metro 0.80.1 → 0.80.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 +17 -17
- package/src/Bundler.js.flow +1 -1
- package/src/DeltaBundler/DeltaCalculator.js +1 -1
- package/src/DeltaBundler/DeltaCalculator.js.flow +3 -2
- package/src/DeltaBundler/Graph.js +27 -24
- package/src/DeltaBundler/Graph.js.flow +32 -26
- package/src/DeltaBundler/Serializers/helpers/js.js.flow +1 -1
- package/src/DeltaBundler/Serializers/hmrJSBundle.js +2 -1
- package/src/DeltaBundler/Serializers/hmrJSBundle.js.flow +2 -1
- package/src/DeltaBundler/Serializers/sourceMapGenerator.js.flow +6 -6
- package/src/DeltaBundler/Transformer.js.flow +1 -0
- package/src/DeltaBundler/types.flow.js.flow +1 -1
- package/src/ModuleGraph/worker/collectDependencies.js +1 -1
- package/src/ModuleGraph/worker/collectDependencies.js.flow +1 -1
- package/src/Server/MultipartResponse.js.flow +1 -0
- package/src/Server/symbolicate.js.flow +1 -2
- package/src/Server.js +21 -7
- package/src/Server.js.flow +23 -9
- package/src/commands/build.js.flow +4 -4
- package/src/commands/dependencies.js.flow +1 -1
- package/src/commands/serve.js.flow +1 -1
- package/src/index.flow.js.flow +2 -2
- package/src/integration_tests/basic_bundle/require-context/conflict.js.flow +2 -2
- package/src/integration_tests/basic_bundle/require-context/mode-eager.js.flow +2 -1
- package/src/integration_tests/basic_bundle/require-context/mode-lazy-once.js.flow +2 -1
- package/src/integration_tests/basic_bundle/require-context/mode-lazy.js.flow +2 -1
- package/src/integration_tests/basic_bundle/require-context/mode-sync.js.flow +2 -1
- package/src/lib/contextModule.js +1 -1
- package/src/lib/contextModule.js.flow +3 -2
- package/src/lib/contextModuleTemplates.js +1 -1
- package/src/lib/contextModuleTemplates.js.flow +3 -2
- package/src/lib/reporting.js.flow +2 -2
- package/src/lib/transformHelpers.js.flow +2 -3
- package/src/node-haste/DependencyGraph/ModuleResolution.js.flow +6 -6
- package/src/node-haste/DependencyGraph.js +1 -1
- package/src/node-haste/DependencyGraph.js.flow +6 -6
- package/src/shared/types.flow.js.flow +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metro",
|
|
3
|
-
"version": "0.80.
|
|
3
|
+
"version": "0.80.2",
|
|
4
4
|
"description": "🚇 The JavaScript bundler for React Native.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": "src/cli.js",
|
|
@@ -28,25 +28,25 @@
|
|
|
28
28
|
"denodeify": "^1.2.1",
|
|
29
29
|
"error-stack-parser": "^2.0.6",
|
|
30
30
|
"graceful-fs": "^4.2.4",
|
|
31
|
-
"hermes-parser": "0.
|
|
31
|
+
"hermes-parser": "0.18.0",
|
|
32
32
|
"image-size": "^1.0.2",
|
|
33
33
|
"invariant": "^2.2.4",
|
|
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-minify-terser": "0.80.
|
|
44
|
-
"metro-resolver": "0.80.
|
|
45
|
-
"metro-runtime": "0.80.
|
|
46
|
-
"metro-source-map": "0.80.
|
|
47
|
-
"metro-symbolicate": "0.80.
|
|
48
|
-
"metro-transform-plugins": "0.80.
|
|
49
|
-
"metro-transform-worker": "0.80.
|
|
37
|
+
"metro-babel-transformer": "0.80.2",
|
|
38
|
+
"metro-cache": "0.80.2",
|
|
39
|
+
"metro-cache-key": "0.80.2",
|
|
40
|
+
"metro-config": "0.80.2",
|
|
41
|
+
"metro-core": "0.80.2",
|
|
42
|
+
"metro-file-map": "0.80.2",
|
|
43
|
+
"metro-minify-terser": "0.80.2",
|
|
44
|
+
"metro-resolver": "0.80.2",
|
|
45
|
+
"metro-runtime": "0.80.2",
|
|
46
|
+
"metro-source-map": "0.80.2",
|
|
47
|
+
"metro-symbolicate": "0.80.2",
|
|
48
|
+
"metro-transform-plugins": "0.80.2",
|
|
49
|
+
"metro-transform-worker": "0.80.2",
|
|
50
50
|
"mime-types": "^2.1.27",
|
|
51
51
|
"node-fetch": "^2.2.0",
|
|
52
52
|
"nullthrows": "^1.1.1",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"dedent": "^0.7.0",
|
|
68
68
|
"jest-snapshot": "^29.6.3",
|
|
69
69
|
"jest-snapshot-serializer-raw": "^1.2.0",
|
|
70
|
-
"metro-babel-register": "0.80.
|
|
71
|
-
"metro-memory-fs": "0.80.
|
|
70
|
+
"metro-babel-register": "0.80.2",
|
|
71
|
+
"metro-memory-fs": "0.80.2",
|
|
72
72
|
"mock-req": "^0.2.0",
|
|
73
73
|
"mock-res": "^0.6.0",
|
|
74
74
|
"stack-trace": "^0.0.10"
|
package/src/Bundler.js.flow
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
import type {TransformResultWithSource} from './DeltaBundler';
|
|
15
15
|
import type {TransformOptions} from './DeltaBundler/Worker';
|
|
16
|
-
import type {ConfigT} from 'metro-config/src/configTypes.flow';
|
|
17
16
|
import type EventEmitter from 'events';
|
|
17
|
+
import type {ConfigT} from 'metro-config/src/configTypes.flow';
|
|
18
18
|
|
|
19
19
|
const Transformer = require('./DeltaBundler/Transformer');
|
|
20
20
|
const DependencyGraph = require('./node-haste/DependencyGraph');
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
"use strict";
|
|
13
13
|
|
|
14
|
-
var _path = _interopRequireDefault(require("path"));
|
|
15
14
|
var _Graph = require("./Graph");
|
|
15
|
+
var _path = _interopRequireDefault(require("path"));
|
|
16
16
|
function _interopRequireDefault(obj) {
|
|
17
17
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
18
18
|
}
|
|
@@ -11,12 +11,13 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
import path from 'path';
|
|
15
|
-
import {Graph} from './Graph';
|
|
16
14
|
import type {DeltaResult, Options} from './types.flow';
|
|
17
15
|
import type {RootPerfLogger} from 'metro-config';
|
|
18
16
|
import type {ChangeEventMetadata} from 'metro-file-map';
|
|
19
17
|
|
|
18
|
+
import {Graph} from './Graph';
|
|
19
|
+
import path from 'path';
|
|
20
|
+
|
|
20
21
|
const debug = require('debug')('Metro:DeltaCalculator');
|
|
21
22
|
const {EventEmitter} = require('events');
|
|
22
23
|
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true,
|
|
5
5
|
});
|
|
6
6
|
exports.Graph = void 0;
|
|
7
|
-
var _CountingSet = _interopRequireDefault(require("../lib/CountingSet"));
|
|
8
7
|
var _contextModule = require("../lib/contextModule");
|
|
8
|
+
var _CountingSet = _interopRequireDefault(require("../lib/CountingSet"));
|
|
9
9
|
var path = _interopRequireWildcard(require("path"));
|
|
10
10
|
function _getRequireWildcardCache(nodeInterop) {
|
|
11
11
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -161,7 +161,7 @@ class Graph {
|
|
|
161
161
|
);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
this._collectCycles(delta);
|
|
164
|
+
this._collectCycles(delta, internalOptions);
|
|
165
165
|
const added = new Map();
|
|
166
166
|
for (const path of delta.added) {
|
|
167
167
|
added.set(path, nullthrows(this.dependencies.get(path)));
|
|
@@ -584,6 +584,18 @@ class Graph {
|
|
|
584
584
|
this.#gc.color.set(module.path, "black");
|
|
585
585
|
}
|
|
586
586
|
|
|
587
|
+
// Iterate "children" of the given module - i.e. non-weak / async
|
|
588
|
+
// dependencies having a corresponding inverse dependency.
|
|
589
|
+
*_children(module, options) {
|
|
590
|
+
for (const dependency of module.dependencies.values()) {
|
|
591
|
+
const asyncType = dependency.data.data.asyncType;
|
|
592
|
+
if (asyncType === "weak" || (options.lazy && asyncType != null)) {
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
yield nullthrows(this.dependencies.get(dependency.absolutePath));
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
587
599
|
// Delete an unreachable module (and its outbound edges) from the graph
|
|
588
600
|
// immediately.
|
|
589
601
|
// Called when the reference count of a module has reached 0.
|
|
@@ -624,13 +636,13 @@ class Graph {
|
|
|
624
636
|
}
|
|
625
637
|
|
|
626
638
|
// Collect any unreachable cycles in the graph.
|
|
627
|
-
_collectCycles(delta) {
|
|
639
|
+
_collectCycles(delta, options) {
|
|
628
640
|
// Mark recursively from roots (trial deletion)
|
|
629
641
|
for (const path of this.#gc.possibleCycleRoots) {
|
|
630
642
|
const module = nullthrows(this.dependencies.get(path));
|
|
631
643
|
const color = nullthrows(this.#gc.color.get(path));
|
|
632
644
|
if (color === "purple") {
|
|
633
|
-
this._markGray(module);
|
|
645
|
+
this._markGray(module, options);
|
|
634
646
|
} else {
|
|
635
647
|
this.#gc.possibleCycleRoots.delete(path);
|
|
636
648
|
if (
|
|
@@ -645,7 +657,7 @@ class Graph {
|
|
|
645
657
|
// Scan recursively from roots (undo unsuccessful trial deletions)
|
|
646
658
|
for (const path of this.#gc.possibleCycleRoots) {
|
|
647
659
|
const module = nullthrows(this.dependencies.get(path));
|
|
648
|
-
this._scan(module);
|
|
660
|
+
this._scan(module, options);
|
|
649
661
|
}
|
|
650
662
|
// Collect recursively from roots (free unreachable cycles)
|
|
651
663
|
for (const path of this.#gc.possibleCycleRoots) {
|
|
@@ -654,50 +666,41 @@ class Graph {
|
|
|
654
666
|
this._collectWhite(module, delta);
|
|
655
667
|
}
|
|
656
668
|
}
|
|
657
|
-
_markGray(module) {
|
|
669
|
+
_markGray(module, options) {
|
|
658
670
|
const color = nullthrows(this.#gc.color.get(module.path));
|
|
659
671
|
if (color !== "gray") {
|
|
660
672
|
this.#gc.color.set(module.path, "gray");
|
|
661
|
-
for (const
|
|
662
|
-
const childModule = nullthrows(
|
|
663
|
-
this.dependencies.get(dependency.absolutePath)
|
|
664
|
-
);
|
|
673
|
+
for (const childModule of this._children(module, options)) {
|
|
665
674
|
// The inverse dependency will be restored during the scan phase if this module remains live.
|
|
666
675
|
childModule.inverseDependencies.delete(module.path);
|
|
667
|
-
this._markGray(childModule);
|
|
676
|
+
this._markGray(childModule, options);
|
|
668
677
|
}
|
|
669
678
|
}
|
|
670
679
|
}
|
|
671
|
-
_scan(module) {
|
|
680
|
+
_scan(module, options) {
|
|
672
681
|
const color = nullthrows(this.#gc.color.get(module.path));
|
|
673
682
|
if (color === "gray") {
|
|
674
683
|
if (
|
|
675
684
|
module.inverseDependencies.size > 0 ||
|
|
676
685
|
this.entryPoints.has(module.path)
|
|
677
686
|
) {
|
|
678
|
-
this._scanBlack(module);
|
|
687
|
+
this._scanBlack(module, options);
|
|
679
688
|
} else {
|
|
680
689
|
this.#gc.color.set(module.path, "white");
|
|
681
|
-
for (const
|
|
682
|
-
|
|
683
|
-
this.dependencies.get(dependency.absolutePath)
|
|
684
|
-
);
|
|
685
|
-
this._scan(childModule);
|
|
690
|
+
for (const childModule of this._children(module, options)) {
|
|
691
|
+
this._scan(childModule, options);
|
|
686
692
|
}
|
|
687
693
|
}
|
|
688
694
|
}
|
|
689
695
|
}
|
|
690
|
-
_scanBlack(module) {
|
|
696
|
+
_scanBlack(module, options) {
|
|
691
697
|
this.#gc.color.set(module.path, "black");
|
|
692
|
-
for (const
|
|
693
|
-
const childModule = nullthrows(
|
|
694
|
-
this.dependencies.get(dependency.absolutePath)
|
|
695
|
-
);
|
|
698
|
+
for (const childModule of this._children(module, options)) {
|
|
696
699
|
// The inverse dependency must have been deleted during the mark phase.
|
|
697
700
|
childModule.inverseDependencies.add(module.path);
|
|
698
701
|
const childColor = nullthrows(this.#gc.color.get(childModule.path));
|
|
699
702
|
if (childColor !== "black") {
|
|
700
|
-
this._scanBlack(childModule);
|
|
703
|
+
this._scanBlack(childModule, options);
|
|
701
704
|
}
|
|
702
705
|
}
|
|
703
706
|
}
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
* nodes and entries in the importBundleNodes set.
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
-
import type {RequireContextParams} from '../ModuleGraph/worker/collectDependencies';
|
|
33
32
|
import type {RequireContext} from '../lib/contextModule';
|
|
33
|
+
import type {RequireContextParams} from '../ModuleGraph/worker/collectDependencies';
|
|
34
34
|
import type {
|
|
35
35
|
Dependencies,
|
|
36
36
|
Dependency,
|
|
@@ -42,13 +42,13 @@ import type {
|
|
|
42
42
|
TransformResultDependency,
|
|
43
43
|
} from './types.flow';
|
|
44
44
|
|
|
45
|
-
import CountingSet from '../lib/CountingSet';
|
|
46
45
|
import {
|
|
47
46
|
deriveAbsolutePathFromContext,
|
|
48
47
|
fileMatchesContext,
|
|
49
48
|
} from '../lib/contextModule';
|
|
50
|
-
|
|
49
|
+
import CountingSet from '../lib/CountingSet';
|
|
51
50
|
import * as path from 'path';
|
|
51
|
+
|
|
52
52
|
const invariant = require('invariant');
|
|
53
53
|
const nullthrows = require('nullthrows');
|
|
54
54
|
|
|
@@ -202,7 +202,7 @@ export class Graph<T = MixedOutput> {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
this._collectCycles(delta);
|
|
205
|
+
this._collectCycles(delta, internalOptions);
|
|
206
206
|
|
|
207
207
|
const added = new Map<string, Module<T>>();
|
|
208
208
|
for (const path of delta.added) {
|
|
@@ -709,6 +709,21 @@ export class Graph<T = MixedOutput> {
|
|
|
709
709
|
this.#gc.color.set(module.path, 'black');
|
|
710
710
|
}
|
|
711
711
|
|
|
712
|
+
// Iterate "children" of the given module - i.e. non-weak / async
|
|
713
|
+
// dependencies having a corresponding inverse dependency.
|
|
714
|
+
*_children(
|
|
715
|
+
module: Module<T>,
|
|
716
|
+
options: InternalOptions<T>,
|
|
717
|
+
): Iterator<Module<T>> {
|
|
718
|
+
for (const dependency of module.dependencies.values()) {
|
|
719
|
+
const asyncType = dependency.data.data.asyncType;
|
|
720
|
+
if (asyncType === 'weak' || (options.lazy && asyncType != null)) {
|
|
721
|
+
continue;
|
|
722
|
+
}
|
|
723
|
+
yield nullthrows(this.dependencies.get(dependency.absolutePath));
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
712
727
|
// Delete an unreachable module (and its outbound edges) from the graph
|
|
713
728
|
// immediately.
|
|
714
729
|
// Called when the reference count of a module has reached 0.
|
|
@@ -749,13 +764,13 @@ export class Graph<T = MixedOutput> {
|
|
|
749
764
|
}
|
|
750
765
|
|
|
751
766
|
// Collect any unreachable cycles in the graph.
|
|
752
|
-
_collectCycles(delta: Delta) {
|
|
767
|
+
_collectCycles(delta: Delta, options: InternalOptions<T>) {
|
|
753
768
|
// Mark recursively from roots (trial deletion)
|
|
754
769
|
for (const path of this.#gc.possibleCycleRoots) {
|
|
755
770
|
const module = nullthrows(this.dependencies.get(path));
|
|
756
771
|
const color = nullthrows(this.#gc.color.get(path));
|
|
757
772
|
if (color === 'purple') {
|
|
758
|
-
this._markGray(module);
|
|
773
|
+
this._markGray(module, options);
|
|
759
774
|
} else {
|
|
760
775
|
this.#gc.possibleCycleRoots.delete(path);
|
|
761
776
|
if (
|
|
@@ -770,7 +785,7 @@ export class Graph<T = MixedOutput> {
|
|
|
770
785
|
// Scan recursively from roots (undo unsuccessful trial deletions)
|
|
771
786
|
for (const path of this.#gc.possibleCycleRoots) {
|
|
772
787
|
const module = nullthrows(this.dependencies.get(path));
|
|
773
|
-
this._scan(module);
|
|
788
|
+
this._scan(module, options);
|
|
774
789
|
}
|
|
775
790
|
// Collect recursively from roots (free unreachable cycles)
|
|
776
791
|
for (const path of this.#gc.possibleCycleRoots) {
|
|
@@ -780,52 +795,43 @@ export class Graph<T = MixedOutput> {
|
|
|
780
795
|
}
|
|
781
796
|
}
|
|
782
797
|
|
|
783
|
-
_markGray(module: Module<T>) {
|
|
798
|
+
_markGray(module: Module<T>, options: InternalOptions<T>) {
|
|
784
799
|
const color = nullthrows(this.#gc.color.get(module.path));
|
|
785
800
|
if (color !== 'gray') {
|
|
786
801
|
this.#gc.color.set(module.path, 'gray');
|
|
787
|
-
for (const
|
|
788
|
-
const childModule = nullthrows(
|
|
789
|
-
this.dependencies.get(dependency.absolutePath),
|
|
790
|
-
);
|
|
802
|
+
for (const childModule of this._children(module, options)) {
|
|
791
803
|
// The inverse dependency will be restored during the scan phase if this module remains live.
|
|
792
804
|
childModule.inverseDependencies.delete(module.path);
|
|
793
|
-
this._markGray(childModule);
|
|
805
|
+
this._markGray(childModule, options);
|
|
794
806
|
}
|
|
795
807
|
}
|
|
796
808
|
}
|
|
797
809
|
|
|
798
|
-
_scan(module: Module<T>) {
|
|
810
|
+
_scan(module: Module<T>, options: InternalOptions<T>) {
|
|
799
811
|
const color = nullthrows(this.#gc.color.get(module.path));
|
|
800
812
|
if (color === 'gray') {
|
|
801
813
|
if (
|
|
802
814
|
module.inverseDependencies.size > 0 ||
|
|
803
815
|
this.entryPoints.has(module.path)
|
|
804
816
|
) {
|
|
805
|
-
this._scanBlack(module);
|
|
817
|
+
this._scanBlack(module, options);
|
|
806
818
|
} else {
|
|
807
819
|
this.#gc.color.set(module.path, 'white');
|
|
808
|
-
for (const
|
|
809
|
-
|
|
810
|
-
this.dependencies.get(dependency.absolutePath),
|
|
811
|
-
);
|
|
812
|
-
this._scan(childModule);
|
|
820
|
+
for (const childModule of this._children(module, options)) {
|
|
821
|
+
this._scan(childModule, options);
|
|
813
822
|
}
|
|
814
823
|
}
|
|
815
824
|
}
|
|
816
825
|
}
|
|
817
826
|
|
|
818
|
-
_scanBlack(module: Module<T>) {
|
|
827
|
+
_scanBlack(module: Module<T>, options: InternalOptions<T>) {
|
|
819
828
|
this.#gc.color.set(module.path, 'black');
|
|
820
|
-
for (const
|
|
821
|
-
const childModule = nullthrows(
|
|
822
|
-
this.dependencies.get(dependency.absolutePath),
|
|
823
|
-
);
|
|
829
|
+
for (const childModule of this._children(module, options)) {
|
|
824
830
|
// The inverse dependency must have been deleted during the mark phase.
|
|
825
831
|
childModule.inverseDependencies.add(module.path);
|
|
826
832
|
const childColor = nullthrows(this.#gc.color.get(childModule.path));
|
|
827
833
|
if (childColor !== 'black') {
|
|
828
|
-
this._scanBlack(childModule);
|
|
834
|
+
this._scanBlack(childModule, options);
|
|
829
835
|
}
|
|
830
836
|
}
|
|
831
837
|
}
|
|
@@ -136,7 +136,7 @@ function isJsModule(module: Module<>): boolean {
|
|
|
136
136
|
return module.output.filter(isJsOutput).length > 0;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
function isJsOutput(output: MixedOutput): boolean
|
|
139
|
+
function isJsOutput(output: MixedOutput): boolean {
|
|
140
140
|
return output.type.startsWith('js/');
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -23,7 +23,7 @@ function generateModules(sourceModules, graph, options) {
|
|
|
23
23
|
// Construct a bundle URL for this specific module only
|
|
24
24
|
const getURL = (extension) => {
|
|
25
25
|
options.clientUrl.pathname = path.relative(
|
|
26
|
-
options.projectRoot,
|
|
26
|
+
options.serverRoot ?? options.projectRoot,
|
|
27
27
|
path.join(
|
|
28
28
|
path.dirname(module.path),
|
|
29
29
|
path.basename(module.path, path.extname(module.path)) +
|
|
@@ -59,6 +59,7 @@ function prepareModule(module, graph, options) {
|
|
|
59
59
|
const inverseDependenciesById = Object.create(null);
|
|
60
60
|
Object.keys(inverseDependencies).forEach((path) => {
|
|
61
61
|
// $FlowFixMe[prop-missing]
|
|
62
|
+
// $FlowFixMe[invalid-computed-prop]
|
|
62
63
|
inverseDependenciesById[options.createModuleId(path)] = inverseDependencies[
|
|
63
64
|
path
|
|
64
65
|
].map(options.createModuleId);
|
|
@@ -42,7 +42,7 @@ function generateModules(
|
|
|
42
42
|
// Construct a bundle URL for this specific module only
|
|
43
43
|
const getURL = (extension: 'bundle' | 'map') => {
|
|
44
44
|
options.clientUrl.pathname = path.relative(
|
|
45
|
-
options.projectRoot,
|
|
45
|
+
options.serverRoot ?? options.projectRoot,
|
|
46
46
|
path.join(
|
|
47
47
|
path.dirname(module.path),
|
|
48
48
|
path.basename(module.path, path.extname(module.path)) +
|
|
@@ -87,6 +87,7 @@ function prepareModule(
|
|
|
87
87
|
const inverseDependenciesById = Object.create(null);
|
|
88
88
|
Object.keys(inverseDependencies).forEach((path: string) => {
|
|
89
89
|
// $FlowFixMe[prop-missing]
|
|
90
|
+
// $FlowFixMe[invalid-computed-prop]
|
|
90
91
|
inverseDependenciesById[options.createModuleId(path)] = inverseDependencies[
|
|
91
92
|
path
|
|
92
93
|
].map(options.createModuleId);
|
|
@@ -13,12 +13,6 @@
|
|
|
13
13
|
|
|
14
14
|
import type {Module} from '../types.flow';
|
|
15
15
|
|
|
16
|
-
export type SourceMapGeneratorOptions = $ReadOnly<{
|
|
17
|
-
excludeSource: boolean,
|
|
18
|
-
processModuleFilter: (module: Module<>) => boolean,
|
|
19
|
-
shouldAddToIgnoreList: (module: Module<>) => boolean,
|
|
20
|
-
}>;
|
|
21
|
-
|
|
22
16
|
const getSourceMapInfo = require('./helpers/getSourceMapInfo');
|
|
23
17
|
const {isJsModule} = require('./helpers/js');
|
|
24
18
|
const {
|
|
@@ -26,6 +20,12 @@ const {
|
|
|
26
20
|
fromRawMappingsNonBlocking,
|
|
27
21
|
} = require('metro-source-map');
|
|
28
22
|
|
|
23
|
+
export type SourceMapGeneratorOptions = $ReadOnly<{
|
|
24
|
+
excludeSource: boolean,
|
|
25
|
+
processModuleFilter: (module: Module<>) => boolean,
|
|
26
|
+
shouldAddToIgnoreList: (module: Module<>) => boolean,
|
|
27
|
+
}>;
|
|
28
|
+
|
|
29
29
|
function getSourceMapInfosImpl(
|
|
30
30
|
isBlocking: boolean,
|
|
31
31
|
onDone: ($ReadOnlyArray<ReturnType<typeof getSourceMapInfo>>) => void,
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import type {TransformResult, TransformResultWithSource} from '../DeltaBundler';
|
|
15
15
|
import type {TransformerConfig, TransformOptions} from './Worker';
|
|
16
16
|
import type {ConfigT} from 'metro-config/src/configTypes.flow';
|
|
17
|
+
|
|
17
18
|
import crypto from 'crypto';
|
|
18
19
|
|
|
19
20
|
const getTransformCacheKey = require('./getTransformCacheKey');
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
import type {RequireContextParams} from '../ModuleGraph/worker/collectDependencies';
|
|
15
14
|
import type {RequireContext} from '../lib/contextModule';
|
|
15
|
+
import type {RequireContextParams} from '../ModuleGraph/worker/collectDependencies';
|
|
16
16
|
import type {Graph} from './Graph';
|
|
17
17
|
import type {JsTransformOptions} from 'metro-transform-worker';
|
|
18
18
|
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
"use strict";
|
|
12
12
|
|
|
13
|
-
const crypto = require("crypto");
|
|
14
13
|
const generate = require("@babel/generator").default;
|
|
15
14
|
const template = require("@babel/template").default;
|
|
16
15
|
const traverse = require("@babel/traverse").default;
|
|
17
16
|
const types = require("@babel/types");
|
|
17
|
+
const crypto = require("crypto");
|
|
18
18
|
const nullthrows = require("nullthrows");
|
|
19
19
|
const { isImport } = types;
|
|
20
20
|
/**
|
|
@@ -17,11 +17,11 @@ import type {
|
|
|
17
17
|
AsyncDependencyType,
|
|
18
18
|
} from 'metro/src/DeltaBundler/types.flow.js';
|
|
19
19
|
|
|
20
|
-
const crypto = require('crypto');
|
|
21
20
|
const generate = require('@babel/generator').default;
|
|
22
21
|
const template = require('@babel/template').default;
|
|
23
22
|
const traverse = require('@babel/traverse').default;
|
|
24
23
|
const types = require('@babel/types');
|
|
24
|
+
const crypto = require('crypto');
|
|
25
25
|
const nullthrows = require('nullthrows');
|
|
26
26
|
|
|
27
27
|
const {isImport} = types;
|
|
@@ -11,10 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
import type {
|
|
14
|
-
MetroSourceMapSegmentTuple,
|
|
15
14
|
FBSourceFunctionMap,
|
|
15
|
+
MetroSourceMapSegmentTuple,
|
|
16
16
|
} from '../../../metro-source-map/src/source-map';
|
|
17
|
-
|
|
18
17
|
import type {ExplodedSourceMap} from '../DeltaBundler/Serializers/getExplodedSourceMap';
|
|
19
18
|
import type {ConfigT} from 'metro-config/src/configTypes.flow';
|
|
20
19
|
|
package/src/Server.js
CHANGED
|
@@ -28,11 +28,13 @@ const getGraphId = require("./lib/getGraphId");
|
|
|
28
28
|
const parseOptionsFromUrl = require("./lib/parseOptionsFromUrl");
|
|
29
29
|
const splitBundleOptions = require("./lib/splitBundleOptions");
|
|
30
30
|
const transformHelpers = require("./lib/transformHelpers");
|
|
31
|
+
const {
|
|
32
|
+
UnableToResolveError,
|
|
33
|
+
} = require("./node-haste/DependencyGraph/ModuleResolution");
|
|
31
34
|
const parsePlatformFilePath = require("./node-haste/lib/parsePlatformFilePath");
|
|
35
|
+
const MultipartResponse = require("./Server/MultipartResponse");
|
|
32
36
|
const symbolicate = require("./Server/symbolicate");
|
|
33
37
|
const { codeFrameColumns } = require("@babel/code-frame");
|
|
34
|
-
const MultipartResponse = require("./Server/MultipartResponse");
|
|
35
|
-
const { performance } = require("perf_hooks");
|
|
36
38
|
const debug = require("debug")("Metro:Server");
|
|
37
39
|
const fs = require("graceful-fs");
|
|
38
40
|
const invariant = require("invariant");
|
|
@@ -44,6 +46,7 @@ const {
|
|
|
44
46
|
const mime = require("mime-types");
|
|
45
47
|
const nullthrows = require("nullthrows");
|
|
46
48
|
const path = require("path");
|
|
49
|
+
const { performance } = require("perf_hooks");
|
|
47
50
|
const querystring = require("querystring");
|
|
48
51
|
const url = require("url");
|
|
49
52
|
const noopLogger = {
|
|
@@ -448,11 +451,22 @@ class Server {
|
|
|
448
451
|
* `entryFile` is relative to projectRoot, we need to use resolution function
|
|
449
452
|
* to find the appropriate file with supported extensions.
|
|
450
453
|
*/
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
454
|
+
let resolvedEntryFilePath;
|
|
455
|
+
try {
|
|
456
|
+
resolvedEntryFilePath = await this._resolveRelativePath(entryFile, {
|
|
457
|
+
relativeTo: "server",
|
|
458
|
+
resolverOptions,
|
|
459
|
+
transformOptions,
|
|
460
|
+
});
|
|
461
|
+
} catch (error) {
|
|
462
|
+
const formattedError = formatBundlingError(error);
|
|
463
|
+
const status = error instanceof UnableToResolveError ? 404 : 500;
|
|
464
|
+
res.writeHead(status, {
|
|
465
|
+
"Content-Type": "application/json; charset=UTF-8",
|
|
466
|
+
});
|
|
467
|
+
res.end(JSON.stringify(formattedError));
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
456
470
|
const graphId = getGraphId(resolvedEntryFilePath, transformOptions, {
|
|
457
471
|
unstable_allowRequireContext:
|
|
458
472
|
this._config.transformer.unstable_allowRequireContext,
|
package/src/Server.js.flow
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
import type {StackFrameOutput} from './Server/symbolicate';
|
|
15
14
|
import type {AssetData} from './Assets';
|
|
16
15
|
import type {ExplodedSourceMap} from './DeltaBundler/Serializers/getExplodedSourceMap';
|
|
17
16
|
import type {RamBundleInfo} from './DeltaBundler/Serializers/getRamBundleInfo';
|
|
@@ -25,6 +24,7 @@ import type {
|
|
|
25
24
|
import type {RevisionId} from './IncrementalBundler';
|
|
26
25
|
import type {GraphId} from './lib/getGraphId';
|
|
27
26
|
import type {Reporter} from './lib/reporting';
|
|
27
|
+
import type {StackFrameOutput} from './Server/symbolicate';
|
|
28
28
|
import type {
|
|
29
29
|
BundleOptions,
|
|
30
30
|
GraphOptions,
|
|
@@ -60,11 +60,13 @@ const getGraphId = require('./lib/getGraphId');
|
|
|
60
60
|
const parseOptionsFromUrl = require('./lib/parseOptionsFromUrl');
|
|
61
61
|
const splitBundleOptions = require('./lib/splitBundleOptions');
|
|
62
62
|
const transformHelpers = require('./lib/transformHelpers');
|
|
63
|
+
const {
|
|
64
|
+
UnableToResolveError,
|
|
65
|
+
} = require('./node-haste/DependencyGraph/ModuleResolution');
|
|
63
66
|
const parsePlatformFilePath = require('./node-haste/lib/parsePlatformFilePath');
|
|
67
|
+
const MultipartResponse = require('./Server/MultipartResponse');
|
|
64
68
|
const symbolicate = require('./Server/symbolicate');
|
|
65
69
|
const {codeFrameColumns} = require('@babel/code-frame');
|
|
66
|
-
const MultipartResponse = require('./Server/MultipartResponse');
|
|
67
|
-
const {performance} = require('perf_hooks');
|
|
68
70
|
const debug = require('debug')('Metro:Server');
|
|
69
71
|
const fs = require('graceful-fs');
|
|
70
72
|
const invariant = require('invariant');
|
|
@@ -73,10 +75,10 @@ const {
|
|
|
73
75
|
Logger,
|
|
74
76
|
Logger: {createActionStartEntry, createActionEndEntry, log},
|
|
75
77
|
} = require('metro-core');
|
|
76
|
-
|
|
77
78
|
const mime = require('mime-types');
|
|
78
79
|
const nullthrows = require('nullthrows');
|
|
79
80
|
const path = require('path');
|
|
81
|
+
const {performance} = require('perf_hooks');
|
|
80
82
|
const querystring = require('querystring');
|
|
81
83
|
const url = require('url');
|
|
82
84
|
|
|
@@ -611,11 +613,23 @@ class Server {
|
|
|
611
613
|
* `entryFile` is relative to projectRoot, we need to use resolution function
|
|
612
614
|
* to find the appropriate file with supported extensions.
|
|
613
615
|
*/
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
616
|
+
let resolvedEntryFilePath;
|
|
617
|
+
try {
|
|
618
|
+
resolvedEntryFilePath = await this._resolveRelativePath(entryFile, {
|
|
619
|
+
relativeTo: 'server',
|
|
620
|
+
resolverOptions,
|
|
621
|
+
transformOptions,
|
|
622
|
+
});
|
|
623
|
+
} catch (error) {
|
|
624
|
+
const formattedError = formatBundlingError(error);
|
|
625
|
+
|
|
626
|
+
const status = error instanceof UnableToResolveError ? 404 : 500;
|
|
627
|
+
res.writeHead(status, {
|
|
628
|
+
'Content-Type': 'application/json; charset=UTF-8',
|
|
629
|
+
});
|
|
630
|
+
res.end(JSON.stringify(formattedError));
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
619
633
|
const graphId = getGraphId(resolvedEntryFilePath, transformOptions, {
|
|
620
634
|
unstable_allowRequireContext:
|
|
621
635
|
this._config.transformer.unstable_allowRequireContext,
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
* @oncall react_native
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import
|
|
13
|
-
|
|
12
|
+
import type {RunBuildOptions} from '../index';
|
|
14
13
|
import type {CustomTransformOptions} from 'metro-babel-transformer';
|
|
15
14
|
import type {CustomResolverOptions} from 'metro-resolver';
|
|
16
|
-
import type {RunBuildOptions} from '../index';
|
|
17
|
-
import typeof Yargs from 'yargs';
|
|
18
15
|
import type {ModuleObject} from 'yargs';
|
|
16
|
+
import typeof Yargs from 'yargs';
|
|
17
|
+
|
|
18
|
+
import parseKeyValueParamArray from '../cli/parseKeyValueParamArray';
|
|
19
19
|
|
|
20
20
|
const {makeAsyncCommand} = require('../cli-utils');
|
|
21
21
|
const TerminalReporter = require('../lib/TerminalReporter');
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
14
|
import type {ConfigT} from 'metro-config';
|
|
15
|
-
import typeof Yargs from 'yargs';
|
|
16
15
|
import type {ModuleObject} from 'yargs';
|
|
16
|
+
import typeof Yargs from 'yargs';
|
|
17
17
|
|
|
18
18
|
const {makeAsyncCommand} = require('../cli-utils');
|
|
19
19
|
const Server = require('../Server');
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
import typeof Yargs from 'yargs';
|
|
15
14
|
import type {ModuleObject} from 'yargs';
|
|
15
|
+
import typeof Yargs from 'yargs';
|
|
16
16
|
|
|
17
17
|
const {makeAsyncCommand, watchFile} = require('../cli-utils');
|
|
18
18
|
const {loadConfig, resolveConfig} = require('metro-config');
|
package/src/index.flow.js.flow
CHANGED
|
@@ -11,11 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
import type {HandleFunction} from 'connect';
|
|
15
|
-
import type {CustomResolverOptions} from 'metro-resolver';
|
|
16
14
|
import type {ReadOnlyGraph} from './DeltaBundler';
|
|
17
15
|
import type {ServerOptions} from './Server';
|
|
18
16
|
import type {OutputOptions, RequestOptions} from './shared/types.flow.js';
|
|
17
|
+
import type {HandleFunction} from 'connect';
|
|
19
18
|
import type {Server as HttpServer} from 'http';
|
|
20
19
|
import type {Server as HttpsServer} from 'https';
|
|
21
20
|
import type {
|
|
@@ -24,6 +23,7 @@ import type {
|
|
|
24
23
|
MetroConfig,
|
|
25
24
|
Middleware,
|
|
26
25
|
} from 'metro-config/src/configTypes.flow';
|
|
26
|
+
import type {CustomResolverOptions} from 'metro-resolver';
|
|
27
27
|
import type {CustomTransformOptions} from 'metro-transform-worker';
|
|
28
28
|
import typeof Yargs from 'yargs';
|
|
29
29
|
|
|
@@ -12,9 +12,9 @@ import type {RequireWithContext} from './utils';
|
|
|
12
12
|
|
|
13
13
|
import {copyContextToObject} from './utils';
|
|
14
14
|
|
|
15
|
-
declare var require: RequireWithContext;
|
|
16
|
-
|
|
17
15
|
const normalModule = require('./subdir-conflict');
|
|
16
|
+
|
|
17
|
+
declare var require: RequireWithContext;
|
|
18
18
|
const contextModule = require.context<$FlowFixMe>('./subdir-conflict');
|
|
19
19
|
|
|
20
20
|
function main() {
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
* @flow strict-local
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {copyContextToObject, awaitProperties} from './utils';
|
|
12
11
|
import type {RequireWithContext} from './utils';
|
|
13
12
|
|
|
13
|
+
import {awaitProperties, copyContextToObject} from './utils';
|
|
14
|
+
|
|
14
15
|
declare var require: RequireWithContext;
|
|
15
16
|
|
|
16
17
|
function main() {
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
* @flow strict-local
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {copyContextToObject, awaitProperties} from './utils';
|
|
12
11
|
import type {RequireWithContext} from './utils';
|
|
13
12
|
|
|
13
|
+
import {awaitProperties, copyContextToObject} from './utils';
|
|
14
|
+
|
|
14
15
|
declare var require: RequireWithContext;
|
|
15
16
|
|
|
16
17
|
function main() {
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
* @flow strict-local
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {copyContextToObject, awaitProperties} from './utils';
|
|
12
11
|
import type {RequireWithContext} from './utils';
|
|
13
12
|
|
|
13
|
+
import {awaitProperties, copyContextToObject} from './utils';
|
|
14
|
+
|
|
14
15
|
declare var require: RequireWithContext;
|
|
15
16
|
|
|
16
17
|
function main() {
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
* @flow strict-local
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {copyContextToObject} from './utils';
|
|
12
11
|
import type {RequireWithContext} from './utils';
|
|
13
12
|
|
|
13
|
+
import {copyContextToObject} from './utils';
|
|
14
|
+
|
|
14
15
|
declare var require: RequireWithContext;
|
|
15
16
|
|
|
16
17
|
function main(): mixed {
|
package/src/lib/contextModule.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.deriveAbsolutePathFromContext = deriveAbsolutePathFromContext;
|
|
7
7
|
exports.fileMatchesContext = fileMatchesContext;
|
|
8
8
|
var _crypto = _interopRequireDefault(require("crypto"));
|
|
9
|
-
var _path = _interopRequireDefault(require("path"));
|
|
10
9
|
var _nullthrows = _interopRequireDefault(require("nullthrows"));
|
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
|
11
11
|
function _interopRequireDefault(obj) {
|
|
12
12
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
13
13
|
}
|
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
* @oncall react_native
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import crypto from 'crypto';
|
|
13
|
-
import path from 'path';
|
|
14
12
|
import type {
|
|
15
13
|
ContextMode,
|
|
16
14
|
RequireContextParams,
|
|
17
15
|
} from '../ModuleGraph/worker/collectDependencies';
|
|
16
|
+
|
|
17
|
+
import crypto from 'crypto';
|
|
18
18
|
import nullthrows from 'nullthrows';
|
|
19
|
+
import path from 'path';
|
|
19
20
|
|
|
20
21
|
export type RequireContext = $ReadOnly<{
|
|
21
22
|
/* Should search for files recursively. Optional, default `true` when `require.context` is used */
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true,
|
|
5
5
|
});
|
|
6
6
|
exports.getContextModuleTemplate = getContextModuleTemplate;
|
|
7
|
-
var path = _interopRequireWildcard(require("path"));
|
|
8
7
|
var os = _interopRequireWildcard(require("os"));
|
|
8
|
+
var path = _interopRequireWildcard(require("path"));
|
|
9
9
|
function _getRequireWildcardCache(nodeInterop) {
|
|
10
10
|
if (typeof WeakMap !== "function") return null;
|
|
11
11
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
* @oncall react_native
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import * as path from 'path';
|
|
13
|
-
import * as os from 'os';
|
|
14
12
|
import type {ContextMode} from '../ModuleGraph/worker/collectDependencies';
|
|
15
13
|
|
|
14
|
+
import * as os from 'os';
|
|
15
|
+
import * as path from 'path';
|
|
16
|
+
|
|
16
17
|
function createFileMap(
|
|
17
18
|
modulePath: string,
|
|
18
19
|
files: string[],
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
import type {Terminal} from 'metro-core';
|
|
15
|
+
import type {HealthCheckResult, WatcherStatus} from 'metro-file-map';
|
|
14
16
|
import type {CustomResolverOptions} from 'metro-resolver';
|
|
15
17
|
import type {CustomTransformOptions} from 'metro-transform-worker';
|
|
16
|
-
import type {HealthCheckResult, WatcherStatus} from 'metro-file-map';
|
|
17
|
-
import type {Terminal} from 'metro-core';
|
|
18
18
|
|
|
19
19
|
const chalk = require('chalk');
|
|
20
20
|
const stripAnsi = require('strip-ansi');
|
|
@@ -19,15 +19,14 @@ import type {
|
|
|
19
19
|
TransformResultDependency,
|
|
20
20
|
} from '../DeltaBundler/types.flow';
|
|
21
21
|
import type {TransformOptions} from '../DeltaBundler/Worker';
|
|
22
|
+
import type {ResolverInputOptions} from '../shared/types.flow';
|
|
23
|
+
import type {RequireContext} from './contextModule';
|
|
22
24
|
import type {ConfigT} from 'metro-config/src/configTypes.flow';
|
|
23
25
|
import type {Type} from 'metro-transform-worker';
|
|
24
|
-
import type {RequireContext} from './contextModule';
|
|
25
26
|
|
|
26
27
|
import {getContextModuleTemplate} from './contextModuleTemplates';
|
|
27
28
|
import isAssetFile from 'metro-resolver/src/utils/isAssetFile';
|
|
28
29
|
|
|
29
|
-
import type {ResolverInputOptions} from '../shared/types.flow';
|
|
30
|
-
|
|
31
30
|
type InlineRequiresRaw = {+blockList: {[string]: true, ...}, ...} | boolean;
|
|
32
31
|
|
|
33
32
|
type TransformOptionsWithRawInlines = {
|
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
import type {
|
|
15
|
+
BundlerResolution,
|
|
16
|
+
TransformResultDependency,
|
|
17
|
+
} from '../../DeltaBundler/types.flow';
|
|
18
|
+
import type {Reporter} from '../../lib/reporting';
|
|
19
|
+
import type {ResolverInputOptions} from '../../shared/types.flow';
|
|
14
20
|
import type {
|
|
15
21
|
CustomResolver,
|
|
16
22
|
DoesFileExist,
|
|
@@ -19,7 +25,6 @@ import type {
|
|
|
19
25
|
Resolution,
|
|
20
26
|
ResolveAsset,
|
|
21
27
|
} from 'metro-resolver';
|
|
22
|
-
import type {ResolverInputOptions} from '../../shared/types.flow';
|
|
23
28
|
import type {PackageInfo, PackageJson} from 'metro-resolver/src/types';
|
|
24
29
|
|
|
25
30
|
const {codeFrameColumns} = require('@babel/code-frame');
|
|
@@ -29,11 +34,6 @@ const Resolver = require('metro-resolver');
|
|
|
29
34
|
const createDefaultContext = require('metro-resolver/src/createDefaultContext');
|
|
30
35
|
const path = require('path');
|
|
31
36
|
const util = require('util');
|
|
32
|
-
import type {
|
|
33
|
-
BundlerResolution,
|
|
34
|
-
TransformResultDependency,
|
|
35
|
-
} from '../../DeltaBundler/types.flow';
|
|
36
|
-
import type {Reporter} from '../../lib/reporting';
|
|
37
37
|
|
|
38
38
|
export type DirExistsFn = (filePath: string) => boolean;
|
|
39
39
|
|
|
@@ -12,7 +12,6 @@ var _metroFileMap = require("metro-file-map");
|
|
|
12
12
|
* @oncall react_native
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
const canonicalize = require("metro-core/src/canonicalize");
|
|
16
15
|
const createFileMap = require("./DependencyGraph/createFileMap");
|
|
17
16
|
const { ModuleResolver } = require("./DependencyGraph/ModuleResolution");
|
|
18
17
|
const ModuleCache = require("./ModuleCache");
|
|
@@ -23,6 +22,7 @@ const {
|
|
|
23
22
|
Logger: { createActionStartEntry, createActionEndEntry, log },
|
|
24
23
|
PackageResolutionError,
|
|
25
24
|
} = require("metro-core");
|
|
25
|
+
const canonicalize = require("metro-core/src/canonicalize");
|
|
26
26
|
const { InvalidPackageError } = require("metro-resolver");
|
|
27
27
|
const nullthrows = require("nullthrows");
|
|
28
28
|
const path = require("path");
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
* @oncall react_native
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import type {
|
|
13
|
+
BundlerResolution,
|
|
14
|
+
TransformResultDependency,
|
|
15
|
+
} from '../DeltaBundler/types.flow';
|
|
16
|
+
import type {ResolverInputOptions} from '../shared/types.flow';
|
|
12
17
|
import type Package from './Package';
|
|
13
18
|
import type {ConfigT} from 'metro-config/src/configTypes.flow';
|
|
14
19
|
import type MetroFileMap, {
|
|
@@ -21,7 +26,6 @@ import type MetroFileMap, {
|
|
|
21
26
|
|
|
22
27
|
import {DuplicateHasteCandidatesError} from 'metro-file-map';
|
|
23
28
|
|
|
24
|
-
const canonicalize = require('metro-core/src/canonicalize');
|
|
25
29
|
const createFileMap = require('./DependencyGraph/createFileMap');
|
|
26
30
|
const {ModuleResolver} = require('./DependencyGraph/ModuleResolution');
|
|
27
31
|
const ModuleCache = require('./ModuleCache');
|
|
@@ -32,14 +36,10 @@ const {
|
|
|
32
36
|
Logger: {createActionStartEntry, createActionEndEntry, log},
|
|
33
37
|
PackageResolutionError,
|
|
34
38
|
} = require('metro-core');
|
|
39
|
+
const canonicalize = require('metro-core/src/canonicalize');
|
|
35
40
|
const {InvalidPackageError} = require('metro-resolver');
|
|
36
41
|
const nullthrows = require('nullthrows');
|
|
37
42
|
const path = require('path');
|
|
38
|
-
import type {ResolverInputOptions} from '../shared/types.flow';
|
|
39
|
-
import type {
|
|
40
|
-
BundlerResolution,
|
|
41
|
-
TransformResultDependency,
|
|
42
|
-
} from '../DeltaBundler/types.flow';
|
|
43
43
|
|
|
44
44
|
const NULL_PLATFORM = Symbol();
|
|
45
45
|
|
|
@@ -16,6 +16,7 @@ import type {
|
|
|
16
16
|
TransformInputOptions,
|
|
17
17
|
} from '../DeltaBundler/types.flow';
|
|
18
18
|
import type {TransformProfile} from 'metro-babel-transformer';
|
|
19
|
+
import type {CustomResolverOptions} from 'metro-resolver';
|
|
19
20
|
import type {
|
|
20
21
|
MetroSourceMapSegmentTuple,
|
|
21
22
|
MixedSourceMap,
|
|
@@ -24,7 +25,6 @@ import type {
|
|
|
24
25
|
CustomTransformOptions,
|
|
25
26
|
MinifierOptions,
|
|
26
27
|
} from 'metro-transform-worker';
|
|
27
|
-
import type {CustomResolverOptions} from 'metro-resolver';
|
|
28
28
|
|
|
29
29
|
type BundleType =
|
|
30
30
|
| 'bundle'
|