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

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.
@@ -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 result = await this._internal.buildAssetGraph({
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
- return result;
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;
@@ -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
- try {
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.3566+9ccbb847b",
3
+ "version": "2.12.1-canary.3567+e0effea53",
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.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",
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",
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": "9ccbb847b43d122706b8ac52bb80c017176405da"
69
+ "gitHead": "e0effea53c21b3c3e3bc9d368468c562e5f80531"
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
- let result = await this._internal.buildAssetGraph({
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
- return result;
65
+ if (error !== null) {
66
+ throw new ThrowableDiagnostic({
67
+ diagnostic: error,
68
+ });
69
+ }
70
+
71
+ return graph;
64
72
  }
65
73
  }
@@ -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
- try {
42
- serializedAssetGraph = await rustAtlaspack.buildAssetGraph();
43
- serializedAssetGraph.nodes = serializedAssetGraph.nodes.flatMap(
44
- (node) => JSON.parse(node),
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',