From 9e7ff3b2ff53227edcbb4c857ff93d919792eb78 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Tue, 12 Nov 2024 07:37:42 -0800 Subject: [PATCH 1/2] Update hermes-parser and related packages in fbsource to 0.25.1 Summary: Bump hermes-parser and related packages to [0.25.1](https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md). Changelog: [Internal] Differential Revision: D65816542 --- package.json | 10 +-- .../eslint-plugin-react-native/package.json | 4 +- packages/eslint-plugin-specs/package.json | 4 +- .../react-native-babel-preset/package.json | 2 +- .../package.json | 2 +- packages/react-native-codegen/package.json | 4 +- packages/react-native/package.json | 2 +- yarn.lock | 75 ++++++++++++------- 8 files changed, 61 insertions(+), 42 deletions(-) diff --git a/package.json b/package.json index d335260a705e93..43eb0a7ec17deb 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@typescript-eslint/parser": "^7.1.1", "ansi-styles": "^4.2.1", "babel-plugin-minify-dead-code-elimination": "^0.5.2", - "babel-plugin-syntax-hermes-parser": "0.24.0", + "babel-plugin-syntax-hermes-parser": "0.25.1", "babel-plugin-transform-define": "^2.1.4", "babel-plugin-transform-flow-enums": "^0.0.2", "chalk": "^4.0.0", @@ -76,11 +76,11 @@ "eslint-plugin-react-native": "^4.0.0", "eslint-plugin-redundant-undefined": "^0.4.0", "eslint-plugin-relay": "^1.8.3", - "flow-api-translator": "0.24.0", + "flow-api-translator": "0.25.1", "flow-bin": "^0.252.0", "glob": "^7.1.1", - "hermes-eslint": "0.24.0", - "hermes-transform": "0.24.0", + "hermes-eslint": "0.25.1", + "hermes-transform": "0.25.1", "inquirer": "^7.1.0", "jest": "^29.6.3", "jest-junit": "^10.0.0", @@ -92,7 +92,7 @@ "node-fetch": "^2.2.0", "nullthrows": "^1.1.1", "prettier": "2.8.8", - "prettier-plugin-hermes-parser": "0.24.0", + "prettier-plugin-hermes-parser": "0.25.1", "react": "18.3.1", "react-test-renderer": "18.3.1", "rimraf": "^3.0.2", diff --git a/packages/eslint-plugin-react-native/package.json b/packages/eslint-plugin-react-native/package.json index 6b4082eaadaa2b..82151c1f614e0c 100644 --- a/packages/eslint-plugin-react-native/package.json +++ b/packages/eslint-plugin-react-native/package.json @@ -18,8 +18,8 @@ "bugs": "https://github.com/facebook/react-native/issues", "main": "index.js", "devDependencies": { - "babel-plugin-syntax-hermes-parser": "0.24.0", - "hermes-eslint": "0.24.0" + "babel-plugin-syntax-hermes-parser": "0.25.1", + "hermes-eslint": "0.25.1" }, "engines": { "node": ">=18" diff --git a/packages/eslint-plugin-specs/package.json b/packages/eslint-plugin-specs/package.json index f65be8030f3f9a..ca94060a48eec1 100644 --- a/packages/eslint-plugin-specs/package.json +++ b/packages/eslint-plugin-specs/package.json @@ -32,8 +32,8 @@ "source-map-support": "0.5.0" }, "devDependencies": { - "babel-plugin-syntax-hermes-parser": "0.24.0", - "hermes-eslint": "0.24.0" + "babel-plugin-syntax-hermes-parser": "0.25.1", + "hermes-eslint": "0.25.1" }, "engines": { "node": ">=18" diff --git a/packages/react-native-babel-preset/package.json b/packages/react-native-babel-preset/package.json index f91baf133f66e5..ba57efc6941582 100644 --- a/packages/react-native-babel-preset/package.json +++ b/packages/react-native-babel-preset/package.json @@ -56,7 +56,7 @@ "@babel/plugin-transform-unicode-regex": "^7.24.7", "@babel/template": "^7.25.0", "@react-native/babel-plugin-codegen": "0.77.0-main", - "babel-plugin-syntax-hermes-parser": "0.24.0", + "babel-plugin-syntax-hermes-parser": "0.25.1", "babel-plugin-transform-flow-enums": "^0.0.2", "react-refresh": "^0.14.0" }, diff --git a/packages/react-native-babel-transformer/package.json b/packages/react-native-babel-transformer/package.json index b7171276b08748..524baafe464a56 100644 --- a/packages/react-native-babel-transformer/package.json +++ b/packages/react-native-babel-transformer/package.json @@ -17,7 +17,7 @@ "dependencies": { "@babel/core": "^7.25.2", "@react-native/babel-preset": "0.77.0-main", - "hermes-parser": "0.24.0", + "hermes-parser": "0.25.1", "nullthrows": "^1.1.1" }, "peerDependencies": { diff --git a/packages/react-native-codegen/package.json b/packages/react-native-codegen/package.json index 3a83aaf7658ccc..80f3e14e658670 100644 --- a/packages/react-native-codegen/package.json +++ b/packages/react-native-codegen/package.json @@ -31,7 +31,7 @@ "dependencies": { "@babel/parser": "^7.25.3", "glob": "^7.1.1", - "hermes-parser": "0.24.0", + "hermes-parser": "0.25.1", "invariant": "^2.2.4", "jscodeshift": "^17.0.0", "nullthrows": "^1.1.1", @@ -49,7 +49,7 @@ "@babel/plugin-transform-flow-strip-types": "^7.25.2", "@babel/preset-env": "^7.25.3", "chalk": "^4.0.0", - "hermes-estree": "0.24.0", + "hermes-estree": "0.25.1", "micromatch": "^4.0.4", "prettier": "2.8.8", "rimraf": "^3.0.2" diff --git a/packages/react-native/package.json b/packages/react-native/package.json index 94c346669df8f3..6481bbaf55fa71 100644 --- a/packages/react-native/package.json +++ b/packages/react-native/package.json @@ -119,7 +119,7 @@ "anser": "^1.4.9", "ansi-regex": "^5.0.0", "babel-jest": "^29.7.0", - "babel-plugin-syntax-hermes-parser": "0.24.0", + "babel-plugin-syntax-hermes-parser": "0.25.1", "base64-js": "^1.5.1", "chalk": "^4.0.0", "commander": "^12.0.0", diff --git a/yarn.lock b/yarn.lock index 7fcc487ef4f9d2..26d36a1f4c9826 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2817,6 +2817,13 @@ babel-plugin-syntax-hermes-parser@0.24.0: dependencies: hermes-parser "0.24.0" +babel-plugin-syntax-hermes-parser@0.25.1: + version "0.25.1" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-hermes-parser/-/babel-plugin-syntax-hermes-parser-0.25.1.tgz#58b539df973427fcfbb5176a3aec7e5dee793cb0" + integrity sha512-IVNpGzboFLfXZUAwkLFcI/bnqVbwky0jP3eBno4HKtqvQJAHBLdgxiG6lQ4to0+Q/YCN3PO0od5NZwIKyY4REQ== + dependencies: + hermes-parser "0.25.1" + babel-plugin-transform-define@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/babel-plugin-transform-define/-/babel-plugin-transform-define-2.1.4.tgz#8f7088211176a55a72788d584ceea9f691a021c1" @@ -4436,19 +4443,19 @@ flatted@^3.2.9: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== -flow-api-translator@0.24.0: - version "0.24.0" - resolved "https://registry.yarnpkg.com/flow-api-translator/-/flow-api-translator-0.24.0.tgz#d70e19d9fcea387a30d6eefee3a35d9d2b0fa244" - integrity sha512-1uUM/3hSbWCsFX7DpgregW9+je49vV398enE/fgYYVvUeRz8qX8Ht4oTn9R173DPhLtfWkFT/bxXO95cTvtQSA== +flow-api-translator@0.25.1: + version "0.25.1" + resolved "https://registry.yarnpkg.com/flow-api-translator/-/flow-api-translator-0.25.1.tgz#5aaf89aecd37384ab8ebdc948fe3afe5f81a7373" + integrity sha512-PI2IXcDUdnEZ5yErIhai4Ipufw0GpnIm/mrNNlbz07l8Lkzr72l4ycbo9mZx98+SV+wl84QLn8Gpt4uKxrM/kQ== dependencies: "@babel/code-frame" "^7.16.0" "@typescript-eslint/parser" "7.2.0" "@typescript-eslint/visitor-keys" "7.2.0" flow-enums-runtime "^0.0.6" - hermes-eslint "0.24.0" - hermes-estree "0.24.0" - hermes-parser "0.24.0" - hermes-transform "0.24.0" + hermes-eslint "0.25.1" + hermes-estree "0.25.1" + hermes-parser "0.25.1" + hermes-transform "0.25.1" typescript "5.3.2" flow-bin@^0.252.0: @@ -4850,20 +4857,25 @@ hasown@^2.0.0, hasown@^2.0.1, hasown@^2.0.2: dependencies: function-bind "^1.1.2" -hermes-eslint@0.24.0: - version "0.24.0" - resolved "https://registry.yarnpkg.com/hermes-eslint/-/hermes-eslint-0.24.0.tgz#a86b723bfb0d12ac3031b66c4b861f0ff2d582f3" - integrity sha512-PS/b1MO7NxVBwnxaPvcd3MGsXlt7B0S9gfL7mIbMDIf1A0tYsR09/i/Sl8BHhMX9zb99h499b4POitmr8soQFQ== +hermes-eslint@0.25.1: + version "0.25.1" + resolved "https://registry.yarnpkg.com/hermes-eslint/-/hermes-eslint-0.25.1.tgz#e7d2d845256705d5e2d5cf69dc79032ac3921bb3" + integrity sha512-nPz9+oyejT1zsIwoJ2pWdUvLcN1i+tbaWCOD8PpNBYQtnHXaPXImZp/6zZHnm3bo/DoFcAgh8+SNcxLFxh7m/A== dependencies: esrecurse "^4.3.0" - hermes-estree "0.24.0" - hermes-parser "0.24.0" + hermes-estree "0.25.1" + hermes-parser "0.25.1" hermes-estree@0.24.0: version "0.24.0" resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.24.0.tgz#487dc1ddc0bae698c2d79f34153ac9bf62d7b3c0" integrity sha512-LyoXLB7IFzeZW0EvAbGZacbxBN7t6KKSDqFJPo3Ydow7wDlrDjXwsdiAHV6XOdvEN9MEuWXsSIFN4tzpyrXIHw== +hermes-estree@0.25.1: + version "0.25.1" + resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.25.1.tgz#6aeec17d1983b4eabf69721f3aa3eb705b17f480" + integrity sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw== + hermes-parser@0.24.0: version "0.24.0" resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.24.0.tgz#2ed19d079efc0848eb1f800f0c393a074c4696fb" @@ -4871,17 +4883,24 @@ hermes-parser@0.24.0: dependencies: hermes-estree "0.24.0" -hermes-transform@0.24.0: - version "0.24.0" - resolved "https://registry.yarnpkg.com/hermes-transform/-/hermes-transform-0.24.0.tgz#bf7693978b8f2d94f79c3a6700018b21ec08233e" - integrity sha512-ZK0FowpvYY8Ajz8sIrzmk4VlRBJlFlRhFGciXxUVBAA0UF3CzsE3mI1i7Cqf8h5A0d0OIE66cXqosm9qRhsEzQ== +hermes-parser@0.25.1: + version "0.25.1" + resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.25.1.tgz#5be0e487b2090886c62bd8a11724cd766d5f54d1" + integrity sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA== + dependencies: + hermes-estree "0.25.1" + +hermes-transform@0.25.1: + version "0.25.1" + resolved "https://registry.yarnpkg.com/hermes-transform/-/hermes-transform-0.25.1.tgz#78a4e82605269447d68426dc3d003e24dca89b7f" + integrity sha512-KSFRTAygJPclP7DMdQrmNrJaUn/h/tA7WSvP8USNK77L5ZSiyFv0019XcrVtlnYUoiEAp4591yD9L8s1d8/qqQ== dependencies: "@babel/code-frame" "^7.16.0" esquery "^1.4.0" flow-enums-runtime "^0.0.6" - hermes-eslint "0.24.0" - hermes-estree "0.24.0" - hermes-parser "0.24.0" + hermes-eslint "0.25.1" + hermes-estree "0.25.1" + hermes-parser "0.25.1" string-width "4.2.3" homedir-polyfill@^1.0.0, homedir-polyfill@^1.0.1: @@ -7211,14 +7230,14 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier-plugin-hermes-parser@0.24.0: - version "0.24.0" - resolved "https://registry.yarnpkg.com/prettier-plugin-hermes-parser/-/prettier-plugin-hermes-parser-0.24.0.tgz#b6a03a2d88e0320d05fc788598b1f0e21e9f7eb6" - integrity sha512-5ocvjexclFaU/qaiw3EW36G5I3H5iX8FQKNWwbls3qXVdzWGMaHNt61xxMzne0E9Unpk9EpMzpijGxgPGb94pw== +prettier-plugin-hermes-parser@0.25.1: + version "0.25.1" + resolved "https://registry.yarnpkg.com/prettier-plugin-hermes-parser/-/prettier-plugin-hermes-parser-0.25.1.tgz#f7e82357f7fdcf5fcdf9e06dcc3bbafe03ed61eb" + integrity sha512-qVsgSt1ZLz7sxQyMmLM3b8JYIcUt4pkE+OCMEoUTe5G87ghNe9lluYMy7ptu1h0f3fAZ+zkifUV3JojMmQcKkg== dependencies: - hermes-estree "0.24.0" - hermes-parser "0.24.0" - prettier-plugin-hermes-parser "0.24.0" + hermes-estree "0.25.1" + hermes-parser "0.25.1" + prettier-plugin-hermes-parser "0.25.1" prettier@2.8.8: version "2.8.8" From 2c8d037d0630825de378fc6b110bdec744a1d3e2 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Tue, 12 Nov 2024 07:53:31 -0800 Subject: [PATCH 2/2] Skip hermes-parser under Babel for non-Flow JS code (#47568) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47568 Resolves https://github.com/facebook/hermes/issues/1549. Changelog: [General][Fixed] - When using Babel with plain JavaScript files, support for additional user syntax plugins should be fixed (now uses Babel's parser instead of hermes-parser). There is no change for JS files annotated with `flow`, where extended JS syntax remains unsupported. Differential Revision: D65816797 --- packages/react-native-babel-preset/src/configs/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-babel-preset/src/configs/main.js b/packages/react-native-babel-preset/src/configs/main.js index c3b7f9d914224a..077e1a68b02287 100644 --- a/packages/react-native-babel-preset/src/configs/main.js +++ b/packages/react-native-babel-preset/src/configs/main.js @@ -25,7 +25,7 @@ function isTSXSource(fileName) { const loose = true; const defaultPlugins = [ - [require('babel-plugin-syntax-hermes-parser')], + [require('babel-plugin-syntax-hermes-parser'), {parseLangTypes: 'flow'}], [require('babel-plugin-transform-flow-enums')], [require('@babel/plugin-transform-block-scoping')], [require('@babel/plugin-transform-class-properties'), {loose}],