@atlaspack/core 2.12.1-canary.3549 → 2.12.1-canary.3553
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/lib/BundleGraph.js +22 -1
- package/lib/public/BundleGraph.js +3 -0
- package/lib/public/MutableBundleGraph.js +3 -0
- package/lib/requests/AssetGraphRequestRust.js +1 -5
- package/lib/requests/BundleGraphRequest.js +1 -1
- package/lib/requests/asset-graph-diff.js +1 -1
- package/package.json +17 -17
- package/src/BundleGraph.js +33 -0
- package/src/public/BundleGraph.js +6 -0
- package/src/public/MutableBundleGraph.js +7 -0
- package/src/requests/AssetGraphRequestRust.js +1 -4
- package/src/requests/BundleGraphRequest.js +5 -2
- package/src/requests/asset-graph-diff.js +2 -1
package/lib/BundleGraph.js
CHANGED
|
@@ -74,7 +74,10 @@ const bundleGraphEdgeTypes = exports.bundleGraphEdgeTypes = {
|
|
|
74
74
|
references: 4,
|
|
75
75
|
// Signals that the dependency is internally resolvable via the bundle's ancestry,
|
|
76
76
|
// and that the bundle connected to the dependency is not necessary for the source bundle.
|
|
77
|
-
internal_async: 5
|
|
77
|
+
internal_async: 5,
|
|
78
|
+
// This type is used to mark an edge between a bundle and a conditional bundle.
|
|
79
|
+
// This allows efficient discovery of conditional bundles in packaging
|
|
80
|
+
conditional: 5
|
|
78
81
|
};
|
|
79
82
|
function makeReadOnlySet(set) {
|
|
80
83
|
return new Proxy(set, {
|
|
@@ -760,6 +763,9 @@ class BundleGraph {
|
|
|
760
763
|
createBundleReference(from, to) {
|
|
761
764
|
this._graph.addEdge(this._graph.getNodeIdByContentKey(from.id), this._graph.getNodeIdByContentKey(to.id), bundleGraphEdgeTypes.references);
|
|
762
765
|
}
|
|
766
|
+
createBundleConditionalReference(from, to) {
|
|
767
|
+
this._graph.addEdge(this._graph.getNodeIdByContentKey(from.id), this._graph.getNodeIdByContentKey(to.id), bundleGraphEdgeTypes.conditional);
|
|
768
|
+
}
|
|
763
769
|
getBundlesWithAsset(asset) {
|
|
764
770
|
return this._graph.getNodeIdsConnectedTo(this._graph.getNodeIdByContentKey(asset.id), bundleGraphEdgeTypes.contains).map(id => (0, _nullthrows().default)(this._graph.getNode(id))).filter(node => node.type === 'bundle').map(node => {
|
|
765
771
|
(0, _assert().default)(node.type === 'bundle');
|
|
@@ -1495,5 +1501,20 @@ class BundleGraph {
|
|
|
1495
1501
|
this._targetEntryRoots.set(target.distDir, root);
|
|
1496
1502
|
return root;
|
|
1497
1503
|
}
|
|
1504
|
+
getReferencedConditionalBundles(bundle) {
|
|
1505
|
+
let referencedBundles = new Set();
|
|
1506
|
+
this._graph.dfs({
|
|
1507
|
+
visit: nodeId => {
|
|
1508
|
+
let node = (0, _nullthrows().default)(this._graph.getNode(nodeId));
|
|
1509
|
+
if (node.type !== 'bundle' || node.value.id === bundle.id) {
|
|
1510
|
+
return;
|
|
1511
|
+
}
|
|
1512
|
+
referencedBundles.add(node.value);
|
|
1513
|
+
},
|
|
1514
|
+
startNodeId: this._graph.getNodeIdByContentKey(bundle.id),
|
|
1515
|
+
getChildren: nodeId => this._graph.getNodeIdsConnectedFrom(nodeId, bundleGraphEdgeTypes.conditional)
|
|
1516
|
+
});
|
|
1517
|
+
return [...referencedBundles];
|
|
1518
|
+
}
|
|
1498
1519
|
}
|
|
1499
1520
|
exports.default = BundleGraph;
|
|
@@ -270,5 +270,8 @@ class BundleGraph {
|
|
|
270
270
|
}
|
|
271
271
|
return bundleConditions;
|
|
272
272
|
}
|
|
273
|
+
getReferencedConditionalBundles(bundle) {
|
|
274
|
+
return this.#graph.getReferencedConditionalBundles((0, _Bundle.bundleToInternalBundle)(bundle)).map(result => this.#createBundle(result, this.#graph, this.#options));
|
|
275
|
+
}
|
|
273
276
|
}
|
|
274
277
|
exports.default = BundleGraph;
|
|
@@ -162,6 +162,9 @@ class MutableBundleGraph extends _BundleGraph.default {
|
|
|
162
162
|
createBundleReference(from, to) {
|
|
163
163
|
return this.#graph.createBundleReference((0, _Bundle.bundleToInternalBundle)(from), (0, _Bundle.bundleToInternalBundle)(to));
|
|
164
164
|
}
|
|
165
|
+
createBundleConditionalReference(from, to) {
|
|
166
|
+
return this.#graph.createBundleConditionalReference((0, _Bundle.bundleToInternalBundle)(from), (0, _Bundle.bundleToInternalBundle)(to));
|
|
167
|
+
}
|
|
165
168
|
getDependencyAssets(dependency) {
|
|
166
169
|
return this.#graph.getDependencyAssets((0, _Dependency.dependencyToInternalDependency)(dependency)).map(asset => (0, _Asset.assetFromValue)(asset, this.#options));
|
|
167
170
|
}
|
|
@@ -191,11 +191,7 @@ function getAssetGraph(serializedGraph, options) {
|
|
|
191
191
|
deps.set(id, dependency);
|
|
192
192
|
dependency.id = id;
|
|
193
193
|
dependency.env.id = getEnvId(dependency.env);
|
|
194
|
-
|
|
195
|
-
// Dependency.symbols are always set to an empty map when scope hoisting
|
|
196
|
-
// is enabled. Some tests will fail if this is not the case. We should
|
|
197
|
-
// make this consistant when we re-visit packaging.
|
|
198
|
-
if (dependency.symbols != null || dependency.env.shouldScopeHoist) {
|
|
194
|
+
if (dependency.symbols != null) {
|
|
199
195
|
var _dependency$symbols;
|
|
200
196
|
dependency.symbols = new Map((_dependency$symbols = dependency.symbols) === null || _dependency$symbols === void 0 ? void 0 : _dependency$symbols.map(mapSymbols));
|
|
201
197
|
}
|
|
@@ -392,7 +392,7 @@ class BundlerRunner {
|
|
|
392
392
|
validateBundles(bundleGraph) {
|
|
393
393
|
let bundles = bundleGraph.getBundles();
|
|
394
394
|
let bundleNames = bundles.map(b => (0, _projectPath.joinProjectPath)(b.target.distDir, (0, _nullthrows().default)(b.name)));
|
|
395
|
-
_assert().default.deepEqual(bundleNames, (0, _utils().unique)(bundleNames), 'Bundles must have unique name. Conflicting names: ' + [...(0, _utils().
|
|
395
|
+
_assert().default.deepEqual(bundleNames, (0, _utils().unique)(bundleNames), 'Bundles must have unique name. Conflicting names: ' + [...(0, _utils().setSymmetricDifference)(new Set(bundleNames), new Set((0, _utils().unique)(bundleNames)))].join());
|
|
396
396
|
}
|
|
397
397
|
async nameBundle(namers, internalBundle, internalBundleGraph) {
|
|
398
398
|
let bundle = _Bundle.Bundle.get(internalBundle, internalBundleGraph, this.options);
|
|
@@ -120,7 +120,7 @@ function assetGraphDiff(jsAssetGraph, rustAssetGraph) {
|
|
|
120
120
|
'$.value.outputHash',
|
|
121
121
|
// ignore correspondingRequest from all nodes
|
|
122
122
|
'$.correspondingRequest'];
|
|
123
|
-
console.log((0, _jestDiff().diff)(compactDeep(
|
|
123
|
+
console.log((0, _jestDiff().diff)(compactDeep(jsNode, ignoredPatterns), compactDeep(rustNode, ignoredPatterns)));
|
|
124
124
|
}
|
|
125
125
|
console.log('Missing', missing);
|
|
126
126
|
console.log('Extra', extra);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/core",
|
|
3
|
-
"version": "2.12.1-canary.
|
|
3
|
+
"version": "2.12.1-canary.3553+bb17a2994",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -20,21 +20,21 @@
|
|
|
20
20
|
"check-ts": "tsc --noEmit index.d.ts"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@atlaspack/build-cache": "2.12.1-canary.
|
|
24
|
-
"@atlaspack/cache": "2.12.1-canary.
|
|
25
|
-
"@atlaspack/diagnostic": "2.12.1-canary.
|
|
26
|
-
"@atlaspack/events": "2.12.1-canary.
|
|
27
|
-
"@atlaspack/feature-flags": "2.12.1-canary.
|
|
28
|
-
"@atlaspack/fs": "2.12.1-canary.
|
|
29
|
-
"@atlaspack/graph": "3.2.1-canary.
|
|
30
|
-
"@atlaspack/logger": "2.12.1-canary.
|
|
31
|
-
"@atlaspack/package-manager": "2.12.1-canary.
|
|
32
|
-
"@atlaspack/plugin": "2.12.1-canary.
|
|
33
|
-
"@atlaspack/profiler": "2.12.1-canary.
|
|
34
|
-
"@atlaspack/rust": "2.12.1-canary.
|
|
35
|
-
"@atlaspack/types": "2.12.1-canary.
|
|
36
|
-
"@atlaspack/utils": "2.12.1-canary.
|
|
37
|
-
"@atlaspack/workers": "2.12.1-canary.
|
|
23
|
+
"@atlaspack/build-cache": "2.12.1-canary.3553+bb17a2994",
|
|
24
|
+
"@atlaspack/cache": "2.12.1-canary.3553+bb17a2994",
|
|
25
|
+
"@atlaspack/diagnostic": "2.12.1-canary.3553+bb17a2994",
|
|
26
|
+
"@atlaspack/events": "2.12.1-canary.3553+bb17a2994",
|
|
27
|
+
"@atlaspack/feature-flags": "2.12.1-canary.3553+bb17a2994",
|
|
28
|
+
"@atlaspack/fs": "2.12.1-canary.3553+bb17a2994",
|
|
29
|
+
"@atlaspack/graph": "3.2.1-canary.3553+bb17a2994",
|
|
30
|
+
"@atlaspack/logger": "2.12.1-canary.3553+bb17a2994",
|
|
31
|
+
"@atlaspack/package-manager": "2.12.1-canary.3553+bb17a2994",
|
|
32
|
+
"@atlaspack/plugin": "2.12.1-canary.3553+bb17a2994",
|
|
33
|
+
"@atlaspack/profiler": "2.12.1-canary.3553+bb17a2994",
|
|
34
|
+
"@atlaspack/rust": "2.12.1-canary.3553+bb17a2994",
|
|
35
|
+
"@atlaspack/types": "2.12.1-canary.3553+bb17a2994",
|
|
36
|
+
"@atlaspack/utils": "2.12.1-canary.3553+bb17a2994",
|
|
37
|
+
"@atlaspack/workers": "2.12.1-canary.3553+bb17a2994",
|
|
38
38
|
"@mischnic/json-sourcemap": "^0.1.0",
|
|
39
39
|
"@parcel/source-map": "^2.1.1",
|
|
40
40
|
"base-x": "^3.0.8",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"browser": {
|
|
67
67
|
"./src/serializerCore.js": "./src/serializerCore.browser.js"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "bb17a299464827110c52faaca0807fa38f302457"
|
|
70
70
|
}
|
package/src/BundleGraph.js
CHANGED
|
@@ -73,6 +73,9 @@ export const bundleGraphEdgeTypes = {
|
|
|
73
73
|
// Signals that the dependency is internally resolvable via the bundle's ancestry,
|
|
74
74
|
// and that the bundle connected to the dependency is not necessary for the source bundle.
|
|
75
75
|
internal_async: 5,
|
|
76
|
+
// This type is used to mark an edge between a bundle and a conditional bundle.
|
|
77
|
+
// This allows efficient discovery of conditional bundles in packaging
|
|
78
|
+
conditional: 5,
|
|
76
79
|
};
|
|
77
80
|
|
|
78
81
|
export type BundleGraphEdgeType = $Values<typeof bundleGraphEdgeTypes>;
|
|
@@ -1176,6 +1179,14 @@ export default class BundleGraph {
|
|
|
1176
1179
|
);
|
|
1177
1180
|
}
|
|
1178
1181
|
|
|
1182
|
+
createBundleConditionalReference(from: Bundle, to: Bundle): void {
|
|
1183
|
+
this._graph.addEdge(
|
|
1184
|
+
this._graph.getNodeIdByContentKey(from.id),
|
|
1185
|
+
this._graph.getNodeIdByContentKey(to.id),
|
|
1186
|
+
bundleGraphEdgeTypes.conditional,
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1179
1190
|
getBundlesWithAsset(asset: Asset): Array<Bundle> {
|
|
1180
1191
|
return this._graph
|
|
1181
1192
|
.getNodeIdsConnectedTo(
|
|
@@ -2272,4 +2283,26 @@ export default class BundleGraph {
|
|
|
2272
2283
|
this._targetEntryRoots.set(target.distDir, root);
|
|
2273
2284
|
return root;
|
|
2274
2285
|
}
|
|
2286
|
+
|
|
2287
|
+
getReferencedConditionalBundles(bundle: Bundle): Array<Bundle> {
|
|
2288
|
+
let referencedBundles = new Set();
|
|
2289
|
+
this._graph.dfs({
|
|
2290
|
+
visit: (nodeId) => {
|
|
2291
|
+
let node = nullthrows(this._graph.getNode(nodeId));
|
|
2292
|
+
if (node.type !== 'bundle' || node.value.id === bundle.id) {
|
|
2293
|
+
return;
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
referencedBundles.add(node.value);
|
|
2297
|
+
},
|
|
2298
|
+
startNodeId: this._graph.getNodeIdByContentKey(bundle.id),
|
|
2299
|
+
getChildren: (nodeId) =>
|
|
2300
|
+
this._graph.getNodeIdsConnectedFrom(
|
|
2301
|
+
nodeId,
|
|
2302
|
+
bundleGraphEdgeTypes.conditional,
|
|
2303
|
+
),
|
|
2304
|
+
});
|
|
2305
|
+
|
|
2306
|
+
return [...referencedBundles];
|
|
2307
|
+
}
|
|
2275
2308
|
}
|
|
@@ -494,4 +494,10 @@ export default class BundleGraph<TBundle: IBundle>
|
|
|
494
494
|
|
|
495
495
|
return bundleConditions;
|
|
496
496
|
}
|
|
497
|
+
|
|
498
|
+
getReferencedConditionalBundles(bundle: IBundle): Array<TBundle> {
|
|
499
|
+
return this.#graph
|
|
500
|
+
.getReferencedConditionalBundles(bundleToInternalBundle(bundle))
|
|
501
|
+
.map((result) => this.#createBundle(result, this.#graph, this.#options));
|
|
502
|
+
}
|
|
497
503
|
}
|
|
@@ -280,6 +280,13 @@ export default class MutableBundleGraph
|
|
|
280
280
|
);
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
+
createBundleConditionalReference(from: IBundle, to: IBundle): void {
|
|
284
|
+
return this.#graph.createBundleConditionalReference(
|
|
285
|
+
bundleToInternalBundle(from),
|
|
286
|
+
bundleToInternalBundle(to),
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
283
290
|
getDependencyAssets(dependency: IDependency): Array<IAsset> {
|
|
284
291
|
return this.#graph
|
|
285
292
|
.getDependencyAssets(dependencyToInternalDependency(dependency))
|
|
@@ -221,10 +221,7 @@ function getAssetGraph(serializedGraph, options) {
|
|
|
221
221
|
dependency.id = id;
|
|
222
222
|
dependency.env.id = getEnvId(dependency.env);
|
|
223
223
|
|
|
224
|
-
|
|
225
|
-
// is enabled. Some tests will fail if this is not the case. We should
|
|
226
|
-
// make this consistant when we re-visit packaging.
|
|
227
|
-
if (dependency.symbols != null || dependency.env.shouldScopeHoist) {
|
|
224
|
+
if (dependency.symbols != null) {
|
|
228
225
|
dependency.symbols = new Map(dependency.symbols?.map(mapSymbols));
|
|
229
226
|
}
|
|
230
227
|
|
|
@@ -27,7 +27,7 @@ import MutableBundleGraph from '../public/MutableBundleGraph';
|
|
|
27
27
|
import {Bundle, NamedBundle} from '../public/Bundle';
|
|
28
28
|
import {report} from '../ReporterRunner';
|
|
29
29
|
import dumpGraphToGraphViz from '../dumpGraphToGraphViz';
|
|
30
|
-
import {unique,
|
|
30
|
+
import {unique, setSymmetricDifference} from '@atlaspack/utils';
|
|
31
31
|
import {hashString} from '@atlaspack/rust';
|
|
32
32
|
import PluginOptions from '../public/PluginOptions';
|
|
33
33
|
import applyRuntimes from '../applyRuntimes';
|
|
@@ -511,7 +511,10 @@ class BundlerRunner {
|
|
|
511
511
|
unique(bundleNames),
|
|
512
512
|
'Bundles must have unique name. Conflicting names: ' +
|
|
513
513
|
[
|
|
514
|
-
...
|
|
514
|
+
...setSymmetricDifference(
|
|
515
|
+
new Set(bundleNames),
|
|
516
|
+
new Set(unique(bundleNames)),
|
|
517
|
+
),
|
|
515
518
|
].join(),
|
|
516
519
|
);
|
|
517
520
|
}
|
|
@@ -130,10 +130,11 @@ function assetGraphDiff(jsAssetGraph: AssetGraph, rustAssetGraph: AssetGraph) {
|
|
|
130
130
|
// ignore correspondingRequest from all nodes
|
|
131
131
|
'$.correspondingRequest',
|
|
132
132
|
];
|
|
133
|
+
|
|
133
134
|
console.log(
|
|
134
135
|
diff(
|
|
135
|
-
compactDeep(rustNode, ignoredPatterns),
|
|
136
136
|
compactDeep(jsNode, ignoredPatterns),
|
|
137
|
+
compactDeep(rustNode, ignoredPatterns),
|
|
137
138
|
),
|
|
138
139
|
);
|
|
139
140
|
}
|