@atlaspack/core 2.12.1-dev.3450 → 2.12.1-dev.3466
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/AssetGraph.js +5 -1
- package/lib/Atlaspack.js +2 -2
- package/lib/CommittedAsset.js +11 -5
- package/lib/Dependency.js +1 -1
- package/lib/PackagerRunner.js +53 -5
- package/lib/RequestTracker.js +10 -4
- package/lib/SymbolPropagation.js +25 -36
- package/lib/UncommittedAsset.js +8 -2
- package/lib/assetUtils.js +9 -3
- package/lib/atlaspack-v3/fs.js +31 -29
- package/lib/atlaspack-v3/index.js +2 -2
- package/lib/atlaspack-v3/jsCallable.js +9 -4
- package/lib/atlaspack-v3/worker/compat/asset-symbols.js +192 -0
- package/lib/atlaspack-v3/worker/compat/bitflags.js +84 -0
- package/lib/atlaspack-v3/worker/compat/dependency.js +44 -0
- package/lib/atlaspack-v3/worker/compat/environment.js +68 -0
- package/lib/atlaspack-v3/worker/compat/index.js +104 -0
- 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/compat/target.js +17 -0
- package/lib/atlaspack-v3/worker/worker.js +115 -127
- package/lib/index.js +0 -43
- package/lib/projectPath.js +12 -4
- package/lib/registerCoreWithSerializer.js +11 -5
- package/lib/requests/AtlaspackConfigRequest.js +8 -2
- package/lib/requests/ConfigRequest.js +9 -4
- package/lib/requests/DevDepRequest.js +9 -3
- package/lib/requests/PathRequest.js +8 -2
- package/lib/requests/WriteBundleRequest.js +15 -15
- package/lib/worker.js +8 -2
- package/package.json +24 -16
- package/src/AssetGraph.js +15 -13
- package/src/Atlaspack.js +5 -6
- package/src/AtlaspackConfig.js +11 -9
- package/src/AtlaspackConfig.schema.js +1 -1
- package/src/BundleGraph.js +83 -79
- package/src/CommittedAsset.js +5 -3
- package/src/Dependency.js +1 -1
- package/src/PackagerRunner.js +57 -9
- package/src/ReporterRunner.js +4 -4
- package/src/RequestTracker.js +19 -19
- package/src/SymbolPropagation.js +40 -52
- package/src/Transformation.js +12 -12
- package/src/UncommittedAsset.js +3 -3
- package/src/Validation.js +5 -5
- package/src/applyRuntimes.js +2 -2
- package/src/assetUtils.js +2 -2
- package/src/atlaspack-v3/AtlaspackV3.js +1 -1
- package/src/atlaspack-v3/fs.js +39 -25
- package/src/atlaspack-v3/index.js +1 -1
- package/src/atlaspack-v3/jsCallable.js +11 -10
- package/src/atlaspack-v3/worker/compat/asset-symbols.js +225 -0
- package/src/atlaspack-v3/worker/compat/bitflags.js +100 -0
- package/src/atlaspack-v3/worker/compat/dependency.js +83 -0
- package/src/atlaspack-v3/worker/compat/environment.js +92 -0
- package/src/atlaspack-v3/worker/compat/index.js +10 -0
- 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/compat/target.js +27 -0
- package/src/atlaspack-v3/worker/worker.js +148 -134
- package/src/dumpGraphToGraphViz.js +1 -1
- package/src/index.js +0 -10
- package/src/loadDotEnv.js +1 -1
- package/src/projectPath.js +12 -4
- package/src/public/Asset.js +1 -1
- package/src/public/Bundle.js +3 -3
- package/src/public/BundleGraph.js +20 -20
- package/src/public/Config.js +1 -1
- package/src/public/MutableBundleGraph.js +8 -8
- package/src/registerCoreWithSerializer.js +7 -4
- package/src/requests/AssetGraphRequest.js +10 -10
- package/src/requests/AssetGraphRequestRust.js +3 -3
- package/src/requests/AssetRequest.js +3 -3
- package/src/requests/AtlaspackConfigRequest.js +6 -4
- package/src/requests/BundleGraphRequest.js +6 -6
- package/src/requests/ConfigRequest.js +5 -6
- package/src/requests/DevDepRequest.js +8 -8
- package/src/requests/EntryRequest.js +2 -2
- package/src/requests/PathRequest.js +1 -1
- package/src/requests/TargetRequest.js +9 -8
- package/src/requests/ValidationRequest.js +2 -2
- package/src/requests/WriteBundleRequest.js +26 -20
- package/src/requests/WriteBundlesRequest.js +6 -6
- package/src/requests/asset-graph-diff.js +4 -4
- package/src/resolveOptions.js +3 -3
- package/src/serializerCore.browser.js +3 -2
- package/src/utils.js +2 -2
- package/src/worker.js +1 -1
- package/test/AtlaspackConfigRequest.test.js +1 -1
- package/test/BundleGraph.test.js +3 -3
- package/test/Dependency.test.js +28 -0
- package/test/PublicMutableBundleGraph.test.js +2 -2
- package/test/RequestTracker.test.js +7 -6
- package/test/SymbolPropagation.test.js +9 -9
- package/test/requests/ConfigRequest.test.js +3 -6
- package/test/utils.test.js +1 -1
- package/lib/atlaspack-v3/worker/compat.js +0 -57
- package/lib/buildCache.js +0 -18
- package/lib/serializer.js +0 -216
- package/lib/serializerCore.js +0 -16
- package/src/atlaspack-v3/worker/compat.js +0 -82
- package/src/buildCache.js +0 -15
- package/src/serializer.js +0 -255
- package/src/serializerCore.js +0 -5
- package/test/requests/WriteBundleRequest.test.js +0 -132
- package/test/serializer.test.js +0 -302
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MutableDependencySymbols = exports.MutableAssetSymbols = exports.AssetSymbols = void 0;
|
|
7
|
+
class MutableDependencySymbols {
|
|
8
|
+
#symbols;
|
|
9
|
+
#locals;
|
|
10
|
+
get isCleared() {
|
|
11
|
+
return this.#symbols.size === 0;
|
|
12
|
+
}
|
|
13
|
+
constructor(inner) {
|
|
14
|
+
this.#symbols = new Map();
|
|
15
|
+
this.#locals = new Set();
|
|
16
|
+
for (const {
|
|
17
|
+
exported,
|
|
18
|
+
local,
|
|
19
|
+
loc,
|
|
20
|
+
isWeak
|
|
21
|
+
} of inner || []) {
|
|
22
|
+
this.set(exported, local, loc, isWeak);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
ensure() {
|
|
26
|
+
throw new Error('MutableDependencySymbols.ensure()');
|
|
27
|
+
}
|
|
28
|
+
get(exportSymbol) {
|
|
29
|
+
return this.#symbols.get(exportSymbol);
|
|
30
|
+
}
|
|
31
|
+
hasExportSymbol(exportSymbol) {
|
|
32
|
+
return this.#symbols.has(exportSymbol);
|
|
33
|
+
}
|
|
34
|
+
hasLocalSymbol(local) {
|
|
35
|
+
return this.#locals.has(local);
|
|
36
|
+
}
|
|
37
|
+
exportSymbols() {
|
|
38
|
+
return this.#symbols.keys();
|
|
39
|
+
}
|
|
40
|
+
set(exportSymbol, local, loc, isWeak) {
|
|
41
|
+
this.#locals.add(local);
|
|
42
|
+
this.#symbols.set(exportSymbol, {
|
|
43
|
+
local,
|
|
44
|
+
loc,
|
|
45
|
+
meta: {},
|
|
46
|
+
isWeak: isWeak ?? false
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
delete(exportSymbol) {
|
|
50
|
+
let existing = this.#symbols.get(exportSymbol);
|
|
51
|
+
if (!existing) return;
|
|
52
|
+
this.#locals.delete(existing.local);
|
|
53
|
+
this.#symbols.delete(exportSymbol);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/*:: @@iterator(): Iterator<[Symbol, DependencyAssetSymbol]> { return ({}: any); } */
|
|
57
|
+
// $FlowFixMe Flow can't do computed properties
|
|
58
|
+
[Symbol.iterator]() {
|
|
59
|
+
return this.#symbols.values();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.MutableDependencySymbols = MutableDependencySymbols;
|
|
63
|
+
class AssetSymbols {
|
|
64
|
+
#symbols;
|
|
65
|
+
#locals;
|
|
66
|
+
get isCleared() {
|
|
67
|
+
return this.#symbols.size === 0;
|
|
68
|
+
}
|
|
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);
|
|
96
|
+
}
|
|
97
|
+
exportSymbols() {
|
|
98
|
+
return this.#symbols.keys();
|
|
99
|
+
}
|
|
100
|
+
intoNapi() {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
|
|
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
|
+
}
|
|
110
|
+
exports.AssetSymbols = AssetSymbols;
|
|
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
|
+
}
|
|
185
|
+
|
|
186
|
+
/*:: @@iterator(): Iterator<[Symbol, AssetSymbol]> { return ({}: any); } */
|
|
187
|
+
// $FlowFixMe Flow can't do computed properties
|
|
188
|
+
[Symbol.iterator]() {
|
|
189
|
+
return this.#symbols.values();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
exports.MutableAssetSymbols = MutableAssetSymbols;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.specifierTypeMap = exports.packageConditionsMap = exports.dependencyPriorityMap = exports.bundleBehaviorMap = exports.BitFlags = void 0;
|
|
7
|
+
/// BitFlags is used to map number/string types from napi types
|
|
8
|
+
class BitFlags {
|
|
9
|
+
#kv;
|
|
10
|
+
#vk;
|
|
11
|
+
constructor(source) {
|
|
12
|
+
this.#kv = source;
|
|
13
|
+
this.#vk = Object.fromEntries(
|
|
14
|
+
// $FlowFixMe
|
|
15
|
+
Object.entries(source).map(a => a.reverse()));
|
|
16
|
+
}
|
|
17
|
+
into(key) {
|
|
18
|
+
const found = this.#kv[key];
|
|
19
|
+
if (found === undefined) {
|
|
20
|
+
// $FlowFixMe
|
|
21
|
+
throw new Error(`Invalid BundleBehavior(${key})`);
|
|
22
|
+
}
|
|
23
|
+
return found;
|
|
24
|
+
}
|
|
25
|
+
intoNullable(key) {
|
|
26
|
+
if (key === undefined || key === null) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
return this.into(key);
|
|
30
|
+
}
|
|
31
|
+
intoArray(keys) {
|
|
32
|
+
return keys.map(key => this.into(key));
|
|
33
|
+
}
|
|
34
|
+
from(key) {
|
|
35
|
+
const found = this.#vk[key];
|
|
36
|
+
if (found === undefined) {
|
|
37
|
+
// $FlowFixMe
|
|
38
|
+
throw new Error(`Invalid BundleBehavior(${key})`);
|
|
39
|
+
}
|
|
40
|
+
return found;
|
|
41
|
+
}
|
|
42
|
+
fromNullable(key) {
|
|
43
|
+
if (key === undefined || key === null) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
return this.from(key);
|
|
47
|
+
}
|
|
48
|
+
fromArray(keys) {
|
|
49
|
+
return keys.map(key => this.from(key));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.BitFlags = BitFlags;
|
|
53
|
+
const bundleBehaviorMap = exports.bundleBehaviorMap = new BitFlags({
|
|
54
|
+
inline: 0,
|
|
55
|
+
isolated: 1
|
|
56
|
+
});
|
|
57
|
+
const dependencyPriorityMap = exports.dependencyPriorityMap = new BitFlags({
|
|
58
|
+
sync: 0,
|
|
59
|
+
parallel: 1,
|
|
60
|
+
lazy: 2,
|
|
61
|
+
conditional: 3
|
|
62
|
+
});
|
|
63
|
+
const packageConditionsMap = exports.packageConditionsMap = new BitFlags({
|
|
64
|
+
import: 0,
|
|
65
|
+
require: 1,
|
|
66
|
+
module: 2,
|
|
67
|
+
node: 3,
|
|
68
|
+
browser: 4,
|
|
69
|
+
worker: 5,
|
|
70
|
+
worklet: 6,
|
|
71
|
+
electron: 7,
|
|
72
|
+
development: 8,
|
|
73
|
+
production: 9,
|
|
74
|
+
types: 10,
|
|
75
|
+
default: 11,
|
|
76
|
+
style: 12,
|
|
77
|
+
sass: 13
|
|
78
|
+
});
|
|
79
|
+
const specifierTypeMap = exports.specifierTypeMap = new BitFlags({
|
|
80
|
+
esm: 0,
|
|
81
|
+
commonjs: 1,
|
|
82
|
+
url: 2,
|
|
83
|
+
custom: 3
|
|
84
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Dependency = void 0;
|
|
7
|
+
var _target = require("./target");
|
|
8
|
+
var _assetSymbols = require("./asset-symbols");
|
|
9
|
+
var _bitflags = require("./bitflags");
|
|
10
|
+
class Dependency {
|
|
11
|
+
get id() {
|
|
12
|
+
throw new Error('Dependency.id');
|
|
13
|
+
}
|
|
14
|
+
constructor(inner, env) {
|
|
15
|
+
this.env = env;
|
|
16
|
+
this.meta = inner.meta || {};
|
|
17
|
+
this.target = undefined;
|
|
18
|
+
if (inner.target) {
|
|
19
|
+
this.target = new _target.Target(inner.target, this.env);
|
|
20
|
+
}
|
|
21
|
+
if (!inner.bundleBehavior) {
|
|
22
|
+
this.bundleBehavior = undefined;
|
|
23
|
+
} else {
|
|
24
|
+
this.bundleBehavior = _bitflags.bundleBehaviorMap.from(inner.bundleBehavior);
|
|
25
|
+
}
|
|
26
|
+
this.bundleBehavior = undefined;
|
|
27
|
+
this.symbols = new _assetSymbols.MutableDependencySymbols(inner.symbols || []);
|
|
28
|
+
this.specifier = inner.specifier;
|
|
29
|
+
this.specifierType = _bitflags.specifierTypeMap.from(inner.specifierType);
|
|
30
|
+
this.priority = _bitflags.dependencyPriorityMap.from(inner.priority);
|
|
31
|
+
this.needsStableName = inner.needsStableName;
|
|
32
|
+
this.isOptional = inner.isOptional;
|
|
33
|
+
this.isEntry = inner.isEntry;
|
|
34
|
+
this.loc = inner.loc;
|
|
35
|
+
this.packageConditions = _bitflags.packageConditionsMap.fromArray(inner.packageConditions || []);
|
|
36
|
+
this.sourceAssetId = inner.sourceAssetId;
|
|
37
|
+
this.sourcePath = inner.sourcePath;
|
|
38
|
+
this.sourceAssetType = inner.sourceAssetType;
|
|
39
|
+
this.resolveFrom = inner.resolveFrom;
|
|
40
|
+
this.range = inner.range;
|
|
41
|
+
this.pipeline = inner.pipeline;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.Dependency = Dependency;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Environment = void 0;
|
|
7
|
+
class Environment {
|
|
8
|
+
constructor(inner) {
|
|
9
|
+
// TODO
|
|
10
|
+
this.id = '';
|
|
11
|
+
this.includeNodeModules = inner.includeNodeModules;
|
|
12
|
+
// $FlowFixMe
|
|
13
|
+
this.context = inner.context;
|
|
14
|
+
this.engines = inner.engines;
|
|
15
|
+
// $FlowFixMe
|
|
16
|
+
this.outputFormat = inner.outputFormat;
|
|
17
|
+
// $FlowFixMe
|
|
18
|
+
this.sourceType = inner.sourceType;
|
|
19
|
+
this.isLibrary = inner.isLibrary;
|
|
20
|
+
this.shouldOptimize = inner.shouldOptimize;
|
|
21
|
+
this.shouldScopeHoist = inner.shouldScopeHoist;
|
|
22
|
+
this.sourceMap = inner.sourceMap;
|
|
23
|
+
this.loc = inner.loc;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// TODO
|
|
27
|
+
isBrowser() {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// TODO
|
|
32
|
+
isNode() {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// TODO
|
|
37
|
+
isElectron() {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// TODO
|
|
42
|
+
isWorker() {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// TODO
|
|
47
|
+
isWorklet() {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// TODO
|
|
52
|
+
isIsolated() {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// TODO
|
|
57
|
+
// eslint-disable-next-line no-unused-vars
|
|
58
|
+
matchesEngines() {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// TODO
|
|
63
|
+
// eslint-disable-next-line no-unused-vars
|
|
64
|
+
supports() {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.Environment = Environment;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _bitflags = require("./bitflags");
|
|
7
|
+
Object.keys(_bitflags).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _bitflags[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _bitflags[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _dependency = require("./dependency");
|
|
18
|
+
Object.keys(_dependency).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _dependency[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _dependency[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _environment = require("./environment");
|
|
29
|
+
Object.keys(_environment).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _environment[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _environment[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _target = require("./target");
|
|
40
|
+
Object.keys(_target).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _target[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _target[key];
|
|
47
|
+
}
|
|
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
|
+
});
|
|
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;
|