@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
|
@@ -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];
|
|
@@ -46,20 +46,10 @@ function _diagnostic() {
|
|
|
46
46
|
};
|
|
47
47
|
return data;
|
|
48
48
|
}
|
|
49
|
-
var
|
|
50
|
-
var _BundleGraph = _interopRequireDefault(require("../public/BundleGraph"));
|
|
51
|
-
var _BundleGraph2 = _interopRequireWildcard(require("../BundleGraph"));
|
|
49
|
+
var _BundleGraph = _interopRequireWildcard(require("../BundleGraph"));
|
|
52
50
|
var _MutableBundleGraph = _interopRequireDefault(require("../public/MutableBundleGraph"));
|
|
53
|
-
var _Bundle = require("../public/Bundle");
|
|
54
51
|
var _ReporterRunner = require("../ReporterRunner");
|
|
55
52
|
var _dumpGraphToGraphViz = _interopRequireDefault(require("../dumpGraphToGraphViz"));
|
|
56
|
-
function _utils() {
|
|
57
|
-
const data = require("@atlaspack/utils");
|
|
58
|
-
_utils = function () {
|
|
59
|
-
return data;
|
|
60
|
-
};
|
|
61
|
-
return data;
|
|
62
|
-
}
|
|
63
53
|
function _rust() {
|
|
64
54
|
const data = require("@atlaspack/rust");
|
|
65
55
|
_rust = function () {
|
|
@@ -70,12 +60,11 @@ function _rust() {
|
|
|
70
60
|
var _PluginOptions = _interopRequireDefault(require("../public/PluginOptions"));
|
|
71
61
|
var _applyRuntimes = _interopRequireDefault(require("../applyRuntimes"));
|
|
72
62
|
var _constants = require("../constants");
|
|
73
|
-
var
|
|
63
|
+
var _utils = require("../utils");
|
|
74
64
|
var _AtlaspackConfigRequest = _interopRequireWildcard(require("./AtlaspackConfigRequest"));
|
|
75
65
|
var _DevDepRequest = require("./DevDepRequest");
|
|
76
|
-
var _InternalConfig = require("../InternalConfig");
|
|
77
|
-
var _ConfigRequest = require("./ConfigRequest");
|
|
78
66
|
var _projectPath = require("../projectPath");
|
|
67
|
+
var _BundleGraphRequestUtils = require("./BundleGraphRequestUtils");
|
|
79
68
|
var _AssetGraphRequest = _interopRequireDefault(require("./AssetGraphRequest"));
|
|
80
69
|
var _AssetGraphRequestRust = require("./AssetGraphRequestRust");
|
|
81
70
|
function _profiler() {
|
|
@@ -88,10 +77,10 @@ function _profiler() {
|
|
|
88
77
|
var _RequestTracker = require("../RequestTracker");
|
|
89
78
|
var _assetGraphDot = require("./asset-graph-dot");
|
|
90
79
|
var _types = require("../types");
|
|
91
|
-
function
|
|
92
|
-
function
|
|
93
|
-
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 }; }
|
|
94
82
|
// TODO: Rename to BundleGraphRequestResult
|
|
83
|
+
|
|
95
84
|
function applySideEffectsForLoadableImports(assetGraph) {
|
|
96
85
|
// Avoid revisiting nodes
|
|
97
86
|
let updatedAssetIds = new Set();
|
|
@@ -138,7 +127,7 @@ function createBundleGraphRequest(input) {
|
|
|
138
127
|
signal
|
|
139
128
|
} = input.input;
|
|
140
129
|
let measurement = _profiler().tracer.createMeasurement('building');
|
|
141
|
-
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;
|
|
142
131
|
let request = createAssetGraphRequest({
|
|
143
132
|
name: 'Main',
|
|
144
133
|
entries: options.entries,
|
|
@@ -146,14 +135,17 @@ function createBundleGraphRequest(input) {
|
|
|
146
135
|
shouldBuildLazily: options.shouldBuildLazily,
|
|
147
136
|
lazyIncludes: options.lazyIncludes,
|
|
148
137
|
lazyExcludes: options.lazyExcludes,
|
|
149
|
-
requestedAssetIds
|
|
138
|
+
requestedAssetIds,
|
|
139
|
+
skipSymbolProp: (0, _featureFlags().getFeatureFlag)('rustSymbolTracker')
|
|
150
140
|
});
|
|
151
141
|
let {
|
|
152
142
|
assetGraph,
|
|
153
143
|
changedAssets,
|
|
154
144
|
assetRequests
|
|
155
|
-
} = await
|
|
156
|
-
|
|
145
|
+
} = await (0, _logger().instrumentAsync)('asset-graph-request', () => {
|
|
146
|
+
return api.runRequest(request, {
|
|
147
|
+
force: Boolean(input.rustAtlaspack) || options.shouldBuildLazily && requestedAssetIds.size > 0
|
|
148
|
+
});
|
|
157
149
|
});
|
|
158
150
|
if ((_input$options$featur = input.options.featureFlags) !== null && _input$options$featur !== void 0 && _input$options$featur.loadableSideEffects) {
|
|
159
151
|
applySideEffectsForLoadableImports(assetGraph);
|
|
@@ -178,11 +170,15 @@ function createBundleGraphRequest(input) {
|
|
|
178
170
|
// force: true,
|
|
179
171
|
// },
|
|
180
172
|
// );
|
|
181
|
-
// require('./asset-graph-diff.
|
|
173
|
+
// require('./asset-graph-diff.ts')(
|
|
174
|
+
// jsAssetGraph,
|
|
175
|
+
// assetGraph,
|
|
176
|
+
// options.projectRoot,
|
|
177
|
+
// );
|
|
182
178
|
// }
|
|
183
179
|
|
|
184
180
|
measurement && measurement.end();
|
|
185
|
-
(0,
|
|
181
|
+
(0, _utils.assertSignalNotAborted)(signal);
|
|
186
182
|
|
|
187
183
|
// If any subrequests are invalid (e.g. dev dep requests or config requests),
|
|
188
184
|
// bail on incremental bundling. We also need to invalidate for option changes,
|
|
@@ -192,7 +188,7 @@ function createBundleGraphRequest(input) {
|
|
|
192
188
|
assetGraph.safeToIncrementallyBundle = false;
|
|
193
189
|
}
|
|
194
190
|
let configResult = (0, _nullthrows().default)(await input.api.runRequest((0, _AtlaspackConfigRequest.default)()));
|
|
195
|
-
(0,
|
|
191
|
+
(0, _utils.assertSignalNotAborted)(signal);
|
|
196
192
|
let atlaspackConfig = (0, _AtlaspackConfigRequest.getCachedAtlaspackConfig)(configResult, input.options);
|
|
197
193
|
let {
|
|
198
194
|
devDeps,
|
|
@@ -211,8 +207,8 @@ function createBundleGraphRequest(input) {
|
|
|
211
207
|
res.changedAssets.set(id, asset);
|
|
212
208
|
}
|
|
213
209
|
await (0, _dumpGraphToGraphViz.default)(
|
|
214
|
-
//
|
|
215
|
-
res.bundleGraph._graph, 'BundleGraph',
|
|
210
|
+
// @ts-expect-error TS2345
|
|
211
|
+
res.bundleGraph._graph, 'BundleGraph', _BundleGraph.bundleGraphEdgeTypes);
|
|
216
212
|
return res;
|
|
217
213
|
},
|
|
218
214
|
input
|
|
@@ -231,13 +227,8 @@ class BundlerRunner {
|
|
|
231
227
|
this.previousDevDeps = previousDevDeps;
|
|
232
228
|
this.devDepRequests = new Map();
|
|
233
229
|
this.configs = new Map();
|
|
234
|
-
this.pluginOptions = new _PluginOptions.default((0,
|
|
235
|
-
|
|
236
|
-
const key = (0, _rust().hashString)(`${_constants.ATLASPACK_VERSION}:BundleGraph:${JSON.stringify(options.entries) ?? ''}${options.mode}${options.shouldBuildLazily ? 'lazy' : 'eager'}`);
|
|
237
|
-
this.cacheKey = `BundleGraph/${_constants.ATLASPACK_VERSION}/${options.mode}/${key}`;
|
|
238
|
-
} else {
|
|
239
|
-
this.cacheKey = (0, _rust().hashString)(`${_constants.ATLASPACK_VERSION}:BundleGraph:${JSON.stringify(options.entries) ?? ''}${options.mode}${options.shouldBuildLazily ? 'lazy' : 'eager'}`) + '-BundleGraph';
|
|
240
|
-
}
|
|
230
|
+
this.pluginOptions = new _PluginOptions.default((0, _utils.optionsProxy)(this.options, api.invalidateOnOptionChange));
|
|
231
|
+
this.cacheKey = (0, _rust().hashString)(`${_constants.ATLASPACK_VERSION}:BundleGraph:${JSON.stringify(options.entries) ?? ''}${options.mode}${options.shouldBuildLazily ? 'lazy' : 'eager'}`) + '-BundleGraph';
|
|
241
232
|
}
|
|
242
233
|
async loadConfigs() {
|
|
243
234
|
// Load all configs up front so we can use them in the cache key
|
|
@@ -253,26 +244,10 @@ class BundlerRunner {
|
|
|
253
244
|
}
|
|
254
245
|
}
|
|
255
246
|
async loadConfig(plugin) {
|
|
256
|
-
|
|
257
|
-
plugin: plugin.name,
|
|
258
|
-
searchPath: (0, _projectPath.toProjectPathUnsafe)('index')
|
|
259
|
-
});
|
|
260
|
-
await (0, _ConfigRequest.loadPluginConfig)(plugin, config, this.options);
|
|
261
|
-
await (0, _ConfigRequest.runConfigRequest)(this.api, config);
|
|
262
|
-
for (let devDep of config.devDeps) {
|
|
263
|
-
let devDepRequest = await (0, _DevDepRequest.createDevDependency)(devDep, this.previousDevDeps, this.options);
|
|
264
|
-
await this.runDevDepRequest(devDepRequest);
|
|
265
|
-
}
|
|
266
|
-
this.configs.set(plugin.name, config);
|
|
247
|
+
await (0, _BundleGraphRequestUtils.loadPluginConfigWithDevDeps)(plugin, this.options, this.api, this.previousDevDeps, this.devDepRequests, this.configs);
|
|
267
248
|
}
|
|
268
249
|
async runDevDepRequest(devDepRequest) {
|
|
269
|
-
|
|
270
|
-
specifier,
|
|
271
|
-
resolveFrom
|
|
272
|
-
} = devDepRequest;
|
|
273
|
-
let key = `${specifier}:${(0, _projectPath.fromProjectPathRelative)(resolveFrom)}`;
|
|
274
|
-
this.devDepRequests.set(key, devDepRequest);
|
|
275
|
-
await (0, _DevDepRequest.runDevDepRequest)(this.api, devDepRequest);
|
|
250
|
+
await (0, _BundleGraphRequestUtils.runDevDepRequest)(this.api, devDepRequest, this.devDepRequests);
|
|
276
251
|
}
|
|
277
252
|
async bundle({
|
|
278
253
|
graph,
|
|
@@ -283,6 +258,7 @@ class BundlerRunner {
|
|
|
283
258
|
type: 'buildProgress',
|
|
284
259
|
phase: 'bundling'
|
|
285
260
|
});
|
|
261
|
+
let didIncrementallyBundle = false;
|
|
286
262
|
await this.loadConfigs();
|
|
287
263
|
let plugin = await this.config.getBundler();
|
|
288
264
|
let {
|
|
@@ -292,15 +268,9 @@ class BundlerRunner {
|
|
|
292
268
|
} = plugin;
|
|
293
269
|
|
|
294
270
|
// if a previous asset graph hash is passed in, check if the bundle graph is also available
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
previousBundleGraphResult = await this.api.getPreviousResult();
|
|
299
|
-
} catch {
|
|
300
|
-
// if the bundle graph had an error or was removed, don't fail the build
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
if (previousBundleGraphResult == null) {
|
|
271
|
+
const previousBundleGraphResult = await this.api.getPreviousResult();
|
|
272
|
+
const canIncrementallyBundle = previousBundleGraphResult != null && graph.canIncrementallyBundle();
|
|
273
|
+
if (graph.safeToIncrementallyBundle && previousBundleGraphResult == null) {
|
|
304
274
|
graph.safeToIncrementallyBundle = false;
|
|
305
275
|
}
|
|
306
276
|
let internalBundleGraph;
|
|
@@ -312,7 +282,7 @@ class BundlerRunner {
|
|
|
312
282
|
category: 'bundle'
|
|
313
283
|
});
|
|
314
284
|
try {
|
|
315
|
-
if (previousBundleGraphResult) {
|
|
285
|
+
if (canIncrementallyBundle && previousBundleGraphResult) {
|
|
316
286
|
internalBundleGraph = previousBundleGraphResult.bundleGraph;
|
|
317
287
|
for (let changedAssetId of changedAssets.keys()) {
|
|
318
288
|
// Copy over the whole node to also have correct symbol data
|
|
@@ -320,14 +290,14 @@ class BundlerRunner {
|
|
|
320
290
|
(0, _assert().default)(changedAssetNode.type === 'asset');
|
|
321
291
|
internalBundleGraph.updateAsset(changedAssetNode);
|
|
322
292
|
}
|
|
293
|
+
didIncrementallyBundle = true;
|
|
323
294
|
} else {
|
|
324
|
-
|
|
325
|
-
internalBundleGraph = _BundleGraph2.default.fromAssetGraph(graph, this.options.mode === 'production');
|
|
295
|
+
internalBundleGraph = _BundleGraph.default.fromAssetGraph(graph, this.options.mode === 'production');
|
|
326
296
|
(0, _assert().default)(internalBundleGraph != null); // ensures the graph was created
|
|
327
297
|
|
|
328
298
|
await (0, _dumpGraphToGraphViz.default)(
|
|
329
|
-
//
|
|
330
|
-
internalBundleGraph._graph, 'before_bundle',
|
|
299
|
+
// @ts-expect-error TS2345
|
|
300
|
+
internalBundleGraph._graph, 'before_bundle', _BundleGraph.bundleGraphEdgeTypes);
|
|
331
301
|
let mutableBundleGraph = new _MutableBundleGraph.default(internalBundleGraph, this.options);
|
|
332
302
|
let measurement;
|
|
333
303
|
let measurementFilename;
|
|
@@ -337,14 +307,18 @@ class BundlerRunner {
|
|
|
337
307
|
}
|
|
338
308
|
|
|
339
309
|
// this the normal bundle workflow (bundle, optimizing, run-times, naming)
|
|
340
|
-
await
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
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
|
+
});
|
|
346
319
|
});
|
|
347
320
|
measurement && measurement.end();
|
|
321
|
+
(0, _BundleGraphRequestUtils.dumpBundleGraphSnapshot)(internalBundleGraph, 'js');
|
|
348
322
|
if (this.pluginOptions.mode === 'production') {
|
|
349
323
|
let optimizeMeasurement;
|
|
350
324
|
try {
|
|
@@ -367,7 +341,7 @@ class BundlerRunner {
|
|
|
367
341
|
} finally {
|
|
368
342
|
optimizeMeasurement && optimizeMeasurement.end();
|
|
369
343
|
await (0, _dumpGraphToGraphViz.default)(
|
|
370
|
-
//
|
|
344
|
+
// @ts-expect-error TS2345
|
|
371
345
|
internalBundleGraph._graph, 'after_optimize');
|
|
372
346
|
}
|
|
373
347
|
}
|
|
@@ -385,7 +359,8 @@ class BundlerRunner {
|
|
|
385
359
|
this.api.storeResult({
|
|
386
360
|
bundleGraph: internalBundleGraph,
|
|
387
361
|
changedAssets: new Map(),
|
|
388
|
-
assetRequests: []
|
|
362
|
+
assetRequests: [],
|
|
363
|
+
didIncrementallyBundle
|
|
389
364
|
}, this.cacheKey);
|
|
390
365
|
}
|
|
391
366
|
throw new (_diagnostic().default)({
|
|
@@ -396,20 +371,20 @@ class BundlerRunner {
|
|
|
396
371
|
} finally {
|
|
397
372
|
if (internalBundleGraph != null) {
|
|
398
373
|
await (0, _dumpGraphToGraphViz.default)(
|
|
399
|
-
//
|
|
400
|
-
internalBundleGraph._graph, 'after_bundle',
|
|
374
|
+
// @ts-expect-error TS2345
|
|
375
|
+
internalBundleGraph._graph, 'after_bundle', _BundleGraph.bundleGraphEdgeTypes);
|
|
401
376
|
}
|
|
402
377
|
}
|
|
403
378
|
let changedRuntimes = new Map();
|
|
404
|
-
if (!previousBundleGraphResult) {
|
|
379
|
+
if (!previousBundleGraphResult || !canIncrementallyBundle) {
|
|
405
380
|
let namers = await this.config.getNamers();
|
|
406
381
|
// inline bundles must still be named so the PackagerRunner
|
|
407
382
|
// can match them to the correct packager/optimizer plugins.
|
|
408
383
|
let bundles = internalBundleGraph.getBundles({
|
|
409
384
|
includeInline: true
|
|
410
385
|
});
|
|
411
|
-
await Promise.all(bundles.map(bundle =>
|
|
412
|
-
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)({
|
|
413
388
|
bundleGraph: internalBundleGraph,
|
|
414
389
|
api: this.api,
|
|
415
390
|
config: this.config,
|
|
@@ -419,7 +394,7 @@ class BundlerRunner {
|
|
|
419
394
|
previousDevDeps: this.previousDevDeps,
|
|
420
395
|
devDepRequests: this.devDepRequests,
|
|
421
396
|
configs: this.configs
|
|
422
|
-
});
|
|
397
|
+
}));
|
|
423
398
|
|
|
424
399
|
// Add dev deps for namers, AFTER running them to account for lazy require().
|
|
425
400
|
for (let namer of namers) {
|
|
@@ -429,69 +404,25 @@ class BundlerRunner {
|
|
|
429
404
|
}, this.previousDevDeps, this.options);
|
|
430
405
|
await this.runDevDepRequest(devDepRequest);
|
|
431
406
|
}
|
|
432
|
-
|
|
407
|
+
(0, _BundleGraphRequestUtils.validateBundles)(internalBundleGraph);
|
|
433
408
|
|
|
434
409
|
// Pre-compute the hashes for each bundle so they are only computed once and shared between workers.
|
|
435
410
|
internalBundleGraph.getBundleGraphHash();
|
|
436
411
|
}
|
|
437
412
|
await (0, _dumpGraphToGraphViz.default)(
|
|
438
|
-
//
|
|
439
|
-
internalBundleGraph._graph, 'after_runtimes',
|
|
413
|
+
// @ts-expect-error TS2345
|
|
414
|
+
internalBundleGraph._graph, 'after_runtimes', _BundleGraph.bundleGraphEdgeTypes);
|
|
440
415
|
this.api.storeResult({
|
|
441
416
|
bundleGraph: internalBundleGraph,
|
|
442
417
|
changedAssets: new Map(),
|
|
443
|
-
assetRequests: []
|
|
418
|
+
assetRequests: [],
|
|
419
|
+
didIncrementallyBundle
|
|
444
420
|
}, this.cacheKey);
|
|
445
421
|
return {
|
|
446
422
|
bundleGraph: internalBundleGraph,
|
|
447
423
|
changedAssets: changedRuntimes,
|
|
448
|
-
assetRequests
|
|
424
|
+
assetRequests,
|
|
425
|
+
didIncrementallyBundle
|
|
449
426
|
};
|
|
450
427
|
}
|
|
451
|
-
validateBundles(bundleGraph) {
|
|
452
|
-
let bundles = bundleGraph.getBundles();
|
|
453
|
-
let bundleNames = bundles.map(b => (0, _projectPath.joinProjectPath)(b.target.distDir, (0, _nullthrows().default)(b.name)));
|
|
454
|
-
_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());
|
|
455
|
-
}
|
|
456
|
-
async nameBundle(namers, internalBundle, internalBundleGraph) {
|
|
457
|
-
let bundle = _Bundle.Bundle.get(internalBundle, internalBundleGraph, this.options);
|
|
458
|
-
let bundleGraph = new _BundleGraph.default(internalBundleGraph, _Bundle.NamedBundle.get.bind(_Bundle.NamedBundle), this.options);
|
|
459
|
-
for (let namer of namers) {
|
|
460
|
-
let measurement;
|
|
461
|
-
try {
|
|
462
|
-
var _this$configs$get3;
|
|
463
|
-
measurement = _profiler().tracer.createMeasurement(namer.name, 'namer', bundle.id);
|
|
464
|
-
let name = await namer.plugin.name({
|
|
465
|
-
bundle,
|
|
466
|
-
bundleGraph,
|
|
467
|
-
config: (_this$configs$get3 = this.configs.get(namer.name)) === null || _this$configs$get3 === void 0 ? void 0 : _this$configs$get3.result,
|
|
468
|
-
options: this.pluginOptions,
|
|
469
|
-
logger: new (_logger().PluginLogger)({
|
|
470
|
-
origin: namer.name
|
|
471
|
-
}),
|
|
472
|
-
tracer: new (_profiler().PluginTracer)({
|
|
473
|
-
origin: namer.name,
|
|
474
|
-
category: 'namer'
|
|
475
|
-
})
|
|
476
|
-
});
|
|
477
|
-
if (name != null) {
|
|
478
|
-
internalBundle.name = name;
|
|
479
|
-
let {
|
|
480
|
-
hashReference
|
|
481
|
-
} = internalBundle;
|
|
482
|
-
internalBundle.displayName = name.includes(hashReference) ? name.replace(hashReference, '[hash]') : name;
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
} catch (e) {
|
|
486
|
-
throw new (_diagnostic().default)({
|
|
487
|
-
diagnostic: (0, _diagnostic().errorToDiagnostic)(e, {
|
|
488
|
-
origin: namer.name
|
|
489
|
-
})
|
|
490
|
-
});
|
|
491
|
-
} finally {
|
|
492
|
-
measurement && measurement.end();
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
throw new Error('Unable to name bundle');
|
|
496
|
-
}
|
|
497
428
|
}
|