metro 0.66.2 → 0.69.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 +22 -24
- package/src/Assets.js +9 -9
- package/src/Assets.js.flow +5 -7
- package/src/Bundler/util.js +16 -15
- package/src/Bundler/util.js.flow +11 -10
- package/src/Bundler.js +21 -8
- package/src/Bundler.js.flow +19 -7
- package/src/DeltaBundler/DeltaCalculator.js +15 -15
- package/src/DeltaBundler/DeltaCalculator.js.flow +7 -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 +6 -6
- package/src/DeltaBundler/Serializers/helpers/js.js.flow +11 -12
- 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 +9 -9
- package/src/DeltaBundler/Transformer.js.flow +7 -9
- package/src/DeltaBundler/Worker.js +8 -11
- package/src/DeltaBundler/Worker.js.flow +8 -11
- package/src/DeltaBundler/WorkerFarm.js +14 -17
- package/src/DeltaBundler/WorkerFarm.js.flow +7 -10
- 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 +1 -1
- package/src/DeltaBundler.js +5 -5
- package/src/DeltaBundler.js.flow +4 -4
- package/src/HmrServer.js +71 -55
- package/src/HmrServer.js.flow +40 -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 +44 -32
- package/src/IncrementalBundler.js.flow +30 -24
- package/src/ModuleGraph/module.js +3 -3
- package/src/ModuleGraph/module.js.flow +1 -1
- package/src/ModuleGraph/node-haste/HasteFS.js +2 -2
- package/src/ModuleGraph/node-haste/HasteFS.js.flow +1 -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 +42 -32
- package/src/ModuleGraph/node-haste/node-haste.js.flow +28 -23
- 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 +31 -30
- package/src/ModuleGraph/output/util.js.flow +15 -16
- 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 +7 -7
- package/src/ModuleGraph/worker/JsFileWrapping.js +7 -7
- 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 +15 -17
- 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 +202 -150
- package/src/Server.js.flow +129 -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 +17 -18
- package/src/commands/serve.js.flow +6 -9
- package/src/index.js +116 -51
- package/src/index.js.flow +107 -41
- 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 +3 -2
- package/src/integration_tests/basic_bundle/TestBundle.js.flow +3 -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 +8 -8
- 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 +3 -3
- package/src/lib/BatchProcessor.js.flow +1 -1
- package/src/lib/JsonReporter.js +2 -2
- package/src/lib/JsonReporter.js.flow +1 -1
- package/src/lib/RamBundleParser.js +1 -1
- package/src/lib/RamBundleParser.js.flow +1 -1
- package/src/lib/TerminalReporter.js +14 -14
- package/src/lib/TerminalReporter.js.flow +9 -10
- 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} +12 -21
- 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 +6 -8
- 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 +15 -15
- package/src/lib/getPrependedScripts.js.flow +7 -8
- package/src/lib/logToConsole.js +1 -1
- package/src/lib/logToConsole.js.flow +3 -3
- 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 +16 -3
- package/src/lib/splitBundleOptions.js +5 -5
- package/src/lib/splitBundleOptions.js.flow +1 -1
- package/src/lib/transformHelpers.js +10 -10
- package/src/lib/transformHelpers.js.flow +5 -5
- package/src/node-haste/DependencyGraph/ModuleResolution.js +51 -30
- package/src/node-haste/DependencyGraph/ModuleResolution.js.flow +46 -42
- 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 +49 -117
- package/src/node-haste/DependencyGraph.js.flow +36 -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 +7 -9
- package/src/node-haste/Package.js.flow +1 -8
- package/src/node-haste/lib/AssetPaths.js +5 -5
- package/src/node-haste/lib/AssetPaths.js.flow +2 -4
- package/src/node-haste/lib/parsePlatformFilePath.js +4 -4
- package/src/node-haste/lib/parsePlatformFilePath.js.flow +1 -1
- package/src/shared/output/RamBundle/as-assets.js +16 -17
- package/src/shared/output/RamBundle/as-assets.js.flow +11 -15
- 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 +2 -2
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.69.0",
|
|
4
4
|
"description": "🚇 The JavaScript bundler for React Native.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": "src/cli.js",
|
|
@@ -31,30 +31,28 @@
|
|
|
31
31
|
"error-stack-parser": "^2.0.6",
|
|
32
32
|
"fs-extra": "^1.0.0",
|
|
33
33
|
"graceful-fs": "^4.1.3",
|
|
34
|
-
"hermes-parser": "0.
|
|
34
|
+
"hermes-parser": "0.6.0",
|
|
35
35
|
"image-size": "^0.6.0",
|
|
36
36
|
"invariant": "^2.2.4",
|
|
37
|
-
"jest-haste-map": "^
|
|
37
|
+
"jest-haste-map": "^27.3.1",
|
|
38
38
|
"jest-worker": "^26.0.0",
|
|
39
39
|
"lodash.throttle": "^4.1.1",
|
|
40
|
-
"metro-babel-
|
|
41
|
-
"metro-
|
|
42
|
-
"metro-cache": "0.
|
|
43
|
-
"metro-
|
|
44
|
-
"metro-
|
|
45
|
-
"metro-
|
|
46
|
-
"metro-
|
|
47
|
-
"metro-
|
|
48
|
-
"metro-
|
|
49
|
-
"metro-
|
|
50
|
-
"metro-
|
|
51
|
-
"metro-
|
|
52
|
-
"metro-
|
|
53
|
-
"metro-
|
|
54
|
-
"metro-transform-
|
|
55
|
-
"metro-transform-worker": "0.66.2",
|
|
40
|
+
"metro-babel-transformer": "0.69.0",
|
|
41
|
+
"metro-cache": "0.69.0",
|
|
42
|
+
"metro-cache-key": "0.69.0",
|
|
43
|
+
"metro-config": "0.69.0",
|
|
44
|
+
"metro-core": "0.69.0",
|
|
45
|
+
"metro-hermes-compiler": "0.69.0",
|
|
46
|
+
"metro-inspector-proxy": "0.69.0",
|
|
47
|
+
"metro-minify-uglify": "0.69.0",
|
|
48
|
+
"metro-react-native-babel-preset": "0.69.0",
|
|
49
|
+
"metro-resolver": "0.69.0",
|
|
50
|
+
"metro-runtime": "0.69.0",
|
|
51
|
+
"metro-source-map": "0.69.0",
|
|
52
|
+
"metro-symbolicate": "0.69.0",
|
|
53
|
+
"metro-transform-plugins": "0.69.0",
|
|
54
|
+
"metro-transform-worker": "0.69.0",
|
|
56
55
|
"mime-types": "^2.1.27",
|
|
57
|
-
"mkdirp": "^0.5.1",
|
|
58
56
|
"node-fetch": "^2.2.0",
|
|
59
57
|
"nullthrows": "^1.1.1",
|
|
60
58
|
"rimraf": "^2.5.4",
|
|
@@ -63,7 +61,7 @@
|
|
|
63
61
|
"strip-ansi": "^6.0.0",
|
|
64
62
|
"temp": "0.8.3",
|
|
65
63
|
"throat": "^5.0.0",
|
|
66
|
-
"ws": "^
|
|
64
|
+
"ws": "^7.5.1",
|
|
67
65
|
"yargs": "^15.3.1"
|
|
68
66
|
},
|
|
69
67
|
"devDependencies": {
|
|
@@ -72,9 +70,9 @@
|
|
|
72
70
|
"babel-jest": "^26.6.3",
|
|
73
71
|
"dedent": "^0.7.0",
|
|
74
72
|
"jest-snapshot": "^26.5.2",
|
|
75
|
-
"metro-memory-fs": "0.
|
|
76
|
-
"metro-react-native-babel-preset": "0.
|
|
77
|
-
"metro-react-native-babel-transformer": "0.
|
|
73
|
+
"metro-memory-fs": "0.69.0",
|
|
74
|
+
"metro-react-native-babel-preset": "0.69.0",
|
|
75
|
+
"metro-react-native-babel-transformer": "0.69.0",
|
|
78
76
|
"stack-trace": "^0.0.10"
|
|
79
77
|
},
|
|
80
78
|
"license": "MIT"
|
package/src/Assets.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.
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
|
|
12
|
+
const { isAssetTypeAnImage } = require("./Bundler/util");
|
|
13
|
+
|
|
12
14
|
const AssetPaths = require("./node-haste/lib/AssetPaths");
|
|
13
15
|
|
|
14
16
|
const crypto = require("crypto");
|
|
@@ -21,8 +23,6 @@ const imageSize = require("image-size");
|
|
|
21
23
|
|
|
22
24
|
const path = require("path");
|
|
23
25
|
|
|
24
|
-
const { isAssetTypeAnImage } = require("./Bundler/util");
|
|
25
|
-
|
|
26
26
|
const readDir = denodeify(fs.readdir);
|
|
27
27
|
const readFile = denodeify(fs.readFile);
|
|
28
28
|
const hashFiles = denodeify(function hashFilesCb(files, hash, callback) {
|
|
@@ -45,9 +45,9 @@ const hashFiles = denodeify(function hashFilesCb(files, hash, callback) {
|
|
|
45
45
|
|
|
46
46
|
function buildAssetMap(dir, files, platform) {
|
|
47
47
|
const platforms = new Set(platform != null ? [platform] : []);
|
|
48
|
-
const assets = files.map(file => AssetPaths.tryParse(file, platforms));
|
|
48
|
+
const assets = files.map((file) => AssetPaths.tryParse(file, platforms));
|
|
49
49
|
const map = new Map();
|
|
50
|
-
assets.forEach(function(asset, i) {
|
|
50
|
+
assets.forEach(function (asset, i) {
|
|
51
51
|
if (asset == null) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
@@ -59,7 +59,7 @@ function buildAssetMap(dir, files, platform) {
|
|
|
59
59
|
if (!record) {
|
|
60
60
|
record = {
|
|
61
61
|
scales: [],
|
|
62
|
-
files: []
|
|
62
|
+
files: [],
|
|
63
63
|
};
|
|
64
64
|
map.set(assetKey, record);
|
|
65
65
|
}
|
|
@@ -134,7 +134,7 @@ async function getAbsoluteAssetInfo(assetPath, platform = null) {
|
|
|
134
134
|
hash: hasher.digest("hex"),
|
|
135
135
|
name,
|
|
136
136
|
scales,
|
|
137
|
-
type
|
|
137
|
+
type,
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
140
|
|
|
@@ -173,7 +173,7 @@ async function getAssetData(
|
|
|
173
173
|
files: assetInfo.files,
|
|
174
174
|
hash: assetInfo.hash,
|
|
175
175
|
name: assetInfo.name,
|
|
176
|
-
type: assetInfo.type
|
|
176
|
+
type: assetInfo.type,
|
|
177
177
|
};
|
|
178
178
|
return await applyAssetDataPlugins(assetDataPlugins, assetData);
|
|
179
179
|
}
|
|
@@ -259,5 +259,5 @@ function pathBelongsToRoots(pathToCheck, roots) {
|
|
|
259
259
|
module.exports = {
|
|
260
260
|
getAsset,
|
|
261
261
|
getAssetData,
|
|
262
|
-
getAssetFiles
|
|
262
|
+
getAssetFiles,
|
|
263
263
|
};
|
package/src/Assets.js.flow
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,21 +10,19 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
import type {AssetPath} from './node-haste/lib/AssetPaths';
|
|
14
14
|
|
|
15
|
+
const {isAssetTypeAnImage} = require('./Bundler/util');
|
|
16
|
+
const AssetPaths = require('./node-haste/lib/AssetPaths');
|
|
15
17
|
const crypto = require('crypto');
|
|
16
18
|
const denodeify = require('denodeify');
|
|
17
19
|
const fs = require('fs');
|
|
18
20
|
const imageSize = require('image-size');
|
|
19
21
|
const path = require('path');
|
|
20
22
|
|
|
21
|
-
const {isAssetTypeAnImage} = require('./Bundler/util');
|
|
22
|
-
|
|
23
23
|
const readDir = denodeify(fs.readdir);
|
|
24
24
|
const readFile = denodeify(fs.readFile);
|
|
25
25
|
|
|
26
|
-
import type {AssetPath} from './node-haste/lib/AssetPaths';
|
|
27
|
-
|
|
28
26
|
export type AssetInfo = {|
|
|
29
27
|
+files: Array<string>,
|
|
30
28
|
+hash: string,
|
|
@@ -92,7 +90,7 @@ function buildAssetMap(
|
|
|
92
90
|
AssetPaths.tryParse(file, platforms),
|
|
93
91
|
);
|
|
94
92
|
const map = new Map();
|
|
95
|
-
assets.forEach(function(asset: ?AssetPath, i: number) {
|
|
93
|
+
assets.forEach(function (asset: ?AssetPath, i: number) {
|
|
96
94
|
if (asset == null) {
|
|
97
95
|
return;
|
|
98
96
|
}
|
package/src/Bundler/util.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.
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
|
|
12
|
-
const babelTypes = require("@babel/types");
|
|
13
|
-
|
|
14
12
|
const babylon = require("@babel/parser");
|
|
15
13
|
|
|
16
|
-
const nullthrows = require("nullthrows");
|
|
17
|
-
|
|
18
14
|
const template = require("@babel/template").default;
|
|
19
15
|
|
|
16
|
+
const babelTypes = require("@babel/types");
|
|
17
|
+
|
|
18
|
+
const nullthrows = require("nullthrows"); // Structure of the object: dir.name.scale = asset
|
|
19
|
+
|
|
20
20
|
const assetPropertyBlockList = new Set(["files", "fileSystemLocation", "path"]);
|
|
21
21
|
|
|
22
22
|
function generateAssetCodeFileAst(assetRegistryPath, assetDescriptor) {
|
|
@@ -37,8 +37,8 @@ function generateAssetCodeFileAst(assetRegistryPath, assetDescriptor) {
|
|
|
37
37
|
t.program([
|
|
38
38
|
buildRequire({
|
|
39
39
|
ASSET_REGISTRY_PATH: t.stringLiteral(assetRegistryPath),
|
|
40
|
-
DESCRIPTOR_AST: descriptorAst
|
|
41
|
-
})
|
|
40
|
+
DESCRIPTOR_AST: descriptorAst,
|
|
41
|
+
}),
|
|
42
42
|
])
|
|
43
43
|
);
|
|
44
44
|
}
|
|
@@ -92,8 +92,8 @@ function generateRemoteAssetCodeFileAst(
|
|
|
92
92
|
Object.keys(descriptor)
|
|
93
93
|
.map(Number)
|
|
94
94
|
.sort((a, b) => a - b)
|
|
95
|
-
.map(scale => t.numericLiteral(scale))
|
|
96
|
-
)
|
|
95
|
+
.map((scale) => t.numericLiteral(scale))
|
|
96
|
+
),
|
|
97
97
|
})
|
|
98
98
|
);
|
|
99
99
|
} // Test extension against all types supported by image-size module.
|
|
@@ -122,13 +122,13 @@ function createRamBundleGroups(ramGroups, groupableModules, subtree) {
|
|
|
122
122
|
// by path or (numeric) module id;
|
|
123
123
|
const byPath = new Map();
|
|
124
124
|
const byId = new Map();
|
|
125
|
-
groupableModules.forEach(m => {
|
|
125
|
+
groupableModules.forEach((m) => {
|
|
126
126
|
byPath.set(m.sourcePath, m);
|
|
127
127
|
byId.set(m.id, m.sourcePath);
|
|
128
128
|
}); // build a map of group root IDs to an array of module IDs in the group
|
|
129
129
|
|
|
130
130
|
const result = new Map(
|
|
131
|
-
ramGroups.map(modulePath => {
|
|
131
|
+
ramGroups.map((modulePath) => {
|
|
132
132
|
const root = byPath.get(modulePath);
|
|
133
133
|
|
|
134
134
|
if (root == null) {
|
|
@@ -137,7 +137,7 @@ function createRamBundleGroups(ramGroups, groupableModules, subtree) {
|
|
|
137
137
|
|
|
138
138
|
return [
|
|
139
139
|
root.id, // `subtree` yields the IDs of all transitive dependencies of a module
|
|
140
|
-
new Set(subtree(root, byPath))
|
|
140
|
+
new Set(subtree(root, byPath)),
|
|
141
141
|
];
|
|
142
142
|
})
|
|
143
143
|
);
|
|
@@ -159,8 +159,9 @@ function createRamBundleGroups(ramGroups, groupableModules, subtree) {
|
|
|
159
159
|
const parentNames = parents.map(byId.get, byId);
|
|
160
160
|
const lastName = parentNames.pop();
|
|
161
161
|
throw new Error(
|
|
162
|
-
`Module ${
|
|
163
|
-
|
|
162
|
+
`Module ${
|
|
163
|
+
byId.get(moduleId) || moduleId
|
|
164
|
+
} belongs to groups ${parentNames.join(", ")}, and ${String(
|
|
164
165
|
lastName
|
|
165
166
|
)}. Ensure that each module is only part of one group.`
|
|
166
167
|
);
|
|
@@ -195,5 +196,5 @@ module.exports = {
|
|
|
195
196
|
createRamBundleGroups,
|
|
196
197
|
generateAssetCodeFileAst,
|
|
197
198
|
generateRemoteAssetCodeFileAst,
|
|
198
|
-
isAssetTypeAnImage
|
|
199
|
+
isAssetTypeAnImage,
|
|
199
200
|
};
|
package/src/Bundler/util.js.flow
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,15 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const babelTypes = require('@babel/types');
|
|
14
|
-
const babylon = require('@babel/parser');
|
|
15
|
-
const nullthrows = require('nullthrows');
|
|
16
|
-
const template = require('@babel/template').default;
|
|
17
|
-
|
|
18
13
|
import type {AssetDataFiltered, AssetDataWithoutFiles} from '../Assets';
|
|
19
14
|
import type {ModuleTransportLike} from '../shared/types.flow';
|
|
20
15
|
import type {File} from '@babel/types';
|
|
21
16
|
|
|
17
|
+
const babylon = require('@babel/parser');
|
|
18
|
+
const template = require('@babel/template').default;
|
|
19
|
+
const babelTypes = require('@babel/types');
|
|
20
|
+
const nullthrows = require('nullthrows');
|
|
21
|
+
|
|
22
22
|
// Structure of the object: dir.name.scale = asset
|
|
23
23
|
export type RemoteFileMap = {
|
|
24
24
|
[string]: {
|
|
@@ -28,9 +28,9 @@ export type RemoteFileMap = {
|
|
|
28
28
|
hash: string,
|
|
29
29
|
...
|
|
30
30
|
},
|
|
31
|
-
|
|
31
|
+
...
|
|
32
32
|
},
|
|
33
|
-
|
|
33
|
+
...
|
|
34
34
|
},
|
|
35
35
|
__proto__: null,
|
|
36
36
|
...
|
|
@@ -207,8 +207,9 @@ function createRamBundleGroups<T: ModuleTransportLike>(
|
|
|
207
207
|
const parentNames = parents.map(byId.get, byId);
|
|
208
208
|
const lastName = parentNames.pop();
|
|
209
209
|
throw new Error(
|
|
210
|
-
`Module ${
|
|
211
|
-
|
|
210
|
+
`Module ${
|
|
211
|
+
byId.get(moduleId) || moduleId
|
|
212
|
+
} belongs to groups ${parentNames.join(', ')}, and ${String(
|
|
212
213
|
lastName,
|
|
213
214
|
)}. Ensure that each module is only part of one group.`,
|
|
214
215
|
);
|
package/src/Bundler.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.
|
|
@@ -9,23 +9,32 @@
|
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
|
|
12
|
-
const DependencyGraph = require("./node-haste/DependencyGraph");
|
|
13
|
-
|
|
14
12
|
const Transformer = require("./DeltaBundler/Transformer");
|
|
15
13
|
|
|
14
|
+
const DependencyGraph = require("./node-haste/DependencyGraph");
|
|
15
|
+
|
|
16
16
|
class Bundler {
|
|
17
17
|
constructor(config, options) {
|
|
18
18
|
this._depGraphPromise = DependencyGraph.load(config, options);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
this._readyPromise = this._depGraphPromise
|
|
20
|
+
.then((dependencyGraph) => {
|
|
21
|
+
config.reporter.update({
|
|
22
|
+
type: "transformer_load_started",
|
|
23
|
+
});
|
|
22
24
|
this._transformer = new Transformer(
|
|
23
25
|
config, // $FlowFixMe[method-unbinding] added when improving typing for this parameters
|
|
24
26
|
dependencyGraph.getSha1.bind(dependencyGraph)
|
|
25
27
|
);
|
|
28
|
+
config.reporter.update({
|
|
29
|
+
type: "transformer_load_done",
|
|
30
|
+
});
|
|
26
31
|
})
|
|
27
|
-
.catch(error => {
|
|
32
|
+
.catch((error) => {
|
|
28
33
|
console.error("Failed to construct transformer: ", error);
|
|
34
|
+
config.reporter.update({
|
|
35
|
+
type: "transformer_load_failed",
|
|
36
|
+
error,
|
|
37
|
+
});
|
|
29
38
|
});
|
|
30
39
|
}
|
|
31
40
|
|
|
@@ -34,7 +43,7 @@ class Bundler {
|
|
|
34
43
|
|
|
35
44
|
this._transformer.end();
|
|
36
45
|
|
|
37
|
-
dependencyGraph.
|
|
46
|
+
dependencyGraph.end();
|
|
38
47
|
}
|
|
39
48
|
|
|
40
49
|
async getDependencyGraph() {
|
|
@@ -46,6 +55,10 @@ class Bundler {
|
|
|
46
55
|
// TODO: Remove this ugly hack!
|
|
47
56
|
await this._depGraphPromise;
|
|
48
57
|
return this._transformer.transformFile(filePath, transformOptions);
|
|
58
|
+
} // Waits for the bundler to become ready.
|
|
59
|
+
|
|
60
|
+
async ready() {
|
|
61
|
+
await this._readyPromise;
|
|
49
62
|
}
|
|
50
63
|
}
|
|
51
64
|
|
package/src/Bundler.js.flow
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,13 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const DependencyGraph = require('./node-haste/DependencyGraph');
|
|
14
|
-
const Transformer = require('./DeltaBundler/Transformer');
|
|
15
|
-
|
|
16
|
-
import type {TransformOptions} from './DeltaBundler/Worker';
|
|
17
13
|
import type {TransformResultWithSource} from './DeltaBundler';
|
|
14
|
+
import type {TransformOptions} from './DeltaBundler/Worker';
|
|
18
15
|
import type {ConfigT} from 'metro-config/src/configTypes.flow';
|
|
19
16
|
|
|
17
|
+
const Transformer = require('./DeltaBundler/Transformer');
|
|
18
|
+
const DependencyGraph = require('./node-haste/DependencyGraph');
|
|
19
|
+
|
|
20
20
|
export type BundlerOptions = $ReadOnly<{|
|
|
21
21
|
hasReducedPerformance?: boolean,
|
|
22
22
|
watch?: boolean,
|
|
@@ -24,21 +24,28 @@ export type BundlerOptions = $ReadOnly<{|
|
|
|
24
24
|
|
|
25
25
|
class Bundler {
|
|
26
26
|
_depGraphPromise: Promise<DependencyGraph>;
|
|
27
|
+
_readyPromise: Promise<void>;
|
|
27
28
|
_transformer: Transformer;
|
|
28
29
|
|
|
29
30
|
constructor(config: ConfigT, options?: BundlerOptions) {
|
|
30
31
|
this._depGraphPromise = DependencyGraph.load(config, options);
|
|
31
32
|
|
|
32
|
-
this._depGraphPromise
|
|
33
|
+
this._readyPromise = this._depGraphPromise
|
|
33
34
|
.then((dependencyGraph: DependencyGraph) => {
|
|
35
|
+
config.reporter.update({type: 'transformer_load_started'});
|
|
34
36
|
this._transformer = new Transformer(
|
|
35
37
|
config,
|
|
36
38
|
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
|
|
37
39
|
dependencyGraph.getSha1.bind(dependencyGraph),
|
|
38
40
|
);
|
|
41
|
+
config.reporter.update({type: 'transformer_load_done'});
|
|
39
42
|
})
|
|
40
43
|
.catch(error => {
|
|
41
44
|
console.error('Failed to construct transformer: ', error);
|
|
45
|
+
config.reporter.update({
|
|
46
|
+
type: 'transformer_load_failed',
|
|
47
|
+
error,
|
|
48
|
+
});
|
|
42
49
|
});
|
|
43
50
|
}
|
|
44
51
|
|
|
@@ -46,7 +53,7 @@ class Bundler {
|
|
|
46
53
|
const dependencyGraph = await this._depGraphPromise;
|
|
47
54
|
|
|
48
55
|
this._transformer.end();
|
|
49
|
-
dependencyGraph.
|
|
56
|
+
dependencyGraph.end();
|
|
50
57
|
}
|
|
51
58
|
|
|
52
59
|
async getDependencyGraph(): Promise<DependencyGraph> {
|
|
@@ -63,6 +70,11 @@ class Bundler {
|
|
|
63
70
|
|
|
64
71
|
return this._transformer.transformFile(filePath, transformOptions);
|
|
65
72
|
}
|
|
73
|
+
|
|
74
|
+
// Waits for the bundler to become ready.
|
|
75
|
+
async ready(): Promise<void> {
|
|
76
|
+
await this._readyPromise;
|
|
77
|
+
}
|
|
66
78
|
}
|
|
67
79
|
|
|
68
80
|
module.exports = Bundler;
|
|
@@ -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,17 +12,17 @@
|
|
|
12
12
|
const {
|
|
13
13
|
initialTraverseDependencies,
|
|
14
14
|
reorderGraph,
|
|
15
|
-
traverseDependencies
|
|
15
|
+
traverseDependencies,
|
|
16
16
|
} = require("./traverseDependencies");
|
|
17
17
|
|
|
18
18
|
const { EventEmitter } = require("events");
|
|
19
|
-
|
|
20
19
|
/**
|
|
21
20
|
* This class is in charge of calculating the delta of changed modules that
|
|
22
21
|
* happen between calls. To do so, it subscribes to file changes, so it can
|
|
23
22
|
* traverse the files that have been changed between calls and avoid having to
|
|
24
23
|
* traverse the whole dependency tree for trivial small changes.
|
|
25
24
|
*/
|
|
25
|
+
|
|
26
26
|
class DeltaCalculator extends EventEmitter {
|
|
27
27
|
_deletedFiles = new Set();
|
|
28
28
|
_modifiedFiles = new Set();
|
|
@@ -35,7 +35,7 @@ class DeltaCalculator extends EventEmitter {
|
|
|
35
35
|
dependencies: new Map(),
|
|
36
36
|
entryPoints,
|
|
37
37
|
importBundleNames: new Set(),
|
|
38
|
-
transformOptions: this._options.transformOptions
|
|
38
|
+
transformOptions: this._options.transformOptions,
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
this._dependencyGraph
|
|
@@ -57,7 +57,7 @@ class DeltaCalculator extends EventEmitter {
|
|
|
57
57
|
dependencies: new Map(),
|
|
58
58
|
entryPoints: this._graph.entryPoints,
|
|
59
59
|
importBundleNames: new Set(),
|
|
60
|
-
transformOptions: this._options.transformOptions
|
|
60
|
+
transformOptions: this._options.transformOptions,
|
|
61
61
|
};
|
|
62
62
|
this._modifiedFiles = new Set();
|
|
63
63
|
this._deletedFiles = new Set();
|
|
@@ -97,8 +97,8 @@ class DeltaCalculator extends EventEmitter {
|
|
|
97
97
|
// processed (since we haven't actually created any delta). If we do not
|
|
98
98
|
// do so, asking for a delta after an error will produce an empty Delta,
|
|
99
99
|
// which is not correct.
|
|
100
|
-
modifiedFiles.forEach(file => this._modifiedFiles.add(file));
|
|
101
|
-
deletedFiles.forEach(file => this._deletedFiles.add(file)); // If after an error the number of modules has changed, we could be in
|
|
100
|
+
modifiedFiles.forEach((file) => this._modifiedFiles.add(file));
|
|
101
|
+
deletedFiles.forEach((file) => this._deletedFiles.add(file)); // If after an error the number of modules has changed, we could be in
|
|
102
102
|
// a weird state. As a safe net we clean the dependency modules to force
|
|
103
103
|
// a clean traversal of the graph next time.
|
|
104
104
|
|
|
@@ -113,13 +113,13 @@ class DeltaCalculator extends EventEmitter {
|
|
|
113
113
|
|
|
114
114
|
if (reset) {
|
|
115
115
|
reorderGraph(this._graph, {
|
|
116
|
-
shallow
|
|
116
|
+
shallow,
|
|
117
117
|
});
|
|
118
118
|
return {
|
|
119
119
|
added: this._graph.dependencies,
|
|
120
120
|
modified: new Map(),
|
|
121
121
|
deleted: new Set(),
|
|
122
|
-
reset: true
|
|
122
|
+
reset: true,
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
125
|
|
|
@@ -169,16 +169,16 @@ class DeltaCalculator extends EventEmitter {
|
|
|
169
169
|
added,
|
|
170
170
|
modified: new Map(),
|
|
171
171
|
deleted: new Set(),
|
|
172
|
-
reset: true
|
|
172
|
+
reset: true,
|
|
173
173
|
};
|
|
174
174
|
} // If a file has been deleted, we want to invalidate any other file that
|
|
175
175
|
// depends on it, so we can process it and correctly return an error.
|
|
176
176
|
|
|
177
|
-
deletedFiles.forEach(filePath => {
|
|
177
|
+
deletedFiles.forEach((filePath) => {
|
|
178
178
|
const module = this._graph.dependencies.get(filePath);
|
|
179
179
|
|
|
180
180
|
if (module) {
|
|
181
|
-
module.inverseDependencies.forEach(path => {
|
|
181
|
+
module.inverseDependencies.forEach((path) => {
|
|
182
182
|
// Only mark the inverse dependency as modified if it's not already
|
|
183
183
|
// marked as deleted (in that case we can just ignore it).
|
|
184
184
|
if (!deletedFiles.has(path)) {
|
|
@@ -188,7 +188,7 @@ class DeltaCalculator extends EventEmitter {
|
|
|
188
188
|
}
|
|
189
189
|
}); // We only want to process files that are in the bundle.
|
|
190
190
|
|
|
191
|
-
const modifiedDependencies = Array.from(modifiedFiles).filter(filePath =>
|
|
191
|
+
const modifiedDependencies = Array.from(modifiedFiles).filter((filePath) =>
|
|
192
192
|
this._graph.dependencies.has(filePath)
|
|
193
193
|
); // No changes happened. Return empty delta.
|
|
194
194
|
|
|
@@ -197,7 +197,7 @@ class DeltaCalculator extends EventEmitter {
|
|
|
197
197
|
added: new Map(),
|
|
198
198
|
modified: new Map(),
|
|
199
199
|
deleted: new Set(),
|
|
200
|
-
reset: false
|
|
200
|
+
reset: false,
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
203
|
|
|
@@ -210,7 +210,7 @@ class DeltaCalculator extends EventEmitter {
|
|
|
210
210
|
added,
|
|
211
211
|
modified,
|
|
212
212
|
deleted,
|
|
213
|
-
reset: false
|
|
213
|
+
reset: false,
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
216
|
}
|
|
@@ -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,6 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
+
import type DependencyGraph from '../node-haste/DependencyGraph';
|
|
14
|
+
import type {DeltaResult, Graph, Options} from './types.flow';
|
|
15
|
+
|
|
13
16
|
const {
|
|
14
17
|
initialTraverseDependencies,
|
|
15
18
|
reorderGraph,
|
|
@@ -17,9 +20,6 @@ const {
|
|
|
17
20
|
} = require('./traverseDependencies');
|
|
18
21
|
const {EventEmitter} = require('events');
|
|
19
22
|
|
|
20
|
-
import type DependencyGraph from '../node-haste/DependencyGraph';
|
|
21
|
-
import type {DeltaResult, Graph, Options} from './types.flow';
|
|
22
|
-
|
|
23
23
|
/**
|
|
24
24
|
* This class is in charge of calculating the delta of changed modules that
|
|
25
25
|
* happen between calls. To do so, it subscribes to file changes, so it can
|
|
@@ -228,9 +228,9 @@ class DeltaCalculator<T> extends EventEmitter {
|
|
|
228
228
|
});
|
|
229
229
|
|
|
230
230
|
// We only want to process files that are in the bundle.
|
|
231
|
-
const modifiedDependencies = Array.from(
|
|
232
|
-
|
|
233
|
-
)
|
|
231
|
+
const modifiedDependencies = Array.from(modifiedFiles).filter(
|
|
232
|
+
(filePath: string) => this._graph.dependencies.has(filePath),
|
|
233
|
+
);
|
|
234
234
|
|
|
235
235
|
// No changes happened. Return empty delta.
|
|
236
236
|
if (modifiedDependencies.length === 0) {
|