@roots/bud-compiler 2023.10.23-7 → 2023.10.24-936
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/index.d.ts +0 -4
- package/lib/service/index.js +10 -11
- package/package.json +7 -7
- package/src/service/index.tsx +18 -26
package/lib/service/index.d.ts
CHANGED
@@ -7,10 +7,6 @@ import { Service } from '@roots/bud-framework/service';
|
|
7
7
|
* {@link BudCompiler} implementation
|
8
8
|
*/
|
9
9
|
declare class Compiler extends Service implements BudCompiler {
|
10
|
-
/**
|
11
|
-
* {@link BudCompiler.compilationStats}
|
12
|
-
*/
|
13
|
-
compilationStats: BudCompiler[`compilationStats`];
|
14
10
|
/**
|
15
11
|
* {@link BudCompiler.config}
|
16
12
|
*/
|
package/lib/service/index.js
CHANGED
@@ -7,7 +7,6 @@ import { Error as DisplayError } from '@roots/bud-dashboard/components/error';
|
|
7
7
|
import { Service } from '@roots/bud-framework/service';
|
8
8
|
import { bind } from '@roots/bud-support/decorators/bind';
|
9
9
|
import { BudError } from '@roots/bud-support/errors';
|
10
|
-
import { render } from '@roots/bud-support/ink';
|
11
10
|
import isNull from '@roots/bud-support/lodash/isNull';
|
12
11
|
import isNumber from '@roots/bud-support/lodash/isNumber';
|
13
12
|
import isString from '@roots/bud-support/lodash/isString';
|
@@ -38,10 +37,10 @@ class Compiler extends Service {
|
|
38
37
|
subtitle: error.name,
|
39
38
|
});
|
40
39
|
if (`isBudError` in error) {
|
41
|
-
render(_jsx(DisplayError, { error: error }));
|
40
|
+
this.app.context.render(_jsx(DisplayError, { error: error }));
|
42
41
|
}
|
43
42
|
else {
|
44
|
-
render(_jsx(DisplayError, { error: BudError.normalize(error) }));
|
43
|
+
this.app.context.render(_jsx(DisplayError, { error: BudError.normalize(error) }));
|
45
44
|
}
|
46
45
|
}
|
47
46
|
/**
|
@@ -51,18 +50,17 @@ class Compiler extends Service {
|
|
51
50
|
const makeNoticeTitle = (child) => this.app.label !== child.name
|
52
51
|
? `${this.app.label} (${child.name})`
|
53
52
|
: child.name;
|
54
|
-
this.stats = stats;
|
55
|
-
this.
|
56
|
-
this.app.dashboard.updateStats(this.compilationStats);
|
53
|
+
this.stats = stats.toJson(statsOptions);
|
54
|
+
this.app.context.render(this.app.dashboard.render(stats));
|
57
55
|
if (stats.hasErrors()) {
|
58
56
|
process.exitCode = 1;
|
59
|
-
this.
|
57
|
+
this.stats.children = this.stats.children?.map(child => ({
|
60
58
|
...child,
|
61
59
|
errors: child.errors && this.sourceErrors
|
62
60
|
? this.sourceErrors(child.errors)
|
63
61
|
: child.errors ?? [],
|
64
62
|
}));
|
65
|
-
this.
|
63
|
+
this.stats.children
|
66
64
|
?.filter(child => isNumber(child.errorsCount) && child.errorsCount > 0)
|
67
65
|
.forEach(child => {
|
68
66
|
try {
|
@@ -83,7 +81,7 @@ class Compiler extends Service {
|
|
83
81
|
}
|
84
82
|
});
|
85
83
|
}
|
86
|
-
this.
|
84
|
+
this.stats.children
|
87
85
|
?.filter(child => child.errorsCount === 0)
|
88
86
|
.forEach(child => {
|
89
87
|
try {
|
@@ -97,6 +95,7 @@ class Compiler extends Service {
|
|
97
95
|
title: makeNoticeTitle(child),
|
98
96
|
});
|
99
97
|
this.app.server?.publicUrl.href &&
|
98
|
+
this.app.context.browser &&
|
100
99
|
this.app.notifier.openBrowser(this.app.server?.publicUrl.href);
|
101
100
|
}
|
102
101
|
catch (error) {
|
@@ -156,8 +155,8 @@ class Compiler extends Service {
|
|
156
155
|
* In a perfect world webpack plugins would use the
|
157
156
|
* `nameForCondition` property to identify the module.
|
158
157
|
*/
|
159
|
-
if (ident && this.
|
160
|
-
module = this.
|
158
|
+
if (ident && this.stats?.children) {
|
159
|
+
module = this.stats.children
|
161
160
|
.flatMap(child => child?.modules)
|
162
161
|
.find(module => [module?.id, module?.name].includes(ident));
|
163
162
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@roots/bud-compiler",
|
3
|
-
"version": "2023.10.
|
3
|
+
"version": "2023.10.24-936",
|
4
4
|
"description": "Compilation handler",
|
5
5
|
"engines": {
|
6
6
|
"node": ">=16"
|
@@ -65,15 +65,15 @@
|
|
65
65
|
"types": "./lib/index.d.ts",
|
66
66
|
"module": "./lib/index.js",
|
67
67
|
"devDependencies": {
|
68
|
-
"@roots/bud-api": "2023.10.
|
68
|
+
"@roots/bud-api": "2023.10.24-936",
|
69
69
|
"@skypack/package-check": "0.2.2",
|
70
|
-
"@types/node": "
|
71
|
-
"@types/react": "18.2.
|
70
|
+
"@types/node": "20.8.8",
|
71
|
+
"@types/react": "18.2.31"
|
72
72
|
},
|
73
73
|
"dependencies": {
|
74
|
-
"@roots/bud-dashboard": "2023.10.
|
75
|
-
"@roots/bud-framework": "2023.10.
|
76
|
-
"@roots/bud-support": "2023.10.
|
74
|
+
"@roots/bud-dashboard": "2023.10.24-936",
|
75
|
+
"@roots/bud-framework": "2023.10.24-936",
|
76
|
+
"@roots/bud-support": "2023.10.24-936",
|
77
77
|
"react": "18.2.0",
|
78
78
|
"tslib": "2.6.2"
|
79
79
|
},
|
package/src/service/index.tsx
CHANGED
@@ -21,7 +21,6 @@ import {Error as DisplayError} 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
23
|
import {BudError} from '@roots/bud-support/errors'
|
24
|
-
import {render} from '@roots/bud-support/ink'
|
25
24
|
import isNull from '@roots/bud-support/lodash/isNull'
|
26
25
|
import isNumber from '@roots/bud-support/lodash/isNumber'
|
27
26
|
import isString from '@roots/bud-support/lodash/isString'
|
@@ -31,11 +30,6 @@ import stripAnsi from '@roots/bud-support/strip-ansi'
|
|
31
30
|
* {@link BudCompiler} implementation
|
32
31
|
*/
|
33
32
|
class Compiler extends Service implements BudCompiler {
|
34
|
-
/**
|
35
|
-
* {@link BudCompiler.compilationStats}
|
36
|
-
*/
|
37
|
-
public declare compilationStats: BudCompiler[`compilationStats`]
|
38
|
-
|
39
33
|
/**
|
40
34
|
* {@link BudCompiler.config}
|
41
35
|
*/
|
@@ -73,9 +67,11 @@ class Compiler extends Service implements BudCompiler {
|
|
73
67
|
})
|
74
68
|
|
75
69
|
if (`isBudError` in error) {
|
76
|
-
render(<DisplayError error={error} />)
|
70
|
+
this.app.context.render(<DisplayError error={error} />)
|
77
71
|
} else {
|
78
|
-
render(
|
72
|
+
this.app.context.render(
|
73
|
+
<DisplayError error={BudError.normalize(error)} />,
|
74
|
+
)
|
79
75
|
}
|
80
76
|
}
|
81
77
|
/**
|
@@ -88,26 +84,21 @@ class Compiler extends Service implements BudCompiler {
|
|
88
84
|
? `${this.app.label} (${child.name})`
|
89
85
|
: child.name
|
90
86
|
|
91
|
-
this.stats = stats
|
92
|
-
|
93
|
-
this.compilationStats = stats.toJson(statsOptions)
|
94
|
-
|
95
|
-
this.app.dashboard.updateStats(this.compilationStats)
|
87
|
+
this.stats = stats.toJson(statsOptions)
|
88
|
+
this.app.context.render(this.app.dashboard.render(stats))
|
96
89
|
|
97
90
|
if (stats.hasErrors()) {
|
98
91
|
process.exitCode = 1
|
99
92
|
|
100
|
-
this.
|
101
|
-
child
|
102
|
-
|
103
|
-
errors
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
}),
|
108
|
-
)
|
93
|
+
this.stats.children = this.stats.children?.map(child => ({
|
94
|
+
...child,
|
95
|
+
errors:
|
96
|
+
child.errors && this.sourceErrors
|
97
|
+
? this.sourceErrors(child.errors)
|
98
|
+
: child.errors ?? [],
|
99
|
+
}))
|
109
100
|
|
110
|
-
this.
|
101
|
+
this.stats.children
|
111
102
|
?.filter(
|
112
103
|
child => isNumber(child.errorsCount) && child.errorsCount > 0,
|
113
104
|
)
|
@@ -131,7 +122,7 @@ class Compiler extends Service implements BudCompiler {
|
|
131
122
|
})
|
132
123
|
}
|
133
124
|
|
134
|
-
this.
|
125
|
+
this.stats.children
|
135
126
|
?.filter(child => child.errorsCount === 0)
|
136
127
|
.forEach(child => {
|
137
128
|
try {
|
@@ -146,6 +137,7 @@ class Compiler extends Service implements BudCompiler {
|
|
146
137
|
})
|
147
138
|
|
148
139
|
this.app.server?.publicUrl.href &&
|
140
|
+
this.app.context.browser &&
|
149
141
|
this.app.notifier.openBrowser(this.app.server?.publicUrl.href)
|
150
142
|
} catch (error) {
|
151
143
|
this.logger.error(error)
|
@@ -224,8 +216,8 @@ class Compiler extends Service implements BudCompiler {
|
|
224
216
|
* In a perfect world webpack plugins would use the
|
225
217
|
* `nameForCondition` property to identify the module.
|
226
218
|
*/
|
227
|
-
if (ident && this.
|
228
|
-
module = this.
|
219
|
+
if (ident && this.stats?.children) {
|
220
|
+
module = this.stats.children
|
229
221
|
.flatMap(child => child?.modules)
|
230
222
|
.find(module => [module?.id, module?.name].includes(ident))
|
231
223
|
}
|