@atlaspack/core 2.16.2-canary.21 → 2.16.2-canary.211
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 +561 -0
- package/dist/AssetGraph.js +591 -0
- package/dist/Atlaspack.js +656 -0
- package/dist/AtlaspackConfig.js +324 -0
- package/dist/AtlaspackConfig.schema.js +108 -0
- package/dist/BundleGraph.js +1628 -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 +531 -0
- package/dist/ReporterRunner.js +151 -0
- package/dist/RequestTracker.js +1368 -0
- package/dist/SymbolPropagation.js +617 -0
- package/dist/TargetDescriptor.schema.js +143 -0
- package/dist/Transformation.js +487 -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 +292 -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 +246 -0
- package/dist/requests/AssetRequest.js +130 -0
- package/dist/requests/AtlaspackBuildRequest.js +60 -0
- package/dist/requests/AtlaspackConfigRequest.js +490 -0
- package/dist/requests/BundleGraphRequest.js +441 -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 +65 -0
- package/dist/requests/PathRequest.js +349 -0
- package/dist/requests/TargetRequest.js +1310 -0
- package/dist/requests/ValidationRequest.js +49 -0
- package/dist/requests/WriteBundleRequest.js +254 -0
- package/dist/requests/WriteBundlesRequest.js +165 -0
- package/dist/requests/asset-graph-diff.js +126 -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 +82 -35
- package/lib/AtlaspackConfig.js +15 -3
- package/lib/AtlaspackConfig.schema.js +7 -5
- package/lib/BundleGraph.js +83 -30
- 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 +66 -23
- package/lib/ReporterRunner.js +6 -9
- package/lib/RequestTracker.js +256 -139
- package/lib/SymbolPropagation.js +22 -3
- package/lib/TargetDescriptor.schema.js +7 -1
- package/lib/Transformation.js +16 -9
- 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 +34 -6
- 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 +41 -4
- package/lib/requests/AssetGraphRequestRust.js +29 -14
- package/lib/requests/AssetRequest.js +23 -6
- package/lib/requests/AtlaspackBuildRequest.js +6 -2
- package/lib/requests/AtlaspackConfigRequest.js +12 -11
- package/lib/requests/BundleGraphRequest.js +29 -18
- 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 +7 -2
- package/lib/requests/PathRequest.js +24 -3
- package/lib/requests/TargetRequest.js +120 -56
- package/lib/requests/ValidationRequest.js +5 -1
- package/lib/requests/WriteBundleRequest.js +39 -11
- package/lib/requests/WriteBundlesRequest.js +24 -2
- package/lib/requests/asset-graph-diff.js +8 -3
- 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 +80 -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 +58 -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 +29 -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 +26 -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} +113 -60
- package/src/{AtlaspackConfig.schema.js → AtlaspackConfig.schema.ts} +16 -19
- package/src/{AtlaspackConfig.js → AtlaspackConfig.ts} +78 -54
- package/src/{BundleGraph.js → BundleGraph.ts} +213 -133
- 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} +149 -81
- package/src/{ReporterRunner.js → ReporterRunner.ts} +13 -18
- package/src/{RequestTracker.js → RequestTracker.ts} +558 -336
- package/src/{SymbolPropagation.js → SymbolPropagation.ts} +137 -39
- package/src/{TargetDescriptor.schema.js → TargetDescriptor.schema.ts} +7 -1
- package/src/{Transformation.js → Transformation.ts} +67 -61
- 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} +94 -65
- 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} +83 -48
- package/src/requests/{AssetGraphRequestRust.js → AssetGraphRequestRust.ts} +36 -29
- package/src/requests/{AssetRequest.js → AssetRequest.ts} +24 -18
- package/src/requests/{AtlaspackBuildRequest.js → AtlaspackBuildRequest.ts} +30 -31
- package/src/requests/{AtlaspackConfigRequest.js → AtlaspackConfigRequest.ts} +58 -51
- package/src/requests/{BundleGraphRequest.js → BundleGraphRequest.ts} +66 -57
- 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} +21 -21
- package/src/requests/{PathRequest.js → PathRequest.ts} +47 -37
- package/src/requests/{TargetRequest.js → TargetRequest.ts} +259 -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} +77 -34
- package/src/requests/{asset-graph-diff.js → asset-graph-diff.ts} +14 -14
- 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} +3 -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} +54 -92
- package/test/public/Config.test.ts +104 -0
- package/test/requests/{AssetGraphRequestRust.test.js → AssetGraphRequestRust.test.ts} +163 -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/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
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import { Cache } from '@atlaspack/cache';
|
|
2
|
+
import { ContentGraph } from '@atlaspack/graph';
|
|
3
|
+
import type { ContentGraphOpts, ContentKey, NodeId, SerializedContentGraph, Graph } from '@atlaspack/graph';
|
|
4
|
+
import type { Async, EnvMap } from '@atlaspack/types';
|
|
5
|
+
import { Deferred } from '@atlaspack/utils';
|
|
6
|
+
import type { Options as WatcherOptions, Event } from '@parcel/watcher';
|
|
7
|
+
import type WorkerFarm from '@atlaspack/workers';
|
|
8
|
+
import type { AtlaspackV3 } from './atlaspack-v3/AtlaspackV3';
|
|
9
|
+
import { ProjectPath } from './projectPath';
|
|
10
|
+
import type { AssetGraphRequestResult } from './requests/AssetGraphRequest';
|
|
11
|
+
import type { PackageRequestResult } from './requests/PackageRequest';
|
|
12
|
+
import type { ConfigRequestResult } from './requests/ConfigRequest';
|
|
13
|
+
import type { DevDepRequestResult } from './requests/DevDepRequest';
|
|
14
|
+
import type { WriteBundlesRequestResult } from './requests/WriteBundlesRequest';
|
|
15
|
+
import type { WriteBundleRequestResult } from './requests/WriteBundleRequest';
|
|
16
|
+
import type { TargetRequestResult } from './requests/TargetRequest';
|
|
17
|
+
import type { PathRequestResult } from './requests/PathRequest';
|
|
18
|
+
import type { AtlaspackConfigRequestResult } from './requests/AtlaspackConfigRequest';
|
|
19
|
+
import type { AtlaspackBuildRequestResult } from './requests/AtlaspackBuildRequest';
|
|
20
|
+
import type { EntryRequestResult } from './requests/EntryRequest';
|
|
21
|
+
import type { BundleGraphResult } from './requests/BundleGraphRequest';
|
|
22
|
+
import type { AssetRequestResult, AtlaspackOptions, RequestInvalidation, InternalFileCreateInvalidation, InternalGlob } from './types';
|
|
23
|
+
export declare const requestGraphEdgeTypes: {
|
|
24
|
+
readonly subrequest: 2;
|
|
25
|
+
readonly invalidated_by_update: 3;
|
|
26
|
+
readonly invalidated_by_delete: 4;
|
|
27
|
+
readonly invalidated_by_create: 5;
|
|
28
|
+
readonly invalidated_by_create_above: 6;
|
|
29
|
+
readonly dirname: 7;
|
|
30
|
+
};
|
|
31
|
+
export type RequestGraphEdgeType = (typeof requestGraphEdgeTypes)[keyof typeof requestGraphEdgeTypes];
|
|
32
|
+
type RequestGraphOpts = ContentGraphOpts<RequestGraphNode, RequestGraphEdgeType> & {
|
|
33
|
+
invalidNodeIds: Set<NodeId>;
|
|
34
|
+
incompleteNodeIds: Set<NodeId>;
|
|
35
|
+
globNodeIds: Set<NodeId>;
|
|
36
|
+
envNodeIds: Set<NodeId>;
|
|
37
|
+
optionNodeIds: Set<NodeId>;
|
|
38
|
+
unpredicatableNodeIds: Set<NodeId>;
|
|
39
|
+
invalidateOnBuildNodeIds: Set<NodeId>;
|
|
40
|
+
cachedRequestChunks: Set<number>;
|
|
41
|
+
configKeyNodes: Map<ProjectPath, Set<NodeId>>;
|
|
42
|
+
};
|
|
43
|
+
type SerializedRequestGraph = SerializedContentGraph<RequestGraphNode, RequestGraphEdgeType> & {
|
|
44
|
+
invalidNodeIds: Set<NodeId>;
|
|
45
|
+
incompleteNodeIds: Set<NodeId>;
|
|
46
|
+
globNodeIds: Set<NodeId>;
|
|
47
|
+
envNodeIds: Set<NodeId>;
|
|
48
|
+
optionNodeIds: Set<NodeId>;
|
|
49
|
+
unpredicatableNodeIds: Set<NodeId>;
|
|
50
|
+
invalidateOnBuildNodeIds: Set<NodeId>;
|
|
51
|
+
cachedRequestChunks: Set<number>;
|
|
52
|
+
configKeyNodes: Map<ProjectPath, Set<NodeId>>;
|
|
53
|
+
};
|
|
54
|
+
declare const FILE: 0;
|
|
55
|
+
declare const REQUEST: 1;
|
|
56
|
+
declare const FILE_NAME: 2;
|
|
57
|
+
declare const ENV: 3;
|
|
58
|
+
declare const OPTION: 4;
|
|
59
|
+
declare const GLOB: 5;
|
|
60
|
+
declare const CONFIG_KEY: 6;
|
|
61
|
+
type FileNode = {
|
|
62
|
+
id: ContentKey;
|
|
63
|
+
readonly type: typeof FILE;
|
|
64
|
+
};
|
|
65
|
+
type GlobNode = {
|
|
66
|
+
id: ContentKey;
|
|
67
|
+
readonly type: typeof GLOB;
|
|
68
|
+
value: InternalGlob;
|
|
69
|
+
};
|
|
70
|
+
type FileNameNode = {
|
|
71
|
+
id: ContentKey;
|
|
72
|
+
readonly type: typeof FILE_NAME;
|
|
73
|
+
};
|
|
74
|
+
type EnvNode = {
|
|
75
|
+
id: ContentKey;
|
|
76
|
+
readonly type: typeof ENV;
|
|
77
|
+
value: string | undefined;
|
|
78
|
+
};
|
|
79
|
+
type OptionNode = {
|
|
80
|
+
id: ContentKey;
|
|
81
|
+
readonly type: typeof OPTION;
|
|
82
|
+
hash: string;
|
|
83
|
+
};
|
|
84
|
+
type ConfigKeyNode = {
|
|
85
|
+
id: ContentKey;
|
|
86
|
+
readonly type: typeof CONFIG_KEY;
|
|
87
|
+
configKey: string[];
|
|
88
|
+
contentHash: string;
|
|
89
|
+
};
|
|
90
|
+
type Request<TInput, TResult> = {
|
|
91
|
+
id: string;
|
|
92
|
+
readonly type: RequestType;
|
|
93
|
+
input: TInput;
|
|
94
|
+
run: (arg1: {
|
|
95
|
+
input: TInput;
|
|
96
|
+
} & StaticRunOpts<TResult>) => Async<TResult>;
|
|
97
|
+
};
|
|
98
|
+
export type RequestResult = AssetGraphRequestResult | PackageRequestResult | ConfigRequestResult | DevDepRequestResult | WriteBundlesRequestResult | WriteBundleRequestResult | TargetRequestResult | PathRequestResult | AtlaspackConfigRequestResult | AtlaspackBuildRequestResult | EntryRequestResult | BundleGraphResult | AssetRequestResult;
|
|
99
|
+
type InvalidateReason = number;
|
|
100
|
+
type RequestNode = {
|
|
101
|
+
id: ContentKey;
|
|
102
|
+
readonly type: typeof REQUEST;
|
|
103
|
+
readonly requestType: RequestType;
|
|
104
|
+
invalidateReason: InvalidateReason;
|
|
105
|
+
result?: RequestResult;
|
|
106
|
+
resultCacheKey?: string | null | undefined;
|
|
107
|
+
hash?: string;
|
|
108
|
+
};
|
|
109
|
+
export declare const requestTypes: {
|
|
110
|
+
readonly atlaspack_build_request: 1;
|
|
111
|
+
readonly bundle_graph_request: 2;
|
|
112
|
+
readonly asset_graph_request: 3;
|
|
113
|
+
readonly entry_request: 4;
|
|
114
|
+
readonly target_request: 5;
|
|
115
|
+
readonly atlaspack_config_request: 6;
|
|
116
|
+
readonly path_request: 7;
|
|
117
|
+
readonly dev_dep_request: 8;
|
|
118
|
+
readonly asset_request: 9;
|
|
119
|
+
readonly config_request: 10;
|
|
120
|
+
readonly write_bundles_request: 11;
|
|
121
|
+
readonly package_request: 12;
|
|
122
|
+
readonly write_bundle_request: 13;
|
|
123
|
+
readonly validation_request: 14;
|
|
124
|
+
};
|
|
125
|
+
type RequestType = (typeof requestTypes)[keyof typeof requestTypes];
|
|
126
|
+
type RequestGraphNode = RequestNode | FileNode | GlobNode | FileNameNode | EnvNode | OptionNode | ConfigKeyNode;
|
|
127
|
+
export type RunAPI<TResult extends RequestResult> = {
|
|
128
|
+
invalidateOnFileCreate: (arg1: InternalFileCreateInvalidation) => void;
|
|
129
|
+
invalidateOnFileDelete: (arg1: ProjectPath) => void;
|
|
130
|
+
invalidateOnFileUpdate: (arg1: ProjectPath) => void;
|
|
131
|
+
invalidateOnConfigKeyChange: (filePath: ProjectPath, configKey: string[], contentHash: string) => void;
|
|
132
|
+
invalidateOnStartup: () => void;
|
|
133
|
+
invalidateOnBuild: () => void;
|
|
134
|
+
invalidateOnEnvChange: (arg1: string) => void;
|
|
135
|
+
invalidateOnOptionChange: (arg1: string) => void;
|
|
136
|
+
getInvalidations(): Array<RequestInvalidation>;
|
|
137
|
+
storeResult(result: TResult, cacheKey?: string): void;
|
|
138
|
+
getRequestResult<T extends RequestResult>(contentKey: ContentKey): Async<T | null | undefined>;
|
|
139
|
+
getPreviousResult<T extends RequestResult>(ifMatch?: string): Async<T | null | undefined>;
|
|
140
|
+
getSubRequests(): Array<RequestNode>;
|
|
141
|
+
getInvalidSubRequests(): Array<RequestNode>;
|
|
142
|
+
canSkipSubrequest(arg1: ContentKey): boolean;
|
|
143
|
+
runRequest: <TInput, TResult extends RequestResult>(subRequest: Request<TInput, TResult>, opts?: RunRequestOpts) => Promise<TResult>;
|
|
144
|
+
};
|
|
145
|
+
type RunRequestOpts = {
|
|
146
|
+
force: boolean;
|
|
147
|
+
};
|
|
148
|
+
export type StaticRunOpts<TResult> = {
|
|
149
|
+
api: RunAPI<TResult>;
|
|
150
|
+
farm: WorkerFarm;
|
|
151
|
+
invalidateReason: InvalidateReason;
|
|
152
|
+
options: AtlaspackOptions;
|
|
153
|
+
rustAtlaspack: AtlaspackV3 | null | undefined;
|
|
154
|
+
};
|
|
155
|
+
export declare class RequestGraph extends ContentGraph<RequestGraphNode, RequestGraphEdgeType> {
|
|
156
|
+
invalidNodeIds: Set<NodeId>;
|
|
157
|
+
incompleteNodeIds: Set<NodeId>;
|
|
158
|
+
incompleteNodePromises: Map<NodeId, Promise<boolean>>;
|
|
159
|
+
globNodeIds: Set<NodeId>;
|
|
160
|
+
envNodeIds: Set<NodeId>;
|
|
161
|
+
optionNodeIds: Set<NodeId>;
|
|
162
|
+
unpredicatableNodeIds: Set<NodeId>;
|
|
163
|
+
invalidateOnBuildNodeIds: Set<NodeId>;
|
|
164
|
+
cachedRequestChunks: Set<number>;
|
|
165
|
+
configKeyNodes: Map<ProjectPath, Set<NodeId>>;
|
|
166
|
+
nodesPerBlob: number;
|
|
167
|
+
static deserialize(opts: RequestGraphOpts): RequestGraph;
|
|
168
|
+
serialize(): SerializedRequestGraph;
|
|
169
|
+
addNode(node: RequestGraphNode): NodeId;
|
|
170
|
+
removeNode(nodeId: NodeId, removeOrphans?: boolean): void;
|
|
171
|
+
getRequestNode(nodeId: NodeId): RequestNode;
|
|
172
|
+
replaceSubrequests(requestNodeId: NodeId, subrequestContentKeys: Array<ContentKey>): void;
|
|
173
|
+
invalidateNode(nodeId: NodeId, reason: InvalidateReason): void;
|
|
174
|
+
/**
|
|
175
|
+
* Nodes that are invalidated on start-up, such as JavaScript babel configuration files which are
|
|
176
|
+
* imported when the build kicks-off and might doing arbitrary work such as reading from the file
|
|
177
|
+
* system.
|
|
178
|
+
*/
|
|
179
|
+
invalidateUnpredictableNodes(): void;
|
|
180
|
+
/**
|
|
181
|
+
* Effectively uncacheable nodes.
|
|
182
|
+
*/
|
|
183
|
+
invalidateOnBuildNodes(): void;
|
|
184
|
+
/**
|
|
185
|
+
* Nodes invalidated by environment changes, corresponds to `env: ...` inputs.
|
|
186
|
+
*/
|
|
187
|
+
invalidateEnvNodes(env: EnvMap): string[];
|
|
188
|
+
/**
|
|
189
|
+
* Nodes invalidated by option changes.
|
|
190
|
+
*/
|
|
191
|
+
invalidateOptionNodes(options: AtlaspackOptions): string[];
|
|
192
|
+
invalidateOnConfigKeyChange(requestNodeId: NodeId, filePath: ProjectPath, configKey: string[], contentHash: string): void;
|
|
193
|
+
invalidateOnFileUpdate(requestNodeId: NodeId, filePath: ProjectPath): void;
|
|
194
|
+
invalidateOnFileDelete(requestNodeId: NodeId, filePath: ProjectPath): void;
|
|
195
|
+
invalidateOnFileCreate(requestNodeId: NodeId, input: InternalFileCreateInvalidation): void;
|
|
196
|
+
invalidateOnStartup(requestNodeId: NodeId): void;
|
|
197
|
+
invalidateOnBuild(requestNodeId: NodeId): void;
|
|
198
|
+
invalidateOnEnvChange(requestNodeId: NodeId, env: string, value?: string): void;
|
|
199
|
+
invalidateOnOptionChange(requestNodeId: NodeId, option: string, value: unknown): void;
|
|
200
|
+
clearInvalidations(nodeId: NodeId): void;
|
|
201
|
+
getInvalidations(requestNodeId: NodeId): Array<RequestInvalidation>;
|
|
202
|
+
getSubRequests(requestNodeId: NodeId): Array<RequestNode>;
|
|
203
|
+
getInvalidSubRequests(requestNodeId: NodeId): Array<RequestNode>;
|
|
204
|
+
invalidateFileNameNode(node: FileNameNode, filePath: ProjectPath, matchNodes: Array<FileNode>, invalidateNode: (arg1: NodeId, arg2: InvalidateReason) => void): void;
|
|
205
|
+
respondToFSEvents(events: Array<Event>, options: AtlaspackOptions, threshold: number,
|
|
206
|
+
/**
|
|
207
|
+
* True if this is the start-up (loading phase) invalidation.
|
|
208
|
+
*/
|
|
209
|
+
isInitialBuild?: boolean): Promise<{
|
|
210
|
+
didInvalidate: boolean;
|
|
211
|
+
invalidationsByPath: Map<string, number>;
|
|
212
|
+
}>;
|
|
213
|
+
hasCachedRequestChunk(index: number): boolean;
|
|
214
|
+
setCachedRequestChunk(index: number): void;
|
|
215
|
+
removeCachedRequestChunkForNode(nodeId: number): void;
|
|
216
|
+
/**
|
|
217
|
+
* Returns the number of invalidated nodes in the graph.
|
|
218
|
+
*/
|
|
219
|
+
getInvalidNodeCount(): number;
|
|
220
|
+
}
|
|
221
|
+
export default class RequestTracker {
|
|
222
|
+
graph: RequestGraph;
|
|
223
|
+
farm: WorkerFarm;
|
|
224
|
+
options: AtlaspackOptions;
|
|
225
|
+
rustAtlaspack: AtlaspackV3 | null | undefined;
|
|
226
|
+
stats: Map<RequestType, number>;
|
|
227
|
+
constructor({ graph, farm, options, rustAtlaspack, }: {
|
|
228
|
+
graph?: RequestGraph;
|
|
229
|
+
farm: WorkerFarm;
|
|
230
|
+
options: AtlaspackOptions;
|
|
231
|
+
rustAtlaspack?: AtlaspackV3;
|
|
232
|
+
});
|
|
233
|
+
startRequest(request: RequestNode): {
|
|
234
|
+
requestNodeId: NodeId;
|
|
235
|
+
deferred: Deferred<boolean>;
|
|
236
|
+
};
|
|
237
|
+
storeResult(nodeId: NodeId, result: RequestResult, cacheKey?: string | null): void;
|
|
238
|
+
hasValidResult(nodeId: NodeId): boolean;
|
|
239
|
+
getRequestResult<T extends RequestResult>(contentKey: ContentKey, ifMatch?: string): Promise<T | null | undefined>;
|
|
240
|
+
completeRequest(nodeId: NodeId): void;
|
|
241
|
+
rejectRequest(nodeId: NodeId): void;
|
|
242
|
+
respondToFSEvents(events: Array<Event>, threshold: number): Promise<{
|
|
243
|
+
didInvalidate: boolean;
|
|
244
|
+
invalidationsByPath: Map<string, number>;
|
|
245
|
+
}>;
|
|
246
|
+
hasInvalidRequests(): boolean;
|
|
247
|
+
getInvalidRequests(): Array<RequestNode>;
|
|
248
|
+
replaceSubrequests(requestNodeId: NodeId, subrequestContextKeys: Array<ContentKey>): void;
|
|
249
|
+
runRequest<TInput, TResult extends RequestResult>(request: Request<TInput, TResult>, opts?: RunRequestOpts | null): Promise<TResult>;
|
|
250
|
+
flushStats(): {
|
|
251
|
+
[requestType: string]: number;
|
|
252
|
+
};
|
|
253
|
+
createAPI<TResult extends RequestResult>(requestId: NodeId, previousInvalidations: Array<RequestInvalidation>): {
|
|
254
|
+
api: RunAPI<TResult>;
|
|
255
|
+
subRequestContentKeys: Set<ContentKey>;
|
|
256
|
+
};
|
|
257
|
+
writeToCache(signal?: AbortSignal): Promise<void>;
|
|
258
|
+
static init({ farm, options, rustAtlaspack, }: {
|
|
259
|
+
farm: WorkerFarm;
|
|
260
|
+
options: AtlaspackOptions;
|
|
261
|
+
rustAtlaspack?: AtlaspackV3;
|
|
262
|
+
}): Promise<Async<RequestTracker>>;
|
|
263
|
+
}
|
|
264
|
+
export declare function getWatcherOptions({ watchIgnore, cacheDir, watchDir, watchBackend, }: AtlaspackOptions): WatcherOptions;
|
|
265
|
+
export declare function readAndDeserializeRequestGraph(cache: Cache, requestGraphKey: string, cacheKey: string): Promise<Async<{
|
|
266
|
+
requestGraph: RequestGraph;
|
|
267
|
+
bufferLength: number;
|
|
268
|
+
}>>;
|
|
269
|
+
/**
|
|
270
|
+
* A wrapper around an invalidation type / method
|
|
271
|
+
*/
|
|
272
|
+
type InvalidationFn = {
|
|
273
|
+
key: string;
|
|
274
|
+
fn: () => InvalidationDetail | Promise<InvalidationDetail> | undefined | Promise<undefined>;
|
|
275
|
+
};
|
|
276
|
+
type InvalidationStats = {
|
|
277
|
+
/**
|
|
278
|
+
* Total number of request graph nodes
|
|
279
|
+
*/
|
|
280
|
+
nodeCount: number;
|
|
281
|
+
/**
|
|
282
|
+
* Number of requests in RequestGraph
|
|
283
|
+
*/
|
|
284
|
+
requestCount: number;
|
|
285
|
+
/**
|
|
286
|
+
* Number of nodes that have been invalidated.
|
|
287
|
+
*/
|
|
288
|
+
invalidatedCount: number;
|
|
289
|
+
/**
|
|
290
|
+
* Percentage of requests that have been invalidated
|
|
291
|
+
*/
|
|
292
|
+
requestInvalidationRatio: number;
|
|
293
|
+
/**
|
|
294
|
+
* Percentage of nodes that have been invalidated
|
|
295
|
+
*/
|
|
296
|
+
nodeInvalidationRatio: number;
|
|
297
|
+
/**
|
|
298
|
+
* Details for each invalidation type
|
|
299
|
+
*/
|
|
300
|
+
invalidations: InvalidationFnStats[];
|
|
301
|
+
};
|
|
302
|
+
/**
|
|
303
|
+
* Details about an invalidation.
|
|
304
|
+
*
|
|
305
|
+
* If this is a fs events invalidation, this key will contain statistics about invalidations
|
|
306
|
+
* by path.
|
|
307
|
+
*
|
|
308
|
+
* If this is a env or option invalidation, this key will contain the list of changed environment
|
|
309
|
+
* variables or options.
|
|
310
|
+
*/
|
|
311
|
+
type InvalidationDetail = string[] | FSInvalidationStats;
|
|
312
|
+
/**
|
|
313
|
+
* Number of invalidations for a given file-system event.
|
|
314
|
+
*/
|
|
315
|
+
type FSInvalidation = {
|
|
316
|
+
path: string;
|
|
317
|
+
count: number;
|
|
318
|
+
};
|
|
319
|
+
type FSInvalidationStats = {
|
|
320
|
+
/**
|
|
321
|
+
* This list will be sorted by the number of nodes invalidated and only the top 10 will be
|
|
322
|
+
* included.
|
|
323
|
+
*/
|
|
324
|
+
biggestInvalidations: FSInvalidation[];
|
|
325
|
+
};
|
|
326
|
+
/**
|
|
327
|
+
* Information about a certain cache invalidation type.
|
|
328
|
+
*/
|
|
329
|
+
type InvalidationFnStats = {
|
|
330
|
+
/**
|
|
331
|
+
* Invalidation type, one of:
|
|
332
|
+
*
|
|
333
|
+
* - unpredictable
|
|
334
|
+
* - onBuild
|
|
335
|
+
* - env
|
|
336
|
+
* - option
|
|
337
|
+
* - fsEvents
|
|
338
|
+
*/
|
|
339
|
+
key: string;
|
|
340
|
+
/**
|
|
341
|
+
* Number of invalidated nodes coming from this invalidation type.
|
|
342
|
+
*/
|
|
343
|
+
count: number;
|
|
344
|
+
/**
|
|
345
|
+
* If this is a env or option invalidation, this key will contain the list of changed values.
|
|
346
|
+
*
|
|
347
|
+
* If this is a fs events invalidation, this key will contain statistics about invalidations
|
|
348
|
+
*/
|
|
349
|
+
detail: null | InvalidationDetail;
|
|
350
|
+
/**
|
|
351
|
+
* Time in milliseconds it took to run the invalidation.
|
|
352
|
+
*/
|
|
353
|
+
duration: number;
|
|
354
|
+
};
|
|
355
|
+
/**
|
|
356
|
+
* Respond to unpredictable, build, environment changes, option changes and file-system events
|
|
357
|
+
* invalidating RequestGraph nodes.
|
|
358
|
+
*
|
|
359
|
+
* Returns the count of nodes invalidated by each invalidation type.
|
|
360
|
+
*/
|
|
361
|
+
export declare function invalidateRequestGraph(requestGraph: RequestGraph, options: AtlaspackOptions, events: Event[]): Promise<InvalidationStats>;
|
|
362
|
+
interface InvalidateRequestGraphFSEventsInput {
|
|
363
|
+
respondToFSEvents(events: Event[], options: AtlaspackOptions, timeout: number, shouldLog: boolean): Promise<{
|
|
364
|
+
invalidationsByPath: Map<string, number>;
|
|
365
|
+
}>;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Invalidate the request graph based on file-system events.
|
|
369
|
+
*
|
|
370
|
+
* Returns statistics about the invalidations.
|
|
371
|
+
*/
|
|
372
|
+
export declare function invalidateRequestGraphFSEvents(requestGraph: InvalidateRequestGraphFSEventsInput, options: AtlaspackOptions, events: Event[]): Promise<FSInvalidationStats>;
|
|
373
|
+
interface RunInvalidationInput {
|
|
374
|
+
getInvalidNodeCount(): number;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Runs an invalidation function and reports metrics.
|
|
378
|
+
*/
|
|
379
|
+
export declare function runInvalidation(requestGraph: RunInvalidationInput, invalidationFn: InvalidationFn): Promise<InvalidationFnStats>;
|
|
380
|
+
export declare function cleanUpOrphans<N, E extends number>(graph: Graph<N, E>): NodeId[];
|
|
381
|
+
/**
|
|
382
|
+
* Returns paths that invalidated the most nodes
|
|
383
|
+
*/
|
|
384
|
+
export declare function getBiggestFSEventsInvalidations(invalidationsByPath: Map<string, number>, limit?: number): Array<FSInvalidation>;
|
|
385
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NodeId } from '@atlaspack/graph';
|
|
2
|
+
import type { Diagnostic } from '@atlaspack/diagnostic';
|
|
3
|
+
import type { AtlaspackOptions } from './types';
|
|
4
|
+
import { default as AssetGraph } from './AssetGraph';
|
|
5
|
+
export declare function propagateSymbols({ options, assetGraph, changedAssetsPropagation, assetGroupsWithRemovedParents, previousErrors, }: {
|
|
6
|
+
options: AtlaspackOptions;
|
|
7
|
+
assetGraph: AssetGraph;
|
|
8
|
+
changedAssetsPropagation: Set<string>;
|
|
9
|
+
assetGroupsWithRemovedParents: Set<NodeId>;
|
|
10
|
+
previousErrors?: Map<NodeId, Array<Diagnostic>> | null | undefined;
|
|
11
|
+
}): Map<NodeId, Array<Diagnostic>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SchemaEntity, SchemaObject } from '@atlaspack/utils';
|
|
2
|
+
export declare const ENGINES_SCHEMA: SchemaEntity;
|
|
3
|
+
export declare const PACKAGE_DESCRIPTOR_SCHEMA: SchemaObject;
|
|
4
|
+
export declare const DESCRIPTOR_SCHEMA: SchemaEntity;
|
|
5
|
+
export declare const COMMON_TARGET_DESCRIPTOR_SCHEMA: SchemaEntity;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { GenerateOutput, Transformer, TransformerResult, PackageName, SemverRange } from '@atlaspack/types';
|
|
2
|
+
import type { WorkerApi } from '@atlaspack/workers';
|
|
3
|
+
import type { Asset as AssetValue, TransformationRequest, Config, DevDepRequest, AtlaspackOptions, InternalDevDepOptions, Invalidations, DevDepRequestRef } from './types';
|
|
4
|
+
import type { LoadedPlugin } from './AtlaspackConfig';
|
|
5
|
+
import { Diagnostic } from '@atlaspack/diagnostic';
|
|
6
|
+
import { AtlaspackConfig } from './AtlaspackConfig';
|
|
7
|
+
import { ResolverRunner } from './requests/PathRequest';
|
|
8
|
+
import UncommittedAsset from './UncommittedAsset';
|
|
9
|
+
import PluginOptions from './public/PluginOptions';
|
|
10
|
+
import { ConfigRequest } from './requests/ConfigRequest';
|
|
11
|
+
import { ProjectPath } from './projectPath';
|
|
12
|
+
type GenerateFunc = (input: UncommittedAsset) => Promise<GenerateOutput>;
|
|
13
|
+
type PostProcessFunc = (arg1: Array<UncommittedAsset>) => Promise<Array<UncommittedAsset> | null>;
|
|
14
|
+
export type TransformationOpts = {
|
|
15
|
+
options: AtlaspackOptions;
|
|
16
|
+
config: AtlaspackConfig;
|
|
17
|
+
request: TransformationRequest;
|
|
18
|
+
workerApi: WorkerApi;
|
|
19
|
+
};
|
|
20
|
+
export type TransformationResult = {
|
|
21
|
+
assets?: Array<AssetValue>;
|
|
22
|
+
error?: Array<Diagnostic>;
|
|
23
|
+
configRequests: Array<ConfigRequest>;
|
|
24
|
+
invalidations: Invalidations;
|
|
25
|
+
devDepRequests: Array<DevDepRequest | DevDepRequestRef>;
|
|
26
|
+
};
|
|
27
|
+
export default class Transformation {
|
|
28
|
+
request: TransformationRequest;
|
|
29
|
+
configs: Map<string, Config>;
|
|
30
|
+
devDepRequests: Map<string, DevDepRequest | DevDepRequestRef>;
|
|
31
|
+
pluginDevDeps: Array<InternalDevDepOptions>;
|
|
32
|
+
options: AtlaspackOptions;
|
|
33
|
+
pluginOptions: PluginOptions;
|
|
34
|
+
workerApi: WorkerApi;
|
|
35
|
+
atlaspackConfig: AtlaspackConfig;
|
|
36
|
+
invalidations: Invalidations;
|
|
37
|
+
resolverRunner: ResolverRunner;
|
|
38
|
+
constructor({ request, options, config, workerApi }: TransformationOpts);
|
|
39
|
+
run(): Promise<TransformationResult>;
|
|
40
|
+
loadAsset(): Promise<UncommittedAsset>;
|
|
41
|
+
runPipelines(pipeline: Pipeline, initialAsset: UncommittedAsset): Promise<Array<UncommittedAsset>>;
|
|
42
|
+
addDevDependency(opts: InternalDevDepOptions): Promise<void>;
|
|
43
|
+
runPipeline(pipeline: Pipeline, initialAsset: UncommittedAsset): Promise<Array<UncommittedAsset>>;
|
|
44
|
+
loadPipeline(filePath: ProjectPath, isSource: boolean, pipeline?: string | null): Promise<Pipeline>;
|
|
45
|
+
loadNextPipeline({ filePath, isSource, newType, newPipeline, currentPipeline, }: {
|
|
46
|
+
filePath: ProjectPath;
|
|
47
|
+
isSource: boolean;
|
|
48
|
+
newType: string;
|
|
49
|
+
newPipeline: string | null | undefined;
|
|
50
|
+
currentPipeline: Pipeline;
|
|
51
|
+
}): Promise<Pipeline | null | undefined>;
|
|
52
|
+
loadTransformerConfig(transformer: LoadedPlugin<Transformer<unknown>>, isSource: boolean): Promise<Config | null | undefined>;
|
|
53
|
+
runTransformer(pipeline: Pipeline, asset: UncommittedAsset, transformer: Transformer<unknown>, transformerName: string, preloadedConfig: Config | null | undefined, configKeyPath: string | null | undefined, atlaspackConfig: AtlaspackConfig): Promise<ReadonlyArray<TransformerResult | UncommittedAsset>>;
|
|
54
|
+
}
|
|
55
|
+
type Pipeline = {
|
|
56
|
+
id: string;
|
|
57
|
+
transformers: Array<TransformerWithNameAndConfig>;
|
|
58
|
+
options: AtlaspackOptions;
|
|
59
|
+
pluginOptions: PluginOptions;
|
|
60
|
+
workerApi: WorkerApi;
|
|
61
|
+
postProcess?: PostProcessFunc;
|
|
62
|
+
generate?: GenerateFunc;
|
|
63
|
+
};
|
|
64
|
+
type TransformerWithNameAndConfig = {
|
|
65
|
+
name: PackageName;
|
|
66
|
+
plugin: Transformer<unknown>;
|
|
67
|
+
config: Config | null | undefined;
|
|
68
|
+
configKeyPath?: string;
|
|
69
|
+
resolveFrom: ProjectPath;
|
|
70
|
+
range?: SemverRange | null | undefined;
|
|
71
|
+
};
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { AST, Blob, DependencyOptions, FileCreateInvalidation, GenerateOutput, PackageName, TransformerResult } from '@atlaspack/types';
|
|
2
|
+
import type { Asset, Dependency, AtlaspackOptions, Invalidations } from './types';
|
|
3
|
+
import { Readable } from 'stream';
|
|
4
|
+
import SourceMap from '@parcel/source-map';
|
|
5
|
+
import { ProjectPath } from './projectPath';
|
|
6
|
+
type UncommittedAssetOptions = {
|
|
7
|
+
value: Asset;
|
|
8
|
+
options: AtlaspackOptions;
|
|
9
|
+
content?: Blob | null | undefined;
|
|
10
|
+
mapBuffer?: Buffer | null | undefined;
|
|
11
|
+
ast?: AST | null | undefined;
|
|
12
|
+
isASTDirty?: boolean | null | undefined;
|
|
13
|
+
code?: string | null | undefined;
|
|
14
|
+
invalidations?: Invalidations;
|
|
15
|
+
};
|
|
16
|
+
export default class UncommittedAsset {
|
|
17
|
+
value: Asset;
|
|
18
|
+
options: AtlaspackOptions;
|
|
19
|
+
content: Blob | Promise<Buffer> | null | undefined;
|
|
20
|
+
mapBuffer: Buffer | null | undefined;
|
|
21
|
+
sourceContent: string | null | undefined;
|
|
22
|
+
map: SourceMap | null | undefined;
|
|
23
|
+
ast: AST | null | undefined;
|
|
24
|
+
isASTDirty: boolean;
|
|
25
|
+
code: string | null | undefined;
|
|
26
|
+
invalidations: Invalidations;
|
|
27
|
+
generate: (() => Promise<GenerateOutput>) | null | undefined;
|
|
28
|
+
constructor({ value, options, content, mapBuffer, ast, isASTDirty, code, invalidations, }: UncommittedAssetOptions);
|
|
29
|
+
commit(): Promise<void>;
|
|
30
|
+
commitContent(contentKey: string): Promise<{
|
|
31
|
+
size: number;
|
|
32
|
+
hash: string;
|
|
33
|
+
}>;
|
|
34
|
+
getCode(): Promise<string>;
|
|
35
|
+
getBuffer(): Promise<Buffer>;
|
|
36
|
+
getStream(): Readable;
|
|
37
|
+
setCode(code: string): void;
|
|
38
|
+
setBuffer(buffer: Buffer): void;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated This has been broken on any cache other than FSCache for a long time.
|
|
41
|
+
*/
|
|
42
|
+
setStream(stream: Readable): void;
|
|
43
|
+
loadExistingSourcemap(): Promise<SourceMap | null | undefined>;
|
|
44
|
+
getMapBuffer(): Promise<Buffer | null | undefined>;
|
|
45
|
+
getMap(): Promise<SourceMap | null | undefined>;
|
|
46
|
+
setMap(map?: SourceMap | null): void;
|
|
47
|
+
getAST(): Promise<AST | null | undefined>;
|
|
48
|
+
setAST(ast: AST): void;
|
|
49
|
+
clearAST(): void;
|
|
50
|
+
getCacheKey(key: string): string;
|
|
51
|
+
addDependency(opts: DependencyOptions): string;
|
|
52
|
+
invalidateOnFileChange(filePath: ProjectPath): void;
|
|
53
|
+
invalidateOnFileCreate(invalidation: FileCreateInvalidation): void;
|
|
54
|
+
invalidateOnEnvChange(key: string): void;
|
|
55
|
+
invalidateOnBuild(): void;
|
|
56
|
+
invalidateOnStartup(): void;
|
|
57
|
+
getDependencies(): Array<Dependency>;
|
|
58
|
+
createChildAsset(result: TransformerResult, plugin: PackageName, configPath: ProjectPath, configKeyPath?: string): UncommittedAsset;
|
|
59
|
+
updateId(): void;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { WorkerApi } from '@atlaspack/workers';
|
|
2
|
+
import type { AssetGroup, AtlaspackOptions, ReportFn } from './types';
|
|
3
|
+
import type { Validator, ValidateResult } from '@atlaspack/types';
|
|
4
|
+
import { AtlaspackConfig } from './AtlaspackConfig';
|
|
5
|
+
import UncommittedAsset from './UncommittedAsset';
|
|
6
|
+
export type ValidationOpts = {
|
|
7
|
+
config: AtlaspackConfig;
|
|
8
|
+
/**
|
|
9
|
+
* If true, this Validation instance will run all validators that implement the single-threaded "validateAll" method.
|
|
10
|
+
* If falsy, it will run validators that implement the one-asset-at-a-time "validate" method.
|
|
11
|
+
*/
|
|
12
|
+
dedicatedThread?: boolean;
|
|
13
|
+
options: AtlaspackOptions;
|
|
14
|
+
requests: AssetGroup[];
|
|
15
|
+
report: ReportFn;
|
|
16
|
+
workerApi?: WorkerApi;
|
|
17
|
+
};
|
|
18
|
+
export default class Validation {
|
|
19
|
+
allAssets: {
|
|
20
|
+
[validatorName: string]: UncommittedAsset[];
|
|
21
|
+
};
|
|
22
|
+
allValidators: {
|
|
23
|
+
[validatorName: string]: Validator;
|
|
24
|
+
};
|
|
25
|
+
dedicatedThread: boolean;
|
|
26
|
+
impactfulOptions: Partial<AtlaspackOptions>;
|
|
27
|
+
options: AtlaspackOptions;
|
|
28
|
+
atlaspackConfig: AtlaspackConfig;
|
|
29
|
+
report: ReportFn;
|
|
30
|
+
requests: AssetGroup[];
|
|
31
|
+
workerApi: WorkerApi | null | undefined;
|
|
32
|
+
constructor({ config, dedicatedThread, options, requests, report, workerApi, }: ValidationOpts);
|
|
33
|
+
run(): Promise<void>;
|
|
34
|
+
buildAssetsAndValidators(): Promise<void>;
|
|
35
|
+
handleResults(validatorResults: Array<ValidateResult | null | undefined>): void;
|
|
36
|
+
loadAsset(request: AssetGroup): Promise<UncommittedAsset>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SharedReference } from '@atlaspack/workers';
|
|
2
|
+
import type { Asset, Config, DevDepRequest, AtlaspackOptions, DevDepRequestRef } from './types';
|
|
3
|
+
import type { AtlaspackConfig } from './AtlaspackConfig';
|
|
4
|
+
import type PluginOptions from './public/PluginOptions';
|
|
5
|
+
import type { RequestResult, RunAPI } from './RequestTracker';
|
|
6
|
+
import InternalBundleGraph from './BundleGraph';
|
|
7
|
+
/**
|
|
8
|
+
* The applyRuntimes function is responsible for generating all the runtimes
|
|
9
|
+
* (assets created during the build that don't actually exist on disk) and then
|
|
10
|
+
* linking them into the bundle graph.
|
|
11
|
+
*
|
|
12
|
+
* Introduction of manifest bundles: https://github.com/parcel-bundler/parcel/pull/8837
|
|
13
|
+
* Introduction of reverse topology: https://github.com/parcel-bundler/parcel/pull/8981
|
|
14
|
+
*/
|
|
15
|
+
export default function applyRuntimes<TResult extends RequestResult>({ bundleGraph, config, options, pluginOptions, api, optionsRef, previousDevDeps, devDepRequests, configs, }: {
|
|
16
|
+
bundleGraph: InternalBundleGraph;
|
|
17
|
+
config: AtlaspackConfig;
|
|
18
|
+
options: AtlaspackOptions;
|
|
19
|
+
optionsRef: SharedReference;
|
|
20
|
+
pluginOptions: PluginOptions;
|
|
21
|
+
api: RunAPI<TResult>;
|
|
22
|
+
previousDevDeps: Map<string, string>;
|
|
23
|
+
devDepRequests: Map<string, DevDepRequest | DevDepRequestRef>;
|
|
24
|
+
configs: Map<string, Config>;
|
|
25
|
+
}): Promise<Map<string, Asset>>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ASTGenerator, BundleBehavior, FilePath, GenerateOutput, Meta, PackageName, Stats, SourceLocation } from '@atlaspack/types';
|
|
2
|
+
import type { Asset, RequestInvalidation, Dependency, AtlaspackOptions } from './types';
|
|
3
|
+
import CommittedAsset from './CommittedAsset';
|
|
4
|
+
import UncommittedAsset from './UncommittedAsset';
|
|
5
|
+
import { ProjectPath } from './projectPath';
|
|
6
|
+
import type { EnvironmentRef } from './EnvironmentManager';
|
|
7
|
+
export type AssetOptions = {
|
|
8
|
+
id?: string;
|
|
9
|
+
committed?: boolean;
|
|
10
|
+
code: string | undefined | null;
|
|
11
|
+
filePath: ProjectPath;
|
|
12
|
+
query?: string | null | undefined;
|
|
13
|
+
type: string;
|
|
14
|
+
contentKey?: string | null | undefined;
|
|
15
|
+
mapKey?: string | null | undefined;
|
|
16
|
+
astKey?: string | null | undefined;
|
|
17
|
+
astGenerator?: ASTGenerator | null | undefined;
|
|
18
|
+
dependencies?: Map<string, Dependency>;
|
|
19
|
+
bundleBehavior?: BundleBehavior | null | undefined;
|
|
20
|
+
isBundleSplittable?: boolean | null | undefined;
|
|
21
|
+
isSource: boolean;
|
|
22
|
+
env: EnvironmentRef;
|
|
23
|
+
meta?: Meta;
|
|
24
|
+
outputHash?: string | null | undefined;
|
|
25
|
+
pipeline?: string | null | undefined;
|
|
26
|
+
stats: Stats;
|
|
27
|
+
symbols?: Map<symbol, {
|
|
28
|
+
local: symbol;
|
|
29
|
+
loc: SourceLocation | null | undefined;
|
|
30
|
+
meta?: Meta | null | undefined;
|
|
31
|
+
}> | null | undefined;
|
|
32
|
+
sideEffects?: boolean;
|
|
33
|
+
uniqueKey?: string | null | undefined;
|
|
34
|
+
plugin?: PackageName;
|
|
35
|
+
configPath?: ProjectPath;
|
|
36
|
+
configKeyPath?: string;
|
|
37
|
+
};
|
|
38
|
+
export declare function createAssetIdFromOptions(options: AssetOptions): string;
|
|
39
|
+
export declare function createAsset(projectRoot: FilePath, options: AssetOptions): Asset;
|
|
40
|
+
export declare function generateFromAST(asset: CommittedAsset | UncommittedAsset): Promise<GenerateOutput>;
|
|
41
|
+
export declare function getInvalidationId(invalidation: RequestInvalidation): string;
|
|
42
|
+
export declare function getInvalidationHash(invalidations: Array<RequestInvalidation>, options: AtlaspackOptions): Promise<string>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AtlaspackNapi, Lmdb, AtlaspackNapiOptions } from '@atlaspack/rust';
|
|
2
|
+
import type { Event } from '@parcel/watcher';
|
|
3
|
+
import type { NapiWorkerPool as INapiWorkerPool } from '@atlaspack/types';
|
|
4
|
+
export type AtlaspackV3Options = {
|
|
5
|
+
fs?: AtlaspackNapiOptions['fs'];
|
|
6
|
+
packageManager?: AtlaspackNapiOptions['packageManager'];
|
|
7
|
+
threads?: number;
|
|
8
|
+
/**
|
|
9
|
+
* A reference to LMDB lite's rust object
|
|
10
|
+
*/
|
|
11
|
+
lmdb: Lmdb;
|
|
12
|
+
featureFlags?: {
|
|
13
|
+
[key: string]: string | boolean;
|
|
14
|
+
};
|
|
15
|
+
napiWorkerPool?: INapiWorkerPool;
|
|
16
|
+
} & AtlaspackNapiOptions['options'];
|
|
17
|
+
export declare class AtlaspackV3 {
|
|
18
|
+
_atlaspack_napi: AtlaspackNapi;
|
|
19
|
+
_napiWorkerPool: INapiWorkerPool;
|
|
20
|
+
_isDefaultNapiWorkerPool: boolean;
|
|
21
|
+
constructor(atlaspack_napi: AtlaspackNapi, napiWorkerPool: INapiWorkerPool, isDefaultNapiWorkerPool: boolean);
|
|
22
|
+
static create({ fs, packageManager, threads, lmdb, napiWorkerPool, ...options }: AtlaspackV3Options): Promise<AtlaspackV3>;
|
|
23
|
+
end(): void;
|
|
24
|
+
buildAssetGraph(): Promise<any>;
|
|
25
|
+
respondToFsEvents(events: Array<Event>): Promise<boolean>;
|
|
26
|
+
}
|