@roots/bud-compiler 6.3.5 → 6.4.1

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/LICENSE.md CHANGED
@@ -12,7 +12,7 @@ copies or substantial portions of the Software.
12
12
 
13
13
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
14
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
16
16
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
17
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
18
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
package/README.md CHANGED
@@ -63,9 +63,6 @@ Help support our open-source development efforts by [becoming a patron](https://
63
63
  <a href="https://carrot.com/">
64
64
  <img src="https://cdn.roots.io/app/uploads/carrot.svg" alt="Carrot" width="200" height="150"/>
65
65
  </a>
66
- <a href="https://www.c21redwood.com/">
67
- <img src="https://cdn.roots.io/app/uploads/c21redwood.svg" alt="C21 Redwood Realty" width="200" height="150"/>
68
- </a>
69
66
  <a href="https://wordpress.com/">
70
67
  <img src="https://cdn.roots.io/app/uploads/wordpress.svg" alt="WordPress.com" width="200" height="150"/>
71
68
  </a>
@@ -1,8 +1,6 @@
1
- import type { Compiler as Contract } from '@roots/bud-framework';
2
- import { Service } from '@roots/bud-framework';
3
- import type { Configuration, MultiStats, Stats, StatsCompilation, WebpackError } from 'webpack';
4
- import Webpack from 'webpack';
5
- import type BudError from './Reporter/BudError.js';
1
+ import { Service } from '@roots/bud-framework/service';
2
+ import type { Compiler as Contract } from '@roots/bud-framework/services';
3
+ import type { MultiCompiler, MultiStats, WebpackError } from 'webpack';
6
4
  /**
7
5
  * Wepback compilation controller class
8
6
  *
@@ -10,53 +8,35 @@ import type BudError from './Reporter/BudError.js';
10
8
  */
11
9
  export declare class Compiler extends Service implements Contract.Service {
12
10
  /**
13
- * Compiler implementation
11
+ * Service label
14
12
  *
15
- * @internal
13
+ * @public
16
14
  */
17
- protected _implementation: Contract.Implementation;
15
+ static label: string;
18
16
  /**
19
17
  * Compiler implementation
20
18
  *
21
19
  * @public
22
20
  */
23
- get implementation(): Contract.Implementation;
24
- set implementation(implementation: Contract.Implementation);
21
+ implementation: Contract.Service[`implementation`];
25
22
  /**
26
23
  * Compiler instance
27
24
  *
28
25
  * @public
29
26
  */
30
- compilation: Contract.Service['compilation'];
27
+ instance: Contract.Service[`instance`];
31
28
  /**
32
29
  * Compilation stats
33
30
  *
34
31
  * @public
35
32
  */
36
- stats: {
37
- json: StatsCompilation;
38
- string: string;
39
- };
40
- /**
41
- * Errors
42
- *
43
- * @public
44
- */
45
- errors: Array<BudError>;
33
+ stats: Contract.Service[`stats`];
46
34
  /**
47
- * Warnings
35
+ * Configuration
48
36
  *
49
37
  * @public
50
38
  */
51
- warnings: Array<BudError>;
52
- /**
53
- * Multi-compiler configuration
54
- *
55
- * @public
56
- */
57
- config: Array<Configuration>;
58
- done: boolean;
59
- compiling: boolean;
39
+ config: Contract.Service[`config`];
60
40
  /**
61
41
  * Initiates compilation
62
42
  *
@@ -66,22 +46,7 @@ export declare class Compiler extends Service implements Contract.Service {
66
46
  * @decorator `@bind`
67
47
  * @decorator `@once`
68
48
  */
69
- compile(): Promise<Webpack.MultiCompiler>;
70
- /**
71
- * Invoke compiler
72
- *
73
- * @public
74
- * @decorator `@bind`
75
- * @decorator `@once`
76
- */
77
- invoke(config: Array<Configuration>): Promise<Contract.Service['compilation']>;
78
- /**
79
- * Returns final webpack configuration
80
- *
81
- * @public
82
- * @decorator `@bind`
83
- */
84
- before(): Promise<Configuration[]>;
49
+ compile(): Promise<MultiCompiler>;
85
50
  /**
86
51
  * Webpack callback
87
52
  *
@@ -89,27 +54,27 @@ export declare class Compiler extends Service implements Contract.Service {
89
54
  * @decorator `@bind`
90
55
  * @decorator `@once`
91
56
  */
92
- callback(error: Error, stats: Stats & MultiStats): void;
57
+ callback(error: Error, stats: MultiStats): void;
93
58
  /**
94
59
  * Stats handler
95
60
  *
96
61
  * @public
97
62
  * @decorator `@bind`
98
63
  */
99
- handleStats(stats: Stats & MultiStats): void;
64
+ handleStats(stats: MultiStats): void;
100
65
  /**
101
66
  * Compiler close event
102
67
  *
103
68
  * @public
104
69
  * @decorator `@bind`
105
70
  */
106
- onClose(error: WebpackError): void;
71
+ onClose(error?: WebpackError): void;
107
72
  /**
108
73
  * Compiler error event
109
74
  *
110
75
  * @public
111
76
  * @decorator `@bind`
112
77
  */
113
- onError(error: BudError[] | Error): void;
78
+ onError(error: Error): void;
114
79
  }
115
80
  //# sourceMappingURL=compiler.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compiler.service.d.ts","sourceRoot":"","sources":["../src/compiler.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAM,QAAQ,IAAI,QAAQ,EAAC,MAAM,sBAAsB,CAAA;AACnE,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAA;AAG5C,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,YAAY,EACb,MAAM,SAAS,CAAA;AAChB,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAA;AAGlD;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,OAAQ,YAAW,QAAQ,CAAC,OAAO;IAC/D;;;;OAIG;IACH,SAAS,CAAC,eAAe,EAAE,QAAQ,CAAC,cAAc,CAAU;IAE5D;;;;OAIG;IACH,IAAW,cAAc,IAAI,QAAQ,CAAC,cAAc,CAEnD;I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U,EAAE,YAAY,EAAC,MAAM,SAAS,CAAA;AAEpE;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,OAAQ,YAAW,QAAQ,CAAC,OAAO;IAC/D;;;;OAIG;IACH,OAAc,KAAK,SAAa;IAEhC;;;;OAIG;IACI,cAAc,EAAE,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAEzD;;;;OAIG;IACI,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IAE7C;;;;OAIG;IACI,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAEvC;;;;OAIG;IACI,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAK;IAE9C;;;;;;;;OAQG;IAEU,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC;IAiD9C;;;;;;OAMG;IAEI,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU;IAK/C;;;;;OAKG;IAEI,WAAW,CAAC,KAAK,EAAE,UAAU;IAOpC;;;;;OAKG;IAEI,OAAO,CAAC,KAAK,CAAC,EAAE,YAAY;IAInC;;;;;OAKG;IAEI,OAAO,CAAC,KAAK,EAAE,KAAK;CAQ5B"}
@@ -1,9 +1,6 @@
1
1
  import { __decorate } from "tslib";
2
- import { Service } from '@roots/bud-framework';
3
- import { bind, once } from 'helpful-decorators';
4
- import { isFunction } from 'lodash-es';
5
- import Webpack from 'webpack';
6
- import * as Reporter from './Reporter/index.js';
2
+ import { Service } from '@roots/bud-framework/service';
3
+ import { bind } from '@roots/bud-support/decorators';
7
4
  /**
8
5
  * Wepback compilation controller class
9
6
  *
@@ -13,51 +10,11 @@ export class Compiler extends Service {
13
10
  constructor() {
14
11
  super(...arguments);
15
12
  /**
16
- * Compiler implementation
17
- *
18
- * @internal
19
- */
20
- this._implementation = Webpack;
21
- /**
22
- * Compilation stats
23
- *
24
- * @public
25
- */
26
- this.stats = {
27
- json: null,
28
- string: null,
29
- };
30
- /**
31
- * Errors
32
- *
33
- * @public
34
- */
35
- this.errors = [];
36
- /**
37
- * Warnings
38
- *
39
- * @public
40
- */
41
- this.warnings = [];
42
- /**
43
- * Multi-compiler configuration
13
+ * Configuration
44
14
  *
45
15
  * @public
46
16
  */
47
17
  this.config = [];
48
- this.done = false;
49
- this.compiling = false;
50
- }
51
- /**
52
- * Compiler implementation
53
- *
54
- * @public
55
- */
56
- get implementation() {
57
- return this._implementation;
58
- }
59
- set implementation(implementation) {
60
- this._implementation = implementation;
61
18
  }
62
19
  /**
63
20
  * Initiates compilation
@@ -69,50 +26,37 @@ export class Compiler extends Service {
69
26
  * @decorator `@once`
70
27
  */
71
28
  async compile() {
72
- this.config = await this.before();
73
- this.app._hrdone = this.app._hrdiff();
74
- this.compilation = await this.invoke(this.config);
75
- return this.compilation;
76
- }
77
- /**
78
- * Invoke compiler
79
- *
80
- * @public
81
- * @decorator `@bind`
82
- * @decorator `@once`
83
- */
84
- async invoke(config) {
85
- await this.app.hooks.fire('compiler.before');
86
- this.compilation = this.implementation(config ?? this.config);
87
- this.app.isDevelopment &&
88
- this.compilation.hooks.done.tap(`${this.app.name}-dev-handle`, async (stats) => {
89
- this.handleStats(stats);
90
- });
91
- this.compilation.hooks.done.tap(`${this.app.name}-cli-done`, async () => await this.app.hooks.fire('compiler.close'));
92
- new Webpack.ProgressPlugin(this.app.dashboard.progressCallback).apply(this.compilation);
93
- await this.app.hooks.fire('compiler.after');
94
- return this.compilation;
95
- }
96
- /**
97
- * Returns final webpack configuration
98
- *
99
- * @public
100
- * @decorator `@bind`
101
- */
102
- async before() {
29
+ const webpack = await import(`webpack`);
30
+ this.implementation = webpack.default;
31
+ this.logger.log(`imported webpack`, webpack.default.version);
32
+ this.config = [];
103
33
  if (!this.app.hasChildren) {
104
- await this.app.build.make();
105
- this.config.push(this.app.build.config);
106
- return this.config;
107
- }
108
- await Promise.all(Object.entries(this.app.children).map(async ([name, instance]) => {
109
- const config = await instance.build.make();
110
- this.app.log(`child config`, name, config);
34
+ this.logger.log(`no children found, processing parent instance`);
35
+ const config = await this.app.build.make();
111
36
  this.config.push(config);
112
- return Promise.resolve();
113
- }));
114
- this.app.log(this.config);
115
- return this.config;
37
+ }
38
+ else {
39
+ await Promise.all(Object.values(this.app.children).map(async (child) => {
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);
44
+ }));
45
+ }
46
+ await this.app.hooks.fire(`compiler.before`);
47
+ if (this.app.context.args.dry) {
48
+ this.logger.log(`running in dry mode. exiting early.`);
49
+ return;
50
+ }
51
+ this.instance = this.implementation(this.config);
52
+ this.app.isDevelopment &&
53
+ this.instance.hooks.done.tap(`${this.app.label}-dev-handle`, this.handleStats);
54
+ this.instance.hooks.done.tap(this.app.label, async (stats) => {
55
+ this.handleStats(stats);
56
+ await this.app.hooks.fire(`compiler.close`);
57
+ });
58
+ await this.app.hooks.fire(`compiler.after`);
59
+ return this.instance;
116
60
  }
117
61
  /**
118
62
  * Webpack callback
@@ -134,19 +78,10 @@ export class Compiler extends Service {
134
78
  * @decorator `@bind`
135
79
  */
136
80
  handleStats(stats) {
137
- if (!stats?.toJson || !isFunction(stats?.toJson))
81
+ if (!stats)
138
82
  return;
139
- this.stats.json = stats.toJson();
140
- this.stats.string = stats.toString();
141
- const problemReporter = Reporter.report(this.app, this.stats.json);
142
- this.errors = problemReporter.errors;
143
- this.warnings = problemReporter.warnings;
144
- this.app.dashboard.stats({
145
- stats: this.stats.json,
146
- errors: this.errors,
147
- warnings: this.warnings,
148
- });
149
- this.app.isProduction && this.compilation.close(this.onClose);
83
+ this.stats = stats;
84
+ this.app.dashboard.stats({ stats });
150
85
  }
151
86
  /**
152
87
  * Compiler close event
@@ -157,7 +92,6 @@ export class Compiler extends Service {
157
92
  onClose(error) {
158
93
  if (error)
159
94
  return this.onError(error);
160
- this.app.isProduction && this.app.close();
161
95
  }
162
96
  /**
163
97
  * Compiler error event
@@ -168,23 +102,21 @@ export class Compiler extends Service {
168
102
  onError(error) {
169
103
  this.app.isDevelopment &&
170
104
  this.app.server.appliedMiddleware?.hot?.publish({ error });
171
- this.app.error(error);
105
+ this.logger.error(error);
106
+ process.exitCode = 1;
172
107
  }
173
108
  }
109
+ /**
110
+ * Service label
111
+ *
112
+ * @public
113
+ */
114
+ Compiler.label = `compiler`;
174
115
  __decorate([
175
- bind,
176
- once
116
+ bind
177
117
  ], Compiler.prototype, "compile", null);
178
- __decorate([
179
- bind,
180
- once
181
- ], Compiler.prototype, "invoke", null);
182
118
  __decorate([
183
119
  bind
184
- ], Compiler.prototype, "before", null);
185
- __decorate([
186
- bind,
187
- once
188
120
  ], Compiler.prototype, "callback", null);
189
121
  __decorate([
190
122
  bind
@@ -1 +1 @@
1
- {"version":3,"file":"compiler.service.js","sourceRoot":"","sources":["../src/compiler.service.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAA;AAC5C,OAAO,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAA;AAQpC,OAAO,OAAO,MAAM,SAAS,CAAA;AAG7B,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAE/C;;;;GAIG;AACH,MAAM,OAAO,QAAS,SAAQ,OAAO;IAArC;;QACE;;;;WAIG;QACO,oBAAe,GAA4B,OAAO,CAAA;QAqB5D;;;;WAIG;QACI,UAAK,GAGR;YACF,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;SACb,CAAA;QAED;;;;WAIG;QACI,WAAM,GAAoB,EAAE,CAAA;QAEnC;;;;WAIG;QACI,aAAQ,GAAoB,EAAE,CAAA;QAErC;;;;WAIG;QACI,WAAM,GAAyB,EAAE,CAAA;QAEjC,SAAI,GAAY,KAAK,CAAA;QACrB,cAAS,GAAY,KAAK,CAAA;IA0JnC,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,IAAI;uCAQJ"}
package/lib/index.d.ts CHANGED
@@ -8,5 +8,5 @@
8
8
  * @packageDocumentation
9
9
  */
10
10
  import { Compiler } from './compiler.service.js';
11
- export { Compiler, Compiler as Service, Compiler as default };
11
+ export default Compiler;
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAE9C,OAAO,EAAC,QAAQ,EAAE,QAAQ,IAAI,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAE9C,eAAe,QAAQ,CAAA"}
package/lib/index.js CHANGED
@@ -10,5 +10,5 @@
10
10
  * @packageDocumentation
11
11
  */
12
12
  import { Compiler } from './compiler.service.js';
13
- export { Compiler, Compiler as Service, Compiler as default };
13
+ export default Compiler;
14
14
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,kCAAkC;AAElC;;;;;;;;GAQG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAE9C,OAAO,EAAC,QAAQ,EAAE,QAAQ,IAAI,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,kCAAkC;AAElC;;;;;;;;GAQG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAE9C,eAAe,QAAQ,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@roots/bud-compiler",
3
3
  "description": "Compilation handler",
4
- "version": "6.3.5",
4
+ "version": "6.4.1",
5
5
  "homepage": "https://roots.io/bud",
6
6
  "repository": {
7
7
  "type": "git",
@@ -50,16 +50,15 @@
50
50
  }
51
51
  },
52
52
  "devDependencies": {
53
- "@roots/bud-api": "6.3.5",
53
+ "@jest/globals": "29.0.1",
54
+ "@roots/bud-api": "6.4.1",
54
55
  "@skypack/package-check": "0.2.2",
55
- "@types/lodash-es": "4.17.6",
56
- "@types/node": "16.11.45",
56
+ "@types/node": "16.11.48",
57
57
  "webpack": "5.73.0"
58
58
  },
59
59
  "dependencies": {
60
- "@roots/bud-framework": "6.3.5",
61
- "helpful-decorators": "2.1.0",
62
- "lodash-es": "4.17.21",
60
+ "@roots/bud-framework": "6.4.1",
61
+ "@roots/bud-support": "6.4.1",
63
62
  "tslib": "2.4.0"
64
63
  },
65
64
  "volta": {
@@ -1,27 +0,0 @@
1
- import type { StatsError } from 'webpack';
2
- export default class BudError {
3
- statsError?: StatsError;
4
- file: string;
5
- source: string;
6
- message: string;
7
- line: number;
8
- column: number;
9
- type: 'syntax' | 'export';
10
- constructor(statsError?: StatsError);
11
- hasType(): boolean;
12
- getType(): this['type'];
13
- setType(type: this['type']): void;
14
- getFile(): string;
15
- setFile(file: string | ((file: string) => string)): this;
16
- hasFile(): boolean;
17
- getMessage(): string;
18
- setMessage(message: string | ((message: string) => string)): this;
19
- hasMessage(): boolean;
20
- getLine(): number;
21
- setLine(line: number | string): this;
22
- hasLine(): boolean;
23
- getColumn(): number;
24
- setColumn(column: number | string): this;
25
- hasColumn(): boolean;
26
- }
27
- //# sourceMappingURL=BudError.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BudError.d.ts","sourceRoot":"","sources":["../../src/Reporter/BudError.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,SAAS,CAAA;AAEvC,MAAM,CAAC,OAAO,OAAO,QAAQ;IAQD,UAAU,CAAC,EAAE,UAAU;IAP1C,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAI;IAChB,MAAM,EAAE,MAAM,CAAI;IAClB,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAO;gBAEb,UAAU,CAAC,EAAE,UAAU;IAY1C,OAAO;IAIP,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC;IAIvB,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;IAK1B,OAAO,IAAI,MAAM;IAIjB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,IAAI;IAMxD,OAAO;IAKP,UAAU,IAAI,MAAM;IAIpB,UAAU,CACf,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,GAC9C,IAAI;IAOA,UAAU;IAKV,OAAO,IAAI,MAAM;IAIjB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAMpC,OAAO;IAKP,SAAS,IAAI,MAAM;IAInB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAOxC,SAAS;CAGjB"}
@@ -1,115 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { bind } from 'helpful-decorators';
3
- export default class BudError {
4
- constructor(statsError) {
5
- this.statsError = statsError;
6
- this.line = 0;
7
- this.column = 0;
8
- this.type = null;
9
- if (!statsError)
10
- return;
11
- this.source =
12
- statsError?.moduleName?.split('!').pop() ??
13
- statsError?.moduleIdentifier?.split('!').pop() ??
14
- null;
15
- this.setFile(this.source);
16
- this.message = statsError?.message ?? null;
17
- }
18
- hasType() {
19
- return typeof this.type === 'string';
20
- }
21
- getType() {
22
- return this.type;
23
- }
24
- setType(type) {
25
- this.type = type;
26
- }
27
- getFile() {
28
- return this.file;
29
- }
30
- setFile(file) {
31
- this.file = typeof file === 'function' ? file(this.file ?? '') : file;
32
- return this;
33
- }
34
- hasFile() {
35
- return typeof this.file === 'string';
36
- }
37
- getMessage() {
38
- return this.message;
39
- }
40
- setMessage(message) {
41
- this.message =
42
- typeof message === 'function' ? message(this.message ?? '') : message;
43
- return this;
44
- }
45
- hasMessage() {
46
- return typeof this.message === 'string';
47
- }
48
- getLine() {
49
- return this.line;
50
- }
51
- setLine(line) {
52
- this.line = typeof line === 'string' ? Number.parseInt(line) : line;
53
- return this;
54
- }
55
- hasLine() {
56
- return this.line !== 0;
57
- }
58
- getColumn() {
59
- return this.column;
60
- }
61
- setColumn(column) {
62
- this.column =
63
- typeof column === 'string' ? Number.parseInt(column) : column;
64
- return this;
65
- }
66
- hasColumn() {
67
- return this.column !== 0;
68
- }
69
- }
70
- __decorate([
71
- bind
72
- ], BudError.prototype, "hasType", null);
73
- __decorate([
74
- bind
75
- ], BudError.prototype, "getType", null);
76
- __decorate([
77
- bind
78
- ], BudError.prototype, "setType", null);
79
- __decorate([
80
- bind
81
- ], BudError.prototype, "getFile", null);
82
- __decorate([
83
- bind
84
- ], BudError.prototype, "setFile", null);
85
- __decorate([
86
- bind
87
- ], BudError.prototype, "hasFile", null);
88
- __decorate([
89
- bind
90
- ], BudError.prototype, "getMessage", null);
91
- __decorate([
92
- bind
93
- ], BudError.prototype, "setMessage", null);
94
- __decorate([
95
- bind
96
- ], BudError.prototype, "hasMessage", null);
97
- __decorate([
98
- bind
99
- ], BudError.prototype, "getLine", null);
100
- __decorate([
101
- bind
102
- ], BudError.prototype, "setLine", null);
103
- __decorate([
104
- bind
105
- ], BudError.prototype, "hasLine", null);
106
- __decorate([
107
- bind
108
- ], BudError.prototype, "getColumn", null);
109
- __decorate([
110
- bind
111
- ], BudError.prototype, "setColumn", null);
112
- __decorate([
113
- bind
114
- ], BudError.prototype, "hasColumn", null);
115
- //# sourceMappingURL=BudError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BudError.js","sourceRoot":"","sources":["../../src/Reporter/BudError.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAA;AAGvC,MAAM,CAAC,OAAO,OAAO,QAAQ;IAQ3B,YAA0B,UAAuB;QAAvB,eAAU,GAAV,UAAU,CAAa;QAJ1C,SAAI,GAAW,CAAC,CAAA;QAChB,WAAM,GAAW,CAAC,CAAA;QAClB,SAAI,GAAwB,IAAI,CAAA;QAGrC,IAAI,CAAC,UAAU;YAAE,OAAM;QAEvB,IAAI,CAAC,MAAM;YACT,UAAU,EAAE,UAAU,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE;gBACxC,UAAU,EAAE,gBAAgB,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE;gBAC9C,IAAI,CAAA;QACN,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACzB,IAAI,CAAC,OAAO,GAAG,UAAU,EAAE,OAAO,IAAI,IAAI,CAAA;IAC5C,CAAC;IAGM,OAAO;QACZ,OAAO,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAA;IACtC,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC,IAAI,CAAA;IAClB,CAAC;IAEM,OAAO,CAAC,IAAkB;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAGM,OAAO;QACZ,OAAO,IAAI,CAAC,IAAI,CAAA;IAClB,CAAC;IAEM,OAAO,CAAC,IAAyC;QACtD,IAAI,CAAC,IAAI,GAAG,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAErE,OAAO,IAAI,CAAA;IACb,CAAC;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IAAI;uCAGJ;AAGD;IADC,IAAI;0CAGJ;AAED;IADC,IAAI;0CAQJ;AAED;IADC,IAAI;0CAGJ;AAGD;IADC,IAAI;uCAGJ;AAED;IADC,IAAI;uCAKJ;AAED;IADC,IAAI;uCAGJ;AAGD;IADC,IAAI;yCAGJ;AAED;IADC,IAAI;yCAMJ;AAED;IADC,IAAI;yCAGJ"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Based in part on {@link https://github.com/facebook/create-react-app/blob/5fc8350c89ff730cdfd067bbd86a90dab393d21b/packages/react-dev-utils/formatWebpackMessages.js}
3
- */
4
- import type { Bud } from '@roots/bud-framework';
5
- import type { StatsCompilation, StatsError } from 'webpack';
6
- import BudError from './BudError.js';
7
- export interface BudReport {
8
- errors: Array<BudError>;
9
- warnings: Array<BudError>;
10
- }
11
- /**
12
- * Apply bud context to reporter
13
- */
14
- export declare const curryReporter: (app: Bud) => (stats: StatsError) => Set<BudError>;
15
- /**
16
- * Create report
17
- */
18
- export declare const report: (app: Bud, stats: StatsCompilation) => BudReport;
19
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Reporter/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,sBAAsB,CAAA;AAE7C,OAAO,KAAK,EAAC,gBAAgB,EAAE,UAAU,EAAC,MAAM,SAAS,CAAA;AAEzD,OAAO,QAAQ,MAAM,eAAe,CAAA;AAEpC,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;IACvB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;CAC1B;AAiHD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,CAC1B,GAAG,EAAE,GAAG,KACL,CAAC,KAAK,EAAE,UAAU,KAAK,GAAG,CAAC,QAAQ,CAAwB,CAAA;AAEhE;;GAEG;AACH,eAAO,MAAM,MAAM,QAAS,GAAG,SAAS,gBAAgB,KAAG,SAgC1D,CAAA"}
@@ -1,110 +0,0 @@
1
- /**
2
- * Based in part on {@link https://github.com/facebook/create-react-app/blob/5fc8350c89ff730cdfd067bbd86a90dab393d21b/packages/react-dev-utils/formatWebpackMessages.js}
3
- */
4
- import { isString } from 'lodash-es';
5
- import BudError from './BudError.js';
6
- const reporter = (app) => (error) => {
7
- if (!error || !error.message)
8
- return null;
9
- const reports = new Set();
10
- /**
11
- * Eslint groups all errors under one error..
12
- */
13
- const captureEslint = /\x1B\[0m\x1B\[4m(?<file>.+)\x1B\[24m\x1B\[0m\n\x1B\[0m (?<message>\x1B\[2m(?<line>[0-9]+):(?<column>[0-9]+)\x1B\[22m \x1B\[31merror\x1B\[39m .*)/;
14
- error.message.split('\x1B[0m\x1B[0m\n').forEach((str) => {
15
- const groups = captureEslint.exec(str)?.groups;
16
- if (!groups?.file)
17
- return;
18
- const report = new BudError(error);
19
- Object.entries(groups)
20
- .filter(([k, v]) => k && v)
21
- .map(([key, value]) => {
22
- app.info('eslint capture key value:', key, value);
23
- report[key] = value;
24
- });
25
- report.hasFile() &&
26
- report.setFile(file => file.replace(app.path(), '.'));
27
- reports.add(report);
28
- });
29
- if (reports.size > 0)
30
- return reports;
31
- /**
32
- * Non eslint reporter continues..
33
- */
34
- const report = new BudError(error);
35
- if (error.loc && isString(error.loc)) {
36
- const [column, line] = error.loc.split(':');
37
- report.column = column ? Number.parseInt(column) : 0;
38
- report.line = line ? Number.parseInt(line.split('-').pop()) : 0;
39
- }
40
- const captureGroups = [
41
- /(?<file>.+)\n\s\s(?<line>[0-9]+):(?<column>[0])\s.+/,
42
- /\((?<line>[0-9]+):(?<column>[0-9]+)\)\s(?<file>.*?)\s/,
43
- /SyntaxError:\s(?<file>.+?):\s.+\s\((?<line>[0-9]+):(?<column>[0-9]+)\)/,
44
- ];
45
- captureGroups.forEach(captureGroup => {
46
- report.message?.split('\n').map(message => Object.entries(captureGroup.exec(message)?.groups ?? {})
47
- .filter(([k, v]) => k && v)
48
- .map(([key, value]) => {
49
- app.info(captureGroup, key, value);
50
- report[key] = value;
51
- }));
52
- });
53
- /**
54
- * @remarks
55
- * Sourced from react-dev-util
56
- */
57
- report
58
- .setMessage(message => message
59
- .split('\n')
60
- .filter(str => !/Module [A-z ]+\(from/.test(str))
61
- .join('\n'))
62
- .setMessage(message => message
63
- .replace(/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, `Syntax error: $3\n`)
64
- .replace(/^.*export '(.+?)' was not found in '(.+?)'.*$/gm, `Attempted import error: '$1' is not exported from '$2'.`)
65
- .replace(/^.*export 'default' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, `Attempted import error: '$2' does not contain a default export (imported as '$1').`)
66
- .replace(/^.*export '(.+?)' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, `Attempted import error: '$1' is not exported from '$3' (imported as '$2').`)
67
- .replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, '')
68
- .replace(/^\s*at\s<anonymous>(\n|$)/gm, ''))
69
- .setMessage(message => message
70
- .split('-- inner error --\n')
71
- .shift()
72
- .replaceAll(app.path(), '.')
73
- .trim());
74
- report.hasFile() &&
75
- report.setFile(file => file.replace(app.path(), '.'));
76
- reports.add(report);
77
- return reports;
78
- };
79
- /**
80
- * Apply bud context to reporter
81
- */
82
- export const curryReporter = app => reporter(app);
83
- /**
84
- * Create report
85
- */
86
- export const report = (app, stats) => {
87
- const result = { errors: [], warnings: [] };
88
- try {
89
- stats.errors
90
- .map(curryReporter(app))
91
- .filter(Boolean)
92
- .flatMap(set => Array.from(set))
93
- .filter(Boolean)
94
- .filter(({ message: subject }) => !result.errors.some(({ message }) => subject === message))
95
- .map(error => result.errors.push(error));
96
- stats.warnings
97
- .map(curryReporter(app))
98
- .filter(Boolean)
99
- .flatMap(set => Array.from(set))
100
- .filter(Boolean)
101
- .filter(({ message: subject }) => !result.warnings.some(({ message }) => subject === message))
102
- .map(item => result.warnings.push(item));
103
- app.info(result);
104
- return result;
105
- }
106
- catch (err) {
107
- app.error(result, err);
108
- }
109
- };
110
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Reporter/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAA;AAGlC,OAAO,QAAQ,MAAM,eAAe,CAAA;AAOpC,MAAM,QAAQ,GACZ,CAAC,GAAQ,EAAE,EAAE,CACb,CAAC,KAAiB,EAAiB,EAAE;IACnC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IAEzC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAY,CAAA;IAEnC;;OAEG;IAEH,MAAM,aAAa,GACjB,oJAAoJ,CAAA;IAEtJ,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,OAAO,CAAC,CAAC,GAAW,EAAE,EAAE;QAC9D,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;QAC9C,IAAI,CAAC,MAAM,EAAE,IAAI;YAAE,OAAM;QAEzB,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAA;QAElC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;aACnB,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;aAC1B,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YACpB,GAAG,CAAC,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;YACjD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QACrB,CAAC,CAAC,CAAA;QAEJ,M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