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.
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
+
import type {ModuleGroups, ModuleTransportLike} from '../../types.flow';
|
|
14
|
+
import type {IndexMap} from 'metro-source-map';
|
|
15
|
+
|
|
13
16
|
const {
|
|
14
17
|
combineSourceMaps,
|
|
15
18
|
combineSourceMapsAddingOffsets,
|
|
16
19
|
joinModules,
|
|
17
20
|
} = require('./util');
|
|
18
21
|
|
|
19
|
-
import type {ModuleGroups, ModuleTransportLike} from '../../types.flow';
|
|
20
|
-
import type {IndexMap} from 'metro-source-map';
|
|
21
|
-
|
|
22
22
|
type Params = {|
|
|
23
23
|
fixWrapperOffset: boolean,
|
|
24
24
|
lazyModules: $ReadOnlyArray<ModuleTransportLike>,
|
|
@@ -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,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
var _countLines = _interopRequireDefault(require("../../../lib/countLines"));
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
function _interopRequireDefault(obj) {
|
|
15
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
16
|
+
}
|
|
15
17
|
|
|
16
|
-
const
|
|
18
|
+
const invariant = require("invariant");
|
|
17
19
|
|
|
18
20
|
function lineToLineSourceMap(source, filename = "") {
|
|
19
21
|
// The first line mapping in our package is the base64vlq code for zeros (A).
|
|
@@ -23,28 +25,28 @@ function lineToLineSourceMap(source, filename = "") {
|
|
|
23
25
|
const line = "AACA;";
|
|
24
26
|
return {
|
|
25
27
|
file: filename,
|
|
26
|
-
mappings: firstLine + Array(
|
|
28
|
+
mappings: firstLine + Array((0, _countLines.default)(source)).join(line),
|
|
27
29
|
sources: [filename],
|
|
28
30
|
names: [],
|
|
29
|
-
version: 3
|
|
31
|
+
version: 3,
|
|
30
32
|
};
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
const wrapperEnd = wrappedCode => wrappedCode.indexOf("{") + 1;
|
|
35
|
+
const wrapperEnd = (wrappedCode) => wrappedCode.indexOf("{") + 1;
|
|
34
36
|
|
|
35
37
|
const Section = (line, column, map) => ({
|
|
36
38
|
map,
|
|
37
39
|
offset: {
|
|
38
40
|
line,
|
|
39
|
-
column
|
|
40
|
-
}
|
|
41
|
+
column,
|
|
42
|
+
},
|
|
41
43
|
});
|
|
42
44
|
|
|
43
45
|
function combineSourceMaps(modules, moduleGroups, options) {
|
|
44
46
|
const sections = combineMaps(modules, null, moduleGroups, options);
|
|
45
47
|
return {
|
|
46
48
|
sections,
|
|
47
|
-
version: 3
|
|
49
|
+
version: 3,
|
|
48
50
|
};
|
|
49
51
|
}
|
|
50
52
|
|
|
@@ -65,14 +67,14 @@ function combineSourceMapsAddingOffsets(
|
|
|
65
67
|
sections,
|
|
66
68
|
version: 3,
|
|
67
69
|
x_facebook_offsets,
|
|
68
|
-
x_metro_module_paths
|
|
70
|
+
x_metro_module_paths,
|
|
69
71
|
};
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
function combineMaps(modules, offsets, moduleGroups, options) {
|
|
73
75
|
const sections = [];
|
|
74
76
|
let line = 0;
|
|
75
|
-
modules.forEach(moduleTransport => {
|
|
77
|
+
modules.forEach((moduleTransport) => {
|
|
76
78
|
const { code, id, name } = moduleTransport;
|
|
77
79
|
let column = 0;
|
|
78
80
|
let group;
|
|
@@ -90,11 +92,11 @@ function combineMaps(modules, offsets, moduleGroups, options) {
|
|
|
90
92
|
if (group && moduleGroups) {
|
|
91
93
|
const { modulesById } = moduleGroups;
|
|
92
94
|
const otherModules = Array.from(group || [])
|
|
93
|
-
.map(moduleId => modulesById.get(moduleId))
|
|
95
|
+
.map((moduleId) => modulesById.get(moduleId))
|
|
94
96
|
.filter(Boolean); // needed to appease flow
|
|
95
97
|
|
|
96
|
-
otherModules.forEach(m => {
|
|
97
|
-
groupLines +=
|
|
98
|
+
otherModules.forEach((m) => {
|
|
99
|
+
groupLines += (0, _countLines.default)(m.code);
|
|
98
100
|
});
|
|
99
101
|
map = combineSourceMaps([moduleTransport].concat(otherModules));
|
|
100
102
|
}
|
|
@@ -118,17 +120,17 @@ function combineMaps(modules, offsets, moduleGroups, options) {
|
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
122
|
|
|
121
|
-
line +=
|
|
123
|
+
line += (0, _countLines.default)(code) + groupLines;
|
|
122
124
|
});
|
|
123
125
|
return sections;
|
|
124
126
|
}
|
|
125
127
|
|
|
126
|
-
const joinModules = modules => modules.map(m => m.code).join("\n");
|
|
128
|
+
const joinModules = (modules) => modules.map((m) => m.code).join("\n");
|
|
127
129
|
|
|
128
130
|
module.exports = {
|
|
129
131
|
combineSourceMaps,
|
|
130
132
|
combineSourceMapsAddingOffsets,
|
|
131
|
-
countLines,
|
|
133
|
+
countLines: _countLines.default,
|
|
132
134
|
joinModules,
|
|
133
|
-
lineToLineSourceMap
|
|
135
|
+
lineToLineSourceMap,
|
|
134
136
|
};
|
|
@@ -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,20 +10,17 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const invariant = require('invariant');
|
|
14
|
-
|
|
15
13
|
import type {ModuleGroups, ModuleTransportLike} from '../../types.flow';
|
|
16
14
|
import type {
|
|
15
|
+
BasicSourceMap,
|
|
17
16
|
IndexMap,
|
|
18
17
|
IndexMapSection,
|
|
19
18
|
MixedSourceMap,
|
|
20
|
-
BasicSourceMap,
|
|
21
19
|
} from 'metro-source-map';
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
(string.match(newline) || []).length + 1;
|
|
21
|
+
import countLines from '../../../lib/countLines';
|
|
22
|
+
|
|
23
|
+
const invariant = require('invariant');
|
|
27
24
|
|
|
28
25
|
function lineToLineSourceMap(
|
|
29
26
|
source: string,
|
|
@@ -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.
|
|
@@ -19,7 +19,7 @@ async function build(packagerClient, requestOptions) {
|
|
|
19
19
|
const options = {
|
|
20
20
|
...Server.DEFAULT_BUNDLE_OPTIONS,
|
|
21
21
|
...requestOptions,
|
|
22
|
-
bundleType: "ram"
|
|
22
|
+
bundleType: "ram",
|
|
23
23
|
};
|
|
24
24
|
return await packagerClient.getRamBundleInfo(options);
|
|
25
25
|
}
|
|
@@ -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,14 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
import type {RamBundleInfo} from '../../DeltaBundler/Serializers/getRamBundleInfo';
|
|
14
|
+
import type {OutputOptions, RequestOptions} from '../types.flow';
|
|
14
15
|
|
|
16
|
+
const Server = require('../../Server');
|
|
15
17
|
const asAssets = require('./RamBundle/as-assets');
|
|
16
18
|
const asIndexedFile = require('./RamBundle/as-indexed-file').save;
|
|
17
19
|
|
|
18
|
-
import type {OutputOptions, RequestOptions} from '../types.flow';
|
|
19
|
-
import type {RamBundleInfo} from '../../DeltaBundler/Serializers/getRamBundleInfo';
|
|
20
|
-
|
|
21
20
|
async function build(
|
|
22
21
|
packagerClient: Server,
|
|
23
22
|
requestOptions: RequestOptions,
|
|
@@ -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,17 +9,17 @@
|
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
|
|
12
|
-
const Server = require("../../Server");
|
|
13
|
-
|
|
14
12
|
const relativizeSourceMapInline = require("../../lib/relativizeSourceMap");
|
|
15
13
|
|
|
14
|
+
const Server = require("../../Server");
|
|
15
|
+
|
|
16
16
|
const writeFile = require("./writeFile");
|
|
17
17
|
|
|
18
18
|
function buildBundle(packagerClient, requestOptions) {
|
|
19
19
|
return packagerClient.build({
|
|
20
20
|
...Server.DEFAULT_BUNDLE_OPTIONS,
|
|
21
21
|
...requestOptions,
|
|
22
|
-
bundleType: "bundle"
|
|
22
|
+
bundleType: "bundle",
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -34,7 +34,7 @@ async function saveBundleAndMap(bundle, options, log) {
|
|
|
34
34
|
bundleOutput,
|
|
35
35
|
bundleEncoding: encoding,
|
|
36
36
|
sourcemapOutput,
|
|
37
|
-
sourcemapSourcesRoot
|
|
37
|
+
sourcemapSourcesRoot,
|
|
38
38
|
} = options;
|
|
39
39
|
const writeFns = [];
|
|
40
40
|
writeFns.push(async () => {
|
|
@@ -59,7 +59,7 @@ async function saveBundleAndMap(bundle, options, log) {
|
|
|
59
59
|
});
|
|
60
60
|
} // Wait until everything is written to disk.
|
|
61
61
|
|
|
62
|
-
await Promise.all(writeFns.map(cb => cb()));
|
|
62
|
+
await Promise.all(writeFns.map((cb) => cb()));
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
exports.build = buildBundle;
|
|
@@ -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,14 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
import type {OutputOptions, RequestOptions} from '../types.flow';
|
|
14
|
+
import type {MixedSourceMap} from 'metro-source-map';
|
|
14
15
|
|
|
15
16
|
const relativizeSourceMapInline = require('../../lib/relativizeSourceMap');
|
|
17
|
+
const Server = require('../../Server');
|
|
16
18
|
const writeFile = require('./writeFile');
|
|
17
19
|
|
|
18
|
-
import type {OutputOptions, RequestOptions} from '../types.flow';
|
|
19
|
-
import type {MixedSourceMap} from 'metro-source-map';
|
|
20
|
-
|
|
21
20
|
function buildBundle(
|
|
22
21
|
packagerClient: Server,
|
|
23
22
|
requestOptions: RequestOptions,
|
|
@@ -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.
|
|
@@ -8,13 +8,12 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
|
-
/* global Buffer: true */
|
|
12
11
|
|
|
13
12
|
const crypto = require("crypto");
|
|
14
13
|
|
|
15
|
-
const isUTF8 = encoding => /^utf-?8$/i.test(encoding);
|
|
14
|
+
const isUTF8 = (encoding) => /^utf-?8$/i.test(encoding);
|
|
16
15
|
|
|
17
|
-
const constantFor = encoding =>
|
|
16
|
+
const constantFor = (encoding) =>
|
|
18
17
|
/^ascii$/i.test(encoding)
|
|
19
18
|
? 1
|
|
20
19
|
: isUTF8(encoding)
|
|
@@ -23,7 +22,7 @@ const constantFor = encoding =>
|
|
|
23
22
|
? 3
|
|
24
23
|
: 0;
|
|
25
24
|
|
|
26
|
-
module.exports = function(code, encoding = "utf8") {
|
|
25
|
+
module.exports = function (code, encoding = "utf8") {
|
|
27
26
|
const buffer = asBuffer(code, encoding);
|
|
28
27
|
const hash = crypto.createHash("sha1");
|
|
29
28
|
hash.update(buffer);
|
|
@@ -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,8 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
/* global Buffer: true */
|
|
14
|
-
|
|
15
13
|
const crypto = require('crypto');
|
|
16
14
|
|
|
17
15
|
const isUTF8 = (encoding: 'ascii' | 'utf16le' | 'utf8') =>
|
|
@@ -26,7 +24,7 @@ const constantFor = (encoding: 'ascii' | 'utf16le' | 'utf8') =>
|
|
|
26
24
|
? 3
|
|
27
25
|
: 0;
|
|
28
26
|
|
|
29
|
-
module.exports = function(
|
|
27
|
+
module.exports = function (
|
|
30
28
|
code: Buffer | string,
|
|
31
29
|
encoding: 'ascii' | 'utf16le' | 'utf8' = 'utf8',
|
|
32
30
|
): Buffer {
|
package/src/shared/types.flow.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.
|
|
@@ -10,12 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
import type {
|
|
14
|
-
|
|
13
|
+
import type {
|
|
14
|
+
Options as DeltaBundlerOptions,
|
|
15
|
+
TransformInputOptions,
|
|
16
|
+
} from '../DeltaBundler/types.flow';
|
|
15
17
|
import type {TransformProfile} from 'metro-babel-transformer';
|
|
16
18
|
import type {
|
|
17
|
-
MixedSourceMap,
|
|
18
19
|
MetroSourceMapSegmentTuple,
|
|
20
|
+
MixedSourceMap,
|
|
19
21
|
} from 'metro-source-map';
|
|
20
22
|
import type {
|
|
21
23
|
CustomTransformOptions,
|
package/src/node-haste/types.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @format
|
|
9
|
-
*/
|
|
10
|
-
"use strict"; // TODO(cpojer): Create a jest-types repo.
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @flow strict
|
|
8
|
-
* @format
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
// TODO(cpojer): Create a jest-types repo.
|
|
14
|
-
export type HasteFS = {
|
|
15
|
-
exists(filePath: string): boolean,
|
|
16
|
-
getAllFiles(): Array<string>,
|
|
17
|
-
getDependencies(filePath: string): Array<string>,
|
|
18
|
-
getFileIterator(): Iterator<string>,
|
|
19
|
-
getModuleName(filePath: string): ?string,
|
|
20
|
-
getSha1(string): ?string,
|
|
21
|
-
matchFiles(pattern: RegExp | string): Array<string>,
|
|
22
|
-
...
|
|
23
|
-
};
|