@roots/bud-build 6.21.0 → 6.23.0

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/README.md CHANGED
@@ -112,9 +112,6 @@ However, the amount of effort needed to maintain and develop new features and pr
112
112
  <a href="https://worksitesafety.ca/careers/">
113
113
  <img src="https://cdn.roots.io/app/uploads/worksite-safety.svg" alt="Worksite Safety" width="200" height="150"/>
114
114
  </a>
115
- <a href="https://www.copiadigital.com/">
116
- <img src="https://cdn.roots.io/app/uploads/copia-digital.svg" alt="Copia Digital" width="200" height="150"/>
117
- </a>
118
- <a href="https://www.freave.com/">
119
- <img src="https://cdn.roots.io/app/uploads/freave.svg" alt="Freave" width="200" height="150"/>
115
+ <a href="https://www.itineris.co.uk/">
116
+ <img src="https://cdn.roots.io/app/uploads/itineris.svg" alt="Itineris" width="200" height="150"/>
120
117
  </a>
@@ -1 +1 @@
1
- export const bail = async ({ hooks, isProduction }) => hooks.filter(`build.bail`, isProduction);
1
+ export const bail = async ({ context, hooks, isProduction, }) => hooks.filter(`build.bail`, isProduction && !context.ignoreErrors);
@@ -1,4 +1,4 @@
1
- import { ConfigError } from '@roots/bud-support/errors';
1
+ import { BudError } from '@roots/bud-support/errors';
2
2
  import isUndefined from '@roots/bud-support/isUndefined';
3
3
  export const dependencies = async ({ hooks, label, root, }) => {
4
4
  const dependencies = hooks
@@ -6,7 +6,7 @@ export const dependencies = async ({ hooks, label, root, }) => {
6
6
  ?.filter(dependency => {
7
7
  const defined = !isUndefined(root.children?.[dependency]);
8
8
  if (!defined) {
9
- throw ConfigError.normalize(`${dependency} is not a registered instance of bud.js.`, {
9
+ throw BudError.normalize(`${dependency} is not a registered instance of bud.js.`, {
10
10
  details: root.children
11
11
  ? `Available instances are: ${Object.values(root.children)
12
12
  .map(child => child.label)
@@ -1,19 +1,7 @@
1
- import logger from '@roots/bud-support/logger';
2
1
  export const infrastructureLogging = async (bud) => bud.hooks.filter(`build.infrastructureLogging`, {
3
- console: bud.hooks.filter(`build.infrastructureLogging.console`, {
4
- ...console,
5
- error: (...args) => {
6
- logger.unscope().error(...args);
7
- },
8
- info: (...args) => {
9
- logger.unscope().info(...args);
10
- },
11
- log: (...args) => {
12
- logger.unscope().log(...args);
13
- },
14
- warn: (...args) => {
15
- logger.unscope().info(...args);
16
- },
17
- }),
18
- level: bud.hooks.filter(`build.infrastructureLogging.level`, `log`),
2
+ ...(bud.context?.verbose
3
+ ? { console, level: `verbose` }
4
+ : bud.context?.log
5
+ ? { console, level: `log` }
6
+ : { level: `none` }),
19
7
  });
@@ -83,10 +83,10 @@ const DEFINED = [
83
83
  `json`,
84
84
  `html`,
85
85
  `webp`,
86
- `scss-module`,
87
- `scss`,
88
86
  `css-module`,
89
87
  `css`,
88
+ `sass-module`,
89
+ `sass`,
90
90
  `vue`,
91
91
  `js`,
92
92
  `ts`,
@@ -110,6 +110,20 @@ const makeIssuerRuleSet = ({ filter, path, rules }) => {
110
110
  test: filter(`pattern.css`),
111
111
  use: rules[`css`].toWebpack?.().use,
112
112
  });
113
+ rules[`sass-module`]?.toWebpack?.().use &&
114
+ results.push({
115
+ exclude: [path(`@src`)],
116
+ issuer: { not: filter(`pattern.sassModule`) },
117
+ test: filter(`pattern.sassModule`),
118
+ use: rules[`sass-module`].toWebpack?.().use,
119
+ });
120
+ rules[`sass`]?.toWebpack?.().use &&
121
+ results.push({
122
+ exclude: [path(`@src`)],
123
+ issuer: { not: filter(`pattern.sass`) },
124
+ test: filter(`pattern.sass`),
125
+ use: rules[`sass`].toWebpack?.().use,
126
+ });
113
127
  return results;
114
128
  };
115
129
  const getNoParse = (filter) => filter(`build.module.noParse`, undefined);
@@ -1,6 +1,7 @@
1
1
  export const optimization = async ({ hooks: { filter }, isDevelopment, isProduction, mode, }) => filter(`build.optimization`, {
2
2
  emitOnErrors: filter(`build.optimization.emitOnErrors`, isDevelopment),
3
3
  innerGraph: filter(`build.optimization.innerGraph`, isProduction),
4
+ mangleExports: filter(`build.optimization.mangleExports`, isProduction),
4
5
  mergeDuplicateChunks: filter(`build.optimization.mergeDuplicateChunks`, isProduction),
5
6
  minimize: filter(`build.optimization.minimize`, isProduction),
6
7
  minimizer: filter(`build.optimization.minimizer`, []),
package/lib/item/index.js CHANGED
@@ -99,7 +99,7 @@ class Item extends Registrable {
99
99
  output.ident = this.getIdent();
100
100
  }
101
101
  if (!output.loader) {
102
- logger.error(`error in ${this.ident}`, `no loader registered`);
102
+ logger.error(`error in ${this.ident}: no loader registered`);
103
103
  }
104
104
  return Object.entries(output).reduce((output, [key, value]) => ({
105
105
  ...(output ?? {}),
@@ -7,8 +7,8 @@ export const css = async ({ makeItem }) => makeItem({
7
7
  loader: `css`,
8
8
  options: { modules: false },
9
9
  }).setOptions(({ hooks: { filter } }) => ({
10
- sourceMap: isBoolean(filter(`build.devtool`, false))
11
- ? filter(`build.devtool`, false)
10
+ sourceMap: isBoolean(filter(`build.devtool`))
11
+ ? filter(`build.devtool`)
12
12
  : true,
13
13
  }));
14
14
  /**
@@ -17,11 +17,11 @@ export const css = async ({ makeItem }) => makeItem({
17
17
  export const cssModule = async ({ makeItem }) => makeItem({
18
18
  ident: `css-module`,
19
19
  loader: `css`,
20
- options: { modules: true },
21
- }).setOptions(({ build, hooks }) => ({
22
- importLoaders: build.rules[`css-module`].getUse().length - 2,
23
- sourceMap: isBoolean(hooks.filter(`build.devtool`, false))
24
- ? hooks.filter(`build.devtool`, false)
20
+ }).setOptions(({ build, hooks: { filter } }) => ({
21
+ importLoaders: build.getRule(`css-module`).getUse().length - 2,
22
+ modules: { namedExport: false },
23
+ sourceMap: isBoolean(filter(`build.devtool`))
24
+ ? filter(`build.devtool`)
25
25
  : true,
26
26
  }));
27
27
  /**
@@ -1,9 +1,53 @@
1
1
  import * as MiniCss from '@roots/bud-support/mini-css-extract-plugin';
2
- export const css = async ({ makeLoader, resolve }) => makeLoader(await resolve(`@roots/bud-support/css-loader`, import.meta.url));
3
- export const csv = async ({ makeLoader, resolve }) => makeLoader(await resolve(`@roots/bud-support/csv-loader`, import.meta.url));
4
- export const file = async ({ makeLoader, resolve }) => makeLoader(await resolve(`@roots/bud-support/file-loader`, import.meta.url));
5
- export const html = async ({ makeLoader, resolve }) => makeLoader(await resolve(`@roots/bud-support/html-loader`, import.meta.url));
6
- export const remark = async ({ makeLoader, resolve }) => makeLoader(await resolve(`@roots/bud-support/remark-loader`, import.meta.url));
7
- export const minicss = async ({ makeLoader, resolve }) => makeLoader(MiniCss.loader);
8
- export const style = async ({ makeLoader, resolve }) => makeLoader(await resolve(`@roots/bud-support/style-loader`, import.meta.url));
9
- export const yml = async ({ makeLoader, resolve }) => makeLoader(await resolve(`@roots/bud-support/yml-loader`, import.meta.url));
2
+ export const css = async ({ makeLoader, resolve }) => {
3
+ const path = await resolve(`@roots/bud-support/css-loader`, import.meta.url);
4
+ if (!path) {
5
+ throw new Error(`@roots/bud-support/css-loader not found`);
6
+ }
7
+ return makeLoader(path);
8
+ };
9
+ export const csv = async ({ makeLoader, resolve }) => {
10
+ const path = await resolve(`@roots/bud-support/csv-loader`, import.meta.url);
11
+ if (!path) {
12
+ throw new Error(`@roots/bud-support/csv-loader not found`);
13
+ }
14
+ return makeLoader(path);
15
+ };
16
+ export const file = async ({ makeLoader, resolve }) => {
17
+ const path = await resolve(`@roots/bud-support/file-loader`, import.meta.url);
18
+ if (!path) {
19
+ throw new Error(`@roots/bud-support/csv-loader not found`);
20
+ }
21
+ return makeLoader(path);
22
+ };
23
+ export const html = async ({ makeLoader, resolve }) => {
24
+ const path = await resolve(`@roots/bud-support/html-loader`, import.meta.url);
25
+ if (!path) {
26
+ throw new Error(`@roots/bud-support/html-loader not found`);
27
+ }
28
+ return makeLoader(path);
29
+ };
30
+ export const remark = async ({ makeLoader, resolve }) => {
31
+ const path = await resolve(`@roots/bud-support/remark-loader`, import.meta.url);
32
+ if (!path) {
33
+ throw new Error(`@roots/bud-support/remark-loader not found`);
34
+ }
35
+ return makeLoader(path);
36
+ };
37
+ export const minicss = async ({ makeLoader, resolve }) => {
38
+ return makeLoader(MiniCss.loader);
39
+ };
40
+ export const style = async ({ makeLoader, resolve }) => {
41
+ const path = await resolve(`@roots/bud-support/style-loader`, import.meta.url);
42
+ if (!path) {
43
+ throw new Error(`@roots/bud-support/style-loader not found`);
44
+ }
45
+ return makeLoader(path);
46
+ };
47
+ export const yml = async ({ makeLoader, resolve }) => {
48
+ const path = await resolve(`@roots/bud-support/yml-loader`, import.meta.url);
49
+ if (!path) {
50
+ throw new Error(`@roots/bud-support/yml-loader not found`);
51
+ }
52
+ return makeLoader(path);
53
+ };
@@ -59,7 +59,6 @@ class Build extends Service {
59
59
  .then(async (records) => await Promise.all(Object.entries(records).map(async ([prop, factory]) => {
60
60
  const value = await factory(this.app).catch(this.catch);
61
61
  if (isUndefined(value)) {
62
- this.logger.success(`omitting:`, prop, `(undefined)`);
63
62
  return;
64
63
  }
65
64
  Object.defineProperty(this.config, prop, {
@@ -69,12 +68,11 @@ class Build extends Service {
69
68
  writable: true,
70
69
  });
71
70
  this.logger
72
- .success(`defined:`, prop, `(${typeof this.config[prop]})`)
71
+ .log(`Defined:`, prop, `(${typeof this.config[prop]})`)
73
72
  .info(prop, `info:`, this.config[prop]);
74
73
  })))
75
74
  .catch(this.catch);
76
- this.logger.success(`configuration built`);
77
- this.logger.info(this.config);
75
+ this.logger.scope(this.app.label, `build`).info(`built`, this.config);
78
76
  await this.app.hooks.fire(`build.after`, this.app).catch(this.catch);
79
77
  return Object.entries(this.config).reduce((a, [k, v]) => {
80
78
  if (isUndefined(v))
@@ -104,7 +102,7 @@ class Build extends Service {
104
102
  * {@link BudBuild.setItem}
105
103
  */
106
104
  setItem(ident, definition) {
107
- this.logger.log(`build.setItem`, ident);
105
+ this.logger.log(`Registered item:`, ident);
108
106
  const maybeOptionsCallback = isUndefined(definition)
109
107
  ? { ident, loader: ident }
110
108
  : definition;
@@ -119,7 +117,7 @@ class Build extends Service {
119
117
  * {@link BudBuild.setLoader}
120
118
  */
121
119
  setLoader(name, definition) {
122
- this.logger.log(`build.setLoader`, name);
120
+ this.logger.log(`Registered loader:`, name);
123
121
  const loader = isUndefined(definition)
124
122
  ? this.makeLoader(name)
125
123
  : definition instanceof Loader
@@ -133,7 +131,7 @@ class Build extends Service {
133
131
  * {@link BudBuild.setRule}
134
132
  */
135
133
  setRule(name, definition) {
136
- this.logger.log(`build.setRule`, name);
134
+ this.logger.log(`Registered rule:`, name);
137
135
  const rule = definition instanceof Rule
138
136
  ? definition
139
137
  : isFunction(definition)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roots/bud-build",
3
- "version": "6.21.0",
3
+ "version": "6.23.0",
4
4
  "description": "bud.js core module",
5
5
  "engines": {
6
6
  "node": ">=16"
@@ -169,14 +169,14 @@
169
169
  "types": "./lib/index.d.ts",
170
170
  "module": "./lib/index.js",
171
171
  "devDependencies": {
172
- "@roots/bud-api": "6.21.0",
173
- "@roots/bud-hooks": "6.21.0",
172
+ "@roots/bud-api": "6.23.0",
173
+ "@roots/bud-hooks": "6.23.0",
174
174
  "@skypack/package-check": "0.2.2",
175
- "@types/node": "20.10.5"
175
+ "@types/node": "20.12.8"
176
176
  },
177
177
  "dependencies": {
178
- "@roots/bud-framework": "6.21.0",
179
- "@roots/bud-support": "6.21.0",
178
+ "@roots/bud-framework": "6.23.0",
179
+ "@roots/bud-support": "6.23.0",
180
180
  "tslib": "2.6.2"
181
181
  },
182
182
  "volta": {
@@ -1,4 +1,7 @@
1
1
  import type {Factory} from '@roots/bud-build/config'
2
2
 
3
- export const bail: Factory<'bail'> = async ({hooks, isProduction}) =>
4
- hooks.filter(`build.bail`, isProduction)
3
+ export const bail: Factory<'bail'> = async ({
4
+ context,
5
+ hooks,
6
+ isProduction,
7
+ }) => hooks.filter(`build.bail`, isProduction && !context.ignoreErrors)
@@ -1,6 +1,6 @@
1
1
  import type {Factory} from '@roots/bud-build/config'
2
2
 
3
- import {ConfigError} from '@roots/bud-support/errors'
3
+ import {BudError} from '@roots/bud-support/errors'
4
4
  import isUndefined from '@roots/bud-support/isUndefined'
5
5
 
6
6
  export const dependencies: Factory<`dependencies`> = async ({
@@ -14,7 +14,7 @@ export const dependencies: Factory<`dependencies`> = async ({
14
14
  const defined = !isUndefined(root.children?.[dependency])
15
15
 
16
16
  if (!defined) {
17
- throw ConfigError.normalize(
17
+ throw BudError.normalize(
18
18
  `${dependency} is not a registered instance of bud.js.`,
19
19
  {
20
20
  details: root.children
@@ -1,25 +1,12 @@
1
1
  import type {Factory} from '@roots/bud-build/config'
2
2
 
3
- import logger from '@roots/bud-support/logger'
4
-
5
3
  export const infrastructureLogging: Factory<
6
4
  `infrastructureLogging`
7
5
  > = async bud =>
8
6
  bud.hooks.filter(`build.infrastructureLogging`, {
9
- console: bud.hooks.filter(`build.infrastructureLogging.console`, {
10
- ...console,
11
- error: (...args: any[]) => {
12
- logger.unscope().error(...args)
13
- },
14
- info: (...args: any[]) => {
15
- logger.unscope().info(...args)
16
- },
17
- log: (...args: any[]) => {
18
- logger.unscope().log(...args)
19
- },
20
- warn: (...args: any[]) => {
21
- logger.unscope().info(...args)
22
- },
23
- }),
24
- level: bud.hooks.filter(`build.infrastructureLogging.level`, `log`),
7
+ ...(bud.context?.verbose
8
+ ? {console, level: `verbose`}
9
+ : bud.context?.log
10
+ ? {console, level: `log`}
11
+ : {level: `none`}),
25
12
  })
@@ -103,10 +103,10 @@ const DEFINED = [
103
103
  `json`,
104
104
  `html`,
105
105
  `webp`,
106
- `scss-module`,
107
- `scss`,
108
106
  `css-module`,
109
107
  `css`,
108
+ `sass-module`,
109
+ `sass`,
110
110
  `vue`,
111
111
  `js`,
112
112
  `ts`,
@@ -134,6 +134,22 @@ const makeIssuerRuleSet = ({filter, path, rules}: Props) => {
134
134
  use: rules[`css`].toWebpack?.().use,
135
135
  })
136
136
 
137
+ rules[`sass-module`]?.toWebpack?.().use &&
138
+ results.push({
139
+ exclude: [path(`@src`)],
140
+ issuer: {not: filter(`pattern.sassModule`)},
141
+ test: filter(`pattern.sassModule`),
142
+ use: rules[`sass-module`].toWebpack?.().use,
143
+ })
144
+
145
+ rules[`sass`]?.toWebpack?.().use &&
146
+ results.push({
147
+ exclude: [path(`@src`)],
148
+ issuer: {not: filter(`pattern.sass`)},
149
+ test: filter(`pattern.sass`),
150
+ use: rules[`sass`].toWebpack?.().use,
151
+ })
152
+
137
153
  return results
138
154
  }
139
155
 
@@ -9,6 +9,10 @@ export const optimization: Factory<`optimization`> = async ({
9
9
  filter(`build.optimization`, {
10
10
  emitOnErrors: filter(`build.optimization.emitOnErrors`, isDevelopment),
11
11
  innerGraph: filter(`build.optimization.innerGraph`, isProduction),
12
+ mangleExports: filter(
13
+ `build.optimization.mangleExports`,
14
+ isProduction,
15
+ ),
12
16
  mergeDuplicateChunks: filter(
13
17
  `build.optimization.mergeDuplicateChunks`,
14
18
  isProduction,
@@ -21,6 +25,7 @@ export const optimization: Factory<`optimization`> = async ({
21
25
  `build.optimization.providedExports`,
22
26
  isProduction,
23
27
  ),
28
+
24
29
  /**
25
30
  * Will be new default in webpack 6
26
31
  * @see {@link https://webpack.js.org/configuration/optimization/#optimizationremoveavailablemodules}
package/src/item/index.ts CHANGED
@@ -140,7 +140,7 @@ class Item extends Registrable implements Build.Item {
140
140
  }
141
141
 
142
142
  if (!output.loader) {
143
- logger.error(`error in ${this.ident}`, `no loader registered`)
143
+ logger.error(`error in ${this.ident}: no loader registered`)
144
144
  }
145
145
 
146
146
  return Object.entries(output).reduce(
@@ -12,8 +12,8 @@ export const css: Factory<Item> = async ({makeItem}) =>
12
12
  loader: `css`,
13
13
  options: {modules: false},
14
14
  }).setOptions(({hooks: {filter}}) => ({
15
- sourceMap: isBoolean(filter(`build.devtool`, false))
16
- ? filter(`build.devtool`, false)
15
+ sourceMap: isBoolean(filter(`build.devtool`))
16
+ ? filter(`build.devtool`)
17
17
  : true,
18
18
  }))
19
19
 
@@ -24,11 +24,11 @@ export const cssModule: Factory<Item> = async ({makeItem}) =>
24
24
  makeItem({
25
25
  ident: `css-module`,
26
26
  loader: `css`,
27
- options: {modules: true},
28
- }).setOptions(({build, hooks}) => ({
29
- importLoaders: build.rules[`css-module`].getUse().length - 2,
30
- sourceMap: isBoolean(hooks.filter(`build.devtool`, false))
31
- ? hooks.filter(`build.devtool`, false)
27
+ }).setOptions(({build, hooks: {filter}}) => ({
28
+ importLoaders: build.getRule(`css-module`).getUse().length - 2,
29
+ modules: {namedExport: false},
30
+ sourceMap: isBoolean(filter(`build.devtool`))
31
+ ? filter(`build.devtool`)
32
32
  : true,
33
33
  }))
34
34
 
@@ -3,40 +3,83 @@ import type {Loader} from '@roots/bud-framework/services/build'
3
3
 
4
4
  import * as MiniCss from '@roots/bud-support/mini-css-extract-plugin'
5
5
 
6
- export const css: Factory<Loader> = async ({makeLoader, resolve}) =>
7
- makeLoader(
8
- await resolve(`@roots/bud-support/css-loader`, import.meta.url),
6
+ export const css: Factory<Loader> = async ({makeLoader, resolve}) => {
7
+ const path = await resolve(
8
+ `@roots/bud-support/css-loader`,
9
+ import.meta.url,
9
10
  )
11
+ if (!path) {
12
+ throw new Error(`@roots/bud-support/css-loader not found`)
13
+ }
14
+ return makeLoader(path)
15
+ }
10
16
 
11
- export const csv: Factory<Loader> = async ({makeLoader, resolve}) =>
12
- makeLoader(
13
- await resolve(`@roots/bud-support/csv-loader`, import.meta.url),
17
+ export const csv: Factory<Loader> = async ({makeLoader, resolve}) => {
18
+ const path = await resolve(
19
+ `@roots/bud-support/csv-loader`,
20
+ import.meta.url,
14
21
  )
22
+ if (!path) {
23
+ throw new Error(`@roots/bud-support/csv-loader not found`)
24
+ }
25
+ return makeLoader(path)
26
+ }
15
27
 
16
- export const file: Factory<Loader> = async ({makeLoader, resolve}) =>
17
- makeLoader(
18
- await resolve(`@roots/bud-support/file-loader`, import.meta.url),
28
+ export const file: Factory<Loader> = async ({makeLoader, resolve}) => {
29
+ const path = await resolve(
30
+ `@roots/bud-support/file-loader`,
31
+ import.meta.url,
19
32
  )
33
+ if (!path) {
34
+ throw new Error(`@roots/bud-support/csv-loader not found`)
35
+ }
36
+ return makeLoader(path)
37
+ }
20
38
 
21
- export const html: Factory<Loader> = async ({makeLoader, resolve}) =>
22
- makeLoader(
23
- await resolve(`@roots/bud-support/html-loader`, import.meta.url),
39
+ export const html: Factory<Loader> = async ({makeLoader, resolve}) => {
40
+ const path = await resolve(
41
+ `@roots/bud-support/html-loader`,
42
+ import.meta.url,
24
43
  )
44
+ if (!path) {
45
+ throw new Error(`@roots/bud-support/html-loader not found`)
46
+ }
47
+ return makeLoader(path)
48
+ }
25
49
 
26
- export const remark: Factory<Loader> = async ({makeLoader, resolve}) =>
27
- makeLoader(
28
- await resolve(`@roots/bud-support/remark-loader`, import.meta.url),
50
+ export const remark: Factory<Loader> = async ({makeLoader, resolve}) => {
51
+ const path = await resolve(
52
+ `@roots/bud-support/remark-loader`,
53
+ import.meta.url,
29
54
  )
55
+ if (!path) {
56
+ throw new Error(`@roots/bud-support/remark-loader not found`)
57
+ }
58
+ return makeLoader(path)
59
+ }
30
60
 
31
- export const minicss: Factory<Loader> = async ({makeLoader, resolve}) =>
32
- makeLoader(MiniCss.loader)
61
+ export const minicss: Factory<Loader> = async ({makeLoader, resolve}) => {
62
+ return makeLoader(MiniCss.loader)
63
+ }
33
64
 
34
- export const style: Factory<Loader> = async ({makeLoader, resolve}) =>
35
- makeLoader(
36
- await resolve(`@roots/bud-support/style-loader`, import.meta.url),
65
+ export const style: Factory<Loader> = async ({makeLoader, resolve}) => {
66
+ const path = await resolve(
67
+ `@roots/bud-support/style-loader`,
68
+ import.meta.url,
37
69
  )
70
+ if (!path) {
71
+ throw new Error(`@roots/bud-support/style-loader not found`)
72
+ }
73
+ return makeLoader(path)
74
+ }
38
75
 
39
- export const yml: Factory<Loader> = async ({makeLoader, resolve}) =>
40
- makeLoader(
41
- await resolve(`@roots/bud-support/yml-loader`, import.meta.url),
76
+ export const yml: Factory<Loader> = async ({makeLoader, resolve}) => {
77
+ const path = await resolve(
78
+ `@roots/bud-support/yml-loader`,
79
+ import.meta.url,
42
80
  )
81
+ if (!path) {
82
+ throw new Error(`@roots/bud-support/yml-loader not found`)
83
+ }
84
+ return makeLoader(path)
85
+ }
@@ -98,8 +98,8 @@ class Build extends Service implements BudBuild {
98
98
  await Promise.all(
99
99
  Object.entries(records).map(async ([prop, factory]) => {
100
100
  const value = await factory(this.app).catch(this.catch)
101
+
101
102
  if (isUndefined(value)) {
102
- this.logger.success(`omitting:`, prop, `(undefined)`)
103
103
  return
104
104
  }
105
105
 
@@ -111,16 +111,14 @@ class Build extends Service implements BudBuild {
111
111
  })
112
112
 
113
113
  this.logger
114
- .success(`defined:`, prop, `(${typeof this.config[prop]})`)
114
+ .log(`Defined:`, prop, `(${typeof this.config[prop]})`)
115
115
  .info(prop, `info:`, this.config[prop])
116
116
  }),
117
117
  ),
118
118
  )
119
119
  .catch(this.catch)
120
120
 
121
- this.logger.success(`configuration built`)
122
- this.logger.info(this.config)
123
-
121
+ this.logger.scope(this.app.label, `build`).info(`built`, this.config)
124
122
  await this.app.hooks.fire(`build.after`, this.app).catch(this.catch)
125
123
 
126
124
  return Object.entries(this.config).reduce((a, [k, v]) => {
@@ -161,7 +159,8 @@ class Build extends Service implements BudBuild {
161
159
  ident: K,
162
160
  definition?: ((item: Items[K]) => Items[K]) | Items[K],
163
161
  ): this {
164
- this.logger.log(`build.setItem`, ident)
162
+ this.logger.log(`Registered item:`, ident)
163
+
165
164
  const maybeOptionsCallback = isUndefined(definition)
166
165
  ? {ident, loader: ident}
167
166
  : definition
@@ -184,7 +183,8 @@ class Build extends Service implements BudBuild {
184
183
  name: K,
185
184
  definition?: any,
186
185
  ): this {
187
- this.logger.log(`build.setLoader`, name)
186
+ this.logger.log(`Registered loader:`, name)
187
+
188
188
  const loader = isUndefined(definition)
189
189
  ? this.makeLoader(name)
190
190
  : definition instanceof Loader
@@ -205,7 +205,7 @@ class Build extends Service implements BudBuild {
205
205
  name: K,
206
206
  definition?: Rule | RuleOptions,
207
207
  ): this {
208
- this.logger.log(`build.setRule`, name)
208
+ this.logger.log(`Registered rule:`, name)
209
209
  const rule =
210
210
  definition instanceof Rule
211
211
  ? definition