@atlaspack/core 2.14.1-dev.16 → 2.14.1-dev.27

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/lib/Atlaspack.js CHANGED
@@ -118,6 +118,7 @@ function _featureFlags() {
118
118
  var _atlaspackV = require("./atlaspack-v3");
119
119
  var _AssetGraphRequest = _interopRequireDefault(require("./requests/AssetGraphRequest"));
120
120
  var _AssetGraphRequestRust = require("./requests/AssetGraphRequestRust");
121
+ var _rustWorkerThreadDylibHack = require("./rustWorkerThreadDylibHack");
121
122
  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); }
122
123
  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; }
123
124
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -165,6 +166,9 @@ class Atlaspack {
165
166
  ...this.#initialOptions.featureFlags
166
167
  };
167
168
  (0, _featureFlags().setFeatureFlags)(featureFlags);
169
+ if ((0, _featureFlags().getFeatureFlag)('enableRustWorkerThreadDylibHack')) {
170
+ (0, _rustWorkerThreadDylibHack.loadRustWorkerThreadDylibHack)();
171
+ }
168
172
  await _sourceMap().init;
169
173
  await (_rust().init === null || _rust().init === void 0 ? void 0 : (0, _rust().init)());
170
174
  this.#disposable = new (_events().Disposable)();
@@ -262,12 +262,13 @@ class BundleGraph {
262
262
  ifFalseBundles.push(...depToBundles(cond.ifFalseDependency));
263
263
  }
264
264
  for (let bundle of bundles) {
265
- const conditions = bundleConditions.get(bundle) ?? new Map();
265
+ const conditions = bundleConditions.get(bundle.id) ?? new Map();
266
266
  conditions.set(cond.key, {
267
+ bundle,
267
268
  ifTrueBundles,
268
269
  ifFalseBundles
269
270
  });
270
- bundleConditions.set(bundle, conditions);
271
+ bundleConditions.set(bundle.id, conditions);
271
272
  }
272
273
  }
273
274
  return bundleConditions;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.loadRustWorkerThreadDylibHack = loadRustWorkerThreadDylibHack;
7
+ /**
8
+ * This is a workaround for https://github.com/rust-lang/rust/issues/91979
9
+ * when running atlaspack with parcel bindings, it is possible that the parcel
10
+ * dylib will be loaded from a node worker thread, which causes a crash on exit.
11
+ *
12
+ * This is a workaround to ensure that the parcel dylib is loaded in the main
13
+ * thread, which fixes the crash.
14
+ */
15
+ function loadRustWorkerThreadDylibHack() {
16
+ try {
17
+ // $FlowFixMe
18
+ require('@parcel/rust'); // eslint-disable-line
19
+ } catch (err) {
20
+ /* ignore */
21
+ }
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.14.1-dev.16+921d08b68",
3
+ "version": "2.14.1-dev.27+1b527bfa5",
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.13.3-dev.16+921d08b68",
24
- "@atlaspack/cache": "2.13.3-dev.16+921d08b68",
25
- "@atlaspack/diagnostic": "2.14.1-dev.16+921d08b68",
26
- "@atlaspack/events": "2.14.1-dev.16+921d08b68",
27
- "@atlaspack/feature-flags": "2.14.1-dev.16+921d08b68",
28
- "@atlaspack/fs": "2.14.1-dev.16+921d08b68",
29
- "@atlaspack/graph": "3.4.1-dev.16+921d08b68",
30
- "@atlaspack/logger": "2.14.1-dev.16+921d08b68",
31
- "@atlaspack/package-manager": "2.14.1-dev.16+921d08b68",
32
- "@atlaspack/plugin": "2.14.1-dev.16+921d08b68",
33
- "@atlaspack/profiler": "2.14.1-dev.16+921d08b68",
34
- "@atlaspack/rust": "3.0.1-dev.16+921d08b68",
35
- "@atlaspack/types": "2.14.1-dev.16+921d08b68",
36
- "@atlaspack/utils": "2.14.1-dev.16+921d08b68",
37
- "@atlaspack/workers": "2.14.1-dev.16+921d08b68",
23
+ "@atlaspack/build-cache": "2.13.3-dev.27+1b527bfa5",
24
+ "@atlaspack/cache": "2.13.3-dev.27+1b527bfa5",
25
+ "@atlaspack/diagnostic": "2.14.1-dev.27+1b527bfa5",
26
+ "@atlaspack/events": "2.14.1-dev.27+1b527bfa5",
27
+ "@atlaspack/feature-flags": "2.14.1-dev.27+1b527bfa5",
28
+ "@atlaspack/fs": "2.14.1-dev.27+1b527bfa5",
29
+ "@atlaspack/graph": "3.4.1-dev.27+1b527bfa5",
30
+ "@atlaspack/logger": "2.14.1-dev.27+1b527bfa5",
31
+ "@atlaspack/package-manager": "2.14.1-dev.27+1b527bfa5",
32
+ "@atlaspack/plugin": "2.14.1-dev.27+1b527bfa5",
33
+ "@atlaspack/profiler": "2.14.1-dev.27+1b527bfa5",
34
+ "@atlaspack/rust": "3.0.1-dev.27+1b527bfa5",
35
+ "@atlaspack/types": "2.14.1-dev.27+1b527bfa5",
36
+ "@atlaspack/utils": "2.14.1-dev.27+1b527bfa5",
37
+ "@atlaspack/workers": "2.14.1-dev.27+1b527bfa5",
38
38
  "@mischnic/json-sourcemap": "^0.1.0",
39
39
  "@parcel/source-map": "^2.1.1",
40
40
  "base-x": "^3.0.8",
@@ -67,5 +67,5 @@
67
67
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
68
68
  },
69
69
  "type": "commonjs",
70
- "gitHead": "921d08b68ca593f8cc8cb9ed0d182a5883a9e165"
70
+ "gitHead": "1b527bfa5ae58d415fe6f6f3c68a06c591708fdd"
71
71
  }
package/src/Atlaspack.js CHANGED
@@ -58,11 +58,16 @@ import {
58
58
  fromProjectPathRelative,
59
59
  } from './projectPath';
60
60
  import {tracer} from '@atlaspack/profiler';
61
- import {setFeatureFlags, DEFAULT_FEATURE_FLAGS} from '@atlaspack/feature-flags';
61
+ import {
62
+ getFeatureFlag,
63
+ setFeatureFlags,
64
+ DEFAULT_FEATURE_FLAGS,
65
+ } from '@atlaspack/feature-flags';
62
66
  import {AtlaspackV3, FileSystemV3} from './atlaspack-v3';
63
67
  import createAssetGraphRequestJS from './requests/AssetGraphRequest';
64
68
  import {createAssetGraphRequestRust} from './requests/AssetGraphRequestRust';
65
69
  import type {AssetGraphRequestResult} from './requests/AssetGraphRequest';
70
+ import {loadRustWorkerThreadDylibHack} from './rustWorkerThreadDylibHack';
66
71
 
67
72
  registerCoreWithSerializer();
68
73
 
@@ -117,6 +122,10 @@ export default class Atlaspack {
117
122
  };
118
123
  setFeatureFlags(featureFlags);
119
124
 
125
+ if (getFeatureFlag('enableRustWorkerThreadDylibHack')) {
126
+ loadRustWorkerThreadDylibHack();
127
+ }
128
+
120
129
  await initSourcemaps;
121
130
  await initRust?.();
122
131
 
@@ -444,10 +444,11 @@ export default class BundleGraph<TBundle: IBundle>
444
444
  // be used by a webserver to understand which conditions are used by which bundles,
445
445
  // and which bundles those conditions require depending on what they evaluate to.
446
446
  getConditionalBundleMapping(): Map<
447
- TBundle,
447
+ string,
448
448
  Map<
449
449
  string,
450
450
  {|
451
+ bundle: TBundle,
451
452
  ifTrueBundles: Array<TBundle>,
452
453
  ifFalseBundles: Array<TBundle>,
453
454
  |},
@@ -486,14 +487,15 @@ export default class BundleGraph<TBundle: IBundle>
486
487
  }
487
488
 
488
489
  for (let bundle of bundles) {
489
- const conditions = bundleConditions.get(bundle) ?? new Map();
490
+ const conditions = bundleConditions.get(bundle.id) ?? new Map();
490
491
 
491
492
  conditions.set(cond.key, {
493
+ bundle,
492
494
  ifTrueBundles,
493
495
  ifFalseBundles,
494
496
  });
495
497
 
496
- bundleConditions.set(bundle, conditions);
498
+ bundleConditions.set(bundle.id, conditions);
497
499
  }
498
500
  }
499
501
 
@@ -0,0 +1,18 @@
1
+ // @flow strict-local
2
+
3
+ /**
4
+ * This is a workaround for https://github.com/rust-lang/rust/issues/91979
5
+ * when running atlaspack with parcel bindings, it is possible that the parcel
6
+ * dylib will be loaded from a node worker thread, which causes a crash on exit.
7
+ *
8
+ * This is a workaround to ensure that the parcel dylib is loaded in the main
9
+ * thread, which fixes the crash.
10
+ */
11
+ export function loadRustWorkerThreadDylibHack() {
12
+ try {
13
+ // $FlowFixMe
14
+ require('@parcel/rust'); // eslint-disable-line
15
+ } catch (err) {
16
+ /* ignore */
17
+ }
18
+ }