@roots/bud-compiler 2024.6.16-8 → 2024.6.18-8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  import type { Bud } from '@roots/bud-framework';
2
2
  import type { Compiler as BudCompiler } from '@roots/bud-framework';
3
- import type { MultiCompiler, MultiStats, StatsError, Webpack } from '@roots/bud-framework/config';
3
+ import type { MultiCompiler, MultiStats, Webpack } from '@roots/bud-framework/config';
4
4
  import { Service } from '@roots/bud-framework/service';
5
5
  /**
6
6
  * {@link BudCompiler} implementation
@@ -34,8 +34,5 @@ declare class Compiler extends Service implements BudCompiler {
34
34
  * {@link Service.register}
35
35
  */
36
36
  register?(bud: Bud): Promise<any>;
37
- formatErrors(errors: Array<StatsError> | undefined): Array<({
38
- file: string;
39
- } & Error) | StatsError>;
40
37
  }
41
38
  export { Compiler as default };
@@ -26,14 +26,15 @@ class Compiler extends Service {
26
26
  */
27
27
  onStats(stats) {
28
28
  this.stats = stats.toJson(statsOptions);
29
- this.app.context.render(this.app.dashboard.render(stats));
29
+ this.app.dashboard.render(stats);
30
30
  if (stats.hasErrors()) {
31
31
  process.exitCode = 1;
32
+ const format = makeErrorFormatter(this.stats);
32
33
  this.stats.children = this.stats.children?.map(child => ({
33
34
  ...child,
34
- errors: child.errors
35
- ? this.formatErrors(child.errors)
36
- : child.errors ?? [],
35
+ errors: (child.errors
36
+ ? child.errors?.map(format).filter(Boolean)
37
+ : child.errors) ?? [],
37
38
  }));
38
39
  this.stats.children
39
40
  ?.filter(child => isNumber(child.errorsCount) && child.errorsCount > 0)
@@ -101,9 +102,6 @@ class Compiler extends Service {
101
102
  throw BudError.normalize(error);
102
103
  });
103
104
  }
104
- formatErrors(errors) {
105
- return (errors?.map(makeErrorFormatter(this.stats)).filter(Boolean) ?? []);
106
- }
107
105
  }
108
106
  __decorate([
109
107
  bind
@@ -114,9 +112,6 @@ __decorate([
114
112
  __decorate([
115
113
  bind
116
114
  ], Compiler.prototype, "register", null);
117
- __decorate([
118
- bind
119
- ], Compiler.prototype, "formatErrors", null);
120
115
  const statsOptions = {
121
116
  all: false,
122
117
  children: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roots/bud-compiler",
3
- "version": "2024.6.16-8",
3
+ "version": "2024.6.18-8",
4
4
  "description": "Compilation handler",
5
5
  "engines": {
6
6
  "node": ">=16"
@@ -65,14 +65,14 @@
65
65
  "types": "./lib/index.d.ts",
66
66
  "module": "./lib/index.js",
67
67
  "devDependencies": {
68
- "@roots/bud-api": "2024.6.16-8",
68
+ "@roots/bud-api": "2024.6.18-8",
69
69
  "@skypack/package-check": "0.2.2",
70
70
  "@types/node": "20.12.8"
71
71
  },
72
72
  "dependencies": {
73
- "@roots/bud-dashboard": "2024.6.16-8",
74
- "@roots/bud-framework": "2024.6.16-8",
75
- "@roots/bud-support": "2024.6.16-8",
73
+ "@roots/bud-dashboard": "2024.6.18-8",
74
+ "@roots/bud-framework": "2024.6.18-8",
75
+ "@roots/bud-support": "2024.6.18-8",
76
76
  "tslib": "2.6.2"
77
77
  },
78
78
  "volta": {
@@ -3,7 +3,6 @@ import type {Compiler as BudCompiler} from '@roots/bud-framework'
3
3
  import type {
4
4
  MultiCompiler,
5
5
  MultiStats,
6
- StatsError,
7
6
  Webpack,
8
7
  } from '@roots/bud-framework/config'
9
8
 
@@ -50,16 +49,18 @@ class Compiler extends Service implements BudCompiler {
50
49
  @bind
51
50
  public onStats(stats: MultiStats) {
52
51
  this.stats = stats.toJson(statsOptions)
53
- this.app.context.render(this.app.dashboard.render(stats))
52
+ this.app.dashboard.render(stats)
54
53
 
55
54
  if (stats.hasErrors()) {
56
55
  process.exitCode = 1
57
56
 
57
+ const format = makeErrorFormatter(this.stats)
58
58
  this.stats.children = this.stats.children?.map(child => ({
59
59
  ...child,
60
- errors: child.errors
61
- ? this.formatErrors(child.errors)
62
- : child.errors ?? [],
60
+ errors:
61
+ (child.errors
62
+ ? child.errors?.map(format).filter(Boolean)
63
+ : child.errors) ?? [],
63
64
  }))
64
65
 
65
66
  this.stats.children
@@ -147,15 +148,6 @@ class Compiler extends Service implements BudCompiler {
147
148
  throw BudError.normalize(error)
148
149
  })
149
150
  }
150
-
151
- @bind
152
- public formatErrors(
153
- errors: Array<StatsError> | undefined,
154
- ): Array<({file: string} & Error) | StatsError> {
155
- return (
156
- errors?.map(makeErrorFormatter(this.stats)).filter(Boolean) ?? []
157
- )
158
- }
159
151
  }
160
152
 
161
153
  const statsOptions = {