Skip to content

Commit

Permalink
Upgrade xplat/js + arvr/js to hermes-parser 0.16.0 (#39791)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #39791

Bump `hermes-parser` packages to the latest released version.

Changelog: https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md

Notable changes:
- Upgraded to the lastest version of emscripten for the parser.
- The babel interop logic now more closely matches babel's AST.
  - The biggest change is we now add the `extra.raw` properties to literal nodes, which results in Babel more closely outputting literal sources. e.g. previously the following would happen `1.0` -> `1`, `'foo'` -> `"foo"` and `1n` -> `1` but now the raw source value is preserved.
- Upgraded `prettier-plugin-hermes-parser` to use the latest prettier formatting logic, which causes some minor formatting changes.
- `hermes-parser` no longer fails when the `component` name is used within a function type, e.g. `type Foo = (component: string) => void`.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D49838842

fbshipit-source-id: ebfd2f89852d1bd3b1671ce77f58240d7e17cfbb
  • Loading branch information
pieterv authored and facebook-github-bot committed Oct 4, 2023
1 parent 7f96840 commit 4416de3
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 45 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@
"eslint-plugin-react-native": "^4.0.0",
"eslint-plugin-redundant-undefined": "^0.4.0",
"eslint-plugin-relay": "^1.8.3",
"flow-api-translator": "0.15.0",
"flow-api-translator": "0.16.0",
"flow-bin": "^0.217.2",
"glob": "^7.1.1",
"hermes-eslint": "0.15.0",
"hermes-eslint": "0.16.0",
"inquirer": "^7.1.0",
"jest": "^29.6.3",
"jest-junit": "^10.0.0",
Expand All @@ -98,7 +98,7 @@
"mock-fs": "^5.1.4",
"nullthrows": "^1.1.1",
"prettier": "2.8.8",
"prettier-plugin-hermes-parser": "0.14.0",
"prettier-plugin-hermes-parser": "0.16.0",
"react": "18.2.0",
"react-test-renderer": "18.2.0",
"rimraf": "^3.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-babel-transformer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@babel/core": "^7.20.0",
"@react-native/babel-preset": "*",
"hermes-parser": "0.15.0",
"hermes-parser": "0.16.0",
"nullthrows": "^1.1.1"
},
"peerDependencies": {
Expand Down
5 changes: 3 additions & 2 deletions packages/react-native-babel-transformer/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,13 @@ const transform /*: BabelTransformer['transform'] */ = ({
// You get this behavior by default when using Babel's `transform` method directly.
cloneInputAst: false,
};
const sourceAst =
const sourceAst /*: BabelNodeFile */ =
isTypeScriptSource(filename) ||
isTSXSource(filename) ||
!options.hermesParser
? parseSync(src, babelConfig)
: require('hermes-parser').parse(src, {
: // $FlowFixMe[incompatible-exact]
require('hermes-parser').parse(src, {
babel: true,
sourceType: babelConfig.sourceType,
});
Expand Down
78 changes: 39 additions & 39 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5025,18 +5025,18 @@ flatted@^3.1.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.2.tgz#64bfed5cb68fe3ca78b3eb214ad97b63bedce561"
integrity sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==

flow-api-translator@0.15.0:
version "0.15.0"
resolved "https://registry.yarnpkg.com/flow-api-translator/-/flow-api-translator-0.15.0.tgz#3df5af2d45630251f12782679271dc2533bcf094"
integrity sha512-cH5Fo08kQO0vucJfcQqMAPc2De8ooVX/9AhBUiRDhe+Ob98HOSBJamaiFLgTmC9UVnSyIFRKgpG+RRopHWtjwg==
flow-api-translator@0.16.0:
version "0.16.0"
resolved "https://registry.yarnpkg.com/flow-api-translator/-/flow-api-translator-0.16.0.tgz#c1f9a23ccf756d0b7cc7d168da1dc4203ee4fdc0"
integrity sha512-wIaR2K/NfIa9YllPHO2m6TQPabMFFL8u08ix+aohul0F23+sTQyePGtqOuqWGm63E16sBgh/uPYcsw+/xZoFWA==
dependencies:
"@babel/code-frame" "^7.16.0"
"@typescript-eslint/visitor-keys" "^5.42.0"
flow-enums-runtime "^0.0.6"
hermes-eslint "0.15.0"
hermes-estree "0.15.0"
hermes-parser "0.15.0"
hermes-transform "0.15.0"
hermes-eslint "0.16.0"
hermes-estree "0.16.0"
hermes-parser "0.16.0"
hermes-transform "0.16.0"

flow-bin@^0.217.2:
version "0.217.2"
Expand Down Expand Up @@ -5420,31 +5420,24 @@ has@^1.0.3:
dependencies:
function-bind "^1.1.1"

hermes-eslint@0.15.0:
version "0.15.0"
resolved "https://registry.yarnpkg.com/hermes-eslint/-/hermes-eslint-0.15.0.tgz#4d7495cb5e0e9275a1fb0b465b88fccf0b6d8840"
integrity sha512-Rd12uW9FZdOTDDwpVdYUxZGEApskUzBfKYy9RMtczm2uprX8yviPb9QVSVn2hl+xuRTA7Z0FnqDwOwXGiinsRQ==
hermes-eslint@0.16.0:
version "0.16.0"
resolved "https://registry.yarnpkg.com/hermes-eslint/-/hermes-eslint-0.16.0.tgz#f377e7e0260c82d687f4efedff4ae1a4a193359f"
integrity sha512-8EFCiVY5Sv7fYaje31HgaUIpe5DrRlx8luQ6Cgj9wyVpNpSMoVeoXHsWS2MEA4CHuWKItM1mACB5E4snBQxV/g==
dependencies:
esrecurse "^4.3.0"
hermes-estree "0.15.0"
hermes-parser "0.15.0"

hermes-estree@0.14.0:
version "0.14.0"
resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.14.0.tgz#c663eea1400980802283338a09d0087c448729e7"
integrity sha512-L6M67+0/eSEbt6Ha2XOBFXL++7MR34EOJMgm+j7YCaI4L/jZqrVAg6zYQKzbs1ZCFDLvEQpOgLlapTX4gpFriA==
hermes-estree "0.16.0"
hermes-parser "0.16.0"

hermes-estree@0.15.0:
version "0.15.0"
resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.15.0.tgz#e32f6210ab18c7b705bdcb375f7700f2db15d6ba"
integrity sha512-lLYvAd+6BnOqWdnNbP/Q8xfl8LOGw4wVjfrNd9Gt8eoFzhNBRVD95n4l2ksfMVOoxuVyegs85g83KS9QOsxbVQ==

hermes-parser@0.14.0:
version "0.14.0"
resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.14.0.tgz#edb2e7172fce996d2c8bbba250d140b70cc1aaaf"
integrity sha512-pt+8uRiJhVlErY3fiXB3gKhZ72RxM6E1xRMpvfZ5n6Z5TQKQQXKorgRCRzoe02mmvLKBJFP5nPDGv75MWAgCTw==
dependencies:
hermes-estree "0.14.0"
hermes-estree@0.16.0:
version "0.16.0"
resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.16.0.tgz#e2c76a1e9d5a4d620790b9fe05fb01f2d53da07d"
integrity sha512-XCoTuBU8S+Jg8nFzaqgy6pNEYo0WYkbMmuJldb3svzpJ2SNUYJDg28b1ltoDMo7k3YlJwPRg7ZS3JTWV3DkDZA==

hermes-parser@0.15.0:
version "0.15.0"
Expand All @@ -5453,24 +5446,31 @@ hermes-parser@0.15.0:
dependencies:
hermes-estree "0.15.0"

hermes-parser@0.16.0:
version "0.16.0"
resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.16.0.tgz#92d0a34ff4f9b7ffcb04511dfed0cc19df5038e0"
integrity sha512-tdJJntb45DUpv8j7ybHfq8NfIQgz8AgaD+PVFyfjK+O+v2N5zbsSDtlvQN2uxCghoTkQL86BEs9oi8IPrUE9Pg==
dependencies:
hermes-estree "0.16.0"

hermes-profile-transformer@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/hermes-profile-transformer/-/hermes-profile-transformer-0.0.6.tgz#bd0f5ecceda80dd0ddaae443469ab26fb38fc27b"
integrity sha512-cnN7bQUm65UWOy6cbGcCcZ3rpwW8Q/j4OP5aWRhEry4Z2t2aR1cjrbp0BS+KiBN0smvP1caBgAuxutvyvJILzQ==
dependencies:
source-map "^0.7.3"

hermes-transform@0.15.0:
version "0.15.0"
resolved "https://registry.yarnpkg.com/hermes-transform/-/hermes-transform-0.15.0.tgz#5509cf6993abafbdc32528098d287f5c91eef52c"
integrity sha512-ACGdssuE2mcu/qSwSfie1yWQs5IBRYy7yokPbdCkHd4M0jPqCiQbwrlRzQP0+XgyZPooINXWHxkhsI5Iffhppw==
hermes-transform@0.16.0:
version "0.16.0"
resolved "https://registry.yarnpkg.com/hermes-transform/-/hermes-transform-0.16.0.tgz#f2ba027f558d5c59398f807683ade66adda37b69"
integrity sha512-8jckjt5WG+k/zIFSFe1VyTn4xnAJy9Hdej1/9vx0LUEwHXqCwHSasatwuZiF3oKjXX+q92lc33Nrpv1Ixl1gBw==
dependencies:
"@babel/code-frame" "^7.16.0"
esquery "^1.4.0"
flow-enums-runtime "^0.0.6"
hermes-eslint "0.15.0"
hermes-estree "0.15.0"
hermes-parser "0.15.0"
hermes-eslint "0.16.0"
hermes-estree "0.16.0"
hermes-parser "0.16.0"

homedir-polyfill@^1.0.0, homedir-polyfill@^1.0.1:
version "1.0.3"
Expand Down Expand Up @@ -7756,14 +7756,14 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"

prettier-plugin-hermes-parser@0.14.0:
version "0.14.0"
resolved "https://registry.yarnpkg.com/prettier-plugin-hermes-parser/-/prettier-plugin-hermes-parser-0.14.0.tgz#1b5122c14b949bfae96541bbeb39cdd15962a072"
integrity sha512-L3QtrNCVYUhN56oAvlkSYnwdOPgYxjBo1Fg+ApXTFUSk+b3uKcMlUqo6j0WZk4QKYtTtDwZcTT1Zl9VIF/7nDg==
prettier-plugin-hermes-parser@0.16.0:
version "0.16.0"
resolved "https://registry.yarnpkg.com/prettier-plugin-hermes-parser/-/prettier-plugin-hermes-parser-0.16.0.tgz#4393d43a4a6f4ed976493dccbbb93f62c44215c3"
integrity sha512-J4HdSmlxf3a0nVHVi0G6JJJ7sDVtSb5a+QR52LpiQonpQzMkqgIqyCg+Gt1sGMTJqn19Z0yTHxwCmUicVYXUVg==
dependencies:
hermes-estree "0.14.0"
hermes-parser "0.14.0"
prettier-plugin-hermes-parser "0.14.0"
hermes-estree "0.16.0"
hermes-parser "0.16.0"
prettier-plugin-hermes-parser "0.16.0"

prettier@2.8.8:
version "2.8.8"
Expand Down

0 comments on commit 4416de3

Please sign in to comment.