@atlaspack/core 2.16.2-canary.27 → 2.16.2-canary.270
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 +665 -0
- package/dist/AssetGraph.js +591 -0
- package/dist/Atlaspack.js +658 -0
- package/dist/AtlaspackConfig.js +324 -0
- package/dist/AtlaspackConfig.schema.js +108 -0
- package/dist/BundleGraph.js +1635 -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 +545 -0
- package/dist/ReporterRunner.js +151 -0
- package/dist/RequestTracker.js +1360 -0
- package/dist/SymbolPropagation.js +620 -0
- package/dist/TargetDescriptor.schema.js +143 -0
- package/dist/Transformation.js +490 -0
- package/dist/UncommittedAsset.js +315 -0
- package/dist/Validation.js +196 -0
- package/dist/applyRuntimes.js +305 -0
- package/dist/assetUtils.js +168 -0
- package/dist/atlaspack-v3/AtlaspackV3.js +70 -0
- package/dist/atlaspack-v3/NapiWorkerPool.js +57 -0
- package/dist/atlaspack-v3/fs.js +52 -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 +94 -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 +25 -0
- package/dist/atlaspack-v3/worker/compat/mutable-asset.js +152 -0
- package/dist/atlaspack-v3/worker/compat/plugin-config.js +76 -0
- package/dist/atlaspack-v3/worker/compat/plugin-logger.js +26 -0
- package/dist/atlaspack-v3/worker/compat/plugin-options.js +122 -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/worker.js +297 -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 +359 -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 +429 -0
- package/dist/requests/AssetGraphRequestRust.js +262 -0
- package/dist/requests/AssetRequest.js +130 -0
- package/dist/requests/AtlaspackBuildRequest.js +65 -0
- package/dist/requests/AtlaspackConfigRequest.js +493 -0
- package/dist/requests/BundleGraphRequest.js +445 -0
- package/dist/requests/ConfigRequest.js +222 -0
- package/dist/requests/DevDepRequest.js +204 -0
- package/dist/requests/EntryRequest.js +314 -0
- package/dist/requests/PackageRequest.js +62 -0
- package/dist/requests/PathRequest.js +349 -0
- package/dist/requests/TargetRequest.js +1311 -0
- package/dist/requests/ValidationRequest.js +49 -0
- package/dist/requests/WriteBundleRequest.js +254 -0
- package/dist/requests/WriteBundlesRequest.js +184 -0
- package/dist/requests/asset-graph-diff.js +128 -0
- package/dist/requests/asset-graph-dot.js +131 -0
- package/dist/resolveOptions.js +268 -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 +111 -14
- package/lib/Atlaspack.js +81 -37
- package/lib/AtlaspackConfig.js +15 -3
- package/lib/AtlaspackConfig.schema.js +7 -5
- package/lib/BundleGraph.js +90 -32
- package/lib/CommittedAsset.js +6 -0
- package/lib/Dependency.js +8 -2
- package/lib/Environment.js +15 -8
- package/lib/EnvironmentManager.js +143 -0
- package/lib/IdentifierRegistry.js +1 -3
- package/lib/InternalConfig.js +3 -2
- package/lib/PackagerRunner.js +90 -27
- package/lib/ReporterRunner.js +6 -9
- package/lib/RequestTracker.js +266 -156
- package/lib/SymbolPropagation.js +42 -18
- package/lib/TargetDescriptor.schema.js +7 -1
- package/lib/Transformation.js +26 -10
- package/lib/UncommittedAsset.js +30 -9
- package/lib/Validation.js +18 -2
- package/lib/applyRuntimes.js +9 -1
- package/lib/assetUtils.js +7 -4
- package/lib/atlaspack-v3/AtlaspackV3.js +32 -7
- package/lib/atlaspack-v3/NapiWorkerPool.js +3 -0
- package/lib/atlaspack-v3/fs.js +3 -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 +7 -6
- package/lib/atlaspack-v3/worker/compat/dependency.js +3 -0
- package/lib/atlaspack-v3/worker/compat/environment.js +10 -7
- package/lib/atlaspack-v3/worker/compat/mutable-asset.js +14 -9
- package/lib/atlaspack-v3/worker/compat/plugin-config.js +8 -10
- package/lib/atlaspack-v3/worker/compat/plugin-options.js +1 -0
- 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/worker.js +43 -7
- package/lib/constants.js +0 -1
- package/lib/dumpGraphToGraphViz.js +71 -16
- package/lib/index.js +45 -1
- package/lib/loadDotEnv.js +4 -1
- package/lib/projectPath.js +5 -0
- package/lib/public/Asset.js +21 -11
- package/lib/public/Bundle.js +15 -16
- package/lib/public/BundleGraph.js +10 -4
- package/lib/public/BundleGroup.js +4 -5
- package/lib/public/Config.js +118 -17
- package/lib/public/Dependency.js +8 -6
- package/lib/public/Environment.js +12 -7
- package/lib/public/MutableBundleGraph.js +54 -12
- package/lib/public/PluginOptions.js +2 -2
- package/lib/public/Symbols.js +11 -11
- package/lib/public/Target.js +7 -6
- package/lib/registerCoreWithSerializer.js +5 -3
- package/lib/requests/AssetGraphRequest.js +42 -5
- package/lib/requests/AssetGraphRequestRust.js +126 -62
- package/lib/requests/AssetRequest.js +23 -6
- package/lib/requests/AtlaspackBuildRequest.js +10 -4
- package/lib/requests/AtlaspackConfigRequest.js +27 -16
- package/lib/requests/BundleGraphRequest.js +34 -19
- package/lib/requests/ConfigRequest.js +28 -4
- package/lib/requests/DevDepRequest.js +31 -5
- package/lib/requests/EntryRequest.js +2 -0
- package/lib/requests/PackageRequest.js +2 -1
- package/lib/requests/PathRequest.js +24 -3
- package/lib/requests/TargetRequest.js +122 -57
- package/lib/requests/ValidationRequest.js +5 -1
- package/lib/requests/WriteBundleRequest.js +39 -11
- package/lib/requests/WriteBundlesRequest.js +51 -4
- package/lib/requests/asset-graph-diff.js +12 -7
- package/lib/requests/asset-graph-dot.js +1 -7
- package/lib/resolveOptions.js +36 -10
- package/lib/rustWorkerThreadDylibHack.js +0 -1
- package/lib/types/AssetGraph.d.ts +80 -0
- package/lib/types/Atlaspack.d.ts +52 -0
- package/lib/types/AtlaspackConfig.d.ts +65 -0
- package/lib/types/AtlaspackConfig.schema.d.ts +46 -0
- package/lib/types/BundleGraph.d.ts +182 -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 +24 -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 +26 -0
- package/lib/types/atlaspack-v3/NapiWorkerPool.d.ts +12 -0
- package/lib/types/atlaspack-v3/fs.d.ts +12 -0
- package/lib/types/atlaspack-v3/index.d.ts +5 -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 +15 -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 -1
- package/lib/types/atlaspack-v3/worker/compat/mutable-asset.d.ts +49 -0
- package/lib/types/atlaspack-v3/worker/compat/plugin-config.d.ts +37 -0
- package/lib/types/atlaspack-v3/worker/compat/plugin-logger.d.ts +9 -0
- package/lib/types/atlaspack-v3/worker/compat/plugin-options.d.ts +22 -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/worker.d.ts +60 -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 +70 -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 +74 -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/ConfigRequest.d.ts +59 -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 +28 -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 +493 -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 +17 -2
- package/lib/worker.js +29 -13
- package/package.json +24 -34
- package/src/{AssetGraph.js → AssetGraph.ts} +156 -52
- package/src/{Atlaspack.js → Atlaspack.ts} +114 -61
- package/src/{AtlaspackConfig.schema.js → AtlaspackConfig.schema.ts} +16 -19
- package/src/{AtlaspackConfig.js → AtlaspackConfig.ts} +78 -54
- package/src/{BundleGraph.js → BundleGraph.ts} +231 -140
- package/src/{CommittedAsset.js → CommittedAsset.ts} +14 -12
- 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} +178 -86
- package/src/{ReporterRunner.js → ReporterRunner.ts} +13 -18
- package/src/{RequestTracker.js → RequestTracker.ts} +572 -357
- package/src/{SymbolPropagation.js → SymbolPropagation.ts} +165 -57
- package/src/{TargetDescriptor.schema.js → TargetDescriptor.schema.ts} +7 -1
- package/src/{Transformation.js → Transformation.ts} +71 -62
- package/src/{UncommittedAsset.js → UncommittedAsset.ts} +57 -36
- package/src/{Validation.js → Validation.ts} +32 -17
- package/src/{applyRuntimes.js → applyRuntimes.ts} +35 -26
- package/src/{assetUtils.js → assetUtils.ts} +47 -35
- package/src/atlaspack-v3/AtlaspackV3.ts +122 -0
- package/src/atlaspack-v3/{NapiWorkerPool.js → NapiWorkerPool.ts} +10 -5
- package/src/atlaspack-v3/{fs.js → fs.ts} +3 -4
- package/src/atlaspack-v3/{index.js → index.ts} +2 -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.js → bitflags.ts} +9 -10
- package/src/atlaspack-v3/worker/compat/{dependency.js → dependency.ts} +12 -12
- package/src/atlaspack-v3/worker/compat/{environment.js → environment.ts} +13 -9
- package/src/atlaspack-v3/worker/compat/index.ts +9 -0
- package/src/atlaspack-v3/worker/compat/{mutable-asset.js → mutable-asset.ts} +20 -19
- package/src/atlaspack-v3/worker/compat/{plugin-config.js → plugin-config.ts} +27 -26
- package/src/atlaspack-v3/worker/compat/{plugin-logger.js → plugin-logger.ts} +0 -2
- package/src/atlaspack-v3/worker/compat/{plugin-options.js → plugin-options.ts} +4 -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/{worker.js → worker.ts} +102 -66
- 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} +40 -27
- package/src/public/{Bundle.js → Bundle.ts} +28 -29
- package/src/public/{BundleGraph.js → BundleGraph.ts} +81 -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} +84 -49
- package/src/requests/AssetGraphRequestRust.ts +352 -0
- package/src/requests/{AssetRequest.js → AssetRequest.ts} +24 -18
- package/src/requests/{AtlaspackBuildRequest.js → AtlaspackBuildRequest.ts} +46 -32
- package/src/requests/{AtlaspackConfigRequest.js → AtlaspackConfigRequest.ts} +72 -58
- package/src/requests/{BundleGraphRequest.js → BundleGraphRequest.ts} +71 -58
- package/src/requests/{ConfigRequest.js → ConfigRequest.ts} +71 -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} +20 -22
- package/src/requests/{PathRequest.js → PathRequest.ts} +47 -37
- package/src/requests/{TargetRequest.js → TargetRequest.ts} +260 -179
- package/src/requests/{ValidationRequest.js → ValidationRequest.ts} +18 -17
- package/src/requests/{WriteBundleRequest.js → WriteBundleRequest.ts} +77 -49
- package/src/requests/{WriteBundlesRequest.js → WriteBundlesRequest.ts} +109 -37
- 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} +56 -24
- 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 +647 -0
- package/src/{utils.js → utils.ts} +52 -21
- package/src/{worker.js → worker.ts} +49 -41
- package/test/{AssetGraph.test.js → AssetGraph.test.ts} +37 -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} +75 -15
- 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} +314 -59
- package/test/{SymbolPropagation.test.js → SymbolPropagation.test.ts} +124 -74
- package/test/{TargetRequest.test.js → TargetRequest.test.ts} +66 -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.js → AssetGraphRequestRust.test.ts} +164 -134
- package/test/requests/{ConfigRequest.test.js → ConfigRequest.test.ts} +202 -13
- package/test/requests/{DevDepRequest.test.js → DevDepRequest.test.ts} +0 -2
- package/test/{test-utils.js → test-utils.ts} +4 -11
- package/test/{utils.test.js → utils.test.ts} +1 -3
- package/tsconfig.json +57 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/index.d.ts +0 -30
- package/src/atlaspack-v3/AtlaspackV3.js +0 -87
- package/src/atlaspack-v3/jsCallable.js +0 -18
- package/src/index.js +0 -13
- package/src/requests/AssetGraphRequestRust.js +0 -263
- 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/dist/utils.js
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BuildAbortError = void 0;
|
|
7
|
+
exports.getBundleGroupId = getBundleGroupId;
|
|
8
|
+
exports.assertSignalNotAborted = assertSignalNotAborted;
|
|
9
|
+
exports.getPublicId = getPublicId;
|
|
10
|
+
exports.optionsProxy = optionsProxy;
|
|
11
|
+
exports.hashFromOption = hashFromOption;
|
|
12
|
+
exports.invalidateOnFileCreateToInternal = invalidateOnFileCreateToInternal;
|
|
13
|
+
exports.createInvalidations = createInvalidations;
|
|
14
|
+
exports.fromInternalSourceLocation = fromInternalSourceLocation;
|
|
15
|
+
exports.toInternalSourceLocation = toInternalSourceLocation;
|
|
16
|
+
exports.toInternalSymbols = toInternalSymbols;
|
|
17
|
+
const assert_1 = __importDefault(require("assert"));
|
|
18
|
+
const base_x_1 = __importDefault(require("base-x"));
|
|
19
|
+
const utils_1 = require("@atlaspack/utils");
|
|
20
|
+
const projectPath_1 = require("./projectPath");
|
|
21
|
+
// /flow-to-ts helpers
|
|
22
|
+
const base62 = (0, base_x_1.default)('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
|
|
23
|
+
function getBundleGroupId(bundleGroup) {
|
|
24
|
+
return 'bundle_group:' + bundleGroup.target.name + bundleGroup.entryAssetId;
|
|
25
|
+
}
|
|
26
|
+
function assertSignalNotAborted(signal) {
|
|
27
|
+
if (signal && signal.aborted) {
|
|
28
|
+
throw new BuildAbortError();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
class BuildAbortError extends Error {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.name = 'BuildAbortError';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.BuildAbortError = BuildAbortError;
|
|
38
|
+
function getPublicId(id, alreadyExists) {
|
|
39
|
+
let encoded = base62.encode(Buffer.from(id, 'hex'));
|
|
40
|
+
for (let end = 5; end <= encoded.length; end++) {
|
|
41
|
+
let candidate = encoded.slice(0, end);
|
|
42
|
+
if (!alreadyExists(candidate)) {
|
|
43
|
+
return candidate;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
throw new Error('Original id was not unique');
|
|
47
|
+
}
|
|
48
|
+
// These options don't affect compilation and should cause invalidations
|
|
49
|
+
const ignoreOptions = new Set([
|
|
50
|
+
'env', // handled by separate invalidateOnEnvChange
|
|
51
|
+
'inputFS',
|
|
52
|
+
'outputFS',
|
|
53
|
+
'workerFarm',
|
|
54
|
+
'packageManager',
|
|
55
|
+
'detailedReport',
|
|
56
|
+
'shouldDisableCache',
|
|
57
|
+
'cacheDir',
|
|
58
|
+
'shouldAutoInstall',
|
|
59
|
+
'logLevel',
|
|
60
|
+
'shouldProfile',
|
|
61
|
+
'shouldTrace',
|
|
62
|
+
'shouldPatchConsole',
|
|
63
|
+
'projectRoot',
|
|
64
|
+
'additionalReporters',
|
|
65
|
+
]);
|
|
66
|
+
function optionsProxy(options, invalidateOnOptionChange, addDevDependency) {
|
|
67
|
+
let packageManager = addDevDependency
|
|
68
|
+
? proxyPackageManager(options.projectRoot, options.packageManager, addDevDependency)
|
|
69
|
+
: options.packageManager;
|
|
70
|
+
return new Proxy(options, {
|
|
71
|
+
get(target, prop) {
|
|
72
|
+
if (prop === 'packageManager') {
|
|
73
|
+
return packageManager;
|
|
74
|
+
}
|
|
75
|
+
if (!ignoreOptions.has(prop)) {
|
|
76
|
+
invalidateOnOptionChange(prop);
|
|
77
|
+
}
|
|
78
|
+
// @ts-expect-error TS7053
|
|
79
|
+
return target[prop];
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function proxyPackageManager(projectRoot, packageManager, addDevDependency) {
|
|
84
|
+
let require = (id, from, opts) => {
|
|
85
|
+
addDevDependency({
|
|
86
|
+
specifier: id,
|
|
87
|
+
resolveFrom: (0, projectPath_1.toProjectPath)(projectRoot, from),
|
|
88
|
+
range: opts?.range,
|
|
89
|
+
});
|
|
90
|
+
return packageManager.require(id, from, opts);
|
|
91
|
+
};
|
|
92
|
+
return new Proxy(packageManager, {
|
|
93
|
+
get(target, prop) {
|
|
94
|
+
if (prop === 'require') {
|
|
95
|
+
return require;
|
|
96
|
+
}
|
|
97
|
+
// @ts-expect-error TS7053
|
|
98
|
+
return target[prop];
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function hashFromOption(value) {
|
|
103
|
+
if (typeof value === 'object' && value != null) {
|
|
104
|
+
// @ts-expect-error TS2345
|
|
105
|
+
return (0, utils_1.hashObject)(value);
|
|
106
|
+
}
|
|
107
|
+
return String(value);
|
|
108
|
+
}
|
|
109
|
+
function invalidateOnFileCreateToInternal(projectRoot, invalidation) {
|
|
110
|
+
// @ts-expect-error TS2339
|
|
111
|
+
if (invalidation.glob != null) {
|
|
112
|
+
// @ts-expect-error TS2339
|
|
113
|
+
return { glob: (0, projectPath_1.toProjectPath)(projectRoot, invalidation.glob) };
|
|
114
|
+
// @ts-expect-error TS2339
|
|
115
|
+
}
|
|
116
|
+
else if (invalidation.filePath != null) {
|
|
117
|
+
return {
|
|
118
|
+
// @ts-expect-error TS2339
|
|
119
|
+
filePath: (0, projectPath_1.toProjectPath)(projectRoot, invalidation.filePath),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
(0, assert_1.default)(
|
|
124
|
+
// @ts-expect-error TS2339
|
|
125
|
+
invalidation.aboveFilePath != null && invalidation.fileName != null);
|
|
126
|
+
return {
|
|
127
|
+
// @ts-expect-error TS2339
|
|
128
|
+
fileName: invalidation.fileName,
|
|
129
|
+
// @ts-expect-error TS2339
|
|
130
|
+
aboveFilePath: (0, projectPath_1.toProjectPath)(projectRoot, invalidation.aboveFilePath),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function createInvalidations() {
|
|
135
|
+
return {
|
|
136
|
+
invalidateOnBuild: false,
|
|
137
|
+
invalidateOnStartup: false,
|
|
138
|
+
invalidateOnOptionChange: new Set(),
|
|
139
|
+
invalidateOnEnvChange: new Set(),
|
|
140
|
+
invalidateOnFileChange: new Set(),
|
|
141
|
+
invalidateOnFileCreate: [],
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function fromInternalSourceLocation(projectRoot, loc) {
|
|
145
|
+
if (!loc)
|
|
146
|
+
return loc;
|
|
147
|
+
return {
|
|
148
|
+
filePath: (0, projectPath_1.fromProjectPath)(projectRoot, loc.filePath),
|
|
149
|
+
start: loc.start,
|
|
150
|
+
end: loc.end,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function toInternalSourceLocation(projectRoot, loc) {
|
|
154
|
+
if (!loc)
|
|
155
|
+
return loc;
|
|
156
|
+
return {
|
|
157
|
+
filePath: (0, projectPath_1.toProjectPath)(projectRoot, loc.filePath),
|
|
158
|
+
start: loc.start,
|
|
159
|
+
end: loc.end,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function toInternalSymbols(projectRoot, symbols) {
|
|
163
|
+
if (!symbols)
|
|
164
|
+
return symbols;
|
|
165
|
+
return new Map([...symbols].map(([k, { loc, ...v }]) => [
|
|
166
|
+
k,
|
|
167
|
+
{
|
|
168
|
+
...v,
|
|
169
|
+
loc: toInternalSourceLocation(projectRoot, loc),
|
|
170
|
+
},
|
|
171
|
+
]));
|
|
172
|
+
}
|
package/dist/worker.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.clearWorkerBuildCaches = clearWorkerBuildCaches;
|
|
7
|
+
exports.runTransform = runTransform;
|
|
8
|
+
exports.runValidate = runValidate;
|
|
9
|
+
exports.runPackage = runPackage;
|
|
10
|
+
exports.childInit = childInit;
|
|
11
|
+
exports.invalidateRequireCache = invalidateRequireCache;
|
|
12
|
+
exports.ping = ping;
|
|
13
|
+
const utils_1 = require("@atlaspack/utils");
|
|
14
|
+
const assert_1 = __importDefault(require("assert"));
|
|
15
|
+
const nullthrows_1 = __importDefault(require("nullthrows"));
|
|
16
|
+
const BundleGraph_1 = __importDefault(require("./BundleGraph"));
|
|
17
|
+
const Transformation_1 = __importDefault(require("./Transformation"));
|
|
18
|
+
const ReporterRunner_1 = require("./ReporterRunner");
|
|
19
|
+
const PackagerRunner_1 = __importDefault(require("./PackagerRunner"));
|
|
20
|
+
const Validation_1 = __importDefault(require("./Validation"));
|
|
21
|
+
const AtlaspackConfig_1 = require("./AtlaspackConfig");
|
|
22
|
+
const registerCoreWithSerializer_1 = require("./registerCoreWithSerializer");
|
|
23
|
+
const build_cache_1 = require("@atlaspack/build-cache");
|
|
24
|
+
const source_map_1 = require("@parcel/source-map");
|
|
25
|
+
// @ts-expect-error TS2305
|
|
26
|
+
const rust_1 = require("@atlaspack/rust");
|
|
27
|
+
const workers_1 = __importDefault(require("@atlaspack/workers"));
|
|
28
|
+
const feature_flags_1 = require("@atlaspack/feature-flags");
|
|
29
|
+
require("@atlaspack/cache"); // register with serializer
|
|
30
|
+
require("@atlaspack/package-manager");
|
|
31
|
+
require("@atlaspack/fs");
|
|
32
|
+
// /flow-to-ts helpers
|
|
33
|
+
(0, registerCoreWithSerializer_1.registerCoreWithSerializer)();
|
|
34
|
+
// TODO: this should eventually be replaced by an in memory cache layer
|
|
35
|
+
let atlaspackConfigCache = new Map();
|
|
36
|
+
function loadOptions(ref, workerApi) {
|
|
37
|
+
return (0, nullthrows_1.default)(workerApi.getSharedReference(ref));
|
|
38
|
+
}
|
|
39
|
+
async function loadConfig(cachePath, options) {
|
|
40
|
+
let config = atlaspackConfigCache.get(cachePath);
|
|
41
|
+
if (config && config.options === options) {
|
|
42
|
+
return config;
|
|
43
|
+
}
|
|
44
|
+
let processedConfig = (0, nullthrows_1.default)(await options.cache.get(cachePath));
|
|
45
|
+
config = new AtlaspackConfig_1.AtlaspackConfig(processedConfig, options);
|
|
46
|
+
atlaspackConfigCache.set(cachePath, config);
|
|
47
|
+
(0, feature_flags_1.setFeatureFlags)(options.featureFlags);
|
|
48
|
+
return config;
|
|
49
|
+
}
|
|
50
|
+
function clearWorkerBuildCaches() {
|
|
51
|
+
utils_1.loadConfig.clear();
|
|
52
|
+
(0, build_cache_1.clearBuildCaches)();
|
|
53
|
+
}
|
|
54
|
+
async function runTransform(workerApi, opts) {
|
|
55
|
+
let { optionsRef, configCachePath, ...rest } = opts;
|
|
56
|
+
let options = loadOptions(optionsRef, workerApi);
|
|
57
|
+
let config = await loadConfig(configCachePath, options);
|
|
58
|
+
return new Transformation_1.default({
|
|
59
|
+
workerApi,
|
|
60
|
+
options,
|
|
61
|
+
// @ts-expect-error TS2783
|
|
62
|
+
config,
|
|
63
|
+
...rest,
|
|
64
|
+
}).run();
|
|
65
|
+
}
|
|
66
|
+
async function runValidate(workerApi, opts) {
|
|
67
|
+
let { optionsRef, configCachePath, ...rest } = opts;
|
|
68
|
+
let options = loadOptions(optionsRef, workerApi);
|
|
69
|
+
let config = await loadConfig(configCachePath, options);
|
|
70
|
+
return new Validation_1.default({
|
|
71
|
+
workerApi,
|
|
72
|
+
// @ts-expect-error TS2783
|
|
73
|
+
report: ReporterRunner_1.reportWorker.bind(null, workerApi),
|
|
74
|
+
options,
|
|
75
|
+
// @ts-expect-error TS2783
|
|
76
|
+
config,
|
|
77
|
+
...rest,
|
|
78
|
+
}).run();
|
|
79
|
+
}
|
|
80
|
+
async function runPackage(workerApi, { bundle, bundleGraphReference, configCachePath, optionsRef, previousDevDeps, invalidDevDeps, previousInvalidations, }) {
|
|
81
|
+
let bundleGraph = workerApi.getSharedReference(bundleGraphReference);
|
|
82
|
+
(0, assert_1.default)(bundleGraph instanceof BundleGraph_1.default);
|
|
83
|
+
let options = loadOptions(optionsRef, workerApi);
|
|
84
|
+
let atlaspackConfig = await loadConfig(configCachePath, options);
|
|
85
|
+
let runner = new PackagerRunner_1.default({
|
|
86
|
+
config: atlaspackConfig,
|
|
87
|
+
options,
|
|
88
|
+
// @ts-expect-error TS2322
|
|
89
|
+
report: workers_1.default.isWorker() ? ReporterRunner_1.reportWorker.bind(null, workerApi) : ReporterRunner_1.report,
|
|
90
|
+
previousDevDeps,
|
|
91
|
+
previousInvalidations,
|
|
92
|
+
});
|
|
93
|
+
return runner.run(bundleGraph, bundle, invalidDevDeps);
|
|
94
|
+
}
|
|
95
|
+
async function childInit() {
|
|
96
|
+
await source_map_1.init;
|
|
97
|
+
await (0, rust_1.init)?.();
|
|
98
|
+
}
|
|
99
|
+
const PKG_RE = /node_modules[/\\]((?:@[^/\\]+[/\\][^/\\]+)|[^/\\]+)(?!.*[/\\]node_modules[/\\])/;
|
|
100
|
+
function invalidateRequireCache(workerApi, file) {
|
|
101
|
+
if (process.env.ATLASPACK_BUILD_ENV === 'test') {
|
|
102
|
+
// Delete this module and all children in the same node_modules folder
|
|
103
|
+
let module = require.cache[file];
|
|
104
|
+
if (module) {
|
|
105
|
+
delete require.cache[file];
|
|
106
|
+
let pkg = file.match(PKG_RE)?.[1];
|
|
107
|
+
for (let child of module.children) {
|
|
108
|
+
if (pkg === child.id.match(PKG_RE)?.[1]) {
|
|
109
|
+
invalidateRequireCache(workerApi, child.id);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
atlaspackConfigCache.clear();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
throw new Error('invalidateRequireCache is only for tests');
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* This is used to wait until workers are responding to messages.
|
|
120
|
+
*/
|
|
121
|
+
function ping() {
|
|
122
|
+
return true;
|
|
123
|
+
}
|
package/lib/AssetGraph.js
CHANGED
|
@@ -46,6 +46,14 @@ function _graph() {
|
|
|
46
46
|
}
|
|
47
47
|
var _Dependency = require("./Dependency");
|
|
48
48
|
var _projectPath = require("./projectPath");
|
|
49
|
+
var _EnvironmentManager = require("./EnvironmentManager");
|
|
50
|
+
function _featureFlags() {
|
|
51
|
+
const data = require("@atlaspack/feature-flags");
|
|
52
|
+
_featureFlags = function () {
|
|
53
|
+
return data;
|
|
54
|
+
};
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
49
57
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
50
58
|
function nodeFromDep(dep) {
|
|
51
59
|
return {
|
|
@@ -63,7 +71,11 @@ function nodeFromDep(dep) {
|
|
|
63
71
|
}
|
|
64
72
|
function nodeFromAssetGroup(assetGroup) {
|
|
65
73
|
return {
|
|
66
|
-
id: (0, _rust().hashString)(
|
|
74
|
+
id: (0, _rust().hashString)(
|
|
75
|
+
// @ts-expect-error TS2345
|
|
76
|
+
(0, _projectPath.fromProjectPathRelative)(assetGroup.filePath) +
|
|
77
|
+
// @ts-expect-error TS2345
|
|
78
|
+
(0, _EnvironmentManager.toEnvironmentId)(assetGroup.env) + String(assetGroup.isSource) + String(assetGroup.sideEffects) + (assetGroup.code ?? '') + ':' + (assetGroup.pipeline ?? '') + ':' + (assetGroup.query ?? '')),
|
|
67
79
|
type: 'asset_group',
|
|
68
80
|
value: assetGroup,
|
|
69
81
|
usedSymbolsDownDirty: true
|
|
@@ -93,16 +105,35 @@ function nodeFromEntryFile(entry) {
|
|
|
93
105
|
value: entry
|
|
94
106
|
};
|
|
95
107
|
}
|
|
108
|
+
|
|
109
|
+
// @ts-expect-error TS2417
|
|
96
110
|
class AssetGraph extends _graph().ContentGraph {
|
|
111
|
+
/**
|
|
112
|
+
* Incremented when the asset graph is modified such that it requires a bundling pass.
|
|
113
|
+
*/
|
|
114
|
+
#bundlingVersion = 0;
|
|
115
|
+
/**
|
|
116
|
+
* Force incremental bundling to be disabled.
|
|
117
|
+
*/
|
|
118
|
+
#disableIncrementalBundling = false;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @deprecated
|
|
122
|
+
*/
|
|
97
123
|
safeToIncrementallyBundle = true;
|
|
98
124
|
constructor(opts) {
|
|
99
125
|
if (opts) {
|
|
100
126
|
let {
|
|
101
127
|
hash,
|
|
128
|
+
bundlingVersion,
|
|
129
|
+
disableIncrementalBundling,
|
|
102
130
|
...rest
|
|
103
131
|
} = opts;
|
|
132
|
+
// @ts-expect-error TS2345
|
|
104
133
|
super(rest);
|
|
105
134
|
this.hash = hash;
|
|
135
|
+
this.#bundlingVersion = bundlingVersion ?? 0;
|
|
136
|
+
this.#disableIncrementalBundling = disableIncrementalBundling ?? false;
|
|
106
137
|
} else {
|
|
107
138
|
super();
|
|
108
139
|
this.setRootNodeId(this.addNode({
|
|
@@ -114,32 +145,83 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
114
145
|
this.undeferredDependencies = new Set();
|
|
115
146
|
this.envCache = new Map();
|
|
116
147
|
}
|
|
117
|
-
|
|
118
|
-
// $FlowFixMe[prop-missing]
|
|
119
148
|
static deserialize(opts) {
|
|
120
149
|
return new AssetGraph(opts);
|
|
121
150
|
}
|
|
122
|
-
|
|
123
|
-
// $FlowFixMe[prop-missing]
|
|
124
151
|
serialize() {
|
|
125
152
|
return {
|
|
126
153
|
...super.serialize(),
|
|
154
|
+
bundlingVersion: this.#bundlingVersion,
|
|
155
|
+
disableIncrementalBundling: this.#disableIncrementalBundling,
|
|
127
156
|
hash: this.hash
|
|
128
157
|
};
|
|
129
158
|
}
|
|
130
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Force incremental bundling to be disabled.
|
|
162
|
+
*/
|
|
163
|
+
setDisableIncrementalBundling(disable) {
|
|
164
|
+
this.#disableIncrementalBundling = disable;
|
|
165
|
+
}
|
|
166
|
+
testing_getDisableIncrementalBundling() {
|
|
167
|
+
return this.#disableIncrementalBundling;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Make sure this asset graph is marked as needing a full bundling pass.
|
|
172
|
+
*/
|
|
173
|
+
setNeedsBundling() {
|
|
174
|
+
if (!(0, _featureFlags().getFeatureFlag)('incrementalBundlingVersioning')) {
|
|
175
|
+
// In legacy mode, we rely solely on safeToIncrementallyBundle to
|
|
176
|
+
// invalidate incremental bundling, so we skip bumping the version.
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
this.#bundlingVersion += 1;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Get the current bundling version.
|
|
184
|
+
*
|
|
185
|
+
* Each bundle pass should keep this version around. Whenever an asset graph has a new version,
|
|
186
|
+
* bundling should be re-run.
|
|
187
|
+
*/
|
|
188
|
+
getBundlingVersion() {
|
|
189
|
+
if (!(0, _featureFlags().getFeatureFlag)('incrementalBundlingVersioning')) {
|
|
190
|
+
return 0;
|
|
191
|
+
}
|
|
192
|
+
return this.#bundlingVersion;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* If the `bundlingVersion` has not changed since the last bundling pass,
|
|
197
|
+
* we can incrementally bundle, which will not require a full bundling pass
|
|
198
|
+
* but just update assets into the bundle graph output.
|
|
199
|
+
*/
|
|
200
|
+
canIncrementallyBundle(lastVersion) {
|
|
201
|
+
if (!(0, _featureFlags().getFeatureFlag)('incrementalBundlingVersioning')) {
|
|
202
|
+
return this.safeToIncrementallyBundle && !this.#disableIncrementalBundling;
|
|
203
|
+
}
|
|
204
|
+
return this.safeToIncrementallyBundle && this.#bundlingVersion === lastVersion && !this.#disableIncrementalBundling;
|
|
205
|
+
}
|
|
206
|
+
|
|
131
207
|
// Deduplicates Environments by making them referentially equal
|
|
132
208
|
normalizeEnvironment(input) {
|
|
209
|
+
if ((0, _featureFlags().getFeatureFlag)('environmentDeduplication')) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// @ts-expect-error TS2345
|
|
133
214
|
let {
|
|
134
215
|
id,
|
|
135
216
|
context
|
|
136
|
-
} = input.env;
|
|
217
|
+
} = (0, _EnvironmentManager.fromEnvironmentId)(input.env);
|
|
137
218
|
let idAndContext = `${id}-${context}`;
|
|
138
219
|
let env = this.envCache.get(idAndContext);
|
|
139
220
|
if (env) {
|
|
140
|
-
input.env = env;
|
|
221
|
+
input.env = (0, _EnvironmentManager.toEnvironmentRef)(env);
|
|
141
222
|
} else {
|
|
142
|
-
|
|
223
|
+
// @ts-expect-error TS2345
|
|
224
|
+
this.envCache.set(idAndContext, (0, _EnvironmentManager.fromEnvironmentId)(input.env));
|
|
143
225
|
}
|
|
144
226
|
}
|
|
145
227
|
setRootConnections({
|
|
@@ -166,8 +248,6 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
166
248
|
let existing = this.getNodeByContentKey(node.id);
|
|
167
249
|
if (existing != null) {
|
|
168
250
|
(0, _assert().default)(existing.type === node.type);
|
|
169
|
-
// $FlowFixMe[incompatible-type] Checked above
|
|
170
|
-
// $FlowFixMe[prop-missing]
|
|
171
251
|
existing.value = node.value;
|
|
172
252
|
let existingId = this.getNodeIdByContentKey(node.id);
|
|
173
253
|
this.updateNode(existingId, existing);
|
|
@@ -199,13 +279,14 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
199
279
|
env: target.env,
|
|
200
280
|
isEntry: true,
|
|
201
281
|
needsStableName: true,
|
|
202
|
-
|
|
282
|
+
// @ts-expect-error TS2322
|
|
283
|
+
symbols: (0, _EnvironmentManager.fromEnvironmentId)(target.env).isLibrary ? new Map([['*', {
|
|
203
284
|
local: '*',
|
|
204
285
|
isWeak: true,
|
|
205
286
|
loc: null
|
|
206
287
|
}]]) : undefined
|
|
207
288
|
}));
|
|
208
|
-
if (node.value.env.isLibrary) {
|
|
289
|
+
if ((0, _EnvironmentManager.fromEnvironmentId)(node.value.env).isLibrary) {
|
|
209
290
|
// in library mode, all of the entry's symbols are "used"
|
|
210
291
|
node.usedSymbolsDown.add('*');
|
|
211
292
|
node.usedSymbolsUp.set('*', undefined);
|
|
@@ -285,7 +366,10 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
285
366
|
if (traversedNode.type === 'asset') {
|
|
286
367
|
let hasDeferred = this.getNodeIdsConnectedFrom(traversedNodeId).some(childNodeId => {
|
|
287
368
|
let childNode = (0, _nullthrows().default)(this.getNode(childNodeId));
|
|
288
|
-
|
|
369
|
+
// @ts-expect-error TS2339
|
|
370
|
+
return childNode.hasDeferred == null ? false :
|
|
371
|
+
// @ts-expect-error TS2339
|
|
372
|
+
childNode.hasDeferred;
|
|
289
373
|
});
|
|
290
374
|
if (!hasDeferred) {
|
|
291
375
|
delete traversedNode.hasDeferred;
|
|
@@ -294,13 +378,16 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
294
378
|
hasDeferred
|
|
295
379
|
};
|
|
296
380
|
} else if (traversedNode.type === 'asset_group' && nodeId !== traversedNodeId) {
|
|
381
|
+
// @ts-expect-error TS2339
|
|
297
382
|
if (!(ctx !== null && ctx !== void 0 && ctx.hasDeferred)) {
|
|
298
383
|
this.safeToIncrementallyBundle = false;
|
|
384
|
+
this.setNeedsBundling();
|
|
299
385
|
delete traversedNode.hasDeferred;
|
|
300
386
|
}
|
|
301
387
|
actions.skipChildren();
|
|
302
388
|
} else if (traversedNode.type === 'dependency') {
|
|
303
389
|
this.safeToIncrementallyBundle = false;
|
|
390
|
+
this.setNeedsBundling();
|
|
304
391
|
traversedNode.hasDeferred = false;
|
|
305
392
|
} else if (nodeId !== traversedNodeId) {
|
|
306
393
|
actions.skipChildren();
|
|
@@ -348,7 +435,7 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
348
435
|
if (this.undeferredDependencies.has(d)) {
|
|
349
436
|
return false;
|
|
350
437
|
}
|
|
351
|
-
let depIsDeferrable = d.symbols && !(d.env.isLibrary && d.isEntry) && !d.symbols.has('*') && ![...d.symbols.keys()].some(symbol => {
|
|
438
|
+
let depIsDeferrable = d.symbols && !((0, _EnvironmentManager.fromEnvironmentId)(d.env).isLibrary && d.isEntry) && !d.symbols.has('*') && ![...d.symbols.keys()].some(symbol => {
|
|
352
439
|
var _resolvedAsset$symbol;
|
|
353
440
|
let assetSymbol = (_resolvedAsset$symbol = resolvedAsset.symbols) === null || _resolvedAsset$symbol === void 0 || (_resolvedAsset$symbol = _resolvedAsset$symbol.get(symbol)) === null || _resolvedAsset$symbol === void 0 ? void 0 : _resolvedAsset$symbol.local;
|
|
354
441
|
return assetSymbol != null && symbols.has(assetSymbol);
|
|
@@ -363,6 +450,7 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
363
450
|
resolveAssetGroup(assetGroup, assets, correspondingRequest) {
|
|
364
451
|
this.normalizeEnvironment(assetGroup);
|
|
365
452
|
let assetGroupNode = nodeFromAssetGroup(assetGroup);
|
|
453
|
+
// @ts-expect-error TS2322
|
|
366
454
|
assetGroupNode = this.getNodeByContentKey(assetGroupNode.id);
|
|
367
455
|
if (!assetGroupNode) {
|
|
368
456
|
return;
|
|
@@ -432,6 +520,15 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
432
520
|
...depNode.value.meta,
|
|
433
521
|
...existing.value.resolverMeta
|
|
434
522
|
};
|
|
523
|
+
if ((0, _featureFlags().getFeatureFlag)('hmrImprovements')) {
|
|
524
|
+
depNode.value.resolverMeta = existing.value.resolverMeta;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
if ((0, _featureFlags().getFeatureFlag)('hmrImprovements')) {
|
|
528
|
+
if ((existing === null || existing === void 0 ? void 0 : existing.type) === 'dependency' && existing.value.resolverPriority != null) {
|
|
529
|
+
depNode.value.priority = existing.value.resolverPriority;
|
|
530
|
+
depNode.value.resolverPriority = existing.value.resolverPriority;
|
|
531
|
+
}
|
|
435
532
|
}
|
|
436
533
|
let dependentAsset = dependentAssets.find(a => a.uniqueKey === dep.specifier);
|
|
437
534
|
if (dependentAsset) {
|