@atlaspack/core 2.16.2-canary.48 → 2.16.2-canary.481
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 +1324 -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 +140 -56
- 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 +46 -82
- package/lib/ReporterRunner.js +8 -12
- package/lib/RequestTracker.js +191 -152
- package/lib/SymbolPropagation.js +52 -29
- package/lib/TargetDescriptor.schema.js +10 -1
- package/lib/Transformation.js +68 -19
- package/lib/UncommittedAsset.js +17 -24
- 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 +231 -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 +27 -25
- 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 +61 -40
- 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 +61 -130
- 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 +329 -20
- 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 +37 -14
- 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 +26 -36
- package/src/{AssetGraph.js → AssetGraph.ts} +87 -51
- package/src/{Atlaspack.js → Atlaspack.ts} +181 -72
- 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} +114 -159
- package/src/{ReporterRunner.js → ReporterRunner.ts} +13 -18
- package/src/{RequestTracker.js → RequestTracker.ts} +444 -355
- 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} +45 -49
- 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} +103 -68
- 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} +117 -90
- 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} +119 -199
- 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} +57 -27
- 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} +136 -58
- 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} +3 -4
- 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 -369
- 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 -369
- 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
|
@@ -20,47 +20,62 @@ function _diagnostic() {
|
|
|
20
20
|
return data;
|
|
21
21
|
}
|
|
22
22
|
function _logger() {
|
|
23
|
-
const data = require("@atlaspack/logger");
|
|
23
|
+
const data = _interopRequireWildcard(require("@atlaspack/logger"));
|
|
24
24
|
_logger = function () {
|
|
25
25
|
return data;
|
|
26
26
|
};
|
|
27
27
|
return data;
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
function _featureFlags() {
|
|
30
|
+
const data = require("@atlaspack/feature-flags");
|
|
31
|
+
_featureFlags = function () {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
36
|
+
var _AssetGraph = _interopRequireDefault(require("../AssetGraph"));
|
|
37
|
+
var _ReporterRunner = require("../ReporterRunner");
|
|
30
38
|
var _RequestTracker = require("../RequestTracker");
|
|
31
39
|
var _SymbolPropagation = require("../SymbolPropagation");
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
var _EnvironmentManager = require("../EnvironmentManager");
|
|
41
|
+
var _Environment = require("../Environment");
|
|
42
|
+
var _dumpGraphToGraphViz = _interopRequireDefault(require("../dumpGraphToGraphViz"));
|
|
43
|
+
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); }
|
|
44
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
35
45
|
function createAssetGraphRequestRust(rustAtlaspack) {
|
|
36
46
|
return input => ({
|
|
37
47
|
type: _RequestTracker.requestTypes.asset_graph_request,
|
|
38
48
|
id: input.name,
|
|
39
|
-
run: async
|
|
40
|
-
let options =
|
|
41
|
-
let serializedAssetGraph = await rustAtlaspack.buildAssetGraph();
|
|
42
|
-
serializedAssetGraph.nodes = serializedAssetGraph.nodes.map(node => JSON.parse(node));
|
|
49
|
+
run: async runInput => {
|
|
50
|
+
let options = runInput.options;
|
|
43
51
|
let {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
options,
|
|
50
|
-
assetGraph,
|
|
51
|
-
changedAssetsPropagation,
|
|
52
|
-
assetGroupsWithRemovedParents: new Set(),
|
|
53
|
-
previousErrors: new Map() //this.previousSymbolPropagationErrors,
|
|
52
|
+
assetGraphPromise,
|
|
53
|
+
commitPromise
|
|
54
|
+
} = await rustAtlaspack.buildAssetGraph(eventJson => {
|
|
55
|
+
let event = JSON.parse(eventJson);
|
|
56
|
+
(0, _ReporterRunner.report)(event);
|
|
54
57
|
});
|
|
55
|
-
|
|
56
|
-
if (
|
|
57
|
-
// Just throw the first error. Since errors can bubble (e.g. reexporting a reexported symbol also fails),
|
|
58
|
-
// determining which failing export is the root cause is nontrivial (because of circular dependencies).
|
|
58
|
+
let [serializedAssetGraph, assetGraphError] = await assetGraphPromise;
|
|
59
|
+
if (assetGraphError) {
|
|
59
60
|
throw new (_diagnostic().default)({
|
|
60
|
-
diagnostic:
|
|
61
|
+
diagnostic: assetGraphError
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
+
|
|
65
|
+
// Don't reuse a previous asset graph result if Rust didn't have one too
|
|
66
|
+
let prevResult = null;
|
|
67
|
+
if (serializedAssetGraph.hadPreviousGraph) {
|
|
68
|
+
prevResult = await runInput.api.getPreviousResult();
|
|
69
|
+
}
|
|
70
|
+
let {
|
|
71
|
+
assetGraph,
|
|
72
|
+
changedAssets
|
|
73
|
+
} = (0, _logger().instrument)('atlaspack_v3_getAssetGraph', () => {
|
|
74
|
+
var _prevResult;
|
|
75
|
+
return getAssetGraph(serializedAssetGraph, (_prevResult = prevResult) === null || _prevResult === void 0 ? void 0 : _prevResult.assetGraph);
|
|
76
|
+
});
|
|
77
|
+
let changedAssetsPropagation = new Set(changedAssets.keys());
|
|
78
|
+
let result = {
|
|
64
79
|
assetGraph,
|
|
65
80
|
assetRequests: [],
|
|
66
81
|
assetGroupsWithRemovedParents: new Set(),
|
|
@@ -68,19 +83,126 @@ function createAssetGraphRequestRust(rustAtlaspack) {
|
|
|
68
83
|
changedAssetsPropagation,
|
|
69
84
|
previousSymbolPropagationErrors: undefined
|
|
70
85
|
};
|
|
86
|
+
|
|
87
|
+
// When v3AssetGraphSyncImprovements is enabled, wrap downstream steps
|
|
88
|
+
// in try/catch and store the result even on error. This prevents Rust/JS
|
|
89
|
+
// divergence when symbol propagation or commit_assets fails.
|
|
90
|
+
let storeResultOnError = (0, _featureFlags().getFeatureFlag)('v3AssetGraphSyncImprovements');
|
|
91
|
+
try {
|
|
92
|
+
// Skip symbol propagation for runtime assets - they have pre-computed symbol data
|
|
93
|
+
if (input.skipSymbolProp) {
|
|
94
|
+
_logger().default.verbose({
|
|
95
|
+
origin: '@atlaspack/core',
|
|
96
|
+
message: 'Skipping symbol propagation for runtime asset graph'
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
99
|
+
let errors = (0, _SymbolPropagation.propagateSymbols)({
|
|
100
|
+
options,
|
|
101
|
+
assetGraph,
|
|
102
|
+
changedAssetsPropagation,
|
|
103
|
+
assetGroupsWithRemovedParents: new Set(),
|
|
104
|
+
previousErrors: new Map() //this.previousSymbolPropagationErrors,
|
|
105
|
+
});
|
|
106
|
+
if (errors.size > 0) {
|
|
107
|
+
// Just throw the first error. Since errors can bubble (e.g. reexporting a reexported symbol also fails),
|
|
108
|
+
// determining which failing export is the root cause is nontrivial (because of circular dependencies).
|
|
109
|
+
throw new (_diagnostic().default)({
|
|
110
|
+
diagnostic: [...errors.values()][0]
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
await (0, _dumpGraphToGraphViz.default)(assetGraph, 'AssetGraphV3');
|
|
115
|
+
let [_commitResult, commitError] = await commitPromise;
|
|
116
|
+
if (commitError) {
|
|
117
|
+
throw new (_diagnostic().default)({
|
|
118
|
+
diagnostic: {
|
|
119
|
+
message: 'Error committing asset graph in Rust: ' + commitError.message
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
await runInput.api.storeResult(result);
|
|
124
|
+
runInput.api.invalidateOnBuild();
|
|
125
|
+
} catch (e) {
|
|
126
|
+
if (storeResultOnError) {
|
|
127
|
+
// Store the graph even on error to prevent Rust/JS divergence.
|
|
128
|
+
// The graph from getAssetGraph is structurally correct — only
|
|
129
|
+
// downstream processing (symbols, commit) failed.
|
|
130
|
+
await runInput.api.storeResult(result);
|
|
131
|
+
runInput.api.invalidateOnBuild();
|
|
132
|
+
}
|
|
133
|
+
throw e;
|
|
134
|
+
}
|
|
135
|
+
return result;
|
|
71
136
|
},
|
|
72
137
|
input
|
|
73
138
|
});
|
|
74
139
|
}
|
|
140
|
+
function getAssetGraph(serializedGraph, prevAssetGraph) {
|
|
141
|
+
let graph;
|
|
142
|
+
let reuseEdges = false;
|
|
143
|
+
let clonePrevGraph = (0, _featureFlags().getFeatureFlag)('v3AssetGraphSyncImprovements');
|
|
144
|
+
if (prevAssetGraph && serializedGraph.safeToSkipBundling) {
|
|
145
|
+
if (clonePrevGraph) {
|
|
146
|
+
graph = new _AssetGraph.default({
|
|
147
|
+
_contentKeyToNodeId: new Map(prevAssetGraph._contentKeyToNodeId),
|
|
148
|
+
_nodeIdToContentKey: new Map(prevAssetGraph._nodeIdToContentKey),
|
|
149
|
+
nodes: [...prevAssetGraph.nodes],
|
|
150
|
+
rootNodeId: prevAssetGraph.rootNodeId,
|
|
151
|
+
adjacencyList: prevAssetGraph.adjacencyList
|
|
152
|
+
});
|
|
153
|
+
} else {
|
|
154
|
+
graph = new _AssetGraph.default({
|
|
155
|
+
_contentKeyToNodeId: prevAssetGraph._contentKeyToNodeId,
|
|
156
|
+
_nodeIdToContentKey: prevAssetGraph._nodeIdToContentKey,
|
|
157
|
+
nodes: prevAssetGraph.nodes,
|
|
158
|
+
rootNodeId: prevAssetGraph.rootNodeId,
|
|
159
|
+
adjacencyList: prevAssetGraph.adjacencyList
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
reuseEdges = true;
|
|
163
|
+
} else if (prevAssetGraph && (serializedGraph.updates.length > 0 || serializedGraph.nodes.length > 0)) {
|
|
164
|
+
if (clonePrevGraph) {
|
|
165
|
+
graph = new _AssetGraph.default({
|
|
166
|
+
_contentKeyToNodeId: new Map(prevAssetGraph._contentKeyToNodeId),
|
|
167
|
+
_nodeIdToContentKey: new Map(prevAssetGraph._nodeIdToContentKey),
|
|
168
|
+
nodes: [...prevAssetGraph.nodes],
|
|
169
|
+
initialCapacity: serializedGraph.edges.length,
|
|
170
|
+
// Accomodate the root node
|
|
171
|
+
initialNodeCapacity: prevAssetGraph.nodes.length + 1,
|
|
172
|
+
rootNodeId: prevAssetGraph.rootNodeId
|
|
173
|
+
});
|
|
174
|
+
} else {
|
|
175
|
+
graph = new _AssetGraph.default({
|
|
176
|
+
_contentKeyToNodeId: prevAssetGraph._contentKeyToNodeId,
|
|
177
|
+
_nodeIdToContentKey: prevAssetGraph._nodeIdToContentKey,
|
|
178
|
+
nodes: prevAssetGraph.nodes,
|
|
179
|
+
initialCapacity: serializedGraph.edges.length,
|
|
180
|
+
// Accomodate the root node
|
|
181
|
+
initialNodeCapacity: prevAssetGraph.nodes.length + 1,
|
|
182
|
+
rootNodeId: prevAssetGraph.rootNodeId
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
graph.safeToIncrementallyBundle = false;
|
|
186
|
+
} else {
|
|
187
|
+
graph = new _AssetGraph.default({
|
|
188
|
+
_contentKeyToNodeId: new Map(),
|
|
189
|
+
_nodeIdToContentKey: new Map(),
|
|
190
|
+
initialCapacity: serializedGraph.edges.length,
|
|
191
|
+
// Accomodate the root node
|
|
192
|
+
initialNodeCapacity: serializedGraph.nodes.length + 1
|
|
193
|
+
});
|
|
194
|
+
let rootNodeId = graph.addNodeByContentKey('@@root', {
|
|
195
|
+
id: '@@root',
|
|
196
|
+
type: 'root',
|
|
197
|
+
value: null
|
|
198
|
+
});
|
|
199
|
+
graph.setRootNodeId(rootNodeId);
|
|
200
|
+
graph.safeToIncrementallyBundle = false;
|
|
201
|
+
}
|
|
202
|
+
(0, _assert().default)(graph, 'Asset graph not initialized');
|
|
203
|
+
(0, _assert().default)(graph.rootNodeId != null, 'Asset graph has no root node');
|
|
75
204
|
|
|
76
|
-
//
|
|
77
|
-
function getAssetGraph(serializedGraph) {
|
|
78
|
-
let graph = new _AssetGraph.default({
|
|
79
|
-
_contentKeyToNodeId: new Map(),
|
|
80
|
-
_nodeIdToContentKey: new Map(),
|
|
81
|
-
initialCapacity: serializedGraph.edges.length
|
|
82
|
-
});
|
|
83
|
-
graph.safeToIncrementallyBundle = false;
|
|
205
|
+
// @ts-expect-error TS7031
|
|
84
206
|
function mapSymbols({
|
|
85
207
|
exported,
|
|
86
208
|
...symbol
|
|
@@ -88,19 +210,16 @@ function getAssetGraph(serializedGraph) {
|
|
|
88
210
|
let jsSymbol = {
|
|
89
211
|
local: symbol.local ?? undefined,
|
|
90
212
|
loc: symbol.loc ?? undefined,
|
|
91
|
-
|
|
92
|
-
|
|
213
|
+
isWeak: symbol.isWeak,
|
|
214
|
+
meta: {
|
|
215
|
+
isEsm: symbol.isEsmExport,
|
|
216
|
+
isStaticBindingSafe: symbol.isStaticBindingSafe
|
|
217
|
+
}
|
|
93
218
|
};
|
|
94
219
|
if (symbol.exported) {
|
|
95
|
-
//
|
|
220
|
+
// @ts-expect-error TS2339
|
|
96
221
|
jsSymbol.exported = symbol.exported;
|
|
97
222
|
}
|
|
98
|
-
if (symbol.isEsmExport) {
|
|
99
|
-
// $FlowFixMe
|
|
100
|
-
jsSymbol.meta = {
|
|
101
|
-
isEsm: true
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
223
|
return [exported, jsSymbol];
|
|
105
224
|
}
|
|
106
225
|
|
|
@@ -112,20 +231,121 @@ function getAssetGraph(serializedGraph) {
|
|
|
112
231
|
let envKey = [env.context, env.engines.atlaspack, env.engines.browsers, env.engines.electron, env.engines.node, env.includeNodeModules, env.isLibrary, env.outputFormat, env.shouldScopeHoist, env.shouldOptimize, env.sourceType].join(':');
|
|
113
232
|
let envId = envs.get(envKey);
|
|
114
233
|
if (envId == null) {
|
|
115
|
-
envId =
|
|
234
|
+
envId = (0, _Environment.getEnvironmentHash)(env);
|
|
116
235
|
envs.set(envKey, envId);
|
|
117
236
|
}
|
|
118
237
|
return envId;
|
|
119
238
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
239
|
+
function describeNode(node) {
|
|
240
|
+
const base = {
|
|
241
|
+
type: node.type,
|
|
242
|
+
id: node.id
|
|
243
|
+
};
|
|
244
|
+
if (node.type === 'asset') {
|
|
245
|
+
return {
|
|
246
|
+
...base,
|
|
247
|
+
filePath: node.value.filePath,
|
|
248
|
+
fileType: node.value.type,
|
|
249
|
+
pipeline: node.value.pipeline
|
|
250
|
+
};
|
|
251
|
+
} else if (node.type === 'dependency') {
|
|
252
|
+
return {
|
|
253
|
+
...base,
|
|
254
|
+
specifier: node.value.specifier,
|
|
255
|
+
specifierType: node.value.specifierType,
|
|
256
|
+
sourceAssetId: node.value.sourceAssetId,
|
|
257
|
+
sourcePath: node.value.sourcePath
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
return base;
|
|
261
|
+
}
|
|
262
|
+
function buildDivergenceDiagnostics(divergenceType, newNode, existingNode, index) {
|
|
263
|
+
return {
|
|
264
|
+
contentKey: newNode.id,
|
|
265
|
+
divergenceType,
|
|
266
|
+
newNode: describeNode(newNode),
|
|
267
|
+
existingNode: existingNode ? describeNode(existingNode) : null,
|
|
268
|
+
iterationIndex: index,
|
|
269
|
+
totalSerializedNodes: nodesCount,
|
|
270
|
+
newNodesCount: serializedGraph.nodes.length,
|
|
271
|
+
updatesCount: serializedGraph.updates.length,
|
|
272
|
+
edgesCount: serializedGraph.edges.length,
|
|
273
|
+
hadPreviousGraph: !!prevAssetGraph,
|
|
274
|
+
safeToSkipBundling: serializedGraph.safeToSkipBundling,
|
|
275
|
+
graphNodeCount: graph._contentKeyToNodeId.size
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function updateNode(newNode, isUpdateNode, index) {
|
|
279
|
+
let healDivergence = (0, _featureFlags().getFeatureFlag)('v3AssetGraphSyncImprovements');
|
|
280
|
+
if (isUpdateNode) {
|
|
281
|
+
let existingNode = graph.getNodeByContentKey(newNode.id);
|
|
282
|
+
if (healDivergence) {
|
|
283
|
+
if (existingNode) {
|
|
284
|
+
(0, _assert().default)(existingNode.type === newNode.type);
|
|
285
|
+
Object.assign(existingNode, newNode);
|
|
286
|
+
} else {
|
|
287
|
+
// Rust sent an update for a node JS doesn't have.
|
|
288
|
+
// This means JS's graph is stale. Add the node as new instead.
|
|
289
|
+
// This handles the "undefined == true" error class.
|
|
290
|
+
let diagnostics = buildDivergenceDiagnostics('update_node_not_found', newNode, existingNode, index);
|
|
291
|
+
_logger().default.warn({
|
|
292
|
+
origin: '@atlaspack/core',
|
|
293
|
+
message: `Rust/JS asset graph divergence healed: update node not found, ` + `adding as new. contentKey=${newNode.id} type=${newNode.type} iterationIndex=${index}`,
|
|
294
|
+
meta: {
|
|
295
|
+
trackableEvent: 'asset_graph_divergence_healed',
|
|
296
|
+
...diagnostics
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
graph.addNodeByContentKey(newNode.id, newNode);
|
|
300
|
+
}
|
|
301
|
+
} else {
|
|
302
|
+
(0, _assert().default)(existingNode && existingNode.type === newNode.type);
|
|
303
|
+
Object.assign(existingNode, newNode);
|
|
304
|
+
}
|
|
305
|
+
} else {
|
|
306
|
+
if (healDivergence) {
|
|
307
|
+
if (graph.hasContentKey(newNode.id)) {
|
|
308
|
+
// Rust sent a "new" node that JS already has.
|
|
309
|
+
// This means JS's graph has nodes that Rust considers new.
|
|
310
|
+
// Treat as an update instead of throwing.
|
|
311
|
+
// This handles the "Graph already has content key" error class.
|
|
312
|
+
let existingNode = graph.getNodeByContentKey(newNode.id);
|
|
313
|
+
let diagnostics = buildDivergenceDiagnostics('new_node_already_exists', newNode, existingNode, index);
|
|
314
|
+
_logger().default.warn({
|
|
315
|
+
origin: '@atlaspack/core',
|
|
316
|
+
message: `Rust/JS asset graph divergence healed: new node already exists, ` + `treating as update. contentKey=${newNode.id} type=${newNode.type} iterationIndex=${index}`,
|
|
317
|
+
meta: {
|
|
318
|
+
trackableEvent: 'asset_graph_divergence_healed',
|
|
319
|
+
...diagnostics
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
if (existingNode) {
|
|
323
|
+
Object.assign(existingNode, newNode);
|
|
324
|
+
}
|
|
325
|
+
} else {
|
|
326
|
+
graph.addNodeByContentKey(newNode.id, newNode);
|
|
327
|
+
}
|
|
328
|
+
} else {
|
|
329
|
+
try {
|
|
330
|
+
graph.addNodeByContentKey(newNode.id, newNode);
|
|
331
|
+
} catch (e) {
|
|
332
|
+
if (e instanceof Error && e.message.includes('already has content key')) {
|
|
333
|
+
let existingNode = graph.getNodeByContentKey(newNode.id);
|
|
334
|
+
let diagnostics = buildDivergenceDiagnostics('new_node_already_exists', newNode, existingNode, index);
|
|
335
|
+
throw new Error(`Graph already has content key '${newNode.id}'. Diagnostics: ${JSON.stringify(diagnostics, null, 2)}`);
|
|
336
|
+
}
|
|
337
|
+
throw e;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
let nodeTypeSwitchoverIndex = serializedGraph.nodes.length;
|
|
343
|
+
let nodesCount = serializedGraph.nodes.length + serializedGraph.updates.length;
|
|
344
|
+
for (let index = 0; index < nodesCount; index++) {
|
|
345
|
+
let isUpdateNode = index >= nodeTypeSwitchoverIndex;
|
|
346
|
+
let node = isUpdateNode ? serializedGraph.updates[index - nodeTypeSwitchoverIndex] : serializedGraph.nodes[index];
|
|
347
|
+
node = JSON.parse(node);
|
|
348
|
+
if (node.type === 'entry') {
|
|
129
349
|
let id = 'entry:' + ++entry;
|
|
130
350
|
graph.addNodeByContentKey(id, {
|
|
131
351
|
id: id,
|
|
@@ -137,8 +357,11 @@ function getAssetGraph(serializedGraph) {
|
|
|
137
357
|
let id = asset.id;
|
|
138
358
|
asset.committed = true;
|
|
139
359
|
asset.contentKey = id;
|
|
140
|
-
asset.env.id =
|
|
360
|
+
asset.env.id = (0, _featureFlags().getFeatureFlag)('environmentDeduplication') ?
|
|
361
|
+
// TODO: Rust can do this and avoid copying a significant amount of data over
|
|
362
|
+
(0, _Environment.getEnvironmentHash)(asset.env) : getEnvId(asset.env);
|
|
141
363
|
asset.mapKey = `map:${asset.id}`;
|
|
364
|
+
asset.env = (0, _EnvironmentManager.toEnvironmentRef)(asset.env);
|
|
142
365
|
|
|
143
366
|
// This is populated later when we map the edges between assets and dependencies
|
|
144
367
|
asset.dependencies = new Map();
|
|
@@ -150,66 +373,75 @@ function getAssetGraph(serializedGraph) {
|
|
|
150
373
|
asset.symbols = new Map(asset.symbols.map(mapSymbols));
|
|
151
374
|
}
|
|
152
375
|
changedAssets.set(id, asset);
|
|
153
|
-
|
|
376
|
+
let assetNode = {
|
|
154
377
|
id,
|
|
155
378
|
type: 'asset',
|
|
156
379
|
usedSymbols: new Set(),
|
|
157
380
|
usedSymbolsDownDirty: true,
|
|
158
381
|
usedSymbolsUpDirty: true,
|
|
159
382
|
value: asset
|
|
160
|
-
}
|
|
383
|
+
};
|
|
384
|
+
updateNode(assetNode, isUpdateNode, index);
|
|
161
385
|
} else if (node.type === 'dependency') {
|
|
162
|
-
let
|
|
163
|
-
|
|
386
|
+
let {
|
|
387
|
+
dependency,
|
|
388
|
+
id
|
|
389
|
+
} = node.value;
|
|
164
390
|
dependency.id = id;
|
|
165
|
-
dependency.env.id =
|
|
391
|
+
dependency.env.id = (0, _featureFlags().getFeatureFlag)('environmentDeduplication') ?
|
|
392
|
+
// TODO: Rust can do this and avoid copying a significant amount of data over
|
|
393
|
+
(0, _Environment.getEnvironmentHash)(dependency.env) : getEnvId(dependency.env);
|
|
394
|
+
dependency.env = (0, _EnvironmentManager.toEnvironmentRef)(dependency.env);
|
|
166
395
|
if (dependency.symbols != null) {
|
|
167
396
|
var _dependency$symbols;
|
|
168
397
|
dependency.symbols = new Map((_dependency$symbols = dependency.symbols) === null || _dependency$symbols === void 0 ? void 0 : _dependency$symbols.map(mapSymbols));
|
|
169
398
|
}
|
|
170
399
|
let usedSymbolsDown = new Set();
|
|
171
400
|
let usedSymbolsUp = new Map();
|
|
401
|
+
if (node.used_symbols_up) {
|
|
402
|
+
for (let usedSymbol of node.used_symbols_up) {
|
|
403
|
+
// Transform Rust UsedSymbol { symbol: Symbol, asset: string, resolved_symbol: string }
|
|
404
|
+
// to JS format { symbol: string, asset: string } where symbol is the resolved name
|
|
405
|
+
const exportedName = usedSymbol.symbol.exported;
|
|
406
|
+
usedSymbolsUp.set(exportedName, {
|
|
407
|
+
asset: usedSymbol.asset,
|
|
408
|
+
symbol: usedSymbol.resolved_symbol ?? exportedName
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
}
|
|
172
412
|
if (dependency.isEntry && dependency.isLibrary) {
|
|
173
413
|
usedSymbolsDown.add('*');
|
|
174
414
|
usedSymbolsUp.set('*', undefined);
|
|
175
415
|
}
|
|
176
|
-
|
|
416
|
+
let depNode = {
|
|
177
417
|
id,
|
|
178
418
|
type: 'dependency',
|
|
179
419
|
deferred: false,
|
|
180
420
|
excluded: false,
|
|
181
421
|
hasDeferred: node.has_deferred,
|
|
422
|
+
// @ts-expect-error TS2322
|
|
182
423
|
usedSymbolsDown,
|
|
183
424
|
usedSymbolsDownDirty: true,
|
|
184
425
|
usedSymbolsUp,
|
|
185
426
|
usedSymbolsUpDirtyDown: true,
|
|
186
427
|
usedSymbolsUpDirtyUp: true,
|
|
187
428
|
value: dependency
|
|
188
|
-
}
|
|
429
|
+
};
|
|
430
|
+
updateNode(depNode, isUpdateNode, index);
|
|
189
431
|
}
|
|
190
432
|
}
|
|
191
|
-
|
|
192
|
-
let
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
pipeline: toNode.value.pipeline,
|
|
204
|
-
sideEffects: Boolean(toNode.value.sideEffects)
|
|
205
|
-
});
|
|
206
|
-
let index = graph.addNodeByContentKeyIfNeeded(assetGroupNode.id, assetGroupNode);
|
|
207
|
-
graph.addEdge(from, index);
|
|
208
|
-
graph.addEdge(index, to);
|
|
209
|
-
} else if ((fromNode === null || fromNode === void 0 ? void 0 : fromNode.type) === 'asset' && (toNode === null || toNode === void 0 ? void 0 : toNode.type) === 'dependency') {
|
|
210
|
-
fromNode.value.dependencies.set(toNode.value.id, toNode.value);
|
|
211
|
-
graph.addEdge(from, to);
|
|
212
|
-
} else {
|
|
433
|
+
if (!reuseEdges) {
|
|
434
|
+
for (let i = 0; i < serializedGraph.edges.length; i += 2) {
|
|
435
|
+
let from = serializedGraph.edges[i];
|
|
436
|
+
let to = serializedGraph.edges[i + 1];
|
|
437
|
+
let fromNode = graph.getNode(from);
|
|
438
|
+
let toNode = graph.getNode(to);
|
|
439
|
+
if ((fromNode === null || fromNode === void 0 ? void 0 : fromNode.type) === 'dependency') {
|
|
440
|
+
(0, _assert().default)((toNode === null || toNode === void 0 ? void 0 : toNode.type) === 'asset');
|
|
441
|
+
}
|
|
442
|
+
if ((fromNode === null || fromNode === void 0 ? void 0 : fromNode.type) === 'asset' && (toNode === null || toNode === void 0 ? void 0 : toNode.type) === 'dependency') {
|
|
443
|
+
fromNode.value.dependencies.set(toNode.value.id, toNode.value);
|
|
444
|
+
}
|
|
213
445
|
graph.addEdge(from, to);
|
|
214
446
|
}
|
|
215
447
|
}
|
|
@@ -31,7 +31,8 @@ var _ConfigRequest = require("./ConfigRequest");
|
|
|
31
31
|
var _projectPath = require("../projectPath");
|
|
32
32
|
var _ReporterRunner = require("../ReporterRunner");
|
|
33
33
|
var _RequestTracker = require("../RequestTracker");
|
|
34
|
-
|
|
34
|
+
var _EnvironmentManager = require("../EnvironmentManager");
|
|
35
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
35
36
|
function createAssetRequest(input) {
|
|
36
37
|
return {
|
|
37
38
|
type: _RequestTracker.requestTypes.asset_request,
|
|
@@ -42,8 +43,10 @@ function createAssetRequest(input) {
|
|
|
42
43
|
}
|
|
43
44
|
const type = 'asset_request';
|
|
44
45
|
function getId(input) {
|
|
45
|
-
return (0, _rust().hashString)(type + (0, _projectPath.fromProjectPathRelative)(input.filePath) + input.env
|
|
46
|
+
return (0, _rust().hashString)(type + (0, _projectPath.fromProjectPathRelative)(input.filePath) + (0, _EnvironmentManager.toEnvironmentId)(input.env) + String(input.isSource) + String(input.sideEffects) + (input.code ?? '') + ':' + (input.pipeline ?? '') + ':' + (input.query ?? ''));
|
|
46
47
|
}
|
|
48
|
+
|
|
49
|
+
// @ts-expect-error TS7031
|
|
47
50
|
async function run({
|
|
48
51
|
input,
|
|
49
52
|
api,
|
|
@@ -64,17 +67,31 @@ async function run({
|
|
|
64
67
|
} = input;
|
|
65
68
|
let {
|
|
66
69
|
cachePath
|
|
67
|
-
} = (0, _nullthrows().default)(
|
|
68
|
-
|
|
70
|
+
} = (0, _nullthrows().default)(
|
|
71
|
+
// @ts-expect-error TS2347
|
|
72
|
+
await api.runRequest((0, _AtlaspackConfigRequest.default)()));
|
|
73
|
+
let previousDevDepRequests = new Map(await Promise.all(api.getSubRequests()
|
|
74
|
+
// @ts-expect-error TS7006
|
|
75
|
+
.filter(req => req.requestType === _RequestTracker.requestTypes.dev_dep_request)
|
|
76
|
+
// @ts-expect-error TS7006
|
|
77
|
+
.map(async req => [req.id,
|
|
78
|
+
// @ts-expect-error TS2347
|
|
79
|
+
(0, _nullthrows().default)(await api.getRequestResult(req.id))])));
|
|
69
80
|
let request = {
|
|
70
81
|
...rest,
|
|
71
82
|
invalidateReason,
|
|
72
|
-
devDeps: new Map([...previousDevDepRequests.entries()]
|
|
73
|
-
|
|
83
|
+
devDeps: new Map([...previousDevDepRequests.entries()]
|
|
84
|
+
// @ts-expect-error TS2769
|
|
85
|
+
.filter(([id]) => api.canSkipSubrequest(id)).map(([, req]) => [`${req.specifier}:${(0, _projectPath.fromProjectPathRelative)(req.resolveFrom)}`, req.hash])),
|
|
86
|
+
invalidDevDeps: await Promise.all([...previousDevDepRequests.entries()]
|
|
87
|
+
// @ts-expect-error TS2769
|
|
88
|
+
.filter(([id]) => !api.canSkipSubrequest(id)).flatMap(([, req]) => {
|
|
74
89
|
return [{
|
|
75
90
|
specifier: req.specifier,
|
|
76
91
|
resolveFrom: req.resolveFrom
|
|
77
|
-
},
|
|
92
|
+
},
|
|
93
|
+
// @ts-expect-error TS7006
|
|
94
|
+
...(req.additionalInvalidations ?? []).map(i => ({
|
|
78
95
|
specifier: i.specifier,
|
|
79
96
|
resolveFrom: i.resolveFrom
|
|
80
97
|
}))];
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = createAtlaspackBuildRequest;
|
|
7
7
|
var _BundleGraphRequest = _interopRequireDefault(require("./BundleGraphRequest"));
|
|
8
|
+
var _BundleGraphRequestRust = _interopRequireDefault(require("./BundleGraphRequestRust"));
|
|
8
9
|
var _WriteBundlesRequest = _interopRequireDefault(require("./WriteBundlesRequest"));
|
|
9
10
|
var _utils = require("../utils");
|
|
10
11
|
var _dumpGraphToGraphViz = _interopRequireDefault(require("../dumpGraphToGraphViz"));
|
|
@@ -21,7 +22,22 @@ function _profiler() {
|
|
|
21
22
|
return data;
|
|
22
23
|
}
|
|
23
24
|
var _RequestTracker = require("../RequestTracker");
|
|
24
|
-
function
|
|
25
|
+
function _featureFlags() {
|
|
26
|
+
const data = require("@atlaspack/feature-flags");
|
|
27
|
+
_featureFlags = function () {
|
|
28
|
+
return data;
|
|
29
|
+
};
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
var _EnvironmentManager = require("../EnvironmentManager");
|
|
33
|
+
function _logger() {
|
|
34
|
+
const data = require("@atlaspack/logger");
|
|
35
|
+
_logger = function () {
|
|
36
|
+
return data;
|
|
37
|
+
};
|
|
38
|
+
return data;
|
|
39
|
+
}
|
|
40
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
41
|
function createAtlaspackBuildRequest(input) {
|
|
26
42
|
return {
|
|
27
43
|
type: _RequestTracker.requestTypes.atlaspack_build_request,
|
|
@@ -41,7 +57,11 @@ async function run({
|
|
|
41
57
|
requestedAssetIds,
|
|
42
58
|
signal
|
|
43
59
|
} = input;
|
|
44
|
-
let bundleGraphRequest = (0,
|
|
60
|
+
let bundleGraphRequest = (0, _featureFlags().getFeatureFlag)('nativeBundling') && rustAtlaspack ? (0, _BundleGraphRequestRust.default)({
|
|
61
|
+
optionsRef,
|
|
62
|
+
requestedAssetIds,
|
|
63
|
+
signal
|
|
64
|
+
}) : (0, _BundleGraphRequest.default)({
|
|
45
65
|
optionsRef,
|
|
46
66
|
requestedAssetIds,
|
|
47
67
|
signal
|
|
@@ -49,31 +69,57 @@ async function run({
|
|
|
49
69
|
let {
|
|
50
70
|
bundleGraph,
|
|
51
71
|
changedAssets,
|
|
52
|
-
assetRequests
|
|
72
|
+
assetRequests,
|
|
73
|
+
didIncrementallyBundle
|
|
53
74
|
} = await api.runRequest(bundleGraphRequest, {
|
|
54
75
|
force: Boolean(rustAtlaspack) || options.shouldBuildLazily && requestedAssetIds.size > 0
|
|
55
76
|
});
|
|
77
|
+
if ((0, _featureFlags().getFeatureFlag)('nativePackager') && (0, _featureFlags().getFeatureFlag)('nativePackagerSSRDev') && rustAtlaspack) {
|
|
78
|
+
let hasSupportedTarget = false;
|
|
79
|
+
bundleGraph.traverseBundles((bundle, ctx, actions) => {
|
|
80
|
+
if ((0, _EnvironmentManager.fromEnvironmentId)(bundle.env).context === 'tesseract' && bundle.type === 'js') {
|
|
81
|
+
hasSupportedTarget = true;
|
|
82
|
+
actions.stop();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
if (hasSupportedTarget) {
|
|
86
|
+
if (didIncrementallyBundle) {
|
|
87
|
+
const changedAssetIds = Array.from(changedAssets.keys());
|
|
88
|
+
await rustAtlaspack.updateBundleGraph(bundleGraph, changedAssetIds);
|
|
89
|
+
} else {
|
|
90
|
+
await rustAtlaspack.loadBundleGraph(bundleGraph);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
56
94
|
|
|
57
|
-
//
|
|
95
|
+
// @ts-expect-error TS2345
|
|
58
96
|
(0, _dumpGraphToGraphViz.default)(bundleGraph._graph, 'BundleGraph', _BundleGraph.bundleGraphEdgeTypes);
|
|
59
97
|
await (0, _ReporterRunner.report)({
|
|
60
98
|
type: 'buildProgress',
|
|
61
99
|
phase: 'bundled',
|
|
62
|
-
bundleGraph: new _BundleGraph2.default(bundleGraph,
|
|
100
|
+
bundleGraph: new _BundleGraph2.default(bundleGraph,
|
|
101
|
+
// @ts-expect-error TS2304
|
|
102
|
+
(bundle, bundleGraph, options) => _Bundle.NamedBundle.get(bundle, bundleGraph, options), options),
|
|
63
103
|
changedAssets: new Map(Array.from(changedAssets).map(([id, asset]) => [id, (0, _Asset.assetFromValue)(asset, options)]))
|
|
64
104
|
});
|
|
65
105
|
let packagingMeasurement = _profiler().tracer.createMeasurement('packaging');
|
|
106
|
+
const span = _logger().tracer.enter('writeBundles');
|
|
66
107
|
let writeBundlesRequest = (0, _WriteBundlesRequest.default)({
|
|
67
108
|
bundleGraph,
|
|
68
109
|
optionsRef
|
|
69
110
|
});
|
|
70
|
-
let
|
|
111
|
+
let {
|
|
112
|
+
bundleInfo,
|
|
113
|
+
scopeHoistingStats
|
|
114
|
+
} = await api.runRequest(writeBundlesRequest);
|
|
71
115
|
packagingMeasurement && packagingMeasurement.end();
|
|
116
|
+
_logger().tracer.exit(span);
|
|
72
117
|
(0, _utils.assertSignalNotAborted)(signal);
|
|
73
118
|
return {
|
|
74
119
|
bundleGraph,
|
|
75
120
|
bundleInfo,
|
|
76
121
|
changedAssets,
|
|
77
|
-
assetRequests
|
|
122
|
+
assetRequests,
|
|
123
|
+
scopeHoistingStats
|
|
78
124
|
};
|
|
79
125
|
}
|