@atlaspack/core 2.12.1-canary.3567 → 2.12.1-canary.3569

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.
@@ -201,16 +201,18 @@ class BundleGraph {
201
201
  const [[trueAsset, ifTrueBundles], [falseAsset, ifFalseBundles]] = [condition.ifTrueDependency, condition.ifFalseDependency].map(dep => {
202
202
  const asset = this.#graph.getResolvedAsset(dep, (0, _Bundle.bundleToInternalBundle)(bundle));
203
203
  if (asset && this.#graph.bundleHasAsset((0, _Bundle.bundleToInternalBundle)(bundle), asset)) {
204
- // Asset is in the same bundle
204
+ // Asset is in the same bundle, we know it doesn't need to be loaded externally
205
205
  return [asset, []];
206
206
  }
207
- const resolvedAsync = (0, _nullthrows().default)(this.#graph.resolveAsyncDependency(dep, (0, _Bundle.bundleToInternalBundle)(bundle)), `Failed to load depenendency for '${dep.specifier}' specifier from '${String(dep.sourcePath)}'`);
207
+ const resolvedAsync = this.#graph.resolveAsyncDependency(dep, (0, _Bundle.bundleToInternalBundle)(bundle));
208
208
  if ((resolvedAsync === null || resolvedAsync === void 0 ? void 0 : resolvedAsync.type) === 'asset') {
209
209
  // Single bundle to load dynamically
210
210
  return [resolvedAsync.value, [this.#createBundle((0, _nullthrows().default)(this.#graph.getReferencedBundle(dep, (0, _Bundle.bundleToInternalBundle)(bundle)), `Failed to load referenced bundle for '${dep.specifier}' specifier from '${String(dep.sourcePath)}'`), this.#graph, this.#options)]];
211
- } else {
211
+ } else if (resolvedAsync) {
212
212
  // Bundle group means we have multiple bundles to load first
213
213
  return [this.#graph.getAssetById(resolvedAsync.value.entryAssetId), this.#graph.getBundlesInBundleGroup(resolvedAsync.value).map(b => this.#createBundle(b, this.#graph, this.#options))];
214
+ } else {
215
+ return [(0, _nullthrows().default)(asset, `Failed to load depenendency for '${dep.specifier}' specifier from '${String(dep.sourcePath)}'`), []];
214
216
  }
215
217
  });
216
218
  conditions.add({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.12.1-canary.3567+e0effea53",
3
+ "version": "2.12.1-canary.3569+15c75d645",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,21 +20,21 @@
20
20
  "check-ts": "tsc --noEmit index.d.ts"
21
21
  },
22
22
  "dependencies": {
23
- "@atlaspack/build-cache": "2.12.1-canary.3567+e0effea53",
24
- "@atlaspack/cache": "2.12.1-canary.3567+e0effea53",
25
- "@atlaspack/diagnostic": "2.12.1-canary.3567+e0effea53",
26
- "@atlaspack/events": "2.12.1-canary.3567+e0effea53",
27
- "@atlaspack/feature-flags": "2.12.1-canary.3567+e0effea53",
28
- "@atlaspack/fs": "2.12.1-canary.3567+e0effea53",
29
- "@atlaspack/graph": "3.2.1-canary.3567+e0effea53",
30
- "@atlaspack/logger": "2.12.1-canary.3567+e0effea53",
31
- "@atlaspack/package-manager": "2.12.1-canary.3567+e0effea53",
32
- "@atlaspack/plugin": "2.12.1-canary.3567+e0effea53",
33
- "@atlaspack/profiler": "2.12.1-canary.3567+e0effea53",
34
- "@atlaspack/rust": "2.12.1-canary.3567+e0effea53",
35
- "@atlaspack/types": "2.12.1-canary.3567+e0effea53",
36
- "@atlaspack/utils": "2.12.1-canary.3567+e0effea53",
37
- "@atlaspack/workers": "2.12.1-canary.3567+e0effea53",
23
+ "@atlaspack/build-cache": "2.12.1-canary.3569+15c75d645",
24
+ "@atlaspack/cache": "2.12.1-canary.3569+15c75d645",
25
+ "@atlaspack/diagnostic": "2.12.1-canary.3569+15c75d645",
26
+ "@atlaspack/events": "2.12.1-canary.3569+15c75d645",
27
+ "@atlaspack/feature-flags": "2.12.1-canary.3569+15c75d645",
28
+ "@atlaspack/fs": "2.12.1-canary.3569+15c75d645",
29
+ "@atlaspack/graph": "3.2.1-canary.3569+15c75d645",
30
+ "@atlaspack/logger": "2.12.1-canary.3569+15c75d645",
31
+ "@atlaspack/package-manager": "2.12.1-canary.3569+15c75d645",
32
+ "@atlaspack/plugin": "2.12.1-canary.3569+15c75d645",
33
+ "@atlaspack/profiler": "2.12.1-canary.3569+15c75d645",
34
+ "@atlaspack/rust": "2.12.1-canary.3569+15c75d645",
35
+ "@atlaspack/types": "2.12.1-canary.3569+15c75d645",
36
+ "@atlaspack/utils": "2.12.1-canary.3569+15c75d645",
37
+ "@atlaspack/workers": "2.12.1-canary.3569+15c75d645",
38
38
  "@mischnic/json-sourcemap": "^0.1.0",
39
39
  "@parcel/source-map": "^2.1.1",
40
40
  "base-x": "^3.0.8",
@@ -66,5 +66,5 @@
66
66
  "browser": {
67
67
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
68
68
  },
69
- "gitHead": "e0effea53c21b3c3e3bc9d368468c562e5f80531"
69
+ "gitHead": "15c75d6458c1b2998296c8c66c5bee738f1055f5"
70
70
  }
@@ -369,18 +369,13 @@ export default class BundleGraph<TBundle: IBundle>
369
369
  asset &&
370
370
  this.#graph.bundleHasAsset(bundleToInternalBundle(bundle), asset)
371
371
  ) {
372
- // Asset is in the same bundle
372
+ // Asset is in the same bundle, we know it doesn't need to be loaded externally
373
373
  return [asset, []];
374
374
  }
375
375
 
376
- const resolvedAsync = nullthrows(
377
- this.#graph.resolveAsyncDependency(
378
- dep,
379
- bundleToInternalBundle(bundle),
380
- ),
381
- `Failed to load depenendency for '${
382
- dep.specifier
383
- }' specifier from '${String(dep.sourcePath)}'`,
376
+ const resolvedAsync = this.#graph.resolveAsyncDependency(
377
+ dep,
378
+ bundleToInternalBundle(bundle),
384
379
  );
385
380
  if (resolvedAsync?.type === 'asset') {
386
381
  // Single bundle to load dynamically
@@ -402,7 +397,7 @@ export default class BundleGraph<TBundle: IBundle>
402
397
  ),
403
398
  ],
404
399
  ];
405
- } else {
400
+ } else if (resolvedAsync) {
406
401
  // Bundle group means we have multiple bundles to load first
407
402
  return [
408
403
  this.#graph.getAssetById(resolvedAsync.value.entryAssetId),
@@ -410,6 +405,16 @@ export default class BundleGraph<TBundle: IBundle>
410
405
  .getBundlesInBundleGroup(resolvedAsync.value)
411
406
  .map((b) => this.#createBundle(b, this.#graph, this.#options)),
412
407
  ];
408
+ } else {
409
+ return [
410
+ nullthrows(
411
+ asset,
412
+ `Failed to load depenendency for '${
413
+ dep.specifier
414
+ }' specifier from '${String(dep.sourcePath)}'`,
415
+ ),
416
+ [],
417
+ ];
413
418
  }
414
419
  });
415
420