@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.
Files changed (85) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/package.json +20 -20
  3. package/src/Atlaspack.js +3 -2
  4. package/src/atlaspack-v3/AtlaspackV3.js +25 -9
  5. package/src/requests/WriteBundlesRequest.js +31 -22
  6. package/LICENSE +0 -201
  7. package/lib/AssetGraph.js +0 -521
  8. package/lib/Atlaspack.js +0 -676
  9. package/lib/AtlaspackConfig.js +0 -298
  10. package/lib/AtlaspackConfig.schema.js +0 -103
  11. package/lib/BundleGraph.js +0 -1527
  12. package/lib/CommittedAsset.js +0 -155
  13. package/lib/Dependency.js +0 -136
  14. package/lib/Environment.js +0 -144
  15. package/lib/IdentifierRegistry.js +0 -36
  16. package/lib/InternalConfig.js +0 -56
  17. package/lib/PackagerRunner.js +0 -525
  18. package/lib/ReporterRunner.js +0 -151
  19. package/lib/RequestTracker.js +0 -1178
  20. package/lib/SymbolPropagation.js +0 -618
  21. package/lib/TargetDescriptor.schema.js +0 -118
  22. package/lib/Transformation.js +0 -522
  23. package/lib/UncommittedAsset.js +0 -348
  24. package/lib/Validation.js +0 -203
  25. package/lib/applyRuntimes.js +0 -355
  26. package/lib/assetUtils.js +0 -205
  27. package/lib/atlaspack-v3/AtlaspackV3.js +0 -57
  28. package/lib/atlaspack-v3/NapiWorkerPool.js +0 -71
  29. package/lib/atlaspack-v3/fs.js +0 -39
  30. package/lib/atlaspack-v3/index.js +0 -26
  31. package/lib/atlaspack-v3/jsCallable.js +0 -20
  32. package/lib/atlaspack-v3/worker/compat/asset-symbols.js +0 -197
  33. package/lib/atlaspack-v3/worker/compat/bitflags.js +0 -84
  34. package/lib/atlaspack-v3/worker/compat/dependency.js +0 -44
  35. package/lib/atlaspack-v3/worker/compat/environment.js +0 -57
  36. package/lib/atlaspack-v3/worker/compat/index.js +0 -104
  37. package/lib/atlaspack-v3/worker/compat/mutable-asset.js +0 -164
  38. package/lib/atlaspack-v3/worker/compat/plugin-config.js +0 -78
  39. package/lib/atlaspack-v3/worker/compat/plugin-logger.js +0 -29
  40. package/lib/atlaspack-v3/worker/compat/plugin-options.js +0 -113
  41. package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +0 -12
  42. package/lib/atlaspack-v3/worker/compat/target.js +0 -17
  43. package/lib/atlaspack-v3/worker/index.js +0 -3
  44. package/lib/atlaspack-v3/worker/worker.js +0 -280
  45. package/lib/constants.js +0 -21
  46. package/lib/dumpGraphToGraphViz.js +0 -206
  47. package/lib/index.js +0 -70
  48. package/lib/loadAtlaspackPlugin.js +0 -115
  49. package/lib/loadDotEnv.js +0 -54
  50. package/lib/projectPath.js +0 -112
  51. package/lib/public/Asset.js +0 -259
  52. package/lib/public/Bundle.js +0 -236
  53. package/lib/public/BundleGraph.js +0 -279
  54. package/lib/public/BundleGroup.js +0 -50
  55. package/lib/public/Config.js +0 -202
  56. package/lib/public/Dependency.js +0 -131
  57. package/lib/public/Environment.js +0 -247
  58. package/lib/public/MutableBundleGraph.js +0 -204
  59. package/lib/public/PluginOptions.js +0 -71
  60. package/lib/public/Symbols.js +0 -247
  61. package/lib/public/Target.js +0 -64
  62. package/lib/registerCoreWithSerializer.js +0 -51
  63. package/lib/requests/AssetGraphRequest.js +0 -432
  64. package/lib/requests/AssetGraphRequestRust.js +0 -220
  65. package/lib/requests/AssetRequest.js +0 -132
  66. package/lib/requests/AtlaspackBuildRequest.js +0 -79
  67. package/lib/requests/AtlaspackConfigRequest.js +0 -479
  68. package/lib/requests/BundleGraphRequest.js +0 -485
  69. package/lib/requests/ConfigRequest.js +0 -203
  70. package/lib/requests/DevDepRequest.js +0 -193
  71. package/lib/requests/EntryRequest.js +0 -295
  72. package/lib/requests/PackageRequest.js +0 -88
  73. package/lib/requests/PathRequest.js +0 -357
  74. package/lib/requests/TargetRequest.js +0 -1179
  75. package/lib/requests/ValidationRequest.js +0 -66
  76. package/lib/requests/WriteBundleRequest.js +0 -252
  77. package/lib/requests/WriteBundlesRequest.js +0 -153
  78. package/lib/requests/asset-graph-diff.js +0 -128
  79. package/lib/requests/asset-graph-dot.js +0 -131
  80. package/lib/resolveOptions.js +0 -265
  81. package/lib/serializerCore.browser.js +0 -29
  82. package/lib/summarizeRequest.js +0 -55
  83. package/lib/types.js +0 -35
  84. package/lib/utils.js +0 -160
  85. package/lib/worker.js +0 -184
@@ -1,247 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.ISOLATED_ENVS = exports.BROWSER_ENVS = void 0;
7
- exports.environmentToInternalEnvironment = environmentToInternalEnvironment;
8
- function _nullthrows() {
9
- const data = _interopRequireDefault(require("nullthrows"));
10
- _nullthrows = function () {
11
- return data;
12
- };
13
- return data;
14
- }
15
- function _browserslist() {
16
- const data = _interopRequireDefault(require("browserslist"));
17
- _browserslist = function () {
18
- return data;
19
- };
20
- return data;
21
- }
22
- function _semver() {
23
- const data = _interopRequireDefault(require("semver"));
24
- _semver = function () {
25
- return data;
26
- };
27
- return data;
28
- }
29
- var _utils = require("../utils");
30
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
- const inspect = Symbol.for('nodejs.util.inspect.custom');
32
- const BROWSER_ENVS = exports.BROWSER_ENVS = new Set(['browser', 'web-worker', 'service-worker', 'worklet', 'electron-renderer']);
33
- const ELECTRON_ENVS = new Set(['electron-main', 'electron-renderer']);
34
- const NODE_ENVS = new Set(['node', ...ELECTRON_ENVS]);
35
- const WORKER_ENVS = new Set(['web-worker', 'service-worker']);
36
- const ISOLATED_ENVS = exports.ISOLATED_ENVS = new Set([...WORKER_ENVS, 'worklet']);
37
- const ALL_BROWSERS = ['chrome', 'and_chr', 'edge', 'firefox', 'and_ff', 'safari', 'ios', 'samsung', 'opera', 'ie', 'op_mini', 'blackberry', 'op_mob', 'ie_mob', 'and_uc', 'and_qq', 'baidu', 'kaios'];
38
-
39
- // See require("caniuse-api").getSupport(<feature name>)
40
- const supportData = {
41
- esmodules: {
42
- edge: '16',
43
- firefox: '60',
44
- chrome: '61',
45
- safari: '10.1',
46
- opera: '48',
47
- ios: '10.3',
48
- android: '76',
49
- and_chr: '76',
50
- and_ff: '68',
51
- samsung: '8.2',
52
- and_qq: '10.4',
53
- op_mob: '64'
54
- },
55
- 'dynamic-import': {
56
- edge: '76',
57
- firefox: '67',
58
- chrome: '63',
59
- safari: '11.1',
60
- opera: '50',
61
- ios: '11.3',
62
- android: '63',
63
- and_chr: '63',
64
- and_ff: '67',
65
- samsung: '8',
66
- and_qq: '10.4',
67
- op_mob: '64'
68
- },
69
- 'worker-module': {
70
- edge: '80',
71
- chrome: '80',
72
- opera: '67',
73
- android: '81',
74
- and_chr: '86'
75
- },
76
- 'service-worker-module': {
77
- // TODO: Safari 14.1??
78
- },
79
- 'import-meta-url': {
80
- edge: '79',
81
- firefox: '62',
82
- chrome: '64',
83
- safari: '11.1',
84
- opera: '51',
85
- ios: '12',
86
- android: '64',
87
- and_chr: '64',
88
- and_ff: '62',
89
- samsung: '9.2',
90
- and_qq: '10.4',
91
- op_mob: '64'
92
- },
93
- 'arrow-functions': {
94
- chrome: '47',
95
- opera: '34',
96
- edge: '13',
97
- firefox: '45',
98
- safari: '10',
99
- node: '6',
100
- ios: '10',
101
- samsung: '5',
102
- electron: '0.36',
103
- android: '50',
104
- qq: '10.4',
105
- baidu: '7.12',
106
- kaios: '2.5',
107
- and_chr: '50',
108
- and_qq: '12.12',
109
- op_mob: '64'
110
- },
111
- 'global-this': {
112
- chrome: '75',
113
- edge: '79',
114
- safari: '12.1',
115
- firefox: '65',
116
- opera: '58',
117
- node: '12',
118
- and_chr: '71',
119
- ios: '12.2',
120
- android: '71',
121
- samsung: '10.1'
122
- }
123
- };
124
- const internalEnvironmentToEnvironment = new WeakMap();
125
- const _environmentToInternalEnvironment = new WeakMap();
126
- function environmentToInternalEnvironment(environment) {
127
- return (0, _nullthrows().default)(_environmentToInternalEnvironment.get(environment));
128
- }
129
- class Environment {
130
- #environment /*: InternalEnvironment */;
131
- #options /*: AtlaspackOptions */;
132
-
133
- constructor(env, options) {
134
- let existing = internalEnvironmentToEnvironment.get(env);
135
- if (existing != null) {
136
- return existing;
137
- }
138
- this.#environment = env;
139
- this.#options = options;
140
- _environmentToInternalEnvironment.set(this, env);
141
- internalEnvironmentToEnvironment.set(env, this);
142
- return this;
143
- }
144
- get id() {
145
- return this.#environment.id;
146
- }
147
- get context() {
148
- return this.#environment.context;
149
- }
150
- get engines() {
151
- return this.#environment.engines;
152
- }
153
- get includeNodeModules() {
154
- return this.#environment.includeNodeModules;
155
- }
156
- get outputFormat() {
157
- return this.#environment.outputFormat;
158
- }
159
- get sourceType() {
160
- return this.#environment.sourceType;
161
- }
162
- get isLibrary() {
163
- return this.#environment.isLibrary;
164
- }
165
- get shouldOptimize() {
166
- return this.#environment.shouldOptimize;
167
- }
168
- get shouldScopeHoist() {
169
- return this.#environment.shouldScopeHoist;
170
- }
171
- get sourceMap() {
172
- return this.#environment.sourceMap;
173
- }
174
- get loc() {
175
- return (0, _utils.fromInternalSourceLocation)(this.#options.projectRoot, this.#environment.loc);
176
- }
177
- get unstableSingleFileOutput() {
178
- return this.#environment.unstableSingleFileOutput;
179
- }
180
-
181
- // $FlowFixMe[unsupported-syntax]
182
- [inspect]() {
183
- return `Env(${this.#environment.context})`;
184
- }
185
- isBrowser() {
186
- return BROWSER_ENVS.has(this.#environment.context);
187
- }
188
- isNode() {
189
- return NODE_ENVS.has(this.#environment.context);
190
- }
191
- isElectron() {
192
- return ELECTRON_ENVS.has(this.#environment.context);
193
- }
194
- isIsolated() {
195
- return ISOLATED_ENVS.has(this.#environment.context);
196
- }
197
- isWorker() {
198
- return WORKER_ENVS.has(this.#environment.context);
199
- }
200
- isWorklet() {
201
- return this.#environment.context === 'worklet';
202
- }
203
- matchesEngines(minVersions, defaultValue = false) {
204
- // Determine if the environment matches some minimum version requirements.
205
- // For browsers, we run a browserslist query with and without the minimum
206
- // required browsers and compare the lists. For node, we just check semver.
207
- if (this.isBrowser() && this.engines.browsers != null) {
208
- let targetBrowsers = this.engines.browsers;
209
- let browsers = targetBrowsers != null && !Array.isArray(targetBrowsers) ? [targetBrowsers] : targetBrowsers;
210
-
211
- // If outputting esmodules, exclude browsers without support.
212
- if (this.outputFormat === 'esmodule') {
213
- browsers = [...browsers, ...getExcludedBrowsers(supportData.esmodules)];
214
- }
215
- let matchedBrowsers = (0, _browserslist().default)(browsers);
216
- if (matchedBrowsers.length === 0) {
217
- return false;
218
- }
219
- let minBrowsers = getExcludedBrowsers(minVersions);
220
- let withoutMinBrowsers = (0, _browserslist().default)([...browsers, ...minBrowsers]);
221
- return matchedBrowsers.length === withoutMinBrowsers.length;
222
- } else if (this.isNode() && this.engines.node != null) {
223
- return minVersions.node != null && !_semver().default.intersects(`< ${minVersions.node}`, this.engines.node);
224
- }
225
- return defaultValue;
226
- }
227
- supports(feature, defaultValue) {
228
- let engines = supportData[feature];
229
- if (!engines) {
230
- throw new Error('Unknown environment feature: ' + feature);
231
- }
232
- return this.matchesEngines(engines, defaultValue);
233
- }
234
- }
235
- exports.default = Environment;
236
- function getExcludedBrowsers(minVersions) {
237
- let browsers = [];
238
- for (let browser of ALL_BROWSERS) {
239
- let version = minVersions[browser];
240
- if (version) {
241
- browsers.push(`not ${browser} < ${version}`);
242
- } else {
243
- browsers.push(`not ${browser} > 0`);
244
- }
245
- }
246
- return browsers;
247
- }
@@ -1,204 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- function _assert() {
8
- const data = _interopRequireDefault(require("assert"));
9
- _assert = function () {
10
- return data;
11
- };
12
- return data;
13
- }
14
- function _nullthrows() {
15
- const data = _interopRequireDefault(require("nullthrows"));
16
- _nullthrows = function () {
17
- return data;
18
- };
19
- return data;
20
- }
21
- function _rust() {
22
- const data = require("@atlaspack/rust");
23
- _rust = function () {
24
- return data;
25
- };
26
- return data;
27
- }
28
- var _BundleGraph = _interopRequireDefault(require("./BundleGraph"));
29
- var _BundleGraph2 = _interopRequireWildcard(require("../BundleGraph"));
30
- var _Bundle = require("./Bundle");
31
- var _Asset = require("./Asset");
32
- var _utils = require("../utils");
33
- var _Dependency = _interopRequireWildcard(require("./Dependency"));
34
- var _Environment = require("./Environment");
35
- var _Target = require("./Target");
36
- var _constants = require("../constants");
37
- var _projectPath = require("../projectPath");
38
- var _types = require("../types");
39
- var _BundleGroup = _interopRequireWildcard(require("./BundleGroup"));
40
- var _IdentifierRegistry = require("../IdentifierRegistry");
41
- 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); }
42
- 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; }
43
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
44
- function createBundleId(data) {
45
- const {
46
- entryAssetId,
47
- uniqueKey,
48
- distDir,
49
- bundleBehavior
50
- } = data;
51
- const id = (0, _rust().hashString)(`bundle:${String(entryAssetId != null ? entryAssetId : uniqueKey)}${(0, _projectPath.fromProjectPathRelative)(distDir)}${bundleBehavior ?? ''}`);
52
- _IdentifierRegistry.identifierRegistry.addIdentifier('bundle', id, data);
53
- return id;
54
- }
55
- class MutableBundleGraph extends _BundleGraph.default {
56
- #graph /*: InternalBundleGraph */;
57
- #options /*: AtlaspackOptions */;
58
- #bundlePublicIds /*: Set<string> */ = new Set();
59
- constructor(graph, options) {
60
- super(graph, _Bundle.Bundle.get.bind(_Bundle.Bundle), options);
61
- this.#graph = graph;
62
- this.#options = options;
63
- }
64
- addAssetToBundle(asset, bundle) {
65
- this.#graph.addAssetToBundle((0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle));
66
- }
67
- addAssetGraphToBundle(asset, bundle, shouldSkipDependency) {
68
- this.#graph.addAssetGraphToBundle((0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle), shouldSkipDependency ? d => shouldSkipDependency(new _Dependency.default(d, this.#options)) : undefined);
69
- }
70
- addEntryToBundle(asset, bundle, shouldSkipDependency) {
71
- this.#graph.addEntryToBundle((0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle), shouldSkipDependency ? d => shouldSkipDependency(new _Dependency.default(d, this.#options)) : undefined);
72
- }
73
- createBundleGroup(dependency, target) {
74
- let dependencyNode = this.#graph._graph.getNodeByContentKey(dependency.id);
75
- if (!dependencyNode) {
76
- throw new Error('Dependency not found');
77
- }
78
- (0, _assert().default)(dependencyNode.type === 'dependency');
79
- let resolved = this.#graph.getResolvedAsset((0, _Dependency.dependencyToInternalDependency)(dependency));
80
- if (!resolved) {
81
- throw new Error('Dependency did not resolve to an asset ' + dependency.id);
82
- }
83
- let bundleGroup = {
84
- target: (0, _Target.targetToInternalTarget)(target),
85
- entryAssetId: resolved.id
86
- };
87
- let bundleGroupKey = (0, _utils.getBundleGroupId)(bundleGroup);
88
- let bundleGroupNodeId = this.#graph._graph.hasContentKey(bundleGroupKey) ? this.#graph._graph.getNodeIdByContentKey(bundleGroupKey) : this.#graph._graph.addNodeByContentKey(bundleGroupKey, {
89
- id: bundleGroupKey,
90
- type: 'bundle_group',
91
- value: bundleGroup
92
- });
93
- let dependencyNodeId = this.#graph._graph.getNodeIdByContentKey(dependencyNode.id);
94
- let resolvedNodeId = this.#graph._graph.getNodeIdByContentKey(resolved.id);
95
- let assetNodes = this.#graph._graph.getNodeIdsConnectedFrom(dependencyNodeId);
96
- this.#graph._graph.addEdge(dependencyNodeId, bundleGroupNodeId);
97
- this.#graph._graph.replaceNodeIdsConnectedTo(bundleGroupNodeId, assetNodes);
98
- this.#graph._graph.addEdge(dependencyNodeId, resolvedNodeId, _BundleGraph2.bundleGraphEdgeTypes.references);
99
- if (
100
- // This check is needed for multiple targets, when we go over the same nodes twice
101
- this.#graph._graph.hasEdge(dependencyNodeId, resolvedNodeId, _BundleGraph2.bundleGraphEdgeTypes.null)) {
102
- //nullEdgeType
103
- this.#graph._graph.removeEdge(dependencyNodeId, resolvedNodeId);
104
- }
105
- if (dependency.isEntry) {
106
- this.#graph._graph.addEdge((0, _nullthrows().default)(this.#graph._graph.rootNodeId), bundleGroupNodeId, _BundleGraph2.bundleGraphEdgeTypes.bundle);
107
- } else {
108
- let inboundBundleNodeIds = this.#graph._graph.getNodeIdsConnectedTo(dependencyNodeId, _BundleGraph2.bundleGraphEdgeTypes.contains);
109
- for (let inboundBundleNodeId of inboundBundleNodeIds) {
110
- var _this$graph$_graph$ge;
111
- (0, _assert().default)(((_this$graph$_graph$ge = this.#graph._graph.getNode(inboundBundleNodeId)) === null || _this$graph$_graph$ge === void 0 ? void 0 : _this$graph$_graph$ge.type) === 'bundle');
112
- this.#graph._graph.addEdge(inboundBundleNodeId, bundleGroupNodeId, _BundleGraph2.bundleGraphEdgeTypes.bundle);
113
- }
114
- }
115
- return new _BundleGroup.default(bundleGroup, this.#options);
116
- }
117
- removeBundleGroup(bundleGroup) {
118
- this.#graph.removeBundleGroup((0, _BundleGroup.bundleGroupToInternalBundleGroup)(bundleGroup));
119
- }
120
- internalizeAsyncDependency(bundle, dependency) {
121
- this.#graph.internalizeAsyncDependency((0, _Bundle.bundleToInternalBundle)(bundle), (0, _Dependency.dependencyToInternalDependency)(dependency));
122
- }
123
- createBundle(opts) {
124
- let entryAsset = opts.entryAsset ? (0, _Asset.assetToAssetValue)(opts.entryAsset) : null;
125
- let target = (0, _Target.targetToInternalTarget)(opts.target);
126
- let bundleId = createBundleId({
127
- entryAssetId: (entryAsset === null || entryAsset === void 0 ? void 0 : entryAsset.id) ?? null,
128
- uniqueKey: opts.uniqueKey ?? null,
129
- distDir: target.distDir,
130
- bundleBehavior: opts.bundleBehavior ?? null
131
- });
132
- let existing = this.#graph._graph.getNodeByContentKey(bundleId);
133
- if (existing != null) {
134
- (0, _assert().default)(existing.type === 'bundle');
135
- return _Bundle.Bundle.get(existing.value, this.#graph, this.#options);
136
- }
137
- let publicId = (0, _utils.getPublicId)(bundleId, existing => this.#bundlePublicIds.has(existing));
138
- this.#bundlePublicIds.add(publicId);
139
- let isPlaceholder = false;
140
- if (entryAsset) {
141
- let entryAssetNode = this.#graph._graph.getNodeByContentKey(entryAsset.id);
142
- (0, _assert().default)((entryAssetNode === null || entryAssetNode === void 0 ? void 0 : entryAssetNode.type) === 'asset', 'Entry asset does not exist');
143
- isPlaceholder = entryAssetNode.requested === false;
144
- }
145
- let bundleNode = {
146
- type: 'bundle',
147
- id: bundleId,
148
- value: {
149
- id: bundleId,
150
- hashReference: this.#options.shouldContentHash ? _constants.HASH_REF_PREFIX + bundleId : bundleId.slice(-8),
151
- type: opts.entryAsset ? opts.entryAsset.type : opts.type,
152
- env: opts.env ? (0, _Environment.environmentToInternalEnvironment)(opts.env) : (0, _nullthrows().default)(entryAsset).env,
153
- entryAssetIds: entryAsset ? [entryAsset.id] : [],
154
- mainEntryId: entryAsset === null || entryAsset === void 0 ? void 0 : entryAsset.id,
155
- pipeline: opts.entryAsset ? opts.entryAsset.pipeline : opts.pipeline,
156
- needsStableName: opts.needsStableName,
157
- bundleBehavior: opts.bundleBehavior != null ? _types.BundleBehavior[opts.bundleBehavior] : null,
158
- isSplittable: opts.entryAsset ? opts.entryAsset.isBundleSplittable : opts.isSplittable,
159
- isPlaceholder,
160
- target,
161
- name: null,
162
- displayName: null,
163
- publicId,
164
- manualSharedBundle: opts.manualSharedBundle
165
- }
166
- };
167
- let bundleNodeId = this.#graph._graph.addNodeByContentKey(bundleId, bundleNode);
168
- if (opts.entryAsset) {
169
- this.#graph._graph.addEdge(bundleNodeId, this.#graph._graph.getNodeIdByContentKey(opts.entryAsset.id));
170
- }
171
- return _Bundle.Bundle.get(bundleNode.value, this.#graph, this.#options);
172
- }
173
- addBundleToBundleGroup(bundle, bundleGroup) {
174
- this.#graph.addBundleToBundleGroup((0, _Bundle.bundleToInternalBundle)(bundle), (0, _BundleGroup.bundleGroupToInternalBundleGroup)(bundleGroup));
175
- }
176
- createAssetReference(dependency, asset, bundle) {
177
- return this.#graph.createAssetReference((0, _Dependency.dependencyToInternalDependency)(dependency), (0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle));
178
- }
179
- createBundleReference(from, to) {
180
- return this.#graph.createBundleReference((0, _Bundle.bundleToInternalBundle)(from), (0, _Bundle.bundleToInternalBundle)(to));
181
- }
182
- createBundleConditionalReference(from, to) {
183
- return this.#graph.createBundleConditionalReference((0, _Bundle.bundleToInternalBundle)(from), (0, _Bundle.bundleToInternalBundle)(to));
184
- }
185
- getDependencyAssets(dependency) {
186
- return this.#graph.getDependencyAssets((0, _Dependency.dependencyToInternalDependency)(dependency)).map(asset => (0, _Asset.assetFromValue)(asset, this.#options));
187
- }
188
- getBundleGroupsContainingBundle(bundle) {
189
- return this.#graph.getBundleGroupsContainingBundle((0, _Bundle.bundleToInternalBundle)(bundle)).map(bundleGroup => new _BundleGroup.default(bundleGroup, this.#options));
190
- }
191
- getParentBundlesOfBundleGroup(bundleGroup) {
192
- return this.#graph.getParentBundlesOfBundleGroup((0, _BundleGroup.bundleGroupToInternalBundleGroup)(bundleGroup)).map(bundle => _Bundle.Bundle.get(bundle, this.#graph, this.#options));
193
- }
194
- getTotalSize(asset) {
195
- return this.#graph.getTotalSize((0, _Asset.assetToAssetValue)(asset));
196
- }
197
- isAssetReachableFromBundle(asset, bundle) {
198
- return this.#graph.isAssetReachableFromBundle((0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle));
199
- }
200
- removeAssetGraphFromBundle(asset, bundle) {
201
- this.#graph.removeAssetGraphFromBundle((0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle));
202
- }
203
- }
204
- exports.default = MutableBundleGraph;
@@ -1,71 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- let parcelOptionsToPluginOptions = new WeakMap();
8
- class PluginOptions {
9
- #options /*: AtlaspackOptions */;
10
-
11
- constructor(options) {
12
- let existing = parcelOptionsToPluginOptions.get(options);
13
- if (existing != null) {
14
- return existing;
15
- }
16
- this.#options = options;
17
- parcelOptionsToPluginOptions.set(options, this);
18
- return this;
19
- }
20
- get instanceId() {
21
- return this.#options.instanceId;
22
- }
23
- get mode() {
24
- return this.#options.mode;
25
- }
26
- get env() {
27
- return this.#options.env;
28
- }
29
- get parcelVersion() {
30
- return this.#options.parcelVersion;
31
- }
32
- get hmrOptions() {
33
- return this.#options.hmrOptions;
34
- }
35
- get serveOptions() {
36
- return this.#options.serveOptions;
37
- }
38
- get shouldBuildLazily() {
39
- return this.#options.shouldBuildLazily;
40
- }
41
- get shouldAutoInstall() {
42
- return this.#options.shouldAutoInstall;
43
- }
44
- get logLevel() {
45
- return this.#options.logLevel;
46
- }
47
- get cacheDir() {
48
- // TODO: remove this. Probably bad if there are other types of caches.
49
- // Maybe expose the Cache object instead?
50
- return this.#options.cacheDir;
51
- }
52
- get projectRoot() {
53
- return this.#options.projectRoot;
54
- }
55
- get inputFS() {
56
- return this.#options.inputFS;
57
- }
58
- get outputFS() {
59
- return this.#options.outputFS;
60
- }
61
- get packageManager() {
62
- return this.#options.packageManager;
63
- }
64
- get detailedReport() {
65
- return this.#options.detailedReport;
66
- }
67
- get featureFlags() {
68
- return this.#options.featureFlags;
69
- }
70
- }
71
- exports.default = PluginOptions;