@atlaspack/core 2.16.2-canary.5 → 2.16.2-canary.500
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/CHANGELOG.md +1452 -0
- package/dist/AssetGraph.js +523 -0
- package/dist/Atlaspack.js +701 -0
- package/dist/AtlaspackConfig.js +324 -0
- package/dist/AtlaspackConfig.schema.js +117 -0
- package/dist/BundleGraph.js +1906 -0
- package/dist/CommittedAsset.js +142 -0
- package/dist/Dependency.js +125 -0
- package/dist/Environment.js +132 -0
- package/dist/EnvironmentManager.js +108 -0
- package/dist/IdentifierRegistry.js +38 -0
- package/dist/InternalConfig.js +37 -0
- package/dist/PackagerRunner.js +470 -0
- package/dist/ReporterRunner.js +151 -0
- package/dist/RequestTracker.js +1297 -0
- package/dist/SymbolPropagation.js +624 -0
- package/dist/TargetDescriptor.schema.js +146 -0
- package/dist/Transformation.js +514 -0
- package/dist/UncommittedAsset.js +310 -0
- package/dist/Validation.js +196 -0
- package/dist/applyRuntimes.js +384 -0
- package/dist/assetUtils.js +169 -0
- package/dist/atlaspack-v3/AtlaspackV3.js +83 -0
- package/dist/atlaspack-v3/NapiWorkerPool.js +114 -0
- package/dist/atlaspack-v3/fs.js +53 -0
- package/dist/atlaspack-v3/index.js +25 -0
- package/dist/atlaspack-v3/jsCallable.js +16 -0
- package/dist/atlaspack-v3/worker/compat/asset-symbols.js +190 -0
- package/dist/atlaspack-v3/worker/compat/bitflags.js +98 -0
- package/dist/atlaspack-v3/worker/compat/dependency.js +43 -0
- package/dist/atlaspack-v3/worker/compat/environment.js +57 -0
- package/dist/atlaspack-v3/worker/compat/index.js +24 -0
- package/dist/atlaspack-v3/worker/compat/mutable-asset.js +152 -0
- package/dist/atlaspack-v3/worker/compat/plugin-config.js +64 -0
- package/dist/atlaspack-v3/worker/compat/plugin-options.js +137 -0
- package/dist/atlaspack-v3/worker/compat/plugin-tracer.js +10 -0
- package/dist/atlaspack-v3/worker/compat/target.js +14 -0
- package/dist/atlaspack-v3/worker/side-effect-detector.js +243 -0
- package/dist/atlaspack-v3/worker/worker.js +398 -0
- package/dist/constants.js +17 -0
- package/dist/dumpGraphToGraphViz.js +281 -0
- package/dist/index.js +62 -0
- package/dist/loadAtlaspackPlugin.js +128 -0
- package/dist/loadDotEnv.js +41 -0
- package/dist/projectPath.js +83 -0
- package/dist/public/Asset.js +279 -0
- package/dist/public/Bundle.js +224 -0
- package/dist/public/BundleGraph.js +371 -0
- package/dist/public/BundleGroup.js +53 -0
- package/dist/public/Config.js +286 -0
- package/dist/public/Dependency.js +138 -0
- package/dist/public/Environment.js +278 -0
- package/dist/public/MutableBundleGraph.js +277 -0
- package/dist/public/PluginOptions.js +80 -0
- package/dist/public/Symbols.js +248 -0
- package/dist/public/Target.js +69 -0
- package/dist/registerCoreWithSerializer.js +38 -0
- package/dist/requests/AssetGraphRequest.js +430 -0
- package/dist/requests/AssetGraphRequestRust.js +471 -0
- package/dist/requests/AssetRequest.js +130 -0
- package/dist/requests/AtlaspackBuildRequest.js +98 -0
- package/dist/requests/AtlaspackConfigRequest.js +493 -0
- package/dist/requests/BundleGraphRequest.js +381 -0
- package/dist/requests/BundleGraphRequestRust.js +324 -0
- package/dist/requests/BundleGraphRequestUtils.js +262 -0
- package/dist/requests/ConfigRequest.js +246 -0
- package/dist/requests/DevDepRequest.js +204 -0
- package/dist/requests/EntryRequest.js +314 -0
- package/dist/requests/PackageRequest.js +89 -0
- package/dist/requests/PathRequest.js +349 -0
- package/dist/requests/TargetRequest.js +1316 -0
- package/dist/requests/ValidationRequest.js +49 -0
- package/dist/requests/WriteBundleRequest.js +522 -0
- package/dist/requests/WriteBundlesRequest.js +190 -0
- package/dist/requests/asset-graph-diff.js +128 -0
- package/dist/requests/asset-graph-dot.js +131 -0
- package/dist/resolveOptions.js +267 -0
- package/dist/rustWorkerThreadDylibHack.js +19 -0
- package/dist/serializerCore.browser.js +43 -0
- package/dist/summarizeRequest.js +39 -0
- package/dist/types.js +31 -0
- package/dist/utils.js +172 -0
- package/dist/worker.js +123 -0
- package/lib/AssetGraph.js +53 -15
- package/lib/Atlaspack.js +160 -57
- package/lib/AtlaspackConfig.js +17 -6
- package/lib/AtlaspackConfig.schema.js +16 -5
- package/lib/BundleGraph.js +390 -43
- package/lib/CommittedAsset.js +8 -2
- package/lib/Dependency.js +9 -3
- package/lib/Environment.js +16 -10
- package/lib/EnvironmentManager.js +143 -0
- package/lib/IdentifierRegistry.js +2 -4
- package/lib/InternalConfig.js +3 -2
- package/lib/PackagerRunner.js +38 -40
- package/lib/ReporterRunner.js +8 -12
- package/lib/RequestTracker.js +336 -168
- package/lib/SymbolPropagation.js +52 -29
- package/lib/TargetDescriptor.schema.js +10 -1
- package/lib/Transformation.js +68 -19
- package/lib/UncommittedAsset.js +23 -13
- package/lib/Validation.js +20 -5
- package/lib/applyRuntimes.js +98 -7
- package/lib/assetUtils.js +16 -6
- package/lib/atlaspack-v3/AtlaspackV3.js +58 -15
- package/lib/atlaspack-v3/NapiWorkerPool.js +63 -2
- package/lib/atlaspack-v3/fs.js +4 -1
- package/lib/atlaspack-v3/index.js +28 -1
- package/lib/atlaspack-v3/jsCallable.js +0 -2
- package/lib/atlaspack-v3/worker/compat/asset-symbols.js +7 -4
- package/lib/atlaspack-v3/worker/compat/bitflags.js +31 -25
- package/lib/atlaspack-v3/worker/compat/dependency.js +4 -1
- package/lib/atlaspack-v3/worker/compat/environment.js +10 -7
- package/lib/atlaspack-v3/worker/compat/index.js +0 -11
- package/lib/atlaspack-v3/worker/compat/mutable-asset.js +16 -11
- package/lib/atlaspack-v3/worker/compat/plugin-config.js +14 -35
- package/lib/atlaspack-v3/worker/compat/plugin-options.js +16 -2
- package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +3 -0
- package/lib/atlaspack-v3/worker/compat/target.js +2 -0
- package/lib/atlaspack-v3/worker/index.js +3 -0
- package/lib/atlaspack-v3/worker/side-effect-detector.js +214 -0
- package/lib/atlaspack-v3/worker/worker.js +239 -79
- package/lib/constants.js +0 -1
- package/lib/dumpGraphToGraphViz.js +72 -17
- package/lib/index.js +46 -3
- package/lib/loadAtlaspackPlugin.js +2 -3
- package/lib/loadDotEnv.js +5 -2
- package/lib/projectPath.js +6 -1
- package/lib/public/Asset.js +22 -12
- package/lib/public/Bundle.js +16 -18
- package/lib/public/BundleGraph.js +25 -7
- package/lib/public/BundleGroup.js +5 -6
- package/lib/public/Config.js +118 -18
- package/lib/public/Dependency.js +9 -7
- package/lib/public/Environment.js +13 -8
- package/lib/public/MutableBundleGraph.js +56 -15
- package/lib/public/PluginOptions.js +2 -2
- package/lib/public/Symbols.js +12 -12
- package/lib/public/Target.js +8 -7
- package/lib/registerCoreWithSerializer.js +7 -4
- package/lib/requests/AssetGraphRequest.js +60 -27
- package/lib/requests/AssetGraphRequestRust.js +314 -82
- package/lib/requests/AssetRequest.js +24 -7
- package/lib/requests/AtlaspackBuildRequest.js +53 -7
- package/lib/requests/AtlaspackConfigRequest.js +29 -19
- package/lib/requests/BundleGraphRequest.js +67 -124
- package/lib/requests/BundleGraphRequestRust.js +381 -0
- package/lib/requests/BundleGraphRequestUtils.js +280 -0
- package/lib/requests/ConfigRequest.js +55 -7
- package/lib/requests/DevDepRequest.js +32 -6
- package/lib/requests/EntryRequest.js +4 -3
- package/lib/requests/PackageRequest.js +56 -12
- package/lib/requests/PathRequest.js +26 -6
- package/lib/requests/TargetRequest.js +129 -60
- package/lib/requests/ValidationRequest.js +6 -2
- package/lib/requests/WriteBundleRequest.js +336 -18
- package/lib/requests/WriteBundlesRequest.js +64 -10
- package/lib/requests/asset-graph-diff.js +13 -8
- package/lib/requests/asset-graph-dot.js +2 -8
- package/lib/resolveOptions.js +35 -10
- package/lib/rustWorkerThreadDylibHack.js +0 -1
- package/lib/serializerCore.browser.js +1 -2
- package/lib/summarizeRequest.js +1 -1
- package/lib/types/AssetGraph.d.ts +55 -0
- package/lib/types/Atlaspack.d.ts +52 -0
- package/lib/types/AtlaspackConfig.d.ts +65 -0
- package/lib/types/AtlaspackConfig.schema.d.ts +53 -0
- package/lib/types/BundleGraph.d.ts +232 -0
- package/lib/types/CommittedAsset.d.ts +23 -0
- package/lib/types/Dependency.d.ts +44 -0
- package/lib/types/Environment.d.ts +11 -0
- package/lib/types/EnvironmentManager.d.ts +37 -0
- package/lib/types/IdentifierRegistry.d.ts +6 -0
- package/lib/types/InternalConfig.d.ts +23 -0
- package/lib/types/PackagerRunner.d.ts +85 -0
- package/lib/types/ReporterRunner.d.ts +25 -0
- package/lib/types/RequestTracker.d.ts +385 -0
- package/lib/types/SymbolPropagation.d.ts +11 -0
- package/lib/types/TargetDescriptor.schema.d.ts +5 -0
- package/lib/types/Transformation.d.ts +72 -0
- package/lib/types/UncommittedAsset.d.ts +61 -0
- package/lib/types/Validation.d.ts +37 -0
- package/lib/types/applyRuntimes.d.ts +25 -0
- package/lib/types/assetUtils.d.ts +42 -0
- package/lib/types/atlaspack-v3/AtlaspackV3.d.ts +35 -0
- package/lib/types/atlaspack-v3/NapiWorkerPool.d.ts +13 -0
- package/lib/types/atlaspack-v3/fs.d.ts +13 -0
- package/lib/types/atlaspack-v3/index.d.ts +6 -0
- package/lib/types/atlaspack-v3/jsCallable.d.ts +1 -0
- package/lib/types/atlaspack-v3/worker/compat/asset-symbols.d.ts +51 -0
- package/lib/types/atlaspack-v3/worker/compat/bitflags.d.ts +14 -0
- package/lib/types/atlaspack-v3/worker/compat/dependency.d.ts +25 -0
- package/lib/types/atlaspack-v3/worker/compat/environment.d.ts +27 -0
- package/{src/atlaspack-v3/worker/compat/index.js → lib/types/atlaspack-v3/worker/compat/index.d.ts} +0 -2
- package/lib/types/atlaspack-v3/worker/compat/mutable-asset.d.ts +49 -0
- package/lib/types/atlaspack-v3/worker/compat/plugin-config.d.ts +29 -0
- package/lib/types/atlaspack-v3/worker/compat/plugin-options.d.ts +23 -0
- package/lib/types/atlaspack-v3/worker/compat/plugin-tracer.d.ts +5 -0
- package/lib/types/atlaspack-v3/worker/compat/target.d.ts +11 -0
- package/lib/types/atlaspack-v3/worker/side-effect-detector.d.ts +76 -0
- package/lib/types/atlaspack-v3/worker/worker.d.ts +81 -0
- package/lib/types/constants.d.ts +13 -0
- package/lib/types/dumpGraphToGraphViz.d.ts +10 -0
- package/lib/types/index.d.ts +8 -0
- package/lib/types/loadAtlaspackPlugin.d.ts +8 -0
- package/lib/types/loadDotEnv.d.ts +3 -0
- package/lib/types/projectPath.d.ts +19 -0
- package/lib/types/public/Asset.d.ts +74 -0
- package/lib/types/public/Bundle.d.ts +45 -0
- package/lib/types/public/BundleGraph.d.ts +72 -0
- package/lib/types/public/BundleGroup.d.ts +12 -0
- package/lib/types/public/Config.d.ts +75 -0
- package/lib/types/public/Dependency.d.ts +32 -0
- package/lib/types/public/Environment.d.ts +34 -0
- package/lib/types/public/MutableBundleGraph.d.ts +26 -0
- package/lib/types/public/PluginOptions.d.ts +25 -0
- package/lib/types/public/Symbols.d.ts +81 -0
- package/lib/types/public/Target.d.ts +16 -0
- package/lib/types/registerCoreWithSerializer.d.ts +2 -0
- package/lib/types/requests/AssetGraphRequest.d.ts +76 -0
- package/lib/types/requests/AssetGraphRequestRust.d.ts +21 -0
- package/lib/types/requests/AssetRequest.d.ts +16 -0
- package/lib/types/requests/AtlaspackBuildRequest.d.ts +33 -0
- package/lib/types/requests/AtlaspackConfigRequest.d.ts +45 -0
- package/lib/types/requests/BundleGraphRequest.d.ts +28 -0
- package/lib/types/requests/BundleGraphRequestRust.d.ts +34 -0
- package/lib/types/requests/BundleGraphRequestUtils.d.ts +38 -0
- package/lib/types/requests/ConfigRequest.d.ts +67 -0
- package/lib/types/requests/DevDepRequest.d.ts +30 -0
- package/lib/types/requests/EntryRequest.d.ts +36 -0
- package/lib/types/requests/PackageRequest.d.ts +27 -0
- package/lib/types/requests/PathRequest.d.ts +48 -0
- package/lib/types/requests/TargetRequest.d.ts +48 -0
- package/lib/types/requests/ValidationRequest.d.ts +20 -0
- package/lib/types/requests/WriteBundleRequest.d.ts +80 -0
- package/lib/types/requests/WriteBundlesRequest.d.ts +32 -0
- package/lib/types/requests/asset-graph-diff.d.ts +1 -0
- package/lib/types/requests/asset-graph-dot.d.ts +9 -0
- package/lib/types/resolveOptions.d.ts +3 -0
- package/lib/types/rustWorkerThreadDylibHack.d.ts +9 -0
- package/lib/types/serializerCore.browser.d.ts +3 -0
- package/lib/types/summarizeRequest.d.ts +10 -0
- package/lib/types/types.d.ts +496 -0
- package/lib/types/utils.d.ts +23 -0
- package/lib/types/worker.d.ts +44 -0
- package/lib/types.js +8 -1
- package/lib/utils.js +18 -3
- package/lib/worker.js +32 -15
- package/package.json +27 -33
- package/src/{AssetGraph.js → AssetGraph.ts} +87 -51
- package/src/{Atlaspack.js → Atlaspack.ts} +203 -73
- package/src/{AtlaspackConfig.schema.js → AtlaspackConfig.schema.ts} +25 -19
- package/src/{AtlaspackConfig.js → AtlaspackConfig.ts} +78 -54
- package/src/{BundleGraph.js → BundleGraph.ts} +575 -145
- package/src/{CommittedAsset.js → CommittedAsset.ts} +15 -13
- package/src/{Dependency.js → Dependency.ts} +59 -42
- package/src/{Environment.js → Environment.ts} +24 -15
- package/src/EnvironmentManager.ts +154 -0
- package/src/{IdentifierRegistry.js → IdentifierRegistry.ts} +1 -4
- package/src/{InternalConfig.js → InternalConfig.ts} +22 -23
- package/src/{PackagerRunner.js → PackagerRunner.ts} +109 -103
- package/src/{ReporterRunner.js → ReporterRunner.ts} +13 -18
- package/src/{RequestTracker.js → RequestTracker.ts} +672 -347
- package/src/{SymbolPropagation.js → SymbolPropagation.ts} +178 -61
- package/src/{TargetDescriptor.schema.js → TargetDescriptor.schema.ts} +10 -1
- package/src/{Transformation.js → Transformation.ts} +110 -65
- package/src/{UncommittedAsset.js → UncommittedAsset.ts} +50 -39
- package/src/{Validation.js → Validation.ts} +32 -17
- package/src/{applyRuntimes.js → applyRuntimes.ts} +135 -26
- package/src/{assetUtils.js → assetUtils.ts} +49 -36
- package/src/atlaspack-v3/AtlaspackV3.ts +183 -0
- package/src/atlaspack-v3/NapiWorkerPool.ts +129 -0
- package/src/atlaspack-v3/{fs.js → fs.ts} +8 -4
- package/src/atlaspack-v3/{index.js → index.ts} +3 -4
- package/src/atlaspack-v3/jsCallable.ts +14 -0
- package/src/atlaspack-v3/worker/compat/{asset-symbols.js → asset-symbols.ts} +40 -30
- package/src/atlaspack-v3/worker/compat/bitflags.ts +102 -0
- package/src/atlaspack-v3/worker/compat/{dependency.js → dependency.ts} +13 -13
- package/src/atlaspack-v3/worker/compat/{environment.js → environment.ts} +13 -9
- package/src/atlaspack-v3/worker/compat/index.ts +8 -0
- package/src/atlaspack-v3/worker/compat/{mutable-asset.js → mutable-asset.ts} +21 -20
- package/src/atlaspack-v3/worker/compat/{plugin-config.js → plugin-config.ts} +25 -56
- package/src/atlaspack-v3/worker/compat/{plugin-options.js → plugin-options.ts} +19 -5
- package/src/atlaspack-v3/worker/compat/{plugin-tracer.js → plugin-tracer.ts} +2 -2
- package/src/atlaspack-v3/worker/compat/{target.js → target.ts} +3 -4
- package/src/atlaspack-v3/worker/index.js +2 -1
- package/src/atlaspack-v3/worker/side-effect-detector.ts +298 -0
- package/src/atlaspack-v3/worker/worker.ts +548 -0
- package/src/{constants.js → constants.ts} +0 -3
- package/src/{dumpGraphToGraphViz.js → dumpGraphToGraphViz.ts} +73 -28
- package/src/index.ts +18 -0
- package/src/{loadAtlaspackPlugin.js → loadAtlaspackPlugin.ts} +8 -9
- package/src/{loadDotEnv.js → loadDotEnv.ts} +2 -2
- package/src/{projectPath.js → projectPath.ts} +20 -9
- package/src/public/{Asset.js → Asset.ts} +41 -28
- package/src/public/{Bundle.js → Bundle.ts} +28 -29
- package/src/public/{BundleGraph.js → BundleGraph.ts} +102 -50
- package/src/public/{BundleGroup.js → BundleGroup.ts} +7 -10
- package/src/public/{Config.js → Config.ts} +171 -33
- package/src/public/{Dependency.js → Dependency.ts} +20 -17
- package/src/public/{Environment.js → Environment.ts} +28 -17
- package/src/public/{MutableBundleGraph.js → MutableBundleGraph.ts} +55 -24
- package/src/public/{PluginOptions.js → PluginOptions.ts} +6 -6
- package/src/public/{Symbols.js → Symbols.ts} +75 -36
- package/src/public/{Target.js → Target.ts} +10 -8
- package/src/{registerCoreWithSerializer.js → registerCoreWithSerializer.ts} +9 -7
- package/src/requests/{AssetGraphRequest.js → AssetGraphRequest.ts} +114 -77
- package/src/requests/AssetGraphRequestRust.ts +557 -0
- package/src/requests/{AssetRequest.js → AssetRequest.ts} +24 -18
- package/src/requests/AtlaspackBuildRequest.ts +168 -0
- package/src/requests/{AtlaspackConfigRequest.js → AtlaspackConfigRequest.ts} +72 -58
- package/src/requests/{BundleGraphRequest.js → BundleGraphRequest.ts} +117 -187
- package/src/requests/BundleGraphRequestRust.ts +470 -0
- package/src/requests/BundleGraphRequestUtils.ts +323 -0
- package/src/requests/{ConfigRequest.js → ConfigRequest.ts} +110 -50
- package/src/requests/{DevDepRequest.js → DevDepRequest.ts} +60 -35
- package/src/requests/{EntryRequest.js → EntryRequest.ts} +36 -31
- package/src/requests/{PackageRequest.js → PackageRequest.ts} +52 -25
- package/src/requests/{PathRequest.js → PathRequest.ts} +47 -37
- package/src/requests/{TargetRequest.js → TargetRequest.ts} +265 -179
- package/src/requests/{ValidationRequest.js → ValidationRequest.ts} +18 -17
- package/src/requests/WriteBundleRequest.ts +734 -0
- package/src/requests/{WriteBundlesRequest.js → WriteBundlesRequest.ts} +134 -50
- package/src/requests/{asset-graph-diff.js → asset-graph-diff.ts} +25 -21
- package/src/requests/{asset-graph-dot.js → asset-graph-dot.ts} +8 -12
- package/src/{resolveOptions.js → resolveOptions.ts} +55 -23
- package/src/{rustWorkerThreadDylibHack.js → rustWorkerThreadDylibHack.ts} +1 -4
- package/src/{serializerCore.browser.js → serializerCore.browser.ts} +2 -3
- package/src/{summarizeRequest.js → summarizeRequest.ts} +17 -5
- package/src/types.ts +651 -0
- package/src/{utils.js → utils.ts} +52 -21
- package/src/{worker.js → worker.ts} +50 -42
- package/test/{AssetGraph.test.js → AssetGraph.test.ts} +5 -8
- package/test/{Atlaspack.test.js → Atlaspack.test.ts} +5 -10
- package/test/{AtlaspackConfig.test.js → AtlaspackConfig.test.ts} +0 -5
- package/test/{AtlaspackConfigRequest.test.js → AtlaspackConfigRequest.test.ts} +76 -16
- package/test/{BundleGraph.test.js → BundleGraph.test.ts} +8 -13
- package/test/{Dependency.test.js → Dependency.test.ts} +2 -3
- package/test/{EntryRequest.test.js → EntryRequest.test.ts} +1 -6
- package/test/Environment.test.ts +153 -0
- package/test/EnvironmentManager.test.ts +188 -0
- package/test/{IdentifierRegistry.test.js → IdentifierRegistry.test.ts} +2 -4
- package/test/{InternalAsset.test.js → InternalAsset.test.ts} +2 -7
- package/test/PackagerRunner.test.ts +0 -0
- package/test/{PublicAsset.test.js → PublicAsset.test.ts} +2 -7
- package/test/{PublicBundle.test.js → PublicBundle.test.ts} +1 -2
- package/test/{PublicDependency.test.js → PublicDependency.test.ts} +0 -2
- package/test/PublicEnvironment.test.ts +49 -0
- package/test/{PublicMutableBundleGraph.test.js → PublicMutableBundleGraph.test.ts} +6 -11
- package/test/{RequestTracker.test.js → RequestTracker.test.ts} +149 -59
- package/test/{SymbolPropagation.test.js → SymbolPropagation.test.ts} +124 -74
- package/test/{TargetRequest.test.js → TargetRequest.test.ts} +91 -92
- package/test/fixtures/config-with-reporters/.parcelrc +7 -0
- package/test/fixtures/custom-targets/package.json +6 -0
- package/test/public/Config.test.ts +104 -0
- package/test/requests/AssetGraphRequestRust.test.ts +443 -0
- package/test/requests/{ConfigRequest.test.js → ConfigRequest.test.ts} +202 -13
- package/test/requests/{DevDepRequest.test.js → DevDepRequest.test.ts} +0 -2
- package/test/requests/WriteBundleRequest.test.ts +602 -0
- package/test/{test-utils.js → test-utils.ts} +4 -11
- package/test/{utils.test.js → utils.test.ts} +1 -3
- package/tsconfig.json +60 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/index.d.ts +0 -30
- package/lib/atlaspack-v3/worker/compat/plugin-logger.js +0 -29
- package/src/atlaspack-v3/AtlaspackV3.js +0 -87
- package/src/atlaspack-v3/NapiWorkerPool.js +0 -53
- package/src/atlaspack-v3/jsCallable.js +0 -18
- package/src/atlaspack-v3/worker/compat/bitflags.js +0 -100
- package/src/atlaspack-v3/worker/compat/plugin-logger.js +0 -47
- package/src/atlaspack-v3/worker/worker.js +0 -362
- package/src/index.js +0 -13
- package/src/requests/AssetGraphRequestRust.js +0 -263
- package/src/requests/AtlaspackBuildRequest.js +0 -111
- package/src/requests/WriteBundleRequest.js +0 -362
- package/src/types.js +0 -600
- package/test/Environment.test.js +0 -119
- package/test/PackagerRunner.test.js +0 -27
- package/test/PublicEnvironment.test.js +0 -27
- package/test/requests/AssetGraphRequestRust.test.js +0 -411
package/lib/RequestTracker.js
CHANGED
|
@@ -6,9 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.RequestGraph = void 0;
|
|
7
7
|
exports.cleanUpOrphans = cleanUpOrphans;
|
|
8
8
|
exports.default = void 0;
|
|
9
|
+
exports.getBiggestFSEventsInvalidations = getBiggestFSEventsInvalidations;
|
|
9
10
|
exports.getWatcherOptions = getWatcherOptions;
|
|
11
|
+
exports.invalidateRequestGraph = invalidateRequestGraph;
|
|
12
|
+
exports.invalidateRequestGraphFSEvents = invalidateRequestGraphFSEvents;
|
|
10
13
|
exports.readAndDeserializeRequestGraph = readAndDeserializeRequestGraph;
|
|
11
14
|
exports.requestTypes = exports.requestGraphEdgeTypes = void 0;
|
|
15
|
+
exports.runInvalidation = runInvalidation;
|
|
12
16
|
function _assert() {
|
|
13
17
|
const data = _interopRequireWildcard(require("assert"));
|
|
14
18
|
_assert = function () {
|
|
@@ -30,13 +34,6 @@ function _buildCache() {
|
|
|
30
34
|
};
|
|
31
35
|
return data;
|
|
32
36
|
}
|
|
33
|
-
function _cache() {
|
|
34
|
-
const data = require("@atlaspack/cache");
|
|
35
|
-
_cache = function () {
|
|
36
|
-
return data;
|
|
37
|
-
};
|
|
38
|
-
return data;
|
|
39
|
-
}
|
|
40
37
|
function _featureFlags() {
|
|
41
38
|
const data = require("@atlaspack/feature-flags");
|
|
42
39
|
_featureFlags = function () {
|
|
@@ -52,7 +49,7 @@ function _graph() {
|
|
|
52
49
|
return data;
|
|
53
50
|
}
|
|
54
51
|
function _logger() {
|
|
55
|
-
const data =
|
|
52
|
+
const data = _interopRequireDefault(require("@atlaspack/logger"));
|
|
56
53
|
_logger = function () {
|
|
57
54
|
return data;
|
|
58
55
|
};
|
|
@@ -84,9 +81,16 @@ var _projectPath = require("./projectPath");
|
|
|
84
81
|
var _ReporterRunner = require("./ReporterRunner");
|
|
85
82
|
var _ConfigRequest = require("./requests/ConfigRequest");
|
|
86
83
|
var _utils2 = require("./utils");
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
function _perf_hooks() {
|
|
85
|
+
const data = require("perf_hooks");
|
|
86
|
+
_perf_hooks = function () {
|
|
87
|
+
return data;
|
|
88
|
+
};
|
|
89
|
+
return data;
|
|
90
|
+
}
|
|
91
|
+
var _EnvironmentManager = require("./EnvironmentManager");
|
|
92
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
93
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
90
94
|
const requestGraphEdgeTypes = exports.requestGraphEdgeTypes = {
|
|
91
95
|
subrequest: 2,
|
|
92
96
|
invalidated_by_update: 3,
|
|
@@ -151,7 +155,7 @@ const nodeFromOption = (option, value) => ({
|
|
|
151
155
|
hash: (0, _utils2.hashFromOption)(value)
|
|
152
156
|
});
|
|
153
157
|
const nodeFromConfigKey = (fileName, configKey, contentHash) => ({
|
|
154
|
-
id: `config_key:${(0, _projectPath.fromProjectPathRelative)(fileName)}:${configKey}`,
|
|
158
|
+
id: `config_key:${(0, _projectPath.fromProjectPathRelative)(fileName)}:${JSON.stringify(configKey)}`,
|
|
155
159
|
type: CONFIG_KEY,
|
|
156
160
|
configKey,
|
|
157
161
|
contentHash
|
|
@@ -162,6 +166,8 @@ const keyFromOptionContentKey = contentKey => contentKey.slice('option:'.length)
|
|
|
162
166
|
// This constant is chosen by local profiling the time to serialise n nodes and tuning until an average time of ~50 ms per blob.
|
|
163
167
|
// The goal is to free up the event loop periodically to allow interruption by the user.
|
|
164
168
|
const NODES_PER_BLOB = 2 ** 14;
|
|
169
|
+
|
|
170
|
+
// @ts-expect-error TS2417
|
|
165
171
|
class RequestGraph extends _graph().ContentGraph {
|
|
166
172
|
invalidNodeIds = new Set();
|
|
167
173
|
incompleteNodeIds = new Set();
|
|
@@ -176,10 +182,7 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
176
182
|
cachedRequestChunks = new Set();
|
|
177
183
|
configKeyNodes = new Map();
|
|
178
184
|
nodesPerBlob = NODES_PER_BLOB;
|
|
179
|
-
|
|
180
|
-
// $FlowFixMe[prop-missing]
|
|
181
185
|
static deserialize(opts) {
|
|
182
|
-
// $FlowFixMe[prop-missing]
|
|
183
186
|
let deserialized = new RequestGraph(opts);
|
|
184
187
|
deserialized.invalidNodeIds = opts.invalidNodeIds;
|
|
185
188
|
deserialized.incompleteNodeIds = opts.incompleteNodeIds;
|
|
@@ -192,8 +195,6 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
192
195
|
deserialized.configKeyNodes = opts.configKeyNodes;
|
|
193
196
|
return deserialized;
|
|
194
197
|
}
|
|
195
|
-
|
|
196
|
-
// $FlowFixMe[prop-missing]
|
|
197
198
|
serialize() {
|
|
198
199
|
return {
|
|
199
200
|
...super.serialize(),
|
|
@@ -279,6 +280,12 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
279
280
|
// If the node is invalidated, the cached request chunk on disk needs to be re-written
|
|
280
281
|
this.removeCachedRequestChunkForNode(nodeId);
|
|
281
282
|
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Nodes that are invalidated on start-up, such as JavaScript babel configuration files which are
|
|
286
|
+
* imported when the build kicks-off and might doing arbitrary work such as reading from the file
|
|
287
|
+
* system.
|
|
288
|
+
*/
|
|
282
289
|
invalidateUnpredictableNodes() {
|
|
283
290
|
for (let nodeId of this.unpredicatableNodeIds) {
|
|
284
291
|
let node = (0, _nullthrows().default)(this.getNode(nodeId));
|
|
@@ -286,6 +293,10 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
286
293
|
this.invalidateNode(nodeId, _constants.STARTUP);
|
|
287
294
|
}
|
|
288
295
|
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Effectively uncacheable nodes.
|
|
299
|
+
*/
|
|
289
300
|
invalidateOnBuildNodes() {
|
|
290
301
|
for (let nodeId of this.invalidateOnBuildNodeIds) {
|
|
291
302
|
let node = (0, _nullthrows().default)(this.getNode(nodeId));
|
|
@@ -293,29 +304,47 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
293
304
|
this.invalidateNode(nodeId, _constants.STARTUP);
|
|
294
305
|
}
|
|
295
306
|
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Nodes invalidated by environment changes, corresponds to `env: ...` inputs.
|
|
310
|
+
*/
|
|
296
311
|
invalidateEnvNodes(env) {
|
|
312
|
+
const invalidatedKeys = [];
|
|
297
313
|
for (let nodeId of this.envNodeIds) {
|
|
298
314
|
let node = (0, _nullthrows().default)(this.getNode(nodeId));
|
|
299
315
|
(0, _assert().default)(node.type === ENV);
|
|
300
|
-
|
|
316
|
+
const key = keyFromEnvContentKey(node.id);
|
|
317
|
+
if (env[key] !== node.value) {
|
|
318
|
+
invalidatedKeys.push(key);
|
|
301
319
|
let parentNodes = this.getNodeIdsConnectedTo(nodeId, requestGraphEdgeTypes.invalidated_by_update);
|
|
302
320
|
for (let parentNode of parentNodes) {
|
|
303
321
|
this.invalidateNode(parentNode, _constants.ENV_CHANGE);
|
|
304
322
|
}
|
|
305
323
|
}
|
|
306
324
|
}
|
|
325
|
+
return invalidatedKeys;
|
|
307
326
|
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Nodes invalidated by option changes.
|
|
330
|
+
*/
|
|
308
331
|
invalidateOptionNodes(options) {
|
|
332
|
+
const invalidatedKeys = [];
|
|
309
333
|
for (let nodeId of this.optionNodeIds) {
|
|
310
334
|
let node = (0, _nullthrows().default)(this.getNode(nodeId));
|
|
311
335
|
(0, _assert().default)(node.type === OPTION);
|
|
312
|
-
|
|
336
|
+
const key = keyFromOptionContentKey(node.id);
|
|
337
|
+
|
|
338
|
+
// @ts-expect-error TS7053
|
|
339
|
+
if ((0, _utils2.hashFromOption)(options[key]) !== node.hash) {
|
|
340
|
+
invalidatedKeys.push(key);
|
|
313
341
|
let parentNodes = this.getNodeIdsConnectedTo(nodeId, requestGraphEdgeTypes.invalidated_by_update);
|
|
314
342
|
for (let parentNode of parentNodes) {
|
|
315
343
|
this.invalidateNode(parentNode, _constants.OPTION_CHANGE);
|
|
316
344
|
}
|
|
317
345
|
}
|
|
318
346
|
}
|
|
347
|
+
return invalidatedKeys;
|
|
319
348
|
}
|
|
320
349
|
invalidateOnConfigKeyChange(requestNodeId, filePath, configKey, contentHash) {
|
|
321
350
|
let configKeyNodeId = this.addNode(nodeFromConfigKey(filePath, configKey, contentHash));
|
|
@@ -345,9 +374,13 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
345
374
|
}
|
|
346
375
|
invalidateOnFileCreate(requestNodeId, input) {
|
|
347
376
|
let node;
|
|
377
|
+
// @ts-expect-error TS2339
|
|
348
378
|
if (input.glob != null) {
|
|
379
|
+
// @ts-expect-error TS2339
|
|
349
380
|
node = nodeFromGlob(input.glob);
|
|
381
|
+
// @ts-expect-error TS2339
|
|
350
382
|
} else if (input.fileName != null && input.aboveFilePath != null) {
|
|
383
|
+
// @ts-expect-error TS2339
|
|
351
384
|
let aboveFilePath = input.aboveFilePath;
|
|
352
385
|
|
|
353
386
|
// Create nodes and edges for each part of the filename pattern.
|
|
@@ -355,6 +388,7 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
355
388
|
// This creates a sort of trie structure within the graph that can be
|
|
356
389
|
// quickly matched by following the edges. This is also memory efficient
|
|
357
390
|
// since common sub-paths (e.g. 'node_modules') are deduplicated.
|
|
391
|
+
// @ts-expect-error TS2339
|
|
358
392
|
let parts = input.fileName.split('/').reverse();
|
|
359
393
|
let lastNodeId;
|
|
360
394
|
for (let part of parts) {
|
|
@@ -389,7 +423,9 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
389
423
|
if (!this.hasEdge(lastNodeId, nodeId, requestGraphEdgeTypes.invalidated_by_create_above)) {
|
|
390
424
|
this.addEdge(lastNodeId, nodeId, requestGraphEdgeTypes.invalidated_by_create_above);
|
|
391
425
|
}
|
|
426
|
+
// @ts-expect-error TS2339
|
|
392
427
|
} else if (input.filePath != null) {
|
|
428
|
+
// @ts-expect-error TS2339
|
|
393
429
|
node = nodeFromFilePath(input.filePath);
|
|
394
430
|
} else {
|
|
395
431
|
throw new Error('Invalid invalidation');
|
|
@@ -408,8 +444,8 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
408
444
|
this.invalidateOnBuildNodeIds.add(requestNodeId);
|
|
409
445
|
}
|
|
410
446
|
invalidateOnEnvChange(requestNodeId, env, value) {
|
|
411
|
-
|
|
412
|
-
|
|
447
|
+
const envNode = nodeFromEnv(env, value);
|
|
448
|
+
const envNodeId = this.addNode(envNode);
|
|
413
449
|
if (!this.hasEdge(requestNodeId, envNodeId, requestGraphEdgeTypes.invalidated_by_update)) {
|
|
414
450
|
this.addEdge(requestNodeId, envNodeId, requestGraphEdgeTypes.invalidated_by_update);
|
|
415
451
|
}
|
|
@@ -435,6 +471,7 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
435
471
|
|
|
436
472
|
// For now just handling updates. Could add creates/deletes later if needed.
|
|
437
473
|
let invalidations = this.getNodeIdsConnectedFrom(requestNodeId, requestGraphEdgeTypes.invalidated_by_update);
|
|
474
|
+
// @ts-expect-error TS2322
|
|
438
475
|
return invalidations.map(nodeId => {
|
|
439
476
|
let node = (0, _nullthrows().default)(this.getNode(nodeId));
|
|
440
477
|
switch (node.type) {
|
|
@@ -556,10 +593,12 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
556
593
|
aboveCache.set(fileNameNodeId, above);
|
|
557
594
|
return above;
|
|
558
595
|
};
|
|
596
|
+
const invalidationsByPath = new Map();
|
|
559
597
|
for (let {
|
|
560
598
|
path: _path,
|
|
561
599
|
type
|
|
562
600
|
} of events) {
|
|
601
|
+
const invalidationsBefore = this.getInvalidNodeCount();
|
|
563
602
|
if (!enableOptimization && process.env.ATLASPACK_DISABLE_CACHE_TIMEOUT !== 'true' && ++count === 256) {
|
|
564
603
|
let duration = Date.now() - startTime;
|
|
565
604
|
predictedTime = duration * (events.length >> 8);
|
|
@@ -596,7 +635,10 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
596
635
|
this.invalidNodeIds.add(id);
|
|
597
636
|
}
|
|
598
637
|
}
|
|
599
|
-
return
|
|
638
|
+
return {
|
|
639
|
+
didInvalidate: true,
|
|
640
|
+
invalidationsByPath: new Map()
|
|
641
|
+
};
|
|
600
642
|
}
|
|
601
643
|
|
|
602
644
|
// sometimes mac os reports update events as create events.
|
|
@@ -653,10 +695,17 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
653
695
|
this.removeNode(nodeId, removeOrphans);
|
|
654
696
|
}
|
|
655
697
|
let configKeyNodes = this.configKeyNodes.get(_filePath);
|
|
656
|
-
|
|
698
|
+
|
|
699
|
+
// With granular invalidations we will always run this block,
|
|
700
|
+
// so even if we get a create event (for whatever reason), we will still
|
|
701
|
+
// try to limit invalidations from config key changes through hashing.
|
|
702
|
+
//
|
|
703
|
+
// Currently create events can invalidate a large number of nodes due to
|
|
704
|
+
// "create above" invalidations.
|
|
705
|
+
if (configKeyNodes) {
|
|
657
706
|
for (let nodeId of configKeyNodes) {
|
|
658
707
|
let isInvalid = type === 'delete';
|
|
659
|
-
if (type
|
|
708
|
+
if (type !== 'delete') {
|
|
660
709
|
let node = this.getNode(nodeId);
|
|
661
710
|
(0, _assert().default)(node && node.type === CONFIG_KEY);
|
|
662
711
|
let contentHash = await (0, _ConfigRequest.getConfigKeyContentHash)(_filePath, node.configKey, options);
|
|
@@ -671,6 +720,9 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
671
720
|
}
|
|
672
721
|
}
|
|
673
722
|
}
|
|
723
|
+
const invalidationsAfter = this.getInvalidNodeCount();
|
|
724
|
+
const invalidationsForEvent = invalidationsAfter - invalidationsBefore;
|
|
725
|
+
invalidationsByPath.set(_path, (invalidationsByPath.get(_path) ?? 0) + invalidationsForEvent);
|
|
674
726
|
}
|
|
675
727
|
if ((0, _featureFlags().getFeatureFlag)('fixQuadraticCacheInvalidation')) {
|
|
676
728
|
cleanUpOrphans(this);
|
|
@@ -688,7 +740,10 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
688
740
|
numberOfInvalidatedNodes: invalidatedNodes.size
|
|
689
741
|
}
|
|
690
742
|
});
|
|
691
|
-
return
|
|
743
|
+
return {
|
|
744
|
+
didInvalidate,
|
|
745
|
+
invalidationsByPath
|
|
746
|
+
};
|
|
692
747
|
}
|
|
693
748
|
hasCachedRequestChunk(index) {
|
|
694
749
|
return this.cachedRequestChunks.has(index);
|
|
@@ -699,6 +754,13 @@ class RequestGraph extends _graph().ContentGraph {
|
|
|
699
754
|
removeCachedRequestChunkForNode(nodeId) {
|
|
700
755
|
this.cachedRequestChunks.delete(Math.floor(nodeId / this.nodesPerBlob));
|
|
701
756
|
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Returns the number of invalidated nodes in the graph.
|
|
760
|
+
*/
|
|
761
|
+
getInvalidNodeCount() {
|
|
762
|
+
return this.invalidNodeIds.size;
|
|
763
|
+
}
|
|
702
764
|
}
|
|
703
765
|
exports.RequestGraph = RequestGraph;
|
|
704
766
|
class RequestTracker {
|
|
@@ -714,11 +776,6 @@ class RequestTracker {
|
|
|
714
776
|
this.options = options;
|
|
715
777
|
this.rustAtlaspack = rustAtlaspack;
|
|
716
778
|
}
|
|
717
|
-
|
|
718
|
-
// TODO: refactor (abortcontroller should be created by RequestTracker)
|
|
719
|
-
setSignal(signal) {
|
|
720
|
-
this.signal = signal;
|
|
721
|
-
}
|
|
722
779
|
startRequest(request) {
|
|
723
780
|
let didPreviouslyExist = this.graph.hasContentKey(request.id);
|
|
724
781
|
let requestNodeId;
|
|
@@ -736,6 +793,7 @@ class RequestTracker {
|
|
|
736
793
|
promise,
|
|
737
794
|
deferred
|
|
738
795
|
} = (0, _utils().makeDeferredWithPromise)();
|
|
796
|
+
// @ts-expect-error TS2345
|
|
739
797
|
this.graph.incompleteNodePromises.set(requestNodeId, promise);
|
|
740
798
|
return {
|
|
741
799
|
requestNodeId,
|
|
@@ -761,15 +819,12 @@ class RequestTracker {
|
|
|
761
819
|
return null;
|
|
762
820
|
}
|
|
763
821
|
if (node.result != undefined) {
|
|
764
|
-
// $FlowFixMe
|
|
765
822
|
let result = node.result;
|
|
766
823
|
return result;
|
|
767
824
|
} else if (node.resultCacheKey != null && ifMatch == null) {
|
|
768
825
|
let key = node.resultCacheKey;
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
}
|
|
772
|
-
let cachedResult = (0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements') ? (0, _nullthrows().default)(await this.options.cache.get(key)) : (0, _buildCache().deserialize)(await this.options.cache.getLargeBlob(key));
|
|
826
|
+
(0, _assert().default)(this.options.cache.hasLargeBlob(key));
|
|
827
|
+
let cachedResult = (0, _buildCache().deserialize)(await this.options.cache.getLargeBlob(key));
|
|
773
828
|
node.result = cachedResult;
|
|
774
829
|
return cachedResult;
|
|
775
830
|
}
|
|
@@ -815,7 +870,7 @@ class RequestTracker {
|
|
|
815
870
|
let requestId = hasKey ? this.graph.getNodeIdByContentKey(request.id) : undefined;
|
|
816
871
|
let hasValidResult = requestId != null && this.hasValidResult(requestId);
|
|
817
872
|
if (!(opts !== null && opts !== void 0 && opts.force) && hasValidResult) {
|
|
818
|
-
//
|
|
873
|
+
// @ts-expect-error TS2322
|
|
819
874
|
return this.getRequestResult(request.id);
|
|
820
875
|
}
|
|
821
876
|
if (requestId != null) {
|
|
@@ -824,7 +879,7 @@ class RequestTracker {
|
|
|
824
879
|
// There is a another instance of this request already running, wait for its completion and reuse its result
|
|
825
880
|
try {
|
|
826
881
|
if (await incompletePromise) {
|
|
827
|
-
//
|
|
882
|
+
// @ts-expect-error TS2322
|
|
828
883
|
return this.getRequestResult(request.id);
|
|
829
884
|
}
|
|
830
885
|
} catch (e) {
|
|
@@ -857,7 +912,6 @@ class RequestTracker {
|
|
|
857
912
|
options: this.options,
|
|
858
913
|
rustAtlaspack: this.rustAtlaspack
|
|
859
914
|
});
|
|
860
|
-
(0, _utils2.assertSignalNotAborted)(this.signal);
|
|
861
915
|
this.completeRequest(requestNodeId);
|
|
862
916
|
deferred.resolve(true);
|
|
863
917
|
return result;
|
|
@@ -895,133 +949,123 @@ class RequestTracker {
|
|
|
895
949
|
}
|
|
896
950
|
createAPI(requestId, previousInvalidations) {
|
|
897
951
|
let subRequestContentKeys = new Set();
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
runRequest: (subRequest, opts) => {
|
|
928
|
-
subRequestContentKeys.add(subRequest.id);
|
|
929
|
-
return this.runRequest(subRequest, opts);
|
|
952
|
+
let api = {
|
|
953
|
+
invalidateOnFileCreate: input => this.graph.invalidateOnFileCreate(requestId, input),
|
|
954
|
+
invalidateOnConfigKeyChange: (filePath, configKey, contentHash) => this.graph.invalidateOnConfigKeyChange(requestId, filePath, configKey, contentHash),
|
|
955
|
+
invalidateOnFileDelete: filePath => this.graph.invalidateOnFileDelete(requestId, filePath),
|
|
956
|
+
invalidateOnFileUpdate: filePath => this.graph.invalidateOnFileUpdate(requestId, filePath),
|
|
957
|
+
invalidateOnStartup: () => this.graph.invalidateOnStartup(requestId),
|
|
958
|
+
invalidateOnBuild: () => this.graph.invalidateOnBuild(requestId),
|
|
959
|
+
invalidateOnEnvChange: env => this.graph.invalidateOnEnvChange(requestId, env, this.options.env[env]),
|
|
960
|
+
invalidateOnOptionChange: option => this.graph.invalidateOnOptionChange(requestId, option,
|
|
961
|
+
// @ts-expect-error TS7053
|
|
962
|
+
this.options[option]),
|
|
963
|
+
getInvalidations: () => previousInvalidations,
|
|
964
|
+
storeResult: (result, cacheKey) => {
|
|
965
|
+
this.storeResult(requestId, result, cacheKey);
|
|
966
|
+
},
|
|
967
|
+
getSubRequests: () => this.graph.getSubRequests(requestId),
|
|
968
|
+
getInvalidSubRequests: () => this.graph.getInvalidSubRequests(requestId),
|
|
969
|
+
getPreviousResult: ifMatch => {
|
|
970
|
+
var _this$graph$getNode;
|
|
971
|
+
let contentKey = (0, _nullthrows().default)((_this$graph$getNode = this.graph.getNode(requestId)) === null || _this$graph$getNode === void 0 ? void 0 : _this$graph$getNode.id);
|
|
972
|
+
return this.getRequestResult(contentKey, ifMatch);
|
|
973
|
+
},
|
|
974
|
+
getRequestResult: (
|
|
975
|
+
// @ts-expect-error TS7006
|
|
976
|
+
id) => this.getRequestResult(id),
|
|
977
|
+
canSkipSubrequest: contentKey => {
|
|
978
|
+
if (this.graph.hasContentKey(contentKey) && this.hasValidResult(this.graph.getNodeIdByContentKey(contentKey))) {
|
|
979
|
+
subRequestContentKeys.add(contentKey);
|
|
980
|
+
return true;
|
|
930
981
|
}
|
|
982
|
+
return false;
|
|
931
983
|
},
|
|
984
|
+
runRequest: (subRequest, opts) => {
|
|
985
|
+
subRequestContentKeys.add(subRequest.id);
|
|
986
|
+
return this.runRequest(subRequest, opts);
|
|
987
|
+
}
|
|
988
|
+
};
|
|
989
|
+
return {
|
|
990
|
+
api,
|
|
932
991
|
subRequestContentKeys
|
|
933
992
|
};
|
|
934
993
|
}
|
|
935
994
|
async writeToCache(signal) {
|
|
936
|
-
const options = this.options;
|
|
937
|
-
async function runCacheImprovements(newPath, oldPath) {
|
|
938
|
-
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
939
|
-
(0, _assert().default)(options.cache instanceof _cache().LMDBLiteCache);
|
|
940
|
-
const result = await newPath(options.cache);
|
|
941
|
-
return result;
|
|
942
|
-
} else {
|
|
943
|
-
const result = await oldPath();
|
|
944
|
-
return result;
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
await runCacheImprovements(async cache => {
|
|
948
|
-
await cache.getNativeRef().startWriteTransaction();
|
|
949
|
-
}, () => Promise.resolve());
|
|
950
995
|
let cacheKey = getCacheKey(this.options);
|
|
951
996
|
let requestGraphKey = `requestGraph-${cacheKey}`;
|
|
997
|
+
let snapshotKey = `snapshot-${cacheKey}`;
|
|
952
998
|
if (this.options.shouldDisableCache) {
|
|
953
999
|
return;
|
|
954
1000
|
}
|
|
955
1001
|
let total = 0;
|
|
956
|
-
|
|
957
|
-
type: 'cache',
|
|
958
|
-
phase: 'start',
|
|
959
|
-
total,
|
|
960
|
-
size: this.graph.nodes.length
|
|
961
|
-
});
|
|
962
|
-
let serialisedGraph = this.graph.serialize();
|
|
963
|
-
|
|
964
|
-
// Delete an existing request graph cache, to prevent invalid states
|
|
965
|
-
await this.options.cache.deleteLargeBlob(requestGraphKey);
|
|
966
|
-
const serialiseAndSet = async (key, contents) => {
|
|
967
|
-
if (signal !== null && signal !== void 0 && signal.aborted) {
|
|
968
|
-
throw new Error('Serialization was aborted');
|
|
969
|
-
}
|
|
970
|
-
await runCacheImprovements(cache => {
|
|
971
|
-
(0, _logger().instrument)(`cache.put(${key})`, () => {
|
|
972
|
-
cache.getNativeRef().putNoConfirm(key, (0, _buildCache().serialize)(contents));
|
|
973
|
-
});
|
|
974
|
-
return Promise.resolve();
|
|
975
|
-
}, async () => {
|
|
976
|
-
await this.options.cache.setLargeBlob(key, (0, _buildCache().serialize)(contents), signal ? {
|
|
977
|
-
signal: signal
|
|
978
|
-
} : undefined);
|
|
979
|
-
});
|
|
980
|
-
total += 1;
|
|
1002
|
+
try {
|
|
981
1003
|
(0, _ReporterRunner.report)({
|
|
982
1004
|
type: 'cache',
|
|
983
|
-
phase: '
|
|
1005
|
+
phase: 'start',
|
|
984
1006
|
total,
|
|
985
1007
|
size: this.graph.nodes.length
|
|
986
1008
|
});
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1009
|
+
if ((0, _featureFlags().getFeatureFlag)('environmentDeduplication')) {
|
|
1010
|
+
await (0, _EnvironmentManager.writeEnvironmentsToCache)(this.options.cache);
|
|
1011
|
+
}
|
|
1012
|
+
let serialisedGraph = this.graph.serialize();
|
|
991
1013
|
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1014
|
+
// Delete an existing request graph cache, to prevent invalid states
|
|
1015
|
+
await this.options.cache.deleteLargeBlob(requestGraphKey);
|
|
1016
|
+
const serialiseAndSet = async (key, contents) => {
|
|
1017
|
+
if (signal !== null && signal !== void 0 && signal.aborted) {
|
|
1018
|
+
throw new Error('Serialization was aborted');
|
|
1019
|
+
}
|
|
1020
|
+
await this.options.cache.setLargeBlob(key, (0, _buildCache().serialize)(contents), signal ? {
|
|
1021
|
+
signal: signal
|
|
1022
|
+
} : undefined);
|
|
1023
|
+
total += 1;
|
|
1024
|
+
(0, _ReporterRunner.report)({
|
|
1025
|
+
type: 'cache',
|
|
1026
|
+
phase: 'write',
|
|
1027
|
+
total,
|
|
1028
|
+
size: this.graph.nodes.length
|
|
1029
|
+
});
|
|
1030
|
+
};
|
|
1031
|
+
let queue = new (_utils().PromiseQueue)({
|
|
1032
|
+
maxConcurrent: 32
|
|
1033
|
+
});
|
|
999
1034
|
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1035
|
+
// Preallocating a sparse array is faster than pushing when N is high enough
|
|
1036
|
+
let cacheableNodes = new Array(serialisedGraph.nodes.length);
|
|
1037
|
+
for (let i = 0; i < serialisedGraph.nodes.length; i += 1) {
|
|
1038
|
+
let node = serialisedGraph.nodes[i];
|
|
1039
|
+
|
|
1040
|
+
// @ts-expect-error TS2339
|
|
1041
|
+
let resultCacheKey = node === null || node === void 0 ? void 0 : node.resultCacheKey;
|
|
1042
|
+
if ((node === null || node === void 0 ? void 0 : node.type) === REQUEST && resultCacheKey != null && (node === null || node === void 0 ? void 0 : node.result) != null) {
|
|
1043
|
+
queue.add(() => serialiseAndSet(resultCacheKey, node.result));
|
|
1044
|
+
|
|
1045
|
+
// eslint-disable-next-line no-unused-vars
|
|
1046
|
+
let {
|
|
1047
|
+
result: _,
|
|
1048
|
+
...newNode
|
|
1049
|
+
} = node;
|
|
1050
|
+
cacheableNodes[i] = newNode;
|
|
1051
|
+
} else {
|
|
1052
|
+
cacheableNodes[i] = node;
|
|
1053
|
+
}
|
|
1008
1054
|
}
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
}
|
|
1055
|
+
let nodeCountsPerBlob = [];
|
|
1056
|
+
for (let i = 0; i * this.graph.nodesPerBlob < cacheableNodes.length; i += 1) {
|
|
1057
|
+
let nodesStartIndex = i * this.graph.nodesPerBlob;
|
|
1058
|
+
let nodesEndIndex = Math.min((i + 1) * this.graph.nodesPerBlob, cacheableNodes.length);
|
|
1059
|
+
nodeCountsPerBlob.push(nodesEndIndex - nodesStartIndex);
|
|
1060
|
+
if (!this.graph.hasCachedRequestChunk(i)) {
|
|
1061
|
+
// We assume the request graph nodes are immutable and won't change
|
|
1062
|
+
let nodesToCache = cacheableNodes.slice(nodesStartIndex, nodesEndIndex);
|
|
1063
|
+
queue.add(() => serialiseAndSet(getRequestGraphNodeKey(i, cacheKey), nodesToCache).then(() => {
|
|
1064
|
+
// Succeeded in writing to disk, save that we have completed this chunk
|
|
1065
|
+
this.graph.setCachedRequestChunk(i);
|
|
1066
|
+
}));
|
|
1067
|
+
}
|
|
1022
1068
|
}
|
|
1023
|
-
}
|
|
1024
|
-
try {
|
|
1025
1069
|
await queue.run();
|
|
1026
1070
|
|
|
1027
1071
|
// Set the request graph after the queue is flushed to avoid writing an invalid state
|
|
@@ -1030,23 +1074,13 @@ class RequestTracker {
|
|
|
1030
1074
|
nodeCountsPerBlob,
|
|
1031
1075
|
nodes: undefined
|
|
1032
1076
|
});
|
|
1033
|
-
await runCacheImprovements(() => serialiseAndSet(`request_tracker:cache_metadata:${cacheKey}`, {
|
|
1034
|
-
version: _constants.ATLASPACK_VERSION,
|
|
1035
|
-
entries: this.options.entries,
|
|
1036
|
-
mode: this.options.mode,
|
|
1037
|
-
shouldBuildLazily: this.options.shouldBuildLazily,
|
|
1038
|
-
watchBackend: this.options.watchBackend
|
|
1039
|
-
}), () => Promise.resolve());
|
|
1040
1077
|
let opts = getWatcherOptions(this.options);
|
|
1041
|
-
let snapshotPath = _path2().default.join(this.options.cacheDir,
|
|
1078
|
+
let snapshotPath = _path2().default.join(this.options.cacheDir, snapshotKey + '.txt');
|
|
1042
1079
|
await this.options.outputFS.writeSnapshot(this.options.watchDir, snapshotPath, opts);
|
|
1043
1080
|
} catch (err) {
|
|
1044
1081
|
// If we have aborted, ignore the error and continue
|
|
1045
1082
|
if (!(signal !== null && signal !== void 0 && signal.aborted)) throw err;
|
|
1046
1083
|
}
|
|
1047
|
-
await runCacheImprovements(async cache => {
|
|
1048
|
-
await cache.getNativeRef().commitWriteTransaction();
|
|
1049
|
-
}, () => Promise.resolve());
|
|
1050
1084
|
(0, _ReporterRunner.report)({
|
|
1051
1085
|
type: 'cache',
|
|
1052
1086
|
phase: 'end',
|
|
@@ -1075,7 +1109,8 @@ function getWatcherOptions({
|
|
|
1075
1109
|
watchDir,
|
|
1076
1110
|
watchBackend
|
|
1077
1111
|
}) {
|
|
1078
|
-
const
|
|
1112
|
+
const vcsDirs = ['.git', '.hg'];
|
|
1113
|
+
const uniqueDirs = [...new Set([...watchIgnore, ...vcsDirs, cacheDir])];
|
|
1079
1114
|
const ignore = uniqueDirs.map(dir => _path2().default.resolve(watchDir, dir));
|
|
1080
1115
|
return {
|
|
1081
1116
|
ignore,
|
|
@@ -1091,12 +1126,14 @@ function getRequestGraphNodeKey(index, cacheKey) {
|
|
|
1091
1126
|
async function readAndDeserializeRequestGraph(cache, requestGraphKey, cacheKey) {
|
|
1092
1127
|
let bufferLength = 0;
|
|
1093
1128
|
const getAndDeserialize = async key => {
|
|
1094
|
-
|
|
1129
|
+
const buffer = await cache.getLargeBlob(key);
|
|
1095
1130
|
bufferLength += Buffer.byteLength(buffer);
|
|
1096
1131
|
return (0, _buildCache().deserialize)(buffer);
|
|
1097
1132
|
};
|
|
1098
1133
|
let serializedRequestGraph = await getAndDeserialize(requestGraphKey);
|
|
1099
|
-
let nodePromises = serializedRequestGraph.nodeCountsPerBlob.map(
|
|
1134
|
+
let nodePromises = serializedRequestGraph.nodeCountsPerBlob.map(
|
|
1135
|
+
// @ts-expect-error TS7006
|
|
1136
|
+
async (nodesCount, i) => {
|
|
1100
1137
|
let nodes = await getAndDeserialize(getRequestGraphNodeKey(i, cacheKey));
|
|
1101
1138
|
_assert().default.equal(nodes.length, nodesCount, 'RequestTracker node chunk: invalid node count');
|
|
1102
1139
|
return nodes;
|
|
@@ -1119,15 +1156,29 @@ async function loadRequestGraph(options) {
|
|
|
1119
1156
|
let timeout;
|
|
1120
1157
|
const snapshotKey = `snapshot-${cacheKey}`;
|
|
1121
1158
|
const snapshotPath = _path2().default.join(options.cacheDir, snapshotKey + '.txt');
|
|
1159
|
+
const commonMeta = {
|
|
1160
|
+
cacheKey,
|
|
1161
|
+
snapshotKey,
|
|
1162
|
+
cacheKeyOptions: {
|
|
1163
|
+
version: _constants.ATLASPACK_VERSION,
|
|
1164
|
+
entries: options.entries,
|
|
1165
|
+
mode: options.mode,
|
|
1166
|
+
shouldBuildLazily: options.shouldBuildLazily,
|
|
1167
|
+
watchBackend: options.watchBackend
|
|
1168
|
+
}
|
|
1169
|
+
};
|
|
1122
1170
|
_logger().default.verbose({
|
|
1123
1171
|
origin: '@atlaspack/core',
|
|
1124
1172
|
message: 'Loading request graph',
|
|
1125
1173
|
meta: {
|
|
1126
|
-
|
|
1127
|
-
snapshotKey
|
|
1174
|
+
...commonMeta
|
|
1128
1175
|
}
|
|
1129
1176
|
});
|
|
1130
|
-
if (
|
|
1177
|
+
if ((0, _featureFlags().getFeatureFlag)('environmentDeduplication')) {
|
|
1178
|
+
await (0, _EnvironmentManager.loadEnvironmentsFromCache)(options.cache);
|
|
1179
|
+
}
|
|
1180
|
+
const hasRequestGraphInCache = await options.cache.hasLargeBlob(requestGraphKey);
|
|
1181
|
+
if (hasRequestGraphInCache) {
|
|
1131
1182
|
try {
|
|
1132
1183
|
let {
|
|
1133
1184
|
requestGraph
|
|
@@ -1146,16 +1197,22 @@ async function loadRequestGraph(options) {
|
|
|
1146
1197
|
origin: '@atlaspack/core',
|
|
1147
1198
|
message: `File system event count: ${events.length}`,
|
|
1148
1199
|
meta: {
|
|
1200
|
+
...commonMeta,
|
|
1149
1201
|
trackableEvent: 'watcher_events_count',
|
|
1150
1202
|
watcherEventCount: events.length,
|
|
1151
1203
|
duration: Date.now() - startTime
|
|
1152
1204
|
}
|
|
1153
1205
|
});
|
|
1154
|
-
requestGraph
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1206
|
+
const invalidationStats = await invalidateRequestGraph(requestGraph, options, events);
|
|
1207
|
+
_logger().default.verbose({
|
|
1208
|
+
origin: '@atlaspack/core',
|
|
1209
|
+
message: 'Request track loaded from cache',
|
|
1210
|
+
meta: {
|
|
1211
|
+
...commonMeta,
|
|
1212
|
+
trackableEvent: 'request_tracker_cache_key_hit',
|
|
1213
|
+
invalidationStats
|
|
1214
|
+
}
|
|
1215
|
+
});
|
|
1159
1216
|
return requestGraph;
|
|
1160
1217
|
} catch (e) {
|
|
1161
1218
|
// Prevent logging fs events took too long warning
|
|
@@ -1170,12 +1227,108 @@ async function loadRequestGraph(options) {
|
|
|
1170
1227
|
origin: '@atlaspack/core',
|
|
1171
1228
|
message: 'Cache entry for request tracker was not found, initializing a clean cache.',
|
|
1172
1229
|
meta: {
|
|
1173
|
-
|
|
1174
|
-
|
|
1230
|
+
...commonMeta,
|
|
1231
|
+
trackableEvent: 'request_tracker_cache_key_miss'
|
|
1175
1232
|
}
|
|
1176
1233
|
});
|
|
1177
1234
|
return new RequestGraph();
|
|
1178
1235
|
}
|
|
1236
|
+
|
|
1237
|
+
/**
|
|
1238
|
+
* A wrapper around an invalidation type / method
|
|
1239
|
+
*/
|
|
1240
|
+
|
|
1241
|
+
/**
|
|
1242
|
+
* Details about an invalidation.
|
|
1243
|
+
*
|
|
1244
|
+
* If this is a fs events invalidation, this key will contain statistics about invalidations
|
|
1245
|
+
* by path.
|
|
1246
|
+
*
|
|
1247
|
+
* If this is a env or option invalidation, this key will contain the list of changed environment
|
|
1248
|
+
* variables or options.
|
|
1249
|
+
*/
|
|
1250
|
+
|
|
1251
|
+
/**
|
|
1252
|
+
* Number of invalidations for a given file-system event.
|
|
1253
|
+
*/
|
|
1254
|
+
|
|
1255
|
+
/**
|
|
1256
|
+
* Information about a certain cache invalidation type.
|
|
1257
|
+
*/
|
|
1258
|
+
|
|
1259
|
+
/**
|
|
1260
|
+
* Respond to unpredictable, build, environment changes, option changes and file-system events
|
|
1261
|
+
* invalidating RequestGraph nodes.
|
|
1262
|
+
*
|
|
1263
|
+
* Returns the count of nodes invalidated by each invalidation type.
|
|
1264
|
+
*/
|
|
1265
|
+
async function invalidateRequestGraph(requestGraph, options, events) {
|
|
1266
|
+
const invalidationFns = [{
|
|
1267
|
+
key: 'unpredictable',
|
|
1268
|
+
// @ts-expect-error TS2322
|
|
1269
|
+
fn: () => requestGraph.invalidateUnpredictableNodes()
|
|
1270
|
+
}, {
|
|
1271
|
+
key: 'onBuild',
|
|
1272
|
+
// @ts-expect-error TS2322
|
|
1273
|
+
fn: () => requestGraph.invalidateOnBuildNodes()
|
|
1274
|
+
}, {
|
|
1275
|
+
key: 'env',
|
|
1276
|
+
fn: () => requestGraph.invalidateEnvNodes(options.env)
|
|
1277
|
+
}, {
|
|
1278
|
+
key: 'option',
|
|
1279
|
+
fn: () => requestGraph.invalidateOptionNodes(options)
|
|
1280
|
+
}, {
|
|
1281
|
+
key: 'fsEvents',
|
|
1282
|
+
fn: () => invalidateRequestGraphFSEvents(requestGraph, options, events)
|
|
1283
|
+
}];
|
|
1284
|
+
const invalidations = [];
|
|
1285
|
+
for (const invalidation of invalidationFns) {
|
|
1286
|
+
invalidations.push(await runInvalidation(requestGraph, invalidation));
|
|
1287
|
+
}
|
|
1288
|
+
const invalidatedCount = invalidations.reduce((acc, invalidation) => acc + invalidation.count, 0);
|
|
1289
|
+
const requestCount = requestGraph.nodes.reduce((acc, node) => acc + ((node === null || node === void 0 ? void 0 : node.type) === REQUEST ? 1 : 0), 0);
|
|
1290
|
+
const nodeCount = requestGraph.nodes.length;
|
|
1291
|
+
const nodeInvalidationRatio = invalidatedCount / nodeCount;
|
|
1292
|
+
const requestInvalidationRatio = invalidatedCount / requestCount;
|
|
1293
|
+
return {
|
|
1294
|
+
invalidations,
|
|
1295
|
+
nodeCount,
|
|
1296
|
+
requestCount,
|
|
1297
|
+
invalidatedCount,
|
|
1298
|
+
nodeInvalidationRatio,
|
|
1299
|
+
requestInvalidationRatio
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Invalidate the request graph based on file-system events.
|
|
1304
|
+
*
|
|
1305
|
+
* Returns statistics about the invalidations.
|
|
1306
|
+
*/
|
|
1307
|
+
async function invalidateRequestGraphFSEvents(requestGraph, options, events) {
|
|
1308
|
+
const {
|
|
1309
|
+
invalidationsByPath
|
|
1310
|
+
} = await requestGraph.respondToFSEvents(options.unstableFileInvalidations || events, options, 10000, true);
|
|
1311
|
+
const biggestInvalidations = getBiggestFSEventsInvalidations(invalidationsByPath);
|
|
1312
|
+
return {
|
|
1313
|
+
biggestInvalidations
|
|
1314
|
+
};
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Runs an invalidation function and reports metrics.
|
|
1318
|
+
*/
|
|
1319
|
+
async function runInvalidation(requestGraph, invalidationFn) {
|
|
1320
|
+
const start = _perf_hooks().performance.now();
|
|
1321
|
+
const startInvalidationCount = requestGraph.getInvalidNodeCount();
|
|
1322
|
+
const result = await invalidationFn.fn();
|
|
1323
|
+
const count = requestGraph.getInvalidNodeCount() - startInvalidationCount;
|
|
1324
|
+
const duration = _perf_hooks().performance.now() - start;
|
|
1325
|
+
return {
|
|
1326
|
+
key: invalidationFn.key,
|
|
1327
|
+
count,
|
|
1328
|
+
detail: result ?? null,
|
|
1329
|
+
duration
|
|
1330
|
+
};
|
|
1331
|
+
}
|
|
1179
1332
|
function logErrorOnBailout(options, snapshotPath, e) {
|
|
1180
1333
|
if (e.message && e.message.includes('invalid clockspec')) {
|
|
1181
1334
|
const snapshotContents = options.inputFS.readFileSync(snapshotPath, 'utf-8');
|
|
@@ -1215,4 +1368,19 @@ function cleanUpOrphans(graph) {
|
|
|
1215
1368
|
}
|
|
1216
1369
|
});
|
|
1217
1370
|
return removedNodeIds;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
/**
|
|
1374
|
+
* Returns paths that invalidated the most nodes
|
|
1375
|
+
*/
|
|
1376
|
+
function getBiggestFSEventsInvalidations(invalidationsByPath, limit = 10) {
|
|
1377
|
+
const invalidations = [];
|
|
1378
|
+
for (const [path, count] of invalidationsByPath) {
|
|
1379
|
+
invalidations.push({
|
|
1380
|
+
path,
|
|
1381
|
+
count
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
invalidations.sort((a, b) => b.count - a.count);
|
|
1385
|
+
return invalidations.slice(0, limit);
|
|
1218
1386
|
}
|