@atlaspack/core 2.12.1-canary.3566 → 2.12.1-canary.3568
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-v3/AtlaspackV3.js +15 -2
- package/lib/public/BundleGraph.js +5 -3
- package/lib/requests/AssetGraphRequestRust.js +2 -9
- package/package.json +17 -17
- package/src/atlaspack-v3/AtlaspackV3.js +10 -2
- package/src/public/BundleGraph.js +15 -10
- package/src/requests/AssetGraphRequestRust.js +5 -11
|
@@ -12,6 +12,14 @@ function _rust() {
|
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
14
|
var _WorkerPool = require("./WorkerPool");
|
|
15
|
+
function _diagnostic() {
|
|
16
|
+
const data = _interopRequireDefault(require("@atlaspack/diagnostic"));
|
|
17
|
+
_diagnostic = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
23
|
class AtlaspackV3 {
|
|
16
24
|
constructor({
|
|
17
25
|
fs,
|
|
@@ -35,7 +43,7 @@ class AtlaspackV3 {
|
|
|
35
43
|
}
|
|
36
44
|
async buildAssetGraph() {
|
|
37
45
|
const workerIds = [];
|
|
38
|
-
let
|
|
46
|
+
let [graph, error] = await this._internal.buildAssetGraph({
|
|
39
47
|
registerWorker: tx_worker => {
|
|
40
48
|
// $FlowFixMe
|
|
41
49
|
const workerId = _WorkerPool.workerPool.registerWorker(tx_worker);
|
|
@@ -43,7 +51,12 @@ class AtlaspackV3 {
|
|
|
43
51
|
}
|
|
44
52
|
});
|
|
45
53
|
_WorkerPool.workerPool.releaseWorkers(workerIds);
|
|
46
|
-
|
|
54
|
+
if (error !== null) {
|
|
55
|
+
throw new (_diagnostic().default)({
|
|
56
|
+
diagnostic: error
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return graph;
|
|
47
60
|
}
|
|
48
61
|
}
|
|
49
62
|
exports.AtlaspackV3 = AtlaspackV3;
|
|
@@ -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 =
|
|
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({
|
|
@@ -31,15 +31,8 @@ function createAssetGraphRequestRust(rustAtlaspack) {
|
|
|
31
31
|
id: input.name,
|
|
32
32
|
run: async input => {
|
|
33
33
|
let options = input.options;
|
|
34
|
-
let serializedAssetGraph;
|
|
35
|
-
|
|
36
|
-
serializedAssetGraph = await rustAtlaspack.buildAssetGraph();
|
|
37
|
-
serializedAssetGraph.nodes = serializedAssetGraph.nodes.flatMap(node => JSON.parse(node));
|
|
38
|
-
} catch (err) {
|
|
39
|
-
throw new (_diagnostic().default)({
|
|
40
|
-
diagnostic: err
|
|
41
|
-
});
|
|
42
|
-
}
|
|
34
|
+
let serializedAssetGraph = await rustAtlaspack.buildAssetGraph();
|
|
35
|
+
serializedAssetGraph.nodes = serializedAssetGraph.nodes.flatMap(node => JSON.parse(node));
|
|
43
36
|
let {
|
|
44
37
|
assetGraph,
|
|
45
38
|
changedAssets
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/core",
|
|
3
|
-
"version": "2.12.1-canary.
|
|
3
|
+
"version": "2.12.1-canary.3568+2bb7fb28f",
|
|
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.
|
|
24
|
-
"@atlaspack/cache": "2.12.1-canary.
|
|
25
|
-
"@atlaspack/diagnostic": "2.12.1-canary.
|
|
26
|
-
"@atlaspack/events": "2.12.1-canary.
|
|
27
|
-
"@atlaspack/feature-flags": "2.12.1-canary.
|
|
28
|
-
"@atlaspack/fs": "2.12.1-canary.
|
|
29
|
-
"@atlaspack/graph": "3.2.1-canary.
|
|
30
|
-
"@atlaspack/logger": "2.12.1-canary.
|
|
31
|
-
"@atlaspack/package-manager": "2.12.1-canary.
|
|
32
|
-
"@atlaspack/plugin": "2.12.1-canary.
|
|
33
|
-
"@atlaspack/profiler": "2.12.1-canary.
|
|
34
|
-
"@atlaspack/rust": "2.12.1-canary.
|
|
35
|
-
"@atlaspack/types": "2.12.1-canary.
|
|
36
|
-
"@atlaspack/utils": "2.12.1-canary.
|
|
37
|
-
"@atlaspack/workers": "2.12.1-canary.
|
|
23
|
+
"@atlaspack/build-cache": "2.12.1-canary.3568+2bb7fb28f",
|
|
24
|
+
"@atlaspack/cache": "2.12.1-canary.3568+2bb7fb28f",
|
|
25
|
+
"@atlaspack/diagnostic": "2.12.1-canary.3568+2bb7fb28f",
|
|
26
|
+
"@atlaspack/events": "2.12.1-canary.3568+2bb7fb28f",
|
|
27
|
+
"@atlaspack/feature-flags": "2.12.1-canary.3568+2bb7fb28f",
|
|
28
|
+
"@atlaspack/fs": "2.12.1-canary.3568+2bb7fb28f",
|
|
29
|
+
"@atlaspack/graph": "3.2.1-canary.3568+2bb7fb28f",
|
|
30
|
+
"@atlaspack/logger": "2.12.1-canary.3568+2bb7fb28f",
|
|
31
|
+
"@atlaspack/package-manager": "2.12.1-canary.3568+2bb7fb28f",
|
|
32
|
+
"@atlaspack/plugin": "2.12.1-canary.3568+2bb7fb28f",
|
|
33
|
+
"@atlaspack/profiler": "2.12.1-canary.3568+2bb7fb28f",
|
|
34
|
+
"@atlaspack/rust": "2.12.1-canary.3568+2bb7fb28f",
|
|
35
|
+
"@atlaspack/types": "2.12.1-canary.3568+2bb7fb28f",
|
|
36
|
+
"@atlaspack/utils": "2.12.1-canary.3568+2bb7fb28f",
|
|
37
|
+
"@atlaspack/workers": "2.12.1-canary.3568+2bb7fb28f",
|
|
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": "
|
|
69
|
+
"gitHead": "2bb7fb28f58d6d8e17c7917c4d0be72df125c328"
|
|
70
70
|
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
type AtlaspackNapiOptions,
|
|
7
7
|
} from '@atlaspack/rust';
|
|
8
8
|
import {workerPool} from './WorkerPool';
|
|
9
|
+
import ThrowableDiagnostic from '@atlaspack/diagnostic';
|
|
9
10
|
|
|
10
11
|
export type AtlaspackV3Options = {|
|
|
11
12
|
fs?: AtlaspackNapiOptions['fs'],
|
|
@@ -50,7 +51,8 @@ export class AtlaspackV3 {
|
|
|
50
51
|
|
|
51
52
|
async buildAssetGraph(): Promise<any> {
|
|
52
53
|
const workerIds = [];
|
|
53
|
-
|
|
54
|
+
|
|
55
|
+
let [graph, error] = await this._internal.buildAssetGraph({
|
|
54
56
|
registerWorker: (tx_worker) => {
|
|
55
57
|
// $FlowFixMe
|
|
56
58
|
const workerId = workerPool.registerWorker(tx_worker);
|
|
@@ -60,6 +62,12 @@ export class AtlaspackV3 {
|
|
|
60
62
|
|
|
61
63
|
workerPool.releaseWorkers(workerIds);
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
if (error !== null) {
|
|
66
|
+
throw new ThrowableDiagnostic({
|
|
67
|
+
diagnostic: error,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return graph;
|
|
64
72
|
}
|
|
65
73
|
}
|
|
@@ -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 =
|
|
377
|
-
|
|
378
|
-
|
|
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
|
|
|
@@ -37,17 +37,11 @@ export function createAssetGraphRequestRust(
|
|
|
37
37
|
id: input.name,
|
|
38
38
|
run: async (input) => {
|
|
39
39
|
let options = input.options;
|
|
40
|
-
let serializedAssetGraph;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
);
|
|
46
|
-
} catch (err) {
|
|
47
|
-
throw new ThrowableDiagnostic({
|
|
48
|
-
diagnostic: err,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
40
|
+
let serializedAssetGraph = await rustAtlaspack.buildAssetGraph();
|
|
41
|
+
|
|
42
|
+
serializedAssetGraph.nodes = serializedAssetGraph.nodes.flatMap((node) =>
|
|
43
|
+
JSON.parse(node),
|
|
44
|
+
);
|
|
51
45
|
|
|
52
46
|
let {assetGraph, changedAssets} = instrument(
|
|
53
47
|
'atlaspack_v3_getAssetGraph',
|