@roots/bud-build 6.6.5 → 6.6.6
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 +28 -19
- package/docs/exports.md +13 -0
- package/docs/rules.md +32 -0
- package/lib/config/bail.d.ts +2 -2
- package/lib/config/bail.d.ts.map +1 -1
- package/lib/config/bail.js +1 -1
- package/lib/config/bail.js.map +1 -1
- package/lib/config/cache.d.ts +2 -2
- package/lib/config/cache.d.ts.map +1 -1
- package/lib/config/cache.js +1 -1
- package/lib/config/cache.js.map +1 -1
- package/lib/config/context.d.ts +2 -2
- package/lib/config/context.d.ts.map +1 -1
- package/lib/config/context.js +1 -1
- package/lib/config/context.js.map +1 -1
- package/lib/config/dependencies.d.ts +3 -0
- package/lib/config/dependencies.d.ts.map +1 -0
- package/lib/config/dependencies.js +5 -0
- package/lib/config/dependencies.js.map +1 -0
- package/lib/config/devtool.d.ts +2 -2
- package/lib/config/devtool.d.ts.map +1 -1
- package/lib/config/devtool.js +1 -1
- package/lib/config/devtool.js.map +1 -1
- package/lib/config/entry.d.ts +3 -0
- package/lib/config/entry.d.ts.map +1 -0
- package/lib/config/entry.js +2 -0
- package/lib/config/entry.js.map +1 -0
- package/lib/config/experiments.d.ts +2 -2
- package/lib/config/experiments.d.ts.map +1 -1
- package/lib/config/experiments.js +1 -1
- package/lib/config/experiments.js.map +1 -1
- package/lib/config/externals.d.ts +3 -0
- package/lib/config/externals.d.ts.map +1 -0
- package/lib/config/externals.js +2 -0
- package/lib/config/externals.js.map +1 -0
- package/lib/config/externalsType.d.ts +3 -0
- package/lib/config/externalsType.d.ts.map +1 -0
- package/lib/config/externalsType.js +2 -0
- package/lib/config/externalsType.js.map +1 -0
- package/lib/config/index.d.ts +35 -0
- package/lib/config/index.d.ts.map +1 -0
- package/lib/config/index.js +27 -0
- package/lib/config/index.js.map +1 -0
- package/lib/config/infrastructureLogging.d.ts +2 -2
- package/lib/config/infrastructureLogging.d.ts.map +1 -1
- package/lib/config/infrastructureLogging.js +12 -3
- package/lib/config/infrastructureLogging.js.map +1 -1
- package/lib/config/loader.d.ts +3 -0
- package/lib/config/loader.d.ts.map +1 -0
- package/lib/config/loader.js +2 -0
- package/lib/config/loader.js.map +1 -0
- package/lib/config/mode.d.ts +3 -0
- package/lib/config/mode.d.ts.map +1 -0
- package/lib/config/mode.js +2 -0
- package/lib/config/mode.js.map +1 -0
- package/lib/config/module.d.ts +2 -6
- package/lib/config/module.d.ts.map +1 -1
- package/lib/config/module.js +20 -18
- package/lib/config/module.js.map +1 -1
- package/lib/config/name.d.ts +3 -0
- package/lib/config/name.d.ts.map +1 -0
- package/lib/config/name.js +2 -0
- package/lib/config/name.js.map +1 -0
- package/lib/config/node.d.ts +3 -0
- package/lib/config/node.d.ts.map +1 -0
- package/lib/config/node.js +2 -0
- package/lib/config/node.js.map +1 -0
- package/lib/config/optimization.d.ts +2 -2
- package/lib/config/optimization.d.ts.map +1 -1
- package/lib/config/optimization.js +8 -7
- package/lib/config/optimization.js.map +1 -1
- package/lib/config/output/assetModuleFilename.d.ts +8 -0
- package/lib/config/output/assetModuleFilename.d.ts.map +1 -0
- package/lib/config/output/assetModuleFilename.js +2 -0
- package/lib/config/output/assetModuleFilename.js.map +1 -0
- package/lib/config/output/chunkFilename.d.ts +8 -0
- package/lib/config/output/chunkFilename.d.ts.map +1 -0
- package/lib/config/output/chunkFilename.js +4 -0
- package/lib/config/output/chunkFilename.js.map +1 -0
- package/lib/config/output/filename.d.ts +8 -0
- package/lib/config/output/filename.d.ts.map +1 -0
- package/lib/config/output/filename.js +4 -0
- package/lib/config/output/filename.js.map +1 -0
- package/lib/config/output/index.d.ts +3 -0
- package/lib/config/output/index.d.ts.map +1 -0
- package/lib/config/output/index.js +18 -0
- package/lib/config/output/index.js.map +1 -0
- package/lib/config/parallelism.d.ts +3 -0
- package/lib/config/parallelism.d.ts.map +1 -0
- package/lib/config/parallelism.js +3 -0
- package/lib/config/parallelism.js.map +1 -0
- package/lib/config/performance.d.ts +3 -0
- package/lib/config/performance.d.ts.map +1 -0
- package/lib/config/performance.js +2 -0
- package/lib/config/performance.js.map +1 -0
- package/lib/config/plugins.d.ts +3 -0
- package/lib/config/plugins.d.ts.map +1 -0
- package/lib/config/plugins.js +2 -0
- package/lib/config/plugins.js.map +1 -0
- package/lib/config/profile.d.ts +3 -0
- package/lib/config/profile.d.ts.map +1 -0
- package/lib/config/profile.js +2 -0
- package/lib/config/profile.js.map +1 -0
- package/lib/config/recordsPath.d.ts +3 -0
- package/lib/config/recordsPath.d.ts.map +1 -0
- package/lib/config/recordsPath.js +2 -0
- package/lib/config/recordsPath.js.map +1 -0
- package/lib/config/resolve.d.ts +2 -3
- package/lib/config/resolve.d.ts.map +1 -1
- package/lib/config/resolve.js +16 -9
- package/lib/config/resolve.js.map +1 -1
- package/lib/config/stats.d.ts +3 -0
- package/lib/config/stats.d.ts.map +1 -0
- package/lib/config/stats.js +17 -0
- package/lib/config/stats.js.map +1 -0
- package/lib/config/target.d.ts +3 -0
- package/lib/config/target.d.ts.map +1 -0
- package/lib/config/target.js +4 -0
- package/lib/config/target.js.map +1 -0
- package/lib/handlers/index.d.ts +19 -0
- package/lib/handlers/index.d.ts.map +1 -0
- package/lib/handlers/index.js +6 -0
- package/lib/handlers/index.js.map +1 -0
- package/lib/handlers/items/items.d.ts +69 -0
- package/lib/handlers/items/items.d.ts.map +1 -0
- package/lib/handlers/items/items.js +93 -0
- package/lib/handlers/items/items.js.map +1 -0
- package/lib/handlers/loaders/loaders.d.ts +12 -0
- package/lib/handlers/loaders/loaders.d.ts.map +1 -0
- package/lib/handlers/loaders/loaders.js +11 -0
- package/lib/handlers/loaders/loaders.js.map +1 -0
- package/lib/handlers/register.d.ts +18 -0
- package/lib/handlers/register.d.ts.map +1 -0
- package/lib/handlers/register.js +28 -0
- package/lib/handlers/register.js.map +1 -0
- package/lib/handlers/rules/css.d.ts +3 -0
- package/lib/handlers/rules/css.d.ts.map +1 -0
- package/lib/handlers/rules/css.js +5 -0
- package/lib/handlers/rules/css.js.map +1 -0
- package/lib/handlers/rules/css.module.d.ts +3 -0
- package/lib/handlers/rules/css.module.d.ts.map +1 -0
- package/lib/handlers/rules/css.module.js +5 -0
- package/lib/handlers/rules/css.module.js.map +1 -0
- package/lib/handlers/rules/csv.d.ts +2 -8
- package/lib/handlers/rules/csv.d.ts.map +1 -1
- package/lib/handlers/rules/csv.js +3 -9
- package/lib/handlers/rules/csv.js.map +1 -1
- package/lib/handlers/rules/font.d.ts +3 -0
- package/lib/handlers/rules/font.d.ts.map +1 -0
- package/lib/handlers/rules/font.inline.d.ts +3 -0
- package/lib/handlers/rules/font.inline.d.ts.map +1 -0
- package/lib/handlers/rules/font.inline.js +6 -0
- package/lib/handlers/rules/font.inline.js.map +1 -0
- package/lib/handlers/rules/font.js +5 -0
- package/lib/handlers/rules/font.js.map +1 -0
- package/lib/handlers/rules/html.d.ts +3 -0
- package/lib/handlers/rules/html.d.ts.map +1 -0
- package/lib/handlers/rules/html.js +5 -0
- package/lib/handlers/rules/html.js.map +1 -0
- package/lib/handlers/rules/image.d.ts +3 -0
- package/lib/handlers/rules/image.d.ts.map +1 -0
- package/lib/handlers/rules/image.inline.d.ts +3 -0
- package/lib/handlers/rules/image.inline.d.ts.map +1 -0
- package/lib/handlers/rules/image.inline.js +6 -0
- package/lib/handlers/rules/image.inline.js.map +1 -0
- package/lib/handlers/rules/image.js +5 -0
- package/lib/handlers/rules/image.js.map +1 -0
- package/lib/handlers/rules/index.d.ts +19 -0
- package/lib/handlers/rules/index.d.ts.map +1 -0
- package/lib/handlers/rules/index.js +35 -0
- package/lib/handlers/rules/index.js.map +1 -0
- package/lib/handlers/rules/js.d.ts +3 -0
- package/lib/handlers/rules/js.d.ts.map +1 -0
- package/lib/handlers/rules/js.js +5 -0
- package/lib/handlers/rules/js.js.map +1 -0
- package/lib/handlers/rules/json.d.ts +3 -0
- package/lib/handlers/rules/json.d.ts.map +1 -0
- package/lib/handlers/rules/json.js +7 -0
- package/lib/handlers/rules/json.js.map +1 -0
- package/lib/handlers/rules/svg.d.ts +3 -0
- package/lib/handlers/rules/svg.d.ts.map +1 -0
- package/lib/handlers/rules/svg.inline.d.ts +3 -0
- package/lib/handlers/rules/svg.inline.d.ts.map +1 -0
- package/lib/handlers/rules/svg.inline.js +6 -0
- package/lib/handlers/rules/svg.inline.js.map +1 -0
- package/lib/handlers/rules/svg.js +5 -0
- package/lib/handlers/rules/svg.js.map +1 -0
- package/lib/handlers/rules/toml.d.ts +2 -8
- package/lib/handlers/rules/toml.d.ts.map +1 -1
- package/lib/handlers/rules/toml.js +3 -9
- package/lib/handlers/rules/toml.js.map +1 -1
- package/lib/handlers/rules/webp.d.ts +3 -0
- package/lib/handlers/rules/webp.d.ts.map +1 -0
- package/lib/handlers/rules/webp.js +5 -0
- package/lib/handlers/rules/webp.js.map +1 -0
- package/lib/handlers/rules/xml.d.ts +2 -8
- package/lib/handlers/rules/xml.d.ts.map +1 -1
- package/lib/handlers/rules/xml.js +3 -9
- package/lib/handlers/rules/xml.js.map +1 -1
- package/lib/handlers/rules/yml.d.ts +3 -0
- package/lib/handlers/rules/yml.d.ts.map +1 -0
- package/lib/handlers/rules/yml.js +5 -0
- package/lib/handlers/rules/yml.js.map +1 -0
- package/lib/helpers/isMjs.d.ts +3 -0
- package/lib/helpers/isMjs.d.ts.map +1 -0
- package/lib/helpers/isMjs.js +2 -0
- package/lib/helpers/isMjs.js.map +1 -0
- package/lib/helpers/scriptExtension.d.ts +3 -0
- package/lib/helpers/scriptExtension.d.ts.map +1 -0
- package/lib/helpers/scriptExtension.js +5 -0
- package/lib/helpers/scriptExtension.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/item/index.d.ts +2 -2
- package/lib/item/index.d.ts.map +1 -1
- package/lib/item/index.js +6 -3
- package/lib/item/index.js.map +1 -1
- package/lib/loader/index.d.ts +2 -1
- package/lib/loader/index.d.ts.map +1 -1
- package/lib/loader/index.js +2 -1
- package/lib/loader/index.js.map +1 -1
- package/lib/rule/index.d.ts +30 -21
- package/lib/rule/index.d.ts.map +1 -1
- package/lib/rule/index.js +64 -37
- package/lib/rule/index.js.map +1 -1
- package/lib/service.d.ts +9 -12
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +28 -59
- package/lib/service.js.map +1 -1
- package/lib/shared/base.d.ts +1 -1
- package/lib/shared/base.d.ts.map +1 -1
- package/lib/shared/base.js +4 -2
- package/lib/shared/base.js.map +1 -1
- package/lib/types.d.ts +8 -2
- package/lib/types.d.ts.map +1 -1
- package/package.json +35 -37
- package/src/config/bail.ts +4 -0
- package/src/config/cache.ts +4 -0
- package/src/config/context.ts +3 -0
- package/src/config/dependencies.ts +11 -0
- package/src/config/devtool.ts +4 -0
- package/src/config/entry.ts +4 -0
- package/src/config/experiments.ts +4 -0
- package/src/config/externals.ts +4 -0
- package/src/config/externalsType.ts +3 -0
- package/src/config/index.test.ts +129 -0
- package/src/config/index.ts +67 -0
- package/src/config/infrastructureLogging.ts +21 -0
- package/src/config/loader.ts +4 -0
- package/src/config/mode.ts +4 -0
- package/src/config/module.ts +43 -0
- package/src/config/name.ts +4 -0
- package/src/config/node.ts +4 -0
- package/src/config/optimization.ts +19 -0
- package/src/config/output/assetModuleFilename.ts +9 -0
- package/src/config/output/chunkFilename.ts +18 -0
- package/src/config/output/filename.ts +19 -0
- package/src/config/output/index.ts +27 -0
- package/src/config/parallelism.ts +6 -0
- package/src/config/performance.ts +4 -0
- package/src/config/plugins.ts +4 -0
- package/src/config/profile.ts +4 -0
- package/src/config/recordsPath.ts +7 -0
- package/src/config/resolve.ts +33 -0
- package/src/config/stats.ts +22 -0
- package/src/config/target.ts +9 -0
- package/src/handlers/index.ts +22 -0
- package/src/handlers/items/items.ts +117 -0
- package/src/handlers/loaders/loaders.ts +31 -0
- package/src/handlers/register.ts +51 -0
- package/src/handlers/rules/css.module.ts +7 -0
- package/src/handlers/rules/css.ts +7 -0
- package/src/handlers/rules/csv.test.ts +25 -0
- package/src/handlers/rules/csv.ts +7 -0
- package/src/handlers/rules/font.inline.ts +8 -0
- package/src/handlers/rules/font.ts +7 -0
- package/src/handlers/rules/html.ts +7 -0
- package/src/handlers/rules/image.inline.ts +8 -0
- package/src/handlers/rules/image.ts +7 -0
- package/src/handlers/rules/index.ts +35 -0
- package/src/handlers/rules/js.ts +7 -0
- package/src/handlers/rules/json.ts +10 -0
- package/src/handlers/rules/svg.inline.ts +8 -0
- package/src/handlers/rules/svg.ts +7 -0
- package/src/handlers/rules/toml.test.ts +22 -0
- package/src/handlers/rules/toml.ts +10 -0
- package/src/handlers/rules/webp.ts +7 -0
- package/src/handlers/rules/xml.test.ts +24 -0
- package/src/handlers/rules/xml.ts +7 -0
- package/src/handlers/rules/yml.ts +7 -0
- package/src/helpers/isMjs.ts +4 -0
- package/src/helpers/scriptExtension.ts +11 -0
- package/src/index.ts +17 -0
- package/src/item/index.ts +181 -0
- package/src/loader/index.ts +40 -0
- package/src/rule/index.test.ts +88 -0
- package/src/rule/index.ts +311 -0
- package/src/service.ts +245 -0
- package/src/shared/base.ts +37 -0
- package/src/types.ts +57 -0
- package/lib/config/builder.d.ts +0 -31
- package/lib/config/builder.d.ts.map +0 -1
- package/lib/config/builder.js +0 -32
- package/lib/config/builder.js.map +0 -1
- package/lib/config/output.d.ts +0 -4
- package/lib/config/output.d.ts.map +0 -1
- package/lib/config/output.js +0 -13
- package/lib/config/output.js.map +0 -1
- package/lib/handlers/items.d.ts +0 -69
- package/lib/handlers/items.d.ts.map +0 -1
- package/lib/handlers/items.js +0 -99
- package/lib/handlers/items.js.map +0 -1
- package/lib/handlers/loaders.d.ts +0 -57
- package/lib/handlers/loaders.d.ts.map +0 -1
- package/lib/handlers/loaders.js +0 -82
- package/lib/handlers/loaders.js.map +0 -1
- package/lib/handlers/rules/rules.d.ts +0 -63
- package/lib/handlers/rules/rules.d.ts.map +0 -1
- package/lib/handlers/rules/rules.js +0 -124
- package/lib/handlers/rules/rules.js.map +0 -1
package/lib/shared/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/shared/base.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAC,IAAI,EAAC,MAAM,+BAA+B,CAAA;AAClD,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAA;AAEvD,MAAM,CAAC,OAAO,OAAO,IAAI;IACvB;;;;OAIG;IACH,IAAW,GAAG;QACZ,OAAO,IAAI,CAAC,IAAI,EAAE,CAAA;IACpB,CAAC;IAED;;;;OAIG;IACH,YAA0B,IAAe;QAAf,SAAI,GAAJ,IAAI,CAAW;IAAG,CAAC;IAGtC,IAAI,CAAU,KAA4B;QAC/C,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAA;IAChD,CAAC;IAGM,MAAM,CACX,
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/shared/base.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAC,IAAI,EAAC,MAAM,+BAA+B,CAAA;AAClD,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAA;AAEvD,MAAM,CAAC,OAAO,OAAO,IAAI;IACvB;;;;OAIG;IACH,IAAW,GAAG;QACZ,OAAO,IAAI,CAAC,IAAI,EAAE,CAAA;IACpB,CAAC;IAED;;;;OAIG;IACH,YAA0B,IAAe;QAAf,SAAI,GAAJ,IAAI,CAAW;IAAG,CAAC;IAGtC,IAAI,CAAU,KAA4B;QAC/C,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAA;IAChD,CAAC;IAGM,MAAM,CACX,aAA4D,EAC5D,GAAG,OAAmB;QAEtB,OAAO,UAAU,CAAC,aAAa,CAAC;YAC9B,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC;YACrC,CAAC,CAAC,aAAa,CAAA;IACnB,CAAC;CACF;AAdC;IAAC,IAAI;;;;gCAGJ;AAED;IAAC,IAAI;;;wDAIF,CAAC,oBAAD,CAAC;kCAIH"}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/// <reference path="../../bud-hooks/lib/index.d.ts" />
|
|
2
|
-
|
|
2
|
+
/// <reference types="@roots/bud-framework" />
|
|
3
|
+
import type { Item } from './item/index.js';
|
|
4
|
+
import type { Loader } from './loader/index.js';
|
|
5
|
+
import type { Rule } from './rule/index.js';
|
|
3
6
|
declare module '@roots/bud-framework' {
|
|
4
7
|
interface Loaders {
|
|
5
8
|
css: Loader;
|
|
@@ -39,10 +42,13 @@ declare module '@roots/bud-framework' {
|
|
|
39
42
|
image: Rule;
|
|
40
43
|
font: Rule;
|
|
41
44
|
xml: Rule;
|
|
42
|
-
|
|
45
|
+
json: Rule;
|
|
43
46
|
csv: Rule;
|
|
44
47
|
yml: Rule;
|
|
45
48
|
toml: Rule;
|
|
49
|
+
inlineSvg: Rule;
|
|
50
|
+
inlineFont: Rule;
|
|
51
|
+
inlineImage: Rule;
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
54
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;AAGA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAA;AAEzC,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,OAAO;QACf,GAAG,EAAE,MAAM,CAAA;QACX,GAAG,EAAE,MAAM,CAAA;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,EAAE,EAAE,MAAM,CAAA;QACV,OAAO,EAAE,MAAM,CAAA;QACf,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,MAAM,CAAA;QACb,GAAG,EAAE,MAAM,CAAA;QACX,GAAG,EAAE,MAAM,CAAA;QACX,GAAG,EAAE,MAAM,CAAA;KACZ;IAED,UAAU,KAAK;QACb,MAAM,EAAE,IAAI,CAAA;QACZ,OAAO,EAAE,IAAI,CAAA;QACb,KAAK,EAAE,IAAI,CAAA;QACX,GAAG,EAAE,IAAI,CAAA;QACT,SAAS,EAAE,IAAI,CAAA;QACf,GAAG,EAAE,IAAI,CAAA;QACT,IAAI,EAAE,IAAI,CAAA;QACV,KAAK,EAAE,IAAI,CAAA;QACX,IAAI,EAAE,IAAI,CAAA;QACV,IAAI,EAAE,IAAI,CAAA;QACV,EAAE,EAAE,IAAI,CAAA;QACR,GAAG,EAAE,IAAI,CAAA;QACT,GAAG,EAAE,IAAI,CAAA;QACT,GAAG,EAAE,IAAI,CAAA;KACV;IAED,UAAU,KAAK;QACb,EAAE,EAAE,IAAI,CAAA;QACR,GAAG,EAAE,IAAI,CAAA;QACT,SAAS,EAAE,IAAI,CAAA;QACf,IAAI,EAAE,IAAI,CAAA;QACV,GAAG,EAAE,IAAI,CAAA;QACT,KAAK,EAAE,IAAI,CAAA;QACX,IAAI,EAAE,IAAI,CAAA;QACV,GAAG,EAAE,IAAI,CAAA;QACT,IAAI,EAAE,IAAI,CAAA;QACV,GAAG,EAAE,IAAI,CAAA;QACT,GAAG,EAAE,IAAI,CAAA;QACT,IAAI,EAAE,IAAI,CAAA;QACV,SAAS,EAAE,IAAI,CAAA;QACf,UAAU,EAAE,IAAI,CAAA;QAChB,WAAW,EAAE,IAAI,CAAA;KAClB;CACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roots/bud-build",
|
|
3
3
|
"description": "bud.js core module",
|
|
4
|
-
"version": "6.6.
|
|
4
|
+
"version": "6.6.6",
|
|
5
5
|
"homepage": "https://roots.io/bud",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -34,48 +34,46 @@
|
|
|
34
34
|
"node": ">=16"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
|
-
"
|
|
37
|
+
"docs/",
|
|
38
|
+
"lib/",
|
|
39
|
+
"src/"
|
|
38
40
|
],
|
|
39
41
|
"type": "module",
|
|
40
42
|
"module": "./lib/index.js",
|
|
41
43
|
"types": "./lib/index.d.ts",
|
|
42
44
|
"exports": {
|
|
43
|
-
".":
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"./
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
],
|
|
71
|
-
"rules": [
|
|
72
|
-
"./lib/handlers/rules.d.ts"
|
|
73
|
-
]
|
|
45
|
+
".": {
|
|
46
|
+
"types": "./lib/index.d.ts",
|
|
47
|
+
"default": "./lib/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./item": {
|
|
50
|
+
"types": "./lib/item/index.d.ts",
|
|
51
|
+
"default": "./lib/item/index.js"
|
|
52
|
+
},
|
|
53
|
+
"./items": {
|
|
54
|
+
"types": "./lib/handlers/items/items.d.ts",
|
|
55
|
+
"default": "./lib/handlers/items/items.js"
|
|
56
|
+
},
|
|
57
|
+
"./loader": {
|
|
58
|
+
"types": "./lib/loader/index.d.ts",
|
|
59
|
+
"default": "./lib/loader/index.js"
|
|
60
|
+
},
|
|
61
|
+
"./loaders": {
|
|
62
|
+
"types": "./lib/handlers/loaders/loaders.d.ts",
|
|
63
|
+
"default": "./lib/handlers/loaders/loaders.js"
|
|
64
|
+
},
|
|
65
|
+
"./rule": {
|
|
66
|
+
"types": "./lib/rule/index.d.ts",
|
|
67
|
+
"default": "./lib/rule/index.js"
|
|
68
|
+
},
|
|
69
|
+
"./rules": {
|
|
70
|
+
"types": "./lib/handlers/rules/index.d.ts",
|
|
71
|
+
"default": "./lib/handlers/rules/index.js"
|
|
74
72
|
}
|
|
75
73
|
},
|
|
76
74
|
"devDependencies": {
|
|
77
|
-
"@roots/bud-api": "6.6.
|
|
78
|
-
"@roots/bud-hooks": "6.6.
|
|
75
|
+
"@roots/bud-api": "6.6.6",
|
|
76
|
+
"@roots/bud-hooks": "6.6.6",
|
|
79
77
|
"@skypack/package-check": "0.2.2",
|
|
80
78
|
"@types/fs-extra": "9.0.13",
|
|
81
79
|
"@types/mini-css-extract-plugin": "2.5.1",
|
|
@@ -83,8 +81,8 @@
|
|
|
83
81
|
"webpack": "5.75.0"
|
|
84
82
|
},
|
|
85
83
|
"dependencies": {
|
|
86
|
-
"@roots/bud-framework": "6.6.
|
|
87
|
-
"@roots/bud-support": "6.6.
|
|
84
|
+
"@roots/bud-framework": "6.6.6",
|
|
85
|
+
"@roots/bud-support": "6.6.6",
|
|
88
86
|
"css-loader": "^6.7.2",
|
|
89
87
|
"csv-loader": "^3.0.5",
|
|
90
88
|
"file-loader": "^6.2.0",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {isUndefined} from '@roots/bud-support/lodash-es'
|
|
2
|
+
|
|
3
|
+
import type {Factory} from './index.js'
|
|
4
|
+
|
|
5
|
+
export const dependencies: Factory<`dependencies`> = async ({
|
|
6
|
+
hooks,
|
|
7
|
+
root,
|
|
8
|
+
}) =>
|
|
9
|
+
hooks
|
|
10
|
+
.filter(`build.dependencies`, [])
|
|
11
|
+
.filter(label => !isUndefined(root.children[label]))
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {Bud, factory} from '@repo/test-kit/bud'
|
|
2
|
+
import {beforeEach, describe, expect, it} from 'vitest'
|
|
3
|
+
|
|
4
|
+
import {Build} from '../service.js'
|
|
5
|
+
|
|
6
|
+
describe(`bud.build.config`, function () {
|
|
7
|
+
let bud: Bud
|
|
8
|
+
let build: Build
|
|
9
|
+
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
bud = await factory()
|
|
12
|
+
build = new Build(() => bud)
|
|
13
|
+
await build.register(bud)
|
|
14
|
+
await build.make()
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it(`should not include deprecated properties`, async () => {
|
|
18
|
+
expect(build.config.hasOwnProperty(`devServer`)).toBe(false)
|
|
19
|
+
expect(build.config.hasOwnProperty(`unsafeCache`)).toBe(false)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it(`should have expected bail default`, async () => {
|
|
23
|
+
expect(build.config.bail).toEqual(true)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it(`should have expected cache default`, async () => {
|
|
27
|
+
const {cache}: any = build.config
|
|
28
|
+
|
|
29
|
+
expect(cache.type).toStrictEqual(`filesystem`)
|
|
30
|
+
|
|
31
|
+
expect(cache.cacheDirectory).toStrictEqual(
|
|
32
|
+
expect.stringContaining(`.budfiles`),
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
expect(cache.version).toStrictEqual(expect.any(String))
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it(`should have expected context default`, async () => {
|
|
39
|
+
expect(build.config.context).toEqual(bud.path(`@src`))
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it(`should have expected devtool default`, async () => {
|
|
43
|
+
expect(build.config.devtool).toBe(false)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it(`should have expected entry default`, async () => {
|
|
47
|
+
expect(build.config.entry).toEqual({main: {import: [`index`]}})
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it(`should have expected mode default`, async () => {
|
|
51
|
+
expect(build.config.mode).toEqual(`production`)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it(`should have expected name default`, async () => {
|
|
55
|
+
expect(build.config.name).toEqual(`@tests/project`)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it(`should have expected node default`, async () => {
|
|
59
|
+
expect(build.config.node).toEqual(false)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it(`should have expected optimization.minimize default`, async () => {
|
|
63
|
+
expect(build.config.optimization?.minimize).toEqual(true)
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it(`should have expected optimization.emitOnErrors default`, async () => {
|
|
67
|
+
expect((build.config.optimization as any).emitOnErrors).toEqual(false)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it(`should have expected optimization.runtimeChunk default`, async () => {
|
|
71
|
+
expect(build.config.optimization?.runtimeChunk).toBe(false)
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
it(`should have expected profile default`, async () => {
|
|
75
|
+
expect(build.config.profile).toBeUndefined()
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it(`should have expected resolve.alias default`, async () => {
|
|
79
|
+
expect(build.config.resolve?.alias).toEqual({
|
|
80
|
+
'@src': bud.path(`@src`),
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it(`should have expected resolve.extensions default`, async () => {
|
|
85
|
+
expect(build.config.resolve?.extensions?.sort()).toEqual(
|
|
86
|
+
expect.arrayContaining([
|
|
87
|
+
`.css`,
|
|
88
|
+
`.js`,
|
|
89
|
+
`.json`,
|
|
90
|
+
`.jsx`,
|
|
91
|
+
`.mjs`,
|
|
92
|
+
`.wasm`,
|
|
93
|
+
`.yml`,
|
|
94
|
+
]),
|
|
95
|
+
)
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it(`should have expected target default`, async () => {
|
|
99
|
+
expect(build.config.target).toMatch(/browserslist.*/)
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it(`should have expected watch default`, async () => {
|
|
103
|
+
expect(build.config.watch).toBeUndefined()
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
it(`should have expected watchOptions default`, async () => {
|
|
107
|
+
expect(build.config.watchOptions).toBeUndefined()
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
it(`should have expected plugins`, async () => {
|
|
111
|
+
const plugins = build.config.plugins
|
|
112
|
+
?.map(plugin => plugin.constructor.name)
|
|
113
|
+
.sort()
|
|
114
|
+
|
|
115
|
+
expect(plugins).toContain(`CleanWebpackPlugin`)
|
|
116
|
+
expect(plugins).toContain(`FixStyleOnlyEntrypoints`)
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
it(`should have expected default requireEnsure rule`, async () => {
|
|
120
|
+
if (!build.config.module?.rules?.length) throw new Error()
|
|
121
|
+
expect(build.config.module.rules[0]).toEqual(
|
|
122
|
+
expect.objectContaining({
|
|
123
|
+
parser: {
|
|
124
|
+
requireEnsure: false,
|
|
125
|
+
},
|
|
126
|
+
}),
|
|
127
|
+
)
|
|
128
|
+
})
|
|
129
|
+
})
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type {Bud} from '@roots/bud-framework'
|
|
2
|
+
import type {Configuration} from '@roots/bud-support/webpack'
|
|
3
|
+
|
|
4
|
+
import {bail} from './bail.js'
|
|
5
|
+
import {cache} from './cache.js'
|
|
6
|
+
import {context} from './context.js'
|
|
7
|
+
import {dependencies} from './dependencies.js'
|
|
8
|
+
import {devtool} from './devtool.js'
|
|
9
|
+
import {entry} from './entry.js'
|
|
10
|
+
import {experiments} from './experiments.js'
|
|
11
|
+
import {externals} from './externals.js'
|
|
12
|
+
import {externalsType} from './externalsType.js'
|
|
13
|
+
import {infrastructureLogging} from './infrastructureLogging.js'
|
|
14
|
+
import {loader} from './loader.js'
|
|
15
|
+
import {mode} from './mode.js'
|
|
16
|
+
import {module} from './module.js'
|
|
17
|
+
import {name} from './name.js'
|
|
18
|
+
import {node} from './node.js'
|
|
19
|
+
import {optimization} from './optimization.js'
|
|
20
|
+
import {output} from './output/index.js'
|
|
21
|
+
import {parallelism} from './parallelism.js'
|
|
22
|
+
import {performance} from './performance.js'
|
|
23
|
+
import {plugins} from './plugins.js'
|
|
24
|
+
import {profile} from './profile.js'
|
|
25
|
+
import {recordsPath} from './recordsPath.js'
|
|
26
|
+
import {resolve} from './resolve.js'
|
|
27
|
+
import {stats} from './stats.js'
|
|
28
|
+
import {target} from './target.js'
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
bail,
|
|
32
|
+
cache,
|
|
33
|
+
context,
|
|
34
|
+
dependencies,
|
|
35
|
+
devtool,
|
|
36
|
+
entry,
|
|
37
|
+
experiments,
|
|
38
|
+
externals,
|
|
39
|
+
externalsType,
|
|
40
|
+
infrastructureLogging,
|
|
41
|
+
loader,
|
|
42
|
+
mode,
|
|
43
|
+
module,
|
|
44
|
+
name,
|
|
45
|
+
node,
|
|
46
|
+
optimization,
|
|
47
|
+
output,
|
|
48
|
+
parallelism,
|
|
49
|
+
performance,
|
|
50
|
+
plugins,
|
|
51
|
+
profile,
|
|
52
|
+
recordsPath,
|
|
53
|
+
resolve,
|
|
54
|
+
stats,
|
|
55
|
+
target,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface Factory<
|
|
59
|
+
Key extends keyof Config,
|
|
60
|
+
Config = Configuration,
|
|
61
|
+
> {
|
|
62
|
+
(app: Bud): Promise<Config[Key]>
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type Records<Config = Configuration> = {
|
|
66
|
+
[Key in keyof Config as `${Key & string}`]: Factory<Key, Config>
|
|
67
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type {Factory} from './index.js'
|
|
2
|
+
|
|
3
|
+
export const infrastructureLogging: Factory<
|
|
4
|
+
`infrastructureLogging`
|
|
5
|
+
> = async bud =>
|
|
6
|
+
bud.hooks.filter(`build.infrastructureLogging`, {
|
|
7
|
+
console: bud.hooks.filter(`build.infrastructureLogging.console`, {
|
|
8
|
+
...console,
|
|
9
|
+
log: bud.context.logger.log,
|
|
10
|
+
info: bud.context.logger.info,
|
|
11
|
+
warn: bud.context.logger.warn,
|
|
12
|
+
error: bud.context.logger.error,
|
|
13
|
+
debug: bud.context.logger.debug,
|
|
14
|
+
time: bud.context.logger.time,
|
|
15
|
+
timeEnd: bud.context.logger.timeEnd,
|
|
16
|
+
}),
|
|
17
|
+
level: bud.hooks.filter(
|
|
18
|
+
`build.infrastructureLogging.level`,
|
|
19
|
+
bud.context.args.verbose ? `log` : `info`,
|
|
20
|
+
),
|
|
21
|
+
})
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type {Bud} from '@roots/bud-framework'
|
|
2
|
+
|
|
3
|
+
import type {Factory} from './index.js'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
filter: Bud[`hooks`][`filter`]
|
|
7
|
+
rules: Bud[`build`][`rules`]
|
|
8
|
+
path: Bud[`path`]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const module: Factory<`module`> = async ({
|
|
12
|
+
build: {rules},
|
|
13
|
+
hooks: {filter},
|
|
14
|
+
path,
|
|
15
|
+
}) =>
|
|
16
|
+
filter(`build.module`, {
|
|
17
|
+
noParse: getNoParse(filter),
|
|
18
|
+
rules: getRules({filter, path, rules}),
|
|
19
|
+
unsafeCache: getUnsafeCache(filter),
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const getRules = ({filter, path, rules}: Props) => [
|
|
23
|
+
...filter(`build.module.rules.before`, [
|
|
24
|
+
{
|
|
25
|
+
test: filter(`pattern.js`),
|
|
26
|
+
include: [path(`@src`)],
|
|
27
|
+
parser: {requireEnsure: false},
|
|
28
|
+
},
|
|
29
|
+
]),
|
|
30
|
+
{
|
|
31
|
+
oneOf: filter(
|
|
32
|
+
`build.module.rules.oneOf`,
|
|
33
|
+
Object.values(rules).map(rule => rule.toWebpack()),
|
|
34
|
+
),
|
|
35
|
+
},
|
|
36
|
+
...filter(`build.module.rules.after`, []),
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
const getNoParse = (filter: Props[`filter`]) =>
|
|
40
|
+
filter(`build.module.noParse`, undefined)
|
|
41
|
+
|
|
42
|
+
const getUnsafeCache = (filter: Props[`filter`]) =>
|
|
43
|
+
filter(`build.module.unsafeCache`, false)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type {Factory} from './index.js'
|
|
2
|
+
|
|
3
|
+
export const optimization: Factory<`optimization`> = async ({
|
|
4
|
+
hooks: {filter},
|
|
5
|
+
isDevelopment,
|
|
6
|
+
isProduction,
|
|
7
|
+
}) =>
|
|
8
|
+
filter(`build.optimization`, {
|
|
9
|
+
emitOnErrors: filter(`build.optimization.emitOnErrors`, isDevelopment),
|
|
10
|
+
minimize: filter(`build.optimization.minimize`, isProduction),
|
|
11
|
+
minimizer: filter(`build.optimization.minimizer`, [`...`]),
|
|
12
|
+
moduleIds: filter(`build.optimization.moduleIds`, `named`),
|
|
13
|
+
removeEmptyChunks: filter(
|
|
14
|
+
`build.optimization.removeEmptyChunks`,
|
|
15
|
+
true,
|
|
16
|
+
),
|
|
17
|
+
runtimeChunk: filter(`build.optimization.runtimeChunk`, false),
|
|
18
|
+
splitChunks: filter(`build.optimization.splitChunks`, false),
|
|
19
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {join} from 'node:path'
|
|
2
|
+
|
|
3
|
+
import type {Bud} from '@roots/bud-framework'
|
|
4
|
+
|
|
5
|
+
import {scriptExtension} from '../../helpers/scriptExtension.js'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
filter: Bud[`hooks`][`filter`]
|
|
9
|
+
path: Bud[`path`]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const chunkFilename = ({filter, path}: Props) =>
|
|
13
|
+
filter(
|
|
14
|
+
`build.output.chunkFilename`,
|
|
15
|
+
join(`js`, `dynamic`, path(`@name.chunk`)).concat(
|
|
16
|
+
scriptExtension(filter, `.mjs`, `.js`),
|
|
17
|
+
),
|
|
18
|
+
)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {join} from 'node:path'
|
|
2
|
+
|
|
3
|
+
import type {Bud} from '@roots/bud-framework'
|
|
4
|
+
|
|
5
|
+
import {scriptExtension} from '../../helpers/scriptExtension.js'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
filter: Bud['hooks'][`filter`]
|
|
9
|
+
path: Bud['path']
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const filename = ({filter, path}: Props) =>
|
|
13
|
+
filter(
|
|
14
|
+
`build.output.filename`,
|
|
15
|
+
join(
|
|
16
|
+
`js`,
|
|
17
|
+
path(`@name`).concat(scriptExtension(filter, `.mjs`, `.js`)),
|
|
18
|
+
),
|
|
19
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {isMjs} from '../../helpers/isMjs.js'
|
|
2
|
+
import type {Factory} from '../index.js'
|
|
3
|
+
import {assetModuleFilename} from './assetModuleFilename.js'
|
|
4
|
+
import {chunkFilename} from './chunkFilename.js'
|
|
5
|
+
import {filename} from './filename.js'
|
|
6
|
+
|
|
7
|
+
export const output: Factory<`output`> = async ({
|
|
8
|
+
hooks: {filter},
|
|
9
|
+
isProduction,
|
|
10
|
+
path,
|
|
11
|
+
}) =>
|
|
12
|
+
filter(`build.output`, {
|
|
13
|
+
assetModuleFilename: assetModuleFilename({filter, path}),
|
|
14
|
+
chunkFilename: chunkFilename({filter, path}),
|
|
15
|
+
clean: filter(`build.output.clean`, isProduction),
|
|
16
|
+
environment: filter(`build.output.environment`, undefined),
|
|
17
|
+
filename: filename({filter, path}),
|
|
18
|
+
module: filter(`build.output.module`, false),
|
|
19
|
+
path: filter(`build.output.path`, path(`@dist`)),
|
|
20
|
+
pathinfo: filter(`build.output.pathinfo`),
|
|
21
|
+
publicPath: filter(`build.output.publicPath`, `auto`),
|
|
22
|
+
scriptType: filter(
|
|
23
|
+
`build.output.scriptType`,
|
|
24
|
+
isMjs(filter) ? `module` : false,
|
|
25
|
+
),
|
|
26
|
+
uniqueName: filter(`build.output.uniqueName`, `@roots/bud`),
|
|
27
|
+
})
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type {Bud} from '@roots/bud-framework'
|
|
2
|
+
|
|
3
|
+
import type {Factory} from './index.js'
|
|
4
|
+
|
|
5
|
+
export const resolve: Factory<`resolve`> = async bud => {
|
|
6
|
+
const modules = await getModules(bud)
|
|
7
|
+
const value = {
|
|
8
|
+
alias: await getAlias(bud),
|
|
9
|
+
extensions: getExtensions(bud),
|
|
10
|
+
modules,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return await bud.hooks.filterAsync(`build.resolve`, value)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const getAlias = async (bud: Bud) =>
|
|
17
|
+
await bud.hooks.filterAsync(`build.resolve.alias`, {
|
|
18
|
+
'@src': bud.path(`@src`),
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const getExtensions = (bud: Bud) =>
|
|
22
|
+
Array.from(
|
|
23
|
+
bud.hooks.filter(
|
|
24
|
+
`build.resolve.extensions`,
|
|
25
|
+
new Set([`.mjs`, `.js`, `.jsx`, `.css`, `.json`, `.wasm`, `.yml`]),
|
|
26
|
+
),
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
const getModules = async (bud: Bud) =>
|
|
30
|
+
await bud.hooks.filterAsync(`build.resolve.modules`, [
|
|
31
|
+
bud.hooks.filter(`location.@src`),
|
|
32
|
+
bud.hooks.filter(`location.@modules`),
|
|
33
|
+
])
|