@atlaspack/core 2.12.1-canary.3565 → 2.12.1-canary.3566

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.
@@ -1116,9 +1116,16 @@ class BundleGraph {
1116
1116
  if (!this._graph.hasContentKey(dep.id)) {
1117
1117
  return null;
1118
1118
  }
1119
- let res = this._graph.getNodeIdsConnectedTo(this._graph.getNodeIdByContentKey(dep.id));
1120
- (0, _assert().default)(res.length <= 1, 'Expected a single asset to be connected to a dependency');
1121
- let resNode = this._graph.getNode(res[0]);
1119
+ let res = null;
1120
+ let count = 0;
1121
+ this._graph.forEachNodeIdConnectedTo(this._graph.getNodeIdByContentKey(dep.id), node => {
1122
+ res = node;
1123
+ count += 1;
1124
+ if (count > 1) {
1125
+ throw new Error('Expected a single asset to be connected to a dependency');
1126
+ }
1127
+ }, 1);
1128
+ let resNode = res != null ? this._graph.getNode(res) : null;
1122
1129
  if ((resNode === null || resNode === void 0 ? void 0 : resNode.type) === 'asset') {
1123
1130
  return resNode.value;
1124
1131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.12.1-canary.3565+2b1e35dc3",
3
+ "version": "2.12.1-canary.3566+9ccbb847b",
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.3565+2b1e35dc3",
24
- "@atlaspack/cache": "2.12.1-canary.3565+2b1e35dc3",
25
- "@atlaspack/diagnostic": "2.12.1-canary.3565+2b1e35dc3",
26
- "@atlaspack/events": "2.12.1-canary.3565+2b1e35dc3",
27
- "@atlaspack/feature-flags": "2.12.1-canary.3565+2b1e35dc3",
28
- "@atlaspack/fs": "2.12.1-canary.3565+2b1e35dc3",
29
- "@atlaspack/graph": "3.2.1-canary.3565+2b1e35dc3",
30
- "@atlaspack/logger": "2.12.1-canary.3565+2b1e35dc3",
31
- "@atlaspack/package-manager": "2.12.1-canary.3565+2b1e35dc3",
32
- "@atlaspack/plugin": "2.12.1-canary.3565+2b1e35dc3",
33
- "@atlaspack/profiler": "2.12.1-canary.3565+2b1e35dc3",
34
- "@atlaspack/rust": "2.12.1-canary.3565+2b1e35dc3",
35
- "@atlaspack/types": "2.12.1-canary.3565+2b1e35dc3",
36
- "@atlaspack/utils": "2.12.1-canary.3565+2b1e35dc3",
37
- "@atlaspack/workers": "2.12.1-canary.3565+2b1e35dc3",
23
+ "@atlaspack/build-cache": "2.12.1-canary.3566+9ccbb847b",
24
+ "@atlaspack/cache": "2.12.1-canary.3566+9ccbb847b",
25
+ "@atlaspack/diagnostic": "2.12.1-canary.3566+9ccbb847b",
26
+ "@atlaspack/events": "2.12.1-canary.3566+9ccbb847b",
27
+ "@atlaspack/feature-flags": "2.12.1-canary.3566+9ccbb847b",
28
+ "@atlaspack/fs": "2.12.1-canary.3566+9ccbb847b",
29
+ "@atlaspack/graph": "3.2.1-canary.3566+9ccbb847b",
30
+ "@atlaspack/logger": "2.12.1-canary.3566+9ccbb847b",
31
+ "@atlaspack/package-manager": "2.12.1-canary.3566+9ccbb847b",
32
+ "@atlaspack/plugin": "2.12.1-canary.3566+9ccbb847b",
33
+ "@atlaspack/profiler": "2.12.1-canary.3566+9ccbb847b",
34
+ "@atlaspack/rust": "2.12.1-canary.3566+9ccbb847b",
35
+ "@atlaspack/types": "2.12.1-canary.3566+9ccbb847b",
36
+ "@atlaspack/utils": "2.12.1-canary.3566+9ccbb847b",
37
+ "@atlaspack/workers": "2.12.1-canary.3566+9ccbb847b",
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": "2b1e35dc3d51843fba13edcb958c01406ff355e4"
69
+ "gitHead": "9ccbb847b43d122706b8ac52bb80c017176405da"
70
70
  }
@@ -1773,14 +1773,23 @@ export default class BundleGraph {
1773
1773
  return null;
1774
1774
  }
1775
1775
 
1776
- let res = this._graph.getNodeIdsConnectedTo(
1776
+ let res = null;
1777
+ let count = 0;
1778
+ this._graph.forEachNodeIdConnectedTo(
1777
1779
  this._graph.getNodeIdByContentKey(dep.id),
1780
+ (node) => {
1781
+ res = node;
1782
+ count += 1;
1783
+ if (count > 1) {
1784
+ throw new Error(
1785
+ 'Expected a single asset to be connected to a dependency',
1786
+ );
1787
+ }
1788
+ },
1789
+ 1,
1778
1790
  );
1779
- invariant(
1780
- res.length <= 1,
1781
- 'Expected a single asset to be connected to a dependency',
1782
- );
1783
- let resNode = this._graph.getNode(res[0]);
1791
+
1792
+ let resNode = res != null ? this._graph.getNode(res) : null;
1784
1793
  if (resNode?.type === 'asset') {
1785
1794
  return resNode.value;
1786
1795
  }