metro 0.80.3 → 0.80.5
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.80.
|
|
3
|
+
"version": "0.80.5",
|
|
4
4
|
"description": "🚇 The JavaScript bundler for React Native.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": "src/cli.js",
|
|
@@ -34,19 +34,18 @@
|
|
|
34
34
|
"jest-worker": "^29.6.3",
|
|
35
35
|
"jsc-safe-url": "^0.2.2",
|
|
36
36
|
"lodash.throttle": "^4.1.1",
|
|
37
|
-
"metro-babel-transformer": "0.80.
|
|
38
|
-
"metro-cache": "0.80.
|
|
39
|
-
"metro-cache-key": "0.80.
|
|
40
|
-
"metro-config": "0.80.
|
|
41
|
-
"metro-core": "0.80.
|
|
42
|
-
"metro-file-map": "0.80.
|
|
43
|
-
"metro-
|
|
44
|
-
"metro-
|
|
45
|
-
"metro-
|
|
46
|
-
"metro-
|
|
47
|
-
"metro-
|
|
48
|
-
"metro-transform-
|
|
49
|
-
"metro-transform-worker": "0.80.3",
|
|
37
|
+
"metro-babel-transformer": "0.80.5",
|
|
38
|
+
"metro-cache": "0.80.5",
|
|
39
|
+
"metro-cache-key": "0.80.5",
|
|
40
|
+
"metro-config": "0.80.5",
|
|
41
|
+
"metro-core": "0.80.5",
|
|
42
|
+
"metro-file-map": "0.80.5",
|
|
43
|
+
"metro-resolver": "0.80.5",
|
|
44
|
+
"metro-runtime": "0.80.5",
|
|
45
|
+
"metro-source-map": "0.80.5",
|
|
46
|
+
"metro-symbolicate": "0.80.5",
|
|
47
|
+
"metro-transform-plugins": "0.80.5",
|
|
48
|
+
"metro-transform-worker": "0.80.5",
|
|
50
49
|
"mime-types": "^2.1.27",
|
|
51
50
|
"node-fetch": "^2.2.0",
|
|
52
51
|
"nullthrows": "^1.1.1",
|
|
@@ -67,8 +66,8 @@
|
|
|
67
66
|
"dedent": "^0.7.0",
|
|
68
67
|
"jest-snapshot": "^29.6.3",
|
|
69
68
|
"jest-snapshot-serializer-raw": "^1.2.0",
|
|
70
|
-
"metro-babel-register": "0.80.
|
|
71
|
-
"metro-memory-fs": "0.80.
|
|
69
|
+
"metro-babel-register": "0.80.5",
|
|
70
|
+
"metro-memory-fs": "0.80.5",
|
|
72
71
|
"mock-req": "^0.2.0",
|
|
73
72
|
"mock-res": "^0.6.0",
|
|
74
73
|
"stack-trace": "^0.0.10"
|
|
@@ -318,7 +318,7 @@ class Graph {
|
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
// Diff dependencies (1/
|
|
321
|
+
// Diff dependencies (1/3): remove dependencies that have changed or been removed.
|
|
322
322
|
let dependenciesRemoved = false;
|
|
323
323
|
for (const [key, prevDependency] of previousDependencies) {
|
|
324
324
|
const curDependency = currentDependencies.get(key);
|
|
@@ -331,7 +331,7 @@ class Graph {
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
// Diff dependencies (2/
|
|
334
|
+
// Diff dependencies (2/3): add dependencies that have changed or been added.
|
|
335
335
|
let dependenciesAdded = false;
|
|
336
336
|
if (!commitOptions.onlyRemove) {
|
|
337
337
|
for (const [key, curDependency] of currentDependencies) {
|
|
@@ -352,11 +352,21 @@ class Graph {
|
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
+
|
|
356
|
+
// Diff dependencies (3/3): detect changes in the ordering of dependency
|
|
357
|
+
// keys, which must be committed even if no other changes were made.
|
|
358
|
+
const previousDependencyKeys = [...previousDependencies.keys()];
|
|
359
|
+
const dependencyKeysChangedOrReordered =
|
|
360
|
+
currentDependencies.size !== previousDependencies.size ||
|
|
361
|
+
[...currentDependencies.keys()].some(
|
|
362
|
+
(currentKey, index) => currentKey !== previousDependencyKeys[index]
|
|
363
|
+
);
|
|
355
364
|
if (
|
|
356
365
|
previousModule != null &&
|
|
357
366
|
!transformOutputMayDiffer(previousModule, nextModule) &&
|
|
358
367
|
!dependenciesRemoved &&
|
|
359
|
-
!dependenciesAdded
|
|
368
|
+
!dependenciesAdded &&
|
|
369
|
+
!dependencyKeysChangedOrReordered
|
|
360
370
|
) {
|
|
361
371
|
// We have not operated on nextModule, so restore previousModule
|
|
362
372
|
// to aid diffing. Don't add this path to delta.touched.
|
|
@@ -421,7 +421,7 @@ export class Graph<T = MixedOutput> {
|
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
// Diff dependencies (1/
|
|
424
|
+
// Diff dependencies (1/3): remove dependencies that have changed or been removed.
|
|
425
425
|
let dependenciesRemoved = false;
|
|
426
426
|
for (const [key, prevDependency] of previousDependencies) {
|
|
427
427
|
const curDependency = currentDependencies.get(key);
|
|
@@ -434,7 +434,7 @@ export class Graph<T = MixedOutput> {
|
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
436
|
|
|
437
|
-
// Diff dependencies (2/
|
|
437
|
+
// Diff dependencies (2/3): add dependencies that have changed or been added.
|
|
438
438
|
let dependenciesAdded = false;
|
|
439
439
|
if (!commitOptions.onlyRemove) {
|
|
440
440
|
for (const [key, curDependency] of currentDependencies) {
|
|
@@ -456,11 +456,21 @@ export class Graph<T = MixedOutput> {
|
|
|
456
456
|
}
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
+
// Diff dependencies (3/3): detect changes in the ordering of dependency
|
|
460
|
+
// keys, which must be committed even if no other changes were made.
|
|
461
|
+
const previousDependencyKeys = [...previousDependencies.keys()];
|
|
462
|
+
const dependencyKeysChangedOrReordered =
|
|
463
|
+
currentDependencies.size !== previousDependencies.size ||
|
|
464
|
+
[...currentDependencies.keys()].some(
|
|
465
|
+
(currentKey, index) => currentKey !== previousDependencyKeys[index],
|
|
466
|
+
);
|
|
467
|
+
|
|
459
468
|
if (
|
|
460
469
|
previousModule != null &&
|
|
461
470
|
!transformOutputMayDiffer(previousModule, nextModule) &&
|
|
462
471
|
!dependenciesRemoved &&
|
|
463
|
-
!dependenciesAdded
|
|
472
|
+
!dependenciesAdded &&
|
|
473
|
+
!dependencyKeysChangedOrReordered
|
|
464
474
|
) {
|
|
465
475
|
// We have not operated on nextModule, so restore previousModule
|
|
466
476
|
// to aid diffing. Don't add this path to delta.touched.
|
package/src/HmrServer.js
CHANGED
|
@@ -175,12 +175,14 @@ class HmrServer {
|
|
|
175
175
|
)
|
|
176
176
|
);
|
|
177
177
|
case "log":
|
|
178
|
-
this._config.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
178
|
+
if (this._config.server.forwardClientLogs) {
|
|
179
|
+
this._config.reporter.update({
|
|
180
|
+
type: "client_log",
|
|
181
|
+
level: data.level,
|
|
182
|
+
data: data.data,
|
|
183
|
+
mode: data.mode,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
184
186
|
break;
|
|
185
187
|
case "log-opt-in":
|
|
186
188
|
client.optedIntoHMR = true;
|
package/src/HmrServer.js.flow
CHANGED
|
@@ -228,12 +228,14 @@ class HmrServer<TClient: Client> {
|
|
|
228
228
|
),
|
|
229
229
|
);
|
|
230
230
|
case 'log':
|
|
231
|
-
this._config.
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
231
|
+
if (this._config.server.forwardClientLogs) {
|
|
232
|
+
this._config.reporter.update({
|
|
233
|
+
type: 'client_log',
|
|
234
|
+
level: data.level,
|
|
235
|
+
data: data.data,
|
|
236
|
+
mode: data.mode,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
237
239
|
break;
|
|
238
240
|
case 'log-opt-in':
|
|
239
241
|
client.optedIntoHMR = true;
|
|
@@ -190,14 +190,6 @@ class DependencyGraph extends EventEmitter {
|
|
|
190
190
|
return nullthrows(this._fileSystem).getAllFiles();
|
|
191
191
|
}
|
|
192
192
|
getSha1(filename) {
|
|
193
|
-
// TODO If it looks like we're trying to get the sha1 from a file located
|
|
194
|
-
// within a Zip archive, then we instead compute the sha1 for what looks
|
|
195
|
-
// like the Zip archive itself.
|
|
196
|
-
|
|
197
|
-
const splitIndex = filename.indexOf(".zip/");
|
|
198
|
-
const containerName =
|
|
199
|
-
splitIndex !== -1 ? filename.slice(0, splitIndex + 4) : filename;
|
|
200
|
-
|
|
201
193
|
// Prior to unstable_enableSymlinks:
|
|
202
194
|
// Calling realpath allows us to get a hash for a given path even when
|
|
203
195
|
// it's a symlink to a file, which prevents Metro from crashing in such a
|
|
@@ -208,8 +200,8 @@ class DependencyGraph extends EventEmitter {
|
|
|
208
200
|
//
|
|
209
201
|
// This is unnecessary with a symlink-aware fileSystem implementation.
|
|
210
202
|
const resolvedPath = this._config.resolver.unstable_enableSymlinks
|
|
211
|
-
?
|
|
212
|
-
: fs.realpathSync(
|
|
203
|
+
? filename
|
|
204
|
+
: fs.realpathSync(filename);
|
|
213
205
|
const sha1 = this._fileSystem.getSha1(resolvedPath);
|
|
214
206
|
if (!sha1) {
|
|
215
207
|
throw new ReferenceError(`SHA-1 for file ${filename} (${resolvedPath}) is not computed.
|
|
@@ -248,14 +248,6 @@ class DependencyGraph extends EventEmitter {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
getSha1(filename: string): string {
|
|
251
|
-
// TODO If it looks like we're trying to get the sha1 from a file located
|
|
252
|
-
// within a Zip archive, then we instead compute the sha1 for what looks
|
|
253
|
-
// like the Zip archive itself.
|
|
254
|
-
|
|
255
|
-
const splitIndex = filename.indexOf('.zip/');
|
|
256
|
-
const containerName =
|
|
257
|
-
splitIndex !== -1 ? filename.slice(0, splitIndex + 4) : filename;
|
|
258
|
-
|
|
259
251
|
// Prior to unstable_enableSymlinks:
|
|
260
252
|
// Calling realpath allows us to get a hash for a given path even when
|
|
261
253
|
// it's a symlink to a file, which prevents Metro from crashing in such a
|
|
@@ -266,8 +258,8 @@ class DependencyGraph extends EventEmitter {
|
|
|
266
258
|
//
|
|
267
259
|
// This is unnecessary with a symlink-aware fileSystem implementation.
|
|
268
260
|
const resolvedPath = this._config.resolver.unstable_enableSymlinks
|
|
269
|
-
?
|
|
270
|
-
: fs.realpathSync(
|
|
261
|
+
? filename
|
|
262
|
+
: fs.realpathSync(filename);
|
|
271
263
|
|
|
272
264
|
const sha1 = this._fileSystem.getSha1(resolvedPath);
|
|
273
265
|
|