@atlaspack/core 2.16.2-canary.37 → 2.16.2-canary.371
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 +941 -0
- package/dist/AssetGraph.js +591 -0
- package/dist/Atlaspack.js +666 -0
- package/dist/AtlaspackConfig.js +324 -0
- package/dist/AtlaspackConfig.schema.js +117 -0
- package/dist/BundleGraph.js +1740 -0
- package/dist/CommittedAsset.js +142 -0
- package/dist/Dependency.js +125 -0
- package/dist/Environment.js +132 -0
- package/dist/EnvironmentManager.js +108 -0
- package/dist/IdentifierRegistry.js +38 -0
- package/dist/InternalConfig.js +37 -0
- package/dist/PackagerRunner.js +545 -0
- package/dist/ReporterRunner.js +151 -0
- package/dist/RequestTracker.js +1360 -0
- package/dist/SymbolPropagation.js +620 -0
- package/dist/TargetDescriptor.schema.js +143 -0
- package/dist/Transformation.js +514 -0
- package/dist/UncommittedAsset.js +315 -0
- package/dist/Validation.js +196 -0
- package/dist/applyRuntimes.js +383 -0
- package/dist/assetUtils.js +169 -0
- package/dist/atlaspack-v3/AtlaspackV3.js +74 -0
- package/dist/atlaspack-v3/NapiWorkerPool.js +81 -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 +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 +25 -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-logger.js +26 -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 +381 -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 +439 -0
- package/dist/requests/AssetGraphRequestRust.js +273 -0
- package/dist/requests/AssetRequest.js +130 -0
- package/dist/requests/AtlaspackBuildRequest.js +92 -0
- package/dist/requests/AtlaspackConfigRequest.js +493 -0
- package/dist/requests/BundleGraphRequest.js +447 -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 +72 -0
- package/dist/requests/PathRequest.js +349 -0
- package/dist/requests/TargetRequest.js +1311 -0
- package/dist/requests/ValidationRequest.js +49 -0
- package/dist/requests/WriteBundleRequest.js +254 -0
- package/dist/requests/WriteBundlesRequest.js +184 -0
- package/dist/requests/asset-graph-diff.js +128 -0
- package/dist/requests/asset-graph-dot.js +131 -0
- package/dist/resolveOptions.js +269 -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 +94 -41
- package/lib/AtlaspackConfig.js +15 -3
- package/lib/AtlaspackConfig.schema.js +16 -5
- package/lib/BundleGraph.js +197 -32
- package/lib/CommittedAsset.js +7 -1
- package/lib/Dependency.js +8 -2
- package/lib/Environment.js +15 -8
- package/lib/EnvironmentManager.js +143 -0
- package/lib/IdentifierRegistry.js +1 -3
- package/lib/InternalConfig.js +3 -2
- package/lib/PackagerRunner.js +90 -27
- package/lib/ReporterRunner.js +6 -9
- package/lib/RequestTracker.js +266 -156
- package/lib/SymbolPropagation.js +42 -18
- package/lib/TargetDescriptor.schema.js +7 -1
- package/lib/Transformation.js +66 -15
- package/lib/UncommittedAsset.js +33 -12
- package/lib/Validation.js +18 -2
- package/lib/applyRuntimes.js +96 -4
- package/lib/assetUtils.js +15 -5
- package/lib/atlaspack-v3/AtlaspackV3.js +52 -14
- package/lib/atlaspack-v3/NapiWorkerPool.js +28 -1
- 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 +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/mutable-asset.js +15 -10
- package/lib/atlaspack-v3/worker/compat/plugin-config.js +13 -34
- package/lib/atlaspack-v3/worker/compat/plugin-options.js +16 -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/side-effect-detector.js +215 -0
- package/lib/atlaspack-v3/worker/worker.js +199 -71
- 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 +25 -22
- 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 +74 -27
- package/lib/requests/AssetGraphRequestRust.js +140 -64
- package/lib/requests/AssetRequest.js +23 -6
- package/lib/requests/AtlaspackBuildRequest.js +43 -4
- package/lib/requests/AtlaspackConfigRequest.js +27 -16
- package/lib/requests/BundleGraphRequest.js +41 -24
- package/lib/requests/ConfigRequest.js +53 -4
- package/lib/requests/DevDepRequest.js +31 -5
- package/lib/requests/EntryRequest.js +2 -0
- package/lib/requests/PackageRequest.js +16 -2
- package/lib/requests/PathRequest.js +24 -3
- package/lib/requests/TargetRequest.js +122 -57
- package/lib/requests/ValidationRequest.js +5 -1
- package/lib/requests/WriteBundleRequest.js +39 -11
- package/lib/requests/WriteBundlesRequest.js +51 -4
- package/lib/requests/asset-graph-diff.js +12 -7
- package/lib/requests/asset-graph-dot.js +1 -7
- package/lib/resolveOptions.js +38 -11
- 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 +53 -0
- package/lib/types/BundleGraph.d.ts +184 -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 +34 -0
- package/lib/types/atlaspack-v3/NapiWorkerPool.d.ts +13 -0
- package/lib/types/atlaspack-v3/fs.d.ts +12 -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 -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 +29 -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 +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 +80 -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/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 +28 -0
- package/lib/types/requests/WriteBundlesRequest.d.ts +32 -0
- package/lib/types/requests/asset-graph-diff.d.ts +1 -0
- package/lib/types/requests/asset-graph-dot.d.ts +9 -0
- package/lib/types/resolveOptions.d.ts +3 -0
- package/lib/types/rustWorkerThreadDylibHack.d.ts +9 -0
- package/lib/types/serializerCore.browser.d.ts +3 -0
- package/lib/types/summarizeRequest.d.ts +10 -0
- package/lib/types/types.d.ts +495 -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 +30 -14
- package/package.json +25 -35
- package/src/{AssetGraph.js → AssetGraph.ts} +156 -52
- package/src/{Atlaspack.js → Atlaspack.ts} +134 -67
- package/src/{AtlaspackConfig.schema.js → AtlaspackConfig.schema.ts} +25 -19
- package/src/{AtlaspackConfig.js → AtlaspackConfig.ts} +78 -54
- package/src/{BundleGraph.js → BundleGraph.ts} +383 -140
- 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} +179 -87
- package/src/{ReporterRunner.js → ReporterRunner.ts} +13 -18
- package/src/{RequestTracker.js → RequestTracker.ts} +572 -357
- package/src/{SymbolPropagation.js → SymbolPropagation.ts} +165 -57
- package/src/{TargetDescriptor.schema.js → TargetDescriptor.schema.ts} +7 -1
- package/src/{Transformation.js → Transformation.ts} +110 -65
- package/src/{UncommittedAsset.js → UncommittedAsset.ts} +60 -39
- package/src/{Validation.js → Validation.ts} +32 -17
- package/src/{applyRuntimes.js → applyRuntimes.ts} +133 -26
- package/src/{assetUtils.js → assetUtils.ts} +49 -36
- package/src/atlaspack-v3/AtlaspackV3.ts +143 -0
- package/src/atlaspack-v3/NapiWorkerPool.ts +91 -0
- package/src/atlaspack-v3/{fs.js → fs.ts} +3 -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 +9 -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-logger.js → plugin-logger.ts} +0 -2
- 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 +531 -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} +129 -80
- package/src/requests/AssetGraphRequestRust.ts +364 -0
- package/src/requests/{AssetRequest.js → AssetRequest.ts} +24 -18
- package/src/requests/AtlaspackBuildRequest.ts +163 -0
- package/src/requests/{AtlaspackConfigRequest.js → AtlaspackConfigRequest.ts} +72 -58
- package/src/requests/{BundleGraphRequest.js → BundleGraphRequest.ts} +97 -79
- 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} +34 -22
- package/src/requests/{PathRequest.js → PathRequest.ts} +47 -37
- package/src/requests/{TargetRequest.js → TargetRequest.ts} +260 -179
- package/src/requests/{ValidationRequest.js → ValidationRequest.ts} +18 -17
- package/src/requests/{WriteBundleRequest.js → WriteBundleRequest.ts} +77 -49
- package/src/requests/{WriteBundlesRequest.js → WriteBundlesRequest.ts} +109 -37
- package/src/requests/{asset-graph-diff.js → asset-graph-diff.ts} +25 -21
- package/src/requests/{asset-graph-dot.js → asset-graph-dot.ts} +8 -12
- package/src/{resolveOptions.js → resolveOptions.ts} +59 -25
- 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 +650 -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} +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} +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} +314 -59
- package/test/{SymbolPropagation.test.js → SymbolPropagation.test.ts} +124 -74
- package/test/{TargetRequest.test.js → TargetRequest.test.ts} +66 -92
- package/test/fixtures/config-with-reporters/.parcelrc +7 -0
- package/test/fixtures/custom-targets/package.json +6 -0
- package/test/public/Config.test.ts +104 -0
- package/test/requests/AssetGraphRequestRust.test.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/{test-utils.js → test-utils.ts} +4 -11
- 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/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/worker.js +0 -362
- package/src/index.js +0 -13
- package/src/requests/AssetGraphRequestRust.js +0 -263
- package/src/requests/AtlaspackBuildRequest.js +0 -111
- 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
|
@@ -69,10 +69,17 @@ var _Environment2 = require("../public/Environment");
|
|
|
69
69
|
var _utils2 = require("../utils");
|
|
70
70
|
var _projectPath = require("../projectPath");
|
|
71
71
|
var _RequestTracker = require("../RequestTracker");
|
|
72
|
+
var _EnvironmentManager = require("../EnvironmentManager");
|
|
73
|
+
function _featureFlags() {
|
|
74
|
+
const data = require("@atlaspack/feature-flags");
|
|
75
|
+
_featureFlags = function () {
|
|
76
|
+
return data;
|
|
77
|
+
};
|
|
78
|
+
return data;
|
|
79
|
+
}
|
|
72
80
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
73
81
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
74
82
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
75
|
-
// $FlowFixMe
|
|
76
83
|
const DEFAULT_DIST_DIRNAME = 'dist';
|
|
77
84
|
const JS_RE = /\.[mc]?js$/;
|
|
78
85
|
const JS_EXTENSIONS = ['.js', '.mjs', '.cjs'];
|
|
@@ -122,6 +129,33 @@ async function run({
|
|
|
122
129
|
}) {
|
|
123
130
|
let targetResolver = new TargetResolver(api, (0, _utils2.optionsProxy)(options, api.invalidateOnOptionChange));
|
|
124
131
|
let targets = await targetResolver.resolve((0, _projectPath.fromProjectPath)(options.projectRoot, input.packagePath), input.target);
|
|
132
|
+
|
|
133
|
+
// Filter targets based on allowExplicitTargetEntries feature flag
|
|
134
|
+
if ((0, _featureFlags().getFeatureFlag)('allowExplicitTargetEntries') && options.targets &&
|
|
135
|
+
// Only explicit targets are allowed (i.e. an object of targets)
|
|
136
|
+
!Array.isArray(options.targets)) {
|
|
137
|
+
// Check if ALL targets have sources - only apply new behavior if they do
|
|
138
|
+
const allTargetsHaveSources = targets.every(t => t.source);
|
|
139
|
+
if (allTargetsHaveSources) {
|
|
140
|
+
// Get the current entry file path relative to project root
|
|
141
|
+
const currentEntryPath = input.filePath;
|
|
142
|
+
|
|
143
|
+
// Filter targets to only include those whose source matches the current entry
|
|
144
|
+
targets = targets.filter(target => {
|
|
145
|
+
// Handle both string and array sources
|
|
146
|
+
const sources = Array.isArray(target.source) ? target.source : [target.source];
|
|
147
|
+
|
|
148
|
+
// Check if current entry matches any of the target sources
|
|
149
|
+
return sources.some(source => {
|
|
150
|
+
const targetSourcePath = (0, _projectPath.toProjectPath)(options.projectRoot, _path().default.resolve((0, _projectPath.fromProjectPath)(options.projectRoot, input.packagePath), (0, _nullthrows().default)(source, 'Source must be not be undefined when specified')));
|
|
151
|
+
return targetSourcePath === currentEntryPath;
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
} else {
|
|
155
|
+
// If not all targets have sources, fall back to old behavior (skip targets with sources)
|
|
156
|
+
targets = targets.filter(target => !target.source);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
125
159
|
assertTargetsAreNotEntries(targets, input, options);
|
|
126
160
|
let configResult = (0, _nullthrows().default)(await api.runRequest((0, _AtlaspackConfigRequest.default)()));
|
|
127
161
|
let atlaspackConfig = (0, _AtlaspackConfigRequest.getCachedAtlaspackConfig)(configResult, options);
|
|
@@ -170,6 +204,7 @@ class TargetResolver {
|
|
|
170
204
|
|
|
171
205
|
// If an array of strings is passed, it's a filter on the resolved package
|
|
172
206
|
// targets. Load them, and find the matching targets.
|
|
207
|
+
// @ts-expect-error TS2322
|
|
173
208
|
targets = optionTargets.map(target => {
|
|
174
209
|
// null means skipped.
|
|
175
210
|
if (!packageTargets.has(target)) {
|
|
@@ -221,7 +256,8 @@ class TargetResolver {
|
|
|
221
256
|
shouldOptimize: this.options.defaultTargetOptions.shouldOptimize && descriptor.optimize !== false,
|
|
222
257
|
shouldScopeHoist: this.options.defaultTargetOptions.shouldScopeHoist && descriptor.scopeHoist !== false,
|
|
223
258
|
sourceMap: normalizeSourceMap(this.options, descriptor.sourceMap),
|
|
224
|
-
unstableSingleFileOutput: descriptor.__unstable_singleFileOutput
|
|
259
|
+
unstableSingleFileOutput: descriptor.__unstable_singleFileOutput,
|
|
260
|
+
customEnv: descriptor.env
|
|
225
261
|
})
|
|
226
262
|
};
|
|
227
263
|
if (descriptor.distEntry != null) {
|
|
@@ -231,7 +267,17 @@ class TargetResolver {
|
|
|
231
267
|
target.source = descriptor.source;
|
|
232
268
|
}
|
|
233
269
|
return target;
|
|
234
|
-
}).filter(target => !skipTarget(target.name, exclusiveTarget, target.source));
|
|
270
|
+
}).filter(target => (0, _featureFlags().getFeatureFlag)('allowExplicitTargetEntries') && this.options.entries.length !== 0 || !skipTarget(target.name, exclusiveTarget, target.source));
|
|
271
|
+
|
|
272
|
+
// Apply allowExplicitTargetEntries filtering logic
|
|
273
|
+
if ((0, _featureFlags().getFeatureFlag)('allowExplicitTargetEntries')) {
|
|
274
|
+
// Check if ALL targets have sources - only apply new behavior if they do
|
|
275
|
+
const allTargetsHaveSources = targets.every(t => t.source);
|
|
276
|
+
if (!allTargetsHaveSources) {
|
|
277
|
+
// If not all targets have sources, fall back to old behavior (skip targets with sources)
|
|
278
|
+
targets = targets.filter(target => !target.source);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
235
281
|
}
|
|
236
282
|
let serve = this.options.serveOptions;
|
|
237
283
|
if (serve && targets.length > 0) {
|
|
@@ -245,7 +291,7 @@ class TargetResolver {
|
|
|
245
291
|
}
|
|
246
292
|
});
|
|
247
293
|
}
|
|
248
|
-
if (!_Environment2.BROWSER_ENVS.has(targets[0].env.context)) {
|
|
294
|
+
if (!_Environment2.BROWSER_ENVS.has((0, _EnvironmentManager.fromEnvironmentId)(targets[0].env).context)) {
|
|
249
295
|
throw new (_diagnostic().default)({
|
|
250
296
|
diagnostic: {
|
|
251
297
|
message: `Only browser targets are supported in serve mode`,
|
|
@@ -268,6 +314,7 @@ class TargetResolver {
|
|
|
268
314
|
env: (0, _Environment.createEnvironment)({
|
|
269
315
|
context: 'browser',
|
|
270
316
|
engines: {
|
|
317
|
+
// @ts-expect-error TS2322
|
|
271
318
|
browsers: DEFAULT_ENGINES.browsers
|
|
272
319
|
},
|
|
273
320
|
shouldOptimize: this.options.defaultTargetOptions.shouldOptimize,
|
|
@@ -277,6 +324,7 @@ class TargetResolver {
|
|
|
277
324
|
})
|
|
278
325
|
}];
|
|
279
326
|
} else {
|
|
327
|
+
// @ts-expect-error TS2322
|
|
280
328
|
targets = Array.from(packageTargets.values()).filter(Boolean).filter(descriptor => {
|
|
281
329
|
return descriptor && !skipTarget(descriptor.name, exclusiveTarget, descriptor.source);
|
|
282
330
|
});
|
|
@@ -364,6 +412,7 @@ class TargetResolver {
|
|
|
364
412
|
browsers: browserslistBrowsers
|
|
365
413
|
};
|
|
366
414
|
browsersLoc = {
|
|
415
|
+
// @ts-expect-error TS2353
|
|
367
416
|
message: `(defined in ${_path().default.relative(process.cwd(), browserslistConfig)})`
|
|
368
417
|
};
|
|
369
418
|
}
|
|
@@ -384,8 +433,10 @@ class TargetResolver {
|
|
|
384
433
|
if (context === 'browser' && pkgEngines.browsers == null) {
|
|
385
434
|
pkgEngines = {
|
|
386
435
|
...pkgEngines,
|
|
436
|
+
// @ts-expect-error TS2322
|
|
387
437
|
browsers: (defaultEngines === null || defaultEngines === void 0 ? void 0 : defaultEngines.browsers) ?? DEFAULT_ENGINES.browsers
|
|
388
438
|
};
|
|
439
|
+
// @ts-expect-error TS2353
|
|
389
440
|
browsersLoc = {
|
|
390
441
|
message: '(default)'
|
|
391
442
|
};
|
|
@@ -394,6 +445,7 @@ class TargetResolver {
|
|
|
394
445
|
...pkgEngines,
|
|
395
446
|
node: (defaultEngines === null || defaultEngines === void 0 ? void 0 : defaultEngines.node) ?? DEFAULT_ENGINES.node
|
|
396
447
|
};
|
|
448
|
+
// @ts-expect-error TS2353
|
|
397
449
|
nodeLoc = {
|
|
398
450
|
message: '(default)'
|
|
399
451
|
};
|
|
@@ -480,6 +532,7 @@ class TargetResolver {
|
|
|
480
532
|
_targetDist = pkg[targetName][pkg.name];
|
|
481
533
|
pointer = `/${targetName}/${(0, _diagnostic().encodeJSONKeyComponent)(pkg.name)}`;
|
|
482
534
|
} else {
|
|
535
|
+
// @ts-expect-error TS7053
|
|
483
536
|
_targetDist = pkg[targetName];
|
|
484
537
|
pointer = `/${targetName}`;
|
|
485
538
|
}
|
|
@@ -510,15 +563,16 @@ class TargetResolver {
|
|
|
510
563
|
targets.set(targetName, null);
|
|
511
564
|
continue;
|
|
512
565
|
}
|
|
513
|
-
if (distEntry != null &&
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
JSON.stringify(pkgContents, null, '\t');
|
|
517
|
-
// $FlowFixMe
|
|
566
|
+
if (distEntry != null &&
|
|
567
|
+
// @ts-expect-error TS7053
|
|
568
|
+
!COMMON_TARGETS[targetName].match.test(distEntry)) {
|
|
569
|
+
let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
|
|
518
570
|
let listFormat = new Intl.ListFormat('en-US', {
|
|
519
571
|
type: 'disjunction'
|
|
520
572
|
});
|
|
521
|
-
let extensions = listFormat.format(
|
|
573
|
+
let extensions = listFormat.format(
|
|
574
|
+
// @ts-expect-error TS7053
|
|
575
|
+
COMMON_TARGETS[targetName].extensions);
|
|
522
576
|
let ext = _path().default.extname(distEntry);
|
|
523
577
|
throw new (_diagnostic().default)({
|
|
524
578
|
diagnostic: {
|
|
@@ -540,9 +594,7 @@ class TargetResolver {
|
|
|
540
594
|
});
|
|
541
595
|
}
|
|
542
596
|
if (descriptor.outputFormat === 'global') {
|
|
543
|
-
let contents = typeof pkgContents === 'string' ? pkgContents :
|
|
544
|
-
// $FlowFixMe
|
|
545
|
-
JSON.stringify(pkgContents, null, '\t');
|
|
597
|
+
let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
|
|
546
598
|
throw new (_diagnostic().default)({
|
|
547
599
|
diagnostic: {
|
|
548
600
|
message: (0, _diagnostic().md)`The "global" output format is not supported in the "${targetName}" target.`,
|
|
@@ -561,13 +613,13 @@ class TargetResolver {
|
|
|
561
613
|
}
|
|
562
614
|
});
|
|
563
615
|
}
|
|
564
|
-
let [inferredOutputFormat, inferredOutputFormatField] = this.inferOutputFormat(distEntry, descriptor, targetName,
|
|
616
|
+
let [inferredOutputFormat, inferredOutputFormatField] = this.inferOutputFormat(distEntry, descriptor, targetName,
|
|
617
|
+
// @ts-expect-error TS2345
|
|
618
|
+
pkg, pkgFilePath, pkgContents);
|
|
565
619
|
let outputFormat = descriptor.outputFormat ?? this.options.defaultTargetOptions.outputFormat ?? inferredOutputFormat ?? (targetName === 'module' ? 'esmodule' : 'commonjs');
|
|
566
620
|
let isModule = outputFormat === 'esmodule';
|
|
567
621
|
if (targetName === 'main' && outputFormat === 'esmodule' && inferredOutputFormat !== 'esmodule') {
|
|
568
|
-
let contents = typeof pkgContents === 'string' ? pkgContents :
|
|
569
|
-
// $FlowFixMe
|
|
570
|
-
JSON.stringify(pkgContents, null, '\t');
|
|
622
|
+
let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
|
|
571
623
|
throw new (_diagnostic().default)({
|
|
572
624
|
diagnostic: {
|
|
573
625
|
// prettier-ignore
|
|
@@ -593,9 +645,7 @@ class TargetResolver {
|
|
|
593
645
|
});
|
|
594
646
|
}
|
|
595
647
|
if (descriptor.scopeHoist === false) {
|
|
596
|
-
let contents = typeof pkgContents === 'string' ? pkgContents :
|
|
597
|
-
// $FlowFixMe
|
|
598
|
-
JSON.stringify(pkgContents, null, '\t');
|
|
648
|
+
let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
|
|
599
649
|
throw new (_diagnostic().default)({
|
|
600
650
|
diagnostic: {
|
|
601
651
|
message: 'Scope hoisting cannot be disabled for library targets.',
|
|
@@ -622,6 +672,7 @@ class TargetResolver {
|
|
|
622
672
|
publicUrl: descriptor.publicUrl ?? this.options.defaultTargetOptions.publicUrl,
|
|
623
673
|
env: (0, _Environment.createEnvironment)({
|
|
624
674
|
engines: descriptor.engines ?? pkgEngines,
|
|
675
|
+
// @ts-expect-error TS2322
|
|
625
676
|
context,
|
|
626
677
|
includeNodeModules: descriptor.includeNodeModules ?? false,
|
|
627
678
|
outputFormat,
|
|
@@ -675,10 +726,13 @@ class TargetResolver {
|
|
|
675
726
|
});
|
|
676
727
|
}
|
|
677
728
|
}
|
|
678
|
-
let customTargets = Object.keys(pkgTargets).filter(
|
|
729
|
+
let customTargets = Object.keys(pkgTargets).filter(
|
|
730
|
+
// @ts-expect-error TS7053
|
|
731
|
+
targetName => !COMMON_TARGETS[targetName]);
|
|
679
732
|
|
|
680
733
|
// Custom targets
|
|
681
734
|
for (let targetName of customTargets) {
|
|
735
|
+
// @ts-expect-error TS7053
|
|
682
736
|
let distPath = pkg[targetName];
|
|
683
737
|
let distDir;
|
|
684
738
|
let distEntry;
|
|
@@ -697,9 +751,7 @@ class TargetResolver {
|
|
|
697
751
|
};
|
|
698
752
|
} else {
|
|
699
753
|
if (typeof distPath !== 'string') {
|
|
700
|
-
let contents = typeof pkgContents === 'string' ? pkgContents :
|
|
701
|
-
// $FlowFixMe
|
|
702
|
-
JSON.stringify(pkgContents, null, '\t');
|
|
754
|
+
let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
|
|
703
755
|
throw new (_diagnostic().default)({
|
|
704
756
|
diagnostic: {
|
|
705
757
|
message: (0, _diagnostic().md)`Invalid distPath for target "${targetName}"`,
|
|
@@ -734,11 +786,11 @@ class TargetResolver {
|
|
|
734
786
|
targets.set(targetName, null);
|
|
735
787
|
continue;
|
|
736
788
|
}
|
|
737
|
-
let [inferredOutputFormat, inferredOutputFormatField] = this.inferOutputFormat(distEntry, descriptor, targetName,
|
|
789
|
+
let [inferredOutputFormat, inferredOutputFormatField] = this.inferOutputFormat(distEntry, descriptor, targetName,
|
|
790
|
+
// @ts-expect-error TS2345
|
|
791
|
+
pkg, pkgFilePath, pkgContents);
|
|
738
792
|
if (descriptor.scopeHoist === false && descriptor.isLibrary) {
|
|
739
|
-
let contents = typeof pkgContents === 'string' ? pkgContents :
|
|
740
|
-
// $FlowFixMe
|
|
741
|
-
JSON.stringify(pkgContents, null, '\t');
|
|
793
|
+
let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
|
|
742
794
|
throw new (_diagnostic().default)({
|
|
743
795
|
diagnostic: {
|
|
744
796
|
message: 'Scope hoisting cannot be disabled for library targets.',
|
|
@@ -778,7 +830,8 @@ class TargetResolver {
|
|
|
778
830
|
// Libraries are not optimized by default, users must explicitly configure this.
|
|
779
831
|
isLibrary ? descriptor.optimize === true : descriptor.optimize !== false),
|
|
780
832
|
shouldScopeHoist: shouldScopeHoist && descriptor.scopeHoist !== false,
|
|
781
|
-
sourceMap: normalizeSourceMap(this.options, descriptor.sourceMap)
|
|
833
|
+
sourceMap: normalizeSourceMap(this.options, descriptor.sourceMap),
|
|
834
|
+
customEnv: descriptor.env
|
|
782
835
|
}),
|
|
783
836
|
loc: (0, _utils2.toInternalSourceLocation)(this.options.projectRoot, loc)
|
|
784
837
|
});
|
|
@@ -838,6 +891,7 @@ class TargetResolver {
|
|
|
838
891
|
publicUrl: this.options.defaultTargetOptions.publicUrl,
|
|
839
892
|
env: (0, _Environment.createEnvironment)({
|
|
840
893
|
engines: pkgEngines,
|
|
894
|
+
// @ts-expect-error TS2322
|
|
841
895
|
context,
|
|
842
896
|
outputFormat: this.options.defaultTargetOptions.outputFormat,
|
|
843
897
|
isLibrary: this.options.defaultTargetOptions.isLibrary,
|
|
@@ -874,9 +928,7 @@ class TargetResolver {
|
|
|
874
928
|
break;
|
|
875
929
|
}
|
|
876
930
|
if (descriptor.outputFormat && inferredOutputFormat && descriptor.outputFormat !== inferredOutputFormat) {
|
|
877
|
-
let contents = typeof pkgContents === 'string' ? pkgContents :
|
|
878
|
-
// $FlowFixMe
|
|
879
|
-
JSON.stringify(pkgContents, null, '\t');
|
|
931
|
+
let contents = typeof pkgContents === 'string' ? pkgContents : JSON.stringify(pkgContents, null, '\t');
|
|
880
932
|
let expectedExtensions;
|
|
881
933
|
switch (descriptor.outputFormat) {
|
|
882
934
|
case 'esmodule':
|
|
@@ -889,7 +941,6 @@ class TargetResolver {
|
|
|
889
941
|
expectedExtensions = ['.js'];
|
|
890
942
|
break;
|
|
891
943
|
}
|
|
892
|
-
// $FlowFixMe
|
|
893
944
|
let listFormat = new Intl.ListFormat('en-US', {
|
|
894
945
|
type: 'disjunction'
|
|
895
946
|
});
|
|
@@ -916,6 +967,8 @@ class TargetResolver {
|
|
|
916
967
|
}
|
|
917
968
|
});
|
|
918
969
|
}
|
|
970
|
+
|
|
971
|
+
// @ts-expect-error TS2322
|
|
919
972
|
return [inferredOutputFormat, inferredOutputFormatField];
|
|
920
973
|
}
|
|
921
974
|
}
|
|
@@ -930,7 +983,7 @@ function parseEngines(engines, pkgPath, pkgContents, prependKey, message) {
|
|
|
930
983
|
filePath: pkgPath,
|
|
931
984
|
prependKey
|
|
932
985
|
}, '@atlaspack/core', message);
|
|
933
|
-
//
|
|
986
|
+
// @ts-expect-error TS2322
|
|
934
987
|
return engines;
|
|
935
988
|
}
|
|
936
989
|
}
|
|
@@ -942,7 +995,7 @@ function parseDescriptor(targetName, descriptor, pkgPath, pkgContents) {
|
|
|
942
995
|
prependKey: `/targets/${targetName}`
|
|
943
996
|
}, '@atlaspack/core', `Invalid target descriptor for target "${targetName}"`);
|
|
944
997
|
|
|
945
|
-
//
|
|
998
|
+
// @ts-expect-error TS2322
|
|
946
999
|
return descriptor;
|
|
947
1000
|
}
|
|
948
1001
|
function parsePackageDescriptor(targetName, descriptor, pkgPath, pkgContents) {
|
|
@@ -952,7 +1005,7 @@ function parsePackageDescriptor(targetName, descriptor, pkgPath, pkgContents) {
|
|
|
952
1005
|
filePath: pkgPath,
|
|
953
1006
|
prependKey: `/targets/${targetName}`
|
|
954
1007
|
}, '@atlaspack/core', `Invalid target descriptor for target "${targetName}"`);
|
|
955
|
-
//
|
|
1008
|
+
// @ts-expect-error TS2322
|
|
956
1009
|
return descriptor;
|
|
957
1010
|
}
|
|
958
1011
|
function parseCommonTargetDescriptor(targetName, descriptor, pkgPath, pkgContents) {
|
|
@@ -963,7 +1016,7 @@ function parseCommonTargetDescriptor(targetName, descriptor, pkgPath, pkgContent
|
|
|
963
1016
|
prependKey: `/targets/${targetName}`
|
|
964
1017
|
}, '@atlaspack/core', `Invalid target descriptor for target "${targetName}"`);
|
|
965
1018
|
|
|
966
|
-
//
|
|
1019
|
+
// @ts-expect-error TS2322
|
|
967
1020
|
return descriptor;
|
|
968
1021
|
}
|
|
969
1022
|
function assertNoDuplicateTargets(options, targets, pkgFilePath, pkgContents) {
|
|
@@ -1012,7 +1065,9 @@ function assertNoDuplicateTargets(options, targets, pkgFilePath, pkgContents) {
|
|
|
1012
1065
|
});
|
|
1013
1066
|
}
|
|
1014
1067
|
}
|
|
1015
|
-
function normalizeSourceMap(options,
|
|
1068
|
+
function normalizeSourceMap(options,
|
|
1069
|
+
// @ts-expect-error TS2304
|
|
1070
|
+
sourceMap) {
|
|
1016
1071
|
if (options.defaultTargetOptions.sourceMaps) {
|
|
1017
1072
|
if (typeof sourceMap === 'boolean') {
|
|
1018
1073
|
return sourceMap ? {} : undefined;
|
|
@@ -1028,6 +1083,7 @@ function assertTargetsAreNotEntries(targets, input, options) {
|
|
|
1028
1083
|
if (target.distEntry != null && (0, _projectPath.joinProjectPath)(target.distDir, target.distEntry) === input.filePath) {
|
|
1029
1084
|
let loc = target.loc;
|
|
1030
1085
|
let relativeEntry = _path().default.relative(process.cwd(), (0, _projectPath.fromProjectPath)(options.projectRoot, input.filePath));
|
|
1086
|
+
// @ts-expect-error TS2304
|
|
1031
1087
|
let codeFrames = [];
|
|
1032
1088
|
if (loc) {
|
|
1033
1089
|
codeFrames.push({
|
|
@@ -1052,7 +1108,9 @@ function assertTargetsAreNotEntries(targets, input, options) {
|
|
|
1052
1108
|
origin: '@atlaspack/core',
|
|
1053
1109
|
message: `Target "${target.name}" is configured to overwrite entry "${relativeEntry}".`,
|
|
1054
1110
|
codeFrames,
|
|
1055
|
-
hints: [
|
|
1111
|
+
hints: [
|
|
1112
|
+
// @ts-expect-error TS7053
|
|
1113
|
+
(COMMON_TARGETS[target.name] ? `The "${target.name}" field is an _output_ file path so that your build can be consumed by other tools. ` : '') + `Change the "${target.name}" field to point to an output file rather than your source code.`],
|
|
1056
1114
|
documentationURL: 'https://parceljs.org/features/targets/'
|
|
1057
1115
|
}
|
|
1058
1116
|
});
|
|
@@ -1073,24 +1131,27 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
|
|
|
1073
1131
|
|
|
1074
1132
|
// Resolve relevant engines for context.
|
|
1075
1133
|
let engines;
|
|
1076
|
-
|
|
1134
|
+
const env = (0, _EnvironmentManager.fromEnvironmentId)(target.env);
|
|
1135
|
+
switch (env.context) {
|
|
1077
1136
|
case 'browser':
|
|
1078
1137
|
case 'web-worker':
|
|
1079
1138
|
case 'service-worker':
|
|
1080
1139
|
case 'worklet':
|
|
1081
1140
|
{
|
|
1082
|
-
let browsers =
|
|
1141
|
+
let browsers = env.engines.browsers;
|
|
1083
1142
|
engines = Array.isArray(browsers) ? browsers.join(', ') : browsers;
|
|
1084
1143
|
break;
|
|
1085
1144
|
}
|
|
1086
1145
|
case 'node':
|
|
1087
|
-
engines =
|
|
1146
|
+
engines = env.engines.node;
|
|
1088
1147
|
break;
|
|
1089
1148
|
case 'electron-main':
|
|
1090
1149
|
case 'electron-renderer':
|
|
1091
|
-
engines =
|
|
1150
|
+
engines = env.engines.electron;
|
|
1092
1151
|
break;
|
|
1093
1152
|
}
|
|
1153
|
+
|
|
1154
|
+
// @ts-expect-error TS2304
|
|
1094
1155
|
let highlights = [];
|
|
1095
1156
|
if (input.loc) {
|
|
1096
1157
|
highlights.push((0, _diagnostic().convertSourceLocationToHighlight)(input.loc, 'entry defined here'));
|
|
@@ -1103,6 +1164,7 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
|
|
|
1103
1164
|
// Builds up map of code highlights for each defined/inferred path in the package.json.
|
|
1104
1165
|
let jsonHighlights = new Map();
|
|
1105
1166
|
for (let key in info) {
|
|
1167
|
+
// @ts-expect-error TS7053
|
|
1106
1168
|
let keyInfo = info[key];
|
|
1107
1169
|
let path = keyInfo.path || keyInfo.inferred;
|
|
1108
1170
|
if (!path) {
|
|
@@ -1124,11 +1186,10 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
|
|
|
1124
1186
|
highlight.defined = (0, _diagnostic().md)`${key} defined here`;
|
|
1125
1187
|
}
|
|
1126
1188
|
if (keyInfo.inferred) {
|
|
1127
|
-
|
|
1189
|
+
// @ts-expect-error TS2345
|
|
1190
|
+
highlight.inferred.push((0, _diagnostic().md)`${key} to be ${JSON.stringify(env[key])}`);
|
|
1128
1191
|
}
|
|
1129
1192
|
}
|
|
1130
|
-
|
|
1131
|
-
// $FlowFixMe
|
|
1132
1193
|
let listFormat = new Intl.ListFormat('en-US');
|
|
1133
1194
|
|
|
1134
1195
|
// Generate human friendly messages for each field.
|
|
@@ -1150,26 +1211,30 @@ async function debugResolvedTargets(input, targets, targetInfo, options) {
|
|
|
1150
1211
|
|
|
1151
1212
|
// Format includeNodeModules to be human readable.
|
|
1152
1213
|
let includeNodeModules;
|
|
1153
|
-
if (typeof
|
|
1154
|
-
includeNodeModules = String(
|
|
1155
|
-
} else if (Array.isArray(
|
|
1156
|
-
includeNodeModules = 'only ' + listFormat.format(
|
|
1157
|
-
} else if (
|
|
1158
|
-
includeNodeModules = 'all except ' + listFormat.format(Object.entries(
|
|
1214
|
+
if (typeof env.includeNodeModules === 'boolean') {
|
|
1215
|
+
includeNodeModules = String(env.includeNodeModules);
|
|
1216
|
+
} else if (Array.isArray(env.includeNodeModules)) {
|
|
1217
|
+
includeNodeModules = 'only ' + listFormat.format(env.includeNodeModules.map(m => JSON.stringify(m)));
|
|
1218
|
+
} else if (env.includeNodeModules && typeof env.includeNodeModules === 'object') {
|
|
1219
|
+
includeNodeModules = 'all except ' + listFormat.format(Object.entries(env.includeNodeModules).filter(([, v]) => v === false)
|
|
1220
|
+
// @ts-expect-error TS2345
|
|
1221
|
+
.map(([k]) => JSON.stringify(k)));
|
|
1159
1222
|
}
|
|
1160
|
-
let format = v =>
|
|
1223
|
+
let format = v =>
|
|
1224
|
+
// @ts-expect-error TS2339
|
|
1225
|
+
v.message != null ? _diagnostic().md.italic(v.message) : '';
|
|
1161
1226
|
_logger().default.verbose({
|
|
1162
1227
|
origin: '@atlaspack/core',
|
|
1163
1228
|
message: (0, _diagnostic().md)`**Target** "${target.name}"
|
|
1164
1229
|
|
|
1165
1230
|
**Entry**: ${_path().default.relative(process.cwd(), (0, _projectPath.fromProjectPath)(options.projectRoot, input.filePath))}
|
|
1166
1231
|
**Output**: ${_path().default.relative(process.cwd(), output)}
|
|
1167
|
-
**Format**: ${
|
|
1168
|
-
**Context**: ${
|
|
1232
|
+
**Format**: ${env.outputFormat} ${format(info.outputFormat)}
|
|
1233
|
+
**Context**: ${env.context} ${format(info.context)}
|
|
1169
1234
|
**Engines**: ${engines || ''} ${format(info.engines)}
|
|
1170
|
-
**Library Mode**: ${String(
|
|
1235
|
+
**Library Mode**: ${String(env.isLibrary)} ${format(info.isLibrary)}
|
|
1171
1236
|
**Include Node Modules**: ${includeNodeModules} ${format(info.includeNodeModules)}
|
|
1172
|
-
**Optimize**: ${String(
|
|
1237
|
+
**Optimize**: ${String(env.shouldOptimize)} ${format(info.shouldOptimize)}`,
|
|
1173
1238
|
codeFrames: target.loc ? [{
|
|
1174
1239
|
filePath: targetFilePath,
|
|
1175
1240
|
codeHighlights: highlights
|
|
@@ -36,6 +36,7 @@ function createValidationRequest(input) {
|
|
|
36
36
|
} = (0, _nullthrows().default)(await api.runRequest((0, _AtlaspackConfigRequest.default)()));
|
|
37
37
|
let config = new _AtlaspackConfig.AtlaspackConfig(processedConfig, options);
|
|
38
38
|
let trackedRequestsDesc = assetRequests.filter(request => {
|
|
39
|
+
// @ts-expect-error TS2345
|
|
39
40
|
return config.getValidatorNames(request.filePath).length > 0;
|
|
40
41
|
});
|
|
41
42
|
|
|
@@ -52,10 +53,13 @@ function createValidationRequest(input) {
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
// Schedule validations on the main thread for all validation plugins that implement "validateAll".
|
|
55
|
-
promises.push(
|
|
56
|
+
promises.push(
|
|
57
|
+
// @ts-expect-error TS2345
|
|
58
|
+
new _Validation.default({
|
|
56
59
|
requests: trackedRequestsDesc,
|
|
57
60
|
options,
|
|
58
61
|
config,
|
|
62
|
+
// @ts-expect-error TS2322
|
|
59
63
|
report: _ReporterRunner.report,
|
|
60
64
|
dedicatedThread: true
|
|
61
65
|
}).run());
|
|
@@ -45,7 +45,6 @@ function _logger() {
|
|
|
45
45
|
return data;
|
|
46
46
|
}
|
|
47
47
|
var _DevDepRequest = require("./DevDepRequest");
|
|
48
|
-
var _AtlaspackConfig = require("../AtlaspackConfig");
|
|
49
48
|
function _diagnostic() {
|
|
50
49
|
const data = _interopRequireWildcard(require("@atlaspack/diagnostic"));
|
|
51
50
|
_diagnostic = function () {
|
|
@@ -61,6 +60,14 @@ function _profiler() {
|
|
|
61
60
|
return data;
|
|
62
61
|
}
|
|
63
62
|
var _RequestTracker = require("../RequestTracker");
|
|
63
|
+
function _featureFlags() {
|
|
64
|
+
const data = require("@atlaspack/feature-flags");
|
|
65
|
+
_featureFlags = function () {
|
|
66
|
+
return data;
|
|
67
|
+
};
|
|
68
|
+
return data;
|
|
69
|
+
}
|
|
70
|
+
var _EnvironmentManager = require("../EnvironmentManager");
|
|
64
71
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
65
72
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
66
73
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -79,6 +86,8 @@ function createWriteBundleRequest(input) {
|
|
|
79
86
|
input
|
|
80
87
|
};
|
|
81
88
|
}
|
|
89
|
+
|
|
90
|
+
// @ts-expect-error TS7031
|
|
82
91
|
async function run({
|
|
83
92
|
input,
|
|
84
93
|
options,
|
|
@@ -114,7 +123,8 @@ async function run({
|
|
|
114
123
|
let cacheKeys = info.cacheKeys;
|
|
115
124
|
let mapKey = cacheKeys.map;
|
|
116
125
|
let fullPath = (0, _projectPath.fromProjectPath)(options.projectRoot, filePath);
|
|
117
|
-
|
|
126
|
+
const env = (0, _EnvironmentManager.fromEnvironmentId)(bundle.env);
|
|
127
|
+
if (mapKey && env.sourceMap && !env.sourceMap.inline) {
|
|
118
128
|
api.invalidateOnFileDelete((0, _projectPath.toProjectPath)(options.projectRoot, fullPath + '.map'));
|
|
119
129
|
}
|
|
120
130
|
let dir = _path().default.dirname(fullPath);
|
|
@@ -134,10 +144,14 @@ async function run({
|
|
|
134
144
|
contentStream = (0, _utils().blobToStream)(await options.cache.getBlob(cacheKeys.content));
|
|
135
145
|
}
|
|
136
146
|
let size = 0;
|
|
137
|
-
contentStream = contentStream.pipe(
|
|
147
|
+
contentStream = contentStream.pipe(
|
|
148
|
+
// @ts-expect-error TS2554
|
|
149
|
+
new (_utils().TapStream)(buf => {
|
|
138
150
|
size += buf.length;
|
|
139
151
|
}));
|
|
140
|
-
let configResult = (0, _nullthrows().default)(
|
|
152
|
+
let configResult = (0, _nullthrows().default)(
|
|
153
|
+
// @ts-expect-error TS2347
|
|
154
|
+
await api.runRequest((0, _AtlaspackConfigRequest.default)()));
|
|
141
155
|
let config = (0, _AtlaspackConfigRequest.getCachedAtlaspackConfig)(configResult, options);
|
|
142
156
|
let {
|
|
143
157
|
devDeps,
|
|
@@ -145,11 +159,14 @@ async function run({
|
|
|
145
159
|
} = await (0, _DevDepRequest.getDevDepRequests)(api);
|
|
146
160
|
(0, _DevDepRequest.invalidateDevDeps)(invalidDevDeps, options, config);
|
|
147
161
|
await writeFiles(contentStream, info, hashRefToNameHash, options, config, outputFS, filePath, writeOptions, devDeps, api);
|
|
148
|
-
|
|
149
|
-
|
|
162
|
+
const hasSourceMap = (0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements') ? await options.cache.hasLargeBlob(mapKey) : await options.cache.has(mapKey);
|
|
163
|
+
if (mapKey && env.sourceMap && !env.sourceMap.inline && hasSourceMap) {
|
|
164
|
+
const mapEntry = (0, _featureFlags().getFeatureFlag)('cachePerformanceImprovements') ? await options.cache.getLargeBlob(mapKey) : await options.cache.getBlob(mapKey);
|
|
165
|
+
await writeFiles((0, _utils().blobToStream)(mapEntry), info, hashRefToNameHash, options, config, outputFS, (0, _projectPath.toProjectPathUnsafe)((0, _projectPath.fromProjectPathRelative)(filePath) + '.map'), writeOptions, devDeps, api);
|
|
150
166
|
}
|
|
151
167
|
let res = {
|
|
152
168
|
filePath,
|
|
169
|
+
bundleId: bundle.id,
|
|
153
170
|
type: info.type,
|
|
154
171
|
stats: {
|
|
155
172
|
size,
|
|
@@ -159,17 +176,23 @@ async function run({
|
|
|
159
176
|
api.storeResult(res);
|
|
160
177
|
return res;
|
|
161
178
|
}
|
|
162
|
-
async function writeFiles(
|
|
179
|
+
async function writeFiles(
|
|
180
|
+
// @ts-expect-error TS2503
|
|
181
|
+
inputStream, info, hashRefToNameHash, options, config, outputFS, filePath, writeOptions, devDeps, api) {
|
|
163
182
|
let compressors = await config.getCompressors((0, _projectPath.fromProjectPathRelative)(filePath));
|
|
164
183
|
let fullPath = (0, _projectPath.fromProjectPath)(options.projectRoot, filePath);
|
|
165
184
|
let stream = info.hashReferences.length ? inputStream.pipe(replaceStream(hashRefToNameHash)) : inputStream;
|
|
166
185
|
let promises = [];
|
|
167
186
|
for (let compressor of compressors) {
|
|
168
|
-
promises.push(
|
|
187
|
+
promises.push(
|
|
188
|
+
// @ts-expect-error TS2345
|
|
189
|
+
runCompressor(compressor, cloneStream(stream), options, outputFS, fullPath, writeOptions, devDeps, api));
|
|
169
190
|
}
|
|
170
191
|
await Promise.all(promises);
|
|
171
192
|
}
|
|
172
|
-
async function runCompressor(compressor,
|
|
193
|
+
async function runCompressor(compressor,
|
|
194
|
+
// @ts-expect-error TS2503
|
|
195
|
+
stream, options, outputFS, filePath, writeOptions, devDeps, api) {
|
|
173
196
|
let measurement;
|
|
174
197
|
try {
|
|
175
198
|
measurement = _profiler().tracer.createMeasurement(compressor.name, 'compress', _path().default.relative(options.projectRoot, filePath));
|
|
@@ -186,7 +209,9 @@ async function runCompressor(compressor, stream, options, outputFS, filePath, wr
|
|
|
186
209
|
});
|
|
187
210
|
if (res != null) {
|
|
188
211
|
await new Promise((resolve, reject) => (0, _stream().pipeline)(res.stream, outputFS.createWriteStream(filePath + (res.type != null ? '.' + res.type : ''), writeOptions), err => {
|
|
189
|
-
if (err) reject(err);
|
|
212
|
+
if (err) reject(err);
|
|
213
|
+
// @ts-expect-error TS2794
|
|
214
|
+
else resolve();
|
|
190
215
|
}));
|
|
191
216
|
}
|
|
192
217
|
} catch (err) {
|
|
@@ -241,12 +266,15 @@ function replaceStream(hashRefToNameHash) {
|
|
|
241
266
|
}
|
|
242
267
|
});
|
|
243
268
|
}
|
|
269
|
+
|
|
270
|
+
// @ts-expect-error TS2503
|
|
244
271
|
function cloneStream(readable) {
|
|
245
272
|
let res = new (_stream().Readable)();
|
|
246
|
-
// $FlowFixMe
|
|
247
273
|
res._read = () => {};
|
|
274
|
+
// @ts-expect-error TS7006
|
|
248
275
|
readable.on('data', chunk => res.push(chunk));
|
|
249
276
|
readable.on('end', () => res.push(null));
|
|
277
|
+
// @ts-expect-error TS7006
|
|
250
278
|
readable.on('error', err => res.emit('error', err));
|
|
251
279
|
return res;
|
|
252
280
|
}
|