@atlaspack/core 2.12.1-canary.3453 → 2.12.1-canary.3455
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/SymbolPropagation.js +25 -36
- package/lib/atlaspack-v3/worker/compat/asset-symbols.js +121 -21
- package/lib/atlaspack-v3/worker/compat/bitflags.js +12 -0
- package/lib/atlaspack-v3/worker/compat/index.js +55 -22
- package/lib/atlaspack-v3/worker/compat/mutable-asset.js +144 -0
- package/lib/atlaspack-v3/worker/compat/plugin-config.js +58 -0
- package/lib/atlaspack-v3/worker/compat/plugin-logger.js +29 -0
- package/lib/atlaspack-v3/worker/compat/plugin-options.js +113 -0
- package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +12 -0
- package/lib/atlaspack-v3/worker/worker.js +114 -122
- package/package.json +16 -16
- package/src/SymbolPropagation.js +32 -48
- package/src/atlaspack-v3/worker/compat/asset-symbols.js +125 -32
- package/src/atlaspack-v3/worker/compat/bitflags.js +14 -0
- package/src/atlaspack-v3/worker/compat/index.js +5 -2
- package/src/atlaspack-v3/worker/compat/mutable-asset.js +184 -0
- package/src/atlaspack-v3/worker/compat/plugin-config.js +94 -0
- package/src/atlaspack-v3/worker/compat/plugin-logger.js +47 -0
- package/src/atlaspack-v3/worker/compat/plugin-options.js +137 -0
- package/src/atlaspack-v3/worker/compat/plugin-tracer.js +11 -0
- package/src/atlaspack-v3/worker/worker.js +138 -126
- package/lib/atlaspack-v3/worker/compat/asset-compat.js +0 -57
- package/src/atlaspack-v3/worker/compat/asset-compat.js +0 -82
package/lib/SymbolPropagation.js
CHANGED
|
@@ -438,15 +438,7 @@ function propagateSymbolsDown(assetGraph, changedAssets, assetGroupsWithRemovedP
|
|
|
438
438
|
wasNodeDirty = node.usedSymbolsDownDirty;
|
|
439
439
|
node.usedSymbolsDownDirty = false;
|
|
440
440
|
} else if (node.type === 'asset' && node.usedSymbolsDownDirty) {
|
|
441
|
-
visit(node, assetGraph
|
|
442
|
-
let dep = assetGraph.getNodeByContentKey(d.id);
|
|
443
|
-
(0, _assert().default)(dep && dep.type === 'dependency');
|
|
444
|
-
return dep;
|
|
445
|
-
}), outgoing.map(dep => {
|
|
446
|
-
let depNode = (0, _nullthrows().default)(assetGraph.getNode(dep));
|
|
447
|
-
(0, _assert().default)(depNode.type === 'dependency');
|
|
448
|
-
return depNode;
|
|
449
|
-
}));
|
|
441
|
+
visit(node, incomingDependencyNodesFromAsset(assetGraph, node.value), dependencyNodesFromIds(assetGraph, outgoing));
|
|
450
442
|
node.usedSymbolsDownDirty = false;
|
|
451
443
|
}
|
|
452
444
|
for (let child of outgoing) {
|
|
@@ -494,23 +486,15 @@ function propagateSymbolsUp(assetGraph, changedAssets, changedDepsUsedSymbolsUpD
|
|
|
494
486
|
let rootNodeId = (0, _nullthrows().default)(assetGraph.rootNodeId, 'A root node is required to traverse');
|
|
495
487
|
const nodeVisitor = nodeId => {
|
|
496
488
|
let node = (0, _nullthrows().default)(assetGraph.getNode(nodeId));
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
let child
|
|
500
|
-
if (node.type === 'asset') {
|
|
501
|
-
(0, _assert().default)(child.type === 'dependency');
|
|
489
|
+
if (node.type === 'asset') {
|
|
490
|
+
let outgoing = outgoingDependencyNodesFromAsset(assetGraph, nodeId);
|
|
491
|
+
for (let child of outgoing) {
|
|
502
492
|
if (child.usedSymbolsUpDirtyUp) {
|
|
503
493
|
node.usedSymbolsUpDirty = true;
|
|
504
494
|
child.usedSymbolsUpDirtyUp = false;
|
|
505
495
|
}
|
|
506
496
|
}
|
|
507
|
-
|
|
508
|
-
if (node.type === 'asset') {
|
|
509
|
-
let incoming = assetGraph.getIncomingDependencies(node.value).map(d => {
|
|
510
|
-
let n = assetGraph.getNodeByContentKey(d.id);
|
|
511
|
-
(0, _assert().default)(n && n.type === 'dependency');
|
|
512
|
-
return n;
|
|
513
|
-
});
|
|
497
|
+
let incoming = incomingDependencyNodesFromAsset(assetGraph, node.value);
|
|
514
498
|
for (let dep of incoming) {
|
|
515
499
|
if (dep.usedSymbolsUpDirtyDown) {
|
|
516
500
|
dep.usedSymbolsUpDirtyDown = false;
|
|
@@ -518,11 +502,7 @@ function propagateSymbolsUp(assetGraph, changedAssets, changedDepsUsedSymbolsUpD
|
|
|
518
502
|
}
|
|
519
503
|
}
|
|
520
504
|
if (node.usedSymbolsUpDirty) {
|
|
521
|
-
let e = visit(node, incoming, outgoing
|
|
522
|
-
let depNode = (0, _nullthrows().default)(assetGraph.getNode(depNodeId));
|
|
523
|
-
(0, _assert().default)(depNode.type === 'dependency');
|
|
524
|
-
return depNode;
|
|
525
|
-
}));
|
|
505
|
+
let e = visit(node, incoming, outgoing);
|
|
526
506
|
if (e.length > 0) {
|
|
527
507
|
node.usedSymbolsUpDirty = true;
|
|
528
508
|
errors.set(nodeId, e);
|
|
@@ -548,22 +528,14 @@ function propagateSymbolsUp(assetGraph, changedAssets, changedDepsUsedSymbolsUpD
|
|
|
548
528
|
let queuedNodeId = setPop(queue);
|
|
549
529
|
let node = (0, _nullthrows().default)(assetGraph.getNode(queuedNodeId));
|
|
550
530
|
if (node.type === 'asset') {
|
|
551
|
-
let incoming = assetGraph
|
|
552
|
-
let depNode = assetGraph.getNodeByContentKey(dep.id);
|
|
553
|
-
(0, _assert().default)(depNode && depNode.type === 'dependency');
|
|
554
|
-
return depNode;
|
|
555
|
-
});
|
|
531
|
+
let incoming = incomingDependencyNodesFromAsset(assetGraph, node.value);
|
|
556
532
|
for (let dep of incoming) {
|
|
557
533
|
if (dep.usedSymbolsUpDirtyDown) {
|
|
558
534
|
dep.usedSymbolsUpDirtyDown = false;
|
|
559
535
|
node.usedSymbolsUpDirty = true;
|
|
560
536
|
}
|
|
561
537
|
}
|
|
562
|
-
let outgoing = assetGraph
|
|
563
|
-
let depNode = (0, _nullthrows().default)(assetGraph.getNode(depNodeId));
|
|
564
|
-
(0, _assert().default)(depNode.type === 'dependency');
|
|
565
|
-
return depNode;
|
|
566
|
-
});
|
|
538
|
+
let outgoing = outgoingDependencyNodesFromAsset(assetGraph, queuedNodeId);
|
|
567
539
|
for (let dep of outgoing) {
|
|
568
540
|
if (dep.usedSymbolsUpDirtyUp) {
|
|
569
541
|
node.usedSymbolsUpDirty = true;
|
|
@@ -622,4 +594,21 @@ function setPop(set) {
|
|
|
622
594
|
let v = (0, _nullthrows().default)(set.values().next().value);
|
|
623
595
|
set.delete(v);
|
|
624
596
|
return v;
|
|
597
|
+
}
|
|
598
|
+
function outgoingDependencyNodesFromAsset(assetGraph, assetNode) {
|
|
599
|
+
return dependencyNodesFromIds(assetGraph, assetGraph.getNodeIdsConnectedFrom(assetNode));
|
|
600
|
+
}
|
|
601
|
+
function dependencyNodesFromIds(assetGraph, dependencyIds) {
|
|
602
|
+
return dependencyIds.map(depNodeId => {
|
|
603
|
+
let depNode = (0, _nullthrows().default)(assetGraph.getNode(depNodeId));
|
|
604
|
+
(0, _assert().default)(depNode.type === 'dependency');
|
|
605
|
+
return depNode;
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
function incomingDependencyNodesFromAsset(assetGraph, assetNodeValue) {
|
|
609
|
+
return assetGraph.getIncomingDependencies(assetNodeValue).map(d => {
|
|
610
|
+
let n = assetGraph.getNodeByContentKey(d.id);
|
|
611
|
+
(0, _assert().default)(n && n.type === 'dependency');
|
|
612
|
+
return n;
|
|
613
|
+
});
|
|
625
614
|
}
|
|
@@ -18,7 +18,7 @@ class MutableDependencySymbols {
|
|
|
18
18
|
local,
|
|
19
19
|
loc,
|
|
20
20
|
isWeak
|
|
21
|
-
} of inner) {
|
|
21
|
+
} of inner || []) {
|
|
22
22
|
this.set(exported, local, loc, isWeak);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -59,34 +59,134 @@ class MutableDependencySymbols {
|
|
|
59
59
|
return this.#symbols.values();
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
// TODO
|
|
64
62
|
exports.MutableDependencySymbols = MutableDependencySymbols;
|
|
65
|
-
class AssetSymbols
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
hasExportSymbol() {
|
|
71
|
-
throw new Error('AssetSymbols.hasExportSymbol');
|
|
63
|
+
class AssetSymbols {
|
|
64
|
+
#symbols;
|
|
65
|
+
#locals;
|
|
66
|
+
get isCleared() {
|
|
67
|
+
return this.#symbols.size === 0;
|
|
72
68
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
constructor(inner) {
|
|
70
|
+
this.#symbols = new Map();
|
|
71
|
+
this.#locals = new Set();
|
|
72
|
+
for (const {
|
|
73
|
+
exported,
|
|
74
|
+
local,
|
|
75
|
+
loc
|
|
76
|
+
} of inner || []) {
|
|
77
|
+
this.#set(exported, local, loc);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
#set(exportSymbol, local, loc) {
|
|
81
|
+
this.#locals.add(local);
|
|
82
|
+
this.#symbols.set(exportSymbol, {
|
|
83
|
+
local,
|
|
84
|
+
loc,
|
|
85
|
+
meta: {}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
get(exportSymbol) {
|
|
89
|
+
return this.#symbols.get(exportSymbol);
|
|
90
|
+
}
|
|
91
|
+
hasExportSymbol(exportSymbol) {
|
|
92
|
+
return this.#symbols.has(exportSymbol);
|
|
93
|
+
}
|
|
94
|
+
hasLocalSymbol(local) {
|
|
95
|
+
return this.#locals.has(local);
|
|
77
96
|
}
|
|
78
97
|
exportSymbols() {
|
|
98
|
+
return this.#symbols.keys();
|
|
99
|
+
}
|
|
100
|
+
intoNapi() {
|
|
79
101
|
return [];
|
|
80
102
|
}
|
|
81
|
-
}
|
|
82
103
|
|
|
83
|
-
|
|
104
|
+
/*:: @@iterator(): Iterator<[Symbol, AssetSymbol]> { return ({}: any); } */
|
|
105
|
+
// $FlowFixMe Flow can't do computed properties
|
|
106
|
+
[Symbol.iterator]() {
|
|
107
|
+
return this.#symbols.values();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
84
110
|
exports.AssetSymbols = AssetSymbols;
|
|
85
|
-
class MutableAssetSymbols
|
|
86
|
-
|
|
87
|
-
|
|
111
|
+
class MutableAssetSymbols {
|
|
112
|
+
#symbols;
|
|
113
|
+
#locals;
|
|
114
|
+
get isCleared() {
|
|
115
|
+
return this.#symbols.size === 0;
|
|
116
|
+
}
|
|
117
|
+
constructor(inner) {
|
|
118
|
+
this.#symbols = new Map();
|
|
119
|
+
this.#locals = new Set();
|
|
120
|
+
for (const {
|
|
121
|
+
exported,
|
|
122
|
+
local,
|
|
123
|
+
loc
|
|
124
|
+
} of inner || []) {
|
|
125
|
+
this.set(exported, local, loc);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
intoNapi() {
|
|
129
|
+
const results = [];
|
|
130
|
+
for (const [exportSymbol, {
|
|
131
|
+
local,
|
|
132
|
+
loc
|
|
133
|
+
}] of this.#symbols.entries()) {
|
|
134
|
+
results.push({
|
|
135
|
+
exported: exportSymbol,
|
|
136
|
+
local,
|
|
137
|
+
loc: loc ? {
|
|
138
|
+
filePath: loc.filePath,
|
|
139
|
+
start: {
|
|
140
|
+
line: loc.start.line,
|
|
141
|
+
column: loc.start.column
|
|
142
|
+
},
|
|
143
|
+
end: {
|
|
144
|
+
line: loc.end.line,
|
|
145
|
+
column: loc.end.column
|
|
146
|
+
}
|
|
147
|
+
} : undefined,
|
|
148
|
+
// TODO
|
|
149
|
+
isWeak: false,
|
|
150
|
+
isEsmExport: false,
|
|
151
|
+
selfReferenced: false
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
return results;
|
|
155
|
+
}
|
|
156
|
+
ensure() {
|
|
157
|
+
throw new Error('MutableAssetSymbols.ensure()');
|
|
158
|
+
}
|
|
159
|
+
set(exportSymbol, local, loc) {
|
|
160
|
+
this.#locals.add(local);
|
|
161
|
+
this.#symbols.set(exportSymbol, {
|
|
162
|
+
local,
|
|
163
|
+
loc,
|
|
164
|
+
meta: {}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
get(exportSymbol) {
|
|
168
|
+
return this.#symbols.get(exportSymbol);
|
|
169
|
+
}
|
|
170
|
+
hasExportSymbol(exportSymbol) {
|
|
171
|
+
return this.#symbols.has(exportSymbol);
|
|
172
|
+
}
|
|
173
|
+
hasLocalSymbol(local) {
|
|
174
|
+
return this.#locals.has(local);
|
|
175
|
+
}
|
|
176
|
+
exportSymbols() {
|
|
177
|
+
return this.#symbols.keys();
|
|
178
|
+
}
|
|
179
|
+
delete(exportSymbol) {
|
|
180
|
+
let existing = this.#symbols.get(exportSymbol);
|
|
181
|
+
if (!existing) return;
|
|
182
|
+
this.#locals.delete(existing.local);
|
|
183
|
+
this.#symbols.delete(exportSymbol);
|
|
184
|
+
}
|
|
88
185
|
|
|
89
|
-
|
|
90
|
-
|
|
186
|
+
/*:: @@iterator(): Iterator<[Symbol, AssetSymbol]> { return ({}: any); } */
|
|
187
|
+
// $FlowFixMe Flow can't do computed properties
|
|
188
|
+
[Symbol.iterator]() {
|
|
189
|
+
return this.#symbols.values();
|
|
190
|
+
}
|
|
91
191
|
}
|
|
92
192
|
exports.MutableAssetSymbols = MutableAssetSymbols;
|
|
@@ -22,6 +22,12 @@ class BitFlags {
|
|
|
22
22
|
}
|
|
23
23
|
return found;
|
|
24
24
|
}
|
|
25
|
+
intoNullable(key) {
|
|
26
|
+
if (key === undefined || key === null) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
return this.into(key);
|
|
30
|
+
}
|
|
25
31
|
intoArray(keys) {
|
|
26
32
|
return keys.map(key => this.into(key));
|
|
27
33
|
}
|
|
@@ -33,6 +39,12 @@ class BitFlags {
|
|
|
33
39
|
}
|
|
34
40
|
return found;
|
|
35
41
|
}
|
|
42
|
+
fromNullable(key) {
|
|
43
|
+
if (key === undefined || key === null) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
return this.from(key);
|
|
47
|
+
}
|
|
36
48
|
fromArray(keys) {
|
|
37
49
|
return keys.map(key => this.from(key));
|
|
38
50
|
}
|
|
@@ -3,28 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _assetCompat = require("./asset-compat");
|
|
7
|
-
Object.keys(_assetCompat).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _assetCompat[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _assetCompat[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _assetSymbols = require("./asset-symbols");
|
|
18
|
-
Object.keys(_assetSymbols).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _assetSymbols[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _assetSymbols[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
6
|
var _bitflags = require("./bitflags");
|
|
29
7
|
Object.keys(_bitflags).forEach(function (key) {
|
|
30
8
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -68,4 +46,59 @@ Object.keys(_target).forEach(function (key) {
|
|
|
68
46
|
return _target[key];
|
|
69
47
|
}
|
|
70
48
|
});
|
|
49
|
+
});
|
|
50
|
+
var _pluginConfig = require("./plugin-config");
|
|
51
|
+
Object.keys(_pluginConfig).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _pluginConfig[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _pluginConfig[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _pluginTracer = require("./plugin-tracer");
|
|
62
|
+
Object.keys(_pluginTracer).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _pluginTracer[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _pluginTracer[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var _pluginLogger = require("./plugin-logger");
|
|
73
|
+
Object.keys(_pluginLogger).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _pluginLogger[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _pluginLogger[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
var _pluginOptions = require("./plugin-options");
|
|
84
|
+
Object.keys(_pluginOptions).forEach(function (key) {
|
|
85
|
+
if (key === "default" || key === "__esModule") return;
|
|
86
|
+
if (key in exports && exports[key] === _pluginOptions[key]) return;
|
|
87
|
+
Object.defineProperty(exports, key, {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () {
|
|
90
|
+
return _pluginOptions[key];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
var _mutableAsset = require("./mutable-asset");
|
|
95
|
+
Object.keys(_mutableAsset).forEach(function (key) {
|
|
96
|
+
if (key === "default" || key === "__esModule") return;
|
|
97
|
+
if (key in exports && exports[key] === _mutableAsset[key]) return;
|
|
98
|
+
Object.defineProperty(exports, key, {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function () {
|
|
101
|
+
return _mutableAsset[key];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
71
104
|
});
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MutableAsset = void 0;
|
|
7
|
+
function _stream() {
|
|
8
|
+
const data = require("stream");
|
|
9
|
+
_stream = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
var _bitflags = require("./bitflags");
|
|
15
|
+
var _assetSymbols = require("./asset-symbols");
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
class MutableAsset {
|
|
19
|
+
#inner;
|
|
20
|
+
#ast;
|
|
21
|
+
#contents;
|
|
22
|
+
get astGenerator() {
|
|
23
|
+
throw new Error('get MutableAsset.astGenerator');
|
|
24
|
+
}
|
|
25
|
+
set astGenerator(value) {
|
|
26
|
+
throw new Error('set MutableAsset.astGenerator');
|
|
27
|
+
}
|
|
28
|
+
constructor(asset, fs, env) {
|
|
29
|
+
this.#inner = asset;
|
|
30
|
+
this.stats = asset.stats;
|
|
31
|
+
this.id = asset.id;
|
|
32
|
+
this.filePath = asset.filePath;
|
|
33
|
+
this.type;
|
|
34
|
+
this.symbols = new _assetSymbols.MutableAssetSymbols(asset.symbols);
|
|
35
|
+
this.stats = asset.stats;
|
|
36
|
+
this.id = asset.id;
|
|
37
|
+
this.filePath = asset.filePath;
|
|
38
|
+
this.type = asset.type;
|
|
39
|
+
this.query = new URLSearchParams(asset.query);
|
|
40
|
+
this.isSource = asset.isSource;
|
|
41
|
+
this.meta = asset.meta;
|
|
42
|
+
this.bundleBehavior = _bitflags.bundleBehaviorMap.fromNullable(asset.bundleBehavior);
|
|
43
|
+
this.isBundleSplittable = asset.isBundleSplittable;
|
|
44
|
+
this.sideEffects = asset.sideEffects;
|
|
45
|
+
this.uniqueKey = asset.uniqueKey;
|
|
46
|
+
this.pipeline = asset.pipeline;
|
|
47
|
+
this.#contents = Buffer.from(asset.code);
|
|
48
|
+
this.fs = fs;
|
|
49
|
+
this.env = env;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// eslint-disable-next-line require-await
|
|
53
|
+
async getAST() {
|
|
54
|
+
return this.#ast;
|
|
55
|
+
}
|
|
56
|
+
setAST(ast) {
|
|
57
|
+
this.#ast = ast;
|
|
58
|
+
}
|
|
59
|
+
isASTDirty() {
|
|
60
|
+
throw new Error('MutableAsset.isASTDirty()');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// eslint-disable-next-line require-await
|
|
64
|
+
async getCode() {
|
|
65
|
+
return this.#contents.toString();
|
|
66
|
+
}
|
|
67
|
+
setCode(code) {
|
|
68
|
+
this.#contents = Buffer.from(code);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// eslint-disable-next-line require-await
|
|
72
|
+
async getBuffer() {
|
|
73
|
+
return this.#contents;
|
|
74
|
+
}
|
|
75
|
+
setBuffer(buf) {
|
|
76
|
+
this.#contents = buf;
|
|
77
|
+
}
|
|
78
|
+
getStream() {
|
|
79
|
+
return _stream().Readable.from(this.#contents);
|
|
80
|
+
}
|
|
81
|
+
setStream(stream) {
|
|
82
|
+
const data = [];
|
|
83
|
+
stream.on('data', chunk => {
|
|
84
|
+
data.push(chunk);
|
|
85
|
+
});
|
|
86
|
+
stream.on('end', () => {
|
|
87
|
+
this.#contents = Buffer.concat(data);
|
|
88
|
+
});
|
|
89
|
+
stream.on('error', () => {
|
|
90
|
+
throw new Error('MutableAsset.setStream()');
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
getMap() {
|
|
94
|
+
throw new Error('MutableAsset.getMap');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// eslint-disable-next-line no-unused-vars
|
|
98
|
+
setMap() {
|
|
99
|
+
throw new Error('MutableAsset.setMap()');
|
|
100
|
+
}
|
|
101
|
+
getMapBuffer() {
|
|
102
|
+
throw new Error('MutableAsset.getMapBuffer');
|
|
103
|
+
}
|
|
104
|
+
getDependencies() {
|
|
105
|
+
throw new Error('MutableAsset.getDependencies');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// eslint-disable-next-line no-unused-vars
|
|
109
|
+
addDependency() {
|
|
110
|
+
throw new Error('MutableAsset.addDependency()');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// eslint-disable-next-line no-unused-vars
|
|
114
|
+
addURLDependency() {
|
|
115
|
+
throw new Error('MutableAsset.addURLDependency()');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// eslint-disable-next-line no-unused-vars
|
|
119
|
+
setEnvironment() {
|
|
120
|
+
throw new Error('MutableAsset.setEnvironment()');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// eslint-disable-next-line no-unused-vars
|
|
124
|
+
invalidateOnFileChange() {
|
|
125
|
+
throw new Error('MutableAsset.invalidateOnFileChange()');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// eslint-disable-next-line no-unused-vars
|
|
129
|
+
invalidateOnFileCreate() {
|
|
130
|
+
throw new Error('MutableAsset.invalidateOnFileCreate()');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// eslint-disable-next-line no-unused-vars
|
|
134
|
+
invalidateOnEnvChange() {
|
|
135
|
+
throw new Error('MutableAsset.invalidateOnEnvChange()');
|
|
136
|
+
}
|
|
137
|
+
invalidateOnStartup() {
|
|
138
|
+
throw new Error('MutableAsset.invalidateOnStartup()');
|
|
139
|
+
}
|
|
140
|
+
invalidateOnBuild() {
|
|
141
|
+
throw new Error('MutableAsset.invalidateOnBuild()');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.MutableAsset = MutableAsset;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PluginConfig = void 0;
|
|
7
|
+
class PluginConfig {
|
|
8
|
+
constructor({
|
|
9
|
+
env,
|
|
10
|
+
isSource,
|
|
11
|
+
searchPath
|
|
12
|
+
}) {
|
|
13
|
+
this.env = env;
|
|
14
|
+
this.isSource = isSource;
|
|
15
|
+
this.searchPath = searchPath;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// eslint-disable-next-line no-unused-vars
|
|
19
|
+
invalidateOnFileChange() {
|
|
20
|
+
throw new Error('PluginOptions.invalidateOnFileChange');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// eslint-disable-next-line no-unused-vars
|
|
24
|
+
invalidateOnFileCreate() {
|
|
25
|
+
throw new Error('PluginOptions.invalidateOnFileCreate');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// eslint-disable-next-line no-unused-vars
|
|
29
|
+
invalidateOnEnvChange() {
|
|
30
|
+
throw new Error('PluginOptions.invalidateOnEnvChange');
|
|
31
|
+
}
|
|
32
|
+
invalidateOnStartup() {
|
|
33
|
+
throw new Error('PluginOptions.invalidateOnStartup');
|
|
34
|
+
}
|
|
35
|
+
invalidateOnBuild() {
|
|
36
|
+
throw new Error('PluginOptions.invalidateOnBuild');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// eslint-disable-next-line no-unused-vars
|
|
40
|
+
addDevDependency() {
|
|
41
|
+
throw new Error('PluginOptions.addDevDependency');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// eslint-disable-next-line no-unused-vars
|
|
45
|
+
setCacheKey() {
|
|
46
|
+
throw new Error('PluginOptions.setCacheKey');
|
|
47
|
+
}
|
|
48
|
+
getConfig() {
|
|
49
|
+
throw new Error('PluginOptions.getConfig');
|
|
50
|
+
}
|
|
51
|
+
getConfigFrom() {
|
|
52
|
+
throw new Error('PluginOptions.getConfigFrom');
|
|
53
|
+
}
|
|
54
|
+
getPackage() {
|
|
55
|
+
throw new Error('PluginOptions.getPackage');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.PluginConfig = PluginConfig;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PluginLogger = void 0;
|
|
7
|
+
class PluginLogger {
|
|
8
|
+
verbose(diagnostic) {
|
|
9
|
+
// eslint-disable-next-line no-console
|
|
10
|
+
console.log(diagnostic);
|
|
11
|
+
}
|
|
12
|
+
info(diagnostic) {
|
|
13
|
+
// eslint-disable-next-line no-console
|
|
14
|
+
console.info(diagnostic);
|
|
15
|
+
}
|
|
16
|
+
log(diagnostic) {
|
|
17
|
+
// eslint-disable-next-line no-console
|
|
18
|
+
console.log(diagnostic);
|
|
19
|
+
}
|
|
20
|
+
warn(diagnostic) {
|
|
21
|
+
// eslint-disable-next-line no-console
|
|
22
|
+
console.warn(diagnostic);
|
|
23
|
+
}
|
|
24
|
+
error(input) {
|
|
25
|
+
// eslint-disable-next-line no-console
|
|
26
|
+
console.error(input);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.PluginLogger = PluginLogger;
|