Skip to content

Commit 32ead0d

Browse files
huntiefacebook-github-bot
authored andcommitted
Substitute babel-preset-fbjs for metro-transform-plugins
Summary: Addresses TODO comment. I noticed this lone reference to `babel-preset-fbjs` (last published 3y ago) while attempting to upgrade our Babel Flow syntax plugin. Changelog: [Internal] Differential Revision: D61014834
1 parent 7b36c02 commit 32ead0d

3 files changed

Lines changed: 28 additions & 54 deletions

File tree

‎jest/preprocessor.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
/* eslint-disable lint/sort-imports */
1616

1717
const metroBabelRegister = require('metro-babel-register');
18+
const metroTransformPlugins = require('metro-transform-plugins');
1819
const nullthrows = require('nullthrows');
1920
const createCacheKeyFunction =
2021
require('@jest/create-cache-key-function').default;
@@ -90,8 +91,7 @@ module.exports = {
9091
ast: true,
9192
retainLines: true,
9293
plugins: [
93-
// TODO(moti): Replace with require('metro-transform-plugins').inlineRequiresPlugin when available in OSS
94-
require('babel-preset-fbjs/plugins/inline-requires'),
94+
metroTransformPlugins.inlineRequiresPlugin,
9595
babelPluginPreventBabelRegister,
9696
],
9797
sourceType: 'module',

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
"babel-plugin-syntax-hermes-parser": "0.23.1",
6060
"babel-plugin-transform-define": "^2.1.2",
6161
"babel-plugin-transform-flow-enums": "^0.0.2",
62-
"babel-preset-fbjs": "^3.4.0",
6362
"chalk": "^4.0.0",
6463
"clang-format": "^1.8.0",
6564
"connect": "^3.6.5",
@@ -88,6 +87,7 @@
8887
"jscodeshift": "^0.14.0",
8988
"metro-babel-register": "^0.80.0",
9089
"metro-memory-fs": "^0.80.0",
90+
"metro-transform-plugins": "^0.80.10",
9191
"micromatch": "^4.0.4",
9292
"mkdirp": "^0.5.1",
9393
"node-fetch": "^2.2.0",

‎yarn.lock‎

Lines changed: 25 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@
586586
"@babel/helper-remap-async-to-generator" "^7.18.9"
587587
"@babel/plugin-syntax-async-generators" "^7.8.4"
588588

589-
"@babel/plugin-proposal-class-properties@^7.0.0", "@babel/plugin-proposal-class-properties@^7.13.0", "@babel/plugin-proposal-class-properties@^7.18.6":
589+
"@babel/plugin-proposal-class-properties@^7.13.0", "@babel/plugin-proposal-class-properties@^7.18.6":
590590
version "7.18.6"
591591
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz#b110f59741895f7ec21a6fff696ec46265c446a3"
592592
integrity sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==
@@ -659,7 +659,7 @@
659659
"@babel/helper-plugin-utils" "^7.18.6"
660660
"@babel/plugin-syntax-numeric-separator" "^7.10.4"
661661

662-
"@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.20.2":
662+
"@babel/plugin-proposal-object-rest-spread@^7.20.2":
663663
version "7.20.7"
664664
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.7.tgz#aa662940ef425779c75534a5c41e9d936edc390a"
665665
integrity sha512-d2S98yCiLxDVmBmE8UjGcfPvNEUbA1U5q5WxaWFUGRzJSVAZqm5W6MbPct0jxnegUZ0niLeNX+IOzEs7wYg9Dg==
@@ -727,7 +727,7 @@
727727
dependencies:
728728
"@babel/helper-plugin-utils" "^7.8.0"
729729

730-
"@babel/plugin-syntax-class-properties@^7.0.0", "@babel/plugin-syntax-class-properties@^7.12.13", "@babel/plugin-syntax-class-properties@^7.8.3":
730+
"@babel/plugin-syntax-class-properties@^7.12.13", "@babel/plugin-syntax-class-properties@^7.8.3":
731731
version "7.12.13"
732732
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10"
733733
integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==
@@ -762,7 +762,7 @@
762762
dependencies:
763763
"@babel/helper-plugin-utils" "^7.8.3"
764764

765-
"@babel/plugin-syntax-flow@^7.0.0", "@babel/plugin-syntax-flow@^7.12.1", "@babel/plugin-syntax-flow@^7.18.0", "@babel/plugin-syntax-flow@^7.18.6":
765+
"@babel/plugin-syntax-flow@^7.12.1", "@babel/plugin-syntax-flow@^7.18.0", "@babel/plugin-syntax-flow@^7.18.6":
766766
version "7.18.6"
767767
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.18.6.tgz#774d825256f2379d06139be0c723c4dd444f3ca1"
768768
integrity sha512-LUbR+KNTBWCUAqRG9ex5Gnzu2IOkt8jRJbHHXFT9q+L9zm7M/QQbEqXyw1n1pohYvOyWC8CjeyjrSaIwiYjK7A==
@@ -790,7 +790,7 @@
790790
dependencies:
791791
"@babel/helper-plugin-utils" "^7.8.0"
792792

793-
"@babel/plugin-syntax-jsx@^7.0.0", "@babel/plugin-syntax-jsx@^7.18.6", "@babel/plugin-syntax-jsx@^7.7.2":
793+
"@babel/plugin-syntax-jsx@^7.18.6", "@babel/plugin-syntax-jsx@^7.7.2":
794794
version "7.18.6"
795795
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz#a8feef63b010150abd97f1649ec296e849943ca0"
796796
integrity sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==
@@ -818,7 +818,7 @@
818818
dependencies:
819819
"@babel/helper-plugin-utils" "^7.10.4"
820820

821-
"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.8.3":
821+
"@babel/plugin-syntax-object-rest-spread@^7.8.3":
822822
version "7.8.3"
823823
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871"
824824
integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==
@@ -895,7 +895,7 @@
895895
"@babel/helper-plugin-utils" "^7.20.2"
896896
"@babel/helper-remap-async-to-generator" "^7.18.9"
897897

898-
"@babel/plugin-transform-block-scoped-functions@^7.0.0", "@babel/plugin-transform-block-scoped-functions@^7.18.6":
898+
"@babel/plugin-transform-block-scoped-functions@^7.18.6":
899899
version "7.18.6"
900900
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.18.6.tgz#9187bf4ba302635b9d70d986ad70f038726216a8"
901901
integrity sha512-ExUcOqpPWnliRcPqves5HJcJOvHvIIWfuS4sroBUenPuMdmW+SMHDakmtS7qOo13sVppmUijqeTv7qqGsvURpQ==
@@ -939,7 +939,7 @@
939939
dependencies:
940940
"@babel/helper-plugin-utils" "^7.18.9"
941941

942-
"@babel/plugin-transform-destructuring@^7.0.0", "@babel/plugin-transform-destructuring@^7.20.0", "@babel/plugin-transform-destructuring@^7.20.2":
942+
"@babel/plugin-transform-destructuring@^7.20.0", "@babel/plugin-transform-destructuring@^7.20.2":
943943
version "7.21.3"
944944
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.21.3.tgz#73b46d0fd11cd6ef57dea8a381b1215f4959d401"
945945
integrity sha512-bp6hwMFzuiE4HqYEyoGJ/V2LeIWn+hLVKc4pnj++E5XQptwhtcGmSayM029d/j2X1bPKGTlsyPwAubuU22KhMA==
@@ -969,7 +969,7 @@
969969
"@babel/helper-builder-binary-assignment-operator-visitor" "^7.18.6"
970970
"@babel/helper-plugin-utils" "^7.18.6"
971971

972-
"@babel/plugin-transform-flow-strip-types@^7.0.0", "@babel/plugin-transform-flow-strip-types@^7.20.0", "@babel/plugin-transform-flow-strip-types@^7.21.0":
972+
"@babel/plugin-transform-flow-strip-types@^7.20.0", "@babel/plugin-transform-flow-strip-types@^7.21.0":
973973
version "7.21.0"
974974
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.21.0.tgz#6aeca0adcb81dc627c8986e770bfaa4d9812aff5"
975975
integrity sha512-FlFA2Mj87a6sDkW4gfGrQQqwY/dLlBAyJa2dJEZ+FHXUVHBflO2wyKvg+OOEzXfrKYIa4HWl0mgmbCzt0cMb7w==
@@ -1008,7 +1008,7 @@
10081008
"@babel/helper-plugin-utils" "^7.24.0"
10091009
"@babel/plugin-syntax-logical-assignment-operators" "^7.10.4"
10101010

1011-
"@babel/plugin-transform-member-expression-literals@^7.0.0", "@babel/plugin-transform-member-expression-literals@^7.18.6":
1011+
"@babel/plugin-transform-member-expression-literals@^7.18.6":
10121012
version "7.18.6"
10131013
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.18.6.tgz#ac9fdc1a118620ac49b7e7a5d2dc177a1bfee88e"
10141014
integrity sha512-qSF1ihLGO3q+/g48k85tUjD033C29TNTVB2paCwZPVmOsjn9pClvYYrM2VeJpBY2bcNkuny0YUyTNRyRxJ54KA==
@@ -1091,7 +1091,7 @@
10911091
"@babel/plugin-syntax-object-rest-spread" "^7.8.3"
10921092
"@babel/plugin-transform-parameters" "^7.24.5"
10931093

1094-
"@babel/plugin-transform-object-super@^7.0.0", "@babel/plugin-transform-object-super@^7.18.6":
1094+
"@babel/plugin-transform-object-super@^7.18.6":
10951095
version "7.18.6"
10961096
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.18.6.tgz#fb3c6ccdd15939b6ff7939944b51971ddc35912c"
10971097
integrity sha512-uvGz6zk+pZoS1aTZrOvrbj6Pp/kK2mp45t2B+bTDre2UgsZZ8EZLSJtUg7m/no0zOJUWgFONpB7Zv9W2tSaFlA==
@@ -1148,7 +1148,7 @@
11481148
"@babel/helper-plugin-utils" "^7.22.5"
11491149
"@babel/plugin-syntax-private-property-in-object" "^7.14.5"
11501150

1151-
"@babel/plugin-transform-property-literals@^7.0.0", "@babel/plugin-transform-property-literals@^7.18.6":
1151+
"@babel/plugin-transform-property-literals@^7.18.6":
11521152
version "7.18.6"
11531153
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.18.6.tgz#e22498903a483448e94e032e9bbb9c5ccbfc93a3"
11541154
integrity sha512-cYcs6qlgafTud3PAzrrRNbQtfpQ8+y/+M5tKmksS9+M1ckbH6kzY8MrexEM9mcA6JDsukE19iIRvAyYl463sMg==
@@ -1236,7 +1236,7 @@
12361236
dependencies:
12371237
"@babel/helper-plugin-utils" "^7.18.6"
12381238

1239-
"@babel/plugin-transform-template-literals@^7.0.0", "@babel/plugin-transform-template-literals@^7.18.9":
1239+
"@babel/plugin-transform-template-literals@^7.18.9":
12401240
version "7.18.9"
12411241
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.18.9.tgz#04ec6f10acdaa81846689d63fae117dd9c243a5e"
12421242
integrity sha512-S8cOWfT82gTezpYOiVaGHrCbhlHgKhQt8XH5ES46P2XWmX92yisoZywf5km75wv5sYcXDUCLMmMxOLCtthDgMA==
@@ -3205,11 +3205,6 @@ babel-plugin-syntax-hermes-parser@0.23.1:
32053205
dependencies:
32063206
hermes-parser "0.23.1"
32073207

3208-
babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0:
3209-
version "7.0.0-beta.0"
3210-
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz#aa213c1435e2bffeb6fca842287ef534ad05d5cf"
3211-
integrity sha512-Xj9XuRuz3nTSbaTXWv3itLOcxyF4oPD8douBBmj7U9BBC6nEBYfyOJYQMf/8PJAFotC62UY5dFfIGEPr7WswzQ==
3212-
32133208
babel-plugin-transform-define@^2.1.2:
32143209
version "2.1.2"
32153210
resolved "https://registry.yarnpkg.com/babel-plugin-transform-define/-/babel-plugin-transform-define-2.1.2.tgz#d23e692cf14c68af90ca81500cd953f84678ca28"
@@ -3243,39 +3238,6 @@ babel-preset-current-node-syntax@^1.0.0:
32433238
"@babel/plugin-syntax-optional-chaining" "^7.8.3"
32443239
"@babel/plugin-syntax-top-level-await" "^7.8.3"
32453240

3246-
babel-preset-fbjs@^3.4.0:
3247-
version "3.4.0"
3248-
resolved "https://registry.yarnpkg.com/babel-preset-fbjs/-/babel-preset-fbjs-3.4.0.tgz#38a14e5a7a3b285a3f3a86552d650dca5cf6111c"
3249-
integrity sha512-9ywCsCvo1ojrw0b+XYk7aFvTH6D9064t0RIL1rtMf3nsa02Xw41MS7sZw216Im35xj/UY0PDBQsa1brUDDF1Ow==
3250-
dependencies:
3251-
"@babel/plugin-proposal-class-properties" "^7.0.0"
3252-
"@babel/plugin-proposal-object-rest-spread" "^7.0.0"
3253-
"@babel/plugin-syntax-class-properties" "^7.0.0"
3254-
"@babel/plugin-syntax-flow" "^7.0.0"
3255-
"@babel/plugin-syntax-jsx" "^7.0.0"
3256-
"@babel/plugin-syntax-object-rest-spread" "^7.0.0"
3257-
"@babel/plugin-transform-arrow-functions" "^7.0.0"
3258-
"@babel/plugin-transform-block-scoped-functions" "^7.0.0"
3259-
"@babel/plugin-transform-block-scoping" "^7.0.0"
3260-
"@babel/plugin-transform-classes" "^7.0.0"
3261-
"@babel/plugin-transform-computed-properties" "^7.0.0"
3262-
"@babel/plugin-transform-destructuring" "^7.0.0"
3263-
"@babel/plugin-transform-flow-strip-types" "^7.0.0"
3264-
"@babel/plugin-transform-for-of" "^7.0.0"
3265-
"@babel/plugin-transform-function-name" "^7.0.0"
3266-
"@babel/plugin-transform-literals" "^7.0.0"
3267-
"@babel/plugin-transform-member-expression-literals" "^7.0.0"
3268-
"@babel/plugin-transform-modules-commonjs" "^7.0.0"
3269-
"@babel/plugin-transform-object-super" "^7.0.0"
3270-
"@babel/plugin-transform-parameters" "^7.0.0"
3271-
"@babel/plugin-transform-property-literals" "^7.0.0"
3272-
"@babel/plugin-transform-react-display-name" "^7.0.0"
3273-
"@babel/plugin-transform-react-jsx" "^7.0.0"
3274-
"@babel/plugin-transform-shorthand-properties" "^7.0.0"
3275-
"@babel/plugin-transform-spread" "^7.0.0"
3276-
"@babel/plugin-transform-template-literals" "^7.0.0"
3277-
babel-plugin-syntax-trailing-function-commas "^7.0.0-beta.0"
3278-
32793241
babel-preset-jest@^29.6.3:
32803242
version "29.6.3"
32813243
resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz#fa05fa510e7d493896d7b0dd2033601c840f171c"
@@ -6705,6 +6667,18 @@ metro-transform-plugins@0.80.3:
67056667
"@babel/traverse" "^7.20.0"
67066668
nullthrows "^1.1.1"
67076669

6670+
metro-transform-plugins@^0.80.10:
6671+
version "0.80.10"
6672+
resolved "https://registry.yarnpkg.com/metro-transform-plugins/-/metro-transform-plugins-0.80.10.tgz#df8f44396154ad0bf151533b9bbcdfdf90fccebb"
6673+
integrity sha512-leAx9gtA+2MHLsCeWK6XTLBbv2fBnNFu/QiYhWzMq8HsOAP4u1xQAU0tSgPs8+1vYO34Plyn79xTLUtQCRSSUQ==
6674+
dependencies:
6675+
"@babel/core" "^7.20.0"
6676+
"@babel/generator" "^7.20.0"
6677+
"@babel/template" "^7.0.0"
6678+
"@babel/traverse" "^7.20.0"
6679+
flow-enums-runtime "^0.0.6"
6680+
nullthrows "^1.1.1"
6681+
67086682
metro-transform-worker@0.80.3:
67096683
version "0.80.3"
67106684
resolved "https://registry.yarnpkg.com/metro-transform-worker/-/metro-transform-worker-0.80.3.tgz#33325ca9da22d2f9dcf6e63c6da608b2fb2ca4cc"

0 commit comments

Comments
 (0)