@roots/bud-compiler 6.6.5 → 6.6.7
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.
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Service } from '@roots/bud-framework/service';
|
2
2
|
import type { Compiler as Contract } from '@roots/bud-framework/services';
|
3
|
+
import type webpack from '@roots/bud-support/webpack';
|
3
4
|
import type { MultiCompiler, MultiStats, WebpackError } from '@roots/bud-support/webpack';
|
4
5
|
/**
|
5
6
|
* Wepback compilation controller class
|
@@ -7,33 +8,23 @@ import type { MultiCompiler, MultiStats, WebpackError } from '@roots/bud-support
|
|
7
8
|
* @public
|
8
9
|
*/
|
9
10
|
export declare class Compiler extends Service implements Contract.Service {
|
10
|
-
/**
|
11
|
-
* Service label
|
12
|
-
*
|
13
|
-
* @public
|
14
|
-
*/
|
15
|
-
static label: string;
|
16
11
|
/**
|
17
12
|
* Compiler implementation
|
18
|
-
*
|
19
13
|
* @public
|
20
14
|
*/
|
21
|
-
implementation:
|
15
|
+
implementation: typeof webpack;
|
22
16
|
/**
|
23
17
|
* Compiler instance
|
24
|
-
*
|
25
18
|
* @public
|
26
19
|
*/
|
27
20
|
instance: Contract.Service[`instance`];
|
28
21
|
/**
|
29
22
|
* Compilation stats
|
30
|
-
*
|
31
23
|
* @public
|
32
24
|
*/
|
33
25
|
stats: Contract.Service[`stats`];
|
34
26
|
/**
|
35
27
|
* Configuration
|
36
|
-
*
|
37
28
|
* @public
|
38
29
|
*/
|
39
30
|
config: Contract.Service[`config`];
|
@@ -61,14 +52,7 @@ export declare class Compiler extends Service implements Contract.Service {
|
|
61
52
|
* @public
|
62
53
|
* @decorator `@bind`
|
63
54
|
*/
|
64
|
-
|
65
|
-
/**
|
66
|
-
* Compiler close event
|
67
|
-
*
|
68
|
-
* @public
|
69
|
-
* @decorator `@bind`
|
70
|
-
*/
|
71
|
-
onClose(error?: WebpackError): void;
|
55
|
+
onStats(stats: MultiStats): void;
|
72
56
|
/**
|
73
57
|
* Compiler error event
|
74
58
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"compiler.service.d.ts","sourceRoot":"","sources":["../src/compiler.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,8BAA8B,CAAA;AACpD,OAAO,KAAK,EAAC,QAAQ,IAAI,QAAQ,EAAC,MAAM,+BAA+B,CAAA;AAEvE,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,YAAY,EACb,MAAM,4BAA4B,CAAA;AAEnC;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,OAAQ,YAAW,QAAQ,CAAC,OAAO;IAC/D
|
1
|
+
{"version":3,"file":"compiler.service.d.ts","sourceRoot":"","sources":["../src/compiler.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,8BAA8B,CAAA;AACpD,OAAO,KAAK,EAAC,QAAQ,IAAI,QAAQ,EAAC,MAAM,+BAA+B,CAAA;AAEvE,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAA;AACrD,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,YAAY,EACb,MAAM,4BAA4B,CAAA;AAEnC;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,OAAQ,YAAW,QAAQ,CAAC,OAAO;IAC/D;;;OAGG;IACI,cAAc,EAAE,OAAO,OAAO,CAAA;IAErC;;;OAGG;IACI,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IAE7C;;;OAGG;IACI,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAEvC;;;OAGG;IACI,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAK;IAE9C;;;;;;;;OAQG;IAEU,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC;IAyC9C;;;;;;OAMG;IAEI,QAAQ,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU;IAKtD;;;;;OAKG;IAEI,OAAO,CAAC,KAAK,EAAE,UAAU;IAKhC;;;;;OAKG;IAEI,OAAO,CAAC,KAAK,EAAE,YAAY;CAMnC"}
|
package/lib/compiler.service.js
CHANGED
@@ -11,7 +11,6 @@ export class Compiler extends Service {
|
|
11
11
|
super(...arguments);
|
12
12
|
/**
|
13
13
|
* Configuration
|
14
|
-
*
|
15
14
|
* @public
|
16
15
|
*/
|
17
16
|
this.config = [];
|
@@ -26,42 +25,33 @@ export class Compiler extends Service {
|
|
26
25
|
* @decorator `@once`
|
27
26
|
*/
|
28
27
|
async compile() {
|
29
|
-
|
30
|
-
this.
|
31
|
-
this.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
const config = await child.build.make();
|
41
|
-
this.logger.log(`child config`, child.label);
|
42
|
-
this.logger.info(child.label, child.build.config);
|
43
|
-
this.config.push(config);
|
28
|
+
this.implementation = await this.app.module.import(`webpack`);
|
29
|
+
this.logger.log(`imported webpack`, this.implementation.version);
|
30
|
+
this.config = !this.app.hasChildren
|
31
|
+
? [await this.app.build.make()]
|
32
|
+
: await Promise.all(Object.values(this.app.children).map(async (child) => {
|
33
|
+
try {
|
34
|
+
return await child.build.make();
|
35
|
+
}
|
36
|
+
catch (error) {
|
37
|
+
throw error;
|
38
|
+
}
|
44
39
|
}));
|
40
|
+
try {
|
41
|
+
await this.app.hooks.fire(`compiler.before`);
|
42
|
+
}
|
43
|
+
catch (error) {
|
44
|
+
throw error;
|
45
45
|
}
|
46
|
-
|
47
|
-
if (this.app.context.args.dry) {
|
46
|
+
if (this.app.isCLI() && this.app.context.args.dry) {
|
48
47
|
this.logger.log(`running in dry mode. exiting early.`);
|
49
48
|
return;
|
50
49
|
}
|
50
|
+
this.app.context.logger.timeEnd(`initialize`);
|
51
51
|
this.instance = this.implementation(this.config);
|
52
|
-
this.app.
|
53
|
-
|
54
|
-
this.
|
55
|
-
this.handleStats(stats);
|
56
|
-
await this.app.hooks.fire(`compiler.close`);
|
57
|
-
});
|
58
|
-
this.instance.compilers.forEach(compiler => compiler.hooks.afterEmit.tapAsync(this.app.label, async (stats, callback) => {
|
59
|
-
try {
|
60
|
-
await this.app.hooks.fire(`compiler.after`);
|
61
|
-
}
|
62
|
-
catch (error) { }
|
63
|
-
return callback();
|
64
|
-
}));
|
52
|
+
this.instance.hooks.done.tap(this.app.label, this.onStats);
|
53
|
+
this.instance.hooks.done.tap(`${this.app.label}-close`, async () => await this.app.hooks.fire(`compiler.after`));
|
54
|
+
await this.app.hooks.fire(`compiler.after`);
|
65
55
|
return this.instance;
|
66
56
|
}
|
67
57
|
/**
|
@@ -72,10 +62,10 @@ export class Compiler extends Service {
|
|
72
62
|
* @decorator `@once`
|
73
63
|
*/
|
74
64
|
callback(error, stats) {
|
75
|
-
if (error)
|
76
|
-
return this.onError(error);
|
77
65
|
if (stats)
|
78
|
-
|
66
|
+
this.onStats(stats);
|
67
|
+
if (error)
|
68
|
+
this.onError(error);
|
79
69
|
}
|
80
70
|
/**
|
81
71
|
* Stats handler
|
@@ -83,19 +73,9 @@ export class Compiler extends Service {
|
|
83
73
|
* @public
|
84
74
|
* @decorator `@bind`
|
85
75
|
*/
|
86
|
-
|
76
|
+
onStats(stats) {
|
87
77
|
this.stats = stats;
|
88
|
-
this.app.dashboard.
|
89
|
-
}
|
90
|
-
/**
|
91
|
-
* Compiler close event
|
92
|
-
*
|
93
|
-
* @public
|
94
|
-
* @decorator `@bind`
|
95
|
-
*/
|
96
|
-
onClose(error) {
|
97
|
-
if (error)
|
98
|
-
return this.onError(error);
|
78
|
+
this.app.dashboard.update(stats);
|
99
79
|
}
|
100
80
|
/**
|
101
81
|
* Compiler error event
|
@@ -106,18 +86,9 @@ export class Compiler extends Service {
|
|
106
86
|
onError(error) {
|
107
87
|
this.app.isDevelopment &&
|
108
88
|
this.app.server.appliedMiddleware?.hot?.publish({ error });
|
109
|
-
|
110
|
-
process.exitCode = 1;
|
111
|
-
this.app.error(error);
|
112
|
-
}
|
89
|
+
throw error;
|
113
90
|
}
|
114
91
|
}
|
115
|
-
/**
|
116
|
-
* Service label
|
117
|
-
*
|
118
|
-
* @public
|
119
|
-
*/
|
120
|
-
Compiler.label = `compiler`;
|
121
92
|
__decorate([
|
122
93
|
bind,
|
123
94
|
__metadata("design:type", Function),
|
@@ -135,13 +106,7 @@ __decorate([
|
|
135
106
|
__metadata("design:type", Function),
|
136
107
|
__metadata("design:paramtypes", [Function]),
|
137
108
|
__metadata("design:returntype", void 0)
|
138
|
-
], Compiler.prototype, "
|
139
|
-
__decorate([
|
140
|
-
bind,
|
141
|
-
__metadata("design:type", Function),
|
142
|
-
__metadata("design:paramtypes", [Function]),
|
143
|
-
__metadata("design:returntype", void 0)
|
144
|
-
], Compiler.prototype, "onClose", null);
|
109
|
+
], Compiler.prototype, "onStats", null);
|
145
110
|
__decorate([
|
146
111
|
bind,
|
147
112
|
__metadata("design:type", Function),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"compiler.service.js","sourceRoot":"","sources":["../src/compiler.service.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,OAAO,EAAC,MAAM,8BAA8B,CAAA;AAEpD,OAAO,EAAC,IAAI,EAAC,MAAM,+BAA+B,CAAA;
|
1
|
+
{"version":3,"file":"compiler.service.js","sourceRoot":"","sources":["../src/compiler.service.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,OAAO,EAAC,MAAM,8BAA8B,CAAA;AAEpD,OAAO,EAAC,IAAI,EAAC,MAAM,+BAA+B,CAAA;AAQlD;;;;GAIG;AACH,MAAM,OAAO,QAAS,SAAQ,OAAO;IAArC;;QAmBE;;;WAGG;QACI,WAAM,GAA+B,EAAE,CAAA;IA2FhD,CAAC;IAzFC;;;;;;;;OAQG;IAEU,AAAN,KAAK,CAAC,OAAO;QAClB,IAAI,CAAC,cAAc,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CA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
+
"version": "6.6.7",
|
5
5
|
"homepage": "https://roots.io/bud",
|
6
6
|
"repository": {
|
7
7
|
"type": "git",
|
@@ -50,13 +50,13 @@
|
|
50
50
|
}
|
51
51
|
},
|
52
52
|
"devDependencies": {
|
53
|
-
"@roots/bud-api": "6.6.
|
53
|
+
"@roots/bud-api": "6.6.7",
|
54
54
|
"@skypack/package-check": "0.2.2",
|
55
55
|
"@types/node": "16.18.6"
|
56
56
|
},
|
57
57
|
"dependencies": {
|
58
|
-
"@roots/bud-framework": "6.6.
|
59
|
-
"@roots/bud-support": "6.6.
|
58
|
+
"@roots/bud-framework": "6.6.7",
|
59
|
+
"@roots/bud-support": "6.6.7"
|
60
60
|
},
|
61
61
|
"volta": {
|
62
62
|
"extends": "../../../package.json"
|