@atlaspack/core 2.14.1-dev.55 → 2.14.1-dev.82
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 +4 -0
- package/lib/public/BundleGraph.js +3 -2
- package/lib/resolveOptions.js +2 -1
- package/lib/rustWorkerThreadDylibHack.js +22 -0
- package/package.json +17 -17
- package/src/Atlaspack.js +10 -1
- package/src/public/BundleGraph.js +5 -3
- package/src/resolveOptions.js +9 -5
- package/src/rustWorkerThreadDylibHack.js +18 -0
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;
|
package/lib/resolveOptions.js
CHANGED
|
@@ -139,7 +139,8 @@ async function resolveOptions(initialOptions) {
|
|
|
139
139
|
// where symlinked dependencies outside the project root need to trigger HMR
|
|
140
140
|
// updates. Default to the project root if not provided.
|
|
141
141
|
let watchDir = initialOptions.watchDir != null ? _path().default.resolve(initialOptions.watchDir) : projectRoot;
|
|
142
|
-
|
|
142
|
+
const needsRustLmdbCache = (0, _featureFlags().getFeatureFlag)('useLmdbJsLite') || (0, _featureFlags().getFeatureFlag)('atlaspackV3');
|
|
143
|
+
let cache = needsRustLmdbCache ? new (_cache().LMDBLiteCache)(cacheDir) : outputFS instanceof _fs().NodeFS ? new (_cache().LMDBCache)(cacheDir) : new (_cache().FSCache)(outputFS, cacheDir);
|
|
143
144
|
let mode = initialOptions.mode ?? 'development';
|
|
144
145
|
let shouldOptimize = (initialOptions === null || initialOptions === void 0 || (_initialOptions$defau = initialOptions.defaultTargetOptions) === null || _initialOptions$defau === void 0 ? void 0 : _initialOptions$defau.shouldOptimize) ?? mode === 'production';
|
|
145
146
|
let publicUrl = (initialOptions === null || initialOptions === void 0 || (_initialOptions$defau2 = initialOptions.defaultTargetOptions) === null || _initialOptions$defau2 === void 0 ? void 0 : _initialOptions$defau2.publicUrl) ?? '/';
|
|
@@ -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.
|
|
3
|
+
"version": "2.14.1-dev.82+5e3ca3e0c",
|
|
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.
|
|
24
|
-
"@atlaspack/cache": "2.13.3-dev.
|
|
25
|
-
"@atlaspack/diagnostic": "2.14.1-dev.
|
|
26
|
-
"@atlaspack/events": "2.14.1-dev.
|
|
27
|
-
"@atlaspack/feature-flags": "2.14.1-dev.
|
|
28
|
-
"@atlaspack/fs": "2.14.1-dev.
|
|
29
|
-
"@atlaspack/graph": "3.4.1-dev.
|
|
30
|
-
"@atlaspack/logger": "2.14.1-dev.
|
|
31
|
-
"@atlaspack/package-manager": "2.14.1-dev.
|
|
32
|
-
"@atlaspack/plugin": "2.14.1-dev.
|
|
33
|
-
"@atlaspack/profiler": "2.14.1-dev.
|
|
34
|
-
"@atlaspack/rust": "3.0.1-dev.
|
|
35
|
-
"@atlaspack/types": "2.14.1-dev.
|
|
36
|
-
"@atlaspack/utils": "2.14.1-dev.
|
|
37
|
-
"@atlaspack/workers": "2.14.1-dev.
|
|
23
|
+
"@atlaspack/build-cache": "2.13.3-dev.82+5e3ca3e0c",
|
|
24
|
+
"@atlaspack/cache": "2.13.3-dev.82+5e3ca3e0c",
|
|
25
|
+
"@atlaspack/diagnostic": "2.14.1-dev.82+5e3ca3e0c",
|
|
26
|
+
"@atlaspack/events": "2.14.1-dev.82+5e3ca3e0c",
|
|
27
|
+
"@atlaspack/feature-flags": "2.14.1-dev.82+5e3ca3e0c",
|
|
28
|
+
"@atlaspack/fs": "2.14.1-dev.82+5e3ca3e0c",
|
|
29
|
+
"@atlaspack/graph": "3.4.1-dev.82+5e3ca3e0c",
|
|
30
|
+
"@atlaspack/logger": "2.14.1-dev.82+5e3ca3e0c",
|
|
31
|
+
"@atlaspack/package-manager": "2.14.1-dev.82+5e3ca3e0c",
|
|
32
|
+
"@atlaspack/plugin": "2.14.1-dev.82+5e3ca3e0c",
|
|
33
|
+
"@atlaspack/profiler": "2.14.1-dev.82+5e3ca3e0c",
|
|
34
|
+
"@atlaspack/rust": "3.0.1-dev.82+5e3ca3e0c",
|
|
35
|
+
"@atlaspack/types": "2.14.1-dev.82+5e3ca3e0c",
|
|
36
|
+
"@atlaspack/utils": "2.14.1-dev.82+5e3ca3e0c",
|
|
37
|
+
"@atlaspack/workers": "2.14.1-dev.82+5e3ca3e0c",
|
|
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": "
|
|
70
|
+
"gitHead": "5e3ca3e0cbbd49f4e67ac8d9b8aeebba1c3e76ef"
|
|
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 {
|
|
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
|
|
|
@@ -120,6 +125,10 @@ export default class Atlaspack {
|
|
|
120
125
|
};
|
|
121
126
|
setFeatureFlags(featureFlags);
|
|
122
127
|
|
|
128
|
+
if (getFeatureFlag('enableRustWorkerThreadDylibHack')) {
|
|
129
|
+
loadRustWorkerThreadDylibHack();
|
|
130
|
+
}
|
|
131
|
+
|
|
123
132
|
await initSourcemaps;
|
|
124
133
|
await initRust?.();
|
|
125
134
|
|
|
@@ -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
|
-
|
|
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
|
|
package/src/resolveOptions.js
CHANGED
|
@@ -12,7 +12,7 @@ import type {AtlaspackOptions} from './types';
|
|
|
12
12
|
import path from 'path';
|
|
13
13
|
import {hashString} from '@atlaspack/rust';
|
|
14
14
|
import {NodeFS, NodeVCSAwareFS} from '@atlaspack/fs';
|
|
15
|
-
import {LMDBLiteCache, FSCache} from '@atlaspack/cache';
|
|
15
|
+
import {LMDBCache, LMDBLiteCache, FSCache} from '@atlaspack/cache';
|
|
16
16
|
import {getFeatureFlag, getFeatureFlagValue} from '@atlaspack/feature-flags';
|
|
17
17
|
import {NodePackageManager} from '@atlaspack/package-manager';
|
|
18
18
|
import {
|
|
@@ -146,10 +146,14 @@ export default async function resolveOptions(
|
|
|
146
146
|
? path.resolve(initialOptions.watchDir)
|
|
147
147
|
: projectRoot;
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
const needsRustLmdbCache =
|
|
150
|
+
getFeatureFlag('useLmdbJsLite') || getFeatureFlag('atlaspackV3');
|
|
151
|
+
|
|
152
|
+
let cache = needsRustLmdbCache
|
|
153
|
+
? new LMDBLiteCache(cacheDir)
|
|
154
|
+
: outputFS instanceof NodeFS
|
|
155
|
+
? new LMDBCache(cacheDir)
|
|
156
|
+
: new FSCache(outputFS, cacheDir);
|
|
153
157
|
|
|
154
158
|
let mode = initialOptions.mode ?? 'development';
|
|
155
159
|
let shouldOptimize =
|
|
@@ -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
|
+
}
|