@roots/bud-compiler 6.6.6 → 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
|
@@ -9,25 +10,21 @@ import type { MultiCompiler, MultiStats, WebpackError } from '@roots/bud-support
|
|
9
10
|
export declare class Compiler extends Service implements Contract.Service {
|
10
11
|
/**
|
11
12
|
* Compiler implementation
|
12
|
-
*
|
13
13
|
* @public
|
14
14
|
*/
|
15
|
-
implementation:
|
15
|
+
implementation: typeof webpack;
|
16
16
|
/**
|
17
17
|
* Compiler instance
|
18
|
-
*
|
19
18
|
* @public
|
20
19
|
*/
|
21
20
|
instance: Contract.Service[`instance`];
|
22
21
|
/**
|
23
22
|
* Compilation stats
|
24
|
-
*
|
25
23
|
* @public
|
26
24
|
*/
|
27
25
|
stats: Contract.Service[`stats`];
|
28
26
|
/**
|
29
27
|
* Configuration
|
30
|
-
*
|
31
28
|
* @public
|
32
29
|
*/
|
33
30
|
config: Contract.Service[`config`];
|
@@ -55,14 +52,7 @@ export declare class Compiler extends Service implements Contract.Service {
|
|
55
52
|
* @public
|
56
53
|
* @decorator `@bind`
|
57
54
|
*/
|
58
|
-
|
59
|
-
/**
|
60
|
-
* Compiler close event
|
61
|
-
*
|
62
|
-
* @public
|
63
|
-
* @decorator `@bind`
|
64
|
-
*/
|
65
|
-
onClose(error?: WebpackError): void;
|
55
|
+
onStats(stats: MultiStats): void;
|
66
56
|
/**
|
67
57
|
* Compiler error event
|
68
58
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"compiler.service.d.ts","sourceRoot":"","sources":["../src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Y;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,57 +25,34 @@ 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
|
}));
|
45
|
-
}
|
46
40
|
try {
|
47
41
|
await this.app.hooks.fire(`compiler.before`);
|
48
42
|
}
|
49
43
|
catch (error) {
|
50
44
|
throw error;
|
51
45
|
}
|
52
|
-
this.app.context.
|
53
|
-
if (this.app.context.args.dry) {
|
46
|
+
if (this.app.isCLI() && this.app.context.args.dry) {
|
54
47
|
this.logger.log(`running in dry mode. exiting early.`);
|
55
48
|
return;
|
56
49
|
}
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
}
|
64
|
-
this.app.isDevelopment &&
|
65
|
-
this.instance.hooks.done.tap(`${this.app.label}-dev-handle`, this.handleStats);
|
66
|
-
this.instance.hooks.done.tap(this.app.label, async (stats) => {
|
67
|
-
this.handleStats(stats);
|
68
|
-
await this.app.hooks.fire(`compiler.close`);
|
69
|
-
});
|
70
|
-
this.instance.compilers.forEach(compiler => compiler.hooks.afterEmit.tapAsync(this.app.label, async (_stats, callback) => {
|
71
|
-
try {
|
72
|
-
await this.app.hooks.fire(`compiler.after`);
|
73
|
-
}
|
74
|
-
catch (error) { }
|
75
|
-
return callback();
|
76
|
-
}));
|
77
|
-
return this.instance;
|
78
|
-
}
|
79
|
-
catch (error) { }
|
50
|
+
this.app.context.logger.timeEnd(`initialize`);
|
51
|
+
this.instance = this.implementation(this.config);
|
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`);
|
55
|
+
return this.instance;
|
80
56
|
}
|
81
57
|
/**
|
82
58
|
* Webpack callback
|
@@ -86,10 +62,10 @@ export class Compiler extends Service {
|
|
86
62
|
* @decorator `@once`
|
87
63
|
*/
|
88
64
|
callback(error, stats) {
|
89
|
-
if (error)
|
90
|
-
return this.onError(error);
|
91
65
|
if (stats)
|
92
|
-
|
66
|
+
this.onStats(stats);
|
67
|
+
if (error)
|
68
|
+
this.onError(error);
|
93
69
|
}
|
94
70
|
/**
|
95
71
|
* Stats handler
|
@@ -97,20 +73,10 @@ export class Compiler extends Service {
|
|
97
73
|
* @public
|
98
74
|
* @decorator `@bind`
|
99
75
|
*/
|
100
|
-
|
76
|
+
onStats(stats) {
|
101
77
|
this.stats = stats;
|
102
78
|
this.app.dashboard.update(stats);
|
103
79
|
}
|
104
|
-
/**
|
105
|
-
* Compiler close event
|
106
|
-
*
|
107
|
-
* @public
|
108
|
-
* @decorator `@bind`
|
109
|
-
*/
|
110
|
-
onClose(error) {
|
111
|
-
if (error)
|
112
|
-
return this.onError(error);
|
113
|
-
}
|
114
80
|
/**
|
115
81
|
* Compiler error event
|
116
82
|
*
|
@@ -120,9 +86,7 @@ export class Compiler extends Service {
|
|
120
86
|
onError(error) {
|
121
87
|
this.app.isDevelopment &&
|
122
88
|
this.app.server.appliedMiddleware?.hot?.publish({ error });
|
123
|
-
|
124
|
-
throw error?.message ?? error;
|
125
|
-
}
|
89
|
+
throw error;
|
126
90
|
}
|
127
91
|
}
|
128
92
|
__decorate([
|
@@ -142,13 +106,7 @@ __decorate([
|
|
142
106
|
__metadata("design:type", Function),
|
143
107
|
__metadata("design:paramtypes", [Function]),
|
144
108
|
__metadata("design:returntype", void 0)
|
145
|
-
], Compiler.prototype, "
|
146
|
-
__decorate([
|
147
|
-
bind,
|
148
|
-
__metadata("design:type", Function),
|
149
|
-
__metadata("design:paramtypes", [Function]),
|
150
|
-
__metadata("design:returntype", void 0)
|
151
|
-
], Compiler.prototype, "onClose", null);
|
109
|
+
], Compiler.prototype, "onStats", null);
|
152
110
|
__decorate([
|
153
111
|
bind,
|
154
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,CAAC,MAAM,CAAC,SAAS,CAAC,CAA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": "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"
|