@atlaspack/graph 3.2.1-dev.3450 → 3.2.1-dev.3478
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/package.json +3 -3
- package/src/AdjacencyList.js +3 -3
- package/src/Graph.js +15 -12
- package/test/AdjacencyList.test.js +1 -1
- package/test/BitSet.test.js +2 -2
- package/test/Graph.test.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/graph",
|
|
3
|
-
"version": "3.2.1-dev.
|
|
3
|
+
"version": "3.2.1-dev.3478+5fd2da535",
|
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
|
5
5
|
"license": "(MIT OR Apache-2.0)",
|
|
6
6
|
"publishConfig": {
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"node": ">= 16.0.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@atlaspack/feature-flags": "2.12.1-dev.
|
|
19
|
+
"@atlaspack/feature-flags": "2.12.1-dev.3478+5fd2da535",
|
|
20
20
|
"nullthrows": "^1.1.1"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "5fd2da535ecbe096d57e03aec15e80bb1d7601f7"
|
|
23
23
|
}
|
package/src/AdjacencyList.js
CHANGED
|
@@ -301,7 +301,7 @@ export default class AdjacencyList<TEdgeType: number = 1> {
|
|
|
301
301
|
// Copy the existing edges into the new array.
|
|
302
302
|
nodes.nextId = this.#nodes.nextId;
|
|
303
303
|
this.#edges.forEach(
|
|
304
|
-
edge =>
|
|
304
|
+
(edge) =>
|
|
305
305
|
void link(
|
|
306
306
|
this.#edges.from(edge),
|
|
307
307
|
this.#edges.to(edge),
|
|
@@ -570,7 +570,7 @@ export default class AdjacencyList<TEdgeType: number = 1> {
|
|
|
570
570
|
| NullEdgeType
|
|
571
571
|
| Array<TEdgeType | NullEdgeType> = 1,
|
|
572
572
|
): NodeId[] {
|
|
573
|
-
let matches = node =>
|
|
573
|
+
let matches = (node) =>
|
|
574
574
|
type === ALL_EDGE_TYPES ||
|
|
575
575
|
(Array.isArray(type)
|
|
576
576
|
? type.includes(this.#nodes.typeOf(node))
|
|
@@ -628,7 +628,7 @@ export default class AdjacencyList<TEdgeType: number = 1> {
|
|
|
628
628
|
| NullEdgeType
|
|
629
629
|
| Array<TEdgeType | NullEdgeType> = 1,
|
|
630
630
|
): NodeId[] {
|
|
631
|
-
let matches = node =>
|
|
631
|
+
let matches = (node) =>
|
|
632
632
|
type === ALL_EDGE_TYPES ||
|
|
633
633
|
(Array.isArray(type)
|
|
634
634
|
? type.includes(this.#nodes.typeOf(node))
|
package/src/Graph.js
CHANGED
|
@@ -293,7 +293,7 @@ export default class Graph<TNode, TEdgeType: number = 1> {
|
|
|
293
293
|
replaceNodeIdsConnectedTo(
|
|
294
294
|
fromNodeId: NodeId,
|
|
295
295
|
toNodeIds: $ReadOnlyArray<NodeId>,
|
|
296
|
-
replaceFilter?: null | (NodeId => boolean),
|
|
296
|
+
replaceFilter?: null | ((NodeId) => boolean),
|
|
297
297
|
type?: TEdgeType | NullEdgeType = 1,
|
|
298
298
|
): void {
|
|
299
299
|
this._assertHasNodeId(fromNodeId);
|
|
@@ -301,7 +301,7 @@ export default class Graph<TNode, TEdgeType: number = 1> {
|
|
|
301
301
|
let outboundEdges = this.getNodeIdsConnectedFrom(fromNodeId, type);
|
|
302
302
|
let childrenToRemove = new Set(
|
|
303
303
|
replaceFilter
|
|
304
|
-
? outboundEdges.filter(toNodeId => replaceFilter(toNodeId))
|
|
304
|
+
? outboundEdges.filter((toNodeId) => replaceFilter(toNodeId))
|
|
305
305
|
: outboundEdges,
|
|
306
306
|
);
|
|
307
307
|
for (let toNodeId of toNodeIds) {
|
|
@@ -337,7 +337,7 @@ export default class Graph<TNode, TEdgeType: number = 1> {
|
|
|
337
337
|
return this.dfs({
|
|
338
338
|
visit,
|
|
339
339
|
startNodeId,
|
|
340
|
-
getChildren: nodeId => this.getNodeIdsConnectedFrom(nodeId, type),
|
|
340
|
+
getChildren: (nodeId) => this.getNodeIdsConnectedFrom(nodeId, type),
|
|
341
341
|
});
|
|
342
342
|
}
|
|
343
343
|
}
|
|
@@ -363,7 +363,7 @@ export default class Graph<TNode, TEdgeType: number = 1> {
|
|
|
363
363
|
return this.dfs({
|
|
364
364
|
visit,
|
|
365
365
|
startNodeId,
|
|
366
|
-
getChildren: nodeId => this.getNodeIdsConnectedTo(nodeId, type),
|
|
366
|
+
getChildren: (nodeId) => this.getNodeIdsConnectedTo(nodeId, type),
|
|
367
367
|
});
|
|
368
368
|
}
|
|
369
369
|
|
|
@@ -421,7 +421,7 @@ export default class Graph<TNode, TEdgeType: number = 1> {
|
|
|
421
421
|
return context;
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
this.adjacencyList.forEachNodeIdConnectedFromReverse(nodeId, child => {
|
|
424
|
+
this.adjacencyList.forEachNodeIdConnectedFromReverse(nodeId, (child) => {
|
|
425
425
|
if (!visited.has(child)) {
|
|
426
426
|
queue.push({nodeId: child, context});
|
|
427
427
|
}
|
|
@@ -473,12 +473,15 @@ export default class Graph<TNode, TEdgeType: number = 1> {
|
|
|
473
473
|
if (!visited.has(nodeId)) {
|
|
474
474
|
visited.add(nodeId);
|
|
475
475
|
|
|
476
|
-
this.adjacencyList.forEachNodeIdConnectedFromReverse(
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
476
|
+
this.adjacencyList.forEachNodeIdConnectedFromReverse(
|
|
477
|
+
nodeId,
|
|
478
|
+
(child) => {
|
|
479
|
+
if (!visited.has(child)) {
|
|
480
|
+
queue.push(child);
|
|
481
|
+
}
|
|
482
|
+
return false;
|
|
483
|
+
},
|
|
484
|
+
);
|
|
482
485
|
} else {
|
|
483
486
|
queue.pop();
|
|
484
487
|
visit(nodeId, null, actions);
|
|
@@ -633,7 +636,7 @@ export default class Graph<TNode, TEdgeType: number = 1> {
|
|
|
633
636
|
let sorted: Array<NodeId> = [];
|
|
634
637
|
this.traverse(
|
|
635
638
|
{
|
|
636
|
-
exit: nodeId => {
|
|
639
|
+
exit: (nodeId) => {
|
|
637
640
|
sorted.push(nodeId);
|
|
638
641
|
},
|
|
639
642
|
},
|
|
@@ -289,7 +289,7 @@ describe('AdjacencyList', () => {
|
|
|
289
289
|
let originalSerialized = graph.serialize();
|
|
290
290
|
let originalNodes = [...originalSerialized.nodes];
|
|
291
291
|
let originalEdges = [...originalSerialized.edges];
|
|
292
|
-
let work = new Promise(resolve => worker.on('message', resolve));
|
|
292
|
+
let work = new Promise((resolve) => worker.on('message', resolve));
|
|
293
293
|
worker.postMessage(originalSerialized);
|
|
294
294
|
let received = AdjacencyList.deserialize(await work);
|
|
295
295
|
// eslint-disable-next-line no-unused-vars
|
package/test/BitSet.test.js
CHANGED
|
@@ -5,14 +5,14 @@ import {BitSet} from '../src/BitSet';
|
|
|
5
5
|
|
|
6
6
|
function assertValues(set: BitSet, values: Array<number>) {
|
|
7
7
|
let setValues = [];
|
|
8
|
-
set.forEach(bit => {
|
|
8
|
+
set.forEach((bit) => {
|
|
9
9
|
setValues.push(bit);
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
for (let value of values) {
|
|
13
13
|
assert(set.has(value), 'Set.has returned false');
|
|
14
14
|
assert(
|
|
15
|
-
setValues.some(v => v === value),
|
|
15
|
+
setValues.some((v) => v === value),
|
|
16
16
|
'Set values is missing value',
|
|
17
17
|
);
|
|
18
18
|
}
|