@atlaspack/core 2.16.2-canary.48 → 2.16.2-canary.481
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1324 -0
- package/dist/AssetGraph.js +523 -0
- package/dist/Atlaspack.js +701 -0
- package/dist/AtlaspackConfig.js +324 -0
- package/dist/AtlaspackConfig.schema.js +117 -0
- package/dist/BundleGraph.js +1906 -0
- package/dist/CommittedAsset.js +142 -0
- package/dist/Dependency.js +125 -0
- package/dist/Environment.js +132 -0
- package/dist/EnvironmentManager.js +108 -0
- package/dist/IdentifierRegistry.js +38 -0
- package/dist/InternalConfig.js +37 -0
- package/dist/PackagerRunner.js +470 -0
- package/dist/ReporterRunner.js +151 -0
- package/dist/RequestTracker.js +1297 -0
- package/dist/SymbolPropagation.js +624 -0
- package/dist/TargetDescriptor.schema.js +146 -0
- package/dist/Transformation.js +514 -0
- package/dist/UncommittedAsset.js +310 -0
- package/dist/Validation.js +196 -0
- package/dist/applyRuntimes.js +384 -0
- package/dist/assetUtils.js +169 -0
- package/dist/atlaspack-v3/AtlaspackV3.js +83 -0
- package/dist/atlaspack-v3/NapiWorkerPool.js +114 -0
- package/dist/atlaspack-v3/fs.js +53 -0
- package/dist/atlaspack-v3/index.js +25 -0
- package/dist/atlaspack-v3/jsCallable.js +16 -0
- package/dist/atlaspack-v3/worker/compat/asset-symbols.js +190 -0
- package/dist/atlaspack-v3/worker/compat/bitflags.js +98 -0
- package/dist/atlaspack-v3/worker/compat/dependency.js +43 -0
- package/dist/atlaspack-v3/worker/compat/environment.js +57 -0
- package/dist/atlaspack-v3/worker/compat/index.js +24 -0
- package/dist/atlaspack-v3/worker/compat/mutable-asset.js +152 -0
- package/dist/atlaspack-v3/worker/compat/plugin-config.js +64 -0
- package/dist/atlaspack-v3/worker/compat/plugin-options.js +137 -0
- package/dist/atlaspack-v3/worker/compat/plugin-tracer.js +10 -0
- package/dist/atlaspack-v3/worker/compat/target.js +14 -0
- package/dist/atlaspack-v3/worker/side-effect-detector.js +243 -0
- package/dist/atlaspack-v3/worker/worker.js +398 -0
- package/dist/constants.js +17 -0
- package/dist/dumpGraphToGraphViz.js +281 -0
- package/dist/index.js +62 -0
- package/dist/loadAtlaspackPlugin.js +128 -0
- package/dist/loadDotEnv.js +41 -0
- package/dist/projectPath.js +83 -0
- package/dist/public/Asset.js +279 -0
- package/dist/public/Bundle.js +224 -0
- package/dist/public/BundleGraph.js +371 -0
- package/dist/public/BundleGroup.js +53 -0
- package/dist/public/Config.js +286 -0
- package/dist/public/Dependency.js +138 -0
- package/dist/public/Environment.js +278 -0
- package/dist/public/MutableBundleGraph.js +277 -0
- package/dist/public/PluginOptions.js +80 -0
- package/dist/public/Symbols.js +248 -0
- package/dist/public/Target.js +69 -0
- package/dist/registerCoreWithSerializer.js +38 -0
- package/dist/requests/AssetGraphRequest.js +430 -0
- package/dist/requests/AssetGraphRequestRust.js +471 -0
- package/dist/requests/AssetRequest.js +130 -0
- package/dist/requests/AtlaspackBuildRequest.js +98 -0
- package/dist/requests/AtlaspackConfigRequest.js +493 -0
- package/dist/requests/BundleGraphRequest.js +381 -0
- package/dist/requests/BundleGraphRequestRust.js +324 -0
- package/dist/requests/BundleGraphRequestUtils.js +262 -0
- package/dist/requests/ConfigRequest.js +246 -0
- package/dist/requests/DevDepRequest.js +204 -0
- package/dist/requests/EntryRequest.js +314 -0
- package/dist/requests/PackageRequest.js +89 -0
- package/dist/requests/PathRequest.js +349 -0
- package/dist/requests/TargetRequest.js +1316 -0
- package/dist/requests/ValidationRequest.js +49 -0
- package/dist/requests/WriteBundleRequest.js +522 -0
- package/dist/requests/WriteBundlesRequest.js +190 -0
- package/dist/requests/asset-graph-diff.js +128 -0
- package/dist/requests/asset-graph-dot.js +131 -0
- package/dist/resolveOptions.js +267 -0
- package/dist/rustWorkerThreadDylibHack.js +19 -0
- package/dist/serializerCore.browser.js +43 -0
- package/dist/summarizeRequest.js +39 -0
- package/dist/types.js +31 -0
- package/dist/utils.js +172 -0
- package/dist/worker.js +123 -0
- package/lib/AssetGraph.js +53 -15
- package/lib/Atlaspack.js +140 -56
- package/lib/AtlaspackConfig.js +17 -6
- package/lib/AtlaspackConfig.schema.js +16 -5
- package/lib/BundleGraph.js +390 -43
- package/lib/CommittedAsset.js +8 -2
- package/lib/Dependency.js +9 -3
- package/lib/Environment.js +16 -10
- package/lib/EnvironmentManager.js +143 -0
- package/lib/IdentifierRegistry.js +2 -4
- package/lib/InternalConfig.js +3 -2
- package/lib/PackagerRunner.js +46 -82
- package/lib/ReporterRunner.js +8 -12
- package/lib/RequestTracker.js +191 -152
- package/lib/SymbolPropagation.js +52 -29
- package/lib/TargetDescriptor.schema.js +10 -1
- package/lib/Transformation.js +68 -19
- package/lib/UncommittedAsset.js +17 -24
- package/lib/Validation.js +20 -5
- package/lib/applyRuntimes.js +98 -7
- package/lib/assetUtils.js +16 -6
- package/lib/atlaspack-v3/AtlaspackV3.js +58 -15
- package/lib/atlaspack-v3/NapiWorkerPool.js +63 -2
- package/lib/atlaspack-v3/fs.js +4 -1
- package/lib/atlaspack-v3/index.js +28 -1
- package/lib/atlaspack-v3/jsCallable.js +0 -2
- package/lib/atlaspack-v3/worker/compat/asset-symbols.js +7 -4
- package/lib/atlaspack-v3/worker/compat/bitflags.js +31 -25
- package/lib/atlaspack-v3/worker/compat/dependency.js +4 -1
- package/lib/atlaspack-v3/worker/compat/environment.js +10 -7
- package/lib/atlaspack-v3/worker/compat/index.js +0 -11
- package/lib/atlaspack-v3/worker/compat/mutable-asset.js +16 -11
- package/lib/atlaspack-v3/worker/compat/plugin-config.js +14 -35
- package/lib/atlaspack-v3/worker/compat/plugin-options.js +16 -2
- package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +3 -0
- package/lib/atlaspack-v3/worker/compat/target.js +2 -0
- package/lib/atlaspack-v3/worker/index.js +3 -0
- package/lib/atlaspack-v3/worker/side-effect-detector.js +214 -0
- package/lib/atlaspack-v3/worker/worker.js +231 -79
- package/lib/constants.js +0 -1
- package/lib/dumpGraphToGraphViz.js +72 -17
- package/lib/index.js +46 -3
- package/lib/loadAtlaspackPlugin.js +2 -3
- package/lib/loadDotEnv.js +5 -2
- package/lib/projectPath.js +6 -1
- package/lib/public/Asset.js +22 -12
- package/lib/public/Bundle.js +16 -18
- package/lib/public/BundleGraph.js +27 -25
- package/lib/public/BundleGroup.js +5 -6
- package/lib/public/Config.js +118 -18
- package/lib/public/Dependency.js +9 -7
- package/lib/public/Environment.js +13 -8
- package/lib/public/MutableBundleGraph.js +56 -15
- package/lib/public/PluginOptions.js +2 -2
- package/lib/public/Symbols.js +12 -12
- package/lib/public/Target.js +8 -7
- package/lib/registerCoreWithSerializer.js +7 -4
- package/lib/requests/AssetGraphRequest.js +61 -40
- package/lib/requests/AssetGraphRequestRust.js +314 -82
- package/lib/requests/AssetRequest.js +24 -7
- package/lib/requests/AtlaspackBuildRequest.js +53 -7
- package/lib/requests/AtlaspackConfigRequest.js +29 -19
- package/lib/requests/BundleGraphRequest.js +61 -130
- package/lib/requests/BundleGraphRequestRust.js +381 -0
- package/lib/requests/BundleGraphRequestUtils.js +280 -0
- package/lib/requests/ConfigRequest.js +55 -7
- package/lib/requests/DevDepRequest.js +32 -6
- package/lib/requests/EntryRequest.js +4 -3
- package/lib/requests/PackageRequest.js +56 -12
- package/lib/requests/PathRequest.js +26 -6
- package/lib/requests/TargetRequest.js +129 -60
- package/lib/requests/ValidationRequest.js +6 -2
- package/lib/requests/WriteBundleRequest.js +329 -20
- package/lib/requests/WriteBundlesRequest.js +64 -10
- package/lib/requests/asset-graph-diff.js +13 -8
- package/lib/requests/asset-graph-dot.js +2 -8
- package/lib/resolveOptions.js +37 -14
- package/lib/rustWorkerThreadDylibHack.js +0 -1
- package/lib/serializerCore.browser.js +1 -2
- package/lib/summarizeRequest.js +1 -1
- package/lib/types/AssetGraph.d.ts +55 -0
- package/lib/types/Atlaspack.d.ts +52 -0
- package/lib/types/AtlaspackConfig.d.ts +65 -0
- package/lib/types/AtlaspackConfig.schema.d.ts +53 -0
- package/lib/types/BundleGraph.d.ts +232 -0
- package/lib/types/CommittedAsset.d.ts +23 -0
- package/lib/types/Dependency.d.ts +44 -0
- package/lib/types/Environment.d.ts +11 -0
- package/lib/types/EnvironmentManager.d.ts +37 -0
- package/lib/types/IdentifierRegistry.d.ts +6 -0
- package/lib/types/InternalConfig.d.ts +23 -0
- package/lib/types/PackagerRunner.d.ts +85 -0
- package/lib/types/ReporterRunner.d.ts +25 -0
- package/lib/types/RequestTracker.d.ts +385 -0
- package/lib/types/SymbolPropagation.d.ts +11 -0
- package/lib/types/TargetDescriptor.schema.d.ts +5 -0
- package/lib/types/Transformation.d.ts +72 -0
- package/lib/types/UncommittedAsset.d.ts +61 -0
- package/lib/types/Validation.d.ts +37 -0
- package/lib/types/applyRuntimes.d.ts +25 -0
- package/lib/types/assetUtils.d.ts +42 -0
- package/lib/types/atlaspack-v3/AtlaspackV3.d.ts +35 -0
- package/lib/types/atlaspack-v3/NapiWorkerPool.d.ts +13 -0
- package/lib/types/atlaspack-v3/fs.d.ts +13 -0
- package/lib/types/atlaspack-v3/index.d.ts +6 -0
- package/lib/types/atlaspack-v3/jsCallable.d.ts +1 -0
- package/lib/types/atlaspack-v3/worker/compat/asset-symbols.d.ts +51 -0
- package/lib/types/atlaspack-v3/worker/compat/bitflags.d.ts +14 -0
- package/lib/types/atlaspack-v3/worker/compat/dependency.d.ts +25 -0
- package/lib/types/atlaspack-v3/worker/compat/environment.d.ts +27 -0
- package/{src/atlaspack-v3/worker/compat/index.js → lib/types/atlaspack-v3/worker/compat/index.d.ts} +0 -2
- package/lib/types/atlaspack-v3/worker/compat/mutable-asset.d.ts +49 -0
- package/lib/types/atlaspack-v3/worker/compat/plugin-config.d.ts +29 -0
- package/lib/types/atlaspack-v3/worker/compat/plugin-options.d.ts +23 -0
- package/lib/types/atlaspack-v3/worker/compat/plugin-tracer.d.ts +5 -0
- package/lib/types/atlaspack-v3/worker/compat/target.d.ts +11 -0
- package/lib/types/atlaspack-v3/worker/side-effect-detector.d.ts +76 -0
- package/lib/types/atlaspack-v3/worker/worker.d.ts +81 -0
- package/lib/types/constants.d.ts +13 -0
- package/lib/types/dumpGraphToGraphViz.d.ts +10 -0
- package/lib/types/index.d.ts +8 -0
- package/lib/types/loadAtlaspackPlugin.d.ts +8 -0
- package/lib/types/loadDotEnv.d.ts +3 -0
- package/lib/types/projectPath.d.ts +19 -0
- package/lib/types/public/Asset.d.ts +74 -0
- package/lib/types/public/Bundle.d.ts +45 -0
- package/lib/types/public/BundleGraph.d.ts +72 -0
- package/lib/types/public/BundleGroup.d.ts +12 -0
- package/lib/types/public/Config.d.ts +75 -0
- package/lib/types/public/Dependency.d.ts +32 -0
- package/lib/types/public/Environment.d.ts +34 -0
- package/lib/types/public/MutableBundleGraph.d.ts +26 -0
- package/lib/types/public/PluginOptions.d.ts +25 -0
- package/lib/types/public/Symbols.d.ts +81 -0
- package/lib/types/public/Target.d.ts +16 -0
- package/lib/types/registerCoreWithSerializer.d.ts +2 -0
- package/lib/types/requests/AssetGraphRequest.d.ts +76 -0
- package/lib/types/requests/AssetGraphRequestRust.d.ts +21 -0
- package/lib/types/requests/AssetRequest.d.ts +16 -0
- package/lib/types/requests/AtlaspackBuildRequest.d.ts +33 -0
- package/lib/types/requests/AtlaspackConfigRequest.d.ts +45 -0
- package/lib/types/requests/BundleGraphRequest.d.ts +28 -0
- package/lib/types/requests/BundleGraphRequestRust.d.ts +34 -0
- package/lib/types/requests/BundleGraphRequestUtils.d.ts +38 -0
- package/lib/types/requests/ConfigRequest.d.ts +67 -0
- package/lib/types/requests/DevDepRequest.d.ts +30 -0
- package/lib/types/requests/EntryRequest.d.ts +36 -0
- package/lib/types/requests/PackageRequest.d.ts +27 -0
- package/lib/types/requests/PathRequest.d.ts +48 -0
- package/lib/types/requests/TargetRequest.d.ts +48 -0
- package/lib/types/requests/ValidationRequest.d.ts +20 -0
- package/lib/types/requests/WriteBundleRequest.d.ts +80 -0
- package/lib/types/requests/WriteBundlesRequest.d.ts +32 -0
- package/lib/types/requests/asset-graph-diff.d.ts +1 -0
- package/lib/types/requests/asset-graph-dot.d.ts +9 -0
- package/lib/types/resolveOptions.d.ts +3 -0
- package/lib/types/rustWorkerThreadDylibHack.d.ts +9 -0
- package/lib/types/serializerCore.browser.d.ts +3 -0
- package/lib/types/summarizeRequest.d.ts +10 -0
- package/lib/types/types.d.ts +496 -0
- package/lib/types/utils.d.ts +23 -0
- package/lib/types/worker.d.ts +44 -0
- package/lib/types.js +8 -1
- package/lib/utils.js +18 -3
- package/lib/worker.js +32 -15
- package/package.json +26 -36
- package/src/{AssetGraph.js → AssetGraph.ts} +87 -51
- package/src/{Atlaspack.js → Atlaspack.ts} +181 -72
- package/src/{AtlaspackConfig.schema.js → AtlaspackConfig.schema.ts} +25 -19
- package/src/{AtlaspackConfig.js → AtlaspackConfig.ts} +78 -54
- package/src/{BundleGraph.js → BundleGraph.ts} +575 -145
- package/src/{CommittedAsset.js → CommittedAsset.ts} +15 -13
- package/src/{Dependency.js → Dependency.ts} +59 -42
- package/src/{Environment.js → Environment.ts} +24 -15
- package/src/EnvironmentManager.ts +154 -0
- package/src/{IdentifierRegistry.js → IdentifierRegistry.ts} +1 -4
- package/src/{InternalConfig.js → InternalConfig.ts} +22 -23
- package/src/{PackagerRunner.js → PackagerRunner.ts} +114 -159
- package/src/{ReporterRunner.js → ReporterRunner.ts} +13 -18
- package/src/{RequestTracker.js → RequestTracker.ts} +444 -355
- package/src/{SymbolPropagation.js → SymbolPropagation.ts} +178 -61
- package/src/{TargetDescriptor.schema.js → TargetDescriptor.schema.ts} +10 -1
- package/src/{Transformation.js → Transformation.ts} +110 -65
- package/src/{UncommittedAsset.js → UncommittedAsset.ts} +45 -49
- package/src/{Validation.js → Validation.ts} +32 -17
- package/src/{applyRuntimes.js → applyRuntimes.ts} +135 -26
- package/src/{assetUtils.js → assetUtils.ts} +49 -36
- package/src/atlaspack-v3/AtlaspackV3.ts +183 -0
- package/src/atlaspack-v3/NapiWorkerPool.ts +129 -0
- package/src/atlaspack-v3/{fs.js → fs.ts} +8 -4
- package/src/atlaspack-v3/{index.js → index.ts} +3 -4
- package/src/atlaspack-v3/jsCallable.ts +14 -0
- package/src/atlaspack-v3/worker/compat/{asset-symbols.js → asset-symbols.ts} +40 -30
- package/src/atlaspack-v3/worker/compat/bitflags.ts +102 -0
- package/src/atlaspack-v3/worker/compat/{dependency.js → dependency.ts} +13 -13
- package/src/atlaspack-v3/worker/compat/{environment.js → environment.ts} +13 -9
- package/src/atlaspack-v3/worker/compat/index.ts +8 -0
- package/src/atlaspack-v3/worker/compat/{mutable-asset.js → mutable-asset.ts} +21 -20
- package/src/atlaspack-v3/worker/compat/{plugin-config.js → plugin-config.ts} +25 -56
- package/src/atlaspack-v3/worker/compat/{plugin-options.js → plugin-options.ts} +19 -5
- package/src/atlaspack-v3/worker/compat/{plugin-tracer.js → plugin-tracer.ts} +2 -2
- package/src/atlaspack-v3/worker/compat/{target.js → target.ts} +3 -4
- package/src/atlaspack-v3/worker/index.js +2 -1
- package/src/atlaspack-v3/worker/side-effect-detector.ts +298 -0
- package/src/atlaspack-v3/worker/worker.ts +548 -0
- package/src/{constants.js → constants.ts} +0 -3
- package/src/{dumpGraphToGraphViz.js → dumpGraphToGraphViz.ts} +73 -28
- package/src/index.ts +18 -0
- package/src/{loadAtlaspackPlugin.js → loadAtlaspackPlugin.ts} +8 -9
- package/src/{loadDotEnv.js → loadDotEnv.ts} +2 -2
- package/src/{projectPath.js → projectPath.ts} +20 -9
- package/src/public/{Asset.js → Asset.ts} +41 -28
- package/src/public/{Bundle.js → Bundle.ts} +28 -29
- package/src/public/{BundleGraph.js → BundleGraph.ts} +103 -68
- package/src/public/{BundleGroup.js → BundleGroup.ts} +7 -10
- package/src/public/{Config.js → Config.ts} +171 -33
- package/src/public/{Dependency.js → Dependency.ts} +20 -17
- package/src/public/{Environment.js → Environment.ts} +28 -17
- package/src/public/{MutableBundleGraph.js → MutableBundleGraph.ts} +55 -24
- package/src/public/{PluginOptions.js → PluginOptions.ts} +6 -6
- package/src/public/{Symbols.js → Symbols.ts} +75 -36
- package/src/public/{Target.js → Target.ts} +10 -8
- package/src/{registerCoreWithSerializer.js → registerCoreWithSerializer.ts} +9 -7
- package/src/requests/{AssetGraphRequest.js → AssetGraphRequest.ts} +117 -90
- package/src/requests/AssetGraphRequestRust.ts +557 -0
- package/src/requests/{AssetRequest.js → AssetRequest.ts} +24 -18
- package/src/requests/AtlaspackBuildRequest.ts +168 -0
- package/src/requests/{AtlaspackConfigRequest.js → AtlaspackConfigRequest.ts} +72 -58
- package/src/requests/{BundleGraphRequest.js → BundleGraphRequest.ts} +119 -199
- package/src/requests/BundleGraphRequestRust.ts +470 -0
- package/src/requests/BundleGraphRequestUtils.ts +323 -0
- package/src/requests/{ConfigRequest.js → ConfigRequest.ts} +110 -50
- package/src/requests/{DevDepRequest.js → DevDepRequest.ts} +60 -35
- package/src/requests/{EntryRequest.js → EntryRequest.ts} +36 -31
- package/src/requests/{PackageRequest.js → PackageRequest.ts} +52 -25
- package/src/requests/{PathRequest.js → PathRequest.ts} +47 -37
- package/src/requests/{TargetRequest.js → TargetRequest.ts} +265 -179
- package/src/requests/{ValidationRequest.js → ValidationRequest.ts} +18 -17
- package/src/requests/WriteBundleRequest.ts +734 -0
- package/src/requests/{WriteBundlesRequest.js → WriteBundlesRequest.ts} +134 -50
- package/src/requests/{asset-graph-diff.js → asset-graph-diff.ts} +25 -21
- package/src/requests/{asset-graph-dot.js → asset-graph-dot.ts} +8 -12
- package/src/{resolveOptions.js → resolveOptions.ts} +57 -27
- package/src/{rustWorkerThreadDylibHack.js → rustWorkerThreadDylibHack.ts} +1 -4
- package/src/{serializerCore.browser.js → serializerCore.browser.ts} +2 -3
- package/src/{summarizeRequest.js → summarizeRequest.ts} +17 -5
- package/src/types.ts +651 -0
- package/src/{utils.js → utils.ts} +52 -21
- package/src/{worker.js → worker.ts} +50 -42
- package/test/{AssetGraph.test.js → AssetGraph.test.ts} +5 -8
- package/test/{Atlaspack.test.js → Atlaspack.test.ts} +5 -10
- package/test/{AtlaspackConfig.test.js → AtlaspackConfig.test.ts} +0 -5
- package/test/{AtlaspackConfigRequest.test.js → AtlaspackConfigRequest.test.ts} +76 -16
- package/test/{BundleGraph.test.js → BundleGraph.test.ts} +8 -13
- package/test/{Dependency.test.js → Dependency.test.ts} +2 -3
- package/test/{EntryRequest.test.js → EntryRequest.test.ts} +1 -6
- package/test/Environment.test.ts +153 -0
- package/test/EnvironmentManager.test.ts +188 -0
- package/test/{IdentifierRegistry.test.js → IdentifierRegistry.test.ts} +2 -4
- package/test/{InternalAsset.test.js → InternalAsset.test.ts} +2 -7
- package/test/PackagerRunner.test.ts +0 -0
- package/test/{PublicAsset.test.js → PublicAsset.test.ts} +2 -7
- package/test/{PublicBundle.test.js → PublicBundle.test.ts} +1 -2
- package/test/{PublicDependency.test.js → PublicDependency.test.ts} +0 -2
- package/test/PublicEnvironment.test.ts +49 -0
- package/test/{PublicMutableBundleGraph.test.js → PublicMutableBundleGraph.test.ts} +6 -11
- package/test/{RequestTracker.test.js → RequestTracker.test.ts} +136 -58
- package/test/{SymbolPropagation.test.js → SymbolPropagation.test.ts} +124 -74
- package/test/{TargetRequest.test.js → TargetRequest.test.ts} +91 -92
- package/test/fixtures/config-with-reporters/.parcelrc +7 -0
- package/test/fixtures/custom-targets/package.json +6 -0
- package/test/public/Config.test.ts +104 -0
- package/test/requests/AssetGraphRequestRust.test.ts +443 -0
- package/test/requests/{ConfigRequest.test.js → ConfigRequest.test.ts} +202 -13
- package/test/requests/{DevDepRequest.test.js → DevDepRequest.test.ts} +0 -2
- package/test/requests/WriteBundleRequest.test.ts +602 -0
- package/test/{test-utils.js → test-utils.ts} +3 -4
- package/test/{utils.test.js → utils.test.ts} +1 -3
- package/tsconfig.json +60 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/index.d.ts +0 -30
- package/lib/atlaspack-v3/worker/compat/plugin-logger.js +0 -29
- package/src/atlaspack-v3/AtlaspackV3.js +0 -87
- package/src/atlaspack-v3/NapiWorkerPool.js +0 -53
- package/src/atlaspack-v3/jsCallable.js +0 -18
- package/src/atlaspack-v3/worker/compat/bitflags.js +0 -100
- package/src/atlaspack-v3/worker/compat/plugin-logger.js +0 -47
- package/src/atlaspack-v3/worker/worker.js +0 -369
- package/src/index.js +0 -13
- package/src/requests/AssetGraphRequestRust.js +0 -263
- package/src/requests/AtlaspackBuildRequest.js +0 -111
- package/src/requests/WriteBundleRequest.js +0 -369
- package/src/types.js +0 -600
- package/test/Environment.test.js +0 -119
- package/test/PackagerRunner.test.js +0 -27
- package/test/PublicEnvironment.test.js +0 -27
- package/test/requests/AssetGraphRequestRust.test.js +0 -411
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { FilePath, Meta, DependencySpecifier, SourceLocation, BundleBehavior as IBundleBehavior, SemverRange } from '@atlaspack/types';
|
|
2
|
+
import type { Dependency, Target } from './types';
|
|
3
|
+
import { SpecifierType, Priority } from './types';
|
|
4
|
+
import type { EnvironmentRef } from './EnvironmentManager';
|
|
5
|
+
type DependencyOpts = {
|
|
6
|
+
id?: string;
|
|
7
|
+
sourcePath?: FilePath;
|
|
8
|
+
sourceAssetId?: string;
|
|
9
|
+
specifier: DependencySpecifier;
|
|
10
|
+
specifierType: keyof typeof SpecifierType;
|
|
11
|
+
priority?: keyof typeof Priority;
|
|
12
|
+
needsStableName?: boolean;
|
|
13
|
+
bundleBehavior?: IBundleBehavior | null | undefined;
|
|
14
|
+
isEntry?: boolean;
|
|
15
|
+
isOptional?: boolean;
|
|
16
|
+
loc?: SourceLocation;
|
|
17
|
+
env: EnvironmentRef;
|
|
18
|
+
packageConditions?: Array<string>;
|
|
19
|
+
meta?: Meta;
|
|
20
|
+
resolveFrom?: FilePath;
|
|
21
|
+
range?: SemverRange;
|
|
22
|
+
target?: Target;
|
|
23
|
+
symbols?: Map<symbol, {
|
|
24
|
+
local: symbol;
|
|
25
|
+
loc: SourceLocation | null | undefined;
|
|
26
|
+
isWeak: boolean;
|
|
27
|
+
meta?: Meta | null | undefined;
|
|
28
|
+
}> | null | undefined;
|
|
29
|
+
pipeline?: string | null | undefined;
|
|
30
|
+
};
|
|
31
|
+
export declare function createDependencyId({ sourceAssetId, specifier, env, target, pipeline, specifierType, bundleBehavior, priority, packageConditions, }: {
|
|
32
|
+
sourceAssetId?: string | undefined;
|
|
33
|
+
specifier: DependencySpecifier;
|
|
34
|
+
env: EnvironmentRef;
|
|
35
|
+
target?: Target | undefined;
|
|
36
|
+
pipeline?: string | null | undefined;
|
|
37
|
+
specifierType: keyof typeof SpecifierType;
|
|
38
|
+
bundleBehavior?: IBundleBehavior | null | undefined;
|
|
39
|
+
priority?: keyof typeof Priority | undefined;
|
|
40
|
+
packageConditions?: Array<string> | undefined;
|
|
41
|
+
}): string;
|
|
42
|
+
export declare function createDependency(projectRoot: FilePath, opts: DependencyOpts): Dependency;
|
|
43
|
+
export declare function mergeDependencies(a: Dependency, b: Dependency): void;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EnvironmentOptions, Environment as IEnvironment, FilePath, EnvMap } from '@atlaspack/types';
|
|
2
|
+
import type { Environment, InternalSourceLocation } from './types';
|
|
3
|
+
import type { EnvironmentRef } from './EnvironmentManager';
|
|
4
|
+
type EnvironmentOpts = EnvironmentOptions & {
|
|
5
|
+
loc?: InternalSourceLocation | null | undefined;
|
|
6
|
+
customEnv?: EnvMap | null | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare function createEnvironment({ context, engines, includeNodeModules, outputFormat, sourceType, shouldOptimize, isLibrary, shouldScopeHoist, sourceMap, unstableSingleFileOutput, loc, customEnv, }?: EnvironmentOpts): EnvironmentRef;
|
|
9
|
+
export declare function mergeEnvironments(projectRoot: FilePath, a: Environment, b?: EnvironmentOptions | IEnvironment | null): EnvironmentRef;
|
|
10
|
+
export declare function getEnvironmentHash(env: Environment): string;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* At the moment we're doing this change for `CoreEnvironment`,
|
|
3
|
+
* but the same change must be made for `TypesEnvironment` in @atlaspack/types.
|
|
4
|
+
*/
|
|
5
|
+
import type { Environment as CoreEnvironment } from './types';
|
|
6
|
+
import { Cache } from '@atlaspack/cache';
|
|
7
|
+
export type EnvironmentId = string;
|
|
8
|
+
/**
|
|
9
|
+
* When deduplication is cleaned-up this will always be a string.
|
|
10
|
+
*/
|
|
11
|
+
export type EnvironmentRef = EnvironmentId | CoreEnvironment;
|
|
12
|
+
/**
|
|
13
|
+
* Convert environment to a ref.
|
|
14
|
+
* This is what we should be using to store environments.
|
|
15
|
+
*/
|
|
16
|
+
export declare function toEnvironmentRef(env: CoreEnvironment): EnvironmentRef;
|
|
17
|
+
/**
|
|
18
|
+
* Convert environment to a string ID
|
|
19
|
+
*/
|
|
20
|
+
export declare function toEnvironmentId(
|
|
21
|
+
/**
|
|
22
|
+
* Redundant type during roll-out
|
|
23
|
+
*/
|
|
24
|
+
env: CoreEnvironment | EnvironmentRef): string;
|
|
25
|
+
export declare function fromEnvironmentId(id: EnvironmentRef): CoreEnvironment;
|
|
26
|
+
/**
|
|
27
|
+
* Writes all environments and their IDs to the cache
|
|
28
|
+
* @param {Cache} cache
|
|
29
|
+
* @returns {Promise<void>}
|
|
30
|
+
*/
|
|
31
|
+
export declare function writeEnvironmentsToCache(cache: Cache): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Loads all environments and their IDs from the cache
|
|
34
|
+
* @param {Cache} cache
|
|
35
|
+
* @returns {Promise<void>}
|
|
36
|
+
*/
|
|
37
|
+
export declare function loadEnvironmentsFromCache(cache: Cache): Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PackageName, ConfigResult } from '@atlaspack/types';
|
|
2
|
+
import type { Config, InternalFileCreateInvalidation, InternalDevDepOptions } from './types';
|
|
3
|
+
import type { ProjectPath } from './projectPath';
|
|
4
|
+
import type { EnvironmentRef } from './EnvironmentManager';
|
|
5
|
+
export type ConfigOpts = {
|
|
6
|
+
plugin: PackageName;
|
|
7
|
+
searchPath: ProjectPath;
|
|
8
|
+
isSource?: boolean;
|
|
9
|
+
env?: EnvironmentRef;
|
|
10
|
+
result?: ConfigResult;
|
|
11
|
+
invalidateOnFileChange?: Set<ProjectPath>;
|
|
12
|
+
invalidateOnConfigKeyChange?: Array<{
|
|
13
|
+
filePath: ProjectPath;
|
|
14
|
+
configKey: string[];
|
|
15
|
+
}>;
|
|
16
|
+
invalidateOnFileCreate?: Array<InternalFileCreateInvalidation>;
|
|
17
|
+
invalidateOnEnvChange?: Set<string>;
|
|
18
|
+
invalidateOnOptionChange?: Set<string>;
|
|
19
|
+
devDeps?: Array<InternalDevDepOptions>;
|
|
20
|
+
invalidateOnStartup?: boolean;
|
|
21
|
+
invalidateOnBuild?: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare function createConfig({ plugin, isSource, searchPath, env, result, invalidateOnFileChange, invalidateOnConfigKeyChange, invalidateOnFileCreate, invalidateOnEnvChange, invalidateOnOptionChange, devDeps, invalidateOnStartup, invalidateOnBuild, }: ConfigOpts): Config;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { Blob, FilePath, BundleResult, Async } from '@atlaspack/types';
|
|
2
|
+
import type SourceMap from '@atlaspack/source-map';
|
|
3
|
+
import type { Bundle as InternalBundle, Config, DevDepRequest, AtlaspackOptions, ReportFn, RequestInvalidation, DevDepRequestRef } from './types';
|
|
4
|
+
import type { AtlaspackConfig, LoadedPlugin } from './AtlaspackConfig';
|
|
5
|
+
import type InternalBundleGraph from './BundleGraph';
|
|
6
|
+
import type { ConfigRequest } from './requests/ConfigRequest';
|
|
7
|
+
import type { DevDepSpecifier } from './requests/DevDepRequest';
|
|
8
|
+
import { Readable } from 'stream';
|
|
9
|
+
import { NamedBundle } from './public/Bundle';
|
|
10
|
+
import PluginOptions from './public/PluginOptions';
|
|
11
|
+
import { PluginWithBundleConfig } from './requests/ConfigRequest';
|
|
12
|
+
type Opts = {
|
|
13
|
+
config: AtlaspackConfig;
|
|
14
|
+
options: AtlaspackOptions;
|
|
15
|
+
report: ReportFn;
|
|
16
|
+
previousDevDeps: Map<string, string>;
|
|
17
|
+
previousInvalidations: Array<RequestInvalidation>;
|
|
18
|
+
};
|
|
19
|
+
export type RunPackagerRunnerResult = {
|
|
20
|
+
bundleInfo: BundleInfo;
|
|
21
|
+
configRequests: Array<ConfigRequest>;
|
|
22
|
+
devDepRequests: Array<DevDepRequest | DevDepRequestRef>;
|
|
23
|
+
invalidations: Array<RequestInvalidation>;
|
|
24
|
+
};
|
|
25
|
+
export type BundleInfo = {
|
|
26
|
+
readonly type: string;
|
|
27
|
+
readonly size: number;
|
|
28
|
+
readonly hash: string;
|
|
29
|
+
readonly hashReferences: Array<string>;
|
|
30
|
+
readonly time?: number;
|
|
31
|
+
readonly cacheKeys: CacheKeyMap;
|
|
32
|
+
readonly isLargeBlob: boolean;
|
|
33
|
+
readonly scopeHoistingStats?: {
|
|
34
|
+
totalAssets: number;
|
|
35
|
+
wrappedAssets: number;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
type CacheKeyMap = {
|
|
39
|
+
content: string;
|
|
40
|
+
map: string;
|
|
41
|
+
info: string;
|
|
42
|
+
};
|
|
43
|
+
export default class PackagerRunner {
|
|
44
|
+
config: AtlaspackConfig;
|
|
45
|
+
options: AtlaspackOptions;
|
|
46
|
+
pluginOptions: PluginOptions;
|
|
47
|
+
distDir: FilePath;
|
|
48
|
+
distExists: Set<FilePath>;
|
|
49
|
+
report: ReportFn;
|
|
50
|
+
previousDevDeps: Map<string, string>;
|
|
51
|
+
devDepRequests: Map<string, DevDepRequest | DevDepRequestRef>;
|
|
52
|
+
invalidations: Map<string, RequestInvalidation>;
|
|
53
|
+
previousInvalidations: Array<RequestInvalidation>;
|
|
54
|
+
constructor({ config, options, report, previousDevDeps, previousInvalidations, }: Opts);
|
|
55
|
+
run(bundleGraph: InternalBundleGraph, bundle: InternalBundle, invalidDevDeps: Array<DevDepSpecifier>): Promise<RunPackagerRunnerResult>;
|
|
56
|
+
loadConfigs(bundleGraph: InternalBundleGraph, bundle: InternalBundle): Promise<{
|
|
57
|
+
configs: Map<string, Config>;
|
|
58
|
+
bundleConfigs: Map<string, Config>;
|
|
59
|
+
}>;
|
|
60
|
+
loadConfig(bundleGraph: InternalBundleGraph, bundle: InternalBundle, configs: Map<string, Config>, bundleConfigs: Map<string, Config>): Promise<void>;
|
|
61
|
+
loadPluginConfig<T extends PluginWithBundleConfig>(bundleGraph: InternalBundleGraph, bundle: InternalBundle, plugin: LoadedPlugin<T>, configs: Map<string, Config>, bundleConfigs: Map<string, Config>): Promise<void>;
|
|
62
|
+
getBundleInfoFromCache(bundleGraph: InternalBundleGraph, bundle: InternalBundle, configs: Map<string, Config>, bundleConfigs: Map<string, Config>): Promise<Async<BundleInfo | null | undefined>>;
|
|
63
|
+
getBundleInfo(bundle: InternalBundle, bundleGraph: InternalBundleGraph, configs: Map<string, Config>, bundleConfigs: Map<string, Config>): Promise<BundleInfo>;
|
|
64
|
+
getBundleResult(bundle: InternalBundle, bundleGraph: InternalBundleGraph, configs: Map<string, Config>, bundleConfigs: Map<string, Config>): Promise<{
|
|
65
|
+
type: string;
|
|
66
|
+
contents: Blob;
|
|
67
|
+
map: string | null | undefined;
|
|
68
|
+
scopeHoistingStats?: BundleResult['scopeHoistingStats'];
|
|
69
|
+
}>;
|
|
70
|
+
getSourceMapReference(bundle: NamedBundle, map?: SourceMap | null): Async<string | null | undefined>;
|
|
71
|
+
package(internalBundle: InternalBundle, bundleGraph: InternalBundleGraph, configs: Map<string, Config>, bundleConfigs: Map<string, Config>): Promise<BundleResult>;
|
|
72
|
+
optimize(internalBundle: InternalBundle, internalBundleGraph: InternalBundleGraph, type: string, contents: Blob, map: SourceMap | null | undefined, configs: Map<string, Config>, bundleConfigs: Map<string, Config>): Promise<BundleResult>;
|
|
73
|
+
generateSourceMap(bundle: InternalBundle, map: SourceMap): Promise<string>;
|
|
74
|
+
getCacheKey(bundle: InternalBundle, bundleGraph: InternalBundleGraph, configs: Map<string, Config>, bundleConfigs: Map<string, Config>, invalidations: Array<RequestInvalidation>): Promise<string>;
|
|
75
|
+
getDevDepHashes(bundle: InternalBundle): Promise<string>;
|
|
76
|
+
readFromCache(cacheKey: string): Promise<{
|
|
77
|
+
contents: Readable;
|
|
78
|
+
map: Readable | null | undefined;
|
|
79
|
+
} | null | undefined>;
|
|
80
|
+
writeToCache(cacheKeys: CacheKeyMap, type: string, contents: Blob, map?: string | null): Promise<BundleInfo>;
|
|
81
|
+
static getContentKey(cacheKey: string): string;
|
|
82
|
+
static getMapKey(cacheKey: string): string;
|
|
83
|
+
static getInfoKey(cacheKey: string): string;
|
|
84
|
+
}
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReporterEvent, Reporter } from '@atlaspack/types';
|
|
2
|
+
import type { WorkerApi } from '@atlaspack/workers';
|
|
3
|
+
import type { AtlaspackOptions } from './types';
|
|
4
|
+
import type { LoadedPlugin } from './AtlaspackConfig';
|
|
5
|
+
import WorkerFarm from '@atlaspack/workers';
|
|
6
|
+
import PluginOptions from './public/PluginOptions';
|
|
7
|
+
type Opts = {
|
|
8
|
+
options: AtlaspackOptions;
|
|
9
|
+
reporters: Array<LoadedPlugin<Reporter>>;
|
|
10
|
+
workerFarm: WorkerFarm;
|
|
11
|
+
};
|
|
12
|
+
export default class ReporterRunner {
|
|
13
|
+
workerFarm: WorkerFarm;
|
|
14
|
+
errors: Error[];
|
|
15
|
+
options: AtlaspackOptions;
|
|
16
|
+
pluginOptions: PluginOptions;
|
|
17
|
+
reporters: Array<LoadedPlugin<Reporter>>;
|
|
18
|
+
constructor(opts: Opts);
|
|
19
|
+
eventHandler: (arg1: ReporterEvent) => void;
|
|
20
|
+
report(unsanitisedEvent: ReporterEvent): Promise<void>;
|
|
21
|
+
dispose(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare function reportWorker(workerApi: WorkerApi, event: ReporterEvent): void;
|
|
24
|
+
export declare function report(event: ReporterEvent): Promise<void>;
|
|
25
|
+
export {};
|
|
@@ -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;
|