From c0e6d2887f6883f090831fb49293ed9c2b33f2e0 Mon Sep 17 00:00:00 2001 From: George Zahariev Date: Thu, 15 Feb 2024 07:00:10 -0800 Subject: [PATCH] Update xplat/js/tools/metro Babel config to use `babel-plugin-syntax-hermes-parser` Summary: `babel-plugin-syntax-hermes-parser` allows us to use the latest Flow syntax. After changes to the plugin SamZ made for version 0.18.1, it only applies to Flow files (leaving TS files to be parsed by Babel): https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md#0181 Reviewed By: robhogan Differential Revision: D53597388 fbshipit-source-id: 461627483a6726377fbdc7a452afb808d1479b75 --- babel.config.js | 1 + package.json | 1 + 2 files changed, 2 insertions(+) diff --git a/babel.config.js b/babel.config.js index 5f643cfd7e..ee5229b0c2 100644 --- a/babel.config.js +++ b/babel.config.js @@ -19,6 +19,7 @@ const fs = require('fs'); import type {BabelCoreOptions} from '@babel/core'; */ const plugins = [ + 'babel-plugin-syntax-hermes-parser', '@babel/plugin-transform-flow-strip-types', '@babel/plugin-transform-modules-commonjs', '@babel/plugin-syntax-class-properties', diff --git a/package.json b/package.json index b93ea6c87a..59453cedb7 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "@typescript-eslint/parser": "^6.7.4", "acorn": "^8.7.1", "babel-jest": "^29.6.3", + "babel-plugin-syntax-hermes-parser": "0.19.1", "chalk": "^4.0.0", "debug": "^2.2.0", "eslint": "^8.23.1",