@react-native/metro-babel-transformer 0.73.12 → 0.74.0-nightly-20231004-2000acc6c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/package.json +3 -4
  2. package/src/index.js +9 -19
  3. package/BUCK +0 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/metro-babel-transformer",
3
- "version": "0.73.12",
3
+ "version": "0.74.0-nightly-20231004-2000acc6c",
4
4
  "description": "Babel transformer for React Native applications.",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -16,9 +16,8 @@
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
18
  "@babel/core": "^7.20.0",
19
- "@react-native/babel-preset": "*",
20
- "babel-preset-fbjs": "^3.4.0",
21
- "hermes-parser": "0.15.0",
19
+ "@react-native/babel-preset": "0.74.0-nightly-20231004-2000acc6c",
20
+ "hermes-parser": "0.16.0",
22
21
  "nullthrows": "^1.1.1"
23
22
  },
24
23
  "peerDependencies": {
package/src/index.js CHANGED
@@ -24,17 +24,13 @@ import type {
24
24
  */
25
25
 
26
26
  const {parseSync, transformFromAstSync} = require('@babel/core');
27
- const inlineRequiresPlugin = require('babel-preset-fbjs/plugins/inline-requires');
28
27
  const crypto = require('crypto');
29
28
  const fs = require('fs');
30
29
  const makeHMRConfig = require('@react-native/babel-preset/src/configs/hmr');
31
30
  const nullthrows = require('nullthrows');
32
31
  const path = require('path');
33
32
 
34
- const cacheKeyParts = [
35
- fs.readFileSync(__filename),
36
- require('babel-preset-fbjs/package.json').version,
37
- ];
33
+ const cacheKeyParts = [fs.readFileSync(__filename)];
38
34
 
39
35
  // TS detection conditions copied from @react-native/babel-preset
40
36
  function isTypeScriptSource(fileName /*: string */) {
@@ -154,17 +150,10 @@ function buildBabelConfig(
154
150
  ...extraConfig,
155
151
  };
156
152
 
157
- // Add extra plugins
158
- const extraPlugins = [];
159
-
160
- if (options.inlineRequires) {
161
- extraPlugins.push(inlineRequiresPlugin);
162
- }
163
-
164
- const withExtrPlugins = (config.plugins = extraPlugins.concat(
165
- config.plugins,
166
- plugins,
167
- ));
153
+ const withExtraPlugins = (config.plugins = [
154
+ ...(config.plugins ?? []),
155
+ ...plugins,
156
+ ]);
168
157
 
169
158
  if (options.dev && options.hot) {
170
159
  // Note: this intentionally doesn't include the path separator because
@@ -177,7 +166,7 @@ function buildBabelConfig(
177
166
 
178
167
  if (mayContainEditableReactComponents) {
179
168
  const hmrConfig = makeHMRConfig();
180
- hmrConfig.plugins = withExtrPlugins.concat(hmrConfig.plugins);
169
+ hmrConfig.plugins = withExtraPlugins.concat(hmrConfig.plugins);
181
170
  config = {...config, ...hmrConfig};
182
171
  }
183
172
  }
@@ -213,12 +202,13 @@ const transform /*: BabelTransformer['transform'] */ = ({
213
202
  // You get this behavior by default when using Babel's `transform` method directly.
214
203
  cloneInputAst: false,
215
204
  };
216
- const sourceAst =
205
+ const sourceAst /*: BabelNodeFile */ =
217
206
  isTypeScriptSource(filename) ||
218
207
  isTSXSource(filename) ||
219
208
  !options.hermesParser
220
209
  ? parseSync(src, babelConfig)
221
- : require('hermes-parser').parse(src, {
210
+ : // $FlowFixMe[incompatible-exact]
211
+ require('hermes-parser').parse(src, {
222
212
  babel: true,
223
213
  sourceType: babelConfig.sourceType,
224
214
  });
package/BUCK DELETED
@@ -1,16 +0,0 @@
1
- load("@fbsource//tools/build_defs/third_party:yarn_defs.bzl", "yarn_workspace")
2
-
3
- oncall("react_native")
4
-
5
- yarn_workspace(
6
- name = "yarn-workspace",
7
- srcs = glob(
8
- ["src/**/*.js"],
9
- exclude = [
10
- "**/__fixtures__/**",
11
- "**/__mocks__/**",
12
- "**/__tests__/**",
13
- ],
14
- ),
15
- visibility = ["PUBLIC"],
16
- )