@atlaspack/graph 3.2.1-canary.3522 → 3.2.1-canary.3527

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/Graph.js CHANGED
@@ -31,7 +31,10 @@ class Graph {
31
31
  this.nodes = (opts === null || opts === void 0 ? void 0 : opts.nodes) || [];
32
32
  this.setRootNodeId(opts === null || opts === void 0 ? void 0 : opts.rootNodeId);
33
33
  let adjacencyList = opts === null || opts === void 0 ? void 0 : opts.adjacencyList;
34
- this.adjacencyList = adjacencyList ? _AdjacencyList.default.deserialize(adjacencyList) : new _AdjacencyList.default();
34
+ let initialCapacity = opts === null || opts === void 0 ? void 0 : opts.initialCapacity;
35
+ this.adjacencyList = adjacencyList ? _AdjacencyList.default.deserialize(adjacencyList) : new _AdjacencyList.default(typeof initialCapacity === 'number' ? {
36
+ initialCapacity
37
+ } : undefined);
35
38
  }
36
39
  setRootNodeId(id) {
37
40
  this.rootNodeId = id;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/graph",
3
- "version": "3.2.1-canary.3522+56e3e234a",
3
+ "version": "3.2.1-canary.3527+3766d627c",
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-canary.3522+56e3e234a",
19
+ "@atlaspack/feature-flags": "2.12.1-canary.3527+3766d627c",
20
20
  "nullthrows": "^1.1.1"
21
21
  },
22
- "gitHead": "56e3e234a88ec4681a542477d38e3a7e1f300844"
22
+ "gitHead": "3766d627cee17159b930f3117730d214c4774152"
23
23
  }
package/src/Graph.js CHANGED
@@ -17,6 +17,7 @@ export type GraphOpts<TNode, TEdgeType: number = 1> = {|
17
17
  nodes?: Array<TNode | null>,
18
18
  adjacencyList?: SerializedAdjacencyList<TEdgeType>,
19
19
  rootNodeId?: ?NodeId,
20
+ initialCapacity?: number,
20
21
  |};
21
22
 
22
23
  export type SerializedGraph<TNode, TEdgeType: number = 1> = {|
@@ -84,9 +85,12 @@ export default class Graph<TNode, TEdgeType: number = 1> {
84
85
  this.setRootNodeId(opts?.rootNodeId);
85
86
 
86
87
  let adjacencyList = opts?.adjacencyList;
88
+ let initialCapacity = opts?.initialCapacity;
87
89
  this.adjacencyList = adjacencyList
88
90
  ? AdjacencyList.deserialize(adjacencyList)
89
- : new AdjacencyList<TEdgeType>();
91
+ : new AdjacencyList<TEdgeType>(
92
+ typeof initialCapacity === 'number' ? {initialCapacity} : undefined,
93
+ );
90
94
  }
91
95
 
92
96
  setRootNodeId(id: ?NodeId) {