@atlaspack/core 2.24.0 → 2.24.2-dev-ts-project-refs-d30e9754f.0
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 +26 -0
- package/LICENSE +201 -0
- package/dist/AssetGraph.js +591 -0
- package/dist/Atlaspack.js +656 -0
- package/dist/AtlaspackConfig.js +324 -0
- package/dist/AtlaspackConfig.schema.js +108 -0
- package/dist/BundleGraph.js +1628 -0
- package/dist/CommittedAsset.js +142 -0
- package/dist/Dependency.js +125 -0
- package/dist/Environment.js +132 -0
- package/dist/EnvironmentManager.js +108 -0
- package/dist/IdentifierRegistry.js +38 -0
- package/dist/InternalConfig.js +37 -0
- package/dist/PackagerRunner.js +531 -0
- package/dist/ReporterRunner.js +151 -0
- package/dist/RequestTracker.js +1368 -0
- package/dist/SymbolPropagation.js +620 -0
- package/dist/TargetDescriptor.schema.js +143 -0
- package/dist/Transformation.js +487 -0
- package/dist/UncommittedAsset.js +315 -0
- package/dist/Validation.js +196 -0
- package/dist/applyRuntimes.js +305 -0
- package/dist/assetUtils.js +168 -0
- package/dist/atlaspack-v3/AtlaspackV3.js +70 -0
- package/dist/atlaspack-v3/NapiWorkerPool.js +57 -0
- package/dist/atlaspack-v3/fs.js +52 -0
- package/dist/atlaspack-v3/index.js +25 -0
- package/dist/atlaspack-v3/jsCallable.js +16 -0
- package/dist/atlaspack-v3/worker/compat/asset-symbols.js +190 -0
- package/dist/atlaspack-v3/worker/compat/bitflags.js +94 -0
- package/dist/atlaspack-v3/worker/compat/dependency.js +43 -0
- package/dist/atlaspack-v3/worker/compat/environment.js +57 -0
- package/dist/atlaspack-v3/worker/compat/index.js +25 -0
- package/dist/atlaspack-v3/worker/compat/mutable-asset.js +152 -0
- package/dist/atlaspack-v3/worker/compat/plugin-config.js +76 -0
- package/dist/atlaspack-v3/worker/compat/plugin-logger.js +26 -0
- package/dist/atlaspack-v3/worker/compat/plugin-options.js +122 -0
- package/dist/atlaspack-v3/worker/compat/plugin-tracer.js +10 -0
- package/dist/atlaspack-v3/worker/compat/target.js +14 -0
- package/dist/atlaspack-v3/worker/worker.js +292 -0
- package/dist/constants.js +17 -0
- package/dist/dumpGraphToGraphViz.js +281 -0
- package/dist/index.js +62 -0
- package/dist/loadAtlaspackPlugin.js +128 -0
- package/dist/loadDotEnv.js +41 -0
- package/dist/projectPath.js +83 -0
- package/dist/public/Asset.js +279 -0
- package/dist/public/Bundle.js +224 -0
- package/dist/public/BundleGraph.js +359 -0
- package/dist/public/BundleGroup.js +53 -0
- package/dist/public/Config.js +286 -0
- package/dist/public/Dependency.js +138 -0
- package/dist/public/Environment.js +278 -0
- package/dist/public/MutableBundleGraph.js +277 -0
- package/dist/public/PluginOptions.js +80 -0
- package/dist/public/Symbols.js +248 -0
- package/dist/public/Target.js +69 -0
- package/dist/registerCoreWithSerializer.js +38 -0
- package/dist/requests/AssetGraphRequest.js +429 -0
- package/dist/requests/AssetGraphRequestRust.js +246 -0
- package/dist/requests/AssetRequest.js +130 -0
- package/dist/requests/AtlaspackBuildRequest.js +60 -0
- package/dist/requests/AtlaspackConfigRequest.js +490 -0
- package/dist/requests/BundleGraphRequest.js +441 -0
- package/dist/requests/ConfigRequest.js +222 -0
- package/dist/requests/DevDepRequest.js +204 -0
- package/dist/requests/EntryRequest.js +314 -0
- package/dist/requests/PackageRequest.js +65 -0
- package/dist/requests/PathRequest.js +349 -0
- package/dist/requests/TargetRequest.js +1310 -0
- package/dist/requests/ValidationRequest.js +49 -0
- package/dist/requests/WriteBundleRequest.js +254 -0
- package/dist/requests/WriteBundlesRequest.js +165 -0
- package/dist/requests/asset-graph-diff.js +126 -0
- package/dist/requests/asset-graph-dot.js +131 -0
- package/dist/resolveOptions.js +268 -0
- package/dist/rustWorkerThreadDylibHack.js +19 -0
- package/dist/serializerCore.browser.js +43 -0
- package/dist/summarizeRequest.js +39 -0
- package/dist/types.js +31 -0
- package/dist/utils.js +172 -0
- package/dist/worker.js +130 -0
- package/lib/AssetGraph.js +1 -0
- package/lib/atlaspack-v3/AtlaspackV3.js +7 -3
- package/lib/requests/AssetGraphRequestRust.js +1 -1
- package/lib/types/atlaspack-v3/AtlaspackV3.d.ts +1 -1
- package/package.json +22 -22
- package/src/AssetGraph.ts +1 -0
- package/src/atlaspack-v3/AtlaspackV3.ts +12 -3
- package/src/requests/AssetGraphRequestRust.ts +1 -1
- package/tsconfig.json +55 -2
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
var _AssetSymbols_value, _AssetSymbols_options, _MutableAssetSymbols_value, _MutableAssetSymbols_options, _MutableDependencySymbols_value, _MutableDependencySymbols_options;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.MutableDependencySymbols = exports.MutableAssetSymbols = exports.AssetSymbols = void 0;
|
|
19
|
+
const nullthrows_1 = __importDefault(require("nullthrows"));
|
|
20
|
+
const utils_1 = require("../utils");
|
|
21
|
+
const EMPTY_ITERABLE = {
|
|
22
|
+
[Symbol.iterator]() {
|
|
23
|
+
return EMPTY_ITERATOR;
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
const EMPTY_ITERATOR = {
|
|
27
|
+
next() {
|
|
28
|
+
return { done: true };
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
const inspect = Symbol.for('nodejs.util.inspect.custom');
|
|
32
|
+
let valueToSymbols = new WeakMap();
|
|
33
|
+
class AssetSymbols {
|
|
34
|
+
constructor(options, asset) {
|
|
35
|
+
/*::
|
|
36
|
+
@@iterator(): Iterator<[ISymbol, {|local: ISymbol, loc: ?SourceLocation, meta?: ?Meta|}]> { return ({}: any); }
|
|
37
|
+
*/
|
|
38
|
+
// @ts-expect-error TS2564
|
|
39
|
+
_AssetSymbols_value.set(this, void 0);
|
|
40
|
+
// @ts-expect-error TS2564
|
|
41
|
+
_AssetSymbols_options.set(this, void 0);
|
|
42
|
+
let existing = valueToSymbols.get(asset);
|
|
43
|
+
if (existing != null) {
|
|
44
|
+
return existing;
|
|
45
|
+
}
|
|
46
|
+
__classPrivateFieldSet(this, _AssetSymbols_value, asset, "f");
|
|
47
|
+
__classPrivateFieldSet(this, _AssetSymbols_options, options, "f");
|
|
48
|
+
valueToSymbols.set(asset, this);
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
hasExportSymbol(exportSymbol) {
|
|
52
|
+
return Boolean(__classPrivateFieldGet(this, _AssetSymbols_value, "f").symbols?.has(exportSymbol));
|
|
53
|
+
}
|
|
54
|
+
hasLocalSymbol(local) {
|
|
55
|
+
if (__classPrivateFieldGet(this, _AssetSymbols_value, "f").symbols == null) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
for (let s of __classPrivateFieldGet(this, _AssetSymbols_value, "f").symbols.values()) {
|
|
59
|
+
if (local === s.local)
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
get(exportSymbol) {
|
|
65
|
+
return fromInternalAssetSymbol(__classPrivateFieldGet(this, _AssetSymbols_options, "f").projectRoot, __classPrivateFieldGet(this, _AssetSymbols_value, "f").symbols?.get(exportSymbol));
|
|
66
|
+
}
|
|
67
|
+
get isCleared() {
|
|
68
|
+
return __classPrivateFieldGet(this, _AssetSymbols_value, "f").symbols == null;
|
|
69
|
+
}
|
|
70
|
+
exportSymbols() {
|
|
71
|
+
return __classPrivateFieldGet(this, _AssetSymbols_value, "f").symbols?.keys() ?? [];
|
|
72
|
+
}
|
|
73
|
+
// @ts-expect-error TS2416
|
|
74
|
+
[(_AssetSymbols_value = new WeakMap(), _AssetSymbols_options = new WeakMap(), Symbol.iterator)]() {
|
|
75
|
+
return __classPrivateFieldGet(this, _AssetSymbols_value, "f").symbols
|
|
76
|
+
? __classPrivateFieldGet(this, _AssetSymbols_value, "f").symbols[Symbol.iterator]()
|
|
77
|
+
: EMPTY_ITERATOR;
|
|
78
|
+
}
|
|
79
|
+
[inspect]() {
|
|
80
|
+
return `AssetSymbols(${__classPrivateFieldGet(this, _AssetSymbols_value, "f").symbols
|
|
81
|
+
? [...__classPrivateFieldGet(this, _AssetSymbols_value, "f").symbols]
|
|
82
|
+
.map(([s, { local }]) => `${s}:${local}`)
|
|
83
|
+
.join(', ')
|
|
84
|
+
: null})`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.AssetSymbols = AssetSymbols;
|
|
88
|
+
let valueToMutableAssetSymbols = new WeakMap();
|
|
89
|
+
class MutableAssetSymbols {
|
|
90
|
+
constructor(options, asset) {
|
|
91
|
+
/*::
|
|
92
|
+
@@iterator(): Iterator<[ISymbol, {|local: ISymbol, loc: ?SourceLocation, meta?: ?Meta|}]> { return ({}: any); }
|
|
93
|
+
*/
|
|
94
|
+
// @ts-expect-error TS2564
|
|
95
|
+
_MutableAssetSymbols_value.set(this, void 0);
|
|
96
|
+
// @ts-expect-error TS2564
|
|
97
|
+
_MutableAssetSymbols_options.set(this, void 0);
|
|
98
|
+
let existing = valueToMutableAssetSymbols.get(asset);
|
|
99
|
+
if (existing != null) {
|
|
100
|
+
return existing;
|
|
101
|
+
}
|
|
102
|
+
__classPrivateFieldSet(this, _MutableAssetSymbols_value, asset, "f");
|
|
103
|
+
__classPrivateFieldSet(this, _MutableAssetSymbols_options, options, "f");
|
|
104
|
+
return this;
|
|
105
|
+
}
|
|
106
|
+
// immutable
|
|
107
|
+
hasExportSymbol(exportSymbol) {
|
|
108
|
+
return Boolean(__classPrivateFieldGet(this, _MutableAssetSymbols_value, "f").symbols?.has(exportSymbol));
|
|
109
|
+
}
|
|
110
|
+
hasLocalSymbol(local) {
|
|
111
|
+
if (__classPrivateFieldGet(this, _MutableAssetSymbols_value, "f").symbols == null) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
for (let s of __classPrivateFieldGet(this, _MutableAssetSymbols_value, "f").symbols.values()) {
|
|
115
|
+
if (local === s.local)
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
get(exportSymbol) {
|
|
121
|
+
return fromInternalAssetSymbol(__classPrivateFieldGet(this, _MutableAssetSymbols_options, "f").projectRoot, __classPrivateFieldGet(this, _MutableAssetSymbols_value, "f").symbols?.get(exportSymbol));
|
|
122
|
+
}
|
|
123
|
+
get isCleared() {
|
|
124
|
+
return __classPrivateFieldGet(this, _MutableAssetSymbols_value, "f").symbols == null;
|
|
125
|
+
}
|
|
126
|
+
exportSymbols() {
|
|
127
|
+
// @ts-expect-error TS2322
|
|
128
|
+
return __classPrivateFieldGet(this, _MutableAssetSymbols_value, "f").symbols.keys();
|
|
129
|
+
}
|
|
130
|
+
// @ts-expect-error TS2416
|
|
131
|
+
[(_MutableAssetSymbols_value = new WeakMap(), _MutableAssetSymbols_options = new WeakMap(), Symbol.iterator)]() {
|
|
132
|
+
return __classPrivateFieldGet(this, _MutableAssetSymbols_value, "f").symbols
|
|
133
|
+
? __classPrivateFieldGet(this, _MutableAssetSymbols_value, "f").symbols[Symbol.iterator]()
|
|
134
|
+
: EMPTY_ITERATOR;
|
|
135
|
+
}
|
|
136
|
+
[inspect]() {
|
|
137
|
+
return `MutableAssetSymbols(${__classPrivateFieldGet(this, _MutableAssetSymbols_value, "f").symbols
|
|
138
|
+
? [...__classPrivateFieldGet(this, _MutableAssetSymbols_value, "f").symbols]
|
|
139
|
+
.map(([s, { local }]) => `${s}:${local}`)
|
|
140
|
+
.join(', ')
|
|
141
|
+
: null})`;
|
|
142
|
+
}
|
|
143
|
+
// mutating
|
|
144
|
+
ensure() {
|
|
145
|
+
if (__classPrivateFieldGet(this, _MutableAssetSymbols_value, "f").symbols == null) {
|
|
146
|
+
__classPrivateFieldGet(this, _MutableAssetSymbols_value, "f").symbols = new Map();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
set(exportSymbol, local, loc, meta) {
|
|
150
|
+
(0, nullthrows_1.default)(__classPrivateFieldGet(this, _MutableAssetSymbols_value, "f").symbols).set(exportSymbol, {
|
|
151
|
+
local,
|
|
152
|
+
loc: (0, utils_1.toInternalSourceLocation)(__classPrivateFieldGet(this, _MutableAssetSymbols_options, "f").projectRoot, loc),
|
|
153
|
+
meta,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
delete(exportSymbol) {
|
|
157
|
+
(0, nullthrows_1.default)(__classPrivateFieldGet(this, _MutableAssetSymbols_value, "f").symbols).delete(exportSymbol);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.MutableAssetSymbols = MutableAssetSymbols;
|
|
161
|
+
let valueToMutableDependencySymbols = new WeakMap();
|
|
162
|
+
class MutableDependencySymbols {
|
|
163
|
+
constructor(options, dep) {
|
|
164
|
+
/*::
|
|
165
|
+
@@iterator(): Iterator<[ISymbol, {|local: ISymbol, loc: ?SourceLocation, isWeak: boolean, meta?: ?Meta|}]> { return ({}: any); }
|
|
166
|
+
*/
|
|
167
|
+
// @ts-expect-error TS2564
|
|
168
|
+
_MutableDependencySymbols_value.set(this, void 0);
|
|
169
|
+
// @ts-expect-error TS2564
|
|
170
|
+
_MutableDependencySymbols_options.set(this, void 0);
|
|
171
|
+
let existing = valueToMutableDependencySymbols.get(dep);
|
|
172
|
+
if (existing != null) {
|
|
173
|
+
return existing;
|
|
174
|
+
}
|
|
175
|
+
__classPrivateFieldSet(this, _MutableDependencySymbols_value, dep, "f");
|
|
176
|
+
__classPrivateFieldSet(this, _MutableDependencySymbols_options, options, "f");
|
|
177
|
+
return this;
|
|
178
|
+
}
|
|
179
|
+
// immutable:
|
|
180
|
+
hasExportSymbol(exportSymbol) {
|
|
181
|
+
return Boolean(__classPrivateFieldGet(this, _MutableDependencySymbols_value, "f").symbols?.has(exportSymbol));
|
|
182
|
+
}
|
|
183
|
+
hasLocalSymbol(local) {
|
|
184
|
+
if (__classPrivateFieldGet(this, _MutableDependencySymbols_value, "f").symbols) {
|
|
185
|
+
for (let s of __classPrivateFieldGet(this, _MutableDependencySymbols_value, "f").symbols.values()) {
|
|
186
|
+
if (local === s.local)
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
get(exportSymbol) {
|
|
193
|
+
return fromInternalDependencySymbol(__classPrivateFieldGet(this, _MutableDependencySymbols_options, "f").projectRoot, (0, nullthrows_1.default)(__classPrivateFieldGet(this, _MutableDependencySymbols_value, "f").symbols).get(exportSymbol));
|
|
194
|
+
}
|
|
195
|
+
get isCleared() {
|
|
196
|
+
return __classPrivateFieldGet(this, _MutableDependencySymbols_value, "f").symbols == null;
|
|
197
|
+
}
|
|
198
|
+
exportSymbols() {
|
|
199
|
+
// @ts-expect-error TS2322
|
|
200
|
+
return __classPrivateFieldGet(this, _MutableDependencySymbols_value, "f").symbols ? __classPrivateFieldGet(this, _MutableDependencySymbols_value, "f").symbols.keys() : EMPTY_ITERABLE;
|
|
201
|
+
}
|
|
202
|
+
// @ts-expect-error TS2416
|
|
203
|
+
[(_MutableDependencySymbols_value = new WeakMap(), _MutableDependencySymbols_options = new WeakMap(), Symbol.iterator)]() {
|
|
204
|
+
return __classPrivateFieldGet(this, _MutableDependencySymbols_value, "f").symbols
|
|
205
|
+
? __classPrivateFieldGet(this, _MutableDependencySymbols_value, "f").symbols[Symbol.iterator]()
|
|
206
|
+
: EMPTY_ITERATOR;
|
|
207
|
+
}
|
|
208
|
+
[inspect]() {
|
|
209
|
+
return `MutableDependencySymbols(${__classPrivateFieldGet(this, _MutableDependencySymbols_value, "f").symbols
|
|
210
|
+
? [...__classPrivateFieldGet(this, _MutableDependencySymbols_value, "f").symbols]
|
|
211
|
+
.map(([s, { local, isWeak }]) => `${s}:${local}${isWeak ? '?' : ''}`)
|
|
212
|
+
.join(', ')
|
|
213
|
+
: null})`;
|
|
214
|
+
}
|
|
215
|
+
// mutating:
|
|
216
|
+
ensure() {
|
|
217
|
+
if (__classPrivateFieldGet(this, _MutableDependencySymbols_value, "f").symbols == null) {
|
|
218
|
+
__classPrivateFieldGet(this, _MutableDependencySymbols_value, "f").symbols = new Map();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
set(exportSymbol, local, loc, isWeak) {
|
|
222
|
+
let symbols = (0, nullthrows_1.default)(__classPrivateFieldGet(this, _MutableDependencySymbols_value, "f").symbols);
|
|
223
|
+
symbols.set(exportSymbol, {
|
|
224
|
+
local,
|
|
225
|
+
loc: (0, utils_1.toInternalSourceLocation)(__classPrivateFieldGet(this, _MutableDependencySymbols_options, "f").projectRoot, loc),
|
|
226
|
+
isWeak: (symbols.get(exportSymbol)?.isWeak ?? true) && (isWeak ?? false),
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
delete(exportSymbol) {
|
|
230
|
+
(0, nullthrows_1.default)(__classPrivateFieldGet(this, _MutableDependencySymbols_value, "f").symbols).delete(exportSymbol);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
exports.MutableDependencySymbols = MutableDependencySymbols;
|
|
234
|
+
function fromInternalAssetSymbol(projectRoot, value) {
|
|
235
|
+
return (value && {
|
|
236
|
+
local: value.local,
|
|
237
|
+
meta: value.meta,
|
|
238
|
+
loc: (0, utils_1.fromInternalSourceLocation)(projectRoot, value.loc),
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
function fromInternalDependencySymbol(projectRoot, value) {
|
|
242
|
+
return (value && {
|
|
243
|
+
local: value.local,
|
|
244
|
+
meta: value.meta,
|
|
245
|
+
isWeak: value.isWeak,
|
|
246
|
+
loc: (0, utils_1.fromInternalSourceLocation)(projectRoot, value.loc),
|
|
247
|
+
});
|
|
248
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
var _Target_target, _Target_options;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.targetToInternalTarget = targetToInternalTarget;
|
|
19
|
+
const nullthrows_1 = __importDefault(require("nullthrows"));
|
|
20
|
+
const Environment_1 = __importDefault(require("./Environment"));
|
|
21
|
+
const projectPath_1 = require("../projectPath");
|
|
22
|
+
const utils_1 = require("../utils");
|
|
23
|
+
const EnvironmentManager_1 = require("../EnvironmentManager");
|
|
24
|
+
const inspect = Symbol.for('nodejs.util.inspect.custom');
|
|
25
|
+
const internalTargetToTarget = new WeakMap();
|
|
26
|
+
const _targetToInternalTarget = new WeakMap();
|
|
27
|
+
function targetToInternalTarget(target) {
|
|
28
|
+
return (0, nullthrows_1.default)(_targetToInternalTarget.get(target));
|
|
29
|
+
}
|
|
30
|
+
class Target {
|
|
31
|
+
constructor(target, options) {
|
|
32
|
+
// @ts-expect-error TS2564
|
|
33
|
+
_Target_target.set(this, void 0);
|
|
34
|
+
// @ts-expect-error TS2564
|
|
35
|
+
_Target_options.set(this, void 0);
|
|
36
|
+
let existing = internalTargetToTarget.get(target);
|
|
37
|
+
if (existing != null) {
|
|
38
|
+
return existing;
|
|
39
|
+
}
|
|
40
|
+
__classPrivateFieldSet(this, _Target_target, target, "f");
|
|
41
|
+
__classPrivateFieldSet(this, _Target_options, options, "f");
|
|
42
|
+
_targetToInternalTarget.set(this, target);
|
|
43
|
+
internalTargetToTarget.set(target, this);
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
get distEntry() {
|
|
47
|
+
return __classPrivateFieldGet(this, _Target_target, "f").distEntry;
|
|
48
|
+
}
|
|
49
|
+
get distDir() {
|
|
50
|
+
return (0, projectPath_1.fromProjectPath)(__classPrivateFieldGet(this, _Target_options, "f").projectRoot, __classPrivateFieldGet(this, _Target_target, "f").distDir);
|
|
51
|
+
}
|
|
52
|
+
get env() {
|
|
53
|
+
return new Environment_1.default((0, EnvironmentManager_1.fromEnvironmentId)(__classPrivateFieldGet(this, _Target_target, "f").env), __classPrivateFieldGet(this, _Target_options, "f"));
|
|
54
|
+
}
|
|
55
|
+
get name() {
|
|
56
|
+
return __classPrivateFieldGet(this, _Target_target, "f").name;
|
|
57
|
+
}
|
|
58
|
+
get publicUrl() {
|
|
59
|
+
return __classPrivateFieldGet(this, _Target_target, "f").publicUrl;
|
|
60
|
+
}
|
|
61
|
+
get loc() {
|
|
62
|
+
return (0, utils_1.fromInternalSourceLocation)(__classPrivateFieldGet(this, _Target_options, "f").projectRoot, __classPrivateFieldGet(this, _Target_target, "f").loc);
|
|
63
|
+
}
|
|
64
|
+
[(_Target_target = new WeakMap(), _Target_options = new WeakMap(), inspect)]() {
|
|
65
|
+
// @ts-expect-error TS7053
|
|
66
|
+
return `Target(${this.name} - ${this.env[inspect]()})`;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.default = Target;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.registerCoreWithSerializer = registerCoreWithSerializer;
|
|
7
|
+
const build_cache_1 = require("@atlaspack/build-cache");
|
|
8
|
+
const graph_1 = require("@atlaspack/graph");
|
|
9
|
+
const package_json_1 = __importDefault(require("../package.json"));
|
|
10
|
+
const AtlaspackConfig_1 = require("./AtlaspackConfig");
|
|
11
|
+
const AssetGraph_1 = __importDefault(require("./AssetGraph"));
|
|
12
|
+
const BundleGraph_1 = __importDefault(require("./BundleGraph"));
|
|
13
|
+
const Config_1 = __importDefault(require("./public/Config"));
|
|
14
|
+
const RequestTracker_1 = require("./RequestTracker");
|
|
15
|
+
// /flow-to-ts helpers
|
|
16
|
+
// @ts-expect-error TS7034
|
|
17
|
+
let coreRegistered;
|
|
18
|
+
function registerCoreWithSerializer() {
|
|
19
|
+
// @ts-expect-error TS7005
|
|
20
|
+
if (coreRegistered) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const packageVersion = package_json_1.default.version;
|
|
24
|
+
if (typeof packageVersion !== 'string') {
|
|
25
|
+
throw new Error('Expected package version to be a string');
|
|
26
|
+
}
|
|
27
|
+
for (let [name, ctor] of Object.entries({
|
|
28
|
+
AssetGraph: AssetGraph_1.default,
|
|
29
|
+
Config: Config_1.default,
|
|
30
|
+
BundleGraph: BundleGraph_1.default,
|
|
31
|
+
Graph: graph_1.Graph,
|
|
32
|
+
AtlaspackConfig: AtlaspackConfig_1.AtlaspackConfig,
|
|
33
|
+
RequestGraph: RequestTracker_1.RequestGraph,
|
|
34
|
+
})) {
|
|
35
|
+
(0, build_cache_1.registerSerializableClass)(packageVersion + ':' + name, ctor);
|
|
36
|
+
}
|
|
37
|
+
coreRegistered = true;
|
|
38
|
+
}
|