@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
|
@@ -65,9 +65,10 @@ var _AtlaspackConfig2 = _interopRequireDefault(require("../AtlaspackConfig.schem
|
|
|
65
65
|
var _projectPath = require("../projectPath");
|
|
66
66
|
var _RequestTracker = require("../RequestTracker");
|
|
67
67
|
var _utils2 = require("../utils");
|
|
68
|
-
function _interopRequireDefault(
|
|
69
|
-
function
|
|
70
|
-
|
|
68
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
69
|
+
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); }
|
|
70
|
+
// @ts-expect-error TS2344
|
|
71
|
+
|
|
71
72
|
const type = 'atlaspack_config_request';
|
|
72
73
|
function createAtlaspackConfigRequest() {
|
|
73
74
|
return {
|
|
@@ -117,10 +118,12 @@ function getCachedAtlaspackConfig(result, options) {
|
|
|
117
118
|
} = result;
|
|
118
119
|
let config = atlaspackConfigCache.get(cachePath);
|
|
119
120
|
if (config) {
|
|
121
|
+
// @ts-expect-error TS2740
|
|
120
122
|
return config;
|
|
121
123
|
}
|
|
122
124
|
config = new _AtlaspackConfig.AtlaspackConfig(processedConfig, options);
|
|
123
125
|
atlaspackConfigCache.set(cachePath, config);
|
|
126
|
+
// @ts-expect-error TS2322
|
|
124
127
|
return config;
|
|
125
128
|
}
|
|
126
129
|
async function loadAtlaspackConfig(options) {
|
|
@@ -157,13 +160,23 @@ async function resolveAtlaspackConfig(options) {
|
|
|
157
160
|
extendedFiles
|
|
158
161
|
} = await parseAndProcessConfig(configPath, contents, options);
|
|
159
162
|
if (options.additionalReporters.length > 0) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}) => ({
|
|
163
|
+
var _config$reporters;
|
|
164
|
+
const reporterMap = new Map();
|
|
165
|
+
options.additionalReporters.forEach(({
|
|
164
166
|
packageName,
|
|
165
167
|
resolveFrom
|
|
166
|
-
})
|
|
168
|
+
}) => {
|
|
169
|
+
reporterMap.set(packageName, {
|
|
170
|
+
packageName,
|
|
171
|
+
resolveFrom
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
(_config$reporters = config.reporters) === null || _config$reporters === void 0 || _config$reporters.forEach(reporter => {
|
|
175
|
+
if (!reporterMap.has(reporter.packageName)) {
|
|
176
|
+
reporterMap.set(reporter.packageName, reporter);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
config.reporters = Array.from(reporterMap.values());
|
|
167
180
|
}
|
|
168
181
|
return {
|
|
169
182
|
config,
|
|
@@ -207,7 +220,6 @@ async function parseAndProcessConfig(configPath, contents, options) {
|
|
|
207
220
|
function processPipeline(options, pipeline, keyPath, filePath) {
|
|
208
221
|
if (pipeline) {
|
|
209
222
|
return pipeline.map((pkg, i) => {
|
|
210
|
-
// $FlowFixMe
|
|
211
223
|
if (pkg === '...') return pkg;
|
|
212
224
|
return {
|
|
213
225
|
packageName: pkg,
|
|
@@ -218,14 +230,8 @@ function processPipeline(options, pipeline, keyPath, filePath) {
|
|
|
218
230
|
}
|
|
219
231
|
}
|
|
220
232
|
const RESERVED_PIPELINES = new Set(['node:', 'npm:', 'http:', 'https:', 'data:', 'tel:', 'mailto:']);
|
|
221
|
-
async function processMap(
|
|
222
|
-
// $FlowFixMe
|
|
223
|
-
map, keyPath, filePath, options
|
|
224
|
-
// $FlowFixMe
|
|
225
|
-
) {
|
|
233
|
+
async function processMap(map, keyPath, filePath, options) {
|
|
226
234
|
if (!map) return undefined;
|
|
227
|
-
|
|
228
|
-
// $FlowFixMe
|
|
229
235
|
let res = {};
|
|
230
236
|
for (let k in map) {
|
|
231
237
|
let i = k.indexOf(':');
|
|
@@ -268,6 +274,7 @@ async function processConfig(configFile, options) {
|
|
|
268
274
|
} : {
|
|
269
275
|
/*::...null*/
|
|
270
276
|
}),
|
|
277
|
+
// @ts-expect-error TS2322
|
|
271
278
|
resolvers: processPipeline(options, configFile.resolvers, '/resolvers', configFile.filePath),
|
|
272
279
|
transformers: await processMap(configFile.transformers, '/transformers', configFile.filePath, options),
|
|
273
280
|
bundler: configFile.bundler != null ? {
|
|
@@ -275,11 +282,14 @@ async function processConfig(configFile, options) {
|
|
|
275
282
|
resolveFrom: (0, _projectPath.toProjectPath)(options.projectRoot, configFile.filePath),
|
|
276
283
|
keyPath: '/bundler'
|
|
277
284
|
} : undefined,
|
|
285
|
+
// @ts-expect-error TS2322
|
|
278
286
|
namers: processPipeline(options, configFile.namers, '/namers', configFile.filePath),
|
|
287
|
+
// @ts-expect-error TS2322
|
|
279
288
|
runtimes: processPipeline(options, configFile.runtimes, '/runtimes', configFile.filePath),
|
|
280
289
|
packagers: await processMap(configFile.packagers, '/packagers', configFile.filePath, options),
|
|
281
290
|
optimizers: await processMap(configFile.optimizers, '/optimizers', configFile.filePath, options),
|
|
282
291
|
compressors: await processMap(configFile.compressors, '/compressors', configFile.filePath, options),
|
|
292
|
+
// @ts-expect-error TS2322
|
|
283
293
|
reporters: processPipeline(options, configFile.reporters, '/reporters', configFile.filePath),
|
|
284
294
|
validators: await processMap(configFile.validators, '/validators', configFile.filePath, options)
|
|
285
295
|
};
|
|
@@ -462,14 +472,14 @@ function mergeMaps(base, ext, merger) {
|
|
|
462
472
|
let res = {};
|
|
463
473
|
// Add the extension options first so they have higher precedence in the output glob map
|
|
464
474
|
for (let k in ext) {
|
|
465
|
-
//$FlowFixMe Flow doesn't correctly infer the type. See https://github.com/facebook/flow/issues/1736.
|
|
466
475
|
let key = k;
|
|
467
|
-
res[key] =
|
|
476
|
+
res[key] =
|
|
477
|
+
// @ts-expect-error TS2345
|
|
478
|
+
merger && base[key] != null ? merger(base[key], ext[key]) : ext[key];
|
|
468
479
|
}
|
|
469
480
|
|
|
470
481
|
// Add base options that aren't defined in the extension
|
|
471
482
|
for (let k in base) {
|
|
472
|
-
// $FlowFixMe
|
|
473
483
|
let key = k;
|
|
474
484
|
if (res[key] == null) {
|
|
475
485
|
res[key] = base[key];
|
|
@@ -32,6 +32,13 @@ function _logger() {
|
|
|
32
32
|
};
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
|
+
function _featureFlags() {
|
|
36
|
+
const data = require("@atlaspack/feature-flags");
|
|
37
|
+
_featureFlags = function () {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
35
42
|
function _diagnostic() {
|
|
36
43
|
const data = _interopRequireWildcard(require("@atlaspack/diagnostic"));
|
|
37
44
|
_diagnostic = function () {
|
|
@@ -39,20 +46,10 @@ function _diagnostic() {
|
|
|
39
46
|
};
|
|
40
47
|
return data;
|
|
41
48
|
}
|
|
42
|
-
var
|
|
43
|
-
var _BundleGraph = _interopRequireDefault(require("../public/BundleGraph"));
|
|
44
|
-
var _BundleGraph2 = _interopRequireWildcard(require("../BundleGraph"));
|
|
49
|
+
var _BundleGraph = _interopRequireWildcard(require("../BundleGraph"));
|
|
45
50
|
var _MutableBundleGraph = _interopRequireDefault(require("../public/MutableBundleGraph"));
|
|
46
|
-
var _Bundle = require("../public/Bundle");
|
|
47
51
|
var _ReporterRunner = require("../ReporterRunner");
|
|
48
52
|
var _dumpGraphToGraphViz = _interopRequireDefault(require("../dumpGraphToGraphViz"));
|
|
49
|
-
function _utils() {
|
|
50
|
-
const data = require("@atlaspack/utils");
|
|
51
|
-
_utils = function () {
|
|
52
|
-
return data;
|
|
53
|
-
};
|
|
54
|
-
return data;
|
|
55
|
-
}
|
|
56
53
|
function _rust() {
|
|
57
54
|
const data = require("@atlaspack/rust");
|
|
58
55
|
_rust = function () {
|
|
@@ -63,12 +60,11 @@ function _rust() {
|
|
|
63
60
|
var _PluginOptions = _interopRequireDefault(require("../public/PluginOptions"));
|
|
64
61
|
var _applyRuntimes = _interopRequireDefault(require("../applyRuntimes"));
|
|
65
62
|
var _constants = require("../constants");
|
|
66
|
-
var
|
|
63
|
+
var _utils = require("../utils");
|
|
67
64
|
var _AtlaspackConfigRequest = _interopRequireWildcard(require("./AtlaspackConfigRequest"));
|
|
68
65
|
var _DevDepRequest = require("./DevDepRequest");
|
|
69
|
-
var _InternalConfig = require("../InternalConfig");
|
|
70
|
-
var _ConfigRequest = require("./ConfigRequest");
|
|
71
66
|
var _projectPath = require("../projectPath");
|
|
67
|
+
var _BundleGraphRequestUtils = require("./BundleGraphRequestUtils");
|
|
72
68
|
var _AssetGraphRequest = _interopRequireDefault(require("./AssetGraphRequest"));
|
|
73
69
|
var _AssetGraphRequestRust = require("./AssetGraphRequestRust");
|
|
74
70
|
function _profiler() {
|
|
@@ -81,10 +77,10 @@ function _profiler() {
|
|
|
81
77
|
var _RequestTracker = require("../RequestTracker");
|
|
82
78
|
var _assetGraphDot = require("./asset-graph-dot");
|
|
83
79
|
var _types = require("../types");
|
|
84
|
-
function
|
|
85
|
-
function
|
|
86
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
80
|
+
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); }
|
|
81
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
87
82
|
// TODO: Rename to BundleGraphRequestResult
|
|
83
|
+
|
|
88
84
|
function applySideEffectsForLoadableImports(assetGraph) {
|
|
89
85
|
// Avoid revisiting nodes
|
|
90
86
|
let updatedAssetIds = new Set();
|
|
@@ -131,7 +127,7 @@ function createBundleGraphRequest(input) {
|
|
|
131
127
|
signal
|
|
132
128
|
} = input.input;
|
|
133
129
|
let measurement = _profiler().tracer.createMeasurement('building');
|
|
134
|
-
let createAssetGraphRequest = input.rustAtlaspack ? (0, _AssetGraphRequestRust.createAssetGraphRequestRust)(input.rustAtlaspack) : _AssetGraphRequest.default;
|
|
130
|
+
let createAssetGraphRequest = (0, _featureFlags().getFeatureFlag)('atlaspackV3') && input.rustAtlaspack ? (0, _AssetGraphRequestRust.createAssetGraphRequestRust)(input.rustAtlaspack) : _AssetGraphRequest.default;
|
|
135
131
|
let request = createAssetGraphRequest({
|
|
136
132
|
name: 'Main',
|
|
137
133
|
entries: options.entries,
|
|
@@ -139,14 +135,17 @@ function createBundleGraphRequest(input) {
|
|
|
139
135
|
shouldBuildLazily: options.shouldBuildLazily,
|
|
140
136
|
lazyIncludes: options.lazyIncludes,
|
|
141
137
|
lazyExcludes: options.lazyExcludes,
|
|
142
|
-
requestedAssetIds
|
|
138
|
+
requestedAssetIds,
|
|
139
|
+
skipSymbolProp: (0, _featureFlags().getFeatureFlag)('rustSymbolTracker')
|
|
143
140
|
});
|
|
144
141
|
let {
|
|
145
142
|
assetGraph,
|
|
146
143
|
changedAssets,
|
|
147
144
|
assetRequests
|
|
148
|
-
} = await
|
|
149
|
-
|
|
145
|
+
} = await (0, _logger().instrumentAsync)('asset-graph-request', () => {
|
|
146
|
+
return api.runRequest(request, {
|
|
147
|
+
force: Boolean(input.rustAtlaspack) || options.shouldBuildLazily && requestedAssetIds.size > 0
|
|
148
|
+
});
|
|
150
149
|
});
|
|
151
150
|
if ((_input$options$featur = input.options.featureFlags) !== null && _input$options$featur !== void 0 && _input$options$featur.loadableSideEffects) {
|
|
152
151
|
applySideEffectsForLoadableImports(assetGraph);
|
|
@@ -171,11 +170,15 @@ function createBundleGraphRequest(input) {
|
|
|
171
170
|
// force: true,
|
|
172
171
|
// },
|
|
173
172
|
// );
|
|
174
|
-
// require('./asset-graph-diff.
|
|
173
|
+
// require('./asset-graph-diff.ts')(
|
|
174
|
+
// jsAssetGraph,
|
|
175
|
+
// assetGraph,
|
|
176
|
+
// options.projectRoot,
|
|
177
|
+
// );
|
|
175
178
|
// }
|
|
176
179
|
|
|
177
180
|
measurement && measurement.end();
|
|
178
|
-
(0,
|
|
181
|
+
(0, _utils.assertSignalNotAborted)(signal);
|
|
179
182
|
|
|
180
183
|
// If any subrequests are invalid (e.g. dev dep requests or config requests),
|
|
181
184
|
// bail on incremental bundling. We also need to invalidate for option changes,
|
|
@@ -185,7 +188,7 @@ function createBundleGraphRequest(input) {
|
|
|
185
188
|
assetGraph.safeToIncrementallyBundle = false;
|
|
186
189
|
}
|
|
187
190
|
let configResult = (0, _nullthrows().default)(await input.api.runRequest((0, _AtlaspackConfigRequest.default)()));
|
|
188
|
-
(0,
|
|
191
|
+
(0, _utils.assertSignalNotAborted)(signal);
|
|
189
192
|
let atlaspackConfig = (0, _AtlaspackConfigRequest.getCachedAtlaspackConfig)(configResult, input.options);
|
|
190
193
|
let {
|
|
191
194
|
devDeps,
|
|
@@ -204,8 +207,8 @@ function createBundleGraphRequest(input) {
|
|
|
204
207
|
res.changedAssets.set(id, asset);
|
|
205
208
|
}
|
|
206
209
|
await (0, _dumpGraphToGraphViz.default)(
|
|
207
|
-
//
|
|
208
|
-
res.bundleGraph._graph, 'BundleGraph',
|
|
210
|
+
// @ts-expect-error TS2345
|
|
211
|
+
res.bundleGraph._graph, 'BundleGraph', _BundleGraph.bundleGraphEdgeTypes);
|
|
209
212
|
return res;
|
|
210
213
|
},
|
|
211
214
|
input
|
|
@@ -224,7 +227,7 @@ class BundlerRunner {
|
|
|
224
227
|
this.previousDevDeps = previousDevDeps;
|
|
225
228
|
this.devDepRequests = new Map();
|
|
226
229
|
this.configs = new Map();
|
|
227
|
-
this.pluginOptions = new _PluginOptions.default((0,
|
|
230
|
+
this.pluginOptions = new _PluginOptions.default((0, _utils.optionsProxy)(this.options, api.invalidateOnOptionChange));
|
|
228
231
|
this.cacheKey = (0, _rust().hashString)(`${_constants.ATLASPACK_VERSION}:BundleGraph:${JSON.stringify(options.entries) ?? ''}${options.mode}${options.shouldBuildLazily ? 'lazy' : 'eager'}`) + '-BundleGraph';
|
|
229
232
|
}
|
|
230
233
|
async loadConfigs() {
|
|
@@ -241,26 +244,10 @@ class BundlerRunner {
|
|
|
241
244
|
}
|
|
242
245
|
}
|
|
243
246
|
async loadConfig(plugin) {
|
|
244
|
-
|
|
245
|
-
plugin: plugin.name,
|
|
246
|
-
searchPath: (0, _projectPath.toProjectPathUnsafe)('index')
|
|
247
|
-
});
|
|
248
|
-
await (0, _ConfigRequest.loadPluginConfig)(plugin, config, this.options);
|
|
249
|
-
await (0, _ConfigRequest.runConfigRequest)(this.api, config);
|
|
250
|
-
for (let devDep of config.devDeps) {
|
|
251
|
-
let devDepRequest = await (0, _DevDepRequest.createDevDependency)(devDep, this.previousDevDeps, this.options);
|
|
252
|
-
await this.runDevDepRequest(devDepRequest);
|
|
253
|
-
}
|
|
254
|
-
this.configs.set(plugin.name, config);
|
|
247
|
+
await (0, _BundleGraphRequestUtils.loadPluginConfigWithDevDeps)(plugin, this.options, this.api, this.previousDevDeps, this.devDepRequests, this.configs);
|
|
255
248
|
}
|
|
256
249
|
async runDevDepRequest(devDepRequest) {
|
|
257
|
-
|
|
258
|
-
specifier,
|
|
259
|
-
resolveFrom
|
|
260
|
-
} = devDepRequest;
|
|
261
|
-
let key = `${specifier}:${(0, _projectPath.fromProjectPathRelative)(resolveFrom)}`;
|
|
262
|
-
this.devDepRequests.set(key, devDepRequest);
|
|
263
|
-
await (0, _DevDepRequest.runDevDepRequest)(this.api, devDepRequest);
|
|
250
|
+
await (0, _BundleGraphRequestUtils.runDevDepRequest)(this.api, devDepRequest, this.devDepRequests);
|
|
264
251
|
}
|
|
265
252
|
async bundle({
|
|
266
253
|
graph,
|
|
@@ -271,6 +258,7 @@ class BundlerRunner {
|
|
|
271
258
|
type: 'buildProgress',
|
|
272
259
|
phase: 'bundling'
|
|
273
260
|
});
|
|
261
|
+
let didIncrementallyBundle = false;
|
|
274
262
|
await this.loadConfigs();
|
|
275
263
|
let plugin = await this.config.getBundler();
|
|
276
264
|
let {
|
|
@@ -280,15 +268,9 @@ class BundlerRunner {
|
|
|
280
268
|
} = plugin;
|
|
281
269
|
|
|
282
270
|
// if a previous asset graph hash is passed in, check if the bundle graph is also available
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
previousBundleGraphResult = await this.api.getPreviousResult();
|
|
287
|
-
} catch {
|
|
288
|
-
// if the bundle graph had an error or was removed, don't fail the build
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
if (previousBundleGraphResult == null) {
|
|
271
|
+
const previousBundleGraphResult = await this.api.getPreviousResult();
|
|
272
|
+
const canIncrementallyBundle = previousBundleGraphResult != null && graph.canIncrementallyBundle();
|
|
273
|
+
if (graph.safeToIncrementallyBundle && previousBundleGraphResult == null) {
|
|
292
274
|
graph.safeToIncrementallyBundle = false;
|
|
293
275
|
}
|
|
294
276
|
let internalBundleGraph;
|
|
@@ -300,7 +282,7 @@ class BundlerRunner {
|
|
|
300
282
|
category: 'bundle'
|
|
301
283
|
});
|
|
302
284
|
try {
|
|
303
|
-
if (previousBundleGraphResult) {
|
|
285
|
+
if (canIncrementallyBundle && previousBundleGraphResult) {
|
|
304
286
|
internalBundleGraph = previousBundleGraphResult.bundleGraph;
|
|
305
287
|
for (let changedAssetId of changedAssets.keys()) {
|
|
306
288
|
// Copy over the whole node to also have correct symbol data
|
|
@@ -308,14 +290,14 @@ class BundlerRunner {
|
|
|
308
290
|
(0, _assert().default)(changedAssetNode.type === 'asset');
|
|
309
291
|
internalBundleGraph.updateAsset(changedAssetNode);
|
|
310
292
|
}
|
|
293
|
+
didIncrementallyBundle = true;
|
|
311
294
|
} else {
|
|
312
|
-
|
|
313
|
-
internalBundleGraph = _BundleGraph2.default.fromAssetGraph(graph, this.options.mode === 'production');
|
|
295
|
+
internalBundleGraph = _BundleGraph.default.fromAssetGraph(graph, this.options.mode === 'production');
|
|
314
296
|
(0, _assert().default)(internalBundleGraph != null); // ensures the graph was created
|
|
315
297
|
|
|
316
298
|
await (0, _dumpGraphToGraphViz.default)(
|
|
317
|
-
//
|
|
318
|
-
internalBundleGraph._graph, 'before_bundle',
|
|
299
|
+
// @ts-expect-error TS2345
|
|
300
|
+
internalBundleGraph._graph, 'before_bundle', _BundleGraph.bundleGraphEdgeTypes);
|
|
319
301
|
let mutableBundleGraph = new _MutableBundleGraph.default(internalBundleGraph, this.options);
|
|
320
302
|
let measurement;
|
|
321
303
|
let measurementFilename;
|
|
@@ -325,14 +307,18 @@ class BundlerRunner {
|
|
|
325
307
|
}
|
|
326
308
|
|
|
327
309
|
// this the normal bundle workflow (bundle, optimizing, run-times, naming)
|
|
328
|
-
await
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
310
|
+
await (0, _logger().instrumentAsync)('bundle (V2)', async () => {
|
|
311
|
+
var _this$configs$get;
|
|
312
|
+
await bundler.bundle({
|
|
313
|
+
bundleGraph: mutableBundleGraph,
|
|
314
|
+
config: (_this$configs$get = this.configs.get(plugin.name)) === null || _this$configs$get === void 0 ? void 0 : _this$configs$get.result,
|
|
315
|
+
options: this.pluginOptions,
|
|
316
|
+
logger,
|
|
317
|
+
tracer
|
|
318
|
+
});
|
|
334
319
|
});
|
|
335
320
|
measurement && measurement.end();
|
|
321
|
+
(0, _BundleGraphRequestUtils.dumpBundleGraphSnapshot)(internalBundleGraph, 'js');
|
|
336
322
|
if (this.pluginOptions.mode === 'production') {
|
|
337
323
|
let optimizeMeasurement;
|
|
338
324
|
try {
|
|
@@ -355,7 +341,7 @@ class BundlerRunner {
|
|
|
355
341
|
} finally {
|
|
356
342
|
optimizeMeasurement && optimizeMeasurement.end();
|
|
357
343
|
await (0, _dumpGraphToGraphViz.default)(
|
|
358
|
-
//
|
|
344
|
+
// @ts-expect-error TS2345
|
|
359
345
|
internalBundleGraph._graph, 'after_optimize');
|
|
360
346
|
}
|
|
361
347
|
}
|
|
@@ -373,7 +359,8 @@ class BundlerRunner {
|
|
|
373
359
|
this.api.storeResult({
|
|
374
360
|
bundleGraph: internalBundleGraph,
|
|
375
361
|
changedAssets: new Map(),
|
|
376
|
-
assetRequests: []
|
|
362
|
+
assetRequests: [],
|
|
363
|
+
didIncrementallyBundle
|
|
377
364
|
}, this.cacheKey);
|
|
378
365
|
}
|
|
379
366
|
throw new (_diagnostic().default)({
|
|
@@ -384,20 +371,20 @@ class BundlerRunner {
|
|
|
384
371
|
} finally {
|
|
385
372
|
if (internalBundleGraph != null) {
|
|
386
373
|
await (0, _dumpGraphToGraphViz.default)(
|
|
387
|
-
//
|
|
388
|
-
internalBundleGraph._graph, 'after_bundle',
|
|
374
|
+
// @ts-expect-error TS2345
|
|
375
|
+
internalBundleGraph._graph, 'after_bundle', _BundleGraph.bundleGraphEdgeTypes);
|
|
389
376
|
}
|
|
390
377
|
}
|
|
391
378
|
let changedRuntimes = new Map();
|
|
392
|
-
if (!previousBundleGraphResult) {
|
|
379
|
+
if (!previousBundleGraphResult || !canIncrementallyBundle) {
|
|
393
380
|
let namers = await this.config.getNamers();
|
|
394
381
|
// inline bundles must still be named so the PackagerRunner
|
|
395
382
|
// can match them to the correct packager/optimizer plugins.
|
|
396
383
|
let bundles = internalBundleGraph.getBundles({
|
|
397
384
|
includeInline: true
|
|
398
385
|
});
|
|
399
|
-
await Promise.all(bundles.map(bundle =>
|
|
400
|
-
changedRuntimes = await (0, _applyRuntimes.default)({
|
|
386
|
+
await Promise.all(bundles.map(bundle => (0, _BundleGraphRequestUtils.nameBundle)(namers, bundle, internalBundleGraph, this.options, this.pluginOptions, this.configs)));
|
|
387
|
+
changedRuntimes = await (0, _logger().instrumentAsync)('applyRuntimes', () => (0, _applyRuntimes.default)({
|
|
401
388
|
bundleGraph: internalBundleGraph,
|
|
402
389
|
api: this.api,
|
|
403
390
|
config: this.config,
|
|
@@ -407,7 +394,7 @@ class BundlerRunner {
|
|
|
407
394
|
previousDevDeps: this.previousDevDeps,
|
|
408
395
|
devDepRequests: this.devDepRequests,
|
|
409
396
|
configs: this.configs
|
|
410
|
-
});
|
|
397
|
+
}));
|
|
411
398
|
|
|
412
399
|
// Add dev deps for namers, AFTER running them to account for lazy require().
|
|
413
400
|
for (let namer of namers) {
|
|
@@ -417,69 +404,25 @@ class BundlerRunner {
|
|
|
417
404
|
}, this.previousDevDeps, this.options);
|
|
418
405
|
await this.runDevDepRequest(devDepRequest);
|
|
419
406
|
}
|
|
420
|
-
|
|
407
|
+
(0, _BundleGraphRequestUtils.validateBundles)(internalBundleGraph);
|
|
421
408
|
|
|
422
409
|
// Pre-compute the hashes for each bundle so they are only computed once and shared between workers.
|
|
423
410
|
internalBundleGraph.getBundleGraphHash();
|
|
424
411
|
}
|
|
425
412
|
await (0, _dumpGraphToGraphViz.default)(
|
|
426
|
-
//
|
|
427
|
-
internalBundleGraph._graph, 'after_runtimes',
|
|
413
|
+
// @ts-expect-error TS2345
|
|
414
|
+
internalBundleGraph._graph, 'after_runtimes', _BundleGraph.bundleGraphEdgeTypes);
|
|
428
415
|
this.api.storeResult({
|
|
429
416
|
bundleGraph: internalBundleGraph,
|
|
430
417
|
changedAssets: new Map(),
|
|
431
|
-
assetRequests: []
|
|
418
|
+
assetRequests: [],
|
|
419
|
+
didIncrementallyBundle
|
|
432
420
|
}, this.cacheKey);
|
|
433
421
|
return {
|
|
434
422
|
bundleGraph: internalBundleGraph,
|
|
435
423
|
changedAssets: changedRuntimes,
|
|
436
|
-
assetRequests
|
|
424
|
+
assetRequests,
|
|
425
|
+
didIncrementallyBundle
|
|
437
426
|
};
|
|
438
427
|
}
|
|
439
|
-
validateBundles(bundleGraph) {
|
|
440
|
-
let bundles = bundleGraph.getBundles();
|
|
441
|
-
let bundleNames = bundles.map(b => (0, _projectPath.joinProjectPath)(b.target.distDir, (0, _nullthrows().default)(b.name)));
|
|
442
|
-
_assert().default.deepEqual(bundleNames, (0, _utils().unique)(bundleNames), 'Bundles must have unique name. Conflicting names: ' + [...(0, _utils().setSymmetricDifference)(new Set(bundleNames), new Set((0, _utils().unique)(bundleNames)))].join());
|
|
443
|
-
}
|
|
444
|
-
async nameBundle(namers, internalBundle, internalBundleGraph) {
|
|
445
|
-
let bundle = _Bundle.Bundle.get(internalBundle, internalBundleGraph, this.options);
|
|
446
|
-
let bundleGraph = new _BundleGraph.default(internalBundleGraph, _Bundle.NamedBundle.get.bind(_Bundle.NamedBundle), this.options);
|
|
447
|
-
for (let namer of namers) {
|
|
448
|
-
let measurement;
|
|
449
|
-
try {
|
|
450
|
-
var _this$configs$get3;
|
|
451
|
-
measurement = _profiler().tracer.createMeasurement(namer.name, 'namer', bundle.id);
|
|
452
|
-
let name = await namer.plugin.name({
|
|
453
|
-
bundle,
|
|
454
|
-
bundleGraph,
|
|
455
|
-
config: (_this$configs$get3 = this.configs.get(namer.name)) === null || _this$configs$get3 === void 0 ? void 0 : _this$configs$get3.result,
|
|
456
|
-
options: this.pluginOptions,
|
|
457
|
-
logger: new (_logger().PluginLogger)({
|
|
458
|
-
origin: namer.name
|
|
459
|
-
}),
|
|
460
|
-
tracer: new (_profiler().PluginTracer)({
|
|
461
|
-
origin: namer.name,
|
|
462
|
-
category: 'namer'
|
|
463
|
-
})
|
|
464
|
-
});
|
|
465
|
-
if (name != null) {
|
|
466
|
-
internalBundle.name = name;
|
|
467
|
-
let {
|
|
468
|
-
hashReference
|
|
469
|
-
} = internalBundle;
|
|
470
|
-
internalBundle.displayName = name.includes(hashReference) ? name.replace(hashReference, '[hash]') : name;
|
|
471
|
-
return;
|
|
472
|
-
}
|
|
473
|
-
} catch (e) {
|
|
474
|
-
throw new (_diagnostic().default)({
|
|
475
|
-
diagnostic: (0, _diagnostic().errorToDiagnostic)(e, {
|
|
476
|
-
origin: namer.name
|
|
477
|
-
})
|
|
478
|
-
});
|
|
479
|
-
} finally {
|
|
480
|
-
measurement && measurement.end();
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
throw new Error('Unable to name bundle');
|
|
484
|
-
}
|
|
485
428
|
}
|