metro 0.69.1 → 0.70.2

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",
3
- "version": "0.69.1",
3
+ "version": "0.70.2",
4
4
  "description": "🚇 The JavaScript bundler for React Native.",
5
5
  "main": "src/index.js",
6
6
  "bin": "src/cli.js",
@@ -22,7 +22,7 @@
22
22
  "@babel/types": "^7.0.0",
23
23
  "absolute-path": "^0.0.0",
24
24
  "accepts": "^1.3.7",
25
- "async": "^2.4.0",
25
+ "async": "^3.2.2",
26
26
  "chalk": "^4.0.0",
27
27
  "ci-info": "^2.0.0",
28
28
  "connect": "^3.6.5",
@@ -30,28 +30,28 @@
30
30
  "denodeify": "^1.2.1",
31
31
  "error-stack-parser": "^2.0.6",
32
32
  "fs-extra": "^1.0.0",
33
- "graceful-fs": "^4.1.3",
33
+ "graceful-fs": "^4.2.4",
34
34
  "hermes-parser": "0.6.0",
35
35
  "image-size": "^0.6.0",
36
36
  "invariant": "^2.2.4",
37
37
  "jest-haste-map": "^27.3.1",
38
- "jest-worker": "^26.0.0",
38
+ "jest-worker": "^27.2.0",
39
39
  "lodash.throttle": "^4.1.1",
40
- "metro-babel-transformer": "0.69.1",
41
- "metro-cache": "0.69.1",
42
- "metro-cache-key": "0.69.1",
43
- "metro-config": "0.69.1",
44
- "metro-core": "0.69.1",
45
- "metro-hermes-compiler": "0.69.1",
46
- "metro-inspector-proxy": "0.69.1",
47
- "metro-minify-uglify": "0.69.1",
48
- "metro-react-native-babel-preset": "0.69.1",
49
- "metro-resolver": "0.69.1",
50
- "metro-runtime": "0.69.1",
51
- "metro-source-map": "0.69.1",
52
- "metro-symbolicate": "0.69.1",
53
- "metro-transform-plugins": "0.69.1",
54
- "metro-transform-worker": "0.69.1",
40
+ "metro-babel-transformer": "0.70.2",
41
+ "metro-cache": "0.70.2",
42
+ "metro-cache-key": "0.70.2",
43
+ "metro-config": "0.70.2",
44
+ "metro-core": "0.70.2",
45
+ "metro-hermes-compiler": "0.70.2",
46
+ "metro-inspector-proxy": "0.70.2",
47
+ "metro-minify-uglify": "0.70.2",
48
+ "metro-react-native-babel-preset": "0.70.2",
49
+ "metro-resolver": "0.70.2",
50
+ "metro-runtime": "0.70.2",
51
+ "metro-source-map": "0.70.2",
52
+ "metro-symbolicate": "0.70.2",
53
+ "metro-transform-plugins": "0.70.2",
54
+ "metro-transform-worker": "0.70.2",
55
55
  "mime-types": "^2.1.27",
56
56
  "node-fetch": "^2.2.0",
57
57
  "nullthrows": "^1.1.1",
@@ -70,9 +70,9 @@
70
70
  "babel-jest": "^26.6.3",
71
71
  "dedent": "^0.7.0",
72
72
  "jest-snapshot": "^26.5.2",
73
- "metro-memory-fs": "0.69.1",
74
- "metro-react-native-babel-preset": "0.69.1",
75
- "metro-react-native-babel-transformer": "0.69.1",
73
+ "metro-memory-fs": "0.70.2",
74
+ "metro-react-native-babel-preset": "0.70.2",
75
+ "metro-react-native-babel-transformer": "0.70.2",
76
76
  "stack-trace": "^0.0.10"
77
77
  },
78
78
  "license": "MIT"
@@ -49,6 +49,7 @@ function baseBytecodeBundle(entryPoint, preModules, graph, options) {
49
49
  projectRoot: options.projectRoot,
50
50
  runBeforeMainModule: options.runBeforeMainModule,
51
51
  runModule: options.runModule,
52
+ serverRoot: options.serverRoot,
52
53
  sourceMapUrl: options.sourceMapUrl,
53
54
  sourceUrl: options.sourceUrl,
54
55
  }
@@ -63,6 +63,7 @@ function baseBytecodeBundle(
63
63
  projectRoot: options.projectRoot,
64
64
  runBeforeMainModule: options.runBeforeMainModule,
65
65
  runModule: options.runModule,
66
+ serverRoot: options.serverRoot,
66
67
  sourceMapUrl: options.sourceMapUrl,
67
68
  sourceUrl: options.sourceUrl,
68
69
  },
@@ -48,6 +48,7 @@ function baseJSBundle(entryPoint, preModules, graph, options) {
48
48
  projectRoot: options.projectRoot,
49
49
  runBeforeMainModule: options.runBeforeMainModule,
50
50
  runModule: options.runModule,
51
+ serverRoot: options.serverRoot,
51
52
  sourceMapUrl: options.sourceMapUrl,
52
53
  sourceUrl: options.sourceUrl,
53
54
  }
@@ -65,6 +65,7 @@ function baseJSBundle(
65
65
  projectRoot: options.projectRoot,
66
66
  runBeforeMainModule: options.runBeforeMainModule,
67
67
  runModule: options.runModule,
68
+ serverRoot: options.serverRoot,
68
69
  sourceMapUrl: options.sourceMapUrl,
69
70
  sourceUrl: options.sourceUrl,
70
71
  },
@@ -9,7 +9,7 @@
9
9
  */
10
10
  "use strict";
11
11
 
12
- const JestWorker = require("jest-worker").default;
12
+ const { Worker: JestWorker } = require("jest-worker");
13
13
 
14
14
  const { Logger } = require("metro-core");
15
15
 
@@ -15,7 +15,7 @@ import type {TransformerConfig, TransformOptions, Worker} from './Worker';
15
15
  import type {ConfigT} from 'metro-config/src/configTypes.flow';
16
16
  import type {Readable} from 'stream';
17
17
 
18
- const JestWorker = require('jest-worker').default;
18
+ const {Worker: JestWorker} = require('jest-worker');
19
19
  const {Logger} = require('metro-core');
20
20
 
21
21
  type WorkerInterface = {|
@@ -129,6 +129,7 @@ export type SerializerOptions = {|
129
129
  +projectRoot: string,
130
130
  +runBeforeMainModule: $ReadOnlyArray<string>,
131
131
  +runModule: boolean,
132
+ +serverRoot: string,
132
133
  +sourceMapUrl: ?string,
133
134
  +sourceUrl: ?string,
134
135
  |};
package/src/Server.js CHANGED
@@ -123,6 +123,8 @@ class Server {
123
123
  }
124
124
 
125
125
  async build(options) {
126
+ var _this$_config$server$;
127
+
126
128
  const {
127
129
  entryFile,
128
130
  graphOptions,
@@ -163,6 +165,11 @@ class Server {
163
165
  sourceMapUrl: serializerOptions.sourceMapUrl,
164
166
  sourceUrl: serializerOptions.sourceUrl,
165
167
  inlineSourceMap: serializerOptions.inlineSourceMap,
168
+ serverRoot:
169
+ (_this$_config$server$ = this._config.server.unstable_serverRoot) !==
170
+ null && _this$_config$server$ !== void 0
171
+ ? _this$_config$server$
172
+ : this._config.projectRoot,
166
173
  };
167
174
  let bundleCode = null;
168
175
  let bundleMap = null;
@@ -204,6 +211,8 @@ class Server {
204
211
  }
205
212
 
206
213
  async getRamBundleInfo(options) {
214
+ var _this$_config$server$2;
215
+
207
216
  const {
208
217
  entryFile,
209
218
  graphOptions,
@@ -247,6 +256,11 @@ class Server {
247
256
  sourceMapUrl: serializerOptions.sourceMapUrl,
248
257
  sourceUrl: serializerOptions.sourceUrl,
249
258
  inlineSourceMap: serializerOptions.inlineSourceMap,
259
+ serverRoot:
260
+ (_this$_config$server$2 = this._config.server.unstable_serverRoot) !==
261
+ null && _this$_config$server$2 !== void 0
262
+ ? _this$_config$server$2
263
+ : this._config.projectRoot,
250
264
  });
251
265
  }
252
266
 
@@ -633,6 +647,8 @@ class Server {
633
647
  serializerOptions,
634
648
  transformOptions,
635
649
  }) => {
650
+ var _this$_config$server$3;
651
+
636
652
  const revPromise = this._bundler.getRevisionByGraphId(graphId);
637
653
 
638
654
  const { delta, revision } = await (revPromise != null
@@ -672,6 +688,12 @@ class Server {
672
688
  sourceMapUrl: serializerOptions.sourceMapUrl,
673
689
  sourceUrl: serializerOptions.sourceUrl,
674
690
  inlineSourceMap: serializerOptions.inlineSourceMap,
691
+ serverRoot:
692
+ (_this$_config$server$3 =
693
+ this._config.server.unstable_serverRoot) !== null &&
694
+ _this$_config$server$3 !== void 0
695
+ ? _this$_config$server$3
696
+ : this._config.projectRoot,
675
697
  }
676
698
  );
677
699
  const bundleCode = typeof bundle === "string" ? bundle : bundle.code;
@@ -745,6 +767,8 @@ class Server {
745
767
  serializerOptions,
746
768
  transformOptions,
747
769
  }) => {
770
+ var _this$_config$server$4;
771
+
748
772
  const revPromise = this._bundler.getRevisionByGraphId(graphId);
749
773
 
750
774
  const { delta, revision } = await (revPromise != null
@@ -776,6 +800,12 @@ class Server {
776
800
  sourceMapUrl: serializerOptions.sourceMapUrl,
777
801
  sourceUrl: serializerOptions.sourceUrl,
778
802
  inlineSourceMap: serializerOptions.inlineSourceMap,
803
+ serverRoot:
804
+ (_this$_config$server$4 =
805
+ this._config.server.unstable_serverRoot) !== null &&
806
+ _this$_config$server$4 !== void 0
807
+ ? _this$_config$server$4
808
+ : this._config.projectRoot,
779
809
  })
780
810
  );
781
811
  return {
@@ -1140,11 +1170,12 @@ class Server {
1140
1170
  };
1141
1171
 
1142
1172
  _getServerRootDir() {
1143
- var _this$_config$server$;
1173
+ var _this$_config$server$5;
1144
1174
 
1145
- return (_this$_config$server$ = this._config.server.unstable_serverRoot) !==
1146
- null && _this$_config$server$ !== void 0
1147
- ? _this$_config$server$
1175
+ return (_this$_config$server$5 =
1176
+ this._config.server.unstable_serverRoot) !== null &&
1177
+ _this$_config$server$5 !== void 0
1178
+ ? _this$_config$server$5
1148
1179
  : this._config.projectRoot;
1149
1180
  }
1150
1181
 
@@ -210,6 +210,8 @@ class Server {
210
210
  sourceMapUrl: serializerOptions.sourceMapUrl,
211
211
  sourceUrl: serializerOptions.sourceUrl,
212
212
  inlineSourceMap: serializerOptions.inlineSourceMap,
213
+ serverRoot:
214
+ this._config.server.unstable_serverRoot ?? this._config.projectRoot,
213
215
  };
214
216
  let bundleCode = null;
215
217
  let bundleMap = null;
@@ -285,6 +287,8 @@ class Server {
285
287
  sourceMapUrl: serializerOptions.sourceMapUrl,
286
288
  sourceUrl: serializerOptions.sourceUrl,
287
289
  inlineSourceMap: serializerOptions.inlineSourceMap,
290
+ serverRoot:
291
+ this._config.server.unstable_serverRoot ?? this._config.projectRoot,
288
292
  });
289
293
  }
290
294
 
@@ -754,6 +758,8 @@ class Server {
754
758
  sourceMapUrl: serializerOptions.sourceMapUrl,
755
759
  sourceUrl: serializerOptions.sourceUrl,
756
760
  inlineSourceMap: serializerOptions.inlineSourceMap,
761
+ serverRoot:
762
+ this._config.server.unstable_serverRoot ?? this._config.projectRoot,
757
763
  },
758
764
  );
759
765
 
@@ -862,6 +868,8 @@ class Server {
862
868
  sourceMapUrl: serializerOptions.sourceMapUrl,
863
869
  sourceUrl: serializerOptions.sourceUrl,
864
870
  inlineSourceMap: serializerOptions.inlineSourceMap,
871
+ serverRoot:
872
+ this._config.server.unstable_serverRoot ?? this._config.projectRoot,
865
873
  }),
866
874
  );
867
875
 
@@ -25,7 +25,7 @@ function getAppendScripts(entryPoint, modules, importBundleNames, options) {
25
25
  if (importBundleNames.size) {
26
26
  const importBundleNamesObject = Object.create(null);
27
27
  importBundleNames.forEach((absolutePath) => {
28
- const bundlePath = path.relative(options.projectRoot, absolutePath);
28
+ const bundlePath = path.relative(options.serverRoot, absolutePath);
29
29
  importBundleNamesObject[options.createModuleId(absolutePath)] =
30
30
  bundlePath.slice(0, -path.extname(bundlePath).length);
31
31
  });
@@ -24,6 +24,7 @@ type Options<T: number | string> = {
24
24
  +getRunModuleStatement: T => string,
25
25
  +inlineSourceMap: ?boolean,
26
26
  +projectRoot: string,
27
+ +serverRoot: string,
27
28
  +runBeforeMainModule: $ReadOnlyArray<string>,
28
29
  +runModule: boolean,
29
30
  +sourceMapUrl: ?string,
@@ -42,7 +43,7 @@ function getAppendScripts<T: number | string>(
42
43
  if (importBundleNames.size) {
43
44
  const importBundleNamesObject = Object.create(null);
44
45
  importBundleNames.forEach(absolutePath => {
45
- const bundlePath = path.relative(options.projectRoot, absolutePath);
46
+ const bundlePath = path.relative(options.serverRoot, absolutePath);
46
47
  importBundleNamesObject[options.createModuleId(absolutePath)] =
47
48
  bundlePath.slice(0, -path.extname(bundlePath).length);
48
49
  });