metro 0.80.4 → 0.80.6
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 +16 -17
- package/src/Assets.js +0 -35
- package/src/Bundler/util.js +1 -29
- package/src/Bundler.js +1 -20
- package/src/DeltaBundler/DeltaCalculator.js +0 -86
- package/src/DeltaBundler/Graph.js +0 -197
- package/src/DeltaBundler/Serializers/baseJSBundle.js +0 -13
- package/src/DeltaBundler/Serializers/getAllFiles.js +0 -11
- package/src/DeltaBundler/Serializers/getAssets.js +0 -11
- package/src/DeltaBundler/Serializers/getExplodedSourceMap.js +0 -11
- package/src/DeltaBundler/Serializers/getRamBundleInfo.js +0 -18
- package/src/DeltaBundler/Serializers/helpers/getInlineSourceMappingURL.js +0 -11
- package/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.js +0 -11
- package/src/DeltaBundler/Serializers/helpers/getTransitiveDependencies.js +0 -14
- package/src/DeltaBundler/Serializers/helpers/js.js +0 -21
- package/src/DeltaBundler/Serializers/helpers/processModules.js +0 -11
- package/src/DeltaBundler/Serializers/hmrJSBundle.js +0 -23
- package/src/DeltaBundler/Serializers/sourceMapGenerator.js +0 -16
- package/src/DeltaBundler/Serializers/sourceMapObject.js +0 -11
- package/src/DeltaBundler/Serializers/sourceMapString.js +0 -11
- package/src/DeltaBundler/Transformer.js +0 -30
- package/src/DeltaBundler/Worker.flow.js +0 -26
- package/src/DeltaBundler/Worker.flow.js.flow +2 -2
- package/src/DeltaBundler/Worker.js +0 -14
- package/src/DeltaBundler/WorkerFarm.js +1 -21
- package/src/DeltaBundler/__fixtures__/hasteImpl.js +0 -14
- package/src/DeltaBundler/buildSubgraph.js +0 -24
- package/src/DeltaBundler/getTransformCacheKey.js +0 -13
- package/src/DeltaBundler/getTransformCacheKey.js.flow +1 -1
- package/src/DeltaBundler/mergeDeltas.js +0 -11
- package/src/DeltaBundler/types.flow.js +0 -11
- package/src/DeltaBundler.js +0 -21
- package/src/HmrServer.js +8 -39
- package/src/HmrServer.js.flow +8 -6
- package/src/IncrementalBundler/GraphNotFoundError.js +0 -11
- package/src/IncrementalBundler/ResourceNotFoundError.js +0 -11
- package/src/IncrementalBundler/RevisionNotFoundError.js +0 -11
- package/src/IncrementalBundler.js +0 -23
- package/src/ModuleGraph/test-helpers.js +0 -17
- package/src/ModuleGraph/worker/JsFileWrapping.js +1 -22
- package/src/ModuleGraph/worker/collectDependencies.js +1 -94
- package/src/ModuleGraph/worker/generateImportNames.js +0 -15
- package/src/Server/MultipartResponse.js +0 -13
- package/src/Server/symbolicate.js +2 -36
- package/src/Server.js +6 -83
- package/src/cli/parseKeyValueParamArray.js +0 -11
- package/src/cli-utils.js +0 -11
- package/src/cli.js +0 -13
- package/src/commands/build.js +0 -15
- package/src/commands/dependencies.js +1 -19
- package/src/commands/serve.js +0 -19
- package/src/index.flow.js +0 -31
- package/src/index.js +0 -14
- package/src/integration_tests/basic_bundle/AssetRegistry.js +0 -10
- package/src/integration_tests/basic_bundle/Bar.js +0 -10
- package/src/integration_tests/basic_bundle/ErrorBundle.js +0 -12
- package/src/integration_tests/basic_bundle/Foo.js +0 -10
- package/src/integration_tests/basic_bundle/TestBigInt.js +0 -12
- package/src/integration_tests/basic_bundle/TestBundle.js +0 -11
- package/src/integration_tests/basic_bundle/TestPolyfill.js +0 -10
- package/src/integration_tests/basic_bundle/build-errors/cannot-resolve-import.js +0 -14
- package/src/integration_tests/basic_bundle/build-errors/cannot-resolve-multi-line-import-with-escapes.js +0 -14
- package/src/integration_tests/basic_bundle/build-errors/cannot-resolve-multi-line-import.js +0 -14
- package/src/integration_tests/basic_bundle/build-errors/cannot-resolve-require-with-embedded-comment.js +1 -15
- package/src/integration_tests/basic_bundle/build-errors/cannot-resolve-require.js +0 -13
- package/src/integration_tests/basic_bundle/build-errors/cannot-resolve-specifier-with-escapes.js +0 -16
- package/src/integration_tests/basic_bundle/build-errors/inline-requires-cannot-resolve-import.js +0 -14
- package/src/integration_tests/basic_bundle/build-errors/inline-requires-cannot-resolve-require.js +0 -13
- package/src/integration_tests/basic_bundle/import-export/export-1.js +0 -10
- package/src/integration_tests/basic_bundle/import-export/export-2.js +0 -10
- package/src/integration_tests/basic_bundle/import-export/export-3.js +0 -10
- package/src/integration_tests/basic_bundle/import-export/export-4.js +0 -10
- package/src/integration_tests/basic_bundle/import-export/export-5.js +0 -10
- package/src/integration_tests/basic_bundle/import-export/export-6.js +0 -10
- package/src/integration_tests/basic_bundle/import-export/export-null.js +0 -10
- package/src/integration_tests/basic_bundle/import-export/export-primitive-default.js +0 -10
- package/src/integration_tests/basic_bundle/import-export/index.js +0 -10
- package/src/integration_tests/basic_bundle/loadBundleAsyncForTest.js +0 -10
- package/src/integration_tests/basic_bundle/polyfill.js +0 -12
- package/src/integration_tests/basic_bundle/require-context/conflict.js +0 -10
- package/src/integration_tests/basic_bundle/require-context/empty.js +0 -10
- package/src/integration_tests/basic_bundle/require-context/matching.js +0 -10
- package/src/integration_tests/basic_bundle/require-context/mode-eager.js +0 -10
- package/src/integration_tests/basic_bundle/require-context/mode-lazy-once.js +0 -10
- package/src/integration_tests/basic_bundle/require-context/mode-lazy.js +0 -10
- package/src/integration_tests/basic_bundle/require-context/mode-sync.js +0 -11
- package/src/integration_tests/basic_bundle/require-context/subdir/a.js +0 -10
- package/src/integration_tests/basic_bundle/require-context/subdir/b.js +0 -9
- package/src/integration_tests/basic_bundle/require-context/subdir/c.js +0 -10
- package/src/integration_tests/basic_bundle/require-context/subdir/nested/d.js +0 -10
- package/src/integration_tests/basic_bundle/require-context/subdir-conflict/index.js +0 -10
- package/src/integration_tests/basic_bundle/require-context/utils.js +0 -10
- package/src/integration_tests/basic_bundle/require-resolveWeak/import-and-resolveWeak.js +0 -15
- package/src/integration_tests/basic_bundle/require-resolveWeak/multiple.js +0 -10
- package/src/integration_tests/basic_bundle/require-resolveWeak/never-required.js +0 -10
- package/src/integration_tests/basic_bundle/require-resolveWeak/require-and-resolveWeak.js +0 -15
- package/src/integration_tests/basic_bundle/require-resolveWeak/subdir/counter-module.js +0 -10
- package/src/integration_tests/basic_bundle/require-resolveWeak/subdir/throwing-module.js +0 -10
- package/src/integration_tests/execBundle.js +0 -11
- package/src/integration_tests/metro.config.js +0 -10
- package/src/lib/BatchProcessor.js +0 -23
- package/src/lib/CountingSet.js +0 -35
- package/src/lib/JsonReporter.js +0 -17
- package/src/lib/RamBundleParser.js +0 -23
- package/src/lib/TerminalReporter.js +0 -68
- package/src/lib/bundleToString.js +1 -19
- package/src/lib/contextModule.js +1 -31
- package/src/lib/contextModuleTemplates.js +0 -36
- package/src/lib/countLines.js +0 -11
- package/src/lib/createModuleIdFactory.js +0 -11
- package/src/lib/createWebsocketServer.js +0 -24
- package/src/lib/debounceAsyncQueue.js +0 -13
- package/src/lib/formatBundlingError.js +0 -14
- package/src/lib/getAppendScripts.js +0 -11
- package/src/lib/getGraphId.js +0 -11
- package/src/lib/getMaxWorkers.js +0 -11
- package/src/lib/getPreludeCode.js +0 -18
- package/src/lib/getPrependedScripts.js +0 -13
- package/src/lib/logToConsole.js +0 -18
- package/src/lib/parseCustomResolverOptions.js +0 -11
- package/src/lib/parseCustomTransformOptions.js +0 -12
- package/src/lib/parseOptionsFromUrl.js +1 -17
- package/src/lib/relativizeSourceMap.js +0 -12
- package/src/lib/reporting.js +0 -30
- package/src/lib/splitBundleOptions.js +0 -14
- package/src/lib/transformHelpers.js +0 -20
- package/src/node-haste/DependencyGraph/ModuleResolution.js +5 -64
- package/src/node-haste/DependencyGraph/createFileMap.js +0 -16
- package/src/node-haste/DependencyGraph.js +6 -46
- package/src/node-haste/DependencyGraph.js.flow +7 -4
- package/src/node-haste/Module.js +0 -11
- package/src/node-haste/ModuleCache.js +0 -20
- package/src/node-haste/Package.js +0 -11
- package/src/node-haste/lib/AssetPaths.js +0 -16
- package/src/node-haste/lib/parsePlatformFilePath.js +0 -16
- package/src/shared/output/RamBundle/as-assets.js +6 -29
- package/src/shared/output/RamBundle/as-indexed-file.js +0 -44
- package/src/shared/output/RamBundle/buildSourcemapWithMetadata.js +0 -13
- package/src/shared/output/RamBundle/magic-number.js +0 -11
- package/src/shared/output/RamBundle/util.js +1 -17
- package/src/shared/output/RamBundle/write-sourcemap.js +0 -12
- package/src/shared/output/RamBundle.js +0 -14
- package/src/shared/output/bundle.flow.js +0 -13
- package/src/shared/output/bundle.flow.js.flow +1 -1
- package/src/shared/output/bundle.js +0 -14
- package/src/shared/output/meta.js +0 -11
- package/src/shared/output/unbundle.js +0 -13
- package/src/shared/output/writeFile.js +0 -11
- package/src/shared/types.flow.js +0 -11
package/src/node-haste/Module.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
3
|
var _path = _interopRequireDefault(require("path"));
|
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
3
|
const Module = require("./Module");
|
|
15
4
|
const Package = require("./Package");
|
|
16
5
|
class ModuleCache {
|
|
17
|
-
// Cache for "closest package.json" queries by module path.
|
|
18
|
-
|
|
19
|
-
// The inverse of _packagePathByModulePath.
|
|
20
|
-
|
|
21
6
|
constructor(options) {
|
|
22
7
|
this._getClosestPackage = options.getClosestPackage;
|
|
23
8
|
this._moduleCache = Object.create(null);
|
|
@@ -68,11 +53,8 @@ class ModuleCache {
|
|
|
68
53
|
delete this._packageCache[filePath];
|
|
69
54
|
}
|
|
70
55
|
if (this._packagePathByModulePath[filePath]) {
|
|
71
|
-
// filePath is a module inside a package.
|
|
72
56
|
const packagePath = this._packagePathByModulePath[filePath];
|
|
73
57
|
delete this._packagePathByModulePath[filePath];
|
|
74
|
-
// This change doesn't invalidate any cached "closest package.json"
|
|
75
|
-
// queries for the package's other modules. Clean up only this module.
|
|
76
58
|
const modulePaths = this._modulePathsByPackagePath[packagePath];
|
|
77
59
|
if (modulePaths) {
|
|
78
60
|
modulePaths.delete(filePath);
|
|
@@ -82,8 +64,6 @@ class ModuleCache {
|
|
|
82
64
|
}
|
|
83
65
|
}
|
|
84
66
|
if (this._modulePathsByPackagePath[filePath]) {
|
|
85
|
-
// filePath is a package. This change invalidates all cached "closest
|
|
86
|
-
// package.json" queries for modules inside this package.
|
|
87
67
|
const modulePaths = this._modulePathsByPackagePath[filePath];
|
|
88
68
|
for (const modulePath of modulePaths) {
|
|
89
69
|
delete this._packagePathByModulePath[modulePath];
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
3
|
const fs = require("fs");
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
3
|
const parsePlatformFilePath = require("./parsePlatformFilePath");
|
|
@@ -34,11 +23,6 @@ function parseBaseName(baseName) {
|
|
|
34
23
|
resolution: 1,
|
|
35
24
|
};
|
|
36
25
|
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Return `null` if the `filePath` doesn't have a valid extension, required
|
|
40
|
-
* to describe the type of an asset.
|
|
41
|
-
*/
|
|
42
26
|
function tryParse(filePath, platforms) {
|
|
43
27
|
const result = parsePlatformFilePath(filePath, platforms);
|
|
44
28
|
const { dirPath, baseName, platform, extension } = result;
|
|
@@ -1,23 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
3
|
const path = require("path");
|
|
15
4
|
const PATH_RE = /^(.+?)(\.([^.]+))?\.([^.]+)$/;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Extract the components of a file path that can have a platform specifier: Ex.
|
|
19
|
-
* `index.ios.js` is specific to the `ios` platform and has the extension `js`.
|
|
20
|
-
*/
|
|
21
5
|
function parsePlatformFilePath(filePath, platforms) {
|
|
22
6
|
const dirPath = path.dirname(filePath);
|
|
23
7
|
const fileName = path.basename(filePath);
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
3
|
const relativizeSourceMapInline = require("../../../lib/relativizeSourceMap");
|
|
@@ -19,17 +8,8 @@ const { joinModules } = require("./util");
|
|
|
19
8
|
const writeSourceMap = require("./write-sourcemap");
|
|
20
9
|
const fsPromises = require("fs").promises;
|
|
21
10
|
const path = require("path");
|
|
22
|
-
// must not start with a dot, as that won't go into the apk
|
|
23
11
|
const MAGIC_RAM_BUNDLE_FILENAME = "UNBUNDLE";
|
|
24
12
|
const MODULES_DIR = "js-modules";
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Saves all JS modules of an app as single files
|
|
28
|
-
* The startup code (prelude, polyfills etc.) are written to the file
|
|
29
|
-
* designated by the `bundleOuput` option.
|
|
30
|
-
* All other modules go into a 'js-modules' folder that in the same parent
|
|
31
|
-
* directory as the startup file.
|
|
32
|
-
*/
|
|
33
13
|
function saveAsAssets(bundle, options, log) {
|
|
34
14
|
const {
|
|
35
15
|
bundleOutput,
|
|
@@ -43,16 +23,13 @@ function saveAsAssets(bundle, options, log) {
|
|
|
43
23
|
const startupCode = joinModules(startupModules);
|
|
44
24
|
log("Writing bundle output to:", bundleOutput);
|
|
45
25
|
const modulesDir = path.join(path.dirname(bundleOutput), MODULES_DIR);
|
|
46
|
-
const writeUnbundle = createDir(modulesDir).then(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
writeMagicFlagFile(modulesDir),
|
|
53
|
-
])
|
|
26
|
+
const writeUnbundle = createDir(modulesDir).then(() =>
|
|
27
|
+
Promise.all([
|
|
28
|
+
writeModules(lazyModules, modulesDir, encoding),
|
|
29
|
+
writeFile(bundleOutput, startupCode, encoding),
|
|
30
|
+
writeMagicFlagFile(modulesDir),
|
|
31
|
+
])
|
|
54
32
|
);
|
|
55
|
-
// $FlowFixMe[unused-promise]
|
|
56
33
|
writeUnbundle.then(() => log("Done writing unbundle output"));
|
|
57
34
|
if (sourcemapOutput) {
|
|
58
35
|
const sourceMap = buildSourcemapWithMetadata({
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
3
|
const relativizeSourceMapInline = require("../../../lib/relativizeSourceMap");
|
|
@@ -18,14 +7,6 @@ const { joinModules } = require("./util");
|
|
|
18
7
|
const writeSourceMap = require("./write-sourcemap");
|
|
19
8
|
const fs = require("fs");
|
|
20
9
|
const SIZEOF_UINT32 = 4;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Saves all JS modules of an app as a single file, separated with null bytes.
|
|
24
|
-
* The file begins with an offset table that contains module ids and their
|
|
25
|
-
* lengths/offsets.
|
|
26
|
-
* The module id for the startup code (prelude, polyfills etc.) is the
|
|
27
|
-
* empty string.
|
|
28
|
-
*/
|
|
29
10
|
function saveAsIndexedFile(bundle, options, log) {
|
|
30
11
|
const {
|
|
31
12
|
bundleOutput,
|
|
@@ -84,41 +65,22 @@ function moduleToBuffer(id, code, encoding) {
|
|
|
84
65
|
};
|
|
85
66
|
}
|
|
86
67
|
function entryOffset(n) {
|
|
87
|
-
// 2: num_entries + startup_code_len
|
|
88
|
-
// n * 2: each entry consists of two uint32s
|
|
89
68
|
return (2 + n * 2) * SIZEOF_UINT32;
|
|
90
69
|
}
|
|
91
70
|
function buildModuleTable(startupCode, moduleBuffers, moduleGroups) {
|
|
92
|
-
// table format:
|
|
93
|
-
// - num_entries: uint_32 number of entries
|
|
94
|
-
// - startup_code_len: uint_32 length of the startup section
|
|
95
|
-
// - entries: entry...
|
|
96
|
-
//
|
|
97
|
-
// entry:
|
|
98
|
-
// - module_offset: uint_32 offset into the modules blob
|
|
99
|
-
// - module_length: uint_32 length of the module code in bytes
|
|
100
|
-
|
|
101
71
|
const moduleIds = [...moduleGroups.modulesById.keys()];
|
|
102
72
|
const maxId = moduleIds.reduce((max, id) => Math.max(max, id));
|
|
103
73
|
const numEntries = maxId + 1;
|
|
104
74
|
const table = Buffer.alloc(entryOffset(numEntries)).fill(0);
|
|
105
|
-
|
|
106
|
-
// num_entries
|
|
107
75
|
table.writeUInt32LE(numEntries, 0);
|
|
108
|
-
|
|
109
|
-
// startup_code_len
|
|
110
76
|
table.writeUInt32LE(startupCode.length, SIZEOF_UINT32);
|
|
111
|
-
|
|
112
|
-
// entries
|
|
113
77
|
let codeOffset = startupCode.length;
|
|
114
78
|
moduleBuffers.forEach(({ id, buffer }) => {
|
|
115
79
|
const group = moduleGroups.groups.get(id);
|
|
116
80
|
const idsInGroup = group ? [id].concat(Array.from(group)) : [id];
|
|
117
81
|
idsInGroup.forEach((moduleId) => {
|
|
118
82
|
const offset = entryOffset(moduleId);
|
|
119
|
-
// module_offset
|
|
120
83
|
table.writeUInt32LE(codeOffset, offset);
|
|
121
|
-
// module_length
|
|
122
84
|
table.writeUInt32LE(buffer.length, offset + SIZEOF_UINT32);
|
|
123
85
|
});
|
|
124
86
|
codeOffset += buffer.length;
|
|
@@ -153,12 +115,6 @@ function buildModuleBuffers(modules, moduleGroups, encoding) {
|
|
|
153
115
|
);
|
|
154
116
|
}
|
|
155
117
|
function buildTableAndContents(startupCode, modules, moduleGroups, encoding) {
|
|
156
|
-
// file contents layout:
|
|
157
|
-
// - magic number char[4] 0xE5 0xD1 0x0B 0xFB (0xFB0BD1E5 uint32 LE)
|
|
158
|
-
// - offset table table see `buildModuleTables`
|
|
159
|
-
// - code blob char[] null-terminated code strings, starting with
|
|
160
|
-
// the startup code
|
|
161
|
-
|
|
162
118
|
const startupCodeBuffer = nullTerminatedBuffer(startupCode, encoding);
|
|
163
119
|
const moduleBuffers = buildModuleBuffers(modules, moduleGroups, encoding);
|
|
164
120
|
const table = buildModuleTable(
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
3
|
const {
|
|
@@ -33,8 +22,6 @@ module.exports = ({
|
|
|
33
22
|
map: combineSourceMaps(startupModules, undefined, options),
|
|
34
23
|
sourcePath: "",
|
|
35
24
|
};
|
|
36
|
-
|
|
37
|
-
// Add map of module id -> source to sourcemap
|
|
38
25
|
const module_paths = [];
|
|
39
26
|
startupModules.forEach((m) => {
|
|
40
27
|
module_paths[m.id] = m.sourcePath;
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
3
|
module.exports = 0xfb0bd1e5;
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
3
|
var _countLines = _interopRequireDefault(require("../../../lib/countLines"));
|
|
@@ -17,11 +6,7 @@ function _interopRequireDefault(obj) {
|
|
|
17
6
|
}
|
|
18
7
|
const invariant = require("invariant");
|
|
19
8
|
function lineToLineSourceMap(source, filename = "") {
|
|
20
|
-
// The first line mapping in our package is the base64vlq code for zeros (A).
|
|
21
9
|
const firstLine = "AAAA;";
|
|
22
|
-
|
|
23
|
-
// Most other lines in our mappings are all zeros (for module, column etc)
|
|
24
|
-
// except for the lineno mapping: curLineno - prevLineno = 1; Which is C.
|
|
25
10
|
const line = "AACA;";
|
|
26
11
|
return {
|
|
27
12
|
file: filename,
|
|
@@ -76,7 +61,6 @@ function combineMaps(modules, offsets, moduleGroups, options) {
|
|
|
76
61
|
let groupLines = 0;
|
|
77
62
|
let { map } = moduleTransport;
|
|
78
63
|
if (moduleGroups && moduleGroups.modulesInGroups.has(id)) {
|
|
79
|
-
// this is a module appended to another module
|
|
80
64
|
return;
|
|
81
65
|
}
|
|
82
66
|
if (offsets != null) {
|
|
@@ -85,7 +69,7 @@ function combineMaps(modules, offsets, moduleGroups, options) {
|
|
|
85
69
|
const { modulesById } = moduleGroups;
|
|
86
70
|
const otherModules = Array.from(group || [])
|
|
87
71
|
.map((moduleId) => modulesById.get(moduleId))
|
|
88
|
-
.filter(Boolean);
|
|
72
|
+
.filter(Boolean);
|
|
89
73
|
otherModules.forEach((m) => {
|
|
90
74
|
groupLines += (0, _countLines.default)(m.code);
|
|
91
75
|
});
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
3
|
const writeFile = require("../writeFile");
|
|
@@ -18,7 +7,6 @@ function writeSourcemap(fileName, contents, log) {
|
|
|
18
7
|
}
|
|
19
8
|
log("Writing sourcemap output to:", fileName);
|
|
20
9
|
const writeMap = writeFile(fileName, contents, null);
|
|
21
|
-
// $FlowFixMe[unused-promise]
|
|
22
10
|
writeMap.then(() => log("Done writing sourcemap output"));
|
|
23
11
|
return writeMap;
|
|
24
12
|
}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
3
|
const Server = require("../../Server");
|
|
@@ -23,9 +12,6 @@ async function build(packagerClient, requestOptions) {
|
|
|
23
12
|
return await packagerClient.getRamBundleInfo(options);
|
|
24
13
|
}
|
|
25
14
|
function save(bundle, options, log) {
|
|
26
|
-
// We fork here depending on the platform: while Android is pretty good at
|
|
27
|
-
// loading individual assets, iOS has a large overhead when reading hundreds
|
|
28
|
-
// of assets from disk.
|
|
29
15
|
return options.platform === "android" && !(options.indexedRamBundle === true)
|
|
30
16
|
? asAssets(bundle, options, log)
|
|
31
17
|
: asIndexedFile(bundle, options, log);
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
3
|
const relativizeSourceMapInline = require("../../lib/relativizeSourceMap");
|
|
@@ -52,8 +41,6 @@ async function saveBundleAndMap(bundle, options, log) {
|
|
|
52
41
|
log("Done writing sourcemap output");
|
|
53
42
|
});
|
|
54
43
|
}
|
|
55
|
-
|
|
56
|
-
// Wait until everything is written to disk.
|
|
57
44
|
await Promise.all(writeFns.map((cb) => cb()));
|
|
58
45
|
}
|
|
59
46
|
exports.build = buildBundle;
|
|
@@ -37,7 +37,7 @@ function relativateSerializedMap(
|
|
|
37
37
|
map: string,
|
|
38
38
|
sourceMapSourcesRoot: string,
|
|
39
39
|
): string {
|
|
40
|
-
const sourceMap =
|
|
40
|
+
const sourceMap: MixedSourceMap = JSON.parse(map);
|
|
41
41
|
relativizeSourceMapInline(sourceMap, sourceMapSourcesRoot);
|
|
42
42
|
return JSON.stringify(sourceMap);
|
|
43
43
|
}
|
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
|
-
/*::
|
|
15
|
-
export type * from './bundle.flow';
|
|
16
|
-
*/
|
|
17
3
|
try {
|
|
18
4
|
require("metro-babel-register").unstable_registerForMetroMonorepo();
|
|
19
5
|
} catch {}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
3
|
const crypto = require("crypto");
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
|
-
/* This is for retro-compatibility of React Native with older versions of
|
|
15
|
-
* Metro. Use the `RamBundle` module directly. */
|
|
16
3
|
module.exports = require("./RamBundle");
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|
|
13
2
|
|
|
14
3
|
const denodeify = require("denodeify");
|
package/src/shared/types.flow.js
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and 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
|
-
* @oncall react_native
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
"use strict";
|