@roots/bud-build 5.3.2 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/cjs/Build/config/builder.js +117 -0
- package/lib/cjs/Build/config/builder.unwrap.js +35 -0
- package/lib/cjs/Build/config/filenameFormat.js +17 -0
- package/lib/cjs/Build/config/index.js +24 -0
- package/lib/cjs/Build/index.js +157 -50
- package/lib/cjs/Build/items.js +101 -111
- package/lib/cjs/Build/loaders.js +55 -53
- package/lib/cjs/Build/rules.js +18 -25
- package/lib/cjs/Item/index.js +36 -24
- package/lib/cjs/Loader/index.js +10 -56
- package/lib/cjs/Rule/index.js +29 -43
- package/lib/cjs/index.js +1 -8
- package/lib/cjs/shared/Base.js +10 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/types/Build/config/builder.d.ts +15 -0
- package/types/Build/config/builder.d.ts.map +1 -0
- package/types/Build/config/builder.unwrap.d.ts +19 -0
- package/types/Build/config/builder.unwrap.d.ts.map +1 -0
- package/types/Build/config/filenameFormat.d.ts +13 -0
- package/types/Build/config/filenameFormat.d.ts.map +1 -0
- package/types/Build/config/index.d.ts +3 -0
- package/types/Build/config/index.d.ts.map +1 -0
- package/types/Build/index.d.ts +66 -15
- package/types/Build/index.d.ts.map +1 -1
- package/types/Build/items.d.ts +62 -71
- package/types/Build/items.d.ts.map +1 -1
- package/types/Build/loaders.d.ts +45 -54
- package/types/Build/loaders.d.ts.map +1 -1
- package/types/Build/rules.d.ts +13 -14
- package/types/Build/rules.d.ts.map +1 -1
- package/types/Item/index.d.ts +19 -11
- package/types/Item/index.d.ts.map +1 -1
- package/types/Loader/index.d.ts +10 -24
- package/types/Loader/index.d.ts.map +1 -1
- package/types/Rule/index.d.ts +25 -33
- package/types/Rule/index.d.ts.map +1 -1
- package/types/index.d.ts +1 -8
- package/types/index.d.ts.map +1 -1
- package/types/shared/Base.d.ts +5 -1
- package/types/shared/Base.d.ts.map +1 -1
- package/lib/cjs/Build/config.js +0 -265
- package/lib/cjs/Item/item.dependencies.js +0 -6
- package/lib/cjs/Item/item.interface.js +0 -7
- package/types/Build/config.d.ts +0 -10
- package/types/Build/config.d.ts.map +0 -1
- package/types/Item/item.dependencies.d.ts +0 -4
- package/types/Item/item.dependencies.d.ts.map +0 -1
- package/types/Item/item.interface.d.ts +0 -2
- package/types/Item/item.interface.d.ts.map +0 -1
package/lib/cjs/Loader/index.js
CHANGED
|
@@ -1,40 +1,13 @@
|
|
|
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
|
-
};
|
|
27
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
3
|
exports.Loader = void 0;
|
|
29
|
-
const
|
|
30
|
-
const bud_support_1 = require("@roots/bud-support");
|
|
31
|
-
const { isFunction } = bud_support_1.lodash;
|
|
4
|
+
const Base_1 = require("../shared/Base");
|
|
32
5
|
/**
|
|
33
6
|
* Framework Loader
|
|
34
7
|
*
|
|
35
8
|
* @public
|
|
36
9
|
*/
|
|
37
|
-
class Loader extends
|
|
10
|
+
class Loader extends Base_1.Base {
|
|
38
11
|
/**
|
|
39
12
|
* Class constructor
|
|
40
13
|
*
|
|
@@ -42,35 +15,16 @@ class Loader extends Framework.Loader.Abstract {
|
|
|
42
15
|
*
|
|
43
16
|
* @public
|
|
44
17
|
*/
|
|
45
|
-
constructor(src) {
|
|
46
|
-
super();
|
|
47
|
-
this.src =
|
|
18
|
+
constructor(_app, src) {
|
|
19
|
+
super(_app);
|
|
20
|
+
this.src = src;
|
|
48
21
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*
|
|
52
|
-
* @param app - {@link @roots/bud-Bud#Bud}
|
|
53
|
-
* @returns final loader path
|
|
54
|
-
*
|
|
55
|
-
* @public
|
|
56
|
-
* @decorator `@bind`
|
|
57
|
-
*/
|
|
58
|
-
make(app) {
|
|
59
|
-
return this.src(app);
|
|
22
|
+
getSrc() {
|
|
23
|
+
return this.unwrap(this.src);
|
|
60
24
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
* @param input - input value
|
|
65
|
-
* @returns normalized value from user input
|
|
66
|
-
*
|
|
67
|
-
* @public
|
|
68
|
-
*/
|
|
69
|
-
normalizeInput(input) {
|
|
70
|
-
return isFunction(input) ? input : () => input;
|
|
25
|
+
setSrc(src) {
|
|
26
|
+
this.src = this.wrap(src);
|
|
27
|
+
return this;
|
|
71
28
|
}
|
|
72
29
|
}
|
|
73
|
-
__decorate([
|
|
74
|
-
bud_support_1.bind
|
|
75
|
-
], Loader.prototype, "make", null);
|
|
76
30
|
exports.Loader = Loader;
|
package/lib/cjs/Rule/index.js
CHANGED
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.Rule = void 0;
|
|
10
10
|
const bud_support_1 = require("@roots/bud-support");
|
|
11
11
|
const Base_1 = require("../shared/Base");
|
|
12
|
+
const { isFunction, isString } = bud_support_1.lodash;
|
|
12
13
|
/**
|
|
13
14
|
* Framework Rule
|
|
14
15
|
*
|
|
@@ -20,9 +21,8 @@ class Rule extends Base_1.Base {
|
|
|
20
21
|
*
|
|
21
22
|
* @public
|
|
22
23
|
*/
|
|
23
|
-
constructor(
|
|
24
|
-
super();
|
|
25
|
-
this.app = app;
|
|
24
|
+
constructor(_app, options) {
|
|
25
|
+
super(_app);
|
|
26
26
|
if (!options)
|
|
27
27
|
return;
|
|
28
28
|
options.test && this.setTest(options.test);
|
|
@@ -42,7 +42,7 @@ class Rule extends Base_1.Base {
|
|
|
42
42
|
* @decorator `@bind`
|
|
43
43
|
*/
|
|
44
44
|
getTest() {
|
|
45
|
-
return this.
|
|
45
|
+
return this.unwrap(this.test);
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Set test value
|
|
@@ -51,7 +51,7 @@ class Rule extends Base_1.Base {
|
|
|
51
51
|
* @decorator `@bind`
|
|
52
52
|
*/
|
|
53
53
|
setTest(test) {
|
|
54
|
-
this.test = this.
|
|
54
|
+
this.test = this.wrap(test);
|
|
55
55
|
return this;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
@@ -61,7 +61,7 @@ class Rule extends Base_1.Base {
|
|
|
61
61
|
* @decorator `@bind`
|
|
62
62
|
*/
|
|
63
63
|
getParser() {
|
|
64
|
-
return this.
|
|
64
|
+
return this.unwrap(this.parser);
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Set parser value
|
|
@@ -70,7 +70,7 @@ class Rule extends Base_1.Base {
|
|
|
70
70
|
* @decorator `@bind`
|
|
71
71
|
*/
|
|
72
72
|
setParser(parser) {
|
|
73
|
-
this.parser = this.
|
|
73
|
+
this.parser = this.wrap(parser);
|
|
74
74
|
return this;
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
@@ -80,7 +80,7 @@ class Rule extends Base_1.Base {
|
|
|
80
80
|
* @decorator `@bind`
|
|
81
81
|
*/
|
|
82
82
|
getUse() {
|
|
83
|
-
return this.
|
|
83
|
+
return this.unwrap(this.use)?.filter(isString) ?? [];
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
86
|
* Set use value
|
|
@@ -88,8 +88,10 @@ class Rule extends Base_1.Base {
|
|
|
88
88
|
* @public
|
|
89
89
|
* @decorator `@bind`
|
|
90
90
|
*/
|
|
91
|
-
setUse(
|
|
92
|
-
this.use =
|
|
91
|
+
setUse(input) {
|
|
92
|
+
this.use =
|
|
93
|
+
(isFunction(input) ? input(this.getUse() ?? [], this.app) : input) ??
|
|
94
|
+
[];
|
|
93
95
|
return this;
|
|
94
96
|
}
|
|
95
97
|
/**
|
|
@@ -99,7 +101,7 @@ class Rule extends Base_1.Base {
|
|
|
99
101
|
* @decorator `@bind`
|
|
100
102
|
*/
|
|
101
103
|
getInclude() {
|
|
102
|
-
return this.
|
|
104
|
+
return this.unwrap(this.include);
|
|
103
105
|
}
|
|
104
106
|
/**
|
|
105
107
|
* Set exclude value
|
|
@@ -108,7 +110,7 @@ class Rule extends Base_1.Base {
|
|
|
108
110
|
* @decorator `@bind`
|
|
109
111
|
*/
|
|
110
112
|
setInclude(include) {
|
|
111
|
-
this.include = this.
|
|
113
|
+
this.include = this.wrap(include);
|
|
112
114
|
return this;
|
|
113
115
|
}
|
|
114
116
|
/**
|
|
@@ -118,7 +120,7 @@ class Rule extends Base_1.Base {
|
|
|
118
120
|
* @decorator `@bind`
|
|
119
121
|
*/
|
|
120
122
|
getExclude() {
|
|
121
|
-
return this.
|
|
123
|
+
return this.unwrap(this.exclude);
|
|
122
124
|
}
|
|
123
125
|
/**
|
|
124
126
|
* Set exclude value
|
|
@@ -127,7 +129,7 @@ class Rule extends Base_1.Base {
|
|
|
127
129
|
* @decorator `@bind`
|
|
128
130
|
*/
|
|
129
131
|
setExclude(exclude) {
|
|
130
|
-
this.exclude = this.
|
|
132
|
+
this.exclude = this.wrap(exclude);
|
|
131
133
|
return this;
|
|
132
134
|
}
|
|
133
135
|
/**
|
|
@@ -137,7 +139,7 @@ class Rule extends Base_1.Base {
|
|
|
137
139
|
* @decorator `@bind`
|
|
138
140
|
*/
|
|
139
141
|
getType() {
|
|
140
|
-
return this.
|
|
142
|
+
return this.unwrap(this.type);
|
|
141
143
|
}
|
|
142
144
|
/**
|
|
143
145
|
* Set type value
|
|
@@ -146,7 +148,7 @@ class Rule extends Base_1.Base {
|
|
|
146
148
|
* @decorator `@bind`
|
|
147
149
|
*/
|
|
148
150
|
setType(type) {
|
|
149
|
-
this.type = this.
|
|
151
|
+
this.type = this.wrap(type);
|
|
150
152
|
return this;
|
|
151
153
|
}
|
|
152
154
|
/**
|
|
@@ -156,7 +158,7 @@ class Rule extends Base_1.Base {
|
|
|
156
158
|
* @decorator `@bind`
|
|
157
159
|
*/
|
|
158
160
|
getGenerator() {
|
|
159
|
-
return this.
|
|
161
|
+
return this.unwrap(this.generator);
|
|
160
162
|
}
|
|
161
163
|
/**
|
|
162
164
|
* Set generator value
|
|
@@ -165,7 +167,7 @@ class Rule extends Base_1.Base {
|
|
|
165
167
|
* @decorator `@bind`
|
|
166
168
|
*/
|
|
167
169
|
setGenerator(generator) {
|
|
168
|
-
this.generator = this.
|
|
170
|
+
this.generator = this.wrap(generator);
|
|
169
171
|
return this;
|
|
170
172
|
}
|
|
171
173
|
/**
|
|
@@ -177,34 +179,18 @@ class Rule extends Base_1.Base {
|
|
|
177
179
|
* @public
|
|
178
180
|
* @decorator `@bind`
|
|
179
181
|
*/
|
|
180
|
-
|
|
181
|
-
const output = {
|
|
182
|
-
test: this.test(this.app),
|
|
183
|
-
};
|
|
182
|
+
toWebpack() {
|
|
183
|
+
const output = { test: this.getTest() };
|
|
184
184
|
this.use &&
|
|
185
185
|
Object.assign(output, {
|
|
186
|
-
use: this.
|
|
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),
|
|
186
|
+
use: this.getUse().map(item => this.app.build.items[item].toWebpack()),
|
|
203
187
|
});
|
|
188
|
+
this.include && Object.assign(output, { include: this.getInclude() });
|
|
189
|
+
this.exclude && Object.assign(output, { exclude: this.getExclude() });
|
|
190
|
+
this.type && Object.assign(output, { type: this.getType() });
|
|
191
|
+
this.parser && Object.assign(output, { parser: this.getParser() });
|
|
204
192
|
this.generator &&
|
|
205
|
-
Object.assign(output, {
|
|
206
|
-
generator: this.generator(this.app),
|
|
207
|
-
});
|
|
193
|
+
Object.assign(output, { generator: this.getGenerator() });
|
|
208
194
|
return output;
|
|
209
195
|
}
|
|
210
196
|
}
|
|
@@ -252,5 +238,5 @@ __decorate([
|
|
|
252
238
|
], Rule.prototype, "setGenerator", null);
|
|
253
239
|
__decorate([
|
|
254
240
|
bud_support_1.bind
|
|
255
|
-
], Rule.prototype, "
|
|
241
|
+
], Rule.prototype, "toWebpack", null);
|
|
256
242
|
exports.Rule = Rule;
|
package/lib/cjs/index.js
CHANGED
|
@@ -28,14 +28,7 @@ exports.rules = exports.loaders = exports.items = exports.Rule = exports.Item =
|
|
|
28
28
|
* @see https://roots.io/bud
|
|
29
29
|
* @see https://github.com/roots/bud
|
|
30
30
|
*
|
|
31
|
-
* @
|
|
32
|
-
* - 💁 Composable - Build exceptional applications with a modular, configurable build system
|
|
33
|
-
*
|
|
34
|
-
* - 💪 Modern - Modern framework written in TypeScript with an expressive API
|
|
35
|
-
*
|
|
36
|
-
* - 🌱 Easy - Low bundle size and fast build times
|
|
37
|
-
*
|
|
38
|
-
* @packageDocumentation
|
|
31
|
+
* @packageDocumentation
|
|
39
32
|
*/
|
|
40
33
|
var Build_1 = require("./Build");
|
|
41
34
|
Object.defineProperty(exports, "Build", { enumerable: true, get: function () { return Build_1.Build; } });
|
package/lib/cjs/shared/Base.js
CHANGED
|
@@ -4,8 +4,17 @@ exports.Base = void 0;
|
|
|
4
4
|
const bud_support_1 = require("@roots/bud-support");
|
|
5
5
|
const { isFunction } = bud_support_1.lodash;
|
|
6
6
|
class Base {
|
|
7
|
-
|
|
7
|
+
constructor(_app) {
|
|
8
|
+
this._app = _app;
|
|
9
|
+
}
|
|
10
|
+
get app() {
|
|
11
|
+
return this._app();
|
|
12
|
+
}
|
|
13
|
+
wrap(input) {
|
|
8
14
|
return isFunction(input) ? input : () => input;
|
|
9
15
|
}
|
|
16
|
+
unwrap(input, ...options) {
|
|
17
|
+
return isFunction(input) ? input(this.app, ...options) : input;
|
|
18
|
+
}
|
|
10
19
|
}
|
|
11
20
|
exports.Base = Base;
|