@atlaspack/core 2.19.3-typescript-5b4d3ad41.0 → 2.20.0
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 +31 -0
- package/index.d.ts +34 -0
- package/lib/AssetGraph.js +10 -25
- package/lib/Atlaspack.js +7 -47
- package/lib/AtlaspackConfig.js +6 -24
- package/lib/AtlaspackConfig.schema.js +4 -0
- package/lib/BundleGraph.js +23 -80
- package/lib/CommittedAsset.js +0 -6
- package/lib/Dependency.js +0 -2
- package/lib/Environment.js +2 -2
- package/lib/EnvironmentManager.js +0 -6
- package/lib/IdentifierRegistry.js +3 -1
- package/lib/PackagerRunner.js +5 -10
- package/lib/ReporterRunner.js +9 -6
- package/lib/RequestTracker.js +11 -28
- package/lib/SymbolPropagation.js +7 -52
- package/lib/Transformation.js +7 -15
- package/lib/UncommittedAsset.js +7 -10
- package/lib/Validation.js +2 -18
- package/lib/applyRuntimes.js +0 -5
- package/lib/assetUtils.js +3 -5
- package/lib/atlaspack-v3/AtlaspackV3.js +2 -10
- package/lib/atlaspack-v3/NapiWorkerPool.js +0 -3
- package/lib/atlaspack-v3/fs.js +1 -3
- package/lib/atlaspack-v3/index.js +1 -28
- package/lib/atlaspack-v3/jsCallable.js +2 -0
- package/lib/atlaspack-v3/worker/compat/asset-symbols.js +3 -5
- package/lib/atlaspack-v3/worker/compat/bitflags.js +5 -5
- package/lib/atlaspack-v3/worker/compat/dependency.js +0 -3
- package/lib/atlaspack-v3/worker/compat/environment.js +3 -2
- package/lib/atlaspack-v3/worker/compat/mutable-asset.js +3 -8
- package/lib/atlaspack-v3/worker/compat/plugin-config.js +5 -3
- package/lib/atlaspack-v3/worker/compat/plugin-options.js +0 -1
- package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +0 -3
- package/lib/atlaspack-v3/worker/compat/target.js +0 -2
- package/lib/atlaspack-v3/worker/worker.js +5 -18
- package/lib/constants.js +1 -0
- package/lib/dumpGraphToGraphViz.js +15 -70
- package/lib/index.js +1 -17
- package/lib/loadAtlaspackPlugin.js +0 -3
- package/lib/loadDotEnv.js +1 -4
- package/lib/projectPath.js +0 -5
- package/lib/public/Asset.js +2 -14
- package/lib/public/Bundle.js +3 -3
- package/lib/public/BundleGraph.js +2 -7
- package/lib/public/BundleGroup.js +2 -2
- package/lib/public/Config.js +13 -27
- package/lib/public/Dependency.js +2 -4
- package/lib/public/Environment.js +2 -2
- package/lib/public/MutableBundleGraph.js +27 -35
- package/lib/public/PluginOptions.js +0 -1
- package/lib/public/Symbols.js +14 -63
- package/lib/public/Target.js +2 -3
- package/lib/registerCoreWithSerializer.js +3 -5
- package/lib/requests/AssetGraphRequest.js +3 -15
- package/lib/requests/AssetGraphRequestRust.js +4 -7
- package/lib/requests/AssetRequest.js +5 -21
- package/lib/requests/AtlaspackBuildRequest.js +2 -6
- package/lib/requests/AtlaspackConfigRequest.js +11 -15
- package/lib/requests/BundleGraphRequest.js +6 -6
- package/lib/requests/ConfigRequest.js +0 -1
- package/lib/requests/DevDepRequest.js +4 -20
- package/lib/requests/EntryRequest.js +0 -9
- package/lib/requests/PackageRequest.js +2 -7
- package/lib/requests/PathRequest.js +5 -20
- package/lib/requests/TargetRequest.js +40 -72
- package/lib/requests/ValidationRequest.js +1 -5
- package/lib/requests/WriteBundleRequest.js +8 -24
- package/lib/requests/WriteBundlesRequest.js +6 -26
- package/lib/requests/asset-graph-dot.js +7 -1
- package/lib/rustWorkerThreadDylibHack.js +1 -0
- package/lib/types.js +0 -6
- package/lib/utils.js +2 -17
- package/lib/worker.js +6 -12
- package/package.json +25 -27
- package/src/{AssetGraph.ts → AssetGraph.js} +47 -53
- package/src/{Atlaspack.ts → Atlaspack.js} +38 -75
- package/src/{AtlaspackConfig.ts → AtlaspackConfig.js} +54 -81
- package/src/{AtlaspackConfig.schema.ts → AtlaspackConfig.schema.js} +19 -16
- package/src/{BundleGraph.ts → BundleGraph.js} +127 -190
- package/src/{CommittedAsset.ts → CommittedAsset.js} +12 -14
- package/src/{Dependency.ts → Dependency.js} +39 -48
- package/src/{Environment.ts → Environment.js} +9 -8
- package/src/{EnvironmentManager.ts → EnvironmentManager.js} +5 -14
- package/src/{IdentifierRegistry.ts → IdentifierRegistry.js} +4 -1
- package/src/{InternalConfig.ts → InternalConfig.js} +20 -18
- package/src/{PackagerRunner.ts → PackagerRunner.js} +59 -67
- package/src/{ReporterRunner.ts → ReporterRunner.js} +18 -13
- package/src/{RequestTracker.ts → RequestTracker.js} +206 -255
- package/src/{SymbolPropagation.ts → SymbolPropagation.js} +44 -157
- package/src/{TargetDescriptor.schema.ts → TargetDescriptor.schema.js} +1 -0
- package/src/{Transformation.ts → Transformation.js} +61 -67
- package/src/{UncommittedAsset.ts → UncommittedAsset.js} +33 -34
- package/src/{Validation.ts → Validation.js} +17 -32
- package/src/{applyRuntimes.ts → applyRuntimes.js} +25 -27
- package/src/{assetUtils.ts → assetUtils.js} +33 -44
- package/src/atlaspack-v3/{AtlaspackV3.ts → AtlaspackV3.js} +15 -20
- package/src/atlaspack-v3/{NapiWorkerPool.ts → NapiWorkerPool.js} +5 -10
- package/src/atlaspack-v3/{fs.ts → fs.js} +4 -3
- package/src/atlaspack-v3/{index.ts → index.js} +4 -2
- package/src/atlaspack-v3/jsCallable.js +18 -0
- package/src/atlaspack-v3/worker/compat/{asset-symbols.ts → asset-symbols.js} +49 -52
- package/src/atlaspack-v3/worker/compat/{bitflags.ts → bitflags.js} +10 -8
- package/src/atlaspack-v3/worker/compat/{dependency.ts → dependency.js} +12 -12
- package/src/atlaspack-v3/worker/compat/{environment.ts → environment.js} +8 -4
- package/{lib/atlaspack-v3/worker/compat/index.d.ts → src/atlaspack-v3/worker/compat/index.js} +1 -0
- package/src/atlaspack-v3/worker/compat/{mutable-asset.ts → mutable-asset.js} +19 -20
- package/src/atlaspack-v3/worker/compat/{plugin-config.ts → plugin-config.js} +29 -26
- package/src/atlaspack-v3/worker/compat/{plugin-logger.ts → plugin-logger.js} +2 -0
- package/src/atlaspack-v3/worker/compat/{plugin-options.ts → plugin-options.js} +5 -4
- package/src/atlaspack-v3/worker/compat/{plugin-tracer.ts → plugin-tracer.js} +2 -2
- package/src/atlaspack-v3/worker/compat/{target.ts → target.js} +4 -3
- package/src/atlaspack-v3/worker/{worker.ts → worker.js} +64 -78
- package/src/{constants.ts → constants.js} +3 -0
- package/src/{dumpGraphToGraphViz.ts → dumpGraphToGraphViz.js} +28 -73
- package/src/{index.ts → index.js} +1 -2
- package/src/{loadAtlaspackPlugin.ts → loadAtlaspackPlugin.js} +9 -11
- package/src/{loadDotEnv.ts → loadDotEnv.js} +2 -2
- package/src/{projectPath.ts → projectPath.js} +9 -20
- package/src/public/{Asset.ts → Asset.js} +23 -29
- package/src/public/{Bundle.ts → Bundle.js} +19 -17
- package/src/public/{BundleGraph.ts → BundleGraph.js} +48 -71
- package/src/public/{BundleGroup.ts → BundleGroup.js} +8 -5
- package/src/public/{Config.ts → Config.js} +39 -63
- package/src/public/{Dependency.ts → Dependency.js} +14 -16
- package/src/public/{Environment.ts → Environment.js} +14 -11
- package/src/public/{MutableBundleGraph.ts → MutableBundleGraph.js} +33 -37
- package/src/public/{PluginOptions.ts → PluginOptions.js} +5 -5
- package/src/public/{Symbols.ts → Symbols.js} +36 -109
- package/src/public/{Target.ts → Target.js} +5 -6
- package/src/{registerCoreWithSerializer.ts → registerCoreWithSerializer.js} +7 -9
- package/src/requests/{AssetGraphRequest.ts → AssetGraphRequest.js} +45 -51
- package/src/requests/{AssetGraphRequestRust.ts → AssetGraphRequestRust.js} +19 -18
- package/src/requests/{AssetRequest.ts → AssetRequest.js} +17 -22
- package/src/requests/{AtlaspackBuildRequest.ts → AtlaspackBuildRequest.js} +31 -30
- package/src/requests/{AtlaspackConfigRequest.ts → AtlaspackConfigRequest.js} +51 -61
- package/src/requests/{BundleGraphRequest.ts → BundleGraphRequest.js} +41 -38
- package/src/requests/{ConfigRequest.ts → ConfigRequest.js} +43 -40
- package/src/requests/{DevDepRequest.ts → DevDepRequest.js} +30 -42
- package/src/requests/{EntryRequest.ts → EntryRequest.js} +31 -43
- package/src/requests/{PackageRequest.ts → PackageRequest.js} +21 -21
- package/src/requests/{PathRequest.ts → PathRequest.js} +37 -45
- package/src/requests/{TargetRequest.ts → TargetRequest.js} +153 -196
- package/src/requests/{ValidationRequest.ts → ValidationRequest.js} +17 -18
- package/src/requests/{WriteBundleRequest.ts → WriteBundleRequest.js} +41 -63
- package/src/requests/{WriteBundlesRequest.ts → WriteBundlesRequest.js} +27 -38
- package/src/requests/{asset-graph-dot.ts → asset-graph-dot.js} +12 -8
- package/src/{resolveOptions.ts → resolveOptions.js} +8 -6
- package/src/{rustWorkerThreadDylibHack.ts → rustWorkerThreadDylibHack.js} +4 -1
- package/src/{serializerCore.browser.ts → serializerCore.browser.js} +3 -2
- package/src/{summarizeRequest.ts → summarizeRequest.js} +5 -17
- package/src/types.js +603 -0
- package/src/{utils.ts → utils.js} +21 -52
- package/src/{worker.ts → worker.js} +35 -51
- package/test/{AssetGraph.test.ts → AssetGraph.test.js} +8 -4
- package/test/{Atlaspack.test.ts → Atlaspack.test.js} +10 -5
- package/test/{AtlaspackConfig.test.ts → AtlaspackConfig.test.js} +5 -0
- package/test/{AtlaspackConfigRequest.test.ts → AtlaspackConfigRequest.test.js} +15 -3
- package/test/{BundleGraph.test.ts → BundleGraph.test.js} +13 -8
- package/test/{Dependency.test.ts → Dependency.test.js} +3 -2
- package/test/{EntryRequest.test.ts → EntryRequest.test.js} +6 -1
- package/test/{Environment.test.ts → Environment.test.js} +5 -2
- package/test/{EnvironmentManager.test.ts → EnvironmentManager.test.js} +9 -7
- package/test/{IdentifierRegistry.test.ts → IdentifierRegistry.test.js} +4 -2
- package/test/{InternalAsset.test.ts → InternalAsset.test.js} +7 -2
- package/test/{PublicAsset.test.ts → PublicAsset.test.js} +7 -2
- package/test/{PublicBundle.test.ts → PublicBundle.test.js} +2 -1
- package/test/{PublicDependency.test.ts → PublicDependency.test.js} +2 -0
- package/test/{PublicEnvironment.test.ts → PublicEnvironment.test.js} +2 -0
- package/test/{PublicMutableBundleGraph.test.ts → PublicMutableBundleGraph.test.js} +11 -6
- package/test/{RequestTracker.test.ts → RequestTracker.test.js} +36 -26
- package/test/{SymbolPropagation.test.ts → SymbolPropagation.test.js} +74 -124
- package/test/{TargetRequest.test.ts → TargetRequest.test.js} +17 -3
- package/test/public/{Config.test.ts → Config.test.js} +11 -7
- package/test/requests/{AssetGraphRequestRust.test.ts → AssetGraphRequestRust.test.js} +1 -0
- package/test/requests/{ConfigRequest.test.ts → ConfigRequest.test.js} +22 -19
- package/test/requests/{DevDepRequest.test.ts → DevDepRequest.test.js} +2 -0
- package/test/{test-utils.ts → test-utils.js} +2 -0
- package/test/{utils.test.ts → utils.test.js} +3 -1
- package/LICENSE +0 -201
- package/lib/AssetGraph.d.ts +0 -80
- package/lib/Atlaspack.d.ts +0 -52
- package/lib/AtlaspackConfig.d.ts +0 -65
- package/lib/AtlaspackConfig.schema.d.ts +0 -46
- package/lib/BundleGraph.d.ts +0 -181
- package/lib/CommittedAsset.d.ts +0 -23
- package/lib/Dependency.d.ts +0 -44
- package/lib/Environment.d.ts +0 -10
- package/lib/EnvironmentManager.d.ts +0 -37
- package/lib/IdentifierRegistry.d.ts +0 -6
- package/lib/InternalConfig.d.ts +0 -24
- package/lib/PackagerRunner.d.ts +0 -80
- package/lib/ReporterRunner.d.ts +0 -25
- package/lib/RequestTracker.d.ts +0 -385
- package/lib/SymbolPropagation.d.ts +0 -11
- package/lib/TargetDescriptor.schema.d.ts +0 -5
- package/lib/Transformation.d.ts +0 -72
- package/lib/UncommittedAsset.d.ts +0 -61
- package/lib/Validation.d.ts +0 -37
- package/lib/applyRuntimes.d.ts +0 -25
- package/lib/assetUtils.d.ts +0 -42
- package/lib/atlaspack-v3/AtlaspackV3.d.ts +0 -26
- package/lib/atlaspack-v3/NapiWorkerPool.d.ts +0 -12
- package/lib/atlaspack-v3/fs.d.ts +0 -12
- package/lib/atlaspack-v3/index.d.ts +0 -5
- package/lib/atlaspack-v3/jsCallable.d.ts +0 -1
- package/lib/atlaspack-v3/worker/compat/asset-symbols.d.ts +0 -51
- package/lib/atlaspack-v3/worker/compat/bitflags.d.ts +0 -15
- package/lib/atlaspack-v3/worker/compat/dependency.d.ts +0 -25
- package/lib/atlaspack-v3/worker/compat/environment.d.ts +0 -25
- package/lib/atlaspack-v3/worker/compat/mutable-asset.d.ts +0 -49
- package/lib/atlaspack-v3/worker/compat/plugin-config.d.ts +0 -37
- package/lib/atlaspack-v3/worker/compat/plugin-logger.d.ts +0 -9
- package/lib/atlaspack-v3/worker/compat/plugin-options.d.ts +0 -22
- package/lib/atlaspack-v3/worker/compat/plugin-tracer.d.ts +0 -5
- package/lib/atlaspack-v3/worker/compat/target.d.ts +0 -11
- package/lib/atlaspack-v3/worker/worker.d.ts +0 -58
- package/lib/constants.d.ts +0 -13
- package/lib/dumpGraphToGraphViz.d.ts +0 -10
- package/lib/index.d.ts +0 -8
- package/lib/loadAtlaspackPlugin.d.ts +0 -8
- package/lib/loadDotEnv.d.ts +0 -3
- package/lib/projectPath.d.ts +0 -19
- package/lib/public/Asset.d.ts +0 -74
- package/lib/public/Bundle.d.ts +0 -45
- package/lib/public/BundleGraph.d.ts +0 -70
- package/lib/public/BundleGroup.d.ts +0 -12
- package/lib/public/Config.d.ts +0 -75
- package/lib/public/Dependency.d.ts +0 -32
- package/lib/public/Environment.d.ts +0 -32
- package/lib/public/MutableBundleGraph.d.ts +0 -26
- package/lib/public/PluginOptions.d.ts +0 -25
- package/lib/public/Symbols.d.ts +0 -81
- package/lib/public/Target.d.ts +0 -16
- package/lib/registerCoreWithSerializer.d.ts +0 -2
- package/lib/requests/AssetGraphRequest.d.ts +0 -74
- package/lib/requests/AssetGraphRequestRust.d.ts +0 -21
- package/lib/requests/AssetRequest.d.ts +0 -16
- package/lib/requests/AtlaspackBuildRequest.d.ts +0 -29
- package/lib/requests/AtlaspackConfigRequest.d.ts +0 -45
- package/lib/requests/BundleGraphRequest.d.ts +0 -28
- package/lib/requests/ConfigRequest.d.ts +0 -59
- package/lib/requests/DevDepRequest.d.ts +0 -30
- package/lib/requests/EntryRequest.d.ts +0 -36
- package/lib/requests/PackageRequest.d.ts +0 -27
- package/lib/requests/PathRequest.d.ts +0 -48
- package/lib/requests/TargetRequest.d.ts +0 -48
- package/lib/requests/ValidationRequest.d.ts +0 -20
- package/lib/requests/WriteBundleRequest.d.ts +0 -28
- package/lib/requests/WriteBundlesRequest.d.ts +0 -26
- package/lib/requests/asset-graph-dot.d.ts +0 -9
- package/lib/resolveOptions.d.ts +0 -3
- package/lib/rustWorkerThreadDylibHack.d.ts +0 -9
- package/lib/serializerCore.browser.d.ts +0 -3
- package/lib/summarizeRequest.d.ts +0 -10
- package/lib/types.d.ts +0 -490
- package/lib/utils.d.ts +0 -23
- package/lib/worker.d.ts +0 -44
- package/src/atlaspack-v3/jsCallable.ts +0 -14
- package/src/atlaspack-v3/worker/compat/index.ts +0 -9
- package/src/types.ts +0 -644
- package/tsconfig.json +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @atlaspack/core
|
|
2
2
|
|
|
3
|
+
## 2.20.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#721](https://github.com/atlassian-labs/atlaspack/pull/721) [`069de47`](https://github.com/atlassian-labs/atlaspack/commit/069de478e64fb5889f6f2ce023eb510782767fbd) Thanks [@benjervis](https://github.com/benjervis)! - Add support for bundle merging based on `webpackChunkName` comments.
|
|
8
|
+
|
|
9
|
+
Adding a `webpackChunkName` comment to an import will allow the bundler to merge multiple imports into a single bundle.
|
|
10
|
+
|
|
11
|
+
e.g.:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import(/* webpackChunkName: "my-chunk" */ './my-module');
|
|
15
|
+
import(/* webpackChunkName: "my-chunk" */ './another-module');
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
This can be enabled with the feature flag `supportWebpackChunkName`.
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`069de47`](https://github.com/atlassian-labs/atlaspack/commit/069de478e64fb5889f6f2ce023eb510782767fbd)]:
|
|
23
|
+
- @atlaspack/feature-flags@2.20.0
|
|
24
|
+
- @atlaspack/fs@2.15.16
|
|
25
|
+
- @atlaspack/profiler@2.14.18
|
|
26
|
+
- @atlaspack/types@2.15.11
|
|
27
|
+
- @atlaspack/workers@2.14.21
|
|
28
|
+
- @atlaspack/cache@3.2.16
|
|
29
|
+
- @atlaspack/graph@3.5.10
|
|
30
|
+
- @atlaspack/utils@2.17.3
|
|
31
|
+
- @atlaspack/package-manager@2.14.21
|
|
32
|
+
- @atlaspack/plugin@2.14.21
|
|
33
|
+
|
|
3
34
|
## 2.19.2
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
InitialAtlaspackOptions,
|
|
3
|
+
BuildEvent,
|
|
4
|
+
BuildSuccessEvent,
|
|
5
|
+
AsyncSubscription,
|
|
6
|
+
} from '@atlaspack/types';
|
|
7
|
+
|
|
8
|
+
import type {FarmOptions} from '@atlaspack/workers';
|
|
9
|
+
|
|
10
|
+
import type WorkerFarm from '@atlaspack/workers';
|
|
11
|
+
|
|
12
|
+
export declare const ATLASPACK_VERSION: string;
|
|
13
|
+
|
|
14
|
+
export class Atlaspack {
|
|
15
|
+
constructor(options: InitialAtlaspackOptions);
|
|
16
|
+
run(): Promise<BuildSuccessEvent>;
|
|
17
|
+
watch(
|
|
18
|
+
cb?: (err: Error | null | undefined, buildEvent?: BuildEvent) => unknown,
|
|
19
|
+
): Promise<AsyncSubscription>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class Parcel {
|
|
23
|
+
constructor(options: InitialAtlaspackOptions);
|
|
24
|
+
run(): Promise<BuildSuccessEvent>;
|
|
25
|
+
watch(
|
|
26
|
+
cb?: (err: Error | null | undefined, buildEvent?: BuildEvent) => unknown,
|
|
27
|
+
): Promise<AsyncSubscription>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export declare function createWorkerFarm(
|
|
31
|
+
options?: Partial<FarmOptions>,
|
|
32
|
+
): WorkerFarm;
|
|
33
|
+
|
|
34
|
+
export default Atlaspack;
|
package/lib/AssetGraph.js
CHANGED
|
@@ -71,11 +71,7 @@ function nodeFromDep(dep) {
|
|
|
71
71
|
}
|
|
72
72
|
function nodeFromAssetGroup(assetGroup) {
|
|
73
73
|
return {
|
|
74
|
-
id: (0, _rust().hashString)(
|
|
75
|
-
// @ts-expect-error TS2345
|
|
76
|
-
(0, _projectPath.fromProjectPathRelative)(assetGroup.filePath) +
|
|
77
|
-
// @ts-expect-error TS2345
|
|
78
|
-
(0, _EnvironmentManager.toEnvironmentId)(assetGroup.env) + String(assetGroup.isSource) + String(assetGroup.sideEffects) + (assetGroup.code ?? '') + ':' + (assetGroup.pipeline ?? '') + ':' + (assetGroup.query ?? '')),
|
|
74
|
+
id: (0, _rust().hashString)((0, _projectPath.fromProjectPathRelative)(assetGroup.filePath) + (0, _EnvironmentManager.toEnvironmentId)(assetGroup.env) + String(assetGroup.isSource) + String(assetGroup.sideEffects) + (assetGroup.code ?? '') + ':' + (assetGroup.pipeline ?? '') + ':' + (assetGroup.query ?? '')),
|
|
79
75
|
type: 'asset_group',
|
|
80
76
|
value: assetGroup,
|
|
81
77
|
usedSymbolsDownDirty: true
|
|
@@ -105,8 +101,6 @@ function nodeFromEntryFile(entry) {
|
|
|
105
101
|
value: entry
|
|
106
102
|
};
|
|
107
103
|
}
|
|
108
|
-
|
|
109
|
-
// @ts-expect-error TS2417
|
|
110
104
|
class AssetGraph extends _graph().ContentGraph {
|
|
111
105
|
/**
|
|
112
106
|
* Incremented when the asset graph is modified such that it requires a bundling pass.
|
|
@@ -144,9 +138,13 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
144
138
|
this.undeferredDependencies = new Set();
|
|
145
139
|
this.envCache = new Map();
|
|
146
140
|
}
|
|
141
|
+
|
|
142
|
+
// $FlowFixMe[prop-missing]
|
|
147
143
|
static deserialize(opts) {
|
|
148
144
|
return new AssetGraph(opts);
|
|
149
145
|
}
|
|
146
|
+
|
|
147
|
+
// $FlowFixMe[prop-missing]
|
|
150
148
|
serialize() {
|
|
151
149
|
return {
|
|
152
150
|
...super.serialize(),
|
|
@@ -208,8 +206,6 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
208
206
|
if ((0, _featureFlags().getFeatureFlag)('environmentDeduplication')) {
|
|
209
207
|
return;
|
|
210
208
|
}
|
|
211
|
-
|
|
212
|
-
// @ts-expect-error TS2345
|
|
213
209
|
let {
|
|
214
210
|
id,
|
|
215
211
|
context
|
|
@@ -219,7 +215,6 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
219
215
|
if (env) {
|
|
220
216
|
input.env = (0, _EnvironmentManager.toEnvironmentRef)(env);
|
|
221
217
|
} else {
|
|
222
|
-
// @ts-expect-error TS2345
|
|
223
218
|
this.envCache.set(idAndContext, (0, _EnvironmentManager.fromEnvironmentId)(input.env));
|
|
224
219
|
}
|
|
225
220
|
}
|
|
@@ -247,6 +242,8 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
247
242
|
let existing = this.getNodeByContentKey(node.id);
|
|
248
243
|
if (existing != null) {
|
|
249
244
|
(0, _assert().default)(existing.type === node.type);
|
|
245
|
+
// $FlowFixMe[incompatible-type] Checked above
|
|
246
|
+
// $FlowFixMe[prop-missing]
|
|
250
247
|
existing.value = node.value;
|
|
251
248
|
let existingId = this.getNodeIdByContentKey(node.id);
|
|
252
249
|
this.updateNode(existingId, existing);
|
|
@@ -278,7 +275,6 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
278
275
|
env: target.env,
|
|
279
276
|
isEntry: true,
|
|
280
277
|
needsStableName: true,
|
|
281
|
-
// @ts-expect-error TS2322
|
|
282
278
|
symbols: (0, _EnvironmentManager.fromEnvironmentId)(target.env).isLibrary ? new Map([['*', {
|
|
283
279
|
local: '*',
|
|
284
280
|
isWeak: true,
|
|
@@ -287,9 +283,7 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
287
283
|
}));
|
|
288
284
|
if ((0, _EnvironmentManager.fromEnvironmentId)(node.value.env).isLibrary) {
|
|
289
285
|
// in library mode, all of the entry's symbols are "used"
|
|
290
|
-
// @ts-expect-error TS2345
|
|
291
286
|
node.usedSymbolsDown.add('*');
|
|
292
|
-
// @ts-expect-error TS2345
|
|
293
287
|
node.usedSymbolsUp.set('*', undefined);
|
|
294
288
|
}
|
|
295
289
|
return node;
|
|
@@ -367,10 +361,7 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
367
361
|
if (traversedNode.type === 'asset') {
|
|
368
362
|
let hasDeferred = this.getNodeIdsConnectedFrom(traversedNodeId).some(childNodeId => {
|
|
369
363
|
let childNode = (0, _nullthrows().default)(this.getNode(childNodeId));
|
|
370
|
-
|
|
371
|
-
return childNode.hasDeferred == null ? false :
|
|
372
|
-
// @ts-expect-error TS2339
|
|
373
|
-
childNode.hasDeferred;
|
|
364
|
+
return childNode.hasDeferred == null ? false : childNode.hasDeferred;
|
|
374
365
|
});
|
|
375
366
|
if (!hasDeferred) {
|
|
376
367
|
delete traversedNode.hasDeferred;
|
|
@@ -379,7 +370,6 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
379
370
|
hasDeferred
|
|
380
371
|
};
|
|
381
372
|
} else if (traversedNode.type === 'asset_group' && nodeId !== traversedNodeId) {
|
|
382
|
-
// @ts-expect-error TS2339
|
|
383
373
|
if (!(ctx !== null && ctx !== void 0 && ctx.hasDeferred)) {
|
|
384
374
|
this.safeToIncrementallyBundle = false;
|
|
385
375
|
this.setNeedsBundling();
|
|
@@ -410,9 +400,7 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
410
400
|
}
|
|
411
401
|
let isDeferrable = [...dependencySymbols].every(([, {
|
|
412
402
|
isWeak
|
|
413
|
-
}]) => isWeak) && sideEffects === false && canDefer &&
|
|
414
|
-
// @ts-expect-error TS2345
|
|
415
|
-
!dependencySymbols.has('*');
|
|
403
|
+
}]) => isWeak) && sideEffects === false && canDefer && !dependencySymbols.has('*');
|
|
416
404
|
if (!isDeferrable) {
|
|
417
405
|
return false;
|
|
418
406
|
}
|
|
@@ -438,9 +426,7 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
438
426
|
if (this.undeferredDependencies.has(d)) {
|
|
439
427
|
return false;
|
|
440
428
|
}
|
|
441
|
-
let depIsDeferrable = d.symbols && !((0, _EnvironmentManager.fromEnvironmentId)(d.env).isLibrary && d.isEntry) &&
|
|
442
|
-
// @ts-expect-error TS2345
|
|
443
|
-
!d.symbols.has('*') && ![...d.symbols.keys()].some(symbol => {
|
|
429
|
+
let depIsDeferrable = d.symbols && !((0, _EnvironmentManager.fromEnvironmentId)(d.env).isLibrary && d.isEntry) && !d.symbols.has('*') && ![...d.symbols.keys()].some(symbol => {
|
|
444
430
|
var _resolvedAsset$symbol;
|
|
445
431
|
let assetSymbol = (_resolvedAsset$symbol = resolvedAsset.symbols) === null || _resolvedAsset$symbol === void 0 || (_resolvedAsset$symbol = _resolvedAsset$symbol.get(symbol)) === null || _resolvedAsset$symbol === void 0 ? void 0 : _resolvedAsset$symbol.local;
|
|
446
432
|
return assetSymbol != null && symbols.has(assetSymbol);
|
|
@@ -455,7 +441,6 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
455
441
|
resolveAssetGroup(assetGroup, assets, correspondingRequest) {
|
|
456
442
|
this.normalizeEnvironment(assetGroup);
|
|
457
443
|
let assetGroupNode = nodeFromAssetGroup(assetGroup);
|
|
458
|
-
// @ts-expect-error TS2322
|
|
459
444
|
assetGroupNode = this.getNodeByContentKey(assetGroupNode.id);
|
|
460
445
|
if (!assetGroupNode) {
|
|
461
446
|
return;
|
package/lib/Atlaspack.js
CHANGED
|
@@ -123,43 +123,28 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
123
123
|
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; }
|
|
124
124
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
125
125
|
// eslint-disable-next-line no-unused-vars
|
|
126
|
-
|
|
127
126
|
(0, _registerCoreWithSerializer.registerCoreWithSerializer)();
|
|
128
127
|
const INTERNAL_TRANSFORM = exports.INTERNAL_TRANSFORM = Symbol('internal_transform');
|
|
129
128
|
const INTERNAL_RESOLVE = exports.INTERNAL_RESOLVE = Symbol('internal_resolve');
|
|
130
|
-
|
|
131
|
-
if (process.env.ATLASPACK_REGISTER_USE_SRC === 'true') {
|
|
132
|
-
exports.WORKER_PATH = WORKER_PATH = _path().default.join(__dirname, 'worker.ts');
|
|
133
|
-
}
|
|
129
|
+
const WORKER_PATH = exports.WORKER_PATH = _path().default.join(__dirname, 'worker.js');
|
|
134
130
|
class Atlaspack {
|
|
135
|
-
// @ts-expect-error TS2564
|
|
136
131
|
#requestTracker;
|
|
137
|
-
// @ts-expect-error TS2564
|
|
138
132
|
#config;
|
|
139
|
-
// @ts-expect-error TS2564
|
|
140
133
|
#farm;
|
|
141
134
|
#initialized = false;
|
|
142
|
-
// @ts-expect-error TS2564
|
|
143
135
|
#disposable;
|
|
144
136
|
#initialOptions;
|
|
145
|
-
// @ts-expect-error TS2564
|
|
146
137
|
#reporterRunner;
|
|
147
138
|
#resolvedOptions = null;
|
|
148
|
-
// @ts-expect-error TS2564
|
|
149
139
|
#optionsRef;
|
|
150
|
-
// @ts-expect-error TS2564
|
|
151
140
|
#watchAbortController;
|
|
152
141
|
#watchQueue = new (_utils2().PromiseQueue)({
|
|
153
142
|
maxConcurrent: 1
|
|
154
143
|
});
|
|
155
|
-
// @ts-expect-error TS2564
|
|
156
144
|
#watchEvents;
|
|
157
145
|
#watcherSubscription;
|
|
158
146
|
#watcherCount = 0;
|
|
159
147
|
#requestedAssetIds = new Set();
|
|
160
|
-
|
|
161
|
-
// @ts-expect-error TS2564
|
|
162
|
-
|
|
163
148
|
constructor(options) {
|
|
164
149
|
this.#initialOptions = options;
|
|
165
150
|
}
|
|
@@ -209,6 +194,8 @@ class Atlaspack {
|
|
|
209
194
|
throw new Error('Atlaspack v3 must be run with lmdb lite cache');
|
|
210
195
|
}
|
|
211
196
|
const lmdb = resolvedOptions.cache.getNativeRef();
|
|
197
|
+
|
|
198
|
+
// $FlowFixMe
|
|
212
199
|
const version = require('../package.json').version;
|
|
213
200
|
await lmdb.put('current_session_version', Buffer.from(version));
|
|
214
201
|
let threads = undefined;
|
|
@@ -219,12 +206,12 @@ class Atlaspack {
|
|
|
219
206
|
}
|
|
220
207
|
rustAtlaspack = await _atlaspackV.AtlaspackV3.create({
|
|
221
208
|
...options,
|
|
222
|
-
// @ts-expect-error TS2353
|
|
223
209
|
corePath: _path().default.join(__dirname, '..'),
|
|
224
210
|
threads,
|
|
225
211
|
entries: Array.isArray(entries) ? entries : entries == null ? undefined : [entries],
|
|
226
212
|
env: resolvedOptions.env,
|
|
227
213
|
fs: inputFS && new _atlaspackV.FileSystemV3(inputFS),
|
|
214
|
+
// $FlowFixMe ProjectPath is a string
|
|
228
215
|
defaultTargetOptions: resolvedOptions.defaultTargetOptions,
|
|
229
216
|
lmdb
|
|
230
217
|
});
|
|
@@ -234,7 +221,6 @@ class Atlaspack {
|
|
|
234
221
|
});
|
|
235
222
|
}
|
|
236
223
|
}
|
|
237
|
-
// @ts-expect-error TS2454
|
|
238
224
|
this.rustAtlaspack = rustAtlaspack;
|
|
239
225
|
let {
|
|
240
226
|
config
|
|
@@ -280,7 +266,6 @@ class Atlaspack {
|
|
|
280
266
|
this.#requestTracker = await _RequestTracker.default.init({
|
|
281
267
|
farm: this.#farm,
|
|
282
268
|
options: resolvedOptions,
|
|
283
|
-
// @ts-expect-error TS2454
|
|
284
269
|
rustAtlaspack
|
|
285
270
|
});
|
|
286
271
|
this.#initialized = true;
|
|
@@ -347,8 +332,6 @@ class Atlaspack {
|
|
|
347
332
|
if (!this.#initialized) {
|
|
348
333
|
await this._init();
|
|
349
334
|
}
|
|
350
|
-
|
|
351
|
-
// @ts-expect-error TS7034
|
|
352
335
|
let watchEventsDisposable;
|
|
353
336
|
if (cb) {
|
|
354
337
|
watchEventsDisposable = this.#watchEvents.addListener(({
|
|
@@ -368,11 +351,8 @@ class Atlaspack {
|
|
|
368
351
|
this.#watchQueue.run();
|
|
369
352
|
}
|
|
370
353
|
this.#watcherCount++;
|
|
371
|
-
|
|
372
|
-
// @ts-expect-error TS7034
|
|
373
354
|
let unsubscribePromise;
|
|
374
355
|
const unsubscribe = async () => {
|
|
375
|
-
// @ts-expect-error TS7005
|
|
376
356
|
if (watchEventsDisposable) {
|
|
377
357
|
watchEventsDisposable.dispose();
|
|
378
358
|
}
|
|
@@ -390,12 +370,9 @@ class Atlaspack {
|
|
|
390
370
|
};
|
|
391
371
|
return {
|
|
392
372
|
unsubscribe() {
|
|
393
|
-
// @ts-expect-error TS7005
|
|
394
373
|
if (unsubscribePromise == null) {
|
|
395
374
|
unsubscribePromise = unsubscribe();
|
|
396
375
|
}
|
|
397
|
-
|
|
398
|
-
// @ts-expect-error TS7005
|
|
399
376
|
return unsubscribePromise;
|
|
400
377
|
}
|
|
401
378
|
};
|
|
@@ -438,14 +415,13 @@ class Atlaspack {
|
|
|
438
415
|
});
|
|
439
416
|
this.#requestedAssetIds.clear();
|
|
440
417
|
await (0, _dumpGraphToGraphViz.default)(
|
|
441
|
-
//
|
|
418
|
+
// $FlowFixMe
|
|
442
419
|
this.#requestTracker.graph, 'RequestGraph', _RequestTracker.requestGraphEdgeTypes);
|
|
443
420
|
let event = {
|
|
444
421
|
type: 'buildSuccess',
|
|
445
422
|
changedAssets: new Map(Array.from(changedAssets).map(([id, asset]) => [id, (0, _Asset.assetFromValue)(asset, options)])),
|
|
446
423
|
bundleGraph: new _BundleGraph.default(bundleGraph, (bundle, bundleGraph, options) => _Bundle.PackagedBundle.getWithInfo(bundle, bundleGraph, options, bundleInfo.get(bundle.id)), options),
|
|
447
424
|
buildTime: Date.now() - startTime,
|
|
448
|
-
// @ts-expect-error TS7006
|
|
449
425
|
requestBundle: async bundle => {
|
|
450
426
|
let bundleNode = bundleGraph._graph.getNodeByContentKey(bundle.id);
|
|
451
427
|
(0, _assert().default)((bundleNode === null || bundleNode === void 0 ? void 0 : bundleNode.type) === 'bundle', 'Bundle does not exist');
|
|
@@ -471,21 +447,15 @@ class Atlaspack {
|
|
|
471
447
|
}
|
|
472
448
|
let results = await this.#watchQueue.run();
|
|
473
449
|
let result = results.filter(Boolean).pop();
|
|
474
|
-
// @ts-expect-error TS18049
|
|
475
450
|
if (result.type === 'buildFailure') {
|
|
476
|
-
// @ts-expect-error TS18049
|
|
477
451
|
throw new BuildError(result.diagnostics);
|
|
478
452
|
}
|
|
479
453
|
return result;
|
|
480
454
|
},
|
|
481
455
|
unstable_requestStats: this.#requestTracker.flushStats()
|
|
482
456
|
};
|
|
483
|
-
|
|
484
|
-
// @ts-expect-error TS2345
|
|
485
457
|
await this.#reporterRunner.report(event);
|
|
486
|
-
await this.#requestTracker.runRequest(
|
|
487
|
-
// @ts-expect-error TS2345
|
|
488
|
-
(0, _ValidationRequest.default)({
|
|
458
|
+
await this.#requestTracker.runRequest((0, _ValidationRequest.default)({
|
|
489
459
|
optionsRef: this.#optionsRef,
|
|
490
460
|
assetRequests
|
|
491
461
|
}), {
|
|
@@ -494,8 +464,6 @@ class Atlaspack {
|
|
|
494
464
|
if (this.#reporterRunner.errors.length) {
|
|
495
465
|
throw this.#reporterRunner.errors;
|
|
496
466
|
}
|
|
497
|
-
|
|
498
|
-
// @ts-expect-error TS2322
|
|
499
467
|
return event;
|
|
500
468
|
} catch (e) {
|
|
501
469
|
if (e instanceof _utils.BuildAbortError) {
|
|
@@ -507,10 +475,7 @@ class Atlaspack {
|
|
|
507
475
|
diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic],
|
|
508
476
|
unstable_requestStats: this.#requestTracker.flushStats()
|
|
509
477
|
};
|
|
510
|
-
|
|
511
|
-
// @ts-expect-error TS2345
|
|
512
478
|
await this.#reporterRunner.report(event);
|
|
513
|
-
// @ts-expect-error TS2322
|
|
514
479
|
return event;
|
|
515
480
|
} finally {
|
|
516
481
|
if (this.isProfiling) {
|
|
@@ -623,11 +588,7 @@ class Atlaspack {
|
|
|
623
588
|
requestedAssetIds: this.#requestedAssetIds
|
|
624
589
|
};
|
|
625
590
|
const start = Date.now();
|
|
626
|
-
const result = await this.#requestTracker.runRequest(this.rustAtlaspack != null ?
|
|
627
|
-
// @ts-expect-error TS2345
|
|
628
|
-
(0, _AssetGraphRequestRust.createAssetGraphRequestRust)(this.rustAtlaspack)(input) :
|
|
629
|
-
// @ts-expect-error TS2345
|
|
630
|
-
(0, _AssetGraphRequest.default)(input), {
|
|
591
|
+
const result = await this.#requestTracker.runRequest(this.rustAtlaspack != null ? (0, _AssetGraphRequestRust.createAssetGraphRequestRust)(this.rustAtlaspack)(input) : (0, _AssetGraphRequest.default)(input), {
|
|
631
592
|
force: true
|
|
632
593
|
});
|
|
633
594
|
const duration = Date.now() - start;
|
|
@@ -714,7 +675,6 @@ class Atlaspack {
|
|
|
714
675
|
return null;
|
|
715
676
|
}
|
|
716
677
|
return {
|
|
717
|
-
// @ts-expect-error TS2322
|
|
718
678
|
filePath: (0, _projectPath.fromProjectPath)(projectRoot, res.filePath),
|
|
719
679
|
code: res.code,
|
|
720
680
|
query: res.query,
|
package/lib/AtlaspackConfig.js
CHANGED
|
@@ -90,7 +90,6 @@ class AtlaspackConfig {
|
|
|
90
90
|
}
|
|
91
91
|
async loadPlugin(node) {
|
|
92
92
|
let plugin = await this._loadPlugin(node);
|
|
93
|
-
// @ts-expect-error TS2322
|
|
94
93
|
return {
|
|
95
94
|
...plugin,
|
|
96
95
|
name: node.packageName,
|
|
@@ -130,9 +129,7 @@ class AtlaspackConfig {
|
|
|
130
129
|
if (allowEmpty) {
|
|
131
130
|
return [];
|
|
132
131
|
}
|
|
133
|
-
throw await this.missingPluginError(this.transformers,
|
|
134
|
-
// @ts-expect-error TS2345
|
|
135
|
-
(0, _diagnostic().md)`No transformers found for __${(0, _projectPath.fromProjectPathRelative)(filePath)}__` + (pipeline != null ? ` with pipeline: '${pipeline}'` : '') + '.', '/transformers');
|
|
132
|
+
throw await this.missingPluginError(this.transformers, (0, _diagnostic().md)`No transformers found for __${(0, _projectPath.fromProjectPathRelative)(filePath)}__` + (pipeline != null ? ` with pipeline: '${pipeline}'` : '') + '.', '/transformers');
|
|
136
133
|
}
|
|
137
134
|
return this.loadPlugins(transformers);
|
|
138
135
|
}
|
|
@@ -157,9 +154,7 @@ class AtlaspackConfig {
|
|
|
157
154
|
async getPackager(filePath) {
|
|
158
155
|
let packager = this.matchGlobMap((0, _projectPath.toProjectPathUnsafe)(filePath), this.packagers);
|
|
159
156
|
if (!packager) {
|
|
160
|
-
throw await this.missingPluginError(this.packagers,
|
|
161
|
-
// @ts-expect-error TS2345
|
|
162
|
-
(0, _diagnostic().md)`No packager found for __${filePath}__.`, '/packagers');
|
|
157
|
+
throw await this.missingPluginError(this.packagers, (0, _diagnostic().md)`No packager found for __${filePath}__.`, '/packagers');
|
|
163
158
|
}
|
|
164
159
|
return this.loadPlugin(packager);
|
|
165
160
|
}
|
|
@@ -188,9 +183,7 @@ class AtlaspackConfig {
|
|
|
188
183
|
async getCompressors(filePath) {
|
|
189
184
|
let compressors = this.matchGlobMapPipelines((0, _projectPath.toProjectPathUnsafe)(filePath), this.compressors) ?? [];
|
|
190
185
|
if (compressors.length === 0) {
|
|
191
|
-
throw await this.missingPluginError(this.compressors,
|
|
192
|
-
// @ts-expect-error TS2345
|
|
193
|
-
(0, _diagnostic().md)`No compressors found for __${filePath}__.`, '/compressors');
|
|
186
|
+
throw await this.missingPluginError(this.compressors, (0, _diagnostic().md)`No compressors found for __${filePath}__.`, '/compressors');
|
|
194
187
|
}
|
|
195
188
|
return this.loadPlugins(compressors);
|
|
196
189
|
}
|
|
@@ -203,7 +196,6 @@ class AtlaspackConfig {
|
|
|
203
196
|
let [patternPipeline, patternGlob] = pattern.split(':');
|
|
204
197
|
if (!patternGlob) {
|
|
205
198
|
patternGlob = patternPipeline;
|
|
206
|
-
// @ts-expect-error TS2322
|
|
207
199
|
patternPipeline = null;
|
|
208
200
|
}
|
|
209
201
|
let re = this.regexCache.get(patternGlob);
|
|
@@ -243,7 +235,6 @@ class AtlaspackConfig {
|
|
|
243
235
|
}
|
|
244
236
|
for (let pattern in globMap) {
|
|
245
237
|
if (this.isGlobMatch(filePath, pattern)) {
|
|
246
|
-
// @ts-expect-error TS2345
|
|
247
238
|
matches.push(globMap[pattern]);
|
|
248
239
|
}
|
|
249
240
|
}
|
|
@@ -259,7 +250,7 @@ class AtlaspackConfig {
|
|
|
259
250
|
return pipeline;
|
|
260
251
|
};
|
|
261
252
|
let res = flatten();
|
|
262
|
-
//
|
|
253
|
+
// $FlowFixMe afaik this should work
|
|
263
254
|
return res;
|
|
264
255
|
}
|
|
265
256
|
async missingPluginError(plugins, message, key) {
|
|
@@ -267,13 +258,7 @@ class AtlaspackConfig {
|
|
|
267
258
|
if (Array.isArray(plugins)) {
|
|
268
259
|
configsWithPlugin = new Set(getConfigPaths(this.options, plugins));
|
|
269
260
|
} else {
|
|
270
|
-
configsWithPlugin = new Set(Object.keys(plugins).flatMap(k =>
|
|
271
|
-
// @ts-expect-error TS7053
|
|
272
|
-
Array.isArray(plugins[k]) ?
|
|
273
|
-
// @ts-expect-error TS7053
|
|
274
|
-
getConfigPaths(this.options, plugins[k]) :
|
|
275
|
-
// @ts-expect-error TS7053
|
|
276
|
-
[getConfigPath(this.options, plugins[k])]));
|
|
261
|
+
configsWithPlugin = new Set(Object.keys(plugins).flatMap(k => Array.isArray(plugins[k]) ? getConfigPaths(this.options, plugins[k]) : [getConfigPath(this.options, plugins[k])]));
|
|
277
262
|
}
|
|
278
263
|
if (configsWithPlugin.size === 0) {
|
|
279
264
|
configsWithPlugin.add((0, _projectPath.fromProjectPath)(this.options.projectRoot, this.filePath));
|
|
@@ -306,11 +291,8 @@ class AtlaspackConfig {
|
|
|
306
291
|
}
|
|
307
292
|
exports.AtlaspackConfig = AtlaspackConfig;
|
|
308
293
|
function getConfigPaths(options, nodes) {
|
|
309
|
-
return nodes
|
|
310
|
-
// @ts-expect-error TS2339
|
|
311
|
-
.map(node => node !== '...' ? getConfigPath(options, node) : null).filter(Boolean);
|
|
294
|
+
return nodes.map(node => node !== '...' ? getConfigPath(options, node) : null).filter(Boolean);
|
|
312
295
|
}
|
|
313
296
|
function getConfigPath(options, node) {
|
|
314
|
-
// @ts-expect-error TS2339
|
|
315
297
|
return (0, _projectPath.fromProjectPath)(options.projectRoot, node.resolveFrom);
|
|
316
298
|
}
|
|
@@ -6,10 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.validatePackageName = validatePackageName;
|
|
8
8
|
// Parcel validates plugin package names due to:
|
|
9
|
+
//
|
|
9
10
|
// * https://github.com/parcel-bundler/parcel/issues/3397#issuecomment-521353931
|
|
11
|
+
//
|
|
10
12
|
// Ultimately:
|
|
13
|
+
//
|
|
11
14
|
// * We do not care about package names
|
|
12
15
|
// * Validation makes interop between parcel/atlaspack confusing.
|
|
16
|
+
//
|
|
13
17
|
function validatePackageName(
|
|
14
18
|
// eslint-disable-next-line no-unused-vars
|
|
15
19
|
pkg,
|