@atlaspack/graph 3.5.10-typescript-bc4459c37.0 → 3.5.10
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 +7 -0
- package/lib/AdjacencyList.js +3 -26
- package/lib/BitSet.js +1 -0
- package/lib/ContentGraph.js +5 -1
- package/lib/Graph.js +3 -8
- package/lib/shared-buffer.js +1 -5
- package/lib/types.js +0 -1
- package/package.json +8 -11
- package/src/{AdjacencyList.ts → AdjacencyList.js} +101 -127
- package/src/{BitSet.ts → BitSet.js} +3 -0
- package/src/{ContentGraph.ts → ContentGraph.js} +20 -21
- package/src/{Graph.ts → Graph.js} +65 -88
- package/src/{index.ts → index.js} +2 -0
- package/src/{shared-buffer.ts → shared-buffer.js} +3 -6
- package/src/{types.ts → types.js} +7 -5
- package/test/{AdjacencyList.test.ts → AdjacencyList.test.js} +29 -21
- package/test/{BitSet.test.ts → BitSet.test.js} +5 -3
- package/test/{ContentGraph.test.ts → ContentGraph.test.js} +4 -2
- package/test/{Graph.test.ts → Graph.test.js} +24 -22
- package/LICENSE +0 -201
- package/lib/AdjacencyList.d.ts +0 -607
- package/lib/BitSet.d.ts +0 -19
- package/lib/ContentGraph.d.ts +0 -23
- package/lib/Graph.d.ts +0 -91
- package/lib/index.d.ts +0 -7
- package/lib/shared-buffer.d.ts +0 -2
- package/lib/types.d.ts +0 -9
- package/tsconfig.json +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaspack/graph
|
|
2
2
|
|
|
3
|
+
## 3.5.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`069de47`](https://github.com/atlassian-labs/atlaspack/commit/069de478e64fb5889f6f2ce023eb510782767fbd)]:
|
|
8
|
+
- @atlaspack/feature-flags@2.20.0
|
|
9
|
+
|
|
3
10
|
## 3.5.9
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/lib/AdjacencyList.js
CHANGED
|
@@ -23,13 +23,9 @@ var _types = require("./types");
|
|
|
23
23
|
var _Graph = require("./Graph");
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
25
|
/** The address of the node in the nodes map. */
|
|
26
|
-
|
|
27
26
|
/** The address of the edge in the edges map. */
|
|
28
|
-
|
|
29
27
|
// eslint-disable-next-line no-unused-vars
|
|
30
|
-
|
|
31
28
|
// eslint-disable-next-line no-unused-vars
|
|
32
|
-
|
|
33
29
|
const DEFAULT_PARAMS = {
|
|
34
30
|
initialCapacity: 2,
|
|
35
31
|
unloadFactor: 0.3,
|
|
@@ -103,10 +99,7 @@ class AdjacencyList {
|
|
|
103
99
|
constructor(opts) {
|
|
104
100
|
let nodes;
|
|
105
101
|
let edges;
|
|
106
|
-
|
|
107
|
-
// @ts-expect-error TS2339
|
|
108
102
|
if (opts !== null && opts !== void 0 && opts.nodes) {
|
|
109
|
-
// @ts-expect-error TS2339
|
|
110
103
|
({
|
|
111
104
|
nodes,
|
|
112
105
|
edges
|
|
@@ -159,7 +152,6 @@ class AdjacencyList {
|
|
|
159
152
|
get stats() {
|
|
160
153
|
let edgeTypes = new Set();
|
|
161
154
|
let buckets = new Map();
|
|
162
|
-
// @ts-expect-error TS2488
|
|
163
155
|
for (let {
|
|
164
156
|
from,
|
|
165
157
|
to,
|
|
@@ -232,17 +224,13 @@ class AdjacencyList {
|
|
|
232
224
|
|
|
233
225
|
// Copy the existing edges into the new array.
|
|
234
226
|
nodes.nextId = this.#nodes.nextId;
|
|
235
|
-
this.#edges.forEach(edge => void link(this.#edges.from(edge), this.#edges.to(edge), this.#edges.typeOf(edge),
|
|
236
|
-
// @ts-expect-error TS2345
|
|
237
|
-
edges, nodes, this.#params.unloadFactor));
|
|
227
|
+
this.#edges.forEach(edge => void link(this.#edges.from(edge), this.#edges.to(edge), this.#edges.typeOf(edge), edges, nodes, this.#params.unloadFactor));
|
|
238
228
|
|
|
239
229
|
// We expect to preserve the same number of edges.
|
|
240
230
|
(0, _assert().default)(this.#edges.count === edges.count, `Edge mismatch! ${this.#edges.count} does not match ${edges.count}.`);
|
|
241
231
|
|
|
242
232
|
// Finally, copy the new data arrays over to this graph.
|
|
243
|
-
// @ts-expect-error TS2322
|
|
244
233
|
this.#nodes = nodes;
|
|
245
|
-
// @ts-expect-error TS2322
|
|
246
234
|
this.#edges = edges;
|
|
247
235
|
}
|
|
248
236
|
|
|
@@ -611,7 +599,6 @@ class SharedTypeMap {
|
|
|
611
599
|
static #TYPE = 1;
|
|
612
600
|
|
|
613
601
|
/** The largest possible capacity. */
|
|
614
|
-
// @ts-expect-error TS1094
|
|
615
602
|
static get MAX_CAPACITY() {
|
|
616
603
|
return Math.floor(
|
|
617
604
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Invalid_array_length#what_went_wrong
|
|
@@ -644,7 +631,6 @@ class SharedTypeMap {
|
|
|
644
631
|
|
|
645
632
|
/** The address of the first item in the map. */
|
|
646
633
|
get addressableLimit() {
|
|
647
|
-
// @ts-expect-error TS2339
|
|
648
634
|
return this.constructor.HEADER_SIZE + this.capacity;
|
|
649
635
|
}
|
|
650
636
|
|
|
@@ -667,6 +653,7 @@ class SharedTypeMap {
|
|
|
667
653
|
BYTES_PER_ELEMENT
|
|
668
654
|
} = Uint32Array;
|
|
669
655
|
let CAPACITY = SharedTypeMap.#CAPACITY;
|
|
656
|
+
// $FlowFixMe[incompatible-call]
|
|
670
657
|
this.data = new Uint32Array(new _sharedBuffer.SharedBuffer(this.getLength(capacityOrData) * BYTES_PER_ELEMENT));
|
|
671
658
|
this.data[CAPACITY] = capacityOrData;
|
|
672
659
|
} else {
|
|
@@ -683,7 +670,6 @@ class SharedTypeMap {
|
|
|
683
670
|
* and is expected to be of equal or smaller capacity to this map.
|
|
684
671
|
*/
|
|
685
672
|
set(data) {
|
|
686
|
-
// @ts-expect-error TS2339
|
|
687
673
|
let {
|
|
688
674
|
HEADER_SIZE,
|
|
689
675
|
ITEM_SIZE
|
|
@@ -734,7 +720,6 @@ class SharedTypeMap {
|
|
|
734
720
|
* get the length of the map, in bytes.
|
|
735
721
|
*/
|
|
736
722
|
getLength(capacity = this.capacity) {
|
|
737
|
-
// @ts-expect-error TS2339
|
|
738
723
|
let {
|
|
739
724
|
HEADER_SIZE,
|
|
740
725
|
ITEM_SIZE
|
|
@@ -744,7 +729,6 @@ class SharedTypeMap {
|
|
|
744
729
|
|
|
745
730
|
/** Get the next available address in the map. */
|
|
746
731
|
getNextAddress() {
|
|
747
|
-
// @ts-expect-error TS2339
|
|
748
732
|
let {
|
|
749
733
|
HEADER_SIZE,
|
|
750
734
|
ITEM_SIZE
|
|
@@ -754,7 +738,6 @@ class SharedTypeMap {
|
|
|
754
738
|
|
|
755
739
|
/** Get the address of the first item with the given hash. */
|
|
756
740
|
head(hash) {
|
|
757
|
-
// @ts-expect-error TS2339
|
|
758
741
|
let {
|
|
759
742
|
HEADER_SIZE
|
|
760
743
|
} = this.constructor;
|
|
@@ -780,7 +763,6 @@ class SharedTypeMap {
|
|
|
780
763
|
let COUNT = SharedTypeMap.#COUNT;
|
|
781
764
|
let NEXT = SharedTypeMap.#NEXT;
|
|
782
765
|
let TYPE = SharedTypeMap.#TYPE;
|
|
783
|
-
// @ts-expect-error TS2339
|
|
784
766
|
let {
|
|
785
767
|
HEADER_SIZE
|
|
786
768
|
} = this.constructor;
|
|
@@ -807,7 +789,6 @@ class SharedTypeMap {
|
|
|
807
789
|
let COUNT = SharedTypeMap.#COUNT;
|
|
808
790
|
let NEXT = SharedTypeMap.#NEXT;
|
|
809
791
|
let TYPE = SharedTypeMap.#TYPE;
|
|
810
|
-
// @ts-expect-error TS2339
|
|
811
792
|
let {
|
|
812
793
|
HEADER_SIZE
|
|
813
794
|
} = this.constructor;
|
|
@@ -820,7 +801,6 @@ class SharedTypeMap {
|
|
|
820
801
|
let candidate = head;
|
|
821
802
|
while (candidate !== null && candidate !== item) {
|
|
822
803
|
prev = candidate;
|
|
823
|
-
// @ts-expect-error TS2322
|
|
824
804
|
candidate = this.next(candidate);
|
|
825
805
|
}
|
|
826
806
|
if (prev !== null && next !== null) {
|
|
@@ -838,7 +818,6 @@ class SharedTypeMap {
|
|
|
838
818
|
forEach(cb) {
|
|
839
819
|
let max = this.count;
|
|
840
820
|
let len = this.length;
|
|
841
|
-
// @ts-expect-error TS2339
|
|
842
821
|
let {
|
|
843
822
|
ITEM_SIZE
|
|
844
823
|
} = this.constructor;
|
|
@@ -855,10 +834,10 @@ class SharedTypeMap {
|
|
|
855
834
|
// See https://github.com/facebook/flow/issues/1163#issuecomment-353523840
|
|
856
835
|
/*:: @@iterator(): Iterator<TAddress> { return ({}: any); } */
|
|
857
836
|
|
|
837
|
+
// $FlowFixMe[unsupported-syntax]
|
|
858
838
|
*[Symbol.iterator]() {
|
|
859
839
|
let max = this.count;
|
|
860
840
|
let len = this.length;
|
|
861
|
-
// @ts-expect-error TS2339
|
|
862
841
|
let {
|
|
863
842
|
ITEM_SIZE
|
|
864
843
|
} = this.constructor;
|
|
@@ -870,7 +849,6 @@ class SharedTypeMap {
|
|
|
870
849
|
}
|
|
871
850
|
}
|
|
872
851
|
inspect() {
|
|
873
|
-
// @ts-expect-error TS2339
|
|
874
852
|
const {
|
|
875
853
|
HEADER_SIZE
|
|
876
854
|
} = this.constructor;
|
|
@@ -1190,7 +1168,6 @@ class EdgeTypeMap extends SharedTypeMap {
|
|
|
1190
1168
|
|
|
1191
1169
|
/** Get the next available address in the map. */
|
|
1192
1170
|
getNextAddress() {
|
|
1193
|
-
// @ts-expect-error TS2339
|
|
1194
1171
|
let {
|
|
1195
1172
|
ITEM_SIZE
|
|
1196
1173
|
} = this.constructor;
|
package/lib/BitSet.js
CHANGED
package/lib/ContentGraph.js
CHANGED
|
@@ -30,14 +30,18 @@ class ContentGraph extends _Graph.default {
|
|
|
30
30
|
this._nodeIdToContentKey = new Map();
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
// $FlowFixMe[prop-missing]
|
|
33
35
|
static deserialize(opts) {
|
|
34
36
|
return new ContentGraph(opts);
|
|
35
37
|
}
|
|
38
|
+
|
|
39
|
+
// $FlowFixMe[prop-missing]
|
|
36
40
|
serialize() {
|
|
41
|
+
// $FlowFixMe[prop-missing]
|
|
37
42
|
return {
|
|
38
43
|
...super.serialize(),
|
|
39
44
|
_contentKeyToNodeId: this._contentKeyToNodeId,
|
|
40
|
-
// @ts-expect-error TS2353
|
|
41
45
|
_nodeIdToContentKey: this._nodeIdToContentKey
|
|
42
46
|
};
|
|
43
47
|
}
|
package/lib/Graph.js
CHANGED
|
@@ -248,7 +248,6 @@ class Graph {
|
|
|
248
248
|
context: null
|
|
249
249
|
}];
|
|
250
250
|
while (queue.length !== 0) {
|
|
251
|
-
// @ts-expect-error TS2339
|
|
252
251
|
let {
|
|
253
252
|
nodeId,
|
|
254
253
|
context
|
|
@@ -258,6 +257,7 @@ class Graph {
|
|
|
258
257
|
skipped = false;
|
|
259
258
|
let newContext = visit(nodeId, context, actions);
|
|
260
259
|
if (typeof newContext !== 'undefined') {
|
|
260
|
+
// $FlowFixMe[reassign-const]
|
|
261
261
|
context = newContext;
|
|
262
262
|
}
|
|
263
263
|
if (skipped) {
|
|
@@ -366,18 +366,15 @@ class Graph {
|
|
|
366
366
|
const enter = typeof visit === 'function' ? visit : visit.enter;
|
|
367
367
|
while (queue.length !== 0) {
|
|
368
368
|
const command = queue.pop();
|
|
369
|
-
|
|
370
|
-
// @ts-expect-error TS18048
|
|
371
369
|
if (command.exit != null) {
|
|
372
|
-
// @ts-expect-error TS2339
|
|
373
370
|
let {
|
|
374
371
|
nodeId,
|
|
375
372
|
context,
|
|
376
373
|
exit
|
|
377
374
|
} = command;
|
|
378
|
-
// @ts-expect-error TS18048
|
|
379
375
|
let newContext = exit(nodeId, command.context, actions);
|
|
380
376
|
if (typeof newContext !== 'undefined') {
|
|
377
|
+
// $FlowFixMe[reassign-const]
|
|
381
378
|
context = newContext;
|
|
382
379
|
}
|
|
383
380
|
if (skipped) {
|
|
@@ -388,7 +385,6 @@ class Graph {
|
|
|
388
385
|
return context;
|
|
389
386
|
}
|
|
390
387
|
} else {
|
|
391
|
-
// @ts-expect-error TS2339
|
|
392
388
|
let {
|
|
393
389
|
nodeId,
|
|
394
390
|
context
|
|
@@ -399,6 +395,7 @@ class Graph {
|
|
|
399
395
|
if (enter) {
|
|
400
396
|
let newContext = enter(nodeId, context, actions);
|
|
401
397
|
if (typeof newContext !== 'undefined') {
|
|
398
|
+
// $FlowFixMe[reassign-const]
|
|
402
399
|
context = newContext;
|
|
403
400
|
}
|
|
404
401
|
}
|
|
@@ -443,8 +440,6 @@ class Graph {
|
|
|
443
440
|
if (stop === true) {
|
|
444
441
|
return node;
|
|
445
442
|
}
|
|
446
|
-
|
|
447
|
-
// @ts-expect-error TS2345
|
|
448
443
|
for (let child of this.getNodeIdsConnectedFrom(node)) {
|
|
449
444
|
if (!visited.has(child)) {
|
|
450
445
|
visited.add(child);
|
package/lib/shared-buffer.js
CHANGED
|
@@ -4,14 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.SharedBuffer = void 0;
|
|
7
|
-
// flow-to-ts helpers
|
|
8
|
-
|
|
9
|
-
// /flow-to-ts helpers
|
|
10
|
-
|
|
11
7
|
// Copy from @atlaspack/utils to fix: https://github.com/stackblitz/core/issues/1855
|
|
12
8
|
let SharedBuffer = exports.SharedBuffer = void 0;
|
|
13
9
|
|
|
14
|
-
//
|
|
10
|
+
// $FlowFixMe[prop-missing]
|
|
15
11
|
if (process.browser) {
|
|
16
12
|
exports.SharedBuffer = SharedBuffer = ArrayBuffer;
|
|
17
13
|
// Safari has removed the constructor
|
package/lib/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/graph",
|
|
3
|
-
"version": "3.5.10
|
|
3
|
+
"version": "3.5.10",
|
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
|
5
5
|
"license": "(MIT OR Apache-2.0)",
|
|
6
6
|
"publishConfig": {
|
|
@@ -10,24 +10,21 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/atlassian-labs/atlaspack.git"
|
|
12
12
|
},
|
|
13
|
-
"main": "
|
|
14
|
-
"source": "
|
|
15
|
-
"types": "./lib/index.d.ts",
|
|
13
|
+
"main": "lib/index.js",
|
|
14
|
+
"source": "src/index.js",
|
|
16
15
|
"engines": {
|
|
17
16
|
"node": ">= 16.0.0"
|
|
18
17
|
},
|
|
19
18
|
"scripts": {
|
|
20
|
-
"benchmark": "node ./benchmark/BitSet.js"
|
|
21
|
-
"check-ts": "tsc --emitDeclarationOnly --rootDir src"
|
|
19
|
+
"benchmark": "node ./benchmark/BitSet.js"
|
|
22
20
|
},
|
|
23
21
|
"dependencies": {
|
|
24
|
-
"@atlaspack/feature-flags": "2.
|
|
22
|
+
"@atlaspack/feature-flags": "2.20.0",
|
|
25
23
|
"nullthrows": "^1.1.1"
|
|
26
24
|
},
|
|
27
25
|
"devDependencies": {
|
|
28
|
-
"@atlaspack/babel-register": "2.14.
|
|
26
|
+
"@atlaspack/babel-register": "2.14.1",
|
|
29
27
|
"benny": "^3.7.1"
|
|
30
28
|
},
|
|
31
|
-
"type": "commonjs"
|
|
32
|
-
|
|
33
|
-
}
|
|
29
|
+
"type": "commonjs"
|
|
30
|
+
}
|