@atlaspack/core 2.23.6-dev-export-func-opt-b714be46e.0 → 2.24.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 CHANGED
@@ -1,5 +1,35 @@
1
1
  # @atlaspack/core
2
2
 
3
+ ## 2.24.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#767](https://github.com/atlassian-labs/atlaspack/pull/767) [`038e87a`](https://github.com/atlassian-labs/atlaspack/commit/038e87a7858d39556d59d3a2d17db534d45f62c6) Thanks [@marcins](https://github.com/marcins)! - Implement a new feature `allowExplicitTargetEntries` where entries provided as entries can be filtered by the source property in targets to allow different targets to be built for different subsets of entries.
8
+
9
+ - [#769](https://github.com/atlassian-labs/atlaspack/pull/769) [`f6532d7`](https://github.com/atlassian-labs/atlaspack/commit/f6532d7a4f7f007bd4e5e36af04dd466f0b9f572) Thanks [@marcins](https://github.com/marcins)! - Adds a new feature to support adding custom `env` properties in a target, that are available in the Environment during the build. A new feature flag `customEnvInTargets` has been added to gate this feature.
10
+
11
+ ### Patch Changes
12
+
13
+ - [#780](https://github.com/atlassian-labs/atlaspack/pull/780) [`eedcbc4`](https://github.com/atlassian-labs/atlaspack/commit/eedcbc408fc1e86a2a8e25f1a41c57146d8529e1) Thanks [@JakeLane](https://github.com/JakeLane)! - Fix isStaticBindingSafe in v3
14
+
15
+ - [#776](https://github.com/atlassian-labs/atlaspack/pull/776) [`5a0363f`](https://github.com/atlassian-labs/atlaspack/commit/5a0363f1086e81068959b87e92064bed5a11a9b4) Thanks [@benjervis](https://github.com/benjervis)! - Guard against empty buffers being returned from JS workers, when using the V3 asset graph build
16
+
17
+ - [#771](https://github.com/atlassian-labs/atlaspack/pull/771) [`8604d2a`](https://github.com/atlassian-labs/atlaspack/commit/8604d2a49ace5e9194ec4f76e71f06b93610f6b4) Thanks [@benjervis](https://github.com/benjervis)! - Fixes a small error with inline bundle packaging resulting from an incorrect comparison.
18
+
19
+ - Updated dependencies [[`7a52bab`](https://github.com/atlassian-labs/atlaspack/commit/7a52bab6281e8edbfa66af248eb6f872c6b4b7bd), [`eedcbc4`](https://github.com/atlassian-labs/atlaspack/commit/eedcbc408fc1e86a2a8e25f1a41c57146d8529e1), [`5a0363f`](https://github.com/atlassian-labs/atlaspack/commit/5a0363f1086e81068959b87e92064bed5a11a9b4), [`038e87a`](https://github.com/atlassian-labs/atlaspack/commit/038e87a7858d39556d59d3a2d17db534d45f62c6), [`f6532d7`](https://github.com/atlassian-labs/atlaspack/commit/f6532d7a4f7f007bd4e5e36af04dd466f0b9f572), [`0684997`](https://github.com/atlassian-labs/atlaspack/commit/0684997c127a6204af1376b36e556fddd1ba5557), [`602f8ed`](https://github.com/atlassian-labs/atlaspack/commit/602f8ed9d8381301df8b2cc82c1d5cf6f2f94fec)]:
20
+ - @atlaspack/feature-flags@2.25.0
21
+ - @atlaspack/rust@3.8.0
22
+ - @atlaspack/cache@3.2.25
23
+ - @atlaspack/fs@2.15.25
24
+ - @atlaspack/graph@3.5.19
25
+ - @atlaspack/utils@2.19.2
26
+ - @atlaspack/logger@2.14.22
27
+ - @atlaspack/plugin@2.14.30
28
+ - @atlaspack/profiler@2.14.27
29
+ - @atlaspack/types@2.15.20
30
+ - @atlaspack/workers@2.14.30
31
+ - @atlaspack/package-manager@2.14.30
32
+
3
33
  ## 2.23.5
4
34
 
5
35
  ### Patch Changes
package/lib/AssetGraph.js CHANGED
@@ -287,9 +287,7 @@ class AssetGraph extends _graph().ContentGraph {
287
287
  }));
288
288
  if ((0, _EnvironmentManager.fromEnvironmentId)(node.value.env).isLibrary) {
289
289
  // in library mode, all of the entry's symbols are "used"
290
- // @ts-expect-error TS2345
291
290
  node.usedSymbolsDown.add('*');
292
- // @ts-expect-error TS2345
293
291
  node.usedSymbolsUp.set('*', undefined);
294
292
  }
295
293
  return node;
@@ -410,9 +408,7 @@ class AssetGraph extends _graph().ContentGraph {
410
408
  }
411
409
  let isDeferrable = [...dependencySymbols].every(([, {
412
410
  isWeak
413
- }]) => isWeak) && sideEffects === false && canDefer &&
414
- // @ts-expect-error TS2345
415
- !dependencySymbols.has('*');
411
+ }]) => isWeak) && sideEffects === false && canDefer && !dependencySymbols.has('*');
416
412
  if (!isDeferrable) {
417
413
  return false;
418
414
  }
@@ -438,9 +434,7 @@ class AssetGraph extends _graph().ContentGraph {
438
434
  if (this.undeferredDependencies.has(d)) {
439
435
  return false;
440
436
  }
441
- let depIsDeferrable = d.symbols && !((0, _EnvironmentManager.fromEnvironmentId)(d.env).isLibrary && d.isEntry) &&
442
- // @ts-expect-error TS2345
443
- !d.symbols.has('*') && ![...d.symbols.keys()].some(symbol => {
437
+ let depIsDeferrable = d.symbols && !((0, _EnvironmentManager.fromEnvironmentId)(d.env).isLibrary && d.isEntry) && !d.symbols.has('*') && ![...d.symbols.keys()].some(symbol => {
444
438
  var _resolvedAsset$symbol;
445
439
  let assetSymbol = (_resolvedAsset$symbol = resolvedAsset.symbols) === null || _resolvedAsset$symbol === void 0 || (_resolvedAsset$symbol = _resolvedAsset$symbol.get(symbol)) === null || _resolvedAsset$symbol === void 0 ? void 0 : _resolvedAsset$symbol.local;
446
440
  return assetSymbol != null && symbols.has(assetSymbol);
@@ -237,7 +237,6 @@ class BundleGraph {
237
237
  // It doesn't make sense to retarget dependencies where `*` is used, because the
238
238
  // retargeting won't enable any benefits in that case (apart from potentially even more
239
239
  // code being generated).
240
- // @ts-expect-error TS2345
241
240
  !node.usedSymbolsUp.has('*') &&
242
241
  // TODO We currently can't rename imports in async imports, e.g. from
243
242
  // (parcelRequire("...")).then(({ a }) => a);
@@ -252,11 +251,8 @@ class BundleGraph {
252
251
  // (and the asset content itself).
253
252
  [...targets].every(([, t]) => new Set([...t.values()]).size === t.size)) {
254
253
  var _nodeValueSymbols$get;
255
- // @ts-expect-error TS2367
256
254
  let isReexportAll = ((_nodeValueSymbols$get = nodeValueSymbols.get('*')) === null || _nodeValueSymbols$get === void 0 ? void 0 : _nodeValueSymbols$get.local) === '*';
257
- let reexportAllLoc = isReexportAll ?
258
- // @ts-expect-error TS2345
259
- (0, _nullthrows().default)(nodeValueSymbols.get('*')).loc : undefined;
255
+ let reexportAllLoc = isReexportAll ? (0, _nullthrows().default)(nodeValueSymbols.get('*')).loc : undefined;
260
256
 
261
257
  // TODO adjust sourceAssetIdNode.value.dependencies ?
262
258
  let deps = [
@@ -313,7 +309,6 @@ class BundleGraph {
313
309
  (0, _assert().default)(!sourceAssetSymbols.has(as));
314
310
  sourceAssetSymbols.set(as, {
315
311
  loc: reexportAllLoc,
316
- // @ts-expect-error TS2322
317
312
  local: local
318
313
  });
319
314
  }
@@ -1198,7 +1193,6 @@ class BundleGraph {
1198
1193
  var _asset$symbols;
1199
1194
  let assetOutside = boundary && !this.bundleHasAsset(boundary, asset);
1200
1195
  let identifier = (_asset$symbols = asset.symbols) === null || _asset$symbols === void 0 || (_asset$symbols = _asset$symbols.get(symbol)) === null || _asset$symbols === void 0 ? void 0 : _asset$symbols.local;
1201
- // @ts-expect-error TS2367
1202
1196
  if (symbol === '*') {
1203
1197
  var _asset$symbols2;
1204
1198
  return {
@@ -1230,7 +1224,6 @@ class BundleGraph {
1230
1224
  // External module or self-reference
1231
1225
  return {
1232
1226
  asset,
1233
- // @ts-expect-error TS2322
1234
1227
  exportSymbol: symbol,
1235
1228
  symbol: identifier,
1236
1229
  loc: (_asset$symbols3 = asset.symbols) === null || _asset$symbols3 === void 0 || (_asset$symbols3 = _asset$symbols3.get(symbol)) === null || _asset$symbols3 === void 0 ? void 0 : _asset$symbols3.loc
@@ -1267,11 +1260,7 @@ class BundleGraph {
1267
1260
  // If this module exports wildcards, resolve the original module.
1268
1261
  // Default exports are excluded from wildcard exports.
1269
1262
  // Wildcard reexports are never listed in the reexporting asset's symbols.
1270
- if (identifier == null &&
1271
- // @ts-expect-error TS2367
1272
- ((_depSymbols$get = depSymbols.get('*')) === null || _depSymbols$get === void 0 ? void 0 : _depSymbols$get.local) === '*' &&
1273
- // @ts-expect-error TS2367
1274
- symbol !== 'default') {
1263
+ if (identifier == null && ((_depSymbols$get = depSymbols.get('*')) === null || _depSymbols$get === void 0 ? void 0 : _depSymbols$get.local) === '*' && symbol !== 'default') {
1275
1264
  let resolved = this.getResolvedAsset(dep, boundary);
1276
1265
  if (!resolved) {
1277
1266
  continue;
@@ -1350,7 +1339,6 @@ class BundleGraph {
1350
1339
  } else if (result === undefined) {
1351
1340
  var _asset$symbols5;
1352
1341
  // If not exported explicitly by the asset (= would have to be in * or a reexport-all) ...
1353
- // @ts-expect-error TS2345
1354
1342
  if (nonStaticDependency || (_asset$symbols5 = asset.symbols) !== null && _asset$symbols5 !== void 0 && _asset$symbols5.has('*')) {
1355
1343
  // ... and if there are non-statically analyzable dependencies or it's a CJS asset,
1356
1344
  // fallback to namespace access.
@@ -1364,7 +1352,6 @@ class BundleGraph {
1364
1352
 
1365
1353
  return {
1366
1354
  asset,
1367
- // @ts-expect-error TS2322
1368
1355
  exportSymbol: symbol,
1369
1356
  symbol: result,
1370
1357
  loc: (_asset$symbols6 = asset.symbols) === null || _asset$symbols6 === void 0 || (_asset$symbols6 = _asset$symbols6.get(symbol)) === null || _asset$symbols6 === void 0 ? void 0 : _asset$symbols6.loc
@@ -1403,8 +1390,6 @@ class BundleGraph {
1403
1390
  var _depSymbols$get2;
1404
1391
  let depSymbols = dep.symbols;
1405
1392
  if (!depSymbols) continue;
1406
-
1407
- // @ts-expect-error TS2367
1408
1393
  if (((_depSymbols$get2 = depSymbols.get('*')) === null || _depSymbols$get2 === void 0 ? void 0 : _depSymbols$get2.local) === '*') {
1409
1394
  let resolved = this.getResolvedAsset(dep, boundary);
1410
1395
  if (!resolved) continue;
@@ -82,7 +82,6 @@ function propagateSymbols({
82
82
  if ((0, _featureFlags().getFeatureFlag)('emptyFileStarRexportFix')) {
83
83
  if (assetNode.value.meta.emptyFileStarReexport && incomingDeps.every(d => d.value.specifierType === _types.SpecifierType.esm)) {
84
84
  var _assetNode$value$symb;
85
- // @ts-expect-error TS2345
86
85
  (_assetNode$value$symb = assetNode.value.symbols) === null || _assetNode$value$symb === void 0 || _assetNode$value$symb.delete('*');
87
86
  }
88
87
  }
@@ -104,9 +103,7 @@ function propagateSymbols({
104
103
  set.add(s);
105
104
  }
106
105
  }
107
- let hasNamespaceOutgoingDeps = outgoingDeps.some(
108
- // @ts-expect-error TS2367
109
- d => {
106
+ let hasNamespaceOutgoingDeps = outgoingDeps.some(d => {
110
107
  var _d$value$symbols;
111
108
  return ((_d$value$symbols = d.value.symbols) === null || _d$value$symbols === void 0 || (_d$value$symbols = _d$value$symbols.get('*')) === null || _d$value$symbols === void 0 ? void 0 : _d$value$symbols.local) === '*';
112
109
  });
@@ -124,9 +121,7 @@ function propagateSymbols({
124
121
  let namespaceReexportedSymbols = new Set();
125
122
  if (incomingDeps.length === 0) {
126
123
  // Root in the runtimes Graph
127
- // @ts-expect-error TS2345
128
124
  assetNode.usedSymbols.add('*');
129
- // @ts-expect-error TS2345
130
125
  namespaceReexportedSymbols.add('*');
131
126
  } else {
132
127
  for (let incomingDep of incomingDeps) {
@@ -141,16 +136,11 @@ function propagateSymbols({
141
136
  continue;
142
137
  }
143
138
  for (let exportSymbol of incomingDep.usedSymbolsDown) {
144
- // @ts-expect-error TS2367
145
139
  if (exportSymbol === '*') {
146
- // @ts-expect-error TS2345
147
140
  assetNode.usedSymbols.add('*');
148
- // @ts-expect-error TS2345
149
141
  namespaceReexportedSymbols.add('*');
150
142
  }
151
- if (!assetSymbols || assetSymbols.has(exportSymbol) ||
152
- // @ts-expect-error TS2345
153
- assetSymbols.has('*')) {
143
+ if (!assetSymbols || assetSymbols.has(exportSymbol) || assetSymbols.has('*')) {
154
144
  // An own symbol or a non-namespace reexport
155
145
  assetNode.usedSymbols.add(exportSymbol);
156
146
  }
@@ -158,7 +148,6 @@ function propagateSymbols({
158
148
  // (but only if we actually have namespace-exporting outgoing dependencies,
159
149
  // This usually happens with a reexporting asset with many namespace exports which means that
160
150
  // we cannot match up the correct asset with the used symbol at this level.)
161
- // @ts-expect-error TS2367
162
151
  else if (hasNamespaceOutgoingDeps && exportSymbol !== 'default') {
163
152
  namespaceReexportedSymbols.add(exportSymbol);
164
153
  }
@@ -192,8 +181,6 @@ function propagateSymbols({
192
181
  var _depSymbols$get;
193
182
  let depSymbols = dep.value.symbols;
194
183
  if (!depSymbols) continue;
195
-
196
- // @ts-expect-error TS2367
197
184
  if (((_depSymbols$get = depSymbols.get('*')) === null || _depSymbols$get === void 0 ? void 0 : _depSymbols$get.local) === '*') {
198
185
  if (addAll) {
199
186
  depUsedSymbolsDown.add('*');
@@ -209,7 +196,6 @@ function propagateSymbols({
209
196
  }] of depSymbols) {
210
197
  var _depSymbols$get2;
211
198
  // Was already handled above
212
- // @ts-expect-error TS2367
213
199
  if (local === '*') continue;
214
200
  if (!assetSymbolsInverse || !((_depSymbols$get2 = depSymbols.get(symbol)) !== null && _depSymbols$get2 !== void 0 && _depSymbols$get2.isWeak)) {
215
201
  // Bailout or non-weak symbol (= used in the asset itself = not a reexport)
@@ -219,7 +205,6 @@ function propagateSymbols({
219
205
  if (reexportedExportSymbols == null) {
220
206
  // not reexported = used in asset itself
221
207
  depUsedSymbolsDown.add(symbol);
222
- // @ts-expect-error TS2345
223
208
  } else if (assetNode.usedSymbols.has('*')) {
224
209
  // we need everything
225
210
  depUsedSymbolsDown.add(symbol);
@@ -251,9 +236,7 @@ function propagateSymbols({
251
236
  const logFallbackNamespaceInsertion = (assetNode, symbol, depNode1, depNode2) => {
252
237
  if (options.logLevel === 'verbose') {
253
238
  _logger().default.warn({
254
- message: `${(0, _projectPath.fromProjectPathRelative)(assetNode.value.filePath
255
- // @ts-expect-error TS2731
256
- )} reexports "${symbol}", which could be resolved either to the dependency "${depNode1.value.specifier}" or "${depNode2.value.specifier}" at runtime. Adding a namespace object to fall back on.`,
239
+ message: `${(0, _projectPath.fromProjectPathRelative)(assetNode.value.filePath)} reexports "${symbol}", which could be resolved either to the dependency "${depNode1.value.specifier}" or "${depNode2.value.specifier}" at runtime. Adding a namespace object to fall back on.`,
257
240
  origin: '@atlaspack/core'
258
241
  });
259
242
  }
@@ -293,11 +276,8 @@ function propagateSymbols({
293
276
  if (isExcluded) {
294
277
  outgoingDep.usedSymbolsDown.forEach((_, s) => outgoingDep.usedSymbolsUp.set(s, null));
295
278
  }
296
-
297
- // @ts-expect-error TS2367
298
279
  if (((_outgoingDepSymbols$g = outgoingDepSymbols.get('*')) === null || _outgoingDepSymbols$g === void 0 ? void 0 : _outgoingDepSymbols$g.local) === '*') {
299
280
  outgoingDep.usedSymbolsUp.forEach((sResolved, s) => {
300
- // @ts-expect-error TS2367
301
281
  if (s === 'default') {
302
282
  return;
303
283
  }
@@ -305,11 +285,9 @@ function propagateSymbols({
305
285
  // If the symbol could come from multiple assets at runtime, assetNode's
306
286
  // namespace will be needed at runtime to perform the lookup on.
307
287
  if (reexportedSymbols.has(s)) {
308
- // @ts-expect-error TS2345
309
288
  if (!assetNode.usedSymbols.has('*')) {
310
289
  logFallbackNamespaceInsertion(assetNode, s, (0, _nullthrows().default)(reexportedSymbolsSource.get(s)), outgoingDep);
311
290
  }
312
- // @ts-expect-error TS2345
313
291
  assetNode.usedSymbols.add('*');
314
292
  reexportedSymbols.set(s, {
315
293
  asset: assetNode.id,
@@ -337,11 +315,9 @@ function propagateSymbols({
337
315
  reexported.forEach(s => {
338
316
  // see same code above
339
317
  if (reexportedSymbols.has(s)) {
340
- // @ts-expect-error TS2345
341
318
  if (!assetNode.usedSymbols.has('*')) {
342
319
  logFallbackNamespaceInsertion(assetNode, s, (0, _nullthrows().default)(reexportedSymbolsSource.get(s)), outgoingDep);
343
320
  }
344
- // @ts-expect-error TS2345
345
321
  assetNode.usedSymbols.add('*');
346
322
  reexportedSymbols.set(s, {
347
323
  asset: assetNode.id,
@@ -373,15 +349,11 @@ function propagateSymbols({
373
349
  incomingDep.usedSymbolsUp = new Map();
374
350
  let incomingDepSymbols = incomingDep.value.symbols;
375
351
  if (!incomingDepSymbols) continue;
376
-
377
- // @ts-expect-error TS2367
378
352
  let hasNamespaceReexport = ((_incomingDepSymbols$g = incomingDepSymbols.get('*')) === null || _incomingDepSymbols$g === void 0 ? void 0 : _incomingDepSymbols$g.local) === '*';
379
353
  for (let s of incomingDep.usedSymbolsDown) {
380
354
  if (assetSymbols == null ||
381
355
  // Assume everything could be provided if symbols are cleared
382
- assetNode.value.bundleBehavior === _types.BundleBehavior.isolated || assetNode.value.bundleBehavior === _types.BundleBehavior.inline ||
383
- // @ts-expect-error TS2367
384
- s === '*' || assetNode.usedSymbols.has(s)) {
356
+ assetNode.value.bundleBehavior === _types.BundleBehavior.isolated || assetNode.value.bundleBehavior === _types.BundleBehavior.inline || s === '*' || assetNode.usedSymbols.has(s)) {
385
357
  usedSymbolsUpAmbiguous(incomingDepUsedSymbolsUpOld, incomingDep.usedSymbolsUp, s, {
386
358
  asset: assetNode.id,
387
359
  symbol: s
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.MutableDependencySymbols = exports.MutableAssetSymbols = exports.AssetSymbols = void 0;
7
- // @ts-expect-error TS2305
8
-
9
7
  class MutableDependencySymbols {
10
8
  #symbols;
11
9
  #locals;
@@ -124,10 +122,12 @@ class MutableAssetSymbols {
124
122
  loc,
125
123
  local,
126
124
  isEsmExport,
127
- selfReferenced
125
+ selfReferenced,
126
+ isStaticBindingSafe
128
127
  } of inner || []) {
129
128
  this.set(exported, local, loc, {
130
129
  isEsm: isEsmExport,
130
+ isStaticBindingSafe,
131
131
  selfReferenced
132
132
  });
133
133
  }
@@ -45,41 +45,28 @@ class AssetSymbols {
45
45
  valueToSymbols.set(asset, this);
46
46
  return this;
47
47
  }
48
-
49
- // @ts-expect-error TS2416
50
48
  hasExportSymbol(exportSymbol) {
51
49
  var _this$value$symbols;
52
- // @ts-expect-error TS2345
53
50
  return Boolean((_this$value$symbols = this.#value.symbols) === null || _this$value$symbols === void 0 ? void 0 : _this$value$symbols.has(exportSymbol));
54
51
  }
55
-
56
- // @ts-expect-error TS2416
57
52
  hasLocalSymbol(local) {
58
53
  if (this.#value.symbols == null) {
59
54
  return false;
60
55
  }
61
56
  for (let s of this.#value.symbols.values()) {
62
- // @ts-expect-error TS2367
63
57
  if (local === s.local) return true;
64
58
  }
65
59
  return false;
66
60
  }
67
-
68
- // @ts-expect-error TS2416
69
61
  get(exportSymbol) {
70
62
  var _this$value$symbols2;
71
- // @ts-expect-error TS2322
72
- return fromInternalAssetSymbol(this.#options.projectRoot, // @ts-expect-error TS2345
73
- (_this$value$symbols2 = this.#value.symbols) === null || _this$value$symbols2 === void 0 ? void 0 : _this$value$symbols2.get(exportSymbol));
63
+ return fromInternalAssetSymbol(this.#options.projectRoot, (_this$value$symbols2 = this.#value.symbols) === null || _this$value$symbols2 === void 0 ? void 0 : _this$value$symbols2.get(exportSymbol));
74
64
  }
75
65
  get isCleared() {
76
66
  return this.#value.symbols == null;
77
67
  }
78
-
79
- // @ts-expect-error TS2416
80
68
  exportSymbols() {
81
69
  var _this$value$symbols3;
82
- // @ts-expect-error TS2322
83
70
  return ((_this$value$symbols3 = this.#value.symbols) === null || _this$value$symbols3 === void 0 ? void 0 : _this$value$symbols3.keys()) ?? [];
84
71
  }
85
72
  // @ts-expect-error TS2416
@@ -114,37 +101,26 @@ class MutableAssetSymbols {
114
101
 
115
102
  // immutable
116
103
 
117
- // @ts-expect-error TS2416
118
104
  hasExportSymbol(exportSymbol) {
119
105
  var _this$value$symbols4;
120
- // @ts-expect-error TS2345
121
106
  return Boolean((_this$value$symbols4 = this.#value.symbols) === null || _this$value$symbols4 === void 0 ? void 0 : _this$value$symbols4.has(exportSymbol));
122
107
  }
123
-
124
- // @ts-expect-error TS2416
125
108
  hasLocalSymbol(local) {
126
109
  if (this.#value.symbols == null) {
127
110
  return false;
128
111
  }
129
112
  for (let s of this.#value.symbols.values()) {
130
- // @ts-expect-error TS2367
131
113
  if (local === s.local) return true;
132
114
  }
133
115
  return false;
134
116
  }
135
-
136
- // @ts-expect-error TS2416
137
117
  get(exportSymbol) {
138
118
  var _this$value$symbols5;
139
- // @ts-expect-error TS2322
140
- return fromInternalAssetSymbol(this.#options.projectRoot, // @ts-expect-error TS2345
141
- (_this$value$symbols5 = this.#value.symbols) === null || _this$value$symbols5 === void 0 ? void 0 : _this$value$symbols5.get(exportSymbol));
119
+ return fromInternalAssetSymbol(this.#options.projectRoot, (_this$value$symbols5 = this.#value.symbols) === null || _this$value$symbols5 === void 0 ? void 0 : _this$value$symbols5.get(exportSymbol));
142
120
  }
143
121
  get isCleared() {
144
122
  return this.#value.symbols == null;
145
123
  }
146
-
147
- // @ts-expect-error TS2416
148
124
  exportSymbols() {
149
125
  // @ts-expect-error TS2322
150
126
  return this.#value.symbols.keys();
@@ -166,20 +142,14 @@ class MutableAssetSymbols {
166
142
  this.#value.symbols = new Map();
167
143
  }
168
144
  }
169
-
170
- // @ts-expect-error TS2416
171
145
  set(exportSymbol, local, loc, meta) {
172
- // @ts-expect-error TS2345
173
146
  (0, _nullthrows().default)(this.#value.symbols).set(exportSymbol, {
174
147
  local,
175
148
  loc: (0, _utils.toInternalSourceLocation)(this.#options.projectRoot, loc),
176
149
  meta
177
150
  });
178
151
  }
179
-
180
- // @ts-expect-error TS2416
181
152
  delete(exportSymbol) {
182
- // @ts-expect-error TS2345
183
153
  (0, _nullthrows().default)(this.#value.symbols).delete(exportSymbol);
184
154
  }
185
155
  }
@@ -205,36 +175,24 @@ class MutableDependencySymbols {
205
175
 
206
176
  // immutable:
207
177
 
208
- // @ts-expect-error TS2416
209
178
  hasExportSymbol(exportSymbol) {
210
179
  var _this$value$symbols6;
211
- // @ts-expect-error TS2345
212
180
  return Boolean((_this$value$symbols6 = this.#value.symbols) === null || _this$value$symbols6 === void 0 ? void 0 : _this$value$symbols6.has(exportSymbol));
213
181
  }
214
-
215
- // @ts-expect-error TS2416
216
182
  hasLocalSymbol(local) {
217
183
  if (this.#value.symbols) {
218
184
  for (let s of this.#value.symbols.values()) {
219
- // @ts-expect-error TS2367
220
185
  if (local === s.local) return true;
221
186
  }
222
187
  }
223
188
  return false;
224
189
  }
225
-
226
- // @ts-expect-error TS2416
227
190
  get(exportSymbol) {
228
- // @ts-expect-error TS2322
229
- return fromInternalDependencySymbol(this.#options.projectRoot,
230
- // @ts-expect-error TS2345
231
- (0, _nullthrows().default)(this.#value.symbols).get(exportSymbol));
191
+ return fromInternalDependencySymbol(this.#options.projectRoot, (0, _nullthrows().default)(this.#value.symbols).get(exportSymbol));
232
192
  }
233
193
  get isCleared() {
234
194
  return this.#value.symbols == null;
235
195
  }
236
-
237
- // @ts-expect-error TS2416
238
196
  exportSymbols() {
239
197
  // @ts-expect-error TS2322
240
198
  return this.#value.symbols ? this.#value.symbols.keys() : EMPTY_ITERABLE;
@@ -258,23 +216,16 @@ class MutableDependencySymbols {
258
216
  this.#value.symbols = new Map();
259
217
  }
260
218
  }
261
-
262
- // @ts-expect-error TS2416
263
219
  set(exportSymbol, local, loc, isWeak) {
264
220
  var _symbols$get;
265
221
  let symbols = (0, _nullthrows().default)(this.#value.symbols);
266
- // @ts-expect-error TS2345
267
222
  symbols.set(exportSymbol, {
268
223
  local,
269
224
  loc: (0, _utils.toInternalSourceLocation)(this.#options.projectRoot, loc),
270
- // @ts-expect-error TS2345
271
225
  isWeak: (((_symbols$get = symbols.get(exportSymbol)) === null || _symbols$get === void 0 ? void 0 : _symbols$get.isWeak) ?? true) && (isWeak ?? false)
272
226
  });
273
227
  }
274
-
275
- // @ts-expect-error TS2416
276
228
  delete(exportSymbol) {
277
- // @ts-expect-error TS2345
278
229
  (0, _nullthrows().default)(this.#value.symbols).delete(exportSymbol);
279
230
  }
280
231
  }
@@ -1,4 +1,4 @@
1
- import type { GraphVisitor, FilePath, TraversalActions, BundleBehavior as IBundleBehavior } from '@atlaspack/types';
1
+ import type { GraphVisitor, FilePath, TraversalActions, BundleBehavior as IBundleBehavior, Symbol } from '@atlaspack/types';
2
2
  import type { ContentGraphOpts, NodeId, SerializedContentGraph } from '@atlaspack/graph';
3
3
  import type { Asset, AssetNode, Bundle, BundleGraphNode, BundleGroup, Dependency, DependencyNode, InternalSourceLocation, Target, Condition } from './types';
4
4
  import type AssetGraph from './AssetGraph';
@@ -17,11 +17,11 @@ export type BundleGraphEdgeType = (typeof bundleGraphEdgeTypes)[keyof typeof bun
17
17
  type InternalSymbolResolution = {
18
18
  asset: Asset;
19
19
  exportSymbol: string;
20
- symbol: symbol | null | undefined | false;
20
+ symbol: Symbol | null | undefined | false;
21
21
  loc: InternalSourceLocation | null | undefined;
22
22
  };
23
23
  type InternalExportSymbolResolution = InternalSymbolResolution & {
24
- readonly exportAs: symbol | string;
24
+ readonly exportAs: Symbol | string;
25
25
  };
26
26
  type BundleGraphOpts = {
27
27
  graph: ContentGraphOpts<BundleGraphNode, BundleGraphEdgeType>;
@@ -159,7 +159,7 @@ export default class BundleGraph {
159
159
  bundleHasAsset(bundle: Bundle, asset: Asset): boolean;
160
160
  bundleHasDependency(bundle: Bundle, dependency: Dependency): boolean;
161
161
  filteredTraverse<TValue, TContext>(bundleNodeId: NodeId, filter: (arg1: NodeId, arg2: TraversalActions) => TValue | null | undefined, visit: GraphVisitor<TValue, TContext>): TContext | null | undefined;
162
- getSymbolResolution(asset: Asset, symbol: symbol, boundary?: Bundle | null): InternalSymbolResolution;
162
+ getSymbolResolution(asset: Asset, symbol: Symbol, boundary?: Bundle | null): InternalSymbolResolution;
163
163
  getAssetById(contentKey: string): Asset;
164
164
  getAssetPublicId(asset: Asset): string;
165
165
  getExportedSymbols(asset: Asset, boundary?: Bundle | null): Array<InternalExportSymbolResolution>;
@@ -168,8 +168,8 @@ export default class BundleGraph {
168
168
  getHash(bundle: Bundle): string;
169
169
  getBundleGraphHash(): string;
170
170
  addBundleToBundleGroup(bundle: Bundle, bundleGroup: BundleGroup): void;
171
- getUsedSymbolsAsset(asset: Asset): ReadonlySet<symbol> | null | undefined;
172
- getUsedSymbolsDependency(dep: Dependency): ReadonlySet<symbol> | null | undefined;
171
+ getUsedSymbolsAsset(asset: Asset): ReadonlySet<Symbol> | null | undefined;
172
+ getUsedSymbolsDependency(dep: Dependency): ReadonlySet<Symbol> | null | undefined;
173
173
  merge(other: BundleGraph): void;
174
174
  isEntryBundleGroup(bundleGroup: BundleGroup): boolean;
175
175
  /**
@@ -1,26 +1,26 @@
1
1
  import type { Symbol as NapiSymbol } from '@atlaspack/rust';
2
- import type { AssetSymbols as IAssetSymbols, MutableAssetSymbols as IMutableAssetSymbols, MutableDependencySymbols as IMutableDependencySymbols, SourceLocation, Meta } from '@atlaspack/types';
2
+ import type { AssetSymbols as IAssetSymbols, MutableAssetSymbols as IMutableAssetSymbols, MutableDependencySymbols as IMutableDependencySymbols, Symbol, SourceLocation, Meta } from '@atlaspack/types';
3
3
  export declare class MutableDependencySymbols implements IMutableDependencySymbols {
4
4
  #private;
5
5
  get isCleared(): boolean;
6
6
  constructor(inner: NapiSymbol[] | null | undefined | null);
7
7
  ensure(): void;
8
- get(exportSymbol: symbol): DependencyAssetSymbol | null | undefined;
9
- hasExportSymbol(exportSymbol: symbol): boolean;
10
- hasLocalSymbol(local: symbol): boolean;
11
- exportSymbols(): Iterable<symbol>;
12
- set(exportSymbol: symbol, local: symbol, loc?: SourceLocation | null, isWeak?: boolean | null): void;
13
- delete(exportSymbol: symbol): void;
8
+ get(exportSymbol: Symbol): DependencyAssetSymbol | null | undefined;
9
+ hasExportSymbol(exportSymbol: Symbol): boolean;
10
+ hasLocalSymbol(local: Symbol): boolean;
11
+ exportSymbols(): Iterable<Symbol>;
12
+ set(exportSymbol: Symbol, local: Symbol, loc?: SourceLocation | null, isWeak?: boolean | null): void;
13
+ delete(exportSymbol: Symbol): void;
14
14
  [Symbol.iterator](): MapIterator<DependencyAssetSymbol>;
15
15
  }
16
16
  export declare class AssetSymbols implements IAssetSymbols {
17
17
  #private;
18
18
  get isCleared(): boolean;
19
19
  constructor(inner: NapiSymbol[] | null | undefined | null);
20
- get(exportSymbol: symbol): AssetSymbol | null | undefined;
21
- hasExportSymbol(exportSymbol: symbol): boolean;
22
- hasLocalSymbol(local: symbol): boolean;
23
- exportSymbols(): Iterable<symbol>;
20
+ get(exportSymbol: Symbol): AssetSymbol | null | undefined;
21
+ hasExportSymbol(exportSymbol: Symbol): boolean;
22
+ hasLocalSymbol(local: Symbol): boolean;
23
+ exportSymbols(): Iterable<Symbol>;
24
24
  intoNapi(): NapiSymbol[];
25
25
  [Symbol.iterator](): MapIterator<AssetSymbol>;
26
26
  }
@@ -30,21 +30,21 @@ export declare class MutableAssetSymbols implements IMutableAssetSymbols {
30
30
  constructor(inner: NapiSymbol[] | null | undefined | null);
31
31
  intoNapi(): NapiSymbol[];
32
32
  ensure(): void;
33
- set(exportSymbol: symbol, local: symbol, loc?: SourceLocation | null, meta?: Meta | null): void;
34
- get(exportSymbol: symbol): AssetSymbol | null | undefined;
35
- hasExportSymbol(exportSymbol: symbol): boolean;
36
- hasLocalSymbol(local: symbol): boolean;
37
- exportSymbols(): Iterable<symbol>;
38
- delete(exportSymbol: symbol): void;
33
+ set(exportSymbol: Symbol, local: Symbol, loc?: SourceLocation | null, meta?: Meta | null): void;
34
+ get(exportSymbol: Symbol): AssetSymbol | null | undefined;
35
+ hasExportSymbol(exportSymbol: Symbol): boolean;
36
+ hasLocalSymbol(local: Symbol): boolean;
37
+ exportSymbols(): Iterable<Symbol>;
38
+ delete(exportSymbol: Symbol): void;
39
39
  [Symbol.iterator](): MapIterator<AssetSymbol>;
40
40
  }
41
41
  export type AssetSymbol = {
42
- local: symbol;
42
+ local: Symbol;
43
43
  loc: SourceLocation | null | undefined;
44
44
  meta?: Meta | null | undefined;
45
45
  };
46
46
  export type DependencyAssetSymbol = {
47
- local: symbol;
47
+ local: Symbol;
48
48
  loc: SourceLocation | null | undefined;
49
49
  meta?: Meta | null | undefined;
50
50
  isWeak: boolean;
@@ -1,4 +1,4 @@
1
- import type { Asset as IAsset, Bundle as IBundle, BundleGraph as IBundleGraph, BundleGraphTraversable, BundleGroup as IBundleGroup, Dependency as IDependency, ExportSymbolResolution, FilePath, GraphVisitor, NamedBundle, SymbolResolution, Target } from '@atlaspack/types';
1
+ import type { Asset as IAsset, Bundle as IBundle, BundleGraph as IBundleGraph, BundleGraphTraversable, BundleGroup as IBundleGroup, Dependency as IDependency, ExportSymbolResolution, FilePath, GraphVisitor, NamedBundle, SymbolResolution, Symbol, Target } from '@atlaspack/types';
2
2
  import type { Bundle as InternalBundle, AtlaspackOptions } from '../types';
3
3
  import type InternalBundleGraph from '../BundleGraph';
4
4
  import { Asset } from './Asset';
@@ -40,7 +40,7 @@ export default class BundleGraph<TBundle extends IBundle> implements IBundleGrap
40
40
  isEntryBundleGroup(bundleGroup: IBundleGroup): boolean;
41
41
  getChildBundles(bundle: IBundle): Array<TBundle>;
42
42
  getParentBundles(bundle: IBundle): Array<TBundle>;
43
- getSymbolResolution(asset: IAsset, symbol: symbol, boundary?: IBundle | null): SymbolResolution;
43
+ getSymbolResolution(asset: IAsset, symbol: Symbol, boundary?: IBundle | null): SymbolResolution;
44
44
  getExportedSymbols(asset: IAsset, boundary?: IBundle | null): Array<ExportSymbolResolution>;
45
45
  traverse<TContext>(visit: GraphVisitor<BundleGraphTraversable, TContext>, start?: IAsset | null, opts?: {
46
46
  skipUnusedDependencies?: boolean;
@@ -48,7 +48,7 @@ export default class BundleGraph<TBundle extends IBundle> implements IBundleGrap
48
48
  traverseBundles<TContext>(visit: GraphVisitor<TBundle, TContext>, startBundle?: IBundle | null): TContext | null | undefined;
49
49
  getBundlesWithAsset(asset: IAsset): Array<TBundle>;
50
50
  getBundlesWithDependency(dependency: IDependency): Array<TBundle>;
51
- getUsedSymbols(v: IAsset | IDependency): ReadonlySet<symbol> | null | undefined;
51
+ getUsedSymbols(v: IAsset | IDependency): ReadonlySet<Symbol> | null | undefined;
52
52
  getEntryRoot(target: Target): FilePath;
53
53
  getConditionsForDependencies(deps: Array<IDependency>, bundle: NamedBundle): Set<{
54
54
  publicId: string;
@@ -17,8 +17,8 @@ export declare class AssetSymbols implements IAssetSymbols {
17
17
  readonly next: () => {
18
18
  done: boolean;
19
19
  };
20
- } | MapIterator<[symbol, {
21
- local: symbol;
20
+ } | MapIterator<[string, {
21
+ local: ISymbol;
22
22
  loc: import("../types").InternalSourceLocation | null | undefined;
23
23
  meta?: Meta | null | undefined;
24
24
  }]>;
@@ -40,8 +40,8 @@ export declare class MutableAssetSymbols implements IMutableAssetSymbols {
40
40
  readonly next: () => {
41
41
  done: boolean;
42
42
  };
43
- } | MapIterator<[symbol, {
44
- local: symbol;
43
+ } | MapIterator<[string, {
44
+ local: ISymbol;
45
45
  loc: import("../types").InternalSourceLocation | null | undefined;
46
46
  meta?: Meta | null | undefined;
47
47
  }]>;
@@ -63,8 +63,8 @@ export declare class MutableDependencySymbols implements IMutableDependencySymbo
63
63
  } | null | undefined;
64
64
  get isCleared(): boolean;
65
65
  exportSymbols(): Iterable<ISymbol>;
66
- [Symbol.iterator](): MapIterator<[symbol, {
67
- local: symbol;
66
+ [Symbol.iterator](): MapIterator<[string, {
67
+ local: ISymbol;
68
68
  loc: import("../types").InternalSourceLocation | null | undefined;
69
69
  isWeak: boolean;
70
70
  meta?: Meta | null | undefined;