@react-native/metro-babel-transformer 0.73.0-nightly-20230807-2bf59c764 → 0.73.4
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.
- package/BUCK +16 -0
- package/package.json +7 -2
- package/src/index.js +17 -6
package/BUCK
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native/metro-babel-transformer",
|
|
3
|
-
"version": "0.73.
|
|
3
|
+
"version": "0.73.4",
|
|
4
4
|
"description": "Babel transformer for React Native applications.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
"url": "git@github.com:facebook/react-native.git",
|
|
9
9
|
"directory": "packages/react-native-babel-transformer"
|
|
10
10
|
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"prepare-release": "test -d build && rm -rf src.real && mv src src.real && mv build src",
|
|
13
|
+
"cleanup-release": "test ! -e build && mv src build && mv src.real src"
|
|
14
|
+
},
|
|
11
15
|
"keywords": [
|
|
12
16
|
"transformer",
|
|
13
17
|
"react-native",
|
|
@@ -17,7 +21,8 @@
|
|
|
17
21
|
"dependencies": {
|
|
18
22
|
"@babel/core": "^7.20.0",
|
|
19
23
|
"@react-native/babel-preset": "*",
|
|
20
|
-
"
|
|
24
|
+
"babel-preset-fbjs": "^3.4.0",
|
|
25
|
+
"hermes-parser": "0.14.0",
|
|
21
26
|
"nullthrows": "^1.1.1"
|
|
22
27
|
},
|
|
23
28
|
"peerDependencies": {
|
package/src/index.js
CHANGED
|
@@ -24,13 +24,17 @@ import type {
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
const {parseSync, transformFromAstSync} = require('@babel/core');
|
|
27
|
+
const inlineRequiresPlugin = require('babel-preset-fbjs/plugins/inline-requires');
|
|
27
28
|
const crypto = require('crypto');
|
|
28
29
|
const fs = require('fs');
|
|
29
30
|
const makeHMRConfig = require('@react-native/babel-preset/src/configs/hmr');
|
|
30
31
|
const nullthrows = require('nullthrows');
|
|
31
32
|
const path = require('path');
|
|
32
33
|
|
|
33
|
-
const cacheKeyParts = [
|
|
34
|
+
const cacheKeyParts = [
|
|
35
|
+
fs.readFileSync(__filename),
|
|
36
|
+
require('babel-preset-fbjs/package.json').version,
|
|
37
|
+
];
|
|
34
38
|
|
|
35
39
|
// TS detection conditions copied from @react-native/babel-preset
|
|
36
40
|
function isTypeScriptSource(fileName /*: string */) {
|
|
@@ -150,10 +154,17 @@ function buildBabelConfig(
|
|
|
150
154
|
...extraConfig,
|
|
151
155
|
};
|
|
152
156
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
+
));
|
|
157
168
|
|
|
158
169
|
if (options.dev && options.hot) {
|
|
159
170
|
// Note: this intentionally doesn't include the path separator because
|
|
@@ -166,7 +177,7 @@ function buildBabelConfig(
|
|
|
166
177
|
|
|
167
178
|
if (mayContainEditableReactComponents) {
|
|
168
179
|
const hmrConfig = makeHMRConfig();
|
|
169
|
-
hmrConfig.plugins =
|
|
180
|
+
hmrConfig.plugins = withExtrPlugins.concat(hmrConfig.plugins);
|
|
170
181
|
config = {...config, ...hmrConfig};
|
|
171
182
|
}
|
|
172
183
|
}
|