metro-transform-worker 0.70.2 → 0.71.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metro-transform-worker",
3
- "version": "0.70.2",
3
+ "version": "0.71.1",
4
4
  "description": "🚇 Transform worker for Metro.",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -18,18 +18,18 @@
18
18
  "@babel/parser": "^7.14.0",
19
19
  "@babel/types": "^7.0.0",
20
20
  "babel-preset-fbjs": "^3.4.0",
21
- "metro": "0.70.2",
22
- "metro-babel-transformer": "0.70.2",
23
- "metro-cache": "0.70.2",
24
- "metro-cache-key": "0.70.2",
25
- "metro-hermes-compiler": "0.70.2",
26
- "metro-source-map": "0.70.2",
27
- "metro-transform-plugins": "0.70.2",
21
+ "metro": "0.71.1",
22
+ "metro-babel-transformer": "0.71.1",
23
+ "metro-cache": "0.71.1",
24
+ "metro-cache-key": "0.71.1",
25
+ "metro-hermes-compiler": "0.71.1",
26
+ "metro-source-map": "0.71.1",
27
+ "metro-transform-plugins": "0.71.1",
28
28
  "nullthrows": "^1.1.1"
29
29
  },
30
30
  "devDependencies": {
31
- "metro-memory-fs": "0.70.2",
32
- "metro-minify-uglify": "0.70.2",
33
- "metro-react-native-babel-transformer": "0.70.2"
31
+ "metro-memory-fs": "0.71.1",
32
+ "metro-minify-uglify": "0.71.1",
33
+ "metro-react-native-babel-transformer": "0.71.1"
34
34
  }
35
35
  }
package/src/index.js CHANGED
@@ -586,7 +586,7 @@ module.exports = {
586
586
  require.resolve("metro/src/ModuleGraph/worker/generateImportNames"),
587
587
  require.resolve("metro/src/ModuleGraph/worker/JsFileWrapping"),
588
588
  ...metroTransformPlugins.getTransformPluginCacheKeyFiles(),
589
- ]);
589
+ ]); // $FlowFixMe[unsupported-syntax]
590
590
 
591
591
  const babelTransformer = require(babelTransformerPath);
592
592
 
package/src/index.js.flow CHANGED
@@ -78,7 +78,7 @@ export type Minifier = MinifierOptions =>
78
78
 
79
79
  export type Type = 'script' | 'module' | 'asset';
80
80
 
81
- export type JsTransformerConfig = $ReadOnly<{|
81
+ export type JsTransformerConfig = $ReadOnly<{
82
82
  assetPlugins: $ReadOnlyArray<string>,
83
83
  assetRegistryPath: string,
84
84
  asyncRequireModulePath: string,
@@ -99,11 +99,11 @@ export type JsTransformerConfig = $ReadOnly<{|
99
99
  unstable_disableModuleWrapping: boolean,
100
100
  unstable_disableNormalizePseudoGlobals: boolean,
101
101
  unstable_compactOutput: boolean,
102
- |}>;
102
+ }>;
103
103
 
104
104
  export type {CustomTransformOptions} from 'metro-babel-transformer';
105
105
 
106
- export type JsTransformOptions = $ReadOnly<{|
106
+ export type JsTransformOptions = $ReadOnly<{
107
107
  customTransformOptions?: CustomTransformOptions,
108
108
  dev: boolean,
109
109
  experimentalImportSupport?: boolean,
@@ -117,7 +117,7 @@ export type JsTransformOptions = $ReadOnly<{|
117
117
  type: Type,
118
118
  unstable_disableES6Transforms?: boolean,
119
119
  unstable_transformProfile: TransformProfile,
120
- |}>;
120
+ }>;
121
121
 
122
122
  export type BytecodeFileType =
123
123
  | 'bytecode/module'
@@ -157,20 +157,20 @@ type TransformationContext = $ReadOnly<{
157
157
  options: JsTransformOptions,
158
158
  }>;
159
159
 
160
- export type JsOutput = $ReadOnly<{|
161
- data: $ReadOnly<{|
160
+ export type JsOutput = $ReadOnly<{
161
+ data: $ReadOnly<{
162
162
  code: string,
163
163
  lineCount: number,
164
164
  map: Array<MetroSourceMapSegmentTuple>,
165
165
  functionMap: ?FBSourceFunctionMap,
166
- |}>,
166
+ }>,
167
167
  type: JSFileType,
168
- |}>;
168
+ }>;
169
169
 
170
- export type BytecodeOutput = $ReadOnly<{|
170
+ export type BytecodeOutput = $ReadOnly<{
171
171
  data: HermesCompilerResult,
172
172
  type: BytecodeFileType,
173
- |}>;
173
+ }>;
174
174
 
175
175
  type DependencySplitCondition = $PropertyType<
176
176
  $PropertyType<TransformResultDependency, 'data'>,
@@ -744,6 +744,7 @@ module.exports = {
744
744
  ...metroTransformPlugins.getTransformPluginCacheKeyFiles(),
745
745
  ]);
746
746
 
747
+ // $FlowFixMe[unsupported-syntax]
747
748
  const babelTransformer = require(babelTransformerPath);
748
749
  return [
749
750
  filesKey,
@@ -1,13 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @format
8
- */
9
- "use strict";
10
-
11
- module.exports = function (data, callback) {
12
- callback(null, {});
13
- };
@@ -1,14 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @format
8
- */
9
-
10
- 'use strict';
11
-
12
- module.exports = function (data, callback) {
13
- callback(null, {});
14
- };
@@ -1,329 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`reports filename when encountering unsupported dynamic dependency 1`] = `"local/file.js:Invalid call at line 3: require(a)"`;
4
-
5
- exports[`transforms a module with dependencies 1`] = `
6
- Array [
7
- Array [
8
- 2,
9
- 0,
10
- 1,
11
- 0,
12
- ],
13
- Array [
14
- 6,
15
- 0,
16
- 5,
17
- 0,
18
- ],
19
- Array [
20
- 8,
21
- 0,
22
- 2,
23
- 0,
24
- "require",
25
- ],
26
- Array [
27
- 8,
28
- 2,
29
- 2,
30
- 0,
31
- "require",
32
- ],
33
- Array [
34
- 8,
35
- 13,
36
- 2,
37
- 7,
38
- ],
39
- Array [
40
- 8,
41
- 39,
42
- 2,
43
- 0,
44
- ],
45
- Array [
46
- 10,
47
- 0,
48
- 3,
49
- 0,
50
- "arbitrary",
51
- ],
52
- Array [
53
- 10,
54
- 2,
55
- 3,
56
- 0,
57
- "arbitrary",
58
- ],
59
- Array [
60
- 10,
61
- 11,
62
- 3,
63
- 9,
64
- ],
65
- Array [
66
- 10,
67
- 12,
68
- 3,
69
- 10,
70
- "code",
71
- ],
72
- Array [
73
- 10,
74
- 16,
75
- 3,
76
- 9,
77
- ],
78
- Array [
79
- 10,
80
- 17,
81
- 3,
82
- 0,
83
- ],
84
- Array [
85
- 12,
86
- 0,
87
- 4,
88
- 0,
89
- ],
90
- Array [
91
- 12,
92
- 6,
93
- 4,
94
- 6,
95
- "b",
96
- ],
97
- Array [
98
- 12,
99
- 7,
100
- 4,
101
- 7,
102
- ],
103
- Array [
104
- 12,
105
- 10,
106
- 4,
107
- 10,
108
- "require",
109
- ],
110
- Array [
111
- 12,
112
- 21,
113
- 4,
114
- 17,
115
- ],
116
- Array [
117
- 12,
118
- 45,
119
- 4,
120
- 0,
121
- ],
122
- ]
123
- `;
124
-
125
- exports[`transforms a module with dependencies 2`] = `
126
- Object {
127
- "mappings": "AAA",
128
- "names": Array [
129
- "<global>",
130
- ],
131
- }
132
- `;
133
-
134
- exports[`transforms a simple module 1`] = `
135
- Array [
136
- Array [
137
- 2,
138
- 0,
139
- 1,
140
- 0,
141
- "arbitrary",
142
- ],
143
- Array [
144
- 2,
145
- 2,
146
- 1,
147
- 0,
148
- "arbitrary",
149
- ],
150
- Array [
151
- 2,
152
- 11,
153
- 1,
154
- 9,
155
- ],
156
- Array [
157
- 2,
158
- 12,
159
- 1,
160
- 10,
161
- "code",
162
- ],
163
- Array [
164
- 2,
165
- 16,
166
- 1,
167
- 9,
168
- ],
169
- Array [
170
- 2,
171
- 17,
172
- 1,
173
- 0,
174
- ],
175
- ]
176
- `;
177
-
178
- exports[`transforms a simple module 2`] = `
179
- Object {
180
- "mappings": "AAA",
181
- "names": Array [
182
- "<global>",
183
- ],
184
- }
185
- `;
186
-
187
- exports[`transforms a simple script 1`] = `
188
- Array [
189
- Array [
190
- 2,
191
- 0,
192
- 1,
193
- 0,
194
- "someReallyArbitrary",
195
- ],
196
- Array [
197
- 2,
198
- 2,
199
- 1,
200
- 0,
201
- "someReallyArbitrary",
202
- ],
203
- Array [
204
- 2,
205
- 21,
206
- 1,
207
- 19,
208
- ],
209
- Array [
210
- 2,
211
- 22,
212
- 1,
213
- 20,
214
- "code",
215
- ],
216
- Array [
217
- 2,
218
- 26,
219
- 1,
220
- 19,
221
- ],
222
- Array [
223
- 2,
224
- 27,
225
- 1,
226
- 0,
227
- ],
228
- ]
229
- `;
230
-
231
- exports[`transforms a simple script 2`] = `
232
- Object {
233
- "mappings": "AAA",
234
- "names": Array [
235
- "<global>",
236
- ],
237
- }
238
- `;
239
-
240
- exports[`transforms an es module with asyncToGenerator 1`] = `
241
- "__d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
242
- var _interopRequireDefault = _$$_REQUIRE(_dependencyMap[0], \\"@babel/runtime/helpers/interopRequireDefault\\");
243
-
244
- Object.defineProperty(exports, \\"__esModule\\", {
245
- value: true
246
- });
247
- exports.test = test;
248
-
249
- var _asyncToGenerator2 = _interopRequireDefault(_$$_REQUIRE(_dependencyMap[1], \\"@babel/runtime/helpers/asyncToGenerator\\"));
250
-
251
- function test() {
252
- return _test.apply(this, arguments);
253
- }
254
-
255
- function _test() {
256
- _test = (0, _asyncToGenerator2.default)(function* () {});
257
- return _test.apply(this, arguments);
258
- }
259
- });"
260
- `;
261
-
262
- exports[`transforms an es module with asyncToGenerator 2`] = `
263
- Object {
264
- "mappings": "AAA,OC",
265
- "names": Array [
266
- "<global>",
267
- "test",
268
- ],
269
- }
270
- `;
271
-
272
- exports[`transforms async generators 1`] = `
273
- "__d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
274
- var _interopRequireDefault = _$$_REQUIRE(_dependencyMap[0], \\"@babel/runtime/helpers/interopRequireDefault\\");
275
-
276
- Object.defineProperty(exports, \\"__esModule\\", {
277
- value: true
278
- });
279
- exports.test = test;
280
-
281
- var _awaitAsyncGenerator2 = _interopRequireDefault(_$$_REQUIRE(_dependencyMap[1], \\"@babel/runtime/helpers/awaitAsyncGenerator\\"));
282
-
283
- var _wrapAsyncGenerator2 = _interopRequireDefault(_$$_REQUIRE(_dependencyMap[2], \\"@babel/runtime/helpers/wrapAsyncGenerator\\"));
284
-
285
- function test() {
286
- return _test.apply(this, arguments);
287
- }
288
-
289
- function _test() {
290
- _test = (0, _wrapAsyncGenerator2.default)(function* () {
291
- yield \\"ok\\";
292
- });
293
- return _test.apply(this, arguments);
294
- }
295
- });"
296
- `;
297
-
298
- exports[`transforms import/export syntax when experimental flag is on 1`] = `
299
- Array [
300
- Array [
301
- 4,
302
- 0,
303
- 1,
304
- 0,
305
- ],
306
- Array [
307
- 4,
308
- 6,
309
- 1,
310
- 7,
311
- "c",
312
- ],
313
- Array [
314
- 4,
315
- 7,
316
- 1,
317
- 0,
318
- ],
319
- ]
320
- `;
321
-
322
- exports[`transforms import/export syntax when experimental flag is on 2`] = `
323
- Object {
324
- "mappings": "AAA",
325
- "names": Array [
326
- "<global>",
327
- ],
328
- }
329
- `;