@roots/bud-compiler 2023.9.2-8 → 2023.9.4-2255
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 +4 -4
- package/lib/service/index.js +33 -33
- package/package.json +5 -5
- package/src/service/index.tsx +42 -44
package/lib/service/index.d.ts
CHANGED
@@ -27,10 +27,6 @@ declare class Compiler extends Service implements BudCompiler {
|
|
27
27
|
* {@link BudCompiler.stats}
|
28
28
|
*/
|
29
29
|
stats: BudCompiler[`stats`];
|
30
|
-
/**
|
31
|
-
* {@link BudCompiler.compile}
|
32
|
-
*/
|
33
|
-
compile(bud: Bud): Promise<MultiCompiler>;
|
34
30
|
/**
|
35
31
|
* {@link BudCompiler.onError}
|
36
32
|
*/
|
@@ -39,6 +35,10 @@ declare class Compiler extends Service implements BudCompiler {
|
|
39
35
|
* {@link BudCompiler.onStats}
|
40
36
|
*/
|
41
37
|
onStats(stats: Stats & MultiStats): void;
|
38
|
+
/**
|
39
|
+
* {@link BudCompiler.compile}
|
40
|
+
*/
|
41
|
+
compile(bud: Bud): Promise<MultiCompiler>;
|
42
42
|
/**
|
43
43
|
* {@link Service.register}
|
44
44
|
*/
|
package/lib/service/index.js
CHANGED
@@ -24,36 +24,6 @@ class Compiler extends Service {
|
|
24
24
|
* {@link BudCompiler.implementation}
|
25
25
|
*/
|
26
26
|
implementation;
|
27
|
-
/**
|
28
|
-
* {@link BudCompiler.compile}
|
29
|
-
*/
|
30
|
-
async compile(bud) {
|
31
|
-
const config = !bud.hasChildren
|
32
|
-
? [await bud.build.make()]
|
33
|
-
: await Promise.all(Object.values(bud.children).map(async (child) => child.build.make().catch(error => {
|
34
|
-
throw error;
|
35
|
-
})));
|
36
|
-
this.config = config?.filter(Boolean);
|
37
|
-
this.config.parallelism = Math.max(cpus().length - 1, 1);
|
38
|
-
this.logger.info(`parallel compilations: ${this.config.parallelism}`);
|
39
|
-
await bud.hooks.fire(`compiler.before`, bud).catch(error => {
|
40
|
-
throw error;
|
41
|
-
});
|
42
|
-
this.logger.timeEnd(`initialize`);
|
43
|
-
this.app.dashboard.updateStatus(`compiling`);
|
44
|
-
try {
|
45
|
-
this.instance = this.implementation(this.config);
|
46
|
-
}
|
47
|
-
catch (error) {
|
48
|
-
const normalError = error instanceof Error ? error : BudError.normalize(error);
|
49
|
-
this.onError(normalError);
|
50
|
-
}
|
51
|
-
this.instance.hooks.done.tap(bud.label, (stats) => {
|
52
|
-
this.onStats(stats);
|
53
|
-
bud.hooks.fire(`compiler.done`, bud, this.stats).catch(this.onError);
|
54
|
-
});
|
55
|
-
return this.instance;
|
56
|
-
}
|
57
27
|
/**
|
58
28
|
* {@link BudCompiler.onError}
|
59
29
|
*/
|
@@ -134,6 +104,36 @@ class Compiler extends Service {
|
|
134
104
|
}
|
135
105
|
});
|
136
106
|
}
|
107
|
+
/**
|
108
|
+
* {@link BudCompiler.compile}
|
109
|
+
*/
|
110
|
+
async compile(bud) {
|
111
|
+
const config = !bud.hasChildren
|
112
|
+
? [await bud.build.make()]
|
113
|
+
: await Promise.all(Object.values(bud.children).map(async (child) => child.build.make().catch(error => {
|
114
|
+
throw error;
|
115
|
+
})));
|
116
|
+
this.config = config?.filter(Boolean);
|
117
|
+
this.config.parallelism = Math.max(cpus().length - 1, 1);
|
118
|
+
this.logger.info(`parallel compilations: ${this.config.parallelism}`);
|
119
|
+
await bud.hooks.fire(`compiler.before`, bud).catch(error => {
|
120
|
+
throw error;
|
121
|
+
});
|
122
|
+
this.logger.timeEnd(`initialize`);
|
123
|
+
this.app.dashboard.updateStatus(`compiling`);
|
124
|
+
try {
|
125
|
+
this.instance = this.implementation(this.config);
|
126
|
+
}
|
127
|
+
catch (error) {
|
128
|
+
const normalError = error instanceof Error ? error : BudError.normalize(error);
|
129
|
+
this.onError(normalError);
|
130
|
+
}
|
131
|
+
this.instance.hooks.done.tap(bud.label, (stats) => {
|
132
|
+
this.onStats(stats);
|
133
|
+
bud.hooks.fire(`compiler.done`, bud, this.stats).catch(this.onError);
|
134
|
+
});
|
135
|
+
return this.instance;
|
136
|
+
}
|
137
137
|
/**
|
138
138
|
* {@link Service.register}
|
139
139
|
*/
|
@@ -207,15 +207,15 @@ class Compiler extends Service {
|
|
207
207
|
}
|
208
208
|
}
|
209
209
|
}
|
210
|
-
__decorate([
|
211
|
-
bind
|
212
|
-
], Compiler.prototype, "compile", null);
|
213
210
|
__decorate([
|
214
211
|
bind
|
215
212
|
], Compiler.prototype, "onError", null);
|
216
213
|
__decorate([
|
217
214
|
bind
|
218
215
|
], Compiler.prototype, "onStats", null);
|
216
|
+
__decorate([
|
217
|
+
bind
|
218
|
+
], Compiler.prototype, "compile", null);
|
219
219
|
__decorate([
|
220
220
|
bind
|
221
221
|
], Compiler.prototype, "register", null);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@roots/bud-compiler",
|
3
|
-
"version": "2023.9.
|
3
|
+
"version": "2023.9.4-2255",
|
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.9.
|
68
|
+
"@roots/bud-api": "2023.9.4-2255",
|
69
69
|
"@skypack/package-check": "0.2.2",
|
70
70
|
"@types/node": "18.17.9",
|
71
71
|
"@types/react": "18.2.21"
|
72
72
|
},
|
73
73
|
"dependencies": {
|
74
|
-
"@roots/bud-dashboard": "2023.9.
|
75
|
-
"@roots/bud-framework": "2023.9.
|
76
|
-
"@roots/bud-support": "2023.9.
|
74
|
+
"@roots/bud-dashboard": "2023.9.4-2255",
|
75
|
+
"@roots/bud-framework": "2023.9.4-2255",
|
76
|
+
"@roots/bud-support": "2023.9.4-2255",
|
77
77
|
"react": "18.2.0",
|
78
78
|
"tslib": "2.6.2"
|
79
79
|
},
|
package/src/service/index.tsx
CHANGED
@@ -56,49 +56,6 @@ class Compiler extends Service implements BudCompiler {
|
|
56
56
|
*/
|
57
57
|
public declare stats: BudCompiler[`stats`]
|
58
58
|
|
59
|
-
/**
|
60
|
-
* {@link BudCompiler.compile}
|
61
|
-
*/
|
62
|
-
@bind
|
63
|
-
public async compile(bud: Bud): Promise<MultiCompiler> {
|
64
|
-
const config = !bud.hasChildren
|
65
|
-
? [await bud.build.make()]
|
66
|
-
: await Promise.all(
|
67
|
-
Object.values(bud.children).map(async (child: Bud) =>
|
68
|
-
child.build.make().catch(error => {
|
69
|
-
throw error
|
70
|
-
}),
|
71
|
-
),
|
72
|
-
)
|
73
|
-
|
74
|
-
this.config = config?.filter(Boolean)
|
75
|
-
|
76
|
-
this.config.parallelism = Math.max(cpus().length - 1, 1)
|
77
|
-
this.logger.info(`parallel compilations: ${this.config.parallelism}`)
|
78
|
-
|
79
|
-
await bud.hooks.fire(`compiler.before`, bud).catch(error => {
|
80
|
-
throw error
|
81
|
-
})
|
82
|
-
|
83
|
-
this.logger.timeEnd(`initialize`)
|
84
|
-
this.app.dashboard.updateStatus(`compiling`)
|
85
|
-
|
86
|
-
try {
|
87
|
-
this.instance = this.implementation(this.config)
|
88
|
-
} catch (error: unknown) {
|
89
|
-
const normalError =
|
90
|
-
error instanceof Error ? error : BudError.normalize(error)
|
91
|
-
this.onError(normalError)
|
92
|
-
}
|
93
|
-
|
94
|
-
this.instance.hooks.done.tap(bud.label, (stats: any) => {
|
95
|
-
this.onStats(stats)
|
96
|
-
bud.hooks.fire(`compiler.done`, bud, this.stats).catch(this.onError)
|
97
|
-
})
|
98
|
-
|
99
|
-
return this.instance
|
100
|
-
}
|
101
|
-
|
102
59
|
/**
|
103
60
|
* {@link BudCompiler.onError}
|
104
61
|
*/
|
@@ -121,7 +78,6 @@ class Compiler extends Service implements BudCompiler {
|
|
121
78
|
render(<DisplayError error={BudError.normalize(error)} />)
|
122
79
|
}
|
123
80
|
}
|
124
|
-
|
125
81
|
/**
|
126
82
|
* {@link BudCompiler.onStats}
|
127
83
|
*/
|
@@ -196,6 +152,48 @@ class Compiler extends Service implements BudCompiler {
|
|
196
152
|
}
|
197
153
|
})
|
198
154
|
}
|
155
|
+
/**
|
156
|
+
* {@link BudCompiler.compile}
|
157
|
+
*/
|
158
|
+
@bind
|
159
|
+
public async compile(bud: Bud): Promise<MultiCompiler> {
|
160
|
+
const config = !bud.hasChildren
|
161
|
+
? [await bud.build.make()]
|
162
|
+
: await Promise.all(
|
163
|
+
Object.values(bud.children).map(async (child: Bud) =>
|
164
|
+
child.build.make().catch(error => {
|
165
|
+
throw error
|
166
|
+
}),
|
167
|
+
),
|
168
|
+
)
|
169
|
+
|
170
|
+
this.config = config?.filter(Boolean)
|
171
|
+
|
172
|
+
this.config.parallelism = Math.max(cpus().length - 1, 1)
|
173
|
+
this.logger.info(`parallel compilations: ${this.config.parallelism}`)
|
174
|
+
|
175
|
+
await bud.hooks.fire(`compiler.before`, bud).catch(error => {
|
176
|
+
throw error
|
177
|
+
})
|
178
|
+
|
179
|
+
this.logger.timeEnd(`initialize`)
|
180
|
+
this.app.dashboard.updateStatus(`compiling`)
|
181
|
+
|
182
|
+
try {
|
183
|
+
this.instance = this.implementation(this.config)
|
184
|
+
} catch (error: unknown) {
|
185
|
+
const normalError =
|
186
|
+
error instanceof Error ? error : BudError.normalize(error)
|
187
|
+
this.onError(normalError)
|
188
|
+
}
|
189
|
+
|
190
|
+
this.instance.hooks.done.tap(bud.label, (stats: any) => {
|
191
|
+
this.onStats(stats)
|
192
|
+
bud.hooks.fire(`compiler.done`, bud, this.stats).catch(this.onError)
|
193
|
+
})
|
194
|
+
|
195
|
+
return this.instance
|
196
|
+
}
|
199
197
|
|
200
198
|
/**
|
201
199
|
* {@link Service.register}
|