@roots/bud-build 5.8.5 → 6.0.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.
Files changed (72) hide show
  1. package/{types/Build → lib}/config/builder.d.ts +0 -0
  2. package/lib/config/builder.d.ts.map +1 -0
  3. package/lib/{cjs/Build/config → config}/builder.js +28 -14
  4. package/lib/config/builder.js.map +1 -0
  5. package/lib/config/filenameFormat.d.ts +13 -0
  6. package/lib/config/filenameFormat.d.ts.map +1 -0
  7. package/lib/config/filenameFormat.js +21 -0
  8. package/lib/config/filenameFormat.js.map +1 -0
  9. package/lib/config/index.d.ts +3 -0
  10. package/lib/config/index.d.ts.map +1 -0
  11. package/lib/config/index.js +3 -0
  12. package/lib/config/index.js.map +1 -0
  13. package/{types → lib/handlers}/items.d.ts +13 -19
  14. package/lib/handlers/items.d.ts.map +1 -0
  15. package/lib/handlers/items.js +92 -0
  16. package/lib/handlers/items.js.map +1 -0
  17. package/lib/handlers/loaders.d.ts +56 -0
  18. package/lib/handlers/loaders.d.ts.map +1 -0
  19. package/lib/handlers/loaders.js +82 -0
  20. package/lib/handlers/loaders.js.map +1 -0
  21. package/{types → lib/handlers}/rules.d.ts +14 -14
  22. package/lib/handlers/rules.d.ts.map +1 -0
  23. package/lib/{cjs → handlers}/rules.js +18 -32
  24. package/lib/handlers/rules.js.map +1 -0
  25. package/lib/index.d.ts +14 -0
  26. package/lib/index.d.ts.map +1 -0
  27. package/lib/index.js +16 -0
  28. package/lib/index.js.map +1 -0
  29. package/{types/Item/index.d.ts → lib/item.d.ts} +2 -2
  30. package/lib/item.d.ts.map +1 -0
  31. package/lib/{cjs/Item/index.js → item.js} +12 -22
  32. package/lib/item.js.map +1 -0
  33. package/{types/Loader/index.d.ts → lib/loader.d.ts} +4 -8
  34. package/lib/loader.d.ts.map +1 -0
  35. package/lib/{cjs/Loader/index.js → loader.js} +3 -9
  36. package/lib/loader.js.map +1 -0
  37. package/{types/Rule/index.d.ts → lib/rule.d.ts} +3 -3
  38. package/lib/rule.d.ts.map +1 -0
  39. package/lib/{cjs/Rule/index.js → rule.js} +22 -32
  40. package/lib/rule.js.map +1 -0
  41. package/{types/Build/index.d.ts → lib/service.d.ts} +8 -10
  42. package/lib/service.d.ts.map +1 -0
  43. package/lib/{cjs/Build/index.js → service.js} +48 -72
  44. package/lib/service.js.map +1 -0
  45. package/{types/shared/Base.d.ts → lib/shared/base.d.ts} +6 -1
  46. package/lib/shared/base.d.ts.map +1 -0
  47. package/lib/shared/base.js +29 -0
  48. package/lib/shared/base.js.map +1 -0
  49. package/package.json +45 -38
  50. package/lib/cjs/Build/config/filenameFormat.js +0 -17
  51. package/lib/cjs/Build/config/index.js +0 -28
  52. package/lib/cjs/index.js +0 -50
  53. package/lib/cjs/items.js +0 -119
  54. package/lib/cjs/loaders.js +0 -63
  55. package/lib/cjs/shared/Base.js +0 -31
  56. package/lib/tsconfig.tsbuildinfo +0 -1
  57. package/types/Build/config/builder.d.ts.map +0 -1
  58. package/types/Build/config/filenameFormat.d.ts +0 -13
  59. package/types/Build/config/filenameFormat.d.ts.map +0 -1
  60. package/types/Build/config/index.d.ts +0 -3
  61. package/types/Build/config/index.d.ts.map +0 -1
  62. package/types/Build/index.d.ts.map +0 -1
  63. package/types/Item/index.d.ts.map +0 -1
  64. package/types/Loader/index.d.ts.map +0 -1
  65. package/types/Rule/index.d.ts.map +0 -1
  66. package/types/index.d.ts +0 -17
  67. package/types/index.d.ts.map +0 -1
  68. package/types/items.d.ts.map +0 -1
  69. package/types/loaders.d.ts +0 -47
  70. package/types/loaders.d.ts.map +0 -1
  71. package/types/rules.d.ts.map +0 -1
  72. package/types/shared/Base.d.ts.map +0 -1
@@ -1,62 +1,34 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
- return c > 3 && r && Object.defineProperty(target, key, r), r;
23
- };
24
- var __importStar = (this && this.__importStar) || function (mod) {
25
- if (mod && mod.__esModule) return mod;
26
- var result = {};
27
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
- __setModuleDefault(result, mod);
29
- return result;
30
- };
31
- var __importDefault = (this && this.__importDefault) || function (mod) {
32
- return (mod && mod.__esModule) ? mod : { "default": mod };
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.Build = void 0;
36
- const Bud = __importStar(require("@roots/bud-framework"));
37
- const bud_support_1 = require("@roots/bud-support");
38
- const lodash_1 = require("lodash");
39
- const Item_1 = __importDefault(require("../Item"));
40
- const items = __importStar(require("../items"));
41
- const Loader_1 = __importDefault(require("../Loader"));
42
- const loaders = __importStar(require("../loaders"));
43
- const Rule_1 = __importDefault(require("../Rule"));
44
- const rules = __importStar(require("../rules"));
45
- const config = __importStar(require("./config"));
46
- const { isUndefined } = bud_support_1.lodash;
47
- const { ensureFile, writeFile } = bud_support_1.fs;
1
+ import { __decorate } from "tslib";
2
+ import { Service } from '@roots/bud-framework/service';
3
+ import fs from 'fs-extra';
4
+ import { bind } from 'helpful-decorators';
5
+ import { isFunction, isUndefined } from 'lodash-es';
6
+ import * as config from './config/index.js';
7
+ import * as items from './handlers/items.js';
8
+ import * as loaders from './handlers/loaders.js';
9
+ import * as rules from './handlers/rules.js';
10
+ import Item from './item.js';
11
+ import Loader from './loader.js';
12
+ import Rule from './rule.js';
13
+ const { ensureFile, writeFile } = fs;
48
14
  /**
49
15
  * Webpack configuration builder class
50
16
  *
51
17
  * @public
52
18
  */
53
- class Build extends Bud.Service {
19
+ export class Build extends Service {
54
20
  constructor() {
55
21
  super(...arguments);
56
22
  /**
57
23
  * @public
58
24
  */
59
25
  this.config = {};
26
+ /**
27
+ * Registered loaders
28
+ *
29
+ * @public
30
+ */
31
+ this.loaders = {};
60
32
  }
61
33
  /**
62
34
  * Service booted event
@@ -74,6 +46,7 @@ class Build extends Bud.Service {
74
46
  * @decorator `@bind`
75
47
  */
76
48
  async make() {
49
+ await this.app.extensions.runAll('_beforeBuild');
77
50
  await this.app.hooks.fire('event.build.before');
78
51
  await Promise.all([
79
52
  ['entry'],
@@ -85,6 +58,7 @@ class Build extends Bud.Service {
85
58
  ['devtool'],
86
59
  ['experiments'],
87
60
  ['externals'],
61
+ ['externalsType'],
88
62
  ['infrastructureLogging'],
89
63
  ['loader'],
90
64
  ['mode'],
@@ -120,15 +94,17 @@ class Build extends Bud.Service {
120
94
  * @decorator `@bind`
121
95
  */
122
96
  async register() {
123
- const reducer = (a, [k, v]) => ({
124
- ...a,
125
- [k]: v(this.app),
126
- });
97
+ const reducer = (a, [k, v]) => {
98
+ const obj = v(this.app);
99
+ return { ...a, [k]: obj };
100
+ };
101
+ await Promise.all(this.app
102
+ .container(loaders)
103
+ .getEntries()
104
+ .map(async ([key, fn]) => {
105
+ this.loaders[key] = await fn(this.app);
106
+ }));
127
107
  Object.assign(this, {
128
- loaders: this.app
129
- .container(loaders)
130
- .getEntries()
131
- .reduce(reducer, this.loaders),
132
108
  rules: this.app
133
109
  .container(rules)
134
110
  .getEntries()
@@ -151,7 +127,7 @@ class Build extends Bud.Service {
151
127
  * @decorator `@bind`
152
128
  */
153
129
  setRule(name, options) {
154
- const processedOptions = (0, lodash_1.isFunction)(options)
130
+ const processedOptions = isFunction(options)
155
131
  ? options(this.makeRule())
156
132
  : this.makeRule(options);
157
133
  Object.assign(this.rules, { [name]: processedOptions });
@@ -167,7 +143,7 @@ class Build extends Bud.Service {
167
143
  * @decorator `@bind`
168
144
  */
169
145
  makeRule(options) {
170
- return new Rule_1.default(() => this.app, options);
146
+ return new Rule(() => this.app, options);
171
147
  }
172
148
  /**
173
149
  * Set Loader
@@ -193,7 +169,7 @@ class Build extends Bud.Service {
193
169
  * @decorator `@bind`
194
170
  */
195
171
  makeLoader(options) {
196
- return new Loader_1.default(() => this.app, options);
172
+ return new Loader(() => this.app, options);
197
173
  }
198
174
  /**
199
175
  * Set Item
@@ -206,7 +182,7 @@ class Build extends Bud.Service {
206
182
  * @decorator `@bind`
207
183
  */
208
184
  setItem(name, options) {
209
- const processedOptions = (0, lodash_1.isFunction)(options)
185
+ const processedOptions = isFunction(options)
210
186
  ? options(this.makeItem())
211
187
  : this.makeItem(options);
212
188
  Object.assign(this.items, { [name]: processedOptions });
@@ -222,7 +198,7 @@ class Build extends Bud.Service {
222
198
  * @decorator `@bind`
223
199
  */
224
200
  makeItem(options) {
225
- return new Item_1.default(() => this.app, options);
201
+ return new Item(() => this.app, options);
226
202
  }
227
203
  /**
228
204
  * Write final configuration to storage directory
@@ -242,33 +218,33 @@ class Build extends Bud.Service {
242
218
  }
243
219
  }
244
220
  __decorate([
245
- bud_support_1.bind
221
+ bind
246
222
  ], Build.prototype, "registered", null);
247
223
  __decorate([
248
- bud_support_1.bind
224
+ bind
249
225
  ], Build.prototype, "make", null);
250
226
  __decorate([
251
- bud_support_1.bind
227
+ bind
252
228
  ], Build.prototype, "register", null);
253
229
  __decorate([
254
- bud_support_1.bind
230
+ bind
255
231
  ], Build.prototype, "setRule", null);
256
232
  __decorate([
257
- bud_support_1.bind
233
+ bind
258
234
  ], Build.prototype, "makeRule", null);
259
235
  __decorate([
260
- bud_support_1.bind
236
+ bind
261
237
  ], Build.prototype, "setLoader", null);
262
238
  __decorate([
263
- bud_support_1.bind
239
+ bind
264
240
  ], Build.prototype, "makeLoader", null);
265
241
  __decorate([
266
- bud_support_1.bind
242
+ bind
267
243
  ], Build.prototype, "setItem", null);
268
244
  __decorate([
269
- bud_support_1.bind
245
+ bind
270
246
  ], Build.prototype, "makeItem", null);
271
247
  __decorate([
272
- bud_support_1.bind
248
+ bind
273
249
  ], Build.prototype, "writeFinalConfig", null);
274
- exports.Build = Build;
250
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,OAAO,EAAC,MAAM,8BAA8B,CAAA;AACpD,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAC,UAAU,EAAE,WAAW,EAAC,MAAM,WAAW,CAAA;AAGjD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAA;AAC5C,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAA;AAChD,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAA;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,MAAM,EAAC,UAAU,EAAE,SAAS,EAAC,GAAG,EAAE,CAAA;AAElC;;;;GAIG;AACH,MAAM,OAAO,KAAM,SAAQ,OAAO;IAAlC;;QACE;;WAEG;QACI,WAAM,GAA2B,EAAE,CAAA;QAE1C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ADC,IAAI;6CAmBJ"}
@@ -1,9 +1,14 @@
1
1
  import type { Bud } from '@roots/bud-framework';
2
2
  export default class Base {
3
3
  _app: () => Bud;
4
+ /**
5
+ * Application getter
6
+ *
7
+ * @readonly @public
8
+ */
4
9
  get app(): Bud;
5
10
  constructor(_app: () => Bud);
6
11
  wrap<T = any>(input: T | ((app: Bud) => T)): (app: Bud) => T;
7
12
  unwrap<T = any>(input: T | ((app: Bud, ...options: Array<any>) => T), ...options: Array<any>): T;
8
13
  }
9
- //# sourceMappingURL=Base.d.ts.map
14
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/shared/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,sBAAsB,CAAA;AAI7C,MAAM,CAAC,OAAO,OAAO,IAAI;IAUG,IAAI,EAAE,MAAM,GAAG;IATzC;;;;OAIG;IACH,IAAW,GAAG,QAEb;gBAEyB,IAAI,EAAE,MAAM,GAAG;IAGlC,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;IAK5D,MAAM,CAAC,CAAC,GAAG,GAAG,EACnB,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EACpD,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GACrB,CAAC;CAGL"}
@@ -0,0 +1,29 @@
1
+ import { __decorate } from "tslib";
2
+ import { bind } from 'helpful-decorators';
3
+ import { isFunction } from 'lodash-es';
4
+ export default class Base {
5
+ constructor(_app) {
6
+ this._app = _app;
7
+ }
8
+ /**
9
+ * Application getter
10
+ *
11
+ * @readonly @public
12
+ */
13
+ get app() {
14
+ return this._app();
15
+ }
16
+ wrap(input) {
17
+ return isFunction(input) ? input : () => input;
18
+ }
19
+ unwrap(input, ...options) {
20
+ return isFunction(input) ? input(this.app, ...options) : input;
21
+ }
22
+ }
23
+ __decorate([
24
+ bind
25
+ ], Base.prototype, "wrap", null);
26
+ __decorate([
27
+ bind
28
+ ], Base.prototype, "unwrap", null);
29
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/shared/base.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAA;AAEpC,MAAM,CAAC,OAAO,OAAO,IAAI;IAUvB,YAA0B,IAAe;QAAf,SAAI,GAAJ,IAAI,CAAW;IAAG,CAAC;IAT7C;;;;OAIG;IACH,IAAW,GAAG;QACZ,OAAO,IAAI,CAAC,IAAI,EAAE,CAAA;IACpB,CAAC;IAKM,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;AAXC;IADC,IAAI;gCAGJ;AAGD;IADC,IAAI;kCAMJ"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@roots/bud-build",
3
3
  "description": "Bud webpack config build controller",
4
- "version": "5.8.5",
4
+ "version": "6.0.0",
5
5
  "homepage": "https://roots.io/bud",
6
6
  "repository": {
7
7
  "type": "git",
@@ -31,72 +31,79 @@
31
31
  "bud-framework"
32
32
  ],
33
33
  "engines": {
34
- "node": ">=14"
34
+ "node": ">=16"
35
35
  },
36
36
  "files": [
37
- "lib/",
38
- "types/"
37
+ "lib/"
39
38
  ],
40
- "main": "./lib/cjs/index.js",
41
- "module": "./lib/esm/index.js",
42
- "types": "./types/index.d.ts",
39
+ "type": "module",
40
+ "module": "./lib/index.js",
41
+ "types": "./lib/index.d.ts",
43
42
  "exports": {
44
- ".": "./lib/cjs/index.js",
45
- "./item": "./lib/cjs/Item/index.js",
46
- "./items": "./lib/cjs/items.js",
47
- "./loader": "./lib/cjs/Loader/index.js",
48
- "./loaders": "./lib/cjs/loaders.js",
49
- "./rule": "./lib/cjs/Rule/index.js",
50
- "./rules": "./lib/cjs/rules.js"
43
+ ".": "./lib/index.js",
44
+ "./item": "./lib/item.js",
45
+ "./items": "./lib/handlers/items.js",
46
+ "./loader": "./lib/loader.js",
47
+ "./loaders": "./lib/handlers/loaders.js",
48
+ "./rule": "./lib/rule.js",
49
+ "./rules": "./lib/handlers/rules.js",
50
+ "./service": "./lib/service.js"
51
51
  },
52
52
  "typesVersions": {
53
53
  "*": {
54
54
  ".": [
55
- "./types/index.d.ts"
55
+ "./lib/index.d.ts"
56
56
  ],
57
- "./item": [
58
- "./types/Item/index.d.ts"
57
+ "item": [
58
+ "./lib/item.d.ts"
59
59
  ],
60
- "./items": [
61
- "./types/items.d.ts"
60
+ "items": [
61
+ "./lib/handlers/items.d.ts"
62
62
  ],
63
- "./loader": [
64
- "./types/Loader/index.d.ts"
63
+ "loader": [
64
+ "./lib/loader.d.ts"
65
65
  ],
66
- "./loaders": [
67
- "./types/loaders.d.ts"
66
+ "loaders": [
67
+ "./lib/handlers/loaders.d.ts"
68
68
  ],
69
- "./rule": [
70
- "./types/Rule/index.d.ts"
69
+ "rule": [
70
+ "./lib/rule.d.ts"
71
71
  ],
72
- "./rules": [
73
- "./types/rules.d.ts"
72
+ "rules": [
73
+ "./lib/handlers/rules.d.ts"
74
+ ],
75
+ "service": [
76
+ "./lib/service.d.ts"
74
77
  ]
75
78
  }
76
79
  },
77
80
  "devDependencies": {
78
81
  "@skypack/package-check": "0.2.2",
82
+ "@types/fs-extra": "9.0.13",
79
83
  "@types/lodash": "4.14.182",
84
+ "@types/lodash-es": "4.17.6",
80
85
  "@types/mini-css-extract-plugin": "2.5.0",
81
- "@types/node": "16.11.36",
82
- "webpack": "5.72.1"
86
+ "@types/node": "16.11.39",
87
+ "webpack": "5.73.0"
83
88
  },
84
89
  "dependencies": {
85
- "@roots/bud-framework": "5.8.5",
86
- "@roots/bud-support": "5.8.5",
90
+ "@roots/bud-framework": "6.0.0",
87
91
  "css-loader": "^6.5.1",
88
92
  "csv-loader": "^3.0.3",
89
93
  "file-loader": "^6.2.0",
94
+ "fs-extra": "10.1.0",
95
+ "helpful-decorators": "2.1.0",
90
96
  "html-loader": "^3.0.1",
91
- "js-yaml-loader": "1.2.2",
97
+ "json5": "2.2.1",
98
+ "lodash-es": "4.17.21",
92
99
  "mini-css-extract-plugin": "^2.4.5",
93
- "remark": "^14.0.2",
94
- "remark-html": "^15.0.0",
100
+ "remark": "14.0.2",
101
+ "remark-html": "15.0.0",
95
102
  "remark-loader": "4.0.0",
96
- "resolve-url-loader": "^5.0.0",
97
- "style-loader": "^3.3.1",
103
+ "style-loader": "3.3.1",
104
+ "toml": "3.0.0",
98
105
  "tslib": "2.4.0",
99
- "url-loader": "^4.1.1",
100
- "xml-loader": "^1.2.1"
106
+ "xml-loader": "1.2.1",
107
+ "yml-loader": "2.1.0"
101
108
  }
102
109
  }
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.filenameFormat = void 0;
4
- /**
5
- * Filename
6
- *
7
- * @param app - Bud
8
- * @param ext - Filename extension
9
- *
10
- * @returns filename format
11
- *
12
- * @public
13
- */
14
- const filenameFormat = (app, ext) => app.hooks.filter('feature.hash')
15
- ? app.hooks.filter('value.hashFormat').concat(ext ?? '.js')
16
- : app.hooks.filter('value.fileFormat').concat(ext ?? '.js');
17
- exports.filenameFormat = filenameFormat;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.builder = void 0;
27
- const builder = __importStar(require("./builder"));
28
- exports.builder = builder;
package/lib/cjs/index.js DELETED
@@ -1,50 +0,0 @@
1
- "use strict";
2
- // Copyright © Roots Software Foundation LLC
3
- // Licensed under the MIT license.
4
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
- if (k2 === undefined) k2 = k;
6
- var desc = Object.getOwnPropertyDescriptor(m, k);
7
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
- desc = { enumerable: true, get: function() { return m[k]; } };
9
- }
10
- Object.defineProperty(o, k2, desc);
11
- }) : (function(o, m, k, k2) {
12
- if (k2 === undefined) k2 = k;
13
- o[k2] = m[k];
14
- }));
15
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
- Object.defineProperty(o, "default", { enumerable: true, value: v });
17
- }) : function(o, v) {
18
- o["default"] = v;
19
- });
20
- var __importStar = (this && this.__importStar) || function (mod) {
21
- if (mod && mod.__esModule) return mod;
22
- var result = {};
23
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
- __setModuleDefault(result, mod);
25
- return result;
26
- };
27
- var __importDefault = (this && this.__importDefault) || function (mod) {
28
- return (mod && mod.__esModule) ? mod : { "default": mod };
29
- };
30
- Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.rules = exports.loaders = exports.items = exports.Rule = exports.Item = exports.Loader = exports.Build = void 0;
32
- /**
33
- * Configuration builder
34
- *
35
- * @see https://bud.js.org
36
- * @see https://github.com/roots/bud
37
- *
38
- * @packageDocumentation
39
- */
40
- var Build_1 = require("./Build");
41
- Object.defineProperty(exports, "Build", { enumerable: true, get: function () { return Build_1.Build; } });
42
- const Item_1 = __importDefault(require("./Item"));
43
- exports.Item = Item_1.default;
44
- const Loader_1 = __importDefault(require("./Loader"));
45
- exports.Loader = Loader_1.default;
46
- const Rule_1 = __importDefault(require("./Rule"));
47
- exports.Rule = Rule_1.default;
48
- exports.items = __importStar(require("./items"));
49
- exports.loaders = __importStar(require("./loaders"));
50
- exports.rules = __importStar(require("./rules"));
package/lib/cjs/items.js DELETED
@@ -1,119 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.yml = exports.xml = exports.resolveUrl = exports.file = exports.raw = exports.precss = exports.minicss = exports.md = exports.style = exports.html = exports.csv = exports.cssModule = exports.css = void 0;
4
- /**
5
- * .css handler factory
6
- *
7
- * @public
8
- */
9
- const css = (app) => app.build
10
- .makeItem()
11
- .setLoader(`css`)
12
- .setOptions(({ hooks }) => ({
13
- importLoaders: 1,
14
- sourceMap: hooks.filter('build.devtool') ? true : false,
15
- }));
16
- exports.css = css;
17
- /**
18
- * .css handler factory
19
- *
20
- * @public
21
- */
22
- const cssModule = (app) => app.build
23
- .makeItem()
24
- .setLoader(`css`)
25
- .setOptions(({ hooks }) => ({
26
- importLoaders: 1,
27
- localIdentName: '[name]__[local]___[hash:base64:5]',
28
- modules: true,
29
- sourceMap: hooks.filter('build.devtool') ? true : false,
30
- }));
31
- exports.cssModule = cssModule;
32
- /**
33
- * .csv handler factory
34
- *
35
- * @public
36
- */
37
- const csv = (app) => app.build.makeItem().setLoader(`csv`);
38
- exports.csv = csv;
39
- /**
40
- * .html handler factory
41
- *
42
- * @public
43
- */
44
- const html = (app) => app.build.makeItem().setLoader(`html`);
45
- exports.html = html;
46
- /**
47
- * Factory {@link Item} for style
48
- *
49
- * @public
50
- */
51
- const style = (app) => app.build.makeItem().setLoader(`style`);
52
- exports.style = style;
53
- /**
54
- * Factory {@link Item} for markdown
55
- *
56
- * @public
57
- */
58
- const md = (app) => app.build.makeItem({ loader: 'md' });
59
- exports.md = md;
60
- /**
61
- * Factory {@link Item} for minicss-extract-plugin
62
- * @public
63
- */
64
- const minicss = (app) => app.build
65
- .makeItem()
66
- .setLoader(`minicss`)
67
- .setOptions(app => ({
68
- publicPath: app.hooks.filter('build.output.publicPath'),
69
- }));
70
- exports.minicss = minicss;
71
- /**
72
- * CSS rule which accounts for env
73
- * @public
74
- */
75
- const precss = (app) => app.build.makeItem().setLoader(app.isProduction ? `minicss` : `style`);
76
- exports.precss = precss;
77
- const raw = ({ build }) => build.makeItem().setLoader(`raw`);
78
- exports.raw = raw;
79
- /**
80
- * Factory {@link Item} for file
81
- *
82
- * @public
83
- */
84
- const file = (app) => app.build
85
- .makeItem()
86
- .setLoader(`file`)
87
- .setOptions(app => ({
88
- name: app.hooks.filter('feature.hash')
89
- ? app.hooks.filter('value.hashFormat').concat('.[ext]')
90
- : app.hooks.filter('value.fileFormat').concat('.[ext]'),
91
- }));
92
- exports.file = file;
93
- /**
94
- * Factory {@link Item} resolve-url
95
- *
96
- * @public
97
- */
98
- const resolveUrl = (app) => app.build
99
- .makeItem()
100
- .setLoader(`resolveUrl`)
101
- .setOptions(({ path, hooks }) => ({
102
- root: path('@src'),
103
- sourceMap: hooks.filter('build.devtool') ? true : false,
104
- }));
105
- exports.resolveUrl = resolveUrl;
106
- /**
107
- * Factory {@link Item} for xml
108
- *
109
- * @public
110
- */
111
- const xml = (app) => app.build.makeItem().setLoader(`xml`);
112
- exports.xml = xml;
113
- /**
114
- * Factory {@link Item} for yml
115
- *
116
- * @public
117
- */
118
- const yml = (app) => app.build.makeItem().setLoader(`yml`);
119
- exports.yml = yml;