@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.
Files changed (322) hide show
  1. package/README.md +28 -19
  2. package/docs/exports.md +13 -0
  3. package/docs/rules.md +32 -0
  4. package/lib/config/bail.d.ts +2 -2
  5. package/lib/config/bail.d.ts.map +1 -1
  6. package/lib/config/bail.js +1 -1
  7. package/lib/config/bail.js.map +1 -1
  8. package/lib/config/cache.d.ts +2 -2
  9. package/lib/config/cache.d.ts.map +1 -1
  10. package/lib/config/cache.js +1 -1
  11. package/lib/config/cache.js.map +1 -1
  12. package/lib/config/context.d.ts +2 -2
  13. package/lib/config/context.d.ts.map +1 -1
  14. package/lib/config/context.js +1 -1
  15. package/lib/config/context.js.map +1 -1
  16. package/lib/config/dependencies.d.ts +3 -0
  17. package/lib/config/dependencies.d.ts.map +1 -0
  18. package/lib/config/dependencies.js +5 -0
  19. package/lib/config/dependencies.js.map +1 -0
  20. package/lib/config/devtool.d.ts +2 -2
  21. package/lib/config/devtool.d.ts.map +1 -1
  22. package/lib/config/devtool.js +1 -1
  23. package/lib/config/devtool.js.map +1 -1
  24. package/lib/config/entry.d.ts +3 -0
  25. package/lib/config/entry.d.ts.map +1 -0
  26. package/lib/config/entry.js +2 -0
  27. package/lib/config/entry.js.map +1 -0
  28. package/lib/config/experiments.d.ts +2 -2
  29. package/lib/config/experiments.d.ts.map +1 -1
  30. package/lib/config/experiments.js +1 -1
  31. package/lib/config/experiments.js.map +1 -1
  32. package/lib/config/externals.d.ts +3 -0
  33. package/lib/config/externals.d.ts.map +1 -0
  34. package/lib/config/externals.js +2 -0
  35. package/lib/config/externals.js.map +1 -0
  36. package/lib/config/externalsType.d.ts +3 -0
  37. package/lib/config/externalsType.d.ts.map +1 -0
  38. package/lib/config/externalsType.js +2 -0
  39. package/lib/config/externalsType.js.map +1 -0
  40. package/lib/config/index.d.ts +35 -0
  41. package/lib/config/index.d.ts.map +1 -0
  42. package/lib/config/index.js +27 -0
  43. package/lib/config/index.js.map +1 -0
  44. package/lib/config/infrastructureLogging.d.ts +2 -2
  45. package/lib/config/infrastructureLogging.d.ts.map +1 -1
  46. package/lib/config/infrastructureLogging.js +12 -3
  47. package/lib/config/infrastructureLogging.js.map +1 -1
  48. package/lib/config/loader.d.ts +3 -0
  49. package/lib/config/loader.d.ts.map +1 -0
  50. package/lib/config/loader.js +2 -0
  51. package/lib/config/loader.js.map +1 -0
  52. package/lib/config/mode.d.ts +3 -0
  53. package/lib/config/mode.d.ts.map +1 -0
  54. package/lib/config/mode.js +2 -0
  55. package/lib/config/mode.js.map +1 -0
  56. package/lib/config/module.d.ts +2 -6
  57. package/lib/config/module.d.ts.map +1 -1
  58. package/lib/config/module.js +20 -18
  59. package/lib/config/module.js.map +1 -1
  60. package/lib/config/name.d.ts +3 -0
  61. package/lib/config/name.d.ts.map +1 -0
  62. package/lib/config/name.js +2 -0
  63. package/lib/config/name.js.map +1 -0
  64. package/lib/config/node.d.ts +3 -0
  65. package/lib/config/node.d.ts.map +1 -0
  66. package/lib/config/node.js +2 -0
  67. package/lib/config/node.js.map +1 -0
  68. package/lib/config/optimization.d.ts +2 -2
  69. package/lib/config/optimization.d.ts.map +1 -1
  70. package/lib/config/optimization.js +8 -7
  71. package/lib/config/optimization.js.map +1 -1
  72. package/lib/config/output/assetModuleFilename.d.ts +8 -0
  73. package/lib/config/output/assetModuleFilename.d.ts.map +1 -0
  74. package/lib/config/output/assetModuleFilename.js +2 -0
  75. package/lib/config/output/assetModuleFilename.js.map +1 -0
  76. package/lib/config/output/chunkFilename.d.ts +8 -0
  77. package/lib/config/output/chunkFilename.d.ts.map +1 -0
  78. package/lib/config/output/chunkFilename.js +4 -0
  79. package/lib/config/output/chunkFilename.js.map +1 -0
  80. package/lib/config/output/filename.d.ts +8 -0
  81. package/lib/config/output/filename.d.ts.map +1 -0
  82. package/lib/config/output/filename.js +4 -0
  83. package/lib/config/output/filename.js.map +1 -0
  84. package/lib/config/output/index.d.ts +3 -0
  85. package/lib/config/output/index.d.ts.map +1 -0
  86. package/lib/config/output/index.js +18 -0
  87. package/lib/config/output/index.js.map +1 -0
  88. package/lib/config/parallelism.d.ts +3 -0
  89. package/lib/config/parallelism.d.ts.map +1 -0
  90. package/lib/config/parallelism.js +3 -0
  91. package/lib/config/parallelism.js.map +1 -0
  92. package/lib/config/performance.d.ts +3 -0
  93. package/lib/config/performance.d.ts.map +1 -0
  94. package/lib/config/performance.js +2 -0
  95. package/lib/config/performance.js.map +1 -0
  96. package/lib/config/plugins.d.ts +3 -0
  97. package/lib/config/plugins.d.ts.map +1 -0
  98. package/lib/config/plugins.js +2 -0
  99. package/lib/config/plugins.js.map +1 -0
  100. package/lib/config/profile.d.ts +3 -0
  101. package/lib/config/profile.d.ts.map +1 -0
  102. package/lib/config/profile.js +2 -0
  103. package/lib/config/profile.js.map +1 -0
  104. package/lib/config/recordsPath.d.ts +3 -0
  105. package/lib/config/recordsPath.d.ts.map +1 -0
  106. package/lib/config/recordsPath.js +2 -0
  107. package/lib/config/recordsPath.js.map +1 -0
  108. package/lib/config/resolve.d.ts +2 -3
  109. package/lib/config/resolve.d.ts.map +1 -1
  110. package/lib/config/resolve.js +16 -9
  111. package/lib/config/resolve.js.map +1 -1
  112. package/lib/config/stats.d.ts +3 -0
  113. package/lib/config/stats.d.ts.map +1 -0
  114. package/lib/config/stats.js +17 -0
  115. package/lib/config/stats.js.map +1 -0
  116. package/lib/config/target.d.ts +3 -0
  117. package/lib/config/target.d.ts.map +1 -0
  118. package/lib/config/target.js +4 -0
  119. package/lib/config/target.js.map +1 -0
  120. package/lib/handlers/index.d.ts +19 -0
  121. package/lib/handlers/index.d.ts.map +1 -0
  122. package/lib/handlers/index.js +6 -0
  123. package/lib/handlers/index.js.map +1 -0
  124. package/lib/handlers/items/items.d.ts +69 -0
  125. package/lib/handlers/items/items.d.ts.map +1 -0
  126. package/lib/handlers/items/items.js +93 -0
  127. package/lib/handlers/items/items.js.map +1 -0
  128. package/lib/handlers/loaders/loaders.d.ts +12 -0
  129. package/lib/handlers/loaders/loaders.d.ts.map +1 -0
  130. package/lib/handlers/loaders/loaders.js +11 -0
  131. package/lib/handlers/loaders/loaders.js.map +1 -0
  132. package/lib/handlers/register.d.ts +18 -0
  133. package/lib/handlers/register.d.ts.map +1 -0
  134. package/lib/handlers/register.js +28 -0
  135. package/lib/handlers/register.js.map +1 -0
  136. package/lib/handlers/rules/css.d.ts +3 -0
  137. package/lib/handlers/rules/css.d.ts.map +1 -0
  138. package/lib/handlers/rules/css.js +5 -0
  139. package/lib/handlers/rules/css.js.map +1 -0
  140. package/lib/handlers/rules/css.module.d.ts +3 -0
  141. package/lib/handlers/rules/css.module.d.ts.map +1 -0
  142. package/lib/handlers/rules/css.module.js +5 -0
  143. package/lib/handlers/rules/css.module.js.map +1 -0
  144. package/lib/handlers/rules/csv.d.ts +2 -8
  145. package/lib/handlers/rules/csv.d.ts.map +1 -1
  146. package/lib/handlers/rules/csv.js +3 -9
  147. package/lib/handlers/rules/csv.js.map +1 -1
  148. package/lib/handlers/rules/font.d.ts +3 -0
  149. package/lib/handlers/rules/font.d.ts.map +1 -0
  150. package/lib/handlers/rules/font.inline.d.ts +3 -0
  151. package/lib/handlers/rules/font.inline.d.ts.map +1 -0
  152. package/lib/handlers/rules/font.inline.js +6 -0
  153. package/lib/handlers/rules/font.inline.js.map +1 -0
  154. package/lib/handlers/rules/font.js +5 -0
  155. package/lib/handlers/rules/font.js.map +1 -0
  156. package/lib/handlers/rules/html.d.ts +3 -0
  157. package/lib/handlers/rules/html.d.ts.map +1 -0
  158. package/lib/handlers/rules/html.js +5 -0
  159. package/lib/handlers/rules/html.js.map +1 -0
  160. package/lib/handlers/rules/image.d.ts +3 -0
  161. package/lib/handlers/rules/image.d.ts.map +1 -0
  162. package/lib/handlers/rules/image.inline.d.ts +3 -0
  163. package/lib/handlers/rules/image.inline.d.ts.map +1 -0
  164. package/lib/handlers/rules/image.inline.js +6 -0
  165. package/lib/handlers/rules/image.inline.js.map +1 -0
  166. package/lib/handlers/rules/image.js +5 -0
  167. package/lib/handlers/rules/image.js.map +1 -0
  168. package/lib/handlers/rules/index.d.ts +19 -0
  169. package/lib/handlers/rules/index.d.ts.map +1 -0
  170. package/lib/handlers/rules/index.js +35 -0
  171. package/lib/handlers/rules/index.js.map +1 -0
  172. package/lib/handlers/rules/js.d.ts +3 -0
  173. package/lib/handlers/rules/js.d.ts.map +1 -0
  174. package/lib/handlers/rules/js.js +5 -0
  175. package/lib/handlers/rules/js.js.map +1 -0
  176. package/lib/handlers/rules/json.d.ts +3 -0
  177. package/lib/handlers/rules/json.d.ts.map +1 -0
  178. package/lib/handlers/rules/json.js +7 -0
  179. package/lib/handlers/rules/json.js.map +1 -0
  180. package/lib/handlers/rules/svg.d.ts +3 -0
  181. package/lib/handlers/rules/svg.d.ts.map +1 -0
  182. package/lib/handlers/rules/svg.inline.d.ts +3 -0
  183. package/lib/handlers/rules/svg.inline.d.ts.map +1 -0
  184. package/lib/handlers/rules/svg.inline.js +6 -0
  185. package/lib/handlers/rules/svg.inline.js.map +1 -0
  186. package/lib/handlers/rules/svg.js +5 -0
  187. package/lib/handlers/rules/svg.js.map +1 -0
  188. package/lib/handlers/rules/toml.d.ts +2 -8
  189. package/lib/handlers/rules/toml.d.ts.map +1 -1
  190. package/lib/handlers/rules/toml.js +3 -9
  191. package/lib/handlers/rules/toml.js.map +1 -1
  192. package/lib/handlers/rules/webp.d.ts +3 -0
  193. package/lib/handlers/rules/webp.d.ts.map +1 -0
  194. package/lib/handlers/rules/webp.js +5 -0
  195. package/lib/handlers/rules/webp.js.map +1 -0
  196. package/lib/handlers/rules/xml.d.ts +2 -8
  197. package/lib/handlers/rules/xml.d.ts.map +1 -1
  198. package/lib/handlers/rules/xml.js +3 -9
  199. package/lib/handlers/rules/xml.js.map +1 -1
  200. package/lib/handlers/rules/yml.d.ts +3 -0
  201. package/lib/handlers/rules/yml.d.ts.map +1 -0
  202. package/lib/handlers/rules/yml.js +5 -0
  203. package/lib/handlers/rules/yml.js.map +1 -0
  204. package/lib/helpers/isMjs.d.ts +3 -0
  205. package/lib/helpers/isMjs.d.ts.map +1 -0
  206. package/lib/helpers/isMjs.js +2 -0
  207. package/lib/helpers/isMjs.js.map +1 -0
  208. package/lib/helpers/scriptExtension.d.ts +3 -0
  209. package/lib/helpers/scriptExtension.d.ts.map +1 -0
  210. package/lib/helpers/scriptExtension.js +5 -0
  211. package/lib/helpers/scriptExtension.js.map +1 -0
  212. package/lib/index.d.ts +1 -1
  213. package/lib/index.d.ts.map +1 -1
  214. package/lib/index.js +1 -1
  215. package/lib/index.js.map +1 -1
  216. package/lib/item/index.d.ts +2 -2
  217. package/lib/item/index.d.ts.map +1 -1
  218. package/lib/item/index.js +6 -3
  219. package/lib/item/index.js.map +1 -1
  220. package/lib/loader/index.d.ts +2 -1
  221. package/lib/loader/index.d.ts.map +1 -1
  222. package/lib/loader/index.js +2 -1
  223. package/lib/loader/index.js.map +1 -1
  224. package/lib/rule/index.d.ts +30 -21
  225. package/lib/rule/index.d.ts.map +1 -1
  226. package/lib/rule/index.js +64 -37
  227. package/lib/rule/index.js.map +1 -1
  228. package/lib/service.d.ts +9 -12
  229. package/lib/service.d.ts.map +1 -1
  230. package/lib/service.js +28 -59
  231. package/lib/service.js.map +1 -1
  232. package/lib/shared/base.d.ts +1 -1
  233. package/lib/shared/base.d.ts.map +1 -1
  234. package/lib/shared/base.js +4 -2
  235. package/lib/shared/base.js.map +1 -1
  236. package/lib/types.d.ts +8 -2
  237. package/lib/types.d.ts.map +1 -1
  238. package/package.json +35 -37
  239. package/src/config/bail.ts +4 -0
  240. package/src/config/cache.ts +4 -0
  241. package/src/config/context.ts +3 -0
  242. package/src/config/dependencies.ts +11 -0
  243. package/src/config/devtool.ts +4 -0
  244. package/src/config/entry.ts +4 -0
  245. package/src/config/experiments.ts +4 -0
  246. package/src/config/externals.ts +4 -0
  247. package/src/config/externalsType.ts +3 -0
  248. package/src/config/index.test.ts +129 -0
  249. package/src/config/index.ts +67 -0
  250. package/src/config/infrastructureLogging.ts +21 -0
  251. package/src/config/loader.ts +4 -0
  252. package/src/config/mode.ts +4 -0
  253. package/src/config/module.ts +43 -0
  254. package/src/config/name.ts +4 -0
  255. package/src/config/node.ts +4 -0
  256. package/src/config/optimization.ts +19 -0
  257. package/src/config/output/assetModuleFilename.ts +9 -0
  258. package/src/config/output/chunkFilename.ts +18 -0
  259. package/src/config/output/filename.ts +19 -0
  260. package/src/config/output/index.ts +27 -0
  261. package/src/config/parallelism.ts +6 -0
  262. package/src/config/performance.ts +4 -0
  263. package/src/config/plugins.ts +4 -0
  264. package/src/config/profile.ts +4 -0
  265. package/src/config/recordsPath.ts +7 -0
  266. package/src/config/resolve.ts +33 -0
  267. package/src/config/stats.ts +22 -0
  268. package/src/config/target.ts +9 -0
  269. package/src/handlers/index.ts +22 -0
  270. package/src/handlers/items/items.ts +117 -0
  271. package/src/handlers/loaders/loaders.ts +31 -0
  272. package/src/handlers/register.ts +51 -0
  273. package/src/handlers/rules/css.module.ts +7 -0
  274. package/src/handlers/rules/css.ts +7 -0
  275. package/src/handlers/rules/csv.test.ts +25 -0
  276. package/src/handlers/rules/csv.ts +7 -0
  277. package/src/handlers/rules/font.inline.ts +8 -0
  278. package/src/handlers/rules/font.ts +7 -0
  279. package/src/handlers/rules/html.ts +7 -0
  280. package/src/handlers/rules/image.inline.ts +8 -0
  281. package/src/handlers/rules/image.ts +7 -0
  282. package/src/handlers/rules/index.ts +35 -0
  283. package/src/handlers/rules/js.ts +7 -0
  284. package/src/handlers/rules/json.ts +10 -0
  285. package/src/handlers/rules/svg.inline.ts +8 -0
  286. package/src/handlers/rules/svg.ts +7 -0
  287. package/src/handlers/rules/toml.test.ts +22 -0
  288. package/src/handlers/rules/toml.ts +10 -0
  289. package/src/handlers/rules/webp.ts +7 -0
  290. package/src/handlers/rules/xml.test.ts +24 -0
  291. package/src/handlers/rules/xml.ts +7 -0
  292. package/src/handlers/rules/yml.ts +7 -0
  293. package/src/helpers/isMjs.ts +4 -0
  294. package/src/helpers/scriptExtension.ts +11 -0
  295. package/src/index.ts +17 -0
  296. package/src/item/index.ts +181 -0
  297. package/src/loader/index.ts +40 -0
  298. package/src/rule/index.test.ts +88 -0
  299. package/src/rule/index.ts +311 -0
  300. package/src/service.ts +245 -0
  301. package/src/shared/base.ts +37 -0
  302. package/src/types.ts +57 -0
  303. package/lib/config/builder.d.ts +0 -31
  304. package/lib/config/builder.d.ts.map +0 -1
  305. package/lib/config/builder.js +0 -32
  306. package/lib/config/builder.js.map +0 -1
  307. package/lib/config/output.d.ts +0 -4
  308. package/lib/config/output.d.ts.map +0 -1
  309. package/lib/config/output.js +0 -13
  310. package/lib/config/output.js.map +0 -1
  311. package/lib/handlers/items.d.ts +0 -69
  312. package/lib/handlers/items.d.ts.map +0 -1
  313. package/lib/handlers/items.js +0 -99
  314. package/lib/handlers/items.js.map +0 -1
  315. package/lib/handlers/loaders.d.ts +0 -57
  316. package/lib/handlers/loaders.d.ts.map +0 -1
  317. package/lib/handlers/loaders.js +0 -82
  318. package/lib/handlers/loaders.js.map +0 -1
  319. package/lib/handlers/rules/rules.d.ts +0 -63
  320. package/lib/handlers/rules/rules.d.ts.map +0 -1
  321. package/lib/handlers/rules/rules.js +0 -124
  322. package/lib/handlers/rules/rules.js.map +0 -1
@@ -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,KAAoD,EACpD,GAAG,OAAmB;QAEtB,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;IAChE,CAAC;CACF;AAZC;IAAC,IAAI;;;;gCAGJ;AAED;IAAC,IAAI;;;wDAIF,CAAC,oBAAD,CAAC;kCAEH"}
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
- import type { Item, Loader, Rule } from '@roots/bud-framework';
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
- json5: Rule;
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
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,sBAAsB,CAAA;AAE5D,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,KAAK,EAAE,IAAI,CAAA;QACX,GAAG,EAAE,IAAI,CAAA;QACT,GAAG,EAAE,IAAI,CAAA;QACT,IAAI,EAAE,IAAI,CAAA;KACX;CACF"}
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.5",
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
- "lib/"
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
- ".": "./lib/index.js",
44
- "./item": "./lib/item/index.js",
45
- "./items": "./lib/handlers/items.js",
46
- "./loader": "./lib/loader/index.js",
47
- "./loaders": "./lib/handlers/loaders.js",
48
- "./rule": "./lib/rule/index.js",
49
- "./rules": "./lib/handlers/rules.js"
50
- },
51
- "typesVersions": {
52
- "*": {
53
- ".": [
54
- "./lib/index.d.ts"
55
- ],
56
- "item": [
57
- "./lib/item/index.d.ts"
58
- ],
59
- "items": [
60
- "./lib/handlers/items.d.ts"
61
- ],
62
- "loader": [
63
- "./lib/loader/index.d.ts"
64
- ],
65
- "loaders": [
66
- "./lib/handlers/loaders.d.ts"
67
- ],
68
- "rule": [
69
- "./lib/rule/index.d.ts"
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.5",
78
- "@roots/bud-hooks": "6.6.5",
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.5",
87
- "@roots/bud-support": "6.6.5",
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,4 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const bail: Factory<'bail'> = async ({hooks, isProduction}) =>
4
+ hooks.filter(`build.bail`, isProduction)
@@ -0,0 +1,4 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const cache: Factory<`cache`> = async ({cache, hooks}) =>
4
+ hooks.filter(`build.cache`, cache.configuration)
@@ -0,0 +1,3 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const context: Factory<`context`> = async ({path}) => path(`@src`)
@@ -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,4 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const devtool: Factory<`devtool`> = async ({hooks}) =>
4
+ hooks.filter(`build.devtool`, false)
@@ -0,0 +1,4 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const entry: Factory<`entry`> = async ({hooks}) =>
4
+ hooks.filter(`build.entry`, {main: {import: [`index`]}})
@@ -0,0 +1,4 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const experiments: Factory<`experiments`> = async ({hooks}) =>
4
+ hooks.filter(`build.experiments`, undefined)
@@ -0,0 +1,4 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const externals: Factory<`externals`> = async app =>
4
+ app.hooks.filter(`build.externals`, undefined)
@@ -0,0 +1,3 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const externalsType: Factory<`externalsType`> = async app => `var`
@@ -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,4 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const loader: Factory<`loader`> = async app =>
4
+ app.hooks.filter(`build.loader`)
@@ -0,0 +1,4 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const mode: Factory<`mode`> = async bud =>
4
+ bud.hooks.filter(`build.mode`, bud.mode)
@@ -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,4 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const name: Factory<`name`> = async ({hooks, label}) =>
4
+ hooks.filter(`build.name`, label)
@@ -0,0 +1,4 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const node: Factory<`node`> = async ({hooks}) =>
4
+ hooks.filter(`build.node`, 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,9 @@
1
+ import type {Bud} from '@roots/bud-framework'
2
+
3
+ interface Props {
4
+ filter: Bud['hooks'][`filter`]
5
+ path: Bud['path']
6
+ }
7
+
8
+ export const assetModuleFilename = ({filter, path}: Props) =>
9
+ filter(`build.output.assetModuleFilename`, path(`@file`))
@@ -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,6 @@
1
+ import {cpus} from 'node:os'
2
+
3
+ import type {Factory} from './index.js'
4
+
5
+ export const parallelism: Factory<`parallelism`> = async ({hooks}) =>
6
+ hooks.filter(`build.parallelism`, 10 * Math.max(cpus().length - 1, 1))
@@ -0,0 +1,4 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const performance: Factory<`performance`> = async ({hooks}) =>
4
+ hooks.filter(`build.performance`, {hints: false})
@@ -0,0 +1,4 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const plugins: Factory<`plugins`> = async app =>
4
+ await app.hooks.filterAsync(`build.plugins`, await app.extensions.make())
@@ -0,0 +1,4 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const profile: Factory<`profile`> = async app =>
4
+ app.hooks.filter(`build.profile`, undefined)
@@ -0,0 +1,7 @@
1
+ import type {Factory} from './index.js'
2
+
3
+ export const recordsPath: Factory<`recordsPath`> = async bud =>
4
+ bud.hooks.filter(
5
+ `build.recordsPath`,
6
+ bud.path(`@storage`, bud.label, `modules.json`),
7
+ )
@@ -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
+ ])