@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/lib/SymbolPropagation.js
CHANGED
|
@@ -72,6 +72,11 @@ function propagateSymbols({
|
|
|
72
72
|
|
|
73
73
|
// Propagate the requested symbols down from the root to the leaves
|
|
74
74
|
propagateSymbolsDown(assetGraph, changedAssets, assetGroupsWithRemovedParents, (assetNode, incomingDeps, outgoingDeps) => {
|
|
75
|
+
if (assetNode.value.meta.emptyFileStarReexport && incomingDeps.every(d => d.value.specifierType === _types.SpecifierType.esm)) {
|
|
76
|
+
var _assetNode$value$symb;
|
|
77
|
+
(_assetNode$value$symb = assetNode.value.symbols) === null || _assetNode$value$symb === void 0 || _assetNode$value$symb.delete('*');
|
|
78
|
+
}
|
|
79
|
+
|
|
75
80
|
// exportSymbol -> identifier
|
|
76
81
|
let assetSymbols = assetNode.value.symbols;
|
|
77
82
|
// identifier -> exportSymbol
|
|
@@ -151,6 +156,7 @@ function propagateSymbols({
|
|
|
151
156
|
for (let dep of outgoingDeps) {
|
|
152
157
|
let depUsedSymbolsDownOld = dep.usedSymbolsDown;
|
|
153
158
|
let depUsedSymbolsDown = new Set();
|
|
159
|
+
// @ts-expect-error TS2322
|
|
154
160
|
dep.usedSymbolsDown = depUsedSymbolsDown;
|
|
155
161
|
if (assetNode.value.sideEffects ||
|
|
156
162
|
// Incoming dependency with cleared symbols
|
|
@@ -359,7 +365,9 @@ function propagateSymbols({
|
|
|
359
365
|
let resolution = (0, _nullthrows().default)(assetGraph.getNode(resolutionNodeId));
|
|
360
366
|
(0, _assert().default)(resolution && (resolution.type === 'asset_group' || resolution.type === 'asset'));
|
|
361
367
|
errors.push({
|
|
362
|
-
message: (0, _diagnostic().md)`${(0, _projectPath.fromProjectPathRelative)(
|
|
368
|
+
message: (0, _diagnostic().md)`${(0, _projectPath.fromProjectPathRelative)(
|
|
369
|
+
// @ts-expect-error TS2345
|
|
370
|
+
resolution.value.filePath)} does not export '${s}'`,
|
|
363
371
|
origin: '@atlaspack/core',
|
|
364
372
|
codeFrames: loc ? [{
|
|
365
373
|
filePath: (0, _projectPath.fromProjectPath)(options.projectRoot, loc === null || loc === void 0 ? void 0 : loc.filePath) ?? undefined,
|
|
@@ -375,15 +383,15 @@ function propagateSymbols({
|
|
|
375
383
|
}
|
|
376
384
|
incomingDep.excluded = false;
|
|
377
385
|
if (incomingDep.value.symbols != null && incomingDep.usedSymbolsUp.size === 0) {
|
|
378
|
-
let
|
|
379
|
-
|
|
380
|
-
let
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
386
|
+
let connectedNodeIds = assetGraph.getNodeIdsConnectedFrom(assetGraph.getNodeIdByContentKey(incomingDep.id));
|
|
387
|
+
let sideEffectFree = connectedNodeIds.every(nodeId => {
|
|
388
|
+
let connectedNode = (0, _nullthrows().default)(assetGraph.getNode(nodeId));
|
|
389
|
+
// Dependencies should only connect to asset_groups or assets
|
|
390
|
+
(0, _assert().default)(connectedNode.type === 'asset' || connectedNode.type === 'asset_group');
|
|
391
|
+
return connectedNode.value.sideEffects === false;
|
|
392
|
+
});
|
|
393
|
+
if (sideEffectFree) {
|
|
394
|
+
incomingDep.excluded = true;
|
|
387
395
|
}
|
|
388
396
|
}
|
|
389
397
|
}
|
|
@@ -394,7 +402,9 @@ function propagateSymbols({
|
|
|
394
402
|
// This ensures a consistent ordering of these symbols when packaging.
|
|
395
403
|
// See https://github.com/parcel-bundler/parcel/pull/8212
|
|
396
404
|
for (let dep of changedDeps) {
|
|
397
|
-
dep.usedSymbolsUp = new Map(
|
|
405
|
+
dep.usedSymbolsUp = new Map(
|
|
406
|
+
// @ts-expect-error TS2345
|
|
407
|
+
[...dep.usedSymbolsUp].sort(([a], [b]) => a.localeCompare(b)));
|
|
398
408
|
}
|
|
399
409
|
return errors;
|
|
400
410
|
});
|
|
@@ -475,6 +485,7 @@ function propagateSymbolsUp(assetGraph, changedAssets, changedDepsUsedSymbolsUpD
|
|
|
475
485
|
|
|
476
486
|
let errors = previousErrors ?
|
|
477
487
|
// Some nodes might have been removed since the last build
|
|
488
|
+
// @ts-expect-error TS2769
|
|
478
489
|
new Map([...previousErrors].filter(([n]) => assetGraph.hasNode(n))) : new Map();
|
|
479
490
|
let changedDepsUsedSymbolsUpDirtyDownAssets = new Set([...[...changedDepsUsedSymbolsUpDirtyDown].reverse().flatMap(id => getDependencyResolution(assetGraph, id)), ...changedAssets]);
|
|
480
491
|
|
|
@@ -484,6 +495,8 @@ function propagateSymbolsUp(assetGraph, changedAssets, changedDepsUsedSymbolsUpD
|
|
|
484
495
|
// If there are n nodes in the graph, then the asset count is approximately
|
|
485
496
|
// n/6 (for every asset, there are ~4 dependencies and ~1 asset_group).
|
|
486
497
|
assetGraph.nodes.length * (1 / 6) * 0.5 < changedDepsUsedSymbolsUpDirtyDownAssets.size;
|
|
498
|
+
|
|
499
|
+
// @ts-expect-error TS7034
|
|
487
500
|
let dirtyDeps;
|
|
488
501
|
if (runFullPass) {
|
|
489
502
|
dirtyDeps = new Set();
|
|
@@ -518,13 +531,16 @@ function propagateSymbolsUp(assetGraph, changedAssets, changedDepsUsedSymbolsUpD
|
|
|
518
531
|
} else {
|
|
519
532
|
if (node.type === 'dependency') {
|
|
520
533
|
if (node.usedSymbolsUpDirtyUp) {
|
|
534
|
+
// @ts-expect-error TS7005
|
|
521
535
|
dirtyDeps.add(nodeId);
|
|
522
536
|
} else {
|
|
537
|
+
// @ts-expect-error TS7005
|
|
523
538
|
dirtyDeps.delete(nodeId);
|
|
524
539
|
}
|
|
525
540
|
}
|
|
526
541
|
}
|
|
527
542
|
};
|
|
543
|
+
// @ts-expect-error TS2345
|
|
528
544
|
assetGraph.postOrderDfsFast(nodeVisitor, rootNodeId);
|
|
529
545
|
}
|
|
530
546
|
let queue = dirtyDeps ?? changedDepsUsedSymbolsUpDirtyDownAssets;
|
|
@@ -564,6 +580,7 @@ function propagateSymbolsUp(assetGraph, changedAssets, changedDepsUsedSymbolsUpD
|
|
|
564
580
|
} else {
|
|
565
581
|
let connectedNodes = assetGraph.getNodeIdsConnectedTo(queuedNodeId);
|
|
566
582
|
if (connectedNodes.length > 0) {
|
|
583
|
+
// @ts-expect-error TS2556
|
|
567
584
|
queue.add(...connectedNodes);
|
|
568
585
|
}
|
|
569
586
|
}
|
|
@@ -573,17 +590,22 @@ function propagateSymbolsUp(assetGraph, changedAssets, changedDepsUsedSymbolsUpD
|
|
|
573
590
|
function getDependencyResolution(graph, depId) {
|
|
574
591
|
let depNodeId = graph.getNodeIdByContentKey(depId);
|
|
575
592
|
let connected = graph.getNodeIdsConnectedFrom(depNodeId);
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
593
|
+
let resolvedNodeIds = [];
|
|
594
|
+
|
|
595
|
+
// If any of the resolved nodes is an asset_group, we need to resolve its
|
|
596
|
+
// assets here.
|
|
597
|
+
for (let child of connected) {
|
|
598
|
+
if (!child) {
|
|
599
|
+
continue;
|
|
600
|
+
}
|
|
579
601
|
let childNode = (0, _nullthrows().default)(graph.getNode(child));
|
|
580
602
|
if (childNode.type === 'asset_group') {
|
|
581
|
-
|
|
603
|
+
resolvedNodeIds.push(...graph.getNodeIdsConnectedFrom(child));
|
|
582
604
|
} else {
|
|
583
|
-
|
|
605
|
+
resolvedNodeIds.push(child);
|
|
584
606
|
}
|
|
585
607
|
}
|
|
586
|
-
return
|
|
608
|
+
return resolvedNodeIds;
|
|
587
609
|
}
|
|
588
610
|
function equalMap(a, b) {
|
|
589
611
|
if (a.size !== b.size) return false;
|
|
@@ -609,7 +631,9 @@ function dependencyNodesFromIds(assetGraph, dependencyIds) {
|
|
|
609
631
|
return depNode;
|
|
610
632
|
});
|
|
611
633
|
}
|
|
612
|
-
function incomingDependencyNodesFromAsset(assetGraph,
|
|
634
|
+
function incomingDependencyNodesFromAsset(assetGraph,
|
|
635
|
+
// @ts-expect-error TS2552
|
|
636
|
+
assetNodeValue) {
|
|
613
637
|
return assetGraph.getIncomingDependencies(assetNodeValue).map(d => {
|
|
614
638
|
let n = assetGraph.getNodeByContentKey(d.id);
|
|
615
639
|
(0, _assert().default)(n && n.type === 'dependency');
|
|
@@ -28,7 +28,7 @@ const PACKAGE_DESCRIPTOR_SCHEMA = exports.PACKAGE_DESCRIPTOR_SCHEMA = {
|
|
|
28
28
|
properties: {
|
|
29
29
|
context: {
|
|
30
30
|
type: 'string',
|
|
31
|
-
enum: ['node', 'browser', 'web-worker', 'electron-main', 'electron-renderer', 'service-worker']
|
|
31
|
+
enum: ['node', 'browser', 'web-worker', 'electron-main', 'electron-renderer', 'service-worker', 'tesseract']
|
|
32
32
|
},
|
|
33
33
|
includeNodeModules: {
|
|
34
34
|
oneOf: [{
|
|
@@ -98,6 +98,12 @@ const PACKAGE_DESCRIPTOR_SCHEMA = exports.PACKAGE_DESCRIPTOR_SCHEMA = {
|
|
|
98
98
|
},
|
|
99
99
|
__unstable_singleFileOutput: {
|
|
100
100
|
type: 'boolean'
|
|
101
|
+
},
|
|
102
|
+
env: {
|
|
103
|
+
type: 'object',
|
|
104
|
+
additionalProperties: {
|
|
105
|
+
type: 'string'
|
|
106
|
+
}
|
|
101
107
|
}
|
|
102
108
|
},
|
|
103
109
|
additionalProperties: false
|
package/lib/Transformation.js
CHANGED
|
@@ -47,7 +47,6 @@ function _utils() {
|
|
|
47
47
|
return data;
|
|
48
48
|
}
|
|
49
49
|
var _Dependency = require("./Dependency");
|
|
50
|
-
var _AtlaspackConfig = require("./AtlaspackConfig");
|
|
51
50
|
var _PathRequest = require("./requests/PathRequest");
|
|
52
51
|
var _Asset = require("./public/Asset");
|
|
53
52
|
var _UncommittedAsset = _interopRequireDefault(require("./UncommittedAsset"));
|
|
@@ -73,10 +72,18 @@ function _profiler() {
|
|
|
73
72
|
};
|
|
74
73
|
return data;
|
|
75
74
|
}
|
|
75
|
+
function _featureFlags() {
|
|
76
|
+
const data = require("@atlaspack/feature-flags");
|
|
77
|
+
_featureFlags = function () {
|
|
78
|
+
return data;
|
|
79
|
+
};
|
|
80
|
+
return data;
|
|
81
|
+
}
|
|
76
82
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
77
83
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
78
84
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
79
85
|
// TODO: eventually call path request as sub requests
|
|
86
|
+
|
|
80
87
|
class Transformation {
|
|
81
88
|
constructor({
|
|
82
89
|
request,
|
|
@@ -127,10 +134,14 @@ class Transformation {
|
|
|
127
134
|
// If no existing sourcemap was found, initialize asset.sourceContent
|
|
128
135
|
// with the original contents. This will be used when the transformer
|
|
129
136
|
// calls setMap to ensure the source content is in the sourcemap.
|
|
130
|
-
|
|
137
|
+
if (!(0, _featureFlags().getFeatureFlag)('omitSourcesContentInMemory')) {
|
|
138
|
+
asset.sourceContent = await asset.getCode();
|
|
139
|
+
}
|
|
131
140
|
}
|
|
132
141
|
(0, _DevDepRequest.invalidateDevDeps)(this.request.invalidDevDeps, this.options, this.atlaspackConfig);
|
|
133
|
-
let pipeline = await this.loadPipeline(
|
|
142
|
+
let pipeline = await this.loadPipeline(
|
|
143
|
+
// @ts-expect-error TS2345
|
|
144
|
+
this.request.filePath, asset.value.isSource, asset.value.pipeline);
|
|
134
145
|
let assets, error;
|
|
135
146
|
try {
|
|
136
147
|
let results = await this.runPipelines(pipeline, asset);
|
|
@@ -141,9 +152,8 @@ class Transformation {
|
|
|
141
152
|
}
|
|
142
153
|
let configRequests = (0, _ConfigRequest.getConfigRequests)([...this.configs.values(), ...this.resolverRunner.configs.values()]);
|
|
143
154
|
let devDepRequests = (0, _DevDepRequest.getWorkerDevDepRequests)([...this.devDepRequests.values(), ...this.resolverRunner.devDepRequests.values()]);
|
|
144
|
-
|
|
145
|
-
// $FlowFixMe because of $$raw
|
|
146
155
|
return {
|
|
156
|
+
// @ts-expect-error TS2353
|
|
147
157
|
$$raw: true,
|
|
148
158
|
assets,
|
|
149
159
|
configRequests,
|
|
@@ -168,19 +178,23 @@ class Transformation {
|
|
|
168
178
|
size,
|
|
169
179
|
isSource: summarizedIsSource
|
|
170
180
|
} = await (0, _summarizeRequest.default)(this.options.inputFS, {
|
|
181
|
+
// @ts-expect-error TS2322
|
|
171
182
|
filePath: (0, _projectPath.fromProjectPath)(this.options.projectRoot, filePath),
|
|
172
183
|
code
|
|
173
184
|
});
|
|
174
185
|
|
|
175
186
|
// Prefer `isSource` originating from the AssetRequest.
|
|
176
|
-
|
|
187
|
+
let isSource = isSourceOverride ?? summarizedIsSource;
|
|
177
188
|
return new _UncommittedAsset.default({
|
|
178
189
|
value: (0, _assetUtils.createAsset)(this.options.projectRoot, {
|
|
179
190
|
code,
|
|
191
|
+
// @ts-expect-error TS2322
|
|
180
192
|
filePath,
|
|
181
|
-
isSource
|
|
193
|
+
isSource,
|
|
194
|
+
// @ts-expect-error TS2345
|
|
182
195
|
type: _path().default.extname((0, _projectPath.fromProjectPathRelative)(filePath)).slice(1),
|
|
183
196
|
pipeline,
|
|
197
|
+
// @ts-expect-error TS2322
|
|
184
198
|
env,
|
|
185
199
|
query,
|
|
186
200
|
stats: {
|
|
@@ -386,6 +400,7 @@ class Transformation {
|
|
|
386
400
|
let config = (0, _InternalConfig.createConfig)({
|
|
387
401
|
plugin: transformer.name,
|
|
388
402
|
isSource,
|
|
403
|
+
// @ts-expect-error TS2322
|
|
389
404
|
searchPath: this.request.filePath,
|
|
390
405
|
env: this.request.env
|
|
391
406
|
});
|
|
@@ -425,6 +440,8 @@ class Transformation {
|
|
|
425
440
|
diagnostic: result.diagnostics
|
|
426
441
|
});
|
|
427
442
|
}
|
|
443
|
+
|
|
444
|
+
// @ts-expect-error TS2322
|
|
428
445
|
return (0, _projectPath.fromProjectPath)(this.options.projectRoot, (0, _nullthrows().default)(result.assetGroup).filePath);
|
|
429
446
|
};
|
|
430
447
|
|
|
@@ -463,9 +480,8 @@ class Transformation {
|
|
|
463
480
|
}
|
|
464
481
|
|
|
465
482
|
// Transform.
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
await transformer.transform({
|
|
483
|
+
// @ts-expect-error TS2322
|
|
484
|
+
let transfomerResult = await transformer.transform({
|
|
469
485
|
asset: new _Asset.MutableAsset(asset),
|
|
470
486
|
config,
|
|
471
487
|
options: pipeline.pluginOptions,
|
package/lib/UncommittedAsset.js
CHANGED
|
@@ -53,6 +53,14 @@ var _assetUtils = require("./assetUtils");
|
|
|
53
53
|
var _types = require("./types");
|
|
54
54
|
var _utils2 = require("./utils");
|
|
55
55
|
var _projectPath = require("./projectPath");
|
|
56
|
+
function _featureFlags() {
|
|
57
|
+
const data = require("@atlaspack/feature-flags");
|
|
58
|
+
_featureFlags = function () {
|
|
59
|
+
return data;
|
|
60
|
+
};
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
var _EnvironmentManager = require("./EnvironmentManager");
|
|
56
64
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
57
65
|
class UncommittedAsset {
|
|
58
66
|
constructor({
|
|
@@ -116,7 +124,9 @@ class UncommittedAsset {
|
|
|
116
124
|
let size = 0;
|
|
117
125
|
if (content instanceof _stream().Readable) {
|
|
118
126
|
let hash = new (_rust().Hash)();
|
|
119
|
-
await this.options.cache.setStream(contentKey, content.pipe(
|
|
127
|
+
await this.options.cache.setStream(contentKey, content.pipe(
|
|
128
|
+
// @ts-expect-error TS2554
|
|
129
|
+
new (_utils().TapStream)(buf => {
|
|
120
130
|
hash.writeBuffer(buf);
|
|
121
131
|
size += buf.length;
|
|
122
132
|
})));
|
|
@@ -133,6 +143,8 @@ class UncommittedAsset {
|
|
|
133
143
|
hash = (0, _rust().hashBuffer)(content);
|
|
134
144
|
size = content.length;
|
|
135
145
|
}
|
|
146
|
+
|
|
147
|
+
// Maybe we should just store this in a file instead of LMDB
|
|
136
148
|
await this.options.cache.setBlob(contentKey, content);
|
|
137
149
|
return {
|
|
138
150
|
size,
|
|
@@ -147,6 +159,7 @@ class UncommittedAsset {
|
|
|
147
159
|
if (typeof content === 'string' || content instanceof Buffer) {
|
|
148
160
|
return content.toString();
|
|
149
161
|
} else if (content != null) {
|
|
162
|
+
// @ts-expect-error TS2345
|
|
150
163
|
this.content = (0, _utils().bufferStream)(content);
|
|
151
164
|
return (await this.content).toString();
|
|
152
165
|
}
|
|
@@ -161,6 +174,8 @@ class UncommittedAsset {
|
|
|
161
174
|
} else if (typeof content === 'string') {
|
|
162
175
|
return Buffer.from(content);
|
|
163
176
|
}
|
|
177
|
+
|
|
178
|
+
// @ts-expect-error TS2345
|
|
164
179
|
this.content = (0, _utils().bufferStream)(content);
|
|
165
180
|
return this.content;
|
|
166
181
|
}
|
|
@@ -184,6 +199,10 @@ class UncommittedAsset {
|
|
|
184
199
|
this.content = buffer;
|
|
185
200
|
this.clearAST();
|
|
186
201
|
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* @deprecated This has been broken on any cache other than FSCache for a long time.
|
|
205
|
+
*/
|
|
187
206
|
setStream(stream) {
|
|
188
207
|
this.content = stream;
|
|
189
208
|
this.clearAST();
|
|
@@ -223,9 +242,7 @@ class UncommittedAsset {
|
|
|
223
242
|
// a previous source map. Ensure that the map set by the transformer has the original
|
|
224
243
|
// source content available.
|
|
225
244
|
if (map != null && this.sourceContent != null) {
|
|
226
|
-
map.setSourceContent((0, _projectPath.fromProjectPath)(this.options.projectRoot, this.value.filePath),
|
|
227
|
-
// $FlowFixMe
|
|
228
|
-
this.sourceContent);
|
|
245
|
+
map.setSourceContent((0, _projectPath.fromProjectPath)(this.options.projectRoot, this.value.filePath), this.sourceContent);
|
|
229
246
|
this.sourceContent = null;
|
|
230
247
|
}
|
|
231
248
|
this.map = map;
|
|
@@ -248,6 +265,10 @@ class UncommittedAsset {
|
|
|
248
265
|
this.value.astGenerator = null;
|
|
249
266
|
}
|
|
250
267
|
getCacheKey(key) {
|
|
268
|
+
if ((0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements')) {
|
|
269
|
+
const filePath = (0, _projectPath.fromProjectPathRelative)(this.value.filePath);
|
|
270
|
+
return `Asset/${_constants.ATLASPACK_VERSION}/${filePath}/${this.value.id}/${key}`;
|
|
271
|
+
}
|
|
251
272
|
return (0, _rust().hashString)(_constants.ATLASPACK_VERSION + key + this.value.id);
|
|
252
273
|
}
|
|
253
274
|
addDependency(opts) {
|
|
@@ -259,9 +280,9 @@ class UncommittedAsset {
|
|
|
259
280
|
} = opts;
|
|
260
281
|
let dep = (0, _Dependency.createDependency)(this.options.projectRoot, {
|
|
261
282
|
...rest,
|
|
262
|
-
//
|
|
283
|
+
// @ts-expect-error TS2322
|
|
263
284
|
symbols,
|
|
264
|
-
env: (0, _Environment.mergeEnvironments)(this.options.projectRoot, this.value.env, env),
|
|
285
|
+
env: (0, _Environment.mergeEnvironments)(this.options.projectRoot, (0, _EnvironmentManager.fromEnvironmentId)(this.value.env), env),
|
|
265
286
|
sourceAssetId: this.value.id,
|
|
266
287
|
sourcePath: (0, _projectPath.fromProjectPath)(this.options.projectRoot, this.value.filePath)
|
|
267
288
|
});
|
|
@@ -301,7 +322,7 @@ class UncommittedAsset {
|
|
|
301
322
|
bundleBehavior: result.bundleBehavior ?? (this.value.bundleBehavior == null ? null : _types.BundleBehaviorNames[this.value.bundleBehavior]),
|
|
302
323
|
isBundleSplittable: result.isBundleSplittable ?? this.value.isBundleSplittable,
|
|
303
324
|
isSource: this.value.isSource,
|
|
304
|
-
env: (0, _Environment.mergeEnvironments)(this.options.projectRoot, this.value.env, result.env),
|
|
325
|
+
env: (0, _Environment.mergeEnvironments)(this.options.projectRoot, (0, _EnvironmentManager.fromEnvironmentId)(this.value.env), result.env),
|
|
305
326
|
dependencies: this.value.type === result.type ? new Map(this.value.dependencies) : new Map(),
|
|
306
327
|
meta: {
|
|
307
328
|
...this.value.meta,
|
|
@@ -312,7 +333,7 @@ class UncommittedAsset {
|
|
|
312
333
|
time: 0,
|
|
313
334
|
size: this.value.stats.size
|
|
314
335
|
},
|
|
315
|
-
//
|
|
336
|
+
// @ts-expect-error TS2322
|
|
316
337
|
symbols: result.symbols,
|
|
317
338
|
sideEffects: result.sideEffects ?? this.value.sideEffects,
|
|
318
339
|
uniqueKey: result.uniqueKey,
|
|
@@ -341,7 +362,7 @@ class UncommittedAsset {
|
|
|
341
362
|
return asset;
|
|
342
363
|
}
|
|
343
364
|
updateId() {
|
|
344
|
-
//
|
|
365
|
+
// @ts-expect-error TS2345
|
|
345
366
|
this.value.id = (0, _assetUtils.createAssetIdFromOptions)(this.value);
|
|
346
367
|
}
|
|
347
368
|
}
|
package/lib/Validation.js
CHANGED
|
@@ -32,7 +32,6 @@ function _diagnostic() {
|
|
|
32
32
|
};
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
|
-
var _AtlaspackConfig = require("./AtlaspackConfig");
|
|
36
35
|
var _UncommittedAsset = _interopRequireDefault(require("./UncommittedAsset"));
|
|
37
36
|
var _assetUtils = require("./assetUtils");
|
|
38
37
|
var _Asset = require("./public/Asset");
|
|
@@ -52,6 +51,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
52
51
|
class Validation {
|
|
53
52
|
allAssets = {};
|
|
54
53
|
allValidators = {};
|
|
54
|
+
|
|
55
|
+
// @ts-expect-error TS2564
|
|
56
|
+
|
|
55
57
|
constructor({
|
|
56
58
|
config,
|
|
57
59
|
dedicatedThread,
|
|
@@ -84,7 +86,9 @@ class Validation {
|
|
|
84
86
|
let validatorResults = [];
|
|
85
87
|
try {
|
|
86
88
|
// If the plugin supports the single-threading validateAll method, pass all assets to it.
|
|
89
|
+
// @ts-expect-error TS2339
|
|
87
90
|
if (plugin.validateAll && this.dedicatedThread) {
|
|
91
|
+
// @ts-expect-error TS2339
|
|
88
92
|
validatorResults = await plugin.validateAll({
|
|
89
93
|
assets: assets.map(asset => new _Asset.Asset(asset)),
|
|
90
94
|
options: pluginOptions,
|
|
@@ -95,11 +99,14 @@ class Validation {
|
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
// Otherwise, pass the assets one-at-a-time
|
|
102
|
+
// @ts-expect-error TS2339
|
|
98
103
|
else if (plugin.validate && !this.dedicatedThread) {
|
|
99
104
|
await Promise.all(assets.map(async input => {
|
|
100
105
|
let config = null;
|
|
101
106
|
let publicAsset = new _Asset.Asset(input);
|
|
107
|
+
// @ts-expect-error TS2339
|
|
102
108
|
if (plugin.getConfig) {
|
|
109
|
+
// @ts-expect-error TS2339
|
|
103
110
|
config = await plugin.getConfig({
|
|
104
111
|
asset: publicAsset,
|
|
105
112
|
options: pluginOptions,
|
|
@@ -108,6 +115,8 @@ class Validation {
|
|
|
108
115
|
resolveConfig: configNames => (0, _utils().resolveConfig)(this.options.inputFS, publicAsset.filePath, configNames, this.options.projectRoot)
|
|
109
116
|
});
|
|
110
117
|
}
|
|
118
|
+
|
|
119
|
+
// @ts-expect-error TS2339
|
|
111
120
|
let validatorResult = await plugin.validate({
|
|
112
121
|
asset: publicAsset,
|
|
113
122
|
options: pluginOptions,
|
|
@@ -134,10 +143,13 @@ class Validation {
|
|
|
134
143
|
await Promise.all(this.requests.map(async request => {
|
|
135
144
|
this.report({
|
|
136
145
|
type: 'validation',
|
|
146
|
+
// @ts-expect-error TS2322
|
|
137
147
|
filePath: (0, _projectPath.fromProjectPath)(this.options.projectRoot, request.filePath)
|
|
138
148
|
});
|
|
139
149
|
let asset = await this.loadAsset(request);
|
|
140
|
-
let validators = await this.atlaspackConfig.getValidators(
|
|
150
|
+
let validators = await this.atlaspackConfig.getValidators(
|
|
151
|
+
// @ts-expect-error TS2345
|
|
152
|
+
request.filePath);
|
|
141
153
|
for (let validator of validators) {
|
|
142
154
|
this.allValidators[validator.name] = validator.plugin;
|
|
143
155
|
if (this.allAssets[validator.name]) {
|
|
@@ -179,15 +191,19 @@ class Validation {
|
|
|
179
191
|
size,
|
|
180
192
|
isSource
|
|
181
193
|
} = await (0, _summarizeRequest.default)(this.options.inputFS, {
|
|
194
|
+
// @ts-expect-error TS2322
|
|
182
195
|
filePath: (0, _projectPath.fromProjectPath)(this.options.projectRoot, request.filePath)
|
|
183
196
|
});
|
|
184
197
|
return new _UncommittedAsset.default({
|
|
185
198
|
value: (0, _assetUtils.createAsset)(this.options.projectRoot, {
|
|
186
199
|
code,
|
|
200
|
+
// @ts-expect-error TS2322
|
|
187
201
|
filePath: filePath,
|
|
188
202
|
isSource,
|
|
203
|
+
// @ts-expect-error TS2345
|
|
189
204
|
type: _path().default.extname((0, _projectPath.fromProjectPathRelative)(filePath)).slice(1),
|
|
190
205
|
query,
|
|
206
|
+
// @ts-expect-error TS2322
|
|
191
207
|
env: env,
|
|
192
208
|
stats: {
|
|
193
209
|
time: 0,
|
package/lib/applyRuntimes.js
CHANGED
|
@@ -69,6 +69,7 @@ function _utils() {
|
|
|
69
69
|
};
|
|
70
70
|
return data;
|
|
71
71
|
}
|
|
72
|
+
var _EnvironmentManager = require("./EnvironmentManager");
|
|
72
73
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
73
74
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
74
75
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -123,8 +124,10 @@ async function applyRuntimes({
|
|
|
123
124
|
* order), so that children will always be available when parents try to reference
|
|
124
125
|
* them.
|
|
125
126
|
*/
|
|
127
|
+
// @ts-expect-error TS2304
|
|
126
128
|
let bundles = [];
|
|
127
129
|
bundleGraph.traverseBundles({
|
|
130
|
+
// @ts-expect-error TS2304
|
|
128
131
|
exit(bundle) {
|
|
129
132
|
bundles.push(bundle);
|
|
130
133
|
}
|
|
@@ -158,13 +161,15 @@ async function applyRuntimes({
|
|
|
158
161
|
filePath,
|
|
159
162
|
isEntry,
|
|
160
163
|
env,
|
|
164
|
+
runtimeAssetRequiringExecutionOnLoad,
|
|
161
165
|
priority
|
|
162
166
|
} of runtimeAssets) {
|
|
163
167
|
let sourceName = _path().default.join(_path().default.dirname(filePath), `runtime-${(0, _rust().hashString)(code)}.${bundle.type}`);
|
|
164
168
|
let assetGroup = {
|
|
165
169
|
code,
|
|
170
|
+
runtimeAssetRequiringExecutionOnLoad,
|
|
166
171
|
filePath: (0, _projectPath.toProjectPath)(options.projectRoot, sourceName),
|
|
167
|
-
env: (0, _Environment.mergeEnvironments)(options.projectRoot, bundle.env, env),
|
|
172
|
+
env: (0, _Environment.mergeEnvironments)(options.projectRoot, (0, _EnvironmentManager.fromEnvironmentId)(bundle.env), env),
|
|
168
173
|
// Runtime assets should be considered source, as they should be
|
|
169
174
|
// e.g. compiled to run in the target environment
|
|
170
175
|
isSource: true
|
|
@@ -195,6 +200,8 @@ async function applyRuntimes({
|
|
|
195
200
|
// been named as this point.
|
|
196
201
|
nameRuntimeBundle(connectionBundle, bundle);
|
|
197
202
|
}
|
|
203
|
+
|
|
204
|
+
// @ts-expect-error TS2345
|
|
198
205
|
connectionMap.get(connectionBundle).push({
|
|
199
206
|
bundle: connectionBundle,
|
|
200
207
|
assetGroup,
|
|
@@ -233,6 +240,7 @@ async function applyRuntimes({
|
|
|
233
240
|
*/
|
|
234
241
|
let connections = [];
|
|
235
242
|
bundleGraph.traverseBundles({
|
|
243
|
+
// @ts-expect-error TS2304
|
|
236
244
|
enter(bundle) {
|
|
237
245
|
connections.push(...connectionMap.get(bundle));
|
|
238
246
|
}
|
package/lib/assetUtils.js
CHANGED
|
@@ -36,8 +36,6 @@ function _nullthrows() {
|
|
|
36
36
|
};
|
|
37
37
|
return data;
|
|
38
38
|
}
|
|
39
|
-
var _CommittedAsset = _interopRequireDefault(require("./CommittedAsset"));
|
|
40
|
-
var _UncommittedAsset = _interopRequireDefault(require("./UncommittedAsset"));
|
|
41
39
|
var _loadAtlaspackPlugin = _interopRequireDefault(require("./loadAtlaspackPlugin"));
|
|
42
40
|
var _Asset = require("./public/Asset");
|
|
43
41
|
var _PluginOptions = _interopRequireDefault(require("./public/PluginOptions"));
|
|
@@ -66,10 +64,11 @@ function _profiler() {
|
|
|
66
64
|
return data;
|
|
67
65
|
}
|
|
68
66
|
var _IdentifierRegistry = require("./IdentifierRegistry");
|
|
67
|
+
var _EnvironmentManager = require("./EnvironmentManager");
|
|
69
68
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
70
69
|
function createAssetIdFromOptions(options) {
|
|
71
70
|
const data = {
|
|
72
|
-
environmentId: options.env
|
|
71
|
+
environmentId: (0, _EnvironmentManager.toEnvironmentId)(options.env),
|
|
73
72
|
filePath: options.filePath,
|
|
74
73
|
code: options.code,
|
|
75
74
|
pipeline: options.pipeline,
|
|
@@ -168,6 +167,7 @@ function getInvalidationId(invalidation) {
|
|
|
168
167
|
case 'option':
|
|
169
168
|
return 'option:' + invalidation.key;
|
|
170
169
|
default:
|
|
170
|
+
// @ts-expect-error TS2339
|
|
171
171
|
throw new Error('Unknown invalidation type: ' + invalidation.type);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
@@ -195,9 +195,12 @@ async function getInvalidationHash(invalidations, options) {
|
|
|
195
195
|
hashes += invalidation.key + ':' + (options.env[invalidation.key] || '');
|
|
196
196
|
break;
|
|
197
197
|
case 'option':
|
|
198
|
-
hashes +=
|
|
198
|
+
hashes +=
|
|
199
|
+
// @ts-expect-error TS7053
|
|
200
|
+
invalidation.key + ':' + (0, _utils2.hashFromOption)(options[invalidation.key]);
|
|
199
201
|
break;
|
|
200
202
|
default:
|
|
203
|
+
// @ts-expect-error TS2339
|
|
201
204
|
throw new Error('Unknown invalidation type: ' + invalidation.type);
|
|
202
205
|
}
|
|
203
206
|
}
|
|
@@ -21,21 +21,34 @@ function _diagnostic() {
|
|
|
21
21
|
}
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
class AtlaspackV3 {
|
|
24
|
-
constructor(atlaspack_napi) {
|
|
24
|
+
constructor(atlaspack_napi, napiWorkerPool, isDefaultNapiWorkerPool) {
|
|
25
25
|
this._atlaspack_napi = atlaspack_napi;
|
|
26
|
+
this._napiWorkerPool = napiWorkerPool;
|
|
27
|
+
this._isDefaultNapiWorkerPool = isDefaultNapiWorkerPool;
|
|
26
28
|
}
|
|
27
29
|
static async create({
|
|
28
30
|
fs,
|
|
29
31
|
packageManager,
|
|
30
32
|
threads,
|
|
31
33
|
lmdb,
|
|
32
|
-
napiWorkerPool
|
|
34
|
+
napiWorkerPool,
|
|
33
35
|
...options
|
|
34
36
|
}) {
|
|
37
|
+
// @ts-expect-error TS2339
|
|
35
38
|
options.logLevel = options.logLevel || 'error';
|
|
39
|
+
// @ts-expect-error TS2339
|
|
36
40
|
options.defaultTargetOptions = options.defaultTargetOptions || {};
|
|
37
|
-
//
|
|
38
|
-
options.defaultTargetOptions.engines =
|
|
41
|
+
// @ts-expect-error TS2339
|
|
42
|
+
options.defaultTargetOptions.engines =
|
|
43
|
+
// @ts-expect-error TS2339
|
|
44
|
+
options.defaultTargetOptions.engines || {};
|
|
45
|
+
let isDefaultNapiWorkerPool = false;
|
|
46
|
+
if (!napiWorkerPool) {
|
|
47
|
+
napiWorkerPool = new _NapiWorkerPool.NapiWorkerPool();
|
|
48
|
+
isDefaultNapiWorkerPool = true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// @ts-expect-error TS2488
|
|
39
52
|
const [internal, error] = await (0, _rust().atlaspackNapiCreate)({
|
|
40
53
|
fs,
|
|
41
54
|
packageManager,
|
|
@@ -48,9 +61,16 @@ class AtlaspackV3 {
|
|
|
48
61
|
diagnostic: error
|
|
49
62
|
});
|
|
50
63
|
}
|
|
51
|
-
return new AtlaspackV3(internal);
|
|
64
|
+
return new AtlaspackV3(internal, napiWorkerPool, isDefaultNapiWorkerPool);
|
|
65
|
+
}
|
|
66
|
+
end() {
|
|
67
|
+
// If the worker pool was provided to us, don't shut it down, it's up to the provider.
|
|
68
|
+
if (this._isDefaultNapiWorkerPool) {
|
|
69
|
+
this._napiWorkerPool.shutdown();
|
|
70
|
+
}
|
|
52
71
|
}
|
|
53
72
|
async buildAssetGraph() {
|
|
73
|
+
// @ts-expect-error TS2488
|
|
54
74
|
let [graph, error] = await (0, _rust().atlaspackNapiBuildAssetGraph)(this._atlaspack_napi);
|
|
55
75
|
if (error !== null) {
|
|
56
76
|
throw new (_diagnostic().default)({
|
|
@@ -59,8 +79,13 @@ class AtlaspackV3 {
|
|
|
59
79
|
}
|
|
60
80
|
return graph;
|
|
61
81
|
}
|
|
62
|
-
respondToFsEvents(events) {
|
|
63
|
-
|
|
82
|
+
async respondToFsEvents(events) {
|
|
83
|
+
// @ts-expect-error TS2488
|
|
84
|
+
let [needsRebuild, error] = await (0, _rust().atlaspackNapiRespondToFsEvents)(this._atlaspack_napi, events);
|
|
85
|
+
if (error) {
|
|
86
|
+
throw new Error(error);
|
|
87
|
+
}
|
|
88
|
+
return needsRebuild;
|
|
64
89
|
}
|
|
65
90
|
}
|
|
66
91
|
exports.AtlaspackV3 = AtlaspackV3;
|
|
@@ -33,6 +33,8 @@ function _rust() {
|
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
35
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
36
|
+
// @ts-expect-error TS2724
|
|
37
|
+
|
|
36
38
|
const WORKER_PATH = _path().default.join(__dirname, 'worker', 'index.js');
|
|
37
39
|
const ATLASPACK_NAPI_WORKERS = _process().default.env.ATLASPACK_NAPI_WORKERS && parseInt(_process().default.env.ATLASPACK_NAPI_WORKERS, 10);
|
|
38
40
|
class NapiWorkerPool {
|
|
@@ -44,6 +46,7 @@ class NapiWorkerPool {
|
|
|
44
46
|
} = {
|
|
45
47
|
workerCount: undefined
|
|
46
48
|
}) {
|
|
49
|
+
// @ts-expect-error TS2322
|
|
47
50
|
this.#workerCount = workerCount ?? ATLASPACK_NAPI_WORKERS ?? (0, _rust().getAvailableThreads)();
|
|
48
51
|
if (!this.#workerCount) {
|
|
49
52
|
// TODO use main thread if workerCount is 0
|