@roots/bud-compiler 2023.7.21-611 → 2023.7.23-80
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/service.d.ts +2 -2
- package/lib/service.js +2 -2
- package/package.json +5 -5
- package/src/service.tsx +7 -8
package/lib/service.d.ts
CHANGED
@@ -3,7 +3,7 @@ import type { Bud } from '@roots/bud-framework';
|
|
3
3
|
import type { MultiCompiler, MultiStats, Stats, StatsError, Webpack } from '@roots/bud-framework/config';
|
4
4
|
import type { ErrorWithSourceFile } from '@roots/bud-support/open';
|
5
5
|
import { Service } from '@roots/bud-framework/service';
|
6
|
-
import {
|
6
|
+
import { BudError } from '@roots/bud-support/errors';
|
7
7
|
import webpack from '@roots/bud-support/webpack';
|
8
8
|
/**
|
9
9
|
* {@link BudCompiler} implementation
|
@@ -36,7 +36,7 @@ export declare class Compiler extends Service implements BudCompiler {
|
|
36
36
|
/**
|
37
37
|
* {@link BudCompiler.onError}
|
38
38
|
*/
|
39
|
-
onError(error:
|
39
|
+
onError(error: BudError | webpack.WebpackError): void;
|
40
40
|
/**
|
41
41
|
* {@link BudCompiler.onStats}
|
42
42
|
*/
|
package/lib/service.js
CHANGED
@@ -43,7 +43,7 @@ export class Compiler extends Service {
|
|
43
43
|
async compile(bud) {
|
44
44
|
this.config = !bud.hasChildren
|
45
45
|
? [await bud.build.make()]
|
46
|
-
: await Promise.all(Object.values(bud.children).map(async (child) =>
|
46
|
+
: await Promise.all(Object.values(bud.children).map(async (child) => child.build.make().catch(error => {
|
47
47
|
throw error;
|
48
48
|
})));
|
49
49
|
this.config.parallelism = Math.max(cpus().length - 1, 1);
|
@@ -57,7 +57,7 @@ export class Compiler extends Service {
|
|
57
57
|
this.instance = this.implementation(this.config);
|
58
58
|
}
|
59
59
|
catch (error) {
|
60
|
-
|
60
|
+
this.onError(error);
|
61
61
|
}
|
62
62
|
this.instance.hooks.done.tap(bud.label, (stats) => {
|
63
63
|
this.onStats(stats);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@roots/bud-compiler",
|
3
|
-
"version": "2023.7.
|
3
|
+
"version": "2023.7.23-80",
|
4
4
|
"description": "Compilation handler",
|
5
5
|
"engines": {
|
6
6
|
"node": ">=16"
|
@@ -61,15 +61,15 @@
|
|
61
61
|
"types": "./lib/index.d.ts",
|
62
62
|
"module": "./lib/index.js",
|
63
63
|
"devDependencies": {
|
64
|
-
"@roots/bud-api": "2023.7.
|
64
|
+
"@roots/bud-api": "2023.7.23-80",
|
65
65
|
"@skypack/package-check": "0.2.2",
|
66
66
|
"@types/node": "18.16.19",
|
67
67
|
"@types/react": "18.2.15"
|
68
68
|
},
|
69
69
|
"dependencies": {
|
70
|
-
"@roots/bud-dashboard": "2023.7.
|
71
|
-
"@roots/bud-framework": "2023.7.
|
72
|
-
"@roots/bud-support": "2023.7.
|
70
|
+
"@roots/bud-dashboard": "2023.7.23-80",
|
71
|
+
"@roots/bud-framework": "2023.7.23-80",
|
72
|
+
"@roots/bud-support": "2023.7.23-80",
|
73
73
|
"react": "18.2.0",
|
74
74
|
"tslib": "2.6.0"
|
75
75
|
},
|
package/src/service.tsx
CHANGED
@@ -20,7 +20,7 @@ import {pathToFileURL} from 'node:url'
|
|
20
20
|
import {Error} from '@roots/bud-dashboard/components/error'
|
21
21
|
import {Service} from '@roots/bud-framework/service'
|
22
22
|
import {bind} from '@roots/bud-support/decorators/bind'
|
23
|
-
import {BudError
|
23
|
+
import {BudError} from '@roots/bud-support/errors'
|
24
24
|
import {duration} from '@roots/bud-support/human-readable'
|
25
25
|
import {render} from '@roots/bud-support/ink'
|
26
26
|
import isNull from '@roots/bud-support/lodash/isNull'
|
@@ -65,11 +65,10 @@ export class Compiler extends Service implements BudCompiler {
|
|
65
65
|
this.config = !bud.hasChildren
|
66
66
|
? [await bud.build.make()]
|
67
67
|
: await Promise.all(
|
68
|
-
Object.values(bud.children).map(
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
}),
|
68
|
+
Object.values(bud.children).map(async (child: Bud) =>
|
69
|
+
child.build.make().catch(error => {
|
70
|
+
throw error
|
71
|
+
}),
|
73
72
|
),
|
74
73
|
)
|
75
74
|
|
@@ -86,7 +85,7 @@ export class Compiler extends Service implements BudCompiler {
|
|
86
85
|
try {
|
87
86
|
this.instance = this.implementation(this.config)
|
88
87
|
} catch (error) {
|
89
|
-
|
88
|
+
this.onError(error)
|
90
89
|
}
|
91
90
|
|
92
91
|
this.instance.hooks.done.tap(bud.label, (stats: any) => {
|
@@ -103,7 +102,7 @@ export class Compiler extends Service implements BudCompiler {
|
|
103
102
|
* {@link BudCompiler.onError}
|
104
103
|
*/
|
105
104
|
@bind
|
106
|
-
public onError(error:
|
105
|
+
public onError(error: BudError | webpack.WebpackError) {
|
107
106
|
process.exitCode = 1
|
108
107
|
if (!error) return
|
109
108
|
|