@roots/bud-build 5.0.0-next.9 → 5.3.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 (73) hide show
  1. package/README.md +8 -28
  2. package/lib/cjs/Build/config.js +176 -89
  3. package/lib/cjs/Build/index.js +140 -68
  4. package/lib/cjs/Build/items.js +55 -33
  5. package/lib/cjs/Build/loaders.js +28 -17
  6. package/lib/cjs/Build/rules.js +153 -90
  7. package/lib/cjs/Item/index.js +26 -26
  8. package/lib/cjs/Item/item.dependencies.js +0 -1
  9. package/lib/cjs/Item/item.interface.js +2 -3
  10. package/lib/cjs/Loader/index.js +34 -10
  11. package/lib/cjs/Rule/index.js +180 -82
  12. package/lib/cjs/index.js +31 -14
  13. package/lib/cjs/shared/Base.js +0 -1
  14. package/lib/tsconfig.tsbuildinfo +1 -1
  15. package/package.json +17 -37
  16. package/types/Build/config.d.ts +8 -1
  17. package/types/Build/config.d.ts.map +1 -1
  18. package/types/Build/index.d.ts +44 -7
  19. package/types/Build/index.d.ts.map +1 -1
  20. package/types/Build/items.d.ts +30 -3
  21. package/types/Build/items.d.ts.map +1 -1
  22. package/types/Build/loaders.d.ts +14 -4
  23. package/types/Build/loaders.d.ts.map +1 -1
  24. package/types/Build/rules.d.ts +61 -22
  25. package/types/Build/rules.d.ts.map +1 -1
  26. package/types/Item/index.d.ts +9 -17
  27. package/types/Item/index.d.ts.map +1 -1
  28. package/types/Item/item.interface.d.ts +1 -1
  29. package/types/Item/item.interface.d.ts.map +1 -1
  30. package/types/Loader/index.d.ts +13 -10
  31. package/types/Loader/index.d.ts.map +1 -1
  32. package/types/Rule/index.d.ts +122 -24
  33. package/types/Rule/index.d.ts.map +1 -1
  34. package/types/index.d.ts +5 -6
  35. package/types/index.d.ts.map +1 -1
  36. package/types/shared/Base.d.ts.map +1 -1
  37. package/lib/cjs/Build/config.js.map +0 -1
  38. package/lib/cjs/Build/index.js.map +0 -1
  39. package/lib/cjs/Build/items.js.map +0 -1
  40. package/lib/cjs/Build/loaders.js.map +0 -1
  41. package/lib/cjs/Build/rules.js.map +0 -1
  42. package/lib/cjs/Item/index.js.map +0 -1
  43. package/lib/cjs/Item/item.dependencies.js.map +0 -1
  44. package/lib/cjs/Item/item.interface.js.map +0 -1
  45. package/lib/cjs/Loader/index.js.map +0 -1
  46. package/lib/cjs/Rule/index.js.map +0 -1
  47. package/lib/cjs/index.js.map +0 -1
  48. package/lib/cjs/shared/Base.js.map +0 -1
  49. package/lib/esm/Build/config.js +0 -174
  50. package/lib/esm/Build/config.js.map +0 -1
  51. package/lib/esm/Build/index.js +0 -104
  52. package/lib/esm/Build/index.js.map +0 -1
  53. package/lib/esm/Build/items.js +0 -92
  54. package/lib/esm/Build/items.js.map +0 -1
  55. package/lib/esm/Build/loaders.js +0 -45
  56. package/lib/esm/Build/loaders.js.map +0 -1
  57. package/lib/esm/Build/rules.js +0 -103
  58. package/lib/esm/Build/rules.js.map +0 -1
  59. package/lib/esm/Item/index.js +0 -88
  60. package/lib/esm/Item/index.js.map +0 -1
  61. package/lib/esm/Item/item.dependencies.js +0 -4
  62. package/lib/esm/Item/item.dependencies.js.map +0 -1
  63. package/lib/esm/Item/item.interface.js +0 -2
  64. package/lib/esm/Item/item.interface.js.map +0 -1
  65. package/lib/esm/Loader/index.js +0 -49
  66. package/lib/esm/Loader/index.js.map +0 -1
  67. package/lib/esm/Rule/index.js +0 -155
  68. package/lib/esm/Rule/index.js.map +0 -1
  69. package/lib/esm/index.js +0 -27
  70. package/lib/esm/index.js.map +0 -1
  71. package/lib/esm/shared/Base.js +0 -8
  72. package/lib/esm/shared/Base.js.map +0 -1
  73. package/lib/tsconfig-esm.tsbuildinfo +0 -1
@@ -1,7 +1,32 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
15
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17
+ 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;
18
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
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
+ };
2
27
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const bud_framework_1 = require("@roots/bud-framework");
28
+ exports.Loader = void 0;
29
+ const Framework = __importStar(require("@roots/bud-framework"));
5
30
  const bud_support_1 = require("@roots/bud-support");
6
31
  const { isFunction } = bud_support_1.lodash;
7
32
  /**
@@ -9,7 +34,7 @@ const { isFunction } = bud_support_1.lodash;
9
34
  *
10
35
  * @public
11
36
  */
12
- class default_1 extends bud_framework_1.Loader.Abstract {
37
+ class Loader extends Framework.Loader.Abstract {
13
38
  /**
14
39
  * Class constructor
15
40
  *
@@ -22,9 +47,9 @@ class default_1 extends bud_framework_1.Loader.Abstract {
22
47
  this.src = this.normalizeInput(src);
23
48
  }
24
49
  /**
25
- * {@link @roots/bud-framework#Factory | Factory} producing the final loader path
50
+ * Factory producing the final loader path
26
51
  *
27
- * @param app - {@link @roots/bud-framework#Framework}
52
+ * @param app - {@link @roots/bud-Bud#Bud}
28
53
  * @returns final loader path
29
54
  *
30
55
  * @public
@@ -34,7 +59,7 @@ class default_1 extends bud_framework_1.Loader.Abstract {
34
59
  return this.src(app);
35
60
  }
36
61
  /**
37
- * Ensure that a userInput is assigned to the class as a {@link @roots/bud-framework#Factory | Factory}
62
+ * Ensure that a userInput is assigned to the class as a {@link @roots/bud-Bud#Factory | Factory}
38
63
  *
39
64
  * @param input - input value
40
65
  * @returns normalized value from user input
@@ -45,8 +70,7 @@ class default_1 extends bud_framework_1.Loader.Abstract {
45
70
  return isFunction(input) ? input : () => input;
46
71
  }
47
72
  }
48
- (0, tslib_1.__decorate)([
73
+ __decorate([
49
74
  bud_support_1.bind
50
- ], default_1.prototype, "make", null);
51
- exports.default = default_1;
52
- //# sourceMappingURL=index.js.map
75
+ ], Loader.prototype, "make", null);
76
+ exports.Loader = Loader;
@@ -1,88 +1,172 @@
1
1
  "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const bud_framework_1 = require("@roots/bud-framework");
9
+ exports.Rule = void 0;
5
10
  const bud_support_1 = require("@roots/bud-support");
6
- const { isFunction } = bud_support_1.lodash;
11
+ const Base_1 = require("../shared/Base");
7
12
  /**
8
13
  * Framework Rule
9
14
  *
10
15
  * @public
11
16
  */
12
- class Rule extends bud_framework_1.Rule.Abstract {
17
+ class Rule extends Base_1.Base {
13
18
  /**
14
19
  * Class constructor
15
20
  *
16
21
  * @public
17
22
  */
18
- constructor({ test, use = null, exclude = null, type = null, parser = null, generator = null, }) {
23
+ constructor(app, options) {
19
24
  super();
20
- this.test = isFunction(test) ? test : () => test;
21
- if (use) {
22
- this.use = isFunction(use) ? use : () => use;
23
- }
24
- if (exclude) {
25
- this.exclude = isFunction(exclude)
26
- ? exclude
27
- : () => exclude;
28
- }
29
- if (type) {
30
- this.type = isFunction(type) ? type : () => type;
31
- }
32
- if (parser) {
33
- this.parser = isFunction(parser) ? parser : () => parser;
34
- }
35
- if (generator) {
36
- this.generator = isFunction(generator)
37
- ? generator
38
- : () => generator;
39
- }
40
- }
41
- /**
42
- *
43
- * @param app - {@link @roots/bud-framework#Framework | Framework}
44
- * @returns
25
+ this.app = app;
26
+ if (!options)
27
+ return;
28
+ options.test && this.setTest(options.test);
29
+ options.use && this.setUse(options.use);
30
+ options.include && this.setInclude(options.include);
31
+ options.exclude && this.setExclude(options.exclude);
32
+ options.type && this.setType(options.type);
33
+ options.parser && this.setParser(options.parser);
34
+ options.generator && this.setGenerator(options.generator);
35
+ }
36
+ /**
37
+ * Test value
38
+ *
39
+ * @param app - Framework instance
45
40
  *
46
41
  * @public
47
42
  * @decorator `@bind`
48
43
  */
49
- getTest(app) {
50
- return this.test ? this.test(app) : null;
44
+ getTest() {
45
+ return this.test ? this.test(this.app) : null;
51
46
  }
47
+ /**
48
+ * Set test value
49
+ *
50
+ * @public
51
+ * @decorator `@bind`
52
+ */
52
53
  setTest(test) {
53
- this.test = isFunction(test) ? test : () => test;
54
+ this.test = this.normalizeInput(test);
55
+ return this;
54
56
  }
55
- getParser(app) {
56
- return this.parser ? this.parser(app) : null;
57
+ /**
58
+ * Get parser value
59
+ *
60
+ * @public
61
+ * @decorator `@bind`
62
+ */
63
+ getParser() {
64
+ return this.parser ? this.parser(this.app) : null;
57
65
  }
66
+ /**
67
+ * Set parser value
68
+ *
69
+ * @public
70
+ * @decorator `@bind`
71
+ */
58
72
  setParser(parser) {
59
- this.parser = isFunction(parser) ? parser : () => parser;
73
+ this.parser = this.normalizeInput(parser);
74
+ return this;
60
75
  }
61
- getUse(app) {
62
- return this.use ? this.use(app) : null;
76
+ /**
77
+ * Get use value
78
+ *
79
+ * @public
80
+ * @decorator `@bind`
81
+ */
82
+ getUse() {
83
+ return this.use ? this.use(this.app) : null;
63
84
  }
85
+ /**
86
+ * Set use value
87
+ *
88
+ * @public
89
+ * @decorator `@bind`
90
+ */
64
91
  setUse(use) {
65
- this.use = isFunction(use) ? use : () => use;
92
+ this.use = this.normalizeInput(use);
93
+ return this;
94
+ }
95
+ /**
96
+ * Get exclude value
97
+ *
98
+ * @public
99
+ * @decorator `@bind`
100
+ */
101
+ getInclude() {
102
+ return this.include ? this.include(this.app) : null;
103
+ }
104
+ /**
105
+ * Set exclude value
106
+ *
107
+ * @public
108
+ * @decorator `@bind`
109
+ */
110
+ setInclude(include) {
111
+ this.include = this.normalizeInput(include);
112
+ return this;
66
113
  }
67
- getExclude(app) {
68
- return this.exclude ? this.exclude(app) : null;
114
+ /**
115
+ * Get exclude value
116
+ *
117
+ * @public
118
+ * @decorator `@bind`
119
+ */
120
+ getExclude() {
121
+ return this.exclude ? this.exclude(this.app) : null;
69
122
  }
123
+ /**
124
+ * Set exclude value
125
+ *
126
+ * @public
127
+ * @decorator `@bind`
128
+ */
70
129
  setExclude(exclude) {
71
- this.exclude = isFunction(exclude) ? exclude : () => exclude;
130
+ this.exclude = this.normalizeInput(exclude);
131
+ return this;
72
132
  }
73
- getType(app) {
74
- return this.type ? this.type(app) : null;
133
+ /**
134
+ * Get type value
135
+ *
136
+ * @public
137
+ * @decorator `@bind`
138
+ */
139
+ getType() {
140
+ return this.type ? this.type(this.app) : null;
75
141
  }
142
+ /**
143
+ * Set type value
144
+ *
145
+ * @public
146
+ * @decorator `@bind`
147
+ */
76
148
  setType(type) {
77
- this.type = isFunction(type) ? type : () => type;
149
+ this.type = this.normalizeInput(type);
150
+ return this;
78
151
  }
79
- getGenerator(app) {
80
- return this.generator ? this.generator(app) : null;
152
+ /**
153
+ * Get generator value
154
+ *
155
+ * @public
156
+ * @decorator `@bind`
157
+ */
158
+ getGenerator() {
159
+ return this.generator ? this.generator(this.app) : null;
81
160
  }
161
+ /**
162
+ * Set generator value
163
+ *
164
+ * @public
165
+ * @decorator `@bind`
166
+ */
82
167
  setGenerator(generator) {
83
- this.generator = isFunction(generator)
84
- ? generator
85
- : () => generator;
168
+ this.generator = this.normalizeInput(generator);
169
+ return this;
86
170
  }
87
171
  /**
88
172
  * Produce final Base output
@@ -93,66 +177,80 @@ class Rule extends bud_framework_1.Rule.Abstract {
93
177
  * @public
94
178
  * @decorator `@bind`
95
179
  */
96
- make(app) {
180
+ make() {
97
181
  const output = {
98
- test: this.test(app),
182
+ test: this.test(this.app),
99
183
  };
100
- if (this.use) {
101
- output.use = this.use(app).map(item => item.make(app));
102
- }
103
- if (this.exclude) {
104
- output.exclude = this.exclude(app);
105
- }
106
- if (this.type) {
107
- output.type = this.type(app);
108
- }
109
- if (this.parser) {
110
- output.parser = this.parser(app);
111
- }
112
- if (this.generator) {
113
- output.generator = this.generator(app);
114
- }
184
+ this.use &&
185
+ Object.assign(output, {
186
+ use: this.use(this.app).map(item => item.make(this.app)),
187
+ });
188
+ this.include &&
189
+ Object.assign(output, {
190
+ include: this.include(this.app),
191
+ });
192
+ this.exclude &&
193
+ Object.assign(output, {
194
+ exclude: this.exclude(this.app),
195
+ });
196
+ this.type &&
197
+ Object.assign(output, {
198
+ type: this.type(this.app),
199
+ });
200
+ this.parser &&
201
+ Object.assign(output, {
202
+ parser: this.parser(this.app),
203
+ });
204
+ this.generator &&
205
+ Object.assign(output, {
206
+ generator: this.generator(this.app),
207
+ });
115
208
  return output;
116
209
  }
117
210
  }
118
- (0, tslib_1.__decorate)([
211
+ __decorate([
119
212
  bud_support_1.bind
120
213
  ], Rule.prototype, "getTest", null);
121
- (0, tslib_1.__decorate)([
214
+ __decorate([
122
215
  bud_support_1.bind
123
216
  ], Rule.prototype, "setTest", null);
124
- (0, tslib_1.__decorate)([
217
+ __decorate([
125
218
  bud_support_1.bind
126
219
  ], Rule.prototype, "getParser", null);
127
- (0, tslib_1.__decorate)([
220
+ __decorate([
128
221
  bud_support_1.bind
129
222
  ], Rule.prototype, "setParser", null);
130
- (0, tslib_1.__decorate)([
223
+ __decorate([
131
224
  bud_support_1.bind
132
225
  ], Rule.prototype, "getUse", null);
133
- (0, tslib_1.__decorate)([
226
+ __decorate([
134
227
  bud_support_1.bind
135
228
  ], Rule.prototype, "setUse", null);
136
- (0, tslib_1.__decorate)([
229
+ __decorate([
230
+ bud_support_1.bind
231
+ ], Rule.prototype, "getInclude", null);
232
+ __decorate([
233
+ bud_support_1.bind
234
+ ], Rule.prototype, "setInclude", null);
235
+ __decorate([
137
236
  bud_support_1.bind
138
237
  ], Rule.prototype, "getExclude", null);
139
- (0, tslib_1.__decorate)([
238
+ __decorate([
140
239
  bud_support_1.bind
141
240
  ], Rule.prototype, "setExclude", null);
142
- (0, tslib_1.__decorate)([
241
+ __decorate([
143
242
  bud_support_1.bind
144
243
  ], Rule.prototype, "getType", null);
145
- (0, tslib_1.__decorate)([
244
+ __decorate([
146
245
  bud_support_1.bind
147
246
  ], Rule.prototype, "setType", null);
148
- (0, tslib_1.__decorate)([
247
+ __decorate([
149
248
  bud_support_1.bind
150
249
  ], Rule.prototype, "getGenerator", null);
151
- (0, tslib_1.__decorate)([
250
+ __decorate([
152
251
  bud_support_1.bind
153
252
  ], Rule.prototype, "setGenerator", null);
154
- (0, tslib_1.__decorate)([
253
+ __decorate([
155
254
  bud_support_1.bind
156
255
  ], Rule.prototype, "make", null);
157
- exports.default = Rule;
158
- //# sourceMappingURL=index.js.map
256
+ exports.Rule = Rule;
package/lib/cjs/index.js CHANGED
@@ -1,9 +1,27 @@
1
1
  "use strict";
2
2
  // Copyright (c) Roots Foundation, LLC. All rights reserved.
3
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
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
7
+ }) : (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ o[k2] = m[k];
10
+ }));
11
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
12
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
13
+ }) : function(o, v) {
14
+ o["default"] = v;
15
+ });
16
+ var __importStar = (this && this.__importStar) || function (mod) {
17
+ if (mod && mod.__esModule) return mod;
18
+ var result = {};
19
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
20
+ __setModuleDefault(result, mod);
21
+ return result;
22
+ };
4
23
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.rules = exports.loaders = exports.items = exports.Rule = exports.Loader = exports.Item = exports.Build = void 0;
6
- const tslib_1 = require("tslib");
24
+ exports.rules = exports.loaders = exports.items = exports.Rule = exports.Item = exports.Loader = exports.Build = void 0;
7
25
  /**
8
26
  * Compiler configuration builder
9
27
  *
@@ -17,20 +35,19 @@ const tslib_1 = require("tslib");
17
35
  *
18
36
  * - 🌱 Easy - Low bundle size and fast build times
19
37
  *
20
- * @core @packageDocumentation @betaDocumentation
38
+ * @packageDocumentation
21
39
  */
22
- const Build_1 = require("./Build");
40
+ var Build_1 = require("./Build");
23
41
  Object.defineProperty(exports, "Build", { enumerable: true, get: function () { return Build_1.Build; } });
24
- const items = (0, tslib_1.__importStar)(require("./Build/items"));
42
+ var Loader_1 = require("./Loader");
43
+ Object.defineProperty(exports, "Loader", { enumerable: true, get: function () { return Loader_1.Loader; } });
44
+ var Item_1 = require("./Item");
45
+ Object.defineProperty(exports, "Item", { enumerable: true, get: function () { return Item_1.Item; } });
46
+ var Rule_1 = require("./Rule");
47
+ Object.defineProperty(exports, "Rule", { enumerable: true, get: function () { return Rule_1.Rule; } });
48
+ const items = __importStar(require("./Build/items"));
25
49
  exports.items = items;
26
- const loaders = (0, tslib_1.__importStar)(require("./Build/loaders"));
50
+ const loaders = __importStar(require("./Build/loaders"));
27
51
  exports.loaders = loaders;
28
- const rules = (0, tslib_1.__importStar)(require("./Build/rules"));
52
+ const rules = __importStar(require("./Build/rules"));
29
53
  exports.rules = rules;
30
- const Item_1 = (0, tslib_1.__importDefault)(require("./Item"));
31
- exports.Item = Item_1.default;
32
- const Loader_1 = (0, tslib_1.__importDefault)(require("./Loader"));
33
- exports.Loader = Loader_1.default;
34
- const Rule_1 = (0, tslib_1.__importDefault)(require("./Rule"));
35
- exports.Rule = Rule_1.default;
36
- //# sourceMappingURL=index.js.map
@@ -9,4 +9,3 @@ class Base {
9
9
  }
10
10
  }
11
11
  exports.Base = Base;
12
- //# sourceMappingURL=Base.js.map