metro 0.65.2 → 0.67.0
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 +27 -27
- package/src/Assets.js +9 -9
- package/src/Assets.js.flow +5 -7
- package/src/Bundler/util.js +17 -15
- package/src/Bundler/util.js.flow +12 -10
- package/src/Bundler.js +22 -9
- package/src/Bundler.js.flow +20 -7
- package/src/DeltaBundler/DeltaCalculator.js +17 -15
- package/src/DeltaBundler/DeltaCalculator.js.flow +9 -7
- package/src/DeltaBundler/Serializers/baseBytecodeBundle.js +13 -13
- package/src/DeltaBundler/Serializers/baseBytecodeBundle.js.flow +6 -7
- package/src/DeltaBundler/Serializers/baseJSBundle.js +4 -4
- package/src/DeltaBundler/Serializers/baseJSBundle.js.flow +4 -4
- package/src/DeltaBundler/Serializers/getAllFiles.js +1 -1
- package/src/DeltaBundler/Serializers/getAllFiles.js.flow +3 -3
- package/src/DeltaBundler/Serializers/getAssets.js +3 -3
- package/src/DeltaBundler/Serializers/getAssets.js.flow +4 -5
- package/src/DeltaBundler/Serializers/getExplodedSourceMap.js +4 -4
- package/src/DeltaBundler/Serializers/getExplodedSourceMap.js.flow +4 -4
- package/src/DeltaBundler/Serializers/getRamBundleInfo.js +20 -20
- package/src/DeltaBundler/Serializers/getRamBundleInfo.js.flow +9 -10
- package/src/DeltaBundler/Serializers/helpers/bytecode.js +11 -11
- package/src/DeltaBundler/Serializers/helpers/bytecode.js.flow +5 -6
- package/src/DeltaBundler/Serializers/helpers/getInlineSourceMappingURL.js +1 -1
- package/src/DeltaBundler/Serializers/helpers/getInlineSourceMappingURL.js.flow +1 -1
- package/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.js +2 -2
- package/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.js.flow +4 -4
- package/src/DeltaBundler/Serializers/helpers/getTransitiveDependencies.js +1 -1
- package/src/DeltaBundler/Serializers/helpers/getTransitiveDependencies.js.flow +1 -1
- package/src/DeltaBundler/Serializers/helpers/js.js +18 -8
- package/src/DeltaBundler/Serializers/helpers/js.js.flow +19 -10
- package/src/DeltaBundler/Serializers/helpers/processBytecodeModules.js +4 -4
- package/src/DeltaBundler/Serializers/helpers/processBytecodeModules.js.flow +3 -3
- package/src/DeltaBundler/Serializers/helpers/processModules.js +4 -4
- package/src/DeltaBundler/Serializers/helpers/processModules.js.flow +3 -3
- package/src/DeltaBundler/Serializers/hmrJSBundle.js +9 -9
- package/src/DeltaBundler/Serializers/hmrJSBundle.js.flow +9 -8
- package/src/DeltaBundler/Serializers/sourceMapGenerator.js +6 -6
- package/src/DeltaBundler/Serializers/sourceMapGenerator.js.flow +3 -4
- package/src/DeltaBundler/Serializers/sourceMapObject.js +5 -5
- package/src/DeltaBundler/Serializers/sourceMapObject.js.flow +4 -4
- package/src/DeltaBundler/Serializers/sourceMapString.js +2 -2
- package/src/DeltaBundler/Serializers/sourceMapString.js.flow +3 -3
- package/src/DeltaBundler/Transformer.js +16 -14
- package/src/DeltaBundler/Transformer.js.flow +15 -15
- package/src/DeltaBundler/Worker.js +8 -11
- package/src/DeltaBundler/Worker.js.flow +8 -11
- package/src/DeltaBundler/WorkerFarm.js +15 -18
- package/src/DeltaBundler/WorkerFarm.js.flow +9 -11
- package/src/DeltaBundler/__fixtures__/hasteImpl.js +2 -2
- package/src/DeltaBundler/computeDelta.js +2 -2
- package/src/DeltaBundler/computeDelta.js.flow +2 -2
- package/src/DeltaBundler/getTransformCacheKey.js +4 -4
- package/src/DeltaBundler/getTransformCacheKey.js.flow +5 -6
- package/src/DeltaBundler/mergeDeltas.js +2 -2
- package/src/DeltaBundler/mergeDeltas.js.flow +1 -1
- package/src/DeltaBundler/traverseDependencies.js +22 -22
- package/src/DeltaBundler/traverseDependencies.js.flow +3 -3
- package/src/DeltaBundler/types.flow.js +1 -1
- package/src/DeltaBundler/types.flow.js.flow +15 -1
- package/src/DeltaBundler.js +5 -5
- package/src/DeltaBundler.js.flow +4 -4
- package/src/HmrServer.js +73 -55
- package/src/HmrServer.js.flow +42 -37
- package/src/IncrementalBundler/GraphNotFoundError.js +1 -1
- package/src/IncrementalBundler/GraphNotFoundError.js.flow +1 -1
- package/src/IncrementalBundler/ResourceNotFoundError.js +1 -1
- package/src/IncrementalBundler/ResourceNotFoundError.js.flow +1 -1
- package/src/IncrementalBundler/RevisionNotFoundError.js +1 -1
- package/src/IncrementalBundler/RevisionNotFoundError.js.flow +1 -1
- package/src/IncrementalBundler.js +46 -32
- package/src/IncrementalBundler.js.flow +32 -24
- package/src/ModuleGraph/module.js +3 -3
- package/src/ModuleGraph/module.js.flow +1 -1
- package/src/ModuleGraph/node-haste/HasteFS.js +5 -3
- package/src/ModuleGraph/node-haste/HasteFS.js.flow +3 -1
- package/src/ModuleGraph/node-haste/Module.js +1 -1
- package/src/ModuleGraph/node-haste/Module.js.flow +1 -1
- package/src/ModuleGraph/node-haste/ModuleCache.js +1 -1
- package/src/ModuleGraph/node-haste/ModuleCache.js.flow +3 -3
- package/src/ModuleGraph/node-haste/Package.js +3 -3
- package/src/ModuleGraph/node-haste/Package.js.flow +3 -3
- package/src/ModuleGraph/node-haste/node-haste.flow.js +1 -1
- package/src/ModuleGraph/node-haste/node-haste.flow.js.flow +1 -1
- package/src/ModuleGraph/node-haste/node-haste.js +41 -31
- package/src/ModuleGraph/node-haste/node-haste.js.flow +28 -22
- package/src/ModuleGraph/output/indexed-ram-bundle.js +17 -17
- package/src/ModuleGraph/output/indexed-ram-bundle.js.flow +41 -9
- package/src/ModuleGraph/output/multiple-files-ram-bundle.js +18 -18
- package/src/ModuleGraph/output/multiple-files-ram-bundle.js.flow +21 -9
- package/src/ModuleGraph/output/plain-bundle.js +6 -6
- package/src/ModuleGraph/output/plain-bundle.js.flow +7 -7
- package/src/ModuleGraph/output/reverse-dependency-map-references.js +3 -3
- package/src/ModuleGraph/output/reverse-dependency-map-references.js.flow +4 -8
- package/src/ModuleGraph/output/util.js +61 -40
- package/src/ModuleGraph/output/util.js.flow +51 -28
- package/src/ModuleGraph/silent-console.js +2 -2
- package/src/ModuleGraph/silent-console.js.flow +1 -1
- package/src/ModuleGraph/test-helpers.js +7 -7
- package/src/ModuleGraph/types.flow.js +1 -1
- package/src/ModuleGraph/types.flow.js.flow +47 -31
- package/src/ModuleGraph/worker/JsFileWrapping.js +16 -16
- package/src/ModuleGraph/worker/JsFileWrapping.js.flow +3 -2
- package/src/ModuleGraph/worker/Platforms.js +2 -2
- package/src/ModuleGraph/worker/Platforms.js.flow +1 -1
- package/src/ModuleGraph/worker/collectDependencies.js +24 -25
- package/src/ModuleGraph/worker/collectDependencies.js.flow +16 -18
- package/src/ModuleGraph/worker/generate.js +2 -2
- package/src/ModuleGraph/worker/generate.js.flow +3 -3
- package/src/ModuleGraph/worker/generateImportNames.js +5 -5
- package/src/ModuleGraph/worker/generateImportNames.js.flow +3 -5
- package/src/ModuleGraph/worker/mergeSourceMaps.js +8 -7
- package/src/ModuleGraph/worker/mergeSourceMaps.js.flow +3 -3
- package/src/Server/MultipartResponse.js +4 -8
- package/src/Server/symbolicate.js +8 -8
- package/src/Server/symbolicate.js.flow +17 -5
- package/src/Server.js +204 -150
- package/src/Server.js.flow +131 -87
- package/src/cli-utils.js +4 -4
- package/src/cli-utils.js.flow +15 -13
- package/src/cli.js +4 -4
- package/src/cli.js.flow +2 -4
- package/src/commands/build.js +23 -24
- package/src/commands/build.js.flow +6 -9
- package/src/commands/dependencies.js +25 -19
- package/src/commands/serve.js +19 -19
- package/src/commands/serve.js.flow +7 -9
- package/src/index.js +117 -50
- package/src/index.js.flow +108 -40
- package/src/integration_tests/basic_bundle/AssetRegistry.js +2 -2
- package/src/integration_tests/basic_bundle/AssetRegistry.js.flow +1 -1
- package/src/integration_tests/basic_bundle/Bar.js +2 -2
- package/src/integration_tests/basic_bundle/Bar.js.flow +1 -1
- package/src/integration_tests/basic_bundle/ErrorBundle.js +2 -2
- package/src/integration_tests/basic_bundle/ErrorBundle.js.flow +1 -1
- package/src/integration_tests/basic_bundle/Foo.js +2 -2
- package/src/integration_tests/basic_bundle/Foo.js.flow +1 -1
- package/src/integration_tests/basic_bundle/TestBundle.js +2 -2
- package/src/integration_tests/basic_bundle/TestBundle.js.flow +1 -1
- package/src/integration_tests/basic_bundle/TestPolyfill.js +1 -1
- package/src/integration_tests/basic_bundle/TestPolyfill.js.flow +1 -1
- package/src/integration_tests/basic_bundle/TypeScript.ts +1 -1
- package/src/integration_tests/basic_bundle/import-export/export-1.js +2 -2
- package/src/integration_tests/basic_bundle/import-export/export-1.js.flow +1 -1
- package/src/integration_tests/basic_bundle/import-export/export-2.js +2 -2
- package/src/integration_tests/basic_bundle/import-export/export-2.js.flow +1 -1
- package/src/integration_tests/basic_bundle/import-export/export-3.js +2 -2
- package/src/integration_tests/basic_bundle/import-export/export-3.js.flow +1 -1
- package/src/integration_tests/basic_bundle/import-export/export-4.js +2 -2
- package/src/integration_tests/basic_bundle/import-export/export-4.js.flow +1 -1
- package/src/integration_tests/basic_bundle/import-export/export-5.js +2 -2
- package/src/integration_tests/basic_bundle/import-export/export-5.js.flow +1 -1
- package/src/integration_tests/basic_bundle/import-export/export-6.js +2 -2
- package/src/integration_tests/basic_bundle/import-export/export-6.js.flow +1 -1
- package/src/integration_tests/basic_bundle/import-export/export-null.js +2 -2
- package/src/integration_tests/basic_bundle/import-export/export-null.js.flow +1 -1
- package/src/integration_tests/basic_bundle/import-export/export-primitive-default.js +2 -2
- package/src/integration_tests/basic_bundle/import-export/export-primitive-default.js.flow +1 -1
- package/src/integration_tests/basic_bundle/import-export/index.js +17 -17
- package/src/integration_tests/basic_bundle/import-export/index.js.flow +1 -1
- package/src/integration_tests/basic_bundle/polyfill.js +1 -1
- package/src/integration_tests/execBundle.js +2 -2
- package/src/integration_tests/execBundle.js.flow +1 -1
- package/src/integration_tests/metro.config.js +8 -8
- package/src/lib/BatchProcessor.js +10 -6
- package/src/lib/BatchProcessor.js.flow +6 -1
- package/src/lib/JsonReporter.js +3 -2
- package/src/lib/JsonReporter.js.flow +2 -1
- package/src/lib/RamBundleParser.js +1 -1
- package/src/lib/RamBundleParser.js.flow +1 -1
- package/src/lib/TerminalReporter.js +15 -15
- package/src/lib/TerminalReporter.js.flow +15 -16
- package/src/lib/bundleToBytecode.js +6 -7
- package/src/lib/bundleToBytecode.js.flow +8 -7
- package/src/lib/bundleToString.js +3 -3
- package/src/lib/bundleToString.js.flow +5 -4
- package/src/lib/countLines.js +3 -7
- package/src/lib/countLines.js.flow +4 -7
- package/src/lib/createModuleIdFactory.js +2 -2
- package/src/lib/createModuleIdFactory.js.flow +1 -1
- package/src/lib/{attachWebsocketServer.js → createWebsocketServer.js} +18 -17
- package/src/lib/{attachWebsocketServer.js.flow → createWebsocketServer.js.flow} +13 -23
- package/src/lib/debounceAsyncQueue.js +2 -2
- package/src/lib/debounceAsyncQueue.js.flow +1 -1
- package/src/lib/formatBundlingError.js +21 -21
- package/src/lib/formatBundlingError.js.flow +18 -20
- package/src/lib/getAppendScripts.js +26 -27
- package/src/lib/getAppendScripts.js.flow +7 -8
- package/src/lib/getGraphId.js +3 -3
- package/src/lib/getGraphId.js.flow +3 -3
- package/src/lib/getMaxWorkers.js +2 -2
- package/src/lib/getMaxWorkers.js.flow +1 -1
- package/src/lib/getPreludeCode.js +2 -2
- package/src/lib/getPreludeCode.js.flow +1 -1
- package/src/lib/getPrependedScripts.js +16 -15
- package/src/lib/getPrependedScripts.js.flow +8 -8
- package/src/lib/logToConsole.js +12 -5
- package/src/lib/logToConsole.js.flow +19 -6
- package/src/lib/parseCustomTransformOptions.js +2 -2
- package/src/lib/parseCustomTransformOptions.js.flow +3 -3
- package/src/lib/parseOptionsFromUrl.js +7 -7
- package/src/lib/parseOptionsFromUrl.js.flow +29 -9
- package/src/lib/relativizeSourceMap.js +1 -1
- package/src/lib/relativizeSourceMap.js.flow +3 -3
- package/src/lib/reporting.js +5 -5
- package/src/lib/reporting.js.flow +18 -4
- package/src/lib/splitBundleOptions.js +5 -5
- package/src/lib/splitBundleOptions.js.flow +1 -1
- package/src/lib/transformHelpers.js +11 -10
- package/src/lib/transformHelpers.js.flow +6 -13
- package/src/node-haste/DependencyGraph/ModuleResolution.js +51 -30
- package/src/node-haste/DependencyGraph/ModuleResolution.js.flow +49 -48
- package/src/node-haste/DependencyGraph/createHasteMap.js +99 -0
- package/src/node-haste/DependencyGraph/createHasteMap.js.flow +88 -0
- package/src/node-haste/DependencyGraph/{assets/empty-module.js → types.js} +2 -2
- package/src/node-haste/DependencyGraph/types.js.flow +88 -0
- package/src/node-haste/DependencyGraph.js +51 -118
- package/src/node-haste/DependencyGraph.js.flow +38 -111
- package/src/node-haste/Module.js +1 -1
- package/src/node-haste/Module.js.flow +3 -3
- package/src/node-haste/ModuleCache.js +54 -13
- package/src/node-haste/ModuleCache.js.flow +53 -12
- package/src/node-haste/Package.js +2 -2
- package/src/node-haste/Package.js.flow +1 -1
- package/src/node-haste/lib/AssetPaths.js +5 -5
- package/src/node-haste/lib/AssetPaths.js.flow +7 -6
- package/src/node-haste/lib/parsePlatformFilePath.js +4 -4
- package/src/node-haste/lib/parsePlatformFilePath.js.flow +2 -2
- package/src/shared/output/RamBundle/as-assets.js +14 -15
- package/src/shared/output/RamBundle/as-assets.js.flow +9 -11
- package/src/shared/output/RamBundle/as-indexed-file.js +14 -15
- package/src/shared/output/RamBundle/as-indexed-file.js.flow +8 -12
- package/src/shared/output/RamBundle/buildSourcemapWithMetadata.js +7 -7
- package/src/shared/output/RamBundle/buildSourcemapWithMetadata.js.flow +4 -4
- package/src/shared/output/RamBundle/magic-number.js +1 -1
- package/src/shared/output/RamBundle/magic-number.js.flow +1 -1
- package/src/shared/output/RamBundle/util.js +21 -19
- package/src/shared/output/RamBundle/util.js.flow +5 -8
- package/src/shared/output/RamBundle/write-sourcemap.js +1 -1
- package/src/shared/output/RamBundle/write-sourcemap.js.flow +1 -1
- package/src/shared/output/RamBundle.js +2 -2
- package/src/shared/output/RamBundle.js.flow +4 -5
- package/src/shared/output/bundle.js +6 -6
- package/src/shared/output/bundle.js.flow +4 -5
- package/src/shared/output/meta.js +4 -5
- package/src/shared/output/meta.js.flow +2 -4
- package/src/shared/output/unbundle.js +1 -1
- package/src/shared/output/unbundle.js.flow +1 -1
- package/src/shared/output/writeFile.js +1 -1
- package/src/shared/output/writeFile.js.flow +1 -1
- package/src/shared/types.flow.js +1 -1
- package/src/shared/types.flow.js.flow +6 -4
- package/src/node-haste/DependencyGraph/assets/empty-module.js.flow +0 -9
- package/src/node-haste/types.js +0 -10
- package/src/node-haste/types.js.flow +0 -23
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
const countLines = require("./countLines");
|
|
13
13
|
|
|
14
|
-
const defaults = require("metro-config/src/defaults/defaults");
|
|
15
|
-
|
|
16
14
|
const getPreludeCode = require("./getPreludeCode");
|
|
17
15
|
|
|
18
16
|
const transformHelpers = require("./transformHelpers");
|
|
19
17
|
|
|
18
|
+
const defaults = require("metro-config/src/defaults/defaults");
|
|
19
|
+
|
|
20
20
|
const { compile } = require("metro-hermes-compiler");
|
|
21
21
|
|
|
22
22
|
async function getPrependedScripts(config, options, bundler, deltaBundler) {
|
|
@@ -24,7 +24,7 @@ async function getPrependedScripts(config, options, bundler, deltaBundler) {
|
|
|
24
24
|
// `getPolyfills()` method and the `polyfillModuleNames` variable).
|
|
25
25
|
const polyfillModuleNames = config.serializer
|
|
26
26
|
.getPolyfills({
|
|
27
|
-
platform: options.platform
|
|
27
|
+
platform: options.platform,
|
|
28
28
|
})
|
|
29
29
|
.concat(config.serializer.polyfillModuleNames);
|
|
30
30
|
const transformOptions = { ...options, type: "script" };
|
|
@@ -42,25 +42,26 @@ async function getPrependedScripts(config, options, bundler, deltaBundler) {
|
|
|
42
42
|
config,
|
|
43
43
|
transformOptions
|
|
44
44
|
),
|
|
45
|
+
transformOptions,
|
|
45
46
|
onProgress: null,
|
|
46
47
|
experimentalImportBundleSupport:
|
|
47
48
|
config.transformer.experimentalImportBundleSupport,
|
|
48
|
-
shallow: false
|
|
49
|
+
shallow: false,
|
|
49
50
|
}
|
|
50
51
|
);
|
|
51
52
|
return [
|
|
52
53
|
_getPrelude({
|
|
53
54
|
dev: options.dev,
|
|
54
|
-
globalPrefix: config.transformer.globalPrefix
|
|
55
|
+
globalPrefix: config.transformer.globalPrefix,
|
|
55
56
|
}),
|
|
56
|
-
...dependencies.values()
|
|
57
|
+
...dependencies.values(),
|
|
57
58
|
];
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
function _getPrelude({ dev, globalPrefix }) {
|
|
61
62
|
const code = getPreludeCode({
|
|
62
63
|
isDev: dev,
|
|
63
|
-
globalPrefix
|
|
64
|
+
globalPrefix,
|
|
64
65
|
});
|
|
65
66
|
const name = "__prelude__";
|
|
66
67
|
return {
|
|
@@ -74,18 +75,18 @@ function _getPrelude({ dev, globalPrefix }) {
|
|
|
74
75
|
data: {
|
|
75
76
|
code,
|
|
76
77
|
lineCount: countLines(code),
|
|
77
|
-
map: []
|
|
78
|
-
}
|
|
78
|
+
map: [],
|
|
79
|
+
},
|
|
79
80
|
},
|
|
80
81
|
{
|
|
81
82
|
type: "bytecode/script/virtual",
|
|
82
83
|
data: {
|
|
83
84
|
bytecode: compile(code, {
|
|
84
|
-
sourceURL: "__prelude__.virtual.js"
|
|
85
|
-
}).bytecode
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
]
|
|
85
|
+
sourceURL: "__prelude__.virtual.js",
|
|
86
|
+
}).bytecode,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
],
|
|
89
90
|
};
|
|
90
91
|
}
|
|
91
92
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -10,18 +10,17 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
+
import type Bundler from '../Bundler';
|
|
14
|
+
import type DeltaBundler, {Module} from '../DeltaBundler';
|
|
15
|
+
import type {TransformInputOptions} from '../DeltaBundler/types.flow';
|
|
16
|
+
import type {ConfigT} from 'metro-config/src/configTypes.flow';
|
|
17
|
+
|
|
13
18
|
const countLines = require('./countLines');
|
|
14
|
-
const defaults = require('metro-config/src/defaults/defaults');
|
|
15
19
|
const getPreludeCode = require('./getPreludeCode');
|
|
16
20
|
const transformHelpers = require('./transformHelpers');
|
|
17
|
-
|
|
21
|
+
const defaults = require('metro-config/src/defaults/defaults');
|
|
18
22
|
const {compile} = require('metro-hermes-compiler');
|
|
19
23
|
|
|
20
|
-
import type Bundler from '../Bundler';
|
|
21
|
-
import type DeltaBundler, {Module} from '../DeltaBundler';
|
|
22
|
-
import type {TransformInputOptions} from '../lib/transformHelpers';
|
|
23
|
-
import type {ConfigT} from 'metro-config/src/configTypes.flow';
|
|
24
|
-
|
|
25
24
|
async function getPrependedScripts(
|
|
26
25
|
config: ConfigT,
|
|
27
26
|
options: $Diff<
|
|
@@ -58,6 +57,7 @@ async function getPrependedScripts(
|
|
|
58
57
|
config,
|
|
59
58
|
transformOptions,
|
|
60
59
|
),
|
|
60
|
+
transformOptions,
|
|
61
61
|
onProgress: null,
|
|
62
62
|
experimentalImportBundleSupport:
|
|
63
63
|
config.transformer.experimentalImportBundleSupport,
|
package/src/lib/logToConsole.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
const chalk = require("chalk");
|
|
15
15
|
|
|
16
|
+
const util = require("util");
|
|
17
|
+
|
|
16
18
|
const groupStack = [];
|
|
17
19
|
let collapsedGuardTimer;
|
|
18
20
|
|
|
19
|
-
module.exports = (terminal, level, ...data) => {
|
|
21
|
+
module.exports = (terminal, level, mode, ...data) => {
|
|
20
22
|
const logFunction = console[level] && level !== "trace" ? level : "log";
|
|
21
23
|
const color =
|
|
22
24
|
level === "error"
|
|
@@ -59,10 +61,15 @@ module.exports = (terminal, level, ...data) => {
|
|
|
59
61
|
data[data.length - 1] = lastItem.trimEnd();
|
|
60
62
|
}
|
|
61
63
|
|
|
64
|
+
const modePrefix =
|
|
65
|
+
!mode || mode == "BRIDGE" ? "" : `(${mode.toUpperCase()}) `;
|
|
62
66
|
terminal.log(
|
|
63
|
-
color.bold(` ${logFunction.toUpperCase()} `) +
|
|
64
|
-
"".padEnd(groupStack.length * 2, " "),
|
|
65
|
-
|
|
67
|
+
color.bold(` ${modePrefix}${logFunction.toUpperCase()} `) +
|
|
68
|
+
"".padEnd(groupStack.length * 2, " "), // `util.format` actually accepts any arguments.
|
|
69
|
+
// If the first argument is a string, it tries to format it.
|
|
70
|
+
// Otherwise, it just concatenates all arguments.
|
|
71
|
+
// $FlowIssue[incompatible-call] util.format expected the first argument to be a string
|
|
72
|
+
util.format(...data)
|
|
66
73
|
);
|
|
67
74
|
}
|
|
68
75
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -12,14 +12,20 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
const chalk = require('chalk');
|
|
16
|
-
|
|
17
15
|
import type {Terminal} from 'metro-core';
|
|
18
16
|
|
|
17
|
+
const chalk = require('chalk');
|
|
18
|
+
const util = require('util');
|
|
19
|
+
|
|
19
20
|
const groupStack = [];
|
|
20
21
|
let collapsedGuardTimer;
|
|
21
22
|
|
|
22
|
-
module.exports = (
|
|
23
|
+
module.exports = (
|
|
24
|
+
terminal: Terminal,
|
|
25
|
+
level: string,
|
|
26
|
+
mode: 'BRIDGE' | 'NOBRIDGE',
|
|
27
|
+
...data: Array<mixed>
|
|
28
|
+
) => {
|
|
23
29
|
const logFunction = console[level] && level !== 'trace' ? level : 'log';
|
|
24
30
|
const color =
|
|
25
31
|
level === 'error'
|
|
@@ -58,10 +64,17 @@ module.exports = (terminal: Terminal, level: string, ...data: Array<mixed>) => {
|
|
|
58
64
|
if (typeof lastItem === 'string') {
|
|
59
65
|
data[data.length - 1] = lastItem.trimEnd();
|
|
60
66
|
}
|
|
67
|
+
|
|
68
|
+
const modePrefix =
|
|
69
|
+
!mode || mode == 'BRIDGE' ? '' : `(${mode.toUpperCase()}) `;
|
|
61
70
|
terminal.log(
|
|
62
|
-
color.bold(` ${logFunction.toUpperCase()} `) +
|
|
71
|
+
color.bold(` ${modePrefix}${logFunction.toUpperCase()} `) +
|
|
63
72
|
''.padEnd(groupStack.length * 2, ' '),
|
|
64
|
-
|
|
73
|
+
// `util.format` actually accepts any arguments.
|
|
74
|
+
// If the first argument is a string, it tries to format it.
|
|
75
|
+
// Otherwise, it just concatenates all arguments.
|
|
76
|
+
// $FlowIssue[incompatible-call] util.format expected the first argument to be a string
|
|
77
|
+
util.format(...data),
|
|
65
78
|
);
|
|
66
79
|
}
|
|
67
80
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -17,7 +17,7 @@ const PREFIX = "transform.";
|
|
|
17
17
|
module.exports = function parseCustomTransformOptions(urlObj) {
|
|
18
18
|
const customTransformOptions = Object.create(null);
|
|
19
19
|
const query = nullthrows(urlObj.query);
|
|
20
|
-
Object.keys(query).forEach(key => {
|
|
20
|
+
Object.keys(query).forEach((key) => {
|
|
21
21
|
if (key.startsWith(PREFIX)) {
|
|
22
22
|
customTransformOptions[key.substr(PREFIX.length)] = query[key];
|
|
23
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
const nullthrows = require('nullthrows');
|
|
15
|
-
|
|
16
14
|
import type {CustomTransformOptions} from 'metro-transform-worker';
|
|
17
15
|
|
|
16
|
+
const nullthrows = require('nullthrows');
|
|
17
|
+
|
|
18
18
|
const PREFIX = 'transform.';
|
|
19
19
|
|
|
20
20
|
module.exports = function parseCustomTransformOptions(urlObj: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const parsePlatformFilePath = require("../node-haste/lib/parsePlatformFilePath");
|
|
13
13
|
|
|
14
14
|
const parseCustomTransformOptions = require("./parseCustomTransformOptions");
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const nullthrows = require("nullthrows");
|
|
17
17
|
|
|
18
18
|
const path = require("path");
|
|
19
19
|
|
|
@@ -29,10 +29,10 @@ const getNumber = (query, opt, defaultValue) => {
|
|
|
29
29
|
return Number.isNaN(number) ? defaultValue : number;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
const getBundleType = bundleType =>
|
|
32
|
+
const getBundleType = (bundleType) =>
|
|
33
33
|
bundleType === "map" ? bundleType : "bundle";
|
|
34
34
|
|
|
35
|
-
const getTransformProfile = transformProfile =>
|
|
35
|
+
const getTransformProfile = (transformProfile) =>
|
|
36
36
|
transformProfile === "hermes-stable" || transformProfile === "hermes-canary"
|
|
37
37
|
? transformProfile
|
|
38
38
|
: "default";
|
|
@@ -80,11 +80,11 @@ module.exports = function parseOptionsFromUrl(
|
|
|
80
80
|
// when loading the bundle for either Android or iOS.
|
|
81
81
|
protocol:
|
|
82
82
|
platform != null && platform.match(/^(android|ios)$/) ? "http" : "",
|
|
83
|
-
pathname: pathname.replace(/\.(bundle|delta)$/, ".map")
|
|
83
|
+
pathname: pathname.replace(/\.(bundle|delta)$/, ".map"),
|
|
84
84
|
}),
|
|
85
85
|
sourceUrl: requestUrl,
|
|
86
86
|
unstable_transformProfile: getTransformProfile(
|
|
87
87
|
query.unstable_transformProfile
|
|
88
|
-
)
|
|
88
|
+
),
|
|
89
89
|
};
|
|
90
90
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -10,28 +10,48 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
import type {BundleOptions} from '../shared/types.flow';
|
|
14
|
+
|
|
15
15
|
const parsePlatformFilePath = require('../node-haste/lib/parsePlatformFilePath');
|
|
16
|
+
const parseCustomTransformOptions = require('./parseCustomTransformOptions');
|
|
17
|
+
const nullthrows = require('nullthrows');
|
|
16
18
|
const path = require('path');
|
|
17
19
|
const url = require('url');
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
const getBoolean = (
|
|
22
|
+
query: {[string]: string},
|
|
23
|
+
opt:
|
|
24
|
+
| $TEMPORARY$string<'dev'>
|
|
25
|
+
| $TEMPORARY$string<'excludeSource'>
|
|
26
|
+
| $TEMPORARY$string<'inlineSourceMap'>
|
|
27
|
+
| $TEMPORARY$string<'minify'>
|
|
28
|
+
| $TEMPORARY$string<'modulesOnly'>
|
|
29
|
+
| $TEMPORARY$string<'runModule'>
|
|
30
|
+
| $TEMPORARY$string<'shallow'>,
|
|
31
|
+
defaultValue: boolean,
|
|
32
|
+
) =>
|
|
22
33
|
query[opt] == null
|
|
23
34
|
? defaultValue
|
|
24
35
|
: query[opt] === 'true' || query[opt] === '1';
|
|
25
36
|
|
|
26
|
-
const getNumber = (
|
|
37
|
+
const getNumber = (
|
|
38
|
+
query: {[string]: string},
|
|
39
|
+
opt: $TEMPORARY$string<'runtimeBytecodeVersion'>,
|
|
40
|
+
defaultValue: null,
|
|
41
|
+
) => {
|
|
27
42
|
const number = parseInt(query[opt], 10);
|
|
28
43
|
return Number.isNaN(number) ? defaultValue : number;
|
|
29
44
|
};
|
|
30
45
|
|
|
31
|
-
const getBundleType = bundleType =>
|
|
46
|
+
const getBundleType = (bundleType: string | $TEMPORARY$string<'map'>) =>
|
|
32
47
|
bundleType === 'map' ? bundleType : 'bundle';
|
|
33
48
|
|
|
34
|
-
const getTransformProfile =
|
|
49
|
+
const getTransformProfile = (
|
|
50
|
+
transformProfile:
|
|
51
|
+
| string
|
|
52
|
+
| $TEMPORARY$string<'hermes-canary'>
|
|
53
|
+
| $TEMPORARY$string<'hermes-stable'>,
|
|
54
|
+
) =>
|
|
35
55
|
transformProfile === 'hermes-stable' || transformProfile === 'hermes-canary'
|
|
36
56
|
? transformProfile
|
|
37
57
|
: 'default';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const path = require('path');
|
|
14
|
-
|
|
15
13
|
import type {MixedSourceMap} from 'metro-source-map';
|
|
16
14
|
|
|
15
|
+
const path = require('path');
|
|
16
|
+
|
|
17
17
|
function relativizeSourceMapInline(
|
|
18
18
|
sourceMap: MixedSourceMap,
|
|
19
19
|
sourcesRoot: string,
|
package/src/lib/reporting.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
const chalk = require("chalk");
|
|
13
13
|
|
|
14
|
+
const { Terminal } = require("metro-core");
|
|
15
|
+
|
|
14
16
|
const stripAnsi = require("strip-ansi");
|
|
15
17
|
|
|
16
18
|
const util = require("util");
|
|
17
19
|
|
|
18
|
-
const { Terminal } = require("metro-core");
|
|
19
|
-
|
|
20
20
|
/**
|
|
21
21
|
* A standard way to log a warning to the terminal. This should not be called
|
|
22
22
|
* from some arbitrary Metro logic, only from the reporters. Instead of
|
|
@@ -47,10 +47,10 @@ function logError(terminal, format, ...args) {
|
|
|
47
47
|
*/
|
|
48
48
|
|
|
49
49
|
const nullReporter = {
|
|
50
|
-
update() {}
|
|
50
|
+
update() {},
|
|
51
51
|
};
|
|
52
52
|
module.exports = {
|
|
53
53
|
logWarning,
|
|
54
54
|
logError,
|
|
55
|
-
nullReporter
|
|
55
|
+
nullReporter,
|
|
56
56
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -11,11 +11,10 @@
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
13
|
const chalk = require('chalk');
|
|
14
|
+
const {Terminal} = require('metro-core');
|
|
14
15
|
const stripAnsi = require('strip-ansi');
|
|
15
16
|
const util = require('util');
|
|
16
17
|
|
|
17
|
-
const {Terminal} = require('metro-core');
|
|
18
|
-
|
|
19
18
|
export type GlobalCacheDisabledReason = 'too_many_errors' | 'too_many_misses';
|
|
20
19
|
|
|
21
20
|
export type BundleDetails = {
|
|
@@ -45,6 +44,10 @@ export type ReportableEvent =
|
|
|
45
44
|
error: Error,
|
|
46
45
|
...
|
|
47
46
|
}
|
|
47
|
+
| {
|
|
48
|
+
type: 'initialize_done',
|
|
49
|
+
port: number,
|
|
50
|
+
}
|
|
48
51
|
| {
|
|
49
52
|
buildID: string,
|
|
50
53
|
type: 'bundle_build_done',
|
|
@@ -117,7 +120,18 @@ export type ReportableEvent =
|
|
|
117
120
|
| 'groupEnd'
|
|
118
121
|
| 'debug',
|
|
119
122
|
data: Array<mixed>,
|
|
123
|
+
mode: 'BRIDGE' | 'NOBRIDGE',
|
|
120
124
|
...
|
|
125
|
+
}
|
|
126
|
+
| {
|
|
127
|
+
type: 'transformer_load_started',
|
|
128
|
+
}
|
|
129
|
+
| {
|
|
130
|
+
type: 'transformer_load_done',
|
|
131
|
+
}
|
|
132
|
+
| {
|
|
133
|
+
type: 'transformer_load_failed',
|
|
134
|
+
error: Error,
|
|
121
135
|
};
|
|
122
136
|
|
|
123
137
|
/**
|
|
@@ -138,7 +152,7 @@ export type ReportableEvent =
|
|
|
138
152
|
* TerminalReporter, that should be the only place in the application should
|
|
139
153
|
* access the `terminal` module (nor the `console`).
|
|
140
154
|
*/
|
|
141
|
-
export type Reporter = {update(event: ReportableEvent): void
|
|
155
|
+
export type Reporter = interface {update(event: ReportableEvent): void};
|
|
142
156
|
|
|
143
157
|
/**
|
|
144
158
|
* A standard way to log a warning to the terminal. This should not be called
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -23,7 +23,7 @@ function splitBundleOptions(options) {
|
|
|
23
23
|
platform: options.platform,
|
|
24
24
|
runtimeBytecodeVersion: options.runtimeBytecodeVersion,
|
|
25
25
|
type: "module",
|
|
26
|
-
unstable_transformProfile: options.unstable_transformProfile
|
|
26
|
+
unstable_transformProfile: options.unstable_transformProfile,
|
|
27
27
|
},
|
|
28
28
|
serializerOptions: {
|
|
29
29
|
excludeSource: options.excludeSource,
|
|
@@ -31,12 +31,12 @@ function splitBundleOptions(options) {
|
|
|
31
31
|
modulesOnly: options.modulesOnly,
|
|
32
32
|
runModule: options.runModule,
|
|
33
33
|
sourceMapUrl: options.sourceMapUrl,
|
|
34
|
-
sourceUrl: options.sourceUrl
|
|
34
|
+
sourceUrl: options.sourceUrl,
|
|
35
35
|
},
|
|
36
36
|
graphOptions: {
|
|
37
|
-
shallow: options.shallow
|
|
37
|
+
shallow: options.shallow,
|
|
38
38
|
},
|
|
39
|
-
onProgress: options.onProgress
|
|
39
|
+
onProgress: options.onProgress,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -29,7 +29,7 @@ async function calcTransformerOptions(
|
|
|
29
29
|
minify: options.minify,
|
|
30
30
|
platform: options.platform,
|
|
31
31
|
runtimeBytecodeVersion: options.runtimeBytecodeVersion,
|
|
32
|
-
unstable_transformProfile: options.unstable_transformProfile
|
|
32
|
+
unstable_transformProfile: options.unstable_transformProfile,
|
|
33
33
|
}; // When we're processing scripts, we don't need to calculate any
|
|
34
34
|
// inlineRequires information, since scripts by definition don't have
|
|
35
35
|
// requires().
|
|
@@ -38,17 +38,18 @@ async function calcTransformerOptions(
|
|
|
38
38
|
return { ...baseOptions, type: "script" };
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
const getDependencies = async path => {
|
|
41
|
+
const getDependencies = async (path) => {
|
|
42
42
|
const dependencies = await deltaBundler.getDependencies([path], {
|
|
43
43
|
resolve: await getResolveDependencyFn(bundler, options.platform),
|
|
44
44
|
transform: await getTransformFn([path], bundler, deltaBundler, config, {
|
|
45
45
|
...options,
|
|
46
|
-
minify: false
|
|
46
|
+
minify: false,
|
|
47
47
|
}),
|
|
48
|
+
transformOptions: options,
|
|
48
49
|
onProgress: null,
|
|
49
50
|
experimentalImportBundleSupport:
|
|
50
51
|
config.transformer.experimentalImportBundleSupport,
|
|
51
|
-
shallow: false
|
|
52
|
+
shallow: false,
|
|
52
53
|
});
|
|
53
54
|
return Array.from(dependencies.keys());
|
|
54
55
|
};
|
|
@@ -58,7 +59,7 @@ async function calcTransformerOptions(
|
|
|
58
59
|
{
|
|
59
60
|
dev: options.dev,
|
|
60
61
|
hot: options.hot,
|
|
61
|
-
platform: options.platform
|
|
62
|
+
platform: options.platform,
|
|
62
63
|
},
|
|
63
64
|
getDependencies
|
|
64
65
|
);
|
|
@@ -70,7 +71,7 @@ async function calcTransformerOptions(
|
|
|
70
71
|
transform.unstable_disableES6Transforms || false,
|
|
71
72
|
nonInlinedRequires:
|
|
72
73
|
transform.nonInlinedRequires || baseIgnoredInlineRequires,
|
|
73
|
-
type: "module"
|
|
74
|
+
type: "module",
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
77
|
|
|
@@ -96,14 +97,14 @@ async function getTransformFn(
|
|
|
96
97
|
config,
|
|
97
98
|
options
|
|
98
99
|
);
|
|
99
|
-
return async path => {
|
|
100
|
+
return async (path) => {
|
|
100
101
|
return await bundler.transformFile(path, {
|
|
101
102
|
...transformOptions,
|
|
102
103
|
type: getType(transformOptions.type, path, config.resolver.assetExts),
|
|
103
104
|
inlineRequires: removeInlineRequiresBlockListFromOptions(
|
|
104
105
|
path,
|
|
105
106
|
inlineRequires
|
|
106
|
-
)
|
|
107
|
+
),
|
|
107
108
|
});
|
|
108
109
|
};
|
|
109
110
|
}
|
|
@@ -130,5 +131,5 @@ async function getResolveDependencyFn(bundler, platform) {
|
|
|
130
131
|
|
|
131
132
|
module.exports = {
|
|
132
133
|
getTransformFn,
|
|
133
|
-
getResolveDependencyFn
|
|
134
|
+
getResolveDependencyFn,
|
|
134
135
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -10,24 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const path = require('path');
|
|
14
|
-
|
|
15
13
|
import type Bundler from '../Bundler';
|
|
16
|
-
import type {TransformOptions} from '../DeltaBundler/Worker';
|
|
17
14
|
import type DeltaBundler, {TransformFn} from '../DeltaBundler';
|
|
15
|
+
import type {TransformInputOptions} from '../DeltaBundler/types.flow';
|
|
16
|
+
import type {TransformOptions} from '../DeltaBundler/Worker';
|
|
18
17
|
import type {ConfigT} from 'metro-config/src/configTypes.flow';
|
|
19
18
|
import type {Type} from 'metro-transform-worker';
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
const path = require('path');
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
TransformOptions,
|
|
25
|
-
{
|
|
26
|
-
inlinePlatform: boolean,
|
|
27
|
-
inlineRequires: boolean,
|
|
28
|
-
...
|
|
29
|
-
},
|
|
30
|
-
>;
|
|
22
|
+
type InlineRequiresRaw = {+blockList: {[string]: true, ...}, ...} | boolean;
|
|
31
23
|
|
|
32
24
|
type TransformOptionsWithRawInlines = {|
|
|
33
25
|
...TransformOptions,
|
|
@@ -72,6 +64,7 @@ async function calcTransformerOptions(
|
|
|
72
64
|
...options,
|
|
73
65
|
minify: false,
|
|
74
66
|
}),
|
|
67
|
+
transformOptions: options,
|
|
75
68
|
onProgress: null,
|
|
76
69
|
experimentalImportBundleSupport:
|
|
77
70
|
config.transformer.experimentalImportBundleSupport,
|