@parcel/graph 2.8.4-nightly.2926 → 2.8.4-nightly.2937
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/AdjacencyList.js +104 -265
- package/lib/ContentGraph.js +6 -28
- package/lib/Graph.js +18 -105
- package/lib/index.js +0 -6
- package/lib/shared-buffer.js +6 -7
- package/lib/types.js +0 -2
- package/package.json +2 -2
package/lib/ContentGraph.js
CHANGED
@@ -4,21 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _Graph = _interopRequireDefault(require("./Graph"));
|
9
|
-
|
10
8
|
function _nullthrows() {
|
11
9
|
const data = _interopRequireDefault(require("nullthrows"));
|
12
|
-
|
13
10
|
_nullthrows = function () {
|
14
11
|
return data;
|
15
12
|
};
|
16
|
-
|
17
13
|
return data;
|
18
14
|
}
|
19
|
-
|
20
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
|
-
|
22
16
|
class ContentGraph extends _Graph.default {
|
23
17
|
constructor(opts) {
|
24
18
|
if (opts) {
|
@@ -35,68 +29,52 @@ class ContentGraph extends _Graph.default {
|
|
35
29
|
this._contentKeyToNodeId = new Map();
|
36
30
|
this._nodeIdToContentKey = new Map();
|
37
31
|
}
|
38
|
-
}
|
39
|
-
|
32
|
+
}
|
40
33
|
|
34
|
+
// $FlowFixMe[prop-missing]
|
41
35
|
static deserialize(opts) {
|
42
36
|
return new ContentGraph(opts);
|
43
|
-
}
|
44
|
-
|
37
|
+
}
|
45
38
|
|
39
|
+
// $FlowFixMe[prop-missing]
|
46
40
|
serialize() {
|
47
41
|
// $FlowFixMe[prop-missing]
|
48
|
-
return {
|
42
|
+
return {
|
43
|
+
...super.serialize(),
|
49
44
|
_contentKeyToNodeId: this._contentKeyToNodeId,
|
50
45
|
_nodeIdToContentKey: this._nodeIdToContentKey
|
51
46
|
};
|
52
47
|
}
|
53
|
-
|
54
48
|
addNodeByContentKey(contentKey, node) {
|
55
49
|
if (this.hasContentKey(contentKey)) {
|
56
50
|
throw new Error('Graph already has content key ' + contentKey);
|
57
51
|
}
|
58
|
-
|
59
52
|
let nodeId = super.addNode(node);
|
60
|
-
|
61
53
|
this._contentKeyToNodeId.set(contentKey, nodeId);
|
62
|
-
|
63
54
|
this._nodeIdToContentKey.set(nodeId, contentKey);
|
64
|
-
|
65
55
|
return nodeId;
|
66
56
|
}
|
67
|
-
|
68
57
|
addNodeByContentKeyIfNeeded(contentKey, node) {
|
69
58
|
return this.hasContentKey(contentKey) ? this.getNodeIdByContentKey(contentKey) : this.addNodeByContentKey(contentKey, node);
|
70
59
|
}
|
71
|
-
|
72
60
|
getNodeByContentKey(contentKey) {
|
73
61
|
let nodeId = this._contentKeyToNodeId.get(contentKey);
|
74
|
-
|
75
62
|
if (nodeId != null) {
|
76
63
|
return super.getNode(nodeId);
|
77
64
|
}
|
78
65
|
}
|
79
|
-
|
80
66
|
getNodeIdByContentKey(contentKey) {
|
81
67
|
return (0, _nullthrows().default)(this._contentKeyToNodeId.get(contentKey), `Expected content key ${contentKey} to exist`);
|
82
68
|
}
|
83
|
-
|
84
69
|
hasContentKey(contentKey) {
|
85
70
|
return this._contentKeyToNodeId.has(contentKey);
|
86
71
|
}
|
87
|
-
|
88
72
|
removeNode(nodeId) {
|
89
73
|
this._assertHasNodeId(nodeId);
|
90
|
-
|
91
74
|
let contentKey = (0, _nullthrows().default)(this._nodeIdToContentKey.get(nodeId));
|
92
|
-
|
93
75
|
this._contentKeyToNodeId.delete(contentKey);
|
94
|
-
|
95
76
|
this._nodeIdToContentKey.delete(nodeId);
|
96
|
-
|
97
77
|
super.removeNode(nodeId);
|
98
78
|
}
|
99
|
-
|
100
79
|
}
|
101
|
-
|
102
80
|
exports.default = ContentGraph;
|
package/lib/Graph.js
CHANGED
@@ -5,36 +5,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = exports.ALL_EDGE_TYPES = void 0;
|
7
7
|
exports.mapVisitor = mapVisitor;
|
8
|
-
|
9
8
|
var _types = require("./types");
|
10
|
-
|
11
9
|
var _AdjacencyList = _interopRequireDefault(require("./AdjacencyList"));
|
12
|
-
|
13
10
|
function _assert() {
|
14
11
|
const data = _interopRequireDefault(require("assert"));
|
15
|
-
|
16
12
|
_assert = function () {
|
17
13
|
return data;
|
18
14
|
};
|
19
|
-
|
20
15
|
return data;
|
21
16
|
}
|
22
|
-
|
23
17
|
function _nullthrows() {
|
24
18
|
const data = _interopRequireDefault(require("nullthrows"));
|
25
|
-
|
26
19
|
_nullthrows = function () {
|
27
20
|
return data;
|
28
21
|
};
|
29
|
-
|
30
22
|
return data;
|
31
23
|
}
|
32
|
-
|
33
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
34
|
-
|
35
25
|
const ALL_EDGE_TYPES = -1;
|
36
26
|
exports.ALL_EDGE_TYPES = ALL_EDGE_TYPES;
|
37
|
-
|
38
27
|
class Graph {
|
39
28
|
constructor(opts) {
|
40
29
|
this.nodes = (opts === null || opts === void 0 ? void 0 : opts.nodes) || new Map();
|
@@ -42,11 +31,9 @@ class Graph {
|
|
42
31
|
let adjacencyList = opts === null || opts === void 0 ? void 0 : opts.adjacencyList;
|
43
32
|
this.adjacencyList = adjacencyList ? _AdjacencyList.default.deserialize(adjacencyList) : new _AdjacencyList.default();
|
44
33
|
}
|
45
|
-
|
46
34
|
setRootNodeId(id) {
|
47
35
|
this.rootNodeId = id;
|
48
36
|
}
|
49
|
-
|
50
37
|
static deserialize(opts) {
|
51
38
|
return new this({
|
52
39
|
nodes: opts.nodes,
|
@@ -54,179 +41,147 @@ class Graph {
|
|
54
41
|
rootNodeId: opts.rootNodeId
|
55
42
|
});
|
56
43
|
}
|
57
|
-
|
58
44
|
serialize() {
|
59
45
|
return {
|
60
46
|
nodes: this.nodes,
|
61
47
|
adjacencyList: this.adjacencyList.serialize(),
|
62
48
|
rootNodeId: this.rootNodeId
|
63
49
|
};
|
64
|
-
}
|
65
|
-
// the complete list can be costly in large graphs. Used when merging graphs.
|
66
|
-
|
50
|
+
}
|
67
51
|
|
52
|
+
// Returns an iterator of all edges in the graph. This can be large, so iterating
|
53
|
+
// the complete list can be costly in large graphs. Used when merging graphs.
|
68
54
|
getAllEdges() {
|
69
55
|
return this.adjacencyList.getAllEdges();
|
70
56
|
}
|
71
|
-
|
72
57
|
addNode(node) {
|
73
58
|
let id = this.adjacencyList.addNode();
|
74
59
|
this.nodes.set(id, node);
|
75
60
|
return id;
|
76
61
|
}
|
77
|
-
|
78
62
|
hasNode(id) {
|
79
63
|
return this.nodes.has(id);
|
80
64
|
}
|
81
|
-
|
82
65
|
getNode(id) {
|
83
66
|
return this.nodes.get(id);
|
84
67
|
}
|
85
|
-
|
86
68
|
addEdge(from, to, type = 1) {
|
87
69
|
if (Number(type) === 0) {
|
88
70
|
throw new Error(`Edge type "${type}" not allowed`);
|
89
71
|
}
|
90
|
-
|
91
72
|
if (!this.getNode(from)) {
|
92
73
|
throw new Error(`"from" node '${(0, _types.fromNodeId)(from)}' not found`);
|
93
74
|
}
|
94
|
-
|
95
75
|
if (!this.getNode(to)) {
|
96
76
|
throw new Error(`"to" node '${(0, _types.fromNodeId)(to)}' not found`);
|
97
77
|
}
|
98
|
-
|
99
78
|
return this.adjacencyList.addEdge(from, to, type);
|
100
79
|
}
|
101
|
-
|
102
80
|
hasEdge(from, to, type = 1) {
|
103
81
|
return this.adjacencyList.hasEdge(from, to, type);
|
104
82
|
}
|
105
|
-
|
106
83
|
getNodeIdsConnectedTo(nodeId, type = 1) {
|
107
84
|
this._assertHasNodeId(nodeId);
|
108
|
-
|
109
85
|
return this.adjacencyList.getNodeIdsConnectedTo(nodeId, type);
|
110
86
|
}
|
111
|
-
|
112
87
|
getNodeIdsConnectedFrom(nodeId, type = 1) {
|
113
88
|
this._assertHasNodeId(nodeId);
|
114
|
-
|
115
89
|
return this.adjacencyList.getNodeIdsConnectedFrom(nodeId, type);
|
116
|
-
}
|
117
|
-
|
90
|
+
}
|
118
91
|
|
92
|
+
// Removes node and any edges coming from or to that node
|
119
93
|
removeNode(nodeId) {
|
120
94
|
if (!this.hasNode(nodeId)) {
|
121
95
|
return;
|
122
96
|
}
|
123
|
-
|
124
97
|
for (let {
|
125
98
|
type,
|
126
99
|
from
|
127
100
|
} of this.adjacencyList.getInboundEdgesByType(nodeId)) {
|
128
|
-
this._removeEdge(from, nodeId, type,
|
101
|
+
this._removeEdge(from, nodeId, type,
|
102
|
+
// Do not allow orphans to be removed as this node could be one
|
129
103
|
// and is already being removed.
|
130
104
|
false);
|
131
105
|
}
|
132
|
-
|
133
106
|
for (let {
|
134
107
|
type,
|
135
108
|
to
|
136
109
|
} of this.adjacencyList.getOutboundEdgesByType(nodeId)) {
|
137
110
|
this._removeEdge(nodeId, to, type);
|
138
111
|
}
|
139
|
-
|
140
112
|
let wasRemoved = this.nodes.delete(nodeId);
|
141
113
|
(0, _assert().default)(wasRemoved);
|
142
114
|
}
|
143
|
-
|
144
115
|
removeEdges(nodeId, type = 1) {
|
145
116
|
if (!this.hasNode(nodeId)) {
|
146
117
|
return;
|
147
118
|
}
|
148
|
-
|
149
119
|
for (let to of this.getNodeIdsConnectedFrom(nodeId, type)) {
|
150
120
|
this._removeEdge(nodeId, to, type);
|
151
121
|
}
|
152
122
|
}
|
153
|
-
|
154
123
|
removeEdge(from, to, type = 1, removeOrphans = true) {
|
155
124
|
if (!this.adjacencyList.hasEdge(from, to, type)) {
|
156
125
|
throw new Error(`Edge from ${(0, _types.fromNodeId)(from)} to ${(0, _types.fromNodeId)(to)} not found!`);
|
157
126
|
}
|
158
|
-
|
159
127
|
this._removeEdge(from, to, type, removeOrphans);
|
160
|
-
}
|
161
|
-
|
128
|
+
}
|
162
129
|
|
130
|
+
// Removes edge and node the edge is to if the node is orphaned
|
163
131
|
_removeEdge(from, to, type = 1, removeOrphans = true) {
|
164
132
|
if (!this.adjacencyList.hasEdge(from, to, type)) {
|
165
133
|
return;
|
166
134
|
}
|
167
|
-
|
168
135
|
this.adjacencyList.removeEdge(from, to, type);
|
169
|
-
|
170
136
|
if (removeOrphans && this.isOrphanedNode(to)) {
|
171
137
|
this.removeNode(to);
|
172
138
|
}
|
173
139
|
}
|
174
|
-
|
175
140
|
isOrphanedNode(nodeId) {
|
176
141
|
if (!this.hasNode(nodeId)) {
|
177
142
|
return false;
|
178
143
|
}
|
179
|
-
|
180
144
|
if (this.rootNodeId == null) {
|
181
145
|
// If the graph does not have a root, and there are inbound edges,
|
182
146
|
// this node should not be considered orphaned.
|
183
147
|
return !this.adjacencyList.hasInboundEdges(nodeId);
|
184
|
-
}
|
185
|
-
// then this is not an orphaned node.
|
186
|
-
|
187
|
-
|
188
|
-
let hasPathToRoot = false; // go back to traverseAncestors
|
148
|
+
}
|
189
149
|
|
150
|
+
// Otherwise, attempt to traverse backwards to the root. If there is a path,
|
151
|
+
// then this is not an orphaned node.
|
152
|
+
let hasPathToRoot = false;
|
153
|
+
// go back to traverseAncestors
|
190
154
|
this.traverseAncestors(nodeId, (ancestorId, _, actions) => {
|
191
155
|
if (ancestorId === this.rootNodeId) {
|
192
156
|
hasPathToRoot = true;
|
193
157
|
actions.stop();
|
194
158
|
}
|
195
159
|
}, ALL_EDGE_TYPES);
|
196
|
-
|
197
160
|
if (hasPathToRoot) {
|
198
161
|
return false;
|
199
162
|
}
|
200
|
-
|
201
163
|
return true;
|
202
164
|
}
|
203
|
-
|
204
165
|
updateNode(nodeId, node) {
|
205
166
|
this._assertHasNodeId(nodeId);
|
206
|
-
|
207
167
|
this.nodes.set(nodeId, node);
|
208
|
-
}
|
209
|
-
|
168
|
+
}
|
210
169
|
|
170
|
+
// Update a node's downstream nodes making sure to prune any orphaned branches
|
211
171
|
replaceNodeIdsConnectedTo(fromNodeId, toNodeIds, replaceFilter, type = 1) {
|
212
172
|
this._assertHasNodeId(fromNodeId);
|
213
|
-
|
214
173
|
let outboundEdges = this.getNodeIdsConnectedFrom(fromNodeId, type);
|
215
174
|
let childrenToRemove = new Set(replaceFilter ? outboundEdges.filter(toNodeId => replaceFilter(toNodeId)) : outboundEdges);
|
216
|
-
|
217
175
|
for (let toNodeId of toNodeIds) {
|
218
176
|
childrenToRemove.delete(toNodeId);
|
219
|
-
|
220
177
|
if (!this.hasEdge(fromNodeId, toNodeId, type)) {
|
221
178
|
this.addEdge(fromNodeId, toNodeId, type);
|
222
179
|
}
|
223
180
|
}
|
224
|
-
|
225
181
|
for (let child of childrenToRemove) {
|
226
182
|
this._removeEdge(fromNodeId, child, type);
|
227
183
|
}
|
228
184
|
}
|
229
|
-
|
230
185
|
traverse(visit, startNodeId, type = 1) {
|
231
186
|
return this.dfs({
|
232
187
|
visit,
|
@@ -234,11 +189,9 @@ class Graph {
|
|
234
189
|
getChildren: nodeId => this.getNodeIdsConnectedFrom(nodeId, type)
|
235
190
|
});
|
236
191
|
}
|
237
|
-
|
238
192
|
filteredTraverse(filter, visit, startNodeId, type) {
|
239
193
|
return this.traverse(mapVisitor(filter, visit), startNodeId, type);
|
240
194
|
}
|
241
|
-
|
242
195
|
traverseAncestors(startNodeId, visit, type = 1) {
|
243
196
|
return this.dfs({
|
244
197
|
visit,
|
@@ -246,16 +199,13 @@ class Graph {
|
|
246
199
|
getChildren: nodeId => this.getNodeIdsConnectedTo(nodeId, type)
|
247
200
|
});
|
248
201
|
}
|
249
|
-
|
250
202
|
dfs({
|
251
203
|
visit,
|
252
204
|
startNodeId,
|
253
205
|
getChildren
|
254
206
|
}) {
|
255
207
|
let traversalStartNode = (0, _nullthrows().default)(startNodeId !== null && startNodeId !== void 0 ? startNodeId : this.rootNodeId, 'A start node is required to traverse');
|
256
|
-
|
257
208
|
this._assertHasNodeId(traversalStartNode);
|
258
|
-
|
259
209
|
let visited = new Set();
|
260
210
|
let stopped = false;
|
261
211
|
let skipped = false;
|
@@ -263,84 +213,66 @@ class Graph {
|
|
263
213
|
skipChildren() {
|
264
214
|
skipped = true;
|
265
215
|
},
|
266
|
-
|
267
216
|
stop() {
|
268
217
|
stopped = true;
|
269
218
|
}
|
270
|
-
|
271
219
|
};
|
272
|
-
|
273
220
|
let walk = (nodeId, context) => {
|
274
221
|
if (!this.hasNode(nodeId)) return;
|
275
222
|
visited.add(nodeId);
|
276
223
|
skipped = false;
|
277
224
|
let enter = typeof visit === 'function' ? visit : visit.enter;
|
278
|
-
|
279
225
|
if (enter) {
|
280
226
|
let newContext = enter(nodeId, context, actions);
|
281
|
-
|
282
227
|
if (typeof newContext !== 'undefined') {
|
283
228
|
// $FlowFixMe[reassign-const]
|
284
229
|
context = newContext;
|
285
230
|
}
|
286
231
|
}
|
287
|
-
|
288
232
|
if (skipped) {
|
289
233
|
return;
|
290
234
|
}
|
291
|
-
|
292
235
|
if (stopped) {
|
293
236
|
return context;
|
294
237
|
}
|
295
|
-
|
296
238
|
for (let child of getChildren(nodeId)) {
|
297
239
|
if (visited.has(child)) {
|
298
240
|
continue;
|
299
241
|
}
|
300
|
-
|
301
242
|
visited.add(child);
|
302
243
|
let result = walk(child, context);
|
303
|
-
|
304
244
|
if (stopped) {
|
305
245
|
return result;
|
306
246
|
}
|
307
247
|
}
|
308
|
-
|
309
|
-
|
248
|
+
if (typeof visit !== 'function' && visit.exit &&
|
249
|
+
// Make sure the graph still has the node: it may have been removed between enter and exit
|
310
250
|
this.hasNode(nodeId)) {
|
311
251
|
let newContext = visit.exit(nodeId, context, actions);
|
312
|
-
|
313
252
|
if (typeof newContext !== 'undefined') {
|
314
253
|
// $FlowFixMe[reassign-const]
|
315
254
|
context = newContext;
|
316
255
|
}
|
317
256
|
}
|
318
|
-
|
319
257
|
if (skipped) {
|
320
258
|
return;
|
321
259
|
}
|
322
|
-
|
323
260
|
if (stopped) {
|
324
261
|
return context;
|
325
262
|
}
|
326
263
|
};
|
327
|
-
|
328
264
|
return walk(traversalStartNode);
|
329
265
|
}
|
330
|
-
|
331
266
|
bfs(visit) {
|
332
267
|
let rootNodeId = (0, _nullthrows().default)(this.rootNodeId, 'A root node is required to traverse');
|
333
268
|
let queue = [rootNodeId];
|
334
269
|
let visited = new Set([rootNodeId]);
|
335
|
-
|
336
270
|
while (queue.length > 0) {
|
337
271
|
let node = queue.shift();
|
338
272
|
let stop = visit(rootNodeId);
|
339
|
-
|
340
273
|
if (stop === true) {
|
341
274
|
return node;
|
342
275
|
}
|
343
|
-
|
344
276
|
for (let child of this.getNodeIdsConnectedFrom(node)) {
|
345
277
|
if (!visited.has(child)) {
|
346
278
|
visited.add(child);
|
@@ -348,10 +280,8 @@ class Graph {
|
|
348
280
|
}
|
349
281
|
}
|
350
282
|
}
|
351
|
-
|
352
283
|
return null;
|
353
284
|
}
|
354
|
-
|
355
285
|
topoSort(type) {
|
356
286
|
let sorted = [];
|
357
287
|
this.traverse({
|
@@ -361,7 +291,6 @@ class Graph {
|
|
361
291
|
}, null, type);
|
362
292
|
return sorted.reverse();
|
363
293
|
}
|
364
|
-
|
365
294
|
findAncestor(nodeId, fn) {
|
366
295
|
let res = null;
|
367
296
|
this.traverseAncestors(nodeId, (nodeId, ctx, traversal) => {
|
@@ -372,7 +301,6 @@ class Graph {
|
|
372
301
|
});
|
373
302
|
return res;
|
374
303
|
}
|
375
|
-
|
376
304
|
findAncestors(nodeId, fn) {
|
377
305
|
let res = [];
|
378
306
|
this.traverseAncestors(nodeId, (nodeId, ctx, traversal) => {
|
@@ -383,7 +311,6 @@ class Graph {
|
|
383
311
|
});
|
384
312
|
return res;
|
385
313
|
}
|
386
|
-
|
387
314
|
findDescendant(nodeId, fn) {
|
388
315
|
let res = null;
|
389
316
|
this.traverse((nodeId, ctx, traversal) => {
|
@@ -394,7 +321,6 @@ class Graph {
|
|
394
321
|
}, nodeId);
|
395
322
|
return res;
|
396
323
|
}
|
397
|
-
|
398
324
|
findDescendants(nodeId, fn) {
|
399
325
|
let res = [];
|
400
326
|
this.traverse((nodeId, ctx, traversal) => {
|
@@ -405,53 +331,40 @@ class Graph {
|
|
405
331
|
}, nodeId);
|
406
332
|
return res;
|
407
333
|
}
|
408
|
-
|
409
334
|
_assertHasNodeId(nodeId) {
|
410
335
|
if (!this.hasNode(nodeId)) {
|
411
336
|
throw new Error('Does not have node ' + (0, _types.fromNodeId)(nodeId));
|
412
337
|
}
|
413
338
|
}
|
414
|
-
|
415
339
|
}
|
416
|
-
|
417
340
|
exports.default = Graph;
|
418
|
-
|
419
341
|
function mapVisitor(filter, visit) {
|
420
342
|
function makeEnter(visit) {
|
421
343
|
return function (nodeId, context, actions) {
|
422
344
|
let value = filter(nodeId, actions);
|
423
|
-
|
424
345
|
if (value != null) {
|
425
346
|
return visit(value, context, actions);
|
426
347
|
}
|
427
348
|
};
|
428
349
|
}
|
429
|
-
|
430
350
|
if (typeof visit === 'function') {
|
431
351
|
return makeEnter(visit);
|
432
352
|
}
|
433
|
-
|
434
353
|
let mapped = {};
|
435
|
-
|
436
354
|
if (visit.enter != null) {
|
437
355
|
mapped.enter = makeEnter(visit.enter);
|
438
356
|
}
|
439
|
-
|
440
357
|
if (visit.exit != null) {
|
441
358
|
mapped.exit = function (nodeId, context, actions) {
|
442
359
|
let exit = visit.exit;
|
443
|
-
|
444
360
|
if (!exit) {
|
445
361
|
return;
|
446
362
|
}
|
447
|
-
|
448
363
|
let value = filter(nodeId, actions);
|
449
|
-
|
450
364
|
if (value != null) {
|
451
365
|
return exit(value, context, actions);
|
452
366
|
}
|
453
367
|
};
|
454
368
|
}
|
455
|
-
|
456
369
|
return mapped;
|
457
370
|
}
|
package/lib/index.js
CHANGED
@@ -39,15 +39,9 @@ Object.defineProperty(exports, "toNodeId", {
|
|
39
39
|
return _types.toNodeId;
|
40
40
|
}
|
41
41
|
});
|
42
|
-
|
43
42
|
var _types = require("./types");
|
44
|
-
|
45
43
|
var _Graph = _interopRequireWildcard(require("./Graph"));
|
46
|
-
|
47
44
|
var _ContentGraph = _interopRequireDefault(require("./ContentGraph"));
|
48
|
-
|
49
45
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
50
|
-
|
51
46
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
52
|
-
|
53
47
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
package/lib/shared-buffer.js
CHANGED
@@ -5,23 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.SharedBuffer = void 0;
|
7
7
|
// Copy from @parcel/utils to fix: https://github.com/stackblitz/core/issues/1855
|
8
|
-
let SharedBuffer;
|
8
|
+
let SharedBuffer;
|
9
9
|
|
10
|
+
// $FlowFixMe[prop-missing]
|
10
11
|
exports.SharedBuffer = SharedBuffer;
|
11
|
-
|
12
12
|
if (process.browser) {
|
13
|
-
exports.SharedBuffer = SharedBuffer = ArrayBuffer;
|
14
|
-
|
13
|
+
exports.SharedBuffer = SharedBuffer = ArrayBuffer;
|
14
|
+
// Safari has removed the constructor
|
15
15
|
if (typeof SharedArrayBuffer !== 'undefined') {
|
16
16
|
let channel = new MessageChannel();
|
17
|
-
|
18
17
|
try {
|
19
18
|
// Firefox might throw when sending the Buffer over a MessagePort
|
20
19
|
channel.port1.postMessage(new SharedArrayBuffer(0));
|
21
20
|
exports.SharedBuffer = SharedBuffer = SharedArrayBuffer;
|
22
|
-
} catch (_) {
|
21
|
+
} catch (_) {
|
22
|
+
// NOOP
|
23
23
|
}
|
24
|
-
|
25
24
|
channel.port1.close();
|
26
25
|
channel.port2.close();
|
27
26
|
}
|
package/lib/types.js
CHANGED
@@ -5,12 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.fromNodeId = fromNodeId;
|
7
7
|
exports.toNodeId = toNodeId;
|
8
|
-
|
9
8
|
// forcing NodeId to be opaque as it should only be created once
|
10
9
|
function toNodeId(x) {
|
11
10
|
return x;
|
12
11
|
}
|
13
|
-
|
14
12
|
function fromNodeId(x) {
|
15
13
|
return x;
|
16
14
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@parcel/graph",
|
3
|
-
"version": "2.8.4-nightly.
|
3
|
+
"version": "2.8.4-nightly.2937+3ad435157",
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
5
5
|
"license": "MIT",
|
6
6
|
"publishConfig": {
|
@@ -22,5 +22,5 @@
|
|
22
22
|
"dependencies": {
|
23
23
|
"nullthrows": "^1.1.1"
|
24
24
|
},
|
25
|
-
"gitHead": "
|
25
|
+
"gitHead": "3ad435157d443da806c215d68ccf292b4e95ae0c"
|
26
26
|
}
|