@atlaspack/core 2.13.2-dev.3689 → 2.14.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 +61 -0
- package/package.json +20 -20
- package/src/Atlaspack.js +3 -2
- package/src/atlaspack-v3/AtlaspackV3.js +25 -9
- package/src/requests/WriteBundlesRequest.js +31 -22
- package/LICENSE +0 -201
- package/lib/AssetGraph.js +0 -521
- package/lib/Atlaspack.js +0 -676
- package/lib/AtlaspackConfig.js +0 -298
- package/lib/AtlaspackConfig.schema.js +0 -103
- package/lib/BundleGraph.js +0 -1527
- package/lib/CommittedAsset.js +0 -155
- package/lib/Dependency.js +0 -136
- package/lib/Environment.js +0 -144
- package/lib/IdentifierRegistry.js +0 -36
- package/lib/InternalConfig.js +0 -56
- package/lib/PackagerRunner.js +0 -525
- package/lib/ReporterRunner.js +0 -151
- package/lib/RequestTracker.js +0 -1178
- package/lib/SymbolPropagation.js +0 -618
- package/lib/TargetDescriptor.schema.js +0 -118
- package/lib/Transformation.js +0 -522
- package/lib/UncommittedAsset.js +0 -348
- package/lib/Validation.js +0 -203
- package/lib/applyRuntimes.js +0 -355
- package/lib/assetUtils.js +0 -205
- package/lib/atlaspack-v3/AtlaspackV3.js +0 -57
- package/lib/atlaspack-v3/NapiWorkerPool.js +0 -71
- package/lib/atlaspack-v3/fs.js +0 -39
- package/lib/atlaspack-v3/index.js +0 -26
- package/lib/atlaspack-v3/jsCallable.js +0 -20
- package/lib/atlaspack-v3/worker/compat/asset-symbols.js +0 -197
- package/lib/atlaspack-v3/worker/compat/bitflags.js +0 -84
- package/lib/atlaspack-v3/worker/compat/dependency.js +0 -44
- package/lib/atlaspack-v3/worker/compat/environment.js +0 -57
- package/lib/atlaspack-v3/worker/compat/index.js +0 -104
- package/lib/atlaspack-v3/worker/compat/mutable-asset.js +0 -164
- package/lib/atlaspack-v3/worker/compat/plugin-config.js +0 -78
- package/lib/atlaspack-v3/worker/compat/plugin-logger.js +0 -29
- package/lib/atlaspack-v3/worker/compat/plugin-options.js +0 -113
- package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +0 -12
- package/lib/atlaspack-v3/worker/compat/target.js +0 -17
- package/lib/atlaspack-v3/worker/index.js +0 -3
- package/lib/atlaspack-v3/worker/worker.js +0 -280
- package/lib/constants.js +0 -21
- package/lib/dumpGraphToGraphViz.js +0 -206
- package/lib/index.js +0 -70
- package/lib/loadAtlaspackPlugin.js +0 -115
- package/lib/loadDotEnv.js +0 -54
- package/lib/projectPath.js +0 -112
- package/lib/public/Asset.js +0 -259
- package/lib/public/Bundle.js +0 -236
- package/lib/public/BundleGraph.js +0 -279
- package/lib/public/BundleGroup.js +0 -50
- package/lib/public/Config.js +0 -202
- package/lib/public/Dependency.js +0 -131
- package/lib/public/Environment.js +0 -247
- package/lib/public/MutableBundleGraph.js +0 -204
- package/lib/public/PluginOptions.js +0 -71
- package/lib/public/Symbols.js +0 -247
- package/lib/public/Target.js +0 -64
- package/lib/registerCoreWithSerializer.js +0 -51
- package/lib/requests/AssetGraphRequest.js +0 -432
- package/lib/requests/AssetGraphRequestRust.js +0 -220
- package/lib/requests/AssetRequest.js +0 -132
- package/lib/requests/AtlaspackBuildRequest.js +0 -79
- package/lib/requests/AtlaspackConfigRequest.js +0 -479
- package/lib/requests/BundleGraphRequest.js +0 -485
- package/lib/requests/ConfigRequest.js +0 -203
- package/lib/requests/DevDepRequest.js +0 -193
- package/lib/requests/EntryRequest.js +0 -295
- package/lib/requests/PackageRequest.js +0 -88
- package/lib/requests/PathRequest.js +0 -357
- package/lib/requests/TargetRequest.js +0 -1179
- package/lib/requests/ValidationRequest.js +0 -66
- package/lib/requests/WriteBundleRequest.js +0 -252
- package/lib/requests/WriteBundlesRequest.js +0 -153
- package/lib/requests/asset-graph-diff.js +0 -128
- package/lib/requests/asset-graph-dot.js +0 -131
- package/lib/resolveOptions.js +0 -265
- package/lib/serializerCore.browser.js +0 -29
- package/lib/summarizeRequest.js +0 -55
- package/lib/types.js +0 -35
- package/lib/utils.js +0 -160
- package/lib/worker.js +0 -184
package/lib/public/Asset.js
DELETED
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.MutableAsset = exports.Asset = void 0;
|
|
7
|
-
exports.assetFromValue = assetFromValue;
|
|
8
|
-
exports.assetToAssetValue = assetToAssetValue;
|
|
9
|
-
exports.mutableAssetToUncommittedAsset = mutableAssetToUncommittedAsset;
|
|
10
|
-
function _nullthrows() {
|
|
11
|
-
const data = _interopRequireDefault(require("nullthrows"));
|
|
12
|
-
_nullthrows = function () {
|
|
13
|
-
return data;
|
|
14
|
-
};
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
|
-
var _Environment = _interopRequireDefault(require("./Environment"));
|
|
18
|
-
var _Dependency = require("./Dependency");
|
|
19
|
-
var _Symbols = require("./Symbols");
|
|
20
|
-
var _UncommittedAsset = _interopRequireDefault(require("../UncommittedAsset"));
|
|
21
|
-
var _CommittedAsset = _interopRequireDefault(require("../CommittedAsset"));
|
|
22
|
-
var _Environment2 = require("../Environment");
|
|
23
|
-
var _projectPath = require("../projectPath");
|
|
24
|
-
var _types = require("../types");
|
|
25
|
-
var _utils = require("../utils");
|
|
26
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
const inspect = Symbol.for('nodejs.util.inspect.custom');
|
|
28
|
-
const uncommittedAssetValueToAsset = new WeakMap();
|
|
29
|
-
const committedAssetValueToAsset = new WeakMap();
|
|
30
|
-
const assetValueToMutableAsset = new WeakMap();
|
|
31
|
-
const _assetToAssetValue = new WeakMap();
|
|
32
|
-
const _mutableAssetToUncommittedAsset = new WeakMap();
|
|
33
|
-
function assetToAssetValue(asset) {
|
|
34
|
-
return (0, _nullthrows().default)(_assetToAssetValue.get(asset));
|
|
35
|
-
}
|
|
36
|
-
function mutableAssetToUncommittedAsset(mutableAsset) {
|
|
37
|
-
return (0, _nullthrows().default)(_mutableAssetToUncommittedAsset.get(mutableAsset));
|
|
38
|
-
}
|
|
39
|
-
function assetFromValue(value, options) {
|
|
40
|
-
return new Asset(value.committed ? new _CommittedAsset.default(value, options) : new _UncommittedAsset.default({
|
|
41
|
-
value,
|
|
42
|
-
options
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
class BaseAsset {
|
|
46
|
-
#asset;
|
|
47
|
-
#query /*: ?URLSearchParams */;
|
|
48
|
-
|
|
49
|
-
constructor(asset) {
|
|
50
|
-
this.#asset = asset;
|
|
51
|
-
_assetToAssetValue.set(this, asset.value);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// $FlowFixMe[unsupported-syntax]
|
|
55
|
-
[inspect]() {
|
|
56
|
-
return `Asset(${this.filePath})`;
|
|
57
|
-
}
|
|
58
|
-
get id() {
|
|
59
|
-
return this.#asset.value.id;
|
|
60
|
-
}
|
|
61
|
-
get type() {
|
|
62
|
-
return this.#asset.value.type;
|
|
63
|
-
}
|
|
64
|
-
get env() {
|
|
65
|
-
return new _Environment.default(this.#asset.value.env, this.#asset.options);
|
|
66
|
-
}
|
|
67
|
-
get fs() {
|
|
68
|
-
return this.#asset.options.inputFS;
|
|
69
|
-
}
|
|
70
|
-
get filePath() {
|
|
71
|
-
return (0, _projectPath.fromProjectPath)(this.#asset.options.projectRoot, this.#asset.value.filePath);
|
|
72
|
-
}
|
|
73
|
-
get query() {
|
|
74
|
-
if (!this.#query) {
|
|
75
|
-
this.#query = new URLSearchParams(this.#asset.value.query ?? '');
|
|
76
|
-
}
|
|
77
|
-
return this.#query;
|
|
78
|
-
}
|
|
79
|
-
get meta() {
|
|
80
|
-
return this.#asset.value.meta;
|
|
81
|
-
}
|
|
82
|
-
get bundleBehavior() {
|
|
83
|
-
let bundleBehavior = this.#asset.value.bundleBehavior;
|
|
84
|
-
return bundleBehavior == null ? null : _types.BundleBehaviorNames[bundleBehavior];
|
|
85
|
-
}
|
|
86
|
-
get isBundleSplittable() {
|
|
87
|
-
return this.#asset.value.isBundleSplittable;
|
|
88
|
-
}
|
|
89
|
-
get isSource() {
|
|
90
|
-
return this.#asset.value.isSource;
|
|
91
|
-
}
|
|
92
|
-
get sideEffects() {
|
|
93
|
-
return this.#asset.value.sideEffects;
|
|
94
|
-
}
|
|
95
|
-
get symbols() {
|
|
96
|
-
return new _Symbols.AssetSymbols(this.#asset.options, this.#asset.value);
|
|
97
|
-
}
|
|
98
|
-
get uniqueKey() {
|
|
99
|
-
return this.#asset.value.uniqueKey;
|
|
100
|
-
}
|
|
101
|
-
get astGenerator() {
|
|
102
|
-
return this.#asset.value.astGenerator;
|
|
103
|
-
}
|
|
104
|
-
get pipeline() {
|
|
105
|
-
return this.#asset.value.pipeline;
|
|
106
|
-
}
|
|
107
|
-
getDependencies() {
|
|
108
|
-
return this.#asset.getDependencies().map(dep => (0, _Dependency.getPublicDependency)(dep, this.#asset.options));
|
|
109
|
-
}
|
|
110
|
-
getCode() {
|
|
111
|
-
return this.#asset.getCode();
|
|
112
|
-
}
|
|
113
|
-
getBuffer() {
|
|
114
|
-
return this.#asset.getBuffer();
|
|
115
|
-
}
|
|
116
|
-
getStream() {
|
|
117
|
-
return this.#asset.getStream();
|
|
118
|
-
}
|
|
119
|
-
getMap() {
|
|
120
|
-
return this.#asset.getMap();
|
|
121
|
-
}
|
|
122
|
-
getAST() {
|
|
123
|
-
return this.#asset.getAST();
|
|
124
|
-
}
|
|
125
|
-
getMapBuffer() {
|
|
126
|
-
return this.#asset.getMapBuffer();
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
class Asset extends BaseAsset {
|
|
130
|
-
#asset /*: CommittedAsset | UncommittedAsset */;
|
|
131
|
-
#env /*: ?Environment */;
|
|
132
|
-
|
|
133
|
-
constructor(asset) {
|
|
134
|
-
let assetValueToAsset = asset.value.committed ? committedAssetValueToAsset : uncommittedAssetValueToAsset;
|
|
135
|
-
let existing = assetValueToAsset.get(asset.value);
|
|
136
|
-
if (existing != null) {
|
|
137
|
-
return existing;
|
|
138
|
-
}
|
|
139
|
-
super(asset);
|
|
140
|
-
this.#asset = asset;
|
|
141
|
-
assetValueToAsset.set(asset.value, this);
|
|
142
|
-
return this;
|
|
143
|
-
}
|
|
144
|
-
get env() {
|
|
145
|
-
this.#env ??= new _Environment.default(this.#asset.value.env, this.#asset.options);
|
|
146
|
-
return this.#env;
|
|
147
|
-
}
|
|
148
|
-
get stats() {
|
|
149
|
-
return this.#asset.value.stats;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
exports.Asset = Asset;
|
|
153
|
-
class MutableAsset extends BaseAsset {
|
|
154
|
-
#asset /*: UncommittedAsset */;
|
|
155
|
-
|
|
156
|
-
constructor(asset) {
|
|
157
|
-
let existing = assetValueToMutableAsset.get(asset.value);
|
|
158
|
-
if (existing != null) {
|
|
159
|
-
return existing;
|
|
160
|
-
}
|
|
161
|
-
super(asset);
|
|
162
|
-
this.#asset = asset;
|
|
163
|
-
assetValueToMutableAsset.set(asset.value, this);
|
|
164
|
-
_mutableAssetToUncommittedAsset.set(this, asset);
|
|
165
|
-
return this;
|
|
166
|
-
}
|
|
167
|
-
setMap(map) {
|
|
168
|
-
this.#asset.setMap(map);
|
|
169
|
-
}
|
|
170
|
-
get type() {
|
|
171
|
-
return this.#asset.value.type;
|
|
172
|
-
}
|
|
173
|
-
set type(type) {
|
|
174
|
-
if (type !== this.#asset.value.type) {
|
|
175
|
-
this.#asset.value.type = type;
|
|
176
|
-
this.#asset.updateId();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
get bundleBehavior() {
|
|
180
|
-
let bundleBehavior = this.#asset.value.bundleBehavior;
|
|
181
|
-
return bundleBehavior == null ? null : _types.BundleBehaviorNames[bundleBehavior];
|
|
182
|
-
}
|
|
183
|
-
set bundleBehavior(bundleBehavior) {
|
|
184
|
-
this.#asset.value.bundleBehavior = bundleBehavior ? _types.BundleBehavior[bundleBehavior] : null;
|
|
185
|
-
}
|
|
186
|
-
get isBundleSplittable() {
|
|
187
|
-
return this.#asset.value.isBundleSplittable;
|
|
188
|
-
}
|
|
189
|
-
set isBundleSplittable(isBundleSplittable) {
|
|
190
|
-
this.#asset.value.isBundleSplittable = isBundleSplittable;
|
|
191
|
-
}
|
|
192
|
-
get sideEffects() {
|
|
193
|
-
return this.#asset.value.sideEffects;
|
|
194
|
-
}
|
|
195
|
-
set sideEffects(sideEffects) {
|
|
196
|
-
this.#asset.value.sideEffects = sideEffects;
|
|
197
|
-
}
|
|
198
|
-
get uniqueKey() {
|
|
199
|
-
return this.#asset.value.uniqueKey;
|
|
200
|
-
}
|
|
201
|
-
set uniqueKey(uniqueKey) {
|
|
202
|
-
if (this.#asset.value.uniqueKey != null) {
|
|
203
|
-
throw new Error("Cannot change an asset's uniqueKey after it has been set.");
|
|
204
|
-
}
|
|
205
|
-
this.#asset.value.uniqueKey = uniqueKey;
|
|
206
|
-
}
|
|
207
|
-
get symbols() {
|
|
208
|
-
return new _Symbols.MutableAssetSymbols(this.#asset.options, this.#asset.value);
|
|
209
|
-
}
|
|
210
|
-
addDependency(dep) {
|
|
211
|
-
return this.#asset.addDependency(dep);
|
|
212
|
-
}
|
|
213
|
-
invalidateOnFileChange(filePath) {
|
|
214
|
-
this.#asset.invalidateOnFileChange((0, _projectPath.toProjectPath)(this.#asset.options.projectRoot, filePath));
|
|
215
|
-
}
|
|
216
|
-
invalidateOnFileCreate(invalidation) {
|
|
217
|
-
this.#asset.invalidateOnFileCreate(invalidation);
|
|
218
|
-
}
|
|
219
|
-
invalidateOnEnvChange(env) {
|
|
220
|
-
this.#asset.invalidateOnEnvChange(env);
|
|
221
|
-
}
|
|
222
|
-
invalidateOnStartup() {
|
|
223
|
-
this.#asset.invalidateOnStartup();
|
|
224
|
-
}
|
|
225
|
-
invalidateOnBuild() {
|
|
226
|
-
this.#asset.invalidateOnBuild();
|
|
227
|
-
}
|
|
228
|
-
isASTDirty() {
|
|
229
|
-
return this.#asset.isASTDirty;
|
|
230
|
-
}
|
|
231
|
-
setBuffer(buffer) {
|
|
232
|
-
this.#asset.setBuffer(buffer);
|
|
233
|
-
}
|
|
234
|
-
setCode(code) {
|
|
235
|
-
this.#asset.setCode(code);
|
|
236
|
-
}
|
|
237
|
-
setStream(stream) {
|
|
238
|
-
this.#asset.setStream(stream);
|
|
239
|
-
}
|
|
240
|
-
setAST(ast) {
|
|
241
|
-
return this.#asset.setAST(ast);
|
|
242
|
-
}
|
|
243
|
-
addURLDependency(url, opts) {
|
|
244
|
-
return this.addDependency({
|
|
245
|
-
specifier: url,
|
|
246
|
-
specifierType: 'url',
|
|
247
|
-
priority: 'lazy',
|
|
248
|
-
...opts
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
setEnvironment(env) {
|
|
252
|
-
this.#asset.value.env = (0, _Environment2.createEnvironment)({
|
|
253
|
-
...env,
|
|
254
|
-
loc: (0, _utils.toInternalSourceLocation)(this.#asset.options.projectRoot, env.loc)
|
|
255
|
-
});
|
|
256
|
-
this.#asset.updateId();
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
exports.MutableAsset = MutableAsset;
|
package/lib/public/Bundle.js
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PackagedBundle = exports.NamedBundle = exports.Bundle = void 0;
|
|
7
|
-
exports.bundleToInternalBundle = bundleToInternalBundle;
|
|
8
|
-
exports.bundleToInternalBundleGraph = bundleToInternalBundleGraph;
|
|
9
|
-
function _assert() {
|
|
10
|
-
const data = _interopRequireDefault(require("assert"));
|
|
11
|
-
_assert = function () {
|
|
12
|
-
return data;
|
|
13
|
-
};
|
|
14
|
-
return data;
|
|
15
|
-
}
|
|
16
|
-
function _nullthrows() {
|
|
17
|
-
const data = _interopRequireDefault(require("nullthrows"));
|
|
18
|
-
_nullthrows = function () {
|
|
19
|
-
return data;
|
|
20
|
-
};
|
|
21
|
-
return data;
|
|
22
|
-
}
|
|
23
|
-
function _utils() {
|
|
24
|
-
const data = require("@atlaspack/utils");
|
|
25
|
-
_utils = function () {
|
|
26
|
-
return data;
|
|
27
|
-
};
|
|
28
|
-
return data;
|
|
29
|
-
}
|
|
30
|
-
var _Asset = require("./Asset");
|
|
31
|
-
function _graph() {
|
|
32
|
-
const data = require("@atlaspack/graph");
|
|
33
|
-
_graph = function () {
|
|
34
|
-
return data;
|
|
35
|
-
};
|
|
36
|
-
return data;
|
|
37
|
-
}
|
|
38
|
-
var _Environment = _interopRequireDefault(require("./Environment"));
|
|
39
|
-
var _Dependency = require("./Dependency");
|
|
40
|
-
var _Target = _interopRequireDefault(require("./Target"));
|
|
41
|
-
var _types = require("../types");
|
|
42
|
-
var _projectPath = require("../projectPath");
|
|
43
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
44
|
-
const inspect = Symbol.for('nodejs.util.inspect.custom');
|
|
45
|
-
const internalBundleToBundle = new (_utils().DefaultWeakMap)(() => new (_utils().DefaultWeakMap)(() => new WeakMap()));
|
|
46
|
-
const internalBundleToNamedBundle = new (_utils().DefaultWeakMap)(() => new (_utils().DefaultWeakMap)(() => new WeakMap()));
|
|
47
|
-
const internalBundleToPackagedBundle = new (_utils().DefaultWeakMap)(() => new (_utils().DefaultWeakMap)(() => new WeakMap()));
|
|
48
|
-
|
|
49
|
-
// Friendly access for other modules within this package that need access
|
|
50
|
-
// to the internal bundle.
|
|
51
|
-
const _bundleToInternalBundle = new WeakMap();
|
|
52
|
-
function bundleToInternalBundle(bundle) {
|
|
53
|
-
return (0, _nullthrows().default)(_bundleToInternalBundle.get(bundle));
|
|
54
|
-
}
|
|
55
|
-
const _bundleToInternalBundleGraph = new WeakMap();
|
|
56
|
-
function bundleToInternalBundleGraph(bundle) {
|
|
57
|
-
return (0, _nullthrows().default)(_bundleToInternalBundleGraph.get(bundle));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Require this private object to be present when invoking these constructors,
|
|
61
|
-
// preventing others from using them. They should use the static `get` method.
|
|
62
|
-
let _private = {};
|
|
63
|
-
class Bundle {
|
|
64
|
-
#bundle /*: InternalBundle */;
|
|
65
|
-
#bundleGraph /*: BundleGraph */;
|
|
66
|
-
#options /*: AtlaspackOptions */;
|
|
67
|
-
|
|
68
|
-
// $FlowFixMe
|
|
69
|
-
[inspect]() {
|
|
70
|
-
return `Bundle(${this.#bundle.id})`;
|
|
71
|
-
}
|
|
72
|
-
constructor(sentinel, bundle, bundleGraph, options) {
|
|
73
|
-
if (sentinel !== _private) {
|
|
74
|
-
throw new Error('Unexpected public usage');
|
|
75
|
-
}
|
|
76
|
-
this.#bundle = bundle;
|
|
77
|
-
this.#bundleGraph = bundleGraph;
|
|
78
|
-
this.#options = options;
|
|
79
|
-
}
|
|
80
|
-
static get(internalBundle, bundleGraph, options) {
|
|
81
|
-
let existingMap = internalBundleToBundle.get(options).get(bundleGraph);
|
|
82
|
-
let existing = existingMap.get(internalBundle);
|
|
83
|
-
if (existing != null) {
|
|
84
|
-
return existing;
|
|
85
|
-
}
|
|
86
|
-
let bundle = new Bundle(_private, internalBundle, bundleGraph, options);
|
|
87
|
-
_bundleToInternalBundle.set(bundle, internalBundle);
|
|
88
|
-
_bundleToInternalBundleGraph.set(bundle, bundleGraph);
|
|
89
|
-
existingMap.set(internalBundle, bundle);
|
|
90
|
-
return bundle;
|
|
91
|
-
}
|
|
92
|
-
get id() {
|
|
93
|
-
return this.#bundle.id;
|
|
94
|
-
}
|
|
95
|
-
get hashReference() {
|
|
96
|
-
return this.#bundle.hashReference;
|
|
97
|
-
}
|
|
98
|
-
get type() {
|
|
99
|
-
return this.#bundle.type;
|
|
100
|
-
}
|
|
101
|
-
get env() {
|
|
102
|
-
return new _Environment.default(this.#bundle.env, this.#options);
|
|
103
|
-
}
|
|
104
|
-
get needsStableName() {
|
|
105
|
-
return this.#bundle.needsStableName;
|
|
106
|
-
}
|
|
107
|
-
get bundleBehavior() {
|
|
108
|
-
let bundleBehavior = this.#bundle.bundleBehavior;
|
|
109
|
-
return bundleBehavior != null ? _types.BundleBehaviorNames[bundleBehavior] : null;
|
|
110
|
-
}
|
|
111
|
-
get isSplittable() {
|
|
112
|
-
return this.#bundle.isSplittable;
|
|
113
|
-
}
|
|
114
|
-
get manualSharedBundle() {
|
|
115
|
-
return this.#bundle.manualSharedBundle;
|
|
116
|
-
}
|
|
117
|
-
get target() {
|
|
118
|
-
return new _Target.default(this.#bundle.target, this.#options);
|
|
119
|
-
}
|
|
120
|
-
hasAsset(asset) {
|
|
121
|
-
return this.#bundleGraph.bundleHasAsset(this.#bundle, (0, _Asset.assetToAssetValue)(asset));
|
|
122
|
-
}
|
|
123
|
-
hasDependency(dep) {
|
|
124
|
-
return this.#bundleGraph.bundleHasDependency(this.#bundle, (0, _Dependency.dependencyToInternalDependency)(dep));
|
|
125
|
-
}
|
|
126
|
-
getEntryAssets() {
|
|
127
|
-
return this.#bundle.entryAssetIds.map(id => {
|
|
128
|
-
let assetNode = this.#bundleGraph._graph.getNodeByContentKey(id);
|
|
129
|
-
(0, _assert().default)(assetNode != null && assetNode.type === 'asset');
|
|
130
|
-
return (0, _Asset.assetFromValue)(assetNode.value, this.#options);
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
getMainEntry() {
|
|
134
|
-
if (this.#bundle.mainEntryId != null) {
|
|
135
|
-
let assetNode = this.#bundleGraph._graph.getNodeByContentKey(this.#bundle.mainEntryId);
|
|
136
|
-
(0, _assert().default)(assetNode != null && assetNode.type === 'asset');
|
|
137
|
-
return (0, _Asset.assetFromValue)(assetNode.value, this.#options);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
traverse(visit) {
|
|
141
|
-
return this.#bundleGraph.traverseBundle(this.#bundle, (0, _graph().mapVisitor)(node => {
|
|
142
|
-
if (node.type === 'asset') {
|
|
143
|
-
return {
|
|
144
|
-
type: 'asset',
|
|
145
|
-
value: (0, _Asset.assetFromValue)(node.value, this.#options)
|
|
146
|
-
};
|
|
147
|
-
} else if (node.type === 'dependency') {
|
|
148
|
-
return {
|
|
149
|
-
type: 'dependency',
|
|
150
|
-
value: (0, _Dependency.getPublicDependency)(node.value, this.#options)
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
}, visit));
|
|
154
|
-
}
|
|
155
|
-
traverseAssets(visit, startAsset) {
|
|
156
|
-
return this.#bundleGraph.traverseAssets(this.#bundle, (0, _graph().mapVisitor)(asset => (0, _Asset.assetFromValue)(asset, this.#options), visit), startAsset ? (0, _Asset.assetToAssetValue)(startAsset) : undefined);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
exports.Bundle = Bundle;
|
|
160
|
-
class NamedBundle extends Bundle {
|
|
161
|
-
#bundle /*: InternalBundle */;
|
|
162
|
-
#bundleGraph /*: BundleGraph */;
|
|
163
|
-
#options /*: AtlaspackOptions */;
|
|
164
|
-
|
|
165
|
-
constructor(sentinel, bundle, bundleGraph, options) {
|
|
166
|
-
super(sentinel, bundle, bundleGraph, options);
|
|
167
|
-
this.#bundle = bundle; // Repeating for flow
|
|
168
|
-
this.#bundleGraph = bundleGraph; // Repeating for flow
|
|
169
|
-
this.#options = options;
|
|
170
|
-
}
|
|
171
|
-
static get(internalBundle, bundleGraph, options) {
|
|
172
|
-
let existingMap = internalBundleToNamedBundle.get(options).get(bundleGraph);
|
|
173
|
-
let existing = existingMap.get(internalBundle);
|
|
174
|
-
if (existing != null) {
|
|
175
|
-
return existing;
|
|
176
|
-
}
|
|
177
|
-
let namedBundle = new NamedBundle(_private, internalBundle, bundleGraph, options);
|
|
178
|
-
_bundleToInternalBundle.set(namedBundle, internalBundle);
|
|
179
|
-
_bundleToInternalBundleGraph.set(namedBundle, bundleGraph);
|
|
180
|
-
existingMap.set(internalBundle, namedBundle);
|
|
181
|
-
return namedBundle;
|
|
182
|
-
}
|
|
183
|
-
get name() {
|
|
184
|
-
return (0, _nullthrows().default)(this.#bundle.name);
|
|
185
|
-
}
|
|
186
|
-
get displayName() {
|
|
187
|
-
return (0, _nullthrows().default)(this.#bundle.displayName);
|
|
188
|
-
}
|
|
189
|
-
get publicId() {
|
|
190
|
-
return (0, _nullthrows().default)(this.#bundle.publicId);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
exports.NamedBundle = NamedBundle;
|
|
194
|
-
class PackagedBundle extends NamedBundle {
|
|
195
|
-
#bundle /*: InternalBundle */;
|
|
196
|
-
#bundleGraph /*: BundleGraph */;
|
|
197
|
-
#options /*: AtlaspackOptions */;
|
|
198
|
-
#bundleInfo /*: ?PackagedBundleInfo */;
|
|
199
|
-
|
|
200
|
-
constructor(sentinel, bundle, bundleGraph, options) {
|
|
201
|
-
super(sentinel, bundle, bundleGraph, options);
|
|
202
|
-
this.#bundle = bundle; // Repeating for flow
|
|
203
|
-
this.#bundleGraph = bundleGraph; // Repeating for flow
|
|
204
|
-
this.#options = options; // Repeating for flow
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
static get(internalBundle, bundleGraph, options) {
|
|
208
|
-
let existingMap = internalBundleToPackagedBundle.get(options).get(bundleGraph);
|
|
209
|
-
let existing = existingMap.get(internalBundle);
|
|
210
|
-
if (existing != null) {
|
|
211
|
-
return existing;
|
|
212
|
-
}
|
|
213
|
-
let packagedBundle = new PackagedBundle(_private, internalBundle, bundleGraph, options);
|
|
214
|
-
_bundleToInternalBundle.set(packagedBundle, internalBundle);
|
|
215
|
-
_bundleToInternalBundleGraph.set(packagedBundle, bundleGraph);
|
|
216
|
-
existingMap.set(internalBundle, packagedBundle);
|
|
217
|
-
return packagedBundle;
|
|
218
|
-
}
|
|
219
|
-
static getWithInfo(internalBundle, bundleGraph, options, bundleInfo) {
|
|
220
|
-
let packagedBundle = PackagedBundle.get(internalBundle, bundleGraph, options);
|
|
221
|
-
packagedBundle.#bundleInfo = bundleInfo;
|
|
222
|
-
return packagedBundle;
|
|
223
|
-
}
|
|
224
|
-
get filePath() {
|
|
225
|
-
return (0, _projectPath.fromProjectPath)(this.#options.projectRoot, (0, _nullthrows().default)(this.#bundleInfo).filePath);
|
|
226
|
-
}
|
|
227
|
-
get type() {
|
|
228
|
-
// The bundle type may be overridden in the packager.
|
|
229
|
-
// However, inline bundles will not have a bundleInfo here since they are not written to the filesystem.
|
|
230
|
-
return this.#bundleInfo ? this.#bundleInfo.type : this.#bundle.type;
|
|
231
|
-
}
|
|
232
|
-
get stats() {
|
|
233
|
-
return (0, _nullthrows().default)(this.#bundleInfo).stats;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
exports.PackagedBundle = PackagedBundle;
|