@atlaspack/bundler-experimental 2.13.24-typescript-b27501580.0 → 2.13.24-typescript-e99c742e9.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.
@@ -0,0 +1,13 @@
|
|
1
|
+
import { ContentGraph, NodeId } from '@atlaspack/graph';
|
2
|
+
/**
|
3
|
+
* A `ContentGraph` that also stores weights on edges.
|
4
|
+
*
|
5
|
+
* @template N The type of the node weight.
|
6
|
+
* @template EW The type of the edge weight.
|
7
|
+
*/
|
8
|
+
export declare class EdgeContentGraph<N, EW> extends ContentGraph<N, number> {
|
9
|
+
#private;
|
10
|
+
clone(): EdgeContentGraph<N, EW>;
|
11
|
+
addWeightedEdge(from: NodeId, to: NodeId, type: number, weight: EW | null): void;
|
12
|
+
getEdgeWeight(from: NodeId, to: NodeId): EW | null;
|
13
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import type { Graph, NodeId } from '@atlaspack/graph';
|
2
|
+
export type StronglyConnectedComponent = NodeId[];
|
3
|
+
/**
|
4
|
+
* Robert Tarjan's algorithm to find strongly connected components in a graph.
|
5
|
+
*
|
6
|
+
* Time complexity: O(V + E)
|
7
|
+
* Space complexity (worst case): O(V)
|
8
|
+
*
|
9
|
+
* * https://web.archive.org/web/20170829214726id_/http://www.cs.ucsb.edu/~gilbert/cs240a/old/cs240aSpr2011/slides/TarjanDFS.pdf
|
10
|
+
* * https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm
|
11
|
+
*/
|
12
|
+
export declare function findStronglyConnectedComponents<T, E extends number>(graph: Graph<T, E>): StronglyConnectedComponent[];
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { NodeId, Graph } from '@atlaspack/graph';
|
2
|
+
/**
|
3
|
+
* Implements "A simple, fast dominance algorithm", to find the immediate
|
4
|
+
* dominators of all nodes in a graph.
|
5
|
+
*
|
6
|
+
* Returns a map of node IDs to their immediate dominator's node ID.
|
7
|
+
* This map is represented by an array where the index is the node ID and the
|
8
|
+
* value is its dominator.
|
9
|
+
*
|
10
|
+
* For example, given a node `3`, `dominators[3]` is the immediate dominator
|
11
|
+
* of node 3.
|
12
|
+
*
|
13
|
+
* - https://www.cs.tufts.edu/comp/150FP/archive/keith-cooper/dom14.pdf
|
14
|
+
*/
|
15
|
+
export declare function simpleFastDominance<T>(graph: Graph<T, number>): NodeId[];
|
16
|
+
/**
|
17
|
+
* Return the post-order of the graph.
|
18
|
+
*/
|
19
|
+
export declare function getGraphPostOrder<T>(graph: Graph<T, number>, type?: number): NodeId[];
|
20
|
+
/**
|
21
|
+
* From "A Simple, Fast Dominance Algorithm"
|
22
|
+
* Keith D. Cooper, Timothy J. Harvey, and Ken Kennedy:
|
23
|
+
*
|
24
|
+
* > The intersection routine appears at the bottom of the figure.
|
25
|
+
* > It implements a “two-finger” algorithm – one can imagine a finger pointing
|
26
|
+
* > to each dominator set, each finger moving independently as the comparisons
|
27
|
+
* > dictate. In this case, the comparisons are on postorder numbers; for each
|
28
|
+
* > intersection, we start the two fingers at the ends of the two sets, and,
|
29
|
+
* > until the fingers point to the same postorder number, we move the finger
|
30
|
+
* > pointing to the smaller number back one element. Remember that nodes higher
|
31
|
+
* > in the dominator tree have higher postorder numbers, which is why intersect
|
32
|
+
* > moves the finger whose value is less than the other finger’s. When the two
|
33
|
+
* > fingers point at the same element, intersect returns that element. The set
|
34
|
+
* > resulting from the intersection begins with the returned element and chains
|
35
|
+
* > its way up the doms array to the entry node.
|
36
|
+
*
|
37
|
+
* `postOrder` is the post-order node list of the graph.
|
38
|
+
*
|
39
|
+
* `dominators` is the current immediate dominator state for node in the graph.
|
40
|
+
*
|
41
|
+
* This is coupled with the fact node ids are indexes into an array. It is a map
|
42
|
+
* of NodeId -> NodeId, where the value at index `i` is the immediate dominator
|
43
|
+
* of the node `i`.
|
44
|
+
*
|
45
|
+
* `predecessor` is one predecessor node id of the node we're currently
|
46
|
+
* computing the immediate dominator for.
|
47
|
+
*
|
48
|
+
* `newImmediateDominator` is current best immediate dominator candidate for the
|
49
|
+
* node we're computing the immediate dominator for.
|
50
|
+
*
|
51
|
+
* The algorithm is intersecting the dominator sets of the two predecessors and
|
52
|
+
* returning dominator node with the highest post-order number by walking up
|
53
|
+
* the dominator tree until the two sets intersect.
|
54
|
+
*
|
55
|
+
* The node with the highest post-order index is the immediate dominator, as
|
56
|
+
* it is the closest to the node we're computing for.
|
57
|
+
*/
|
58
|
+
export declare function intersect(postOrderIndexes: number[], dominators: NodeId | null[], predecessor: NodeId, newImmediateDominator: NodeId): NodeId;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaspack/bundler-experimental",
|
3
|
-
"version": "2.13.24-typescript-
|
3
|
+
"version": "2.13.24-typescript-e99c742e9.0",
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
5
5
|
"type": "commonjs",
|
6
6
|
"publishConfig": {
|
@@ -17,22 +17,22 @@
|
|
17
17
|
"node": ">= 16.0.0"
|
18
18
|
},
|
19
19
|
"dependencies": {
|
20
|
-
"@atlaspack/core": "2.19.3-typescript-
|
21
|
-
"@atlaspack/diagnostic": "2.14.2-typescript-
|
22
|
-
"@atlaspack/feature-flags": "2.19.3-typescript-
|
23
|
-
"@atlaspack/graph": "3.5.10-typescript-
|
24
|
-
"@atlaspack/logger": "2.14.14-typescript-
|
25
|
-
"@atlaspack/plugin": "2.14.21-typescript-
|
26
|
-
"@atlaspack/rust": "3.4.2-typescript-
|
27
|
-
"@atlaspack/types": "2.15.11-typescript-
|
28
|
-
"@atlaspack/utils": "2.17.3-typescript-
|
20
|
+
"@atlaspack/core": "2.19.3-typescript-e99c742e9.0",
|
21
|
+
"@atlaspack/diagnostic": "2.14.2-typescript-e99c742e9.0",
|
22
|
+
"@atlaspack/feature-flags": "2.19.3-typescript-e99c742e9.0",
|
23
|
+
"@atlaspack/graph": "3.5.10-typescript-e99c742e9.0",
|
24
|
+
"@atlaspack/logger": "2.14.14-typescript-e99c742e9.0",
|
25
|
+
"@atlaspack/plugin": "2.14.21-typescript-e99c742e9.0",
|
26
|
+
"@atlaspack/rust": "3.4.2-typescript-e99c742e9.0",
|
27
|
+
"@atlaspack/types": "2.15.11-typescript-e99c742e9.0",
|
28
|
+
"@atlaspack/utils": "2.17.3-typescript-e99c742e9.0",
|
29
29
|
"nullthrows": "^1.1.1"
|
30
30
|
},
|
31
31
|
"devDependencies": {
|
32
|
-
"@atlaspack/fs": "2.15.16-typescript-
|
32
|
+
"@atlaspack/fs": "2.15.16-typescript-e99c742e9.0"
|
33
33
|
},
|
34
34
|
"scripts": {
|
35
35
|
"check-ts": "tsc --emitDeclarationOnly --rootDir src"
|
36
36
|
},
|
37
|
-
"gitHead": "
|
37
|
+
"gitHead": "e99c742e92175ac411d807daf2ba45d5bacebb58"
|
38
38
|
}
|