@atlaspack/core 2.16.2-canary.33 → 2.16.2-canary.330
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 +835 -0
- package/dist/AssetGraph.js +591 -0
- package/dist/Atlaspack.js +663 -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 +491 -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 +63 -0
- package/dist/atlaspack-v3/NapiWorkerPool.js +61 -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 +76 -0
- package/dist/atlaspack-v3/worker/compat/plugin-logger.js +26 -0
- package/dist/atlaspack-v3/worker/compat/plugin-options.js +122 -0
- package/dist/atlaspack-v3/worker/compat/plugin-tracer.js +10 -0
- package/dist/atlaspack-v3/worker/compat/target.js +14 -0
- package/dist/atlaspack-v3/worker/worker.js +307 -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 +65 -0
- package/dist/requests/AtlaspackConfigRequest.js +493 -0
- package/dist/requests/BundleGraphRequest.js +447 -0
- package/dist/requests/ConfigRequest.js +222 -0
- package/dist/requests/DevDepRequest.js +204 -0
- package/dist/requests/EntryRequest.js +314 -0
- package/dist/requests/PackageRequest.js +62 -0
- package/dist/requests/PathRequest.js +349 -0
- package/dist/requests/TargetRequest.js +1311 -0
- package/dist/requests/ValidationRequest.js +49 -0
- package/dist/requests/WriteBundleRequest.js +254 -0
- package/dist/requests/WriteBundlesRequest.js +184 -0
- package/dist/requests/asset-graph-diff.js +128 -0
- package/dist/requests/asset-graph-dot.js +131 -0
- package/dist/resolveOptions.js +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 +87 -38
- 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 +35 -14
- 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 +32 -14
- package/lib/atlaspack-v3/NapiWorkerPool.js +7 -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 +8 -10
- package/lib/atlaspack-v3/worker/compat/plugin-options.js +1 -0
- package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +3 -0
- package/lib/atlaspack-v3/worker/compat/target.js +2 -0
- package/lib/atlaspack-v3/worker/index.js +3 -0
- package/lib/atlaspack-v3/worker/worker.js +60 -12
- 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 +10 -4
- package/lib/requests/AtlaspackConfigRequest.js +27 -16
- package/lib/requests/BundleGraphRequest.js +40 -23
- package/lib/requests/ConfigRequest.js +28 -4
- package/lib/requests/DevDepRequest.js +31 -5
- package/lib/requests/EntryRequest.js +2 -0
- package/lib/requests/PackageRequest.js +2 -1
- package/lib/requests/PathRequest.js +24 -3
- package/lib/requests/TargetRequest.js +122 -57
- package/lib/requests/ValidationRequest.js +5 -1
- package/lib/requests/WriteBundleRequest.js +39 -11
- package/lib/requests/WriteBundlesRequest.js +51 -4
- package/lib/requests/asset-graph-diff.js +12 -7
- package/lib/requests/asset-graph-dot.js +1 -7
- package/lib/resolveOptions.js +37 -10
- package/lib/rustWorkerThreadDylibHack.js +0 -1
- package/lib/types/AssetGraph.d.ts +80 -0
- package/lib/types/Atlaspack.d.ts +52 -0
- package/lib/types/AtlaspackConfig.d.ts +65 -0
- package/lib/types/AtlaspackConfig.schema.d.ts +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 +24 -0
- package/lib/types/PackagerRunner.d.ts +85 -0
- package/lib/types/ReporterRunner.d.ts +25 -0
- package/lib/types/RequestTracker.d.ts +385 -0
- package/lib/types/SymbolPropagation.d.ts +11 -0
- package/lib/types/TargetDescriptor.schema.d.ts +5 -0
- package/lib/types/Transformation.d.ts +72 -0
- package/lib/types/UncommittedAsset.d.ts +61 -0
- package/lib/types/Validation.d.ts +37 -0
- package/lib/types/applyRuntimes.d.ts +25 -0
- package/lib/types/assetUtils.d.ts +42 -0
- package/lib/types/atlaspack-v3/AtlaspackV3.d.ts +26 -0
- package/lib/types/atlaspack-v3/NapiWorkerPool.d.ts +12 -0
- package/lib/types/atlaspack-v3/fs.d.ts +12 -0
- package/lib/types/atlaspack-v3/index.d.ts +5 -0
- package/lib/types/atlaspack-v3/jsCallable.d.ts +1 -0
- package/lib/types/atlaspack-v3/worker/compat/asset-symbols.d.ts +51 -0
- package/lib/types/atlaspack-v3/worker/compat/bitflags.d.ts +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 +37 -0
- package/lib/types/atlaspack-v3/worker/compat/plugin-logger.d.ts +9 -0
- package/lib/types/atlaspack-v3/worker/compat/plugin-options.d.ts +22 -0
- package/lib/types/atlaspack-v3/worker/compat/plugin-tracer.d.ts +5 -0
- package/lib/types/atlaspack-v3/worker/compat/target.d.ts +11 -0
- package/lib/types/atlaspack-v3/worker/worker.d.ts +60 -0
- package/lib/types/constants.d.ts +13 -0
- package/lib/types/dumpGraphToGraphViz.d.ts +10 -0
- package/lib/types/index.d.ts +8 -0
- package/lib/types/loadAtlaspackPlugin.d.ts +8 -0
- package/lib/types/loadDotEnv.d.ts +3 -0
- package/lib/types/projectPath.d.ts +19 -0
- package/lib/types/public/Asset.d.ts +74 -0
- package/lib/types/public/Bundle.d.ts +45 -0
- package/lib/types/public/BundleGraph.d.ts +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 +59 -0
- package/lib/types/requests/DevDepRequest.d.ts +30 -0
- package/lib/types/requests/EntryRequest.d.ts +36 -0
- package/lib/types/requests/PackageRequest.d.ts +27 -0
- package/lib/types/requests/PathRequest.d.ts +48 -0
- package/lib/types/requests/TargetRequest.d.ts +48 -0
- package/lib/types/requests/ValidationRequest.d.ts +20 -0
- package/lib/types/requests/WriteBundleRequest.d.ts +28 -0
- package/lib/types/requests/WriteBundlesRequest.d.ts +32 -0
- package/lib/types/requests/asset-graph-diff.d.ts +1 -0
- package/lib/types/requests/asset-graph-dot.d.ts +9 -0
- package/lib/types/resolveOptions.d.ts +3 -0
- package/lib/types/rustWorkerThreadDylibHack.d.ts +9 -0
- package/lib/types/serializerCore.browser.d.ts +3 -0
- package/lib/types/summarizeRequest.d.ts +10 -0
- package/lib/types/types.d.ts +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} +121 -63
- 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} +74 -64
- 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 +111 -0
- package/src/atlaspack-v3/{NapiWorkerPool.js → NapiWorkerPool.ts} +15 -6
- package/src/atlaspack-v3/{fs.js → fs.ts} +3 -4
- package/src/atlaspack-v3/{index.js → index.ts} +2 -4
- package/src/atlaspack-v3/jsCallable.ts +14 -0
- package/src/atlaspack-v3/worker/compat/{asset-symbols.js → asset-symbols.ts} +40 -30
- package/src/atlaspack-v3/worker/compat/bitflags.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} +27 -26
- package/src/atlaspack-v3/worker/compat/{plugin-logger.js → plugin-logger.ts} +0 -2
- package/src/atlaspack-v3/worker/compat/{plugin-options.js → plugin-options.ts} +4 -5
- package/src/atlaspack-v3/worker/compat/{plugin-tracer.js → plugin-tracer.ts} +2 -2
- package/src/atlaspack-v3/worker/compat/{target.js → target.ts} +3 -4
- package/src/atlaspack-v3/worker/index.js +2 -1
- package/src/atlaspack-v3/worker/{worker.js → worker.ts} +124 -71
- 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.js → AtlaspackBuildRequest.ts} +46 -32
- package/src/requests/{AtlaspackConfigRequest.js → AtlaspackConfigRequest.ts} +72 -58
- package/src/requests/{BundleGraphRequest.js → BundleGraphRequest.ts} +93 -76
- package/src/requests/{ConfigRequest.js → ConfigRequest.ts} +71 -50
- package/src/requests/{DevDepRequest.js → DevDepRequest.ts} +60 -35
- package/src/requests/{EntryRequest.js → EntryRequest.ts} +36 -31
- package/src/requests/{PackageRequest.js → PackageRequest.ts} +20 -22
- package/src/requests/{PathRequest.js → PathRequest.ts} +47 -37
- package/src/requests/{TargetRequest.js → TargetRequest.ts} +260 -179
- package/src/requests/{ValidationRequest.js → ValidationRequest.ts} +18 -17
- package/src/requests/{WriteBundleRequest.js → WriteBundleRequest.ts} +77 -49
- package/src/requests/{WriteBundlesRequest.js → WriteBundlesRequest.ts} +109 -37
- package/src/requests/{asset-graph-diff.js → asset-graph-diff.ts} +25 -21
- package/src/requests/{asset-graph-dot.js → asset-graph-dot.ts} +8 -12
- package/src/{resolveOptions.js → resolveOptions.ts} +57 -24
- package/src/{rustWorkerThreadDylibHack.js → rustWorkerThreadDylibHack.ts} +1 -4
- package/src/{serializerCore.browser.js → serializerCore.browser.ts} +2 -3
- package/src/{summarizeRequest.js → summarizeRequest.ts} +17 -5
- package/src/types.ts +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/jsCallable.js +0 -18
- package/src/atlaspack-v3/worker/compat/bitflags.js +0 -100
- package/src/index.js +0 -13
- package/src/requests/AssetGraphRequestRust.js +0 -263
- package/src/types.js +0 -600
- package/test/Environment.test.js +0 -119
- package/test/PackagerRunner.test.js +0 -27
- package/test/PublicEnvironment.test.js +0 -27
- package/test/requests/AssetGraphRequestRust.test.js +0 -411
package/lib/loadDotEnv.js
CHANGED
|
@@ -34,7 +34,9 @@ async function loadEnv(env, fs, filePath, projectRoot) {
|
|
|
34
34
|
// results for everyone
|
|
35
35
|
NODE_ENV === 'test' ? null : '.env.local', `.env.${NODE_ENV}`, `.env.${NODE_ENV}.local`].filter(Boolean);
|
|
36
36
|
let envs = await Promise.all(dotenvFiles.map(async dotenvFile => {
|
|
37
|
-
const envPath = await (0, _utils().resolveConfig)(fs, filePath,
|
|
37
|
+
const envPath = await (0, _utils().resolveConfig)(fs, filePath,
|
|
38
|
+
// @ts-expect-error TS2322
|
|
39
|
+
[dotenvFile], projectRoot);
|
|
38
40
|
if (envPath == null) {
|
|
39
41
|
return;
|
|
40
42
|
}
|
|
@@ -43,6 +45,7 @@ async function loadEnv(env, fs, filePath, projectRoot) {
|
|
|
43
45
|
// https://github.com/motdotla/dotenv-expand/blob/ddb73d02322fe8522b4e05b73e1c1ad24ea7c14a/lib/main.js#L5
|
|
44
46
|
let output = (0, _dotenvExpand().default)({
|
|
45
47
|
parsed: _dotenv().default.parse(await fs.readFile(envPath)),
|
|
48
|
+
// @ts-expect-error TS2353
|
|
46
49
|
ignoreProcessEnv: true
|
|
47
50
|
});
|
|
48
51
|
if (output.error != null) {
|
package/lib/projectPath.js
CHANGED
|
@@ -33,6 +33,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
33
33
|
/**
|
|
34
34
|
* A path that's relative to the project root.
|
|
35
35
|
*/
|
|
36
|
+
|
|
36
37
|
/**
|
|
37
38
|
* Converts a file path to a project-relative path.
|
|
38
39
|
*
|
|
@@ -67,6 +68,8 @@ function toProjectPath_(projectRoot, p) {
|
|
|
67
68
|
}
|
|
68
69
|
return relative;
|
|
69
70
|
}
|
|
71
|
+
|
|
72
|
+
// @ts-expect-error TS2322
|
|
70
73
|
const toProjectPath = exports.toProjectPath = toProjectPath_;
|
|
71
74
|
function fromProjectPath_(projectRoot, p) {
|
|
72
75
|
if (p == null) {
|
|
@@ -88,6 +91,8 @@ function fromProjectPath_(projectRoot, p) {
|
|
|
88
91
|
}
|
|
89
92
|
return projectRoot + projectPath;
|
|
90
93
|
}
|
|
94
|
+
|
|
95
|
+
// @ts-expect-error TS2322
|
|
91
96
|
const fromProjectPath = exports.fromProjectPath = fromProjectPath_;
|
|
92
97
|
|
|
93
98
|
/**
|
package/lib/public/Asset.js
CHANGED
|
@@ -23,6 +23,7 @@ var _Environment2 = require("../Environment");
|
|
|
23
23
|
var _projectPath = require("../projectPath");
|
|
24
24
|
var _types = require("../types");
|
|
25
25
|
var _utils = require("../utils");
|
|
26
|
+
var _EnvironmentManager = require("../EnvironmentManager");
|
|
26
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
28
|
const inspect = Symbol.for('nodejs.util.inspect.custom');
|
|
28
29
|
const uncommittedAssetValueToAsset = new WeakMap();
|
|
@@ -44,14 +45,11 @@ function assetFromValue(value, options) {
|
|
|
44
45
|
}
|
|
45
46
|
class BaseAsset {
|
|
46
47
|
#asset;
|
|
47
|
-
#query
|
|
48
|
-
|
|
48
|
+
#query;
|
|
49
49
|
constructor(asset) {
|
|
50
50
|
this.#asset = asset;
|
|
51
51
|
_assetToAssetValue.set(this, asset.value);
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
// $FlowFixMe[unsupported-syntax]
|
|
55
53
|
[inspect]() {
|
|
56
54
|
return `Asset(${this.filePath})`;
|
|
57
55
|
}
|
|
@@ -62,7 +60,7 @@ class BaseAsset {
|
|
|
62
60
|
return this.#asset.value.type;
|
|
63
61
|
}
|
|
64
62
|
get env() {
|
|
65
|
-
return new _Environment.default(this.#asset.value.env, this.#asset.options);
|
|
63
|
+
return new _Environment.default((0, _EnvironmentManager.fromEnvironmentId)(this.#asset.value.env), this.#asset.options);
|
|
66
64
|
}
|
|
67
65
|
get fs() {
|
|
68
66
|
return this.#asset.options.inputFS;
|
|
@@ -93,6 +91,7 @@ class BaseAsset {
|
|
|
93
91
|
return this.#asset.value.sideEffects;
|
|
94
92
|
}
|
|
95
93
|
get symbols() {
|
|
94
|
+
// @ts-expect-error TS2322
|
|
96
95
|
return new _Symbols.AssetSymbols(this.#asset.options, this.#asset.value);
|
|
97
96
|
}
|
|
98
97
|
get uniqueKey() {
|
|
@@ -127,9 +126,9 @@ class BaseAsset {
|
|
|
127
126
|
}
|
|
128
127
|
}
|
|
129
128
|
class Asset extends BaseAsset {
|
|
130
|
-
|
|
131
|
-
#
|
|
132
|
-
|
|
129
|
+
// @ts-expect-error TS2564
|
|
130
|
+
#asset;
|
|
131
|
+
#env;
|
|
133
132
|
constructor(asset) {
|
|
134
133
|
let assetValueToAsset = asset.value.committed ? committedAssetValueToAsset : uncommittedAssetValueToAsset;
|
|
135
134
|
let existing = assetValueToAsset.get(asset.value);
|
|
@@ -142,7 +141,7 @@ class Asset extends BaseAsset {
|
|
|
142
141
|
return this;
|
|
143
142
|
}
|
|
144
143
|
get env() {
|
|
145
|
-
this.#env ??= new _Environment.default(this.#asset.value.env, this.#asset.options);
|
|
144
|
+
this.#env ??= new _Environment.default((0, _EnvironmentManager.fromEnvironmentId)(this.#asset.value.env), this.#asset.options);
|
|
146
145
|
return this.#env;
|
|
147
146
|
}
|
|
148
147
|
get stats() {
|
|
@@ -151,8 +150,8 @@ class Asset extends BaseAsset {
|
|
|
151
150
|
}
|
|
152
151
|
exports.Asset = Asset;
|
|
153
152
|
class MutableAsset extends BaseAsset {
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
// @ts-expect-error TS2564
|
|
154
|
+
#asset;
|
|
156
155
|
constructor(asset) {
|
|
157
156
|
let existing = assetValueToMutableAsset.get(asset.value);
|
|
158
157
|
if (existing != null) {
|
|
@@ -170,6 +169,8 @@ class MutableAsset extends BaseAsset {
|
|
|
170
169
|
get type() {
|
|
171
170
|
return this.#asset.value.type;
|
|
172
171
|
}
|
|
172
|
+
|
|
173
|
+
// @ts-expect-error TS1095
|
|
173
174
|
set type(type) {
|
|
174
175
|
if (type !== this.#asset.value.type) {
|
|
175
176
|
this.#asset.value.type = type;
|
|
@@ -180,24 +181,32 @@ class MutableAsset extends BaseAsset {
|
|
|
180
181
|
let bundleBehavior = this.#asset.value.bundleBehavior;
|
|
181
182
|
return bundleBehavior == null ? null : _types.BundleBehaviorNames[bundleBehavior];
|
|
182
183
|
}
|
|
184
|
+
|
|
185
|
+
// @ts-expect-error TS1095
|
|
183
186
|
set bundleBehavior(bundleBehavior) {
|
|
184
187
|
this.#asset.value.bundleBehavior = bundleBehavior ? _types.BundleBehavior[bundleBehavior] : null;
|
|
185
188
|
}
|
|
186
189
|
get isBundleSplittable() {
|
|
187
190
|
return this.#asset.value.isBundleSplittable;
|
|
188
191
|
}
|
|
192
|
+
|
|
193
|
+
// @ts-expect-error TS1095
|
|
189
194
|
set isBundleSplittable(isBundleSplittable) {
|
|
190
195
|
this.#asset.value.isBundleSplittable = isBundleSplittable;
|
|
191
196
|
}
|
|
192
197
|
get sideEffects() {
|
|
193
198
|
return this.#asset.value.sideEffects;
|
|
194
199
|
}
|
|
200
|
+
|
|
201
|
+
// @ts-expect-error TS1095
|
|
195
202
|
set sideEffects(sideEffects) {
|
|
196
203
|
this.#asset.value.sideEffects = sideEffects;
|
|
197
204
|
}
|
|
198
205
|
get uniqueKey() {
|
|
199
206
|
return this.#asset.value.uniqueKey;
|
|
200
207
|
}
|
|
208
|
+
|
|
209
|
+
// @ts-expect-error TS1095
|
|
201
210
|
set uniqueKey(uniqueKey) {
|
|
202
211
|
if (this.#asset.value.uniqueKey != null) {
|
|
203
212
|
throw new Error("Cannot change an asset's uniqueKey after it has been set.");
|
|
@@ -205,6 +214,7 @@ class MutableAsset extends BaseAsset {
|
|
|
205
214
|
this.#asset.value.uniqueKey = uniqueKey;
|
|
206
215
|
}
|
|
207
216
|
get symbols() {
|
|
217
|
+
// @ts-expect-error TS2322
|
|
208
218
|
return new _Symbols.MutableAssetSymbols(this.#asset.options, this.#asset.value);
|
|
209
219
|
}
|
|
210
220
|
addDependency(dep) {
|
package/lib/public/Bundle.js
CHANGED
|
@@ -40,6 +40,7 @@ var _Dependency = require("./Dependency");
|
|
|
40
40
|
var _Target = _interopRequireDefault(require("./Target"));
|
|
41
41
|
var _types = require("../types");
|
|
42
42
|
var _projectPath = require("../projectPath");
|
|
43
|
+
var _EnvironmentManager = require("../EnvironmentManager");
|
|
43
44
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
44
45
|
const inspect = Symbol.for('nodejs.util.inspect.custom');
|
|
45
46
|
const internalBundleToBundle = new (_utils().DefaultWeakMap)(() => new (_utils().DefaultWeakMap)(() => new WeakMap()));
|
|
@@ -61,11 +62,9 @@ function bundleToInternalBundleGraph(bundle) {
|
|
|
61
62
|
// preventing others from using them. They should use the static `get` method.
|
|
62
63
|
let _private = {};
|
|
63
64
|
class Bundle {
|
|
64
|
-
#bundle
|
|
65
|
-
#bundleGraph
|
|
66
|
-
#options
|
|
67
|
-
|
|
68
|
-
// $FlowFixMe
|
|
65
|
+
#bundle;
|
|
66
|
+
#bundleGraph;
|
|
67
|
+
#options;
|
|
69
68
|
[inspect]() {
|
|
70
69
|
return `Bundle(${this.#bundle.id})`;
|
|
71
70
|
}
|
|
@@ -99,7 +98,7 @@ class Bundle {
|
|
|
99
98
|
return this.#bundle.type;
|
|
100
99
|
}
|
|
101
100
|
get env() {
|
|
102
|
-
return new _Environment.default(this.#bundle.env, this.#options);
|
|
101
|
+
return new _Environment.default((0, _EnvironmentManager.fromEnvironmentId)(this.#bundle.env), this.#options);
|
|
103
102
|
}
|
|
104
103
|
get needsStableName() {
|
|
105
104
|
return this.#bundle.needsStableName;
|
|
@@ -138,7 +137,9 @@ class Bundle {
|
|
|
138
137
|
}
|
|
139
138
|
}
|
|
140
139
|
traverse(visit) {
|
|
141
|
-
return this.#bundleGraph.traverseBundle(this.#bundle,
|
|
140
|
+
return this.#bundleGraph.traverseBundle(this.#bundle,
|
|
141
|
+
// @ts-expect-error TS2345
|
|
142
|
+
(0, _graph().mapVisitor)(node => {
|
|
142
143
|
if (node.type === 'asset') {
|
|
143
144
|
return {
|
|
144
145
|
type: 'asset',
|
|
@@ -158,10 +159,9 @@ class Bundle {
|
|
|
158
159
|
}
|
|
159
160
|
exports.Bundle = Bundle;
|
|
160
161
|
class NamedBundle extends Bundle {
|
|
161
|
-
#bundle
|
|
162
|
-
#bundleGraph
|
|
163
|
-
#options
|
|
164
|
-
|
|
162
|
+
#bundle;
|
|
163
|
+
#bundleGraph;
|
|
164
|
+
#options;
|
|
165
165
|
constructor(sentinel, bundle, bundleGraph, options) {
|
|
166
166
|
super(sentinel, bundle, bundleGraph, options);
|
|
167
167
|
this.#bundle = bundle; // Repeating for flow
|
|
@@ -192,11 +192,10 @@ class NamedBundle extends Bundle {
|
|
|
192
192
|
}
|
|
193
193
|
exports.NamedBundle = NamedBundle;
|
|
194
194
|
class PackagedBundle extends NamedBundle {
|
|
195
|
-
#bundle
|
|
196
|
-
#bundleGraph
|
|
197
|
-
#options
|
|
198
|
-
#bundleInfo
|
|
199
|
-
|
|
195
|
+
#bundle;
|
|
196
|
+
#bundleGraph;
|
|
197
|
+
#options;
|
|
198
|
+
#bundleInfo;
|
|
200
199
|
constructor(sentinel, bundle, bundleGraph, options) {
|
|
201
200
|
super(sentinel, bundle, bundleGraph, options);
|
|
202
201
|
this.#bundle = bundle; // Repeating for flow
|
|
@@ -32,13 +32,6 @@ var _Dependency = _interopRequireWildcard(require("./Dependency"));
|
|
|
32
32
|
var _Target = require("./Target");
|
|
33
33
|
var _utils = require("../utils");
|
|
34
34
|
var _BundleGroup = _interopRequireWildcard(require("./BundleGroup"));
|
|
35
|
-
function _featureFlags() {
|
|
36
|
-
const data = require("@atlaspack/feature-flags");
|
|
37
|
-
_featureFlags = function () {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
return data;
|
|
41
|
-
}
|
|
42
35
|
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); }
|
|
43
36
|
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; }
|
|
44
37
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -56,7 +49,6 @@ class BundleGraph {
|
|
|
56
49
|
this.#graph = graph;
|
|
57
50
|
this.#options = options;
|
|
58
51
|
this.#createBundle = createBundle;
|
|
59
|
-
// $FlowFixMe
|
|
60
52
|
_bundleGraphToInternalBundleGraph.set(this, graph);
|
|
61
53
|
}
|
|
62
54
|
getAssetById(id) {
|
|
@@ -122,6 +114,19 @@ class BundleGraph {
|
|
|
122
114
|
isAssetReferenced(bundle, asset) {
|
|
123
115
|
return this.#graph.isAssetReferenced((0, _Bundle.bundleToInternalBundle)(bundle), (0, _Asset.assetToAssetValue)(asset));
|
|
124
116
|
}
|
|
117
|
+
isAssetReferencedFastCheck(bundle, asset) {
|
|
118
|
+
return this.#graph.isAssetReferencedFastCheck((0, _Bundle.bundleToInternalBundle)(bundle), (0, _Asset.assetToAssetValue)(asset));
|
|
119
|
+
}
|
|
120
|
+
getReferencedAssets(bundle) {
|
|
121
|
+
let internalReferencedAssets = this.#graph.getReferencedAssets((0, _Bundle.bundleToInternalBundle)(bundle));
|
|
122
|
+
|
|
123
|
+
// Convert internal assets to public assets
|
|
124
|
+
let publicReferencedAssets = new Set();
|
|
125
|
+
for (let internalAsset of internalReferencedAssets) {
|
|
126
|
+
publicReferencedAssets.add((0, _Asset.assetFromValue)(internalAsset, this.#options));
|
|
127
|
+
}
|
|
128
|
+
return publicReferencedAssets;
|
|
129
|
+
}
|
|
125
130
|
hasParentBundleOfType(bundle, type) {
|
|
126
131
|
return this.#graph.hasParentBundleOfType((0, _Bundle.bundleToInternalBundle)(bundle), type);
|
|
127
132
|
}
|
|
@@ -160,7 +165,9 @@ class BundleGraph {
|
|
|
160
165
|
}));
|
|
161
166
|
}
|
|
162
167
|
traverse(visit, start, opts) {
|
|
163
|
-
return this.#graph.traverse(
|
|
168
|
+
return this.#graph.traverse(
|
|
169
|
+
// @ts-expect-error TS2345
|
|
170
|
+
(0, _graph().mapVisitor)((node, actions) => {
|
|
164
171
|
// Skipping unused dependencies here is faster than doing an isDependencySkipped check inside the visitor
|
|
165
172
|
// because the node needs to be re-looked up by id from the hashmap.
|
|
166
173
|
if (opts !== null && opts !== void 0 && opts.skipUnusedDependencies && node.type === 'dependency' && (node.hasDeferred || node.excluded)) {
|
|
@@ -234,6 +241,8 @@ class BundleGraph {
|
|
|
234
241
|
});
|
|
235
242
|
}
|
|
236
243
|
}
|
|
244
|
+
|
|
245
|
+
// @ts-expect-error TS2322
|
|
237
246
|
return conditions;
|
|
238
247
|
}
|
|
239
248
|
|
|
@@ -265,25 +274,19 @@ class BundleGraph {
|
|
|
265
274
|
(0, _assert().default)(resolved.type === 'bundle_group');
|
|
266
275
|
return this.getBundlesInBundleGroup(resolved.value);
|
|
267
276
|
};
|
|
277
|
+
// @ts-expect-error TS2345
|
|
268
278
|
ifTrueBundles.push(...depToBundles(cond.ifTrueDependency));
|
|
279
|
+
// @ts-expect-error TS2345
|
|
269
280
|
ifFalseBundles.push(...depToBundles(cond.ifFalseDependency));
|
|
270
281
|
}
|
|
271
282
|
for (let bundle of bundles) {
|
|
272
283
|
const conditions = bundleConditions.get(bundle.id) ?? new Map();
|
|
273
284
|
const currentCondition = conditions.get(cond.key);
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
});
|
|
280
|
-
} else {
|
|
281
|
-
conditions.set(cond.key, {
|
|
282
|
-
bundle,
|
|
283
|
-
ifTrueBundles,
|
|
284
|
-
ifFalseBundles
|
|
285
|
-
});
|
|
286
|
-
}
|
|
285
|
+
conditions.set(cond.key, {
|
|
286
|
+
bundle,
|
|
287
|
+
ifTrueBundles: [...((currentCondition === null || currentCondition === void 0 ? void 0 : currentCondition.ifTrueBundles) ?? []), ...ifTrueBundles],
|
|
288
|
+
ifFalseBundles: [...((currentCondition === null || currentCondition === void 0 ? void 0 : currentCondition.ifFalseBundles) ?? []), ...ifFalseBundles]
|
|
289
|
+
});
|
|
287
290
|
bundleConditions.set(bundle.id, conditions);
|
|
288
291
|
}
|
|
289
292
|
}
|
|
@@ -21,9 +21,10 @@ function bundleGroupToInternalBundleGroup(target) {
|
|
|
21
21
|
}
|
|
22
22
|
const inspect = Symbol.for('nodejs.util.inspect.custom');
|
|
23
23
|
class BundleGroup {
|
|
24
|
-
|
|
25
|
-
#
|
|
26
|
-
|
|
24
|
+
// @ts-expect-error TS2564
|
|
25
|
+
#bundleGroup;
|
|
26
|
+
// @ts-expect-error TS2564
|
|
27
|
+
#options;
|
|
27
28
|
constructor(bundleGroup, options) {
|
|
28
29
|
let existing = internalBundleGroupToBundleGroup.get(bundleGroup);
|
|
29
30
|
if (existing != null) {
|
|
@@ -41,8 +42,6 @@ class BundleGroup {
|
|
|
41
42
|
get entryAssetId() {
|
|
42
43
|
return this.#bundleGroup.entryAssetId;
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
-
// $FlowFixMe
|
|
46
45
|
[inspect]() {
|
|
47
46
|
return `BundleGroup(${this.entryAssetId})`;
|
|
48
47
|
}
|
package/lib/public/Config.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
exports.makeConfigProxy = makeConfigProxy;
|
|
7
8
|
function _assert() {
|
|
8
9
|
const data = _interopRequireDefault(require("assert"));
|
|
9
10
|
_assert = function () {
|
|
@@ -27,14 +28,80 @@ function _utils() {
|
|
|
27
28
|
}
|
|
28
29
|
var _Environment = _interopRequireDefault(require("./Environment"));
|
|
29
30
|
var _projectPath = require("../projectPath");
|
|
31
|
+
var _EnvironmentManager = require("../EnvironmentManager");
|
|
30
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
33
|
const internalConfigToConfig = new (_utils().DefaultWeakMap)(() => new WeakMap());
|
|
32
|
-
class PublicConfig {
|
|
33
|
-
#config /*: Config */;
|
|
34
|
-
#pkg /*: ?PackageJSON */;
|
|
35
|
-
#pkgFilePath /*: ?FilePath */;
|
|
36
|
-
#options /*: AtlaspackOptions */;
|
|
37
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Implements read tracking over an object.
|
|
37
|
+
*
|
|
38
|
+
* Calling this function with a non-trivial object like a class instance will fail to work.
|
|
39
|
+
*
|
|
40
|
+
* We track reads to fields that resolve to:
|
|
41
|
+
*
|
|
42
|
+
* - primitive values
|
|
43
|
+
* - arrays
|
|
44
|
+
*
|
|
45
|
+
* That is, reading a nested field `a.b.c` will make a single call to `onRead` with the path
|
|
46
|
+
* `['a', 'b', 'c']`.
|
|
47
|
+
*
|
|
48
|
+
* In case the value is null or an array, we will track the read as well.
|
|
49
|
+
*
|
|
50
|
+
* Iterating over `Object.keys(obj.field)` will register a read for the `['field']` path.
|
|
51
|
+
* Other reads work normally.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
*
|
|
55
|
+
* const usedPaths = new Set();
|
|
56
|
+
* const onRead = (path) => {
|
|
57
|
+
* usedPaths.add(path);
|
|
58
|
+
* };
|
|
59
|
+
*
|
|
60
|
+
* const config = makeConfigProxy(onRead, {a: {b: {c: 'd'}}})
|
|
61
|
+
* console.log(config.a.b.c);
|
|
62
|
+
* console.log(Array.from(usedPaths));
|
|
63
|
+
* // We get a single read for the path
|
|
64
|
+
* // ['a', 'b', 'c']
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
function makeConfigProxy(onRead, config) {
|
|
68
|
+
const reportedPaths = new Set();
|
|
69
|
+
const reportPath = path => {
|
|
70
|
+
if (reportedPaths.has(path)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
reportedPaths.add(path);
|
|
74
|
+
onRead(path);
|
|
75
|
+
};
|
|
76
|
+
const makeProxy = (target, path) => {
|
|
77
|
+
// @ts-expect-error TS2345
|
|
78
|
+
return new Proxy(target, {
|
|
79
|
+
ownKeys(target) {
|
|
80
|
+
reportPath(path);
|
|
81
|
+
return Object.getOwnPropertyNames(target);
|
|
82
|
+
},
|
|
83
|
+
get(target, prop) {
|
|
84
|
+
// @ts-expect-error TS7053
|
|
85
|
+
const value = target[prop];
|
|
86
|
+
if (typeof value === 'object' && value != null && !Array.isArray(value)) {
|
|
87
|
+
return makeProxy(value, [...path, prop]);
|
|
88
|
+
}
|
|
89
|
+
reportPath([...path, prop]);
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// @ts-expect-error TS2322
|
|
96
|
+
return makeProxy(config, []);
|
|
97
|
+
}
|
|
98
|
+
class PublicConfig {
|
|
99
|
+
// @ts-expect-error TS2564
|
|
100
|
+
#config;
|
|
101
|
+
#pkg;
|
|
102
|
+
#pkgFilePath;
|
|
103
|
+
// @ts-expect-error TS2564
|
|
104
|
+
#options;
|
|
38
105
|
constructor(config, options) {
|
|
39
106
|
let existing = internalConfigToConfig.get(options).get(config);
|
|
40
107
|
if (existing != null) {
|
|
@@ -46,7 +113,7 @@ class PublicConfig {
|
|
|
46
113
|
return this;
|
|
47
114
|
}
|
|
48
115
|
get env() {
|
|
49
|
-
return new _Environment.default(this.#config.env, this.#options);
|
|
116
|
+
return new _Environment.default((0, _EnvironmentManager.fromEnvironmentId)(this.#config.env), this.#options);
|
|
50
117
|
}
|
|
51
118
|
get searchPath() {
|
|
52
119
|
return (0, _projectPath.fromProjectPath)(this.#options.projectRoot, this.#config.searchPath);
|
|
@@ -57,8 +124,6 @@ class PublicConfig {
|
|
|
57
124
|
get isSource() {
|
|
58
125
|
return this.#config.isSource;
|
|
59
126
|
}
|
|
60
|
-
|
|
61
|
-
// $FlowFixMe
|
|
62
127
|
setResult(result) {
|
|
63
128
|
this.#config.result = result;
|
|
64
129
|
}
|
|
@@ -86,19 +151,25 @@ class PublicConfig {
|
|
|
86
151
|
});
|
|
87
152
|
}
|
|
88
153
|
invalidateOnFileCreate(invalidation) {
|
|
154
|
+
// @ts-expect-error TS2339
|
|
89
155
|
if (invalidation.glob != null) {
|
|
90
|
-
// $FlowFixMe
|
|
91
156
|
this.#config.invalidateOnFileCreate.push(invalidation);
|
|
157
|
+
// @ts-expect-error TS2339
|
|
92
158
|
} else if (invalidation.filePath != null) {
|
|
93
159
|
this.#config.invalidateOnFileCreate.push({
|
|
94
|
-
filePath: (0, _projectPath.toProjectPath)(this.#options.projectRoot,
|
|
160
|
+
filePath: (0, _projectPath.toProjectPath)(this.#options.projectRoot,
|
|
161
|
+
// @ts-expect-error TS2339
|
|
162
|
+
invalidation.filePath)
|
|
95
163
|
});
|
|
96
164
|
} else {
|
|
165
|
+
// @ts-expect-error TS2339
|
|
97
166
|
(0, _assert().default)(invalidation.aboveFilePath != null);
|
|
98
167
|
this.#config.invalidateOnFileCreate.push({
|
|
99
|
-
//
|
|
168
|
+
// @ts-expect-error TS2339
|
|
100
169
|
fileName: invalidation.fileName,
|
|
101
|
-
aboveFilePath: (0, _projectPath.toProjectPath)(this.#options.projectRoot,
|
|
170
|
+
aboveFilePath: (0, _projectPath.toProjectPath)(this.#options.projectRoot,
|
|
171
|
+
// @ts-expect-error TS2339
|
|
172
|
+
invalidation.aboveFilePath)
|
|
102
173
|
});
|
|
103
174
|
}
|
|
104
175
|
}
|
|
@@ -112,20 +183,46 @@ class PublicConfig {
|
|
|
112
183
|
this.#config.invalidateOnBuild = true;
|
|
113
184
|
}
|
|
114
185
|
async getConfigFrom(searchPath, fileNames, options) {
|
|
186
|
+
// @ts-expect-error TS2339
|
|
115
187
|
let packageKey = options === null || options === void 0 ? void 0 : options.packageKey;
|
|
116
188
|
if (packageKey != null) {
|
|
117
189
|
let pkg = await this.getConfigFrom(searchPath, ['package.json'], {
|
|
118
190
|
exclude: true
|
|
119
191
|
});
|
|
192
|
+
|
|
193
|
+
// @ts-expect-error TS18046
|
|
120
194
|
if (pkg && pkg.contents[packageKey]) {
|
|
121
195
|
// Invalidate only when the package key changes
|
|
122
|
-
this.invalidateOnConfigKeyChange(pkg.filePath, packageKey);
|
|
196
|
+
this.invalidateOnConfigKeyChange(pkg.filePath, [packageKey]);
|
|
123
197
|
return {
|
|
198
|
+
// @ts-expect-error TS18046
|
|
124
199
|
contents: pkg.contents[packageKey],
|
|
125
200
|
filePath: pkg.filePath
|
|
126
201
|
};
|
|
127
202
|
}
|
|
128
203
|
}
|
|
204
|
+
|
|
205
|
+
// @ts-expect-error TS2339
|
|
206
|
+
const readTracking = options === null || options === void 0 ? void 0 : options.readTracking;
|
|
207
|
+
if (readTracking === true) {
|
|
208
|
+
for (let fileName of fileNames) {
|
|
209
|
+
const config = await this.getConfigFrom(searchPath, [fileName], {
|
|
210
|
+
exclude: true
|
|
211
|
+
});
|
|
212
|
+
if (config != null) {
|
|
213
|
+
// @ts-expect-error TS2322
|
|
214
|
+
return Promise.resolve({
|
|
215
|
+
contents: makeConfigProxy(keyPath => {
|
|
216
|
+
this.invalidateOnConfigKeyChange(config.filePath, keyPath);
|
|
217
|
+
}, config.contents),
|
|
218
|
+
filePath: config.filePath
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// fall through so that file above invalidations are registered
|
|
224
|
+
}
|
|
225
|
+
|
|
129
226
|
if (fileNames.length === 0) {
|
|
130
227
|
return null;
|
|
131
228
|
}
|
|
@@ -137,11 +234,15 @@ class PublicConfig {
|
|
|
137
234
|
aboveFilePath: searchPath
|
|
138
235
|
});
|
|
139
236
|
}
|
|
237
|
+
|
|
238
|
+
// @ts-expect-error TS2339
|
|
140
239
|
let parse = options && options.parse;
|
|
141
240
|
let configFilePath = await (0, _utils().resolveConfig)(this.#options.inputFS, searchPath, fileNames, this.#options.projectRoot);
|
|
142
241
|
if (configFilePath == null) {
|
|
143
242
|
return null;
|
|
144
243
|
}
|
|
244
|
+
|
|
245
|
+
// @ts-expect-error TS2339
|
|
145
246
|
if (!options || !options.exclude) {
|
|
146
247
|
this.invalidateOnFileChange(configFilePath);
|
|
147
248
|
}
|
|
@@ -161,9 +262,7 @@ class PublicConfig {
|
|
|
161
262
|
// e.g. uses unknown environment variables, reads from the filesystem, etc.
|
|
162
263
|
this.invalidateOnStartup();
|
|
163
264
|
let config = await this.#options.packageManager.require(specifier, searchPath);
|
|
164
|
-
if (
|
|
165
|
-
// $FlowFixMe
|
|
166
|
-
Object.prototype.toString.call(config) === '[object Module]' && config.default != null) {
|
|
265
|
+
if (Object.prototype.toString.call(config) === '[object Module]' && config.default != null) {
|
|
167
266
|
// Native ESM config. Try to use a default export, otherwise fall back to the whole namespace.
|
|
168
267
|
config = config.default;
|
|
169
268
|
}
|
|
@@ -190,7 +289,9 @@ class PublicConfig {
|
|
|
190
289
|
if (this.#pkg) {
|
|
191
290
|
return this.#pkg;
|
|
192
291
|
}
|
|
193
|
-
let pkgConfig = await this.getConfig(['package.json']
|
|
292
|
+
let pkgConfig = await this.getConfig(['package.json'], {
|
|
293
|
+
readTracking: true
|
|
294
|
+
});
|
|
194
295
|
if (!pkgConfig) {
|
|
195
296
|
return null;
|
|
196
297
|
}
|
package/lib/public/Dependency.js
CHANGED
|
@@ -19,6 +19,7 @@ var _Target = _interopRequireDefault(require("./Target"));
|
|
|
19
19
|
var _Symbols = require("./Symbols");
|
|
20
20
|
var _projectPath = require("../projectPath");
|
|
21
21
|
var _utils = require("../utils");
|
|
22
|
+
var _EnvironmentManager = require("../EnvironmentManager");
|
|
22
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
24
|
const SpecifierTypeNames = Object.keys(_types.SpecifierType);
|
|
24
25
|
const PriorityNames = Object.keys(_types.Priority);
|
|
@@ -36,9 +37,8 @@ function getPublicDependency(dep, options) {
|
|
|
36
37
|
return new Dependency(dep, options);
|
|
37
38
|
}
|
|
38
39
|
class Dependency {
|
|
39
|
-
#dep
|
|
40
|
-
#options
|
|
41
|
-
|
|
40
|
+
#dep;
|
|
41
|
+
#options;
|
|
42
42
|
constructor(dep, options) {
|
|
43
43
|
this.#dep = dep;
|
|
44
44
|
this.#options = options;
|
|
@@ -46,8 +46,6 @@ class Dependency {
|
|
|
46
46
|
internalDependencyToDependency.set(dep, this);
|
|
47
47
|
return this;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
// $FlowFixMe
|
|
51
49
|
[inspect]() {
|
|
52
50
|
return `Dependency(${String(this.sourcePath)} -> ${this.specifier})`;
|
|
53
51
|
}
|
|
@@ -58,9 +56,11 @@ class Dependency {
|
|
|
58
56
|
return this.#dep.specifier;
|
|
59
57
|
}
|
|
60
58
|
get specifierType() {
|
|
59
|
+
// @ts-expect-error TS2322
|
|
61
60
|
return SpecifierTypeNames[this.#dep.specifierType];
|
|
62
61
|
}
|
|
63
62
|
get priority() {
|
|
63
|
+
// @ts-expect-error TS2322
|
|
64
64
|
return PriorityNames[this.#dep.priority];
|
|
65
65
|
}
|
|
66
66
|
get needsStableName() {
|
|
@@ -80,7 +80,7 @@ class Dependency {
|
|
|
80
80
|
return (0, _utils.fromInternalSourceLocation)(this.#options.projectRoot, this.#dep.loc);
|
|
81
81
|
}
|
|
82
82
|
get env() {
|
|
83
|
-
return new _Environment.default(this.#dep.env, this.#options);
|
|
83
|
+
return new _Environment.default((0, _EnvironmentManager.fromEnvironmentId)(this.#dep.env), this.#options);
|
|
84
84
|
}
|
|
85
85
|
get packageConditions() {
|
|
86
86
|
// Merge custom conditions with conditions stored as bitflags.
|
|
@@ -90,6 +90,7 @@ class Dependency {
|
|
|
90
90
|
if (this.#dep.packageConditions) {
|
|
91
91
|
conditions = conditions ? [...conditions] : [];
|
|
92
92
|
for (let key in _types.ExportsCondition) {
|
|
93
|
+
// @ts-expect-error TS7053
|
|
93
94
|
if (this.#dep.packageConditions & _types.ExportsCondition[key]) {
|
|
94
95
|
conditions.push(key);
|
|
95
96
|
}
|
|
@@ -101,6 +102,7 @@ class Dependency {
|
|
|
101
102
|
return this.#dep.meta;
|
|
102
103
|
}
|
|
103
104
|
get symbols() {
|
|
105
|
+
// @ts-expect-error TS2322
|
|
104
106
|
return new _Symbols.MutableDependencySymbols(this.#options, this.#dep);
|
|
105
107
|
}
|
|
106
108
|
get target() {
|