@rslib/core 0.0.4 → 0.0.5
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/compiled/picocolors/index.d.ts +22 -0
- package/compiled/picocolors/index.js +22 -2
- package/compiled/picocolors/license +1 -1
- package/compiled/picocolors/package.json +1 -1
- package/dist/index.js +439 -573
- package/dist-types/config.d.ts +3 -1
- package/dist-types/constant.d.ts +1 -0
- package/dist-types/types/config/index.d.ts +10 -4
- package/dist-types/utils/helper.d.ts +3 -4
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -8,195 +8,136 @@ import * as __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js__ from "../c
|
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__ from "../compiled/commander/index.js";
|
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core__ from "@rsbuild/core";
|
|
10
10
|
import * as __WEBPACK_EXTERNAL_MODULE__compiled_fast_glob_index_js__ from "../compiled/fast-glob/index.js";
|
|
11
|
-
var __webpack_modules__ =
|
|
12
|
-
"rsbuild-plugin-dts":
|
|
13
|
-
module.exports = import("rsbuild-plugin-dts");
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
/************************************************************************/
|
|
19
|
-
// The module cache
|
|
11
|
+
var __webpack_modules__ = {
|
|
12
|
+
"rsbuild-plugin-dts": function(module) {
|
|
13
|
+
module.exports = import("rsbuild-plugin-dts");
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
/************************************************************************/ // The module cache
|
|
20
17
|
var __webpack_module_cache__ = {};
|
|
21
|
-
|
|
22
18
|
// The require function
|
|
23
19
|
function __webpack_require__(moduleId) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
exports
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// Return the exports of the module
|
|
38
|
-
return module.exports;
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/************************************************************************/
|
|
43
|
-
|
|
44
|
-
;// CONCATENATED MODULE: external "process"
|
|
45
|
-
|
|
20
|
+
// Check if module is in cache
|
|
21
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
22
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
23
|
+
// Create a new module (and put it into the cache)
|
|
24
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
25
|
+
exports: {}
|
|
26
|
+
};
|
|
27
|
+
// Execute the module function
|
|
28
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
29
|
+
// Return the exports of the module
|
|
30
|
+
return module.exports;
|
|
31
|
+
} /************************************************************************/
|
|
46
32
|
var external_process_namespaceObject = __WEBPACK_EXTERNAL_MODULE_process__;
|
|
47
|
-
|
|
48
|
-
;// CONCATENATED MODULE: external "os"
|
|
49
|
-
|
|
50
33
|
var external_os_namespaceObject = __WEBPACK_EXTERNAL_MODULE_os__;
|
|
51
|
-
|
|
52
|
-
;// CONCATENATED MODULE: external "tty"
|
|
53
|
-
|
|
54
34
|
var external_tty_namespaceObject = __WEBPACK_EXTERNAL_MODULE_tty__;
|
|
55
|
-
|
|
56
|
-
;// CONCATENATED MODULE: ../../node_modules/.pnpm/rslog@1.2.2/node_modules/rslog/dist/index.mjs
|
|
57
35
|
// node_modules/.pnpm/supports-color@9.4.0/node_modules/supports-color/index.js
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
36
|
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : external_process_namespaceObject["default"].argv) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
37
|
+
const prefix = flag.startsWith("-") ? "" : 1 === flag.length ? "-" : "--";
|
|
38
|
+
const position = argv.indexOf(prefix + flag);
|
|
39
|
+
const terminatorPosition = argv.indexOf("--");
|
|
40
|
+
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
66
41
|
}
|
|
67
42
|
var { env } = external_process_namespaceObject["default"];
|
|
68
43
|
var flagForceColor;
|
|
69
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never"))
|
|
70
|
-
|
|
71
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
72
|
-
flagForceColor = 1;
|
|
73
|
-
}
|
|
44
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
|
|
45
|
+
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
|
|
74
46
|
function envForceColor() {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
47
|
+
if ("FORCE_COLOR" in env) {
|
|
48
|
+
if ("true" === env.FORCE_COLOR) return 1;
|
|
49
|
+
if ("false" === env.FORCE_COLOR) return 0;
|
|
50
|
+
return 0 === env.FORCE_COLOR.length ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
78
51
|
}
|
|
79
|
-
if (env.FORCE_COLOR === "false") {
|
|
80
|
-
return 0;
|
|
81
|
-
}
|
|
82
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
83
|
-
}
|
|
84
52
|
}
|
|
85
53
|
function translateLevel(level) {
|
|
86
|
-
|
|
87
|
-
return
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
has16m: level >= 3
|
|
94
|
-
};
|
|
54
|
+
if (0 === level) return false;
|
|
55
|
+
return {
|
|
56
|
+
level,
|
|
57
|
+
hasBasic: true,
|
|
58
|
+
has256: level >= 2,
|
|
59
|
+
has16m: level >= 3
|
|
60
|
+
};
|
|
95
61
|
}
|
|
96
62
|
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
if (sniffFlags) {
|
|
106
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
107
|
-
return 3;
|
|
63
|
+
const noFlagForceColor = envForceColor();
|
|
64
|
+
if (void 0 !== noFlagForceColor) flagForceColor = noFlagForceColor;
|
|
65
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
66
|
+
if (0 === forceColor) return 0;
|
|
67
|
+
if (sniffFlags) {
|
|
68
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
69
|
+
if (hasFlag("color=256")) return 2;
|
|
108
70
|
}
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return 0;
|
|
118
|
-
}
|
|
119
|
-
const min = forceColor || 0;
|
|
120
|
-
if (env.TERM === "dumb") {
|
|
121
|
-
return min;
|
|
122
|
-
}
|
|
123
|
-
if (external_process_namespaceObject["default"].platform === "win32") {
|
|
124
|
-
const osRelease = external_os_namespaceObject["default"].release().split(".");
|
|
125
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
126
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
71
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) return 1;
|
|
72
|
+
if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
|
|
73
|
+
const min = forceColor || 0;
|
|
74
|
+
if ("dumb" === env.TERM) return min;
|
|
75
|
+
if ("win32" === external_process_namespaceObject["default"].platform) {
|
|
76
|
+
const osRelease = external_os_namespaceObject["default"].release().split(".");
|
|
77
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
78
|
+
return 1;
|
|
127
79
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
80
|
+
if ("CI" in env) {
|
|
81
|
+
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) return 3;
|
|
82
|
+
if ([
|
|
83
|
+
"TRAVIS",
|
|
84
|
+
"CIRCLECI",
|
|
85
|
+
"APPVEYOR",
|
|
86
|
+
"GITLAB_CI",
|
|
87
|
+
"BUILDKITE",
|
|
88
|
+
"DRONE"
|
|
89
|
+
].some((sign)=>sign in env) || "codeship" === env.CI_NAME) return 1;
|
|
90
|
+
return min;
|
|
133
91
|
}
|
|
134
|
-
if (
|
|
135
|
-
|
|
92
|
+
if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
93
|
+
if ("truecolor" === env.COLORTERM) return 3;
|
|
94
|
+
if ("xterm-kitty" === env.TERM) return 3;
|
|
95
|
+
if ("TERM_PROGRAM" in env) {
|
|
96
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
97
|
+
switch(env.TERM_PROGRAM){
|
|
98
|
+
case "iTerm.app":
|
|
99
|
+
return version >= 3 ? 3 : 2;
|
|
100
|
+
case "Apple_Terminal":
|
|
101
|
+
return 2;
|
|
102
|
+
}
|
|
136
103
|
}
|
|
104
|
+
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
105
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
106
|
+
if ("COLORTERM" in env) return 1;
|
|
137
107
|
return min;
|
|
138
|
-
}
|
|
139
|
-
if ("TEAMCITY_VERSION" in env) {
|
|
140
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
141
|
-
}
|
|
142
|
-
if (env.COLORTERM === "truecolor") {
|
|
143
|
-
return 3;
|
|
144
|
-
}
|
|
145
|
-
if (env.TERM === "xterm-kitty") {
|
|
146
|
-
return 3;
|
|
147
|
-
}
|
|
148
|
-
if ("TERM_PROGRAM" in env) {
|
|
149
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
150
|
-
switch (env.TERM_PROGRAM) {
|
|
151
|
-
case "iTerm.app": {
|
|
152
|
-
return version >= 3 ? 3 : 2;
|
|
153
|
-
}
|
|
154
|
-
case "Apple_Terminal": {
|
|
155
|
-
return 2;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
160
|
-
return 2;
|
|
161
|
-
}
|
|
162
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
163
|
-
return 1;
|
|
164
|
-
}
|
|
165
|
-
if ("COLORTERM" in env) {
|
|
166
|
-
return 1;
|
|
167
|
-
}
|
|
168
|
-
return min;
|
|
169
108
|
}
|
|
170
109
|
function createSupportsColor(stream, options = {}) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
110
|
+
const level = _supportsColor(stream, {
|
|
111
|
+
streamIsTTY: stream && stream.isTTY,
|
|
112
|
+
...options
|
|
113
|
+
});
|
|
114
|
+
return translateLevel(level);
|
|
176
115
|
}
|
|
177
116
|
var supportsColor = {
|
|
178
|
-
|
|
179
|
-
|
|
117
|
+
stdout: createSupportsColor({
|
|
118
|
+
isTTY: external_tty_namespaceObject["default"].isatty(1)
|
|
119
|
+
}),
|
|
120
|
+
stderr: createSupportsColor({
|
|
121
|
+
isTTY: external_tty_namespaceObject["default"].isatty(2)
|
|
122
|
+
})
|
|
180
123
|
};
|
|
181
124
|
var supports_color_default = supportsColor;
|
|
182
|
-
|
|
183
125
|
// src/utils.ts
|
|
184
126
|
var colorLevel = supports_color_default.stdout ? supports_color_default.stdout.level : 0;
|
|
185
127
|
var errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/;
|
|
186
|
-
var anonymousErrorStackRegExp =
|
|
187
|
-
var isErrorStackMessage = (message)
|
|
188
|
-
|
|
128
|
+
var anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/;
|
|
129
|
+
var isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
|
|
189
130
|
// src/color.ts
|
|
190
|
-
var formatter = (open, close, replace = open)
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
} : String;
|
|
195
|
-
var replaceClose = (string, close, replace, index)
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
131
|
+
var formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
|
|
132
|
+
let string = "" + input;
|
|
133
|
+
let index = string.indexOf(close, open.length);
|
|
134
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
135
|
+
} : String;
|
|
136
|
+
var replaceClose = (string, close, replace, index)=>{
|
|
137
|
+
let start = string.substring(0, index) + replace;
|
|
138
|
+
let end = string.substring(index + close.length);
|
|
139
|
+
let nextIndex = end.indexOf(close);
|
|
140
|
+
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
|
|
200
141
|
};
|
|
201
142
|
var bold = formatter("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m");
|
|
202
143
|
var red = formatter("\x1B[31m", "\x1B[39m");
|
|
@@ -205,171 +146,143 @@ var yellow = formatter("\x1B[33m", "\x1B[39m");
|
|
|
205
146
|
var magenta = formatter("\x1B[35m", "\x1B[39m");
|
|
206
147
|
var cyan = formatter("\x1B[36m", "\x1B[39m");
|
|
207
148
|
var gray = formatter("\x1B[90m", "\x1B[39m");
|
|
208
|
-
|
|
209
149
|
// src/gradient.ts
|
|
210
|
-
var startColor = [
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
150
|
+
var startColor = [
|
|
151
|
+
189,
|
|
152
|
+
255,
|
|
153
|
+
243
|
|
154
|
+
];
|
|
155
|
+
var endColor = [
|
|
156
|
+
74,
|
|
157
|
+
194,
|
|
158
|
+
154
|
|
159
|
+
];
|
|
160
|
+
var isWord = (char)=>!/[\s\n]/.test(char);
|
|
161
|
+
var gradient = (message)=>{
|
|
162
|
+
if (colorLevel < 3) return 2 === colorLevel ? bold(cyan(message)) : message;
|
|
163
|
+
let chars = [
|
|
164
|
+
...message
|
|
165
|
+
];
|
|
166
|
+
let steps = chars.filter(isWord).length;
|
|
167
|
+
let r = startColor[0];
|
|
168
|
+
let g = startColor[1];
|
|
169
|
+
let b = startColor[2];
|
|
170
|
+
let rStep = (endColor[0] - r) / steps;
|
|
171
|
+
let gStep = (endColor[1] - g) / steps;
|
|
172
|
+
let bStep = (endColor[2] - b) / steps;
|
|
173
|
+
let output = "";
|
|
174
|
+
for (let char of chars){
|
|
175
|
+
if (isWord(char)) {
|
|
176
|
+
r += rStep;
|
|
177
|
+
g += gStep;
|
|
178
|
+
b += bStep;
|
|
179
|
+
}
|
|
180
|
+
output += `\x1B[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1B[39m`;
|
|
231
181
|
}
|
|
232
|
-
|
|
233
|
-
b
|
|
234
|
-
)}m${char}\x1B[39m`;
|
|
235
|
-
}
|
|
236
|
-
return bold(output);
|
|
182
|
+
return bold(output);
|
|
237
183
|
};
|
|
238
|
-
|
|
239
184
|
// src/constants.ts
|
|
240
185
|
var LOG_LEVEL = {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
186
|
+
error: 0,
|
|
187
|
+
warn: 1,
|
|
188
|
+
info: 2,
|
|
189
|
+
log: 3,
|
|
190
|
+
verbose: 4
|
|
246
191
|
};
|
|
247
192
|
var LOG_TYPES = {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
193
|
+
// Level error
|
|
194
|
+
error: {
|
|
195
|
+
label: "error",
|
|
196
|
+
level: "error",
|
|
197
|
+
color: red
|
|
198
|
+
},
|
|
199
|
+
// Level warn
|
|
200
|
+
warn: {
|
|
201
|
+
label: "warn",
|
|
202
|
+
level: "warn",
|
|
203
|
+
color: yellow
|
|
204
|
+
},
|
|
205
|
+
// Level info
|
|
206
|
+
info: {
|
|
207
|
+
label: "info",
|
|
208
|
+
level: "info",
|
|
209
|
+
color: cyan
|
|
210
|
+
},
|
|
211
|
+
start: {
|
|
212
|
+
label: "start",
|
|
213
|
+
level: "info",
|
|
214
|
+
color: cyan
|
|
215
|
+
},
|
|
216
|
+
ready: {
|
|
217
|
+
label: "ready",
|
|
218
|
+
level: "info",
|
|
219
|
+
color: green
|
|
220
|
+
},
|
|
221
|
+
success: {
|
|
222
|
+
label: "success",
|
|
223
|
+
level: "info",
|
|
224
|
+
color: green
|
|
225
|
+
},
|
|
226
|
+
// Level log
|
|
227
|
+
log: {
|
|
228
|
+
level: "log"
|
|
229
|
+
},
|
|
230
|
+
// Level debug
|
|
231
|
+
debug: {
|
|
232
|
+
label: "debug",
|
|
233
|
+
level: "verbose",
|
|
234
|
+
color: magenta
|
|
235
|
+
}
|
|
291
236
|
};
|
|
292
|
-
|
|
293
237
|
// src/createLogger.ts
|
|
294
|
-
var createLogger = (options = {})
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
let text = "";
|
|
306
|
-
if ("label" in logType) {
|
|
307
|
-
label = (logType.label || "").padEnd(7);
|
|
308
|
-
label = bold(logType.color ? logType.color(label) : label);
|
|
309
|
-
}
|
|
310
|
-
if (message instanceof Error) {
|
|
311
|
-
if (message.stack) {
|
|
312
|
-
let [name, ...rest] = message.stack.split("\n");
|
|
313
|
-
if (name.startsWith("Error: ")) {
|
|
314
|
-
name = name.slice(7);
|
|
238
|
+
var createLogger = (options = {})=>{
|
|
239
|
+
let maxLevel = options.level || "log";
|
|
240
|
+
let log = (type, message, ...args)=>{
|
|
241
|
+
if (LOG_LEVEL[LOG_TYPES[type].level] > LOG_LEVEL[maxLevel]) return;
|
|
242
|
+
if (null == message) return console.log();
|
|
243
|
+
let logType = LOG_TYPES[type];
|
|
244
|
+
let label = "";
|
|
245
|
+
let text = "";
|
|
246
|
+
if ("label" in logType) {
|
|
247
|
+
label = (logType.label || "").padEnd(7);
|
|
248
|
+
label = bold(logType.color ? logType.color(label) : label);
|
|
315
249
|
}
|
|
316
|
-
|
|
250
|
+
if (message instanceof Error) {
|
|
251
|
+
if (message.stack) {
|
|
252
|
+
let [name, ...rest] = message.stack.split("\n");
|
|
253
|
+
if (name.startsWith("Error: ")) name = name.slice(7);
|
|
254
|
+
text = `${name}
|
|
317
255
|
${gray(rest.join("\n"))}`;
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
logger2.override = (customLogger) => {
|
|
342
|
-
Object.assign(logger2, customLogger);
|
|
343
|
-
};
|
|
344
|
-
return logger2;
|
|
256
|
+
} else text = message.message;
|
|
257
|
+
} else if ("error" === logType.level && "string" == typeof message) {
|
|
258
|
+
let lines = message.split("\n");
|
|
259
|
+
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join("\n");
|
|
260
|
+
} else text = `${message}`;
|
|
261
|
+
console.log(label.length ? `${label} ${text}` : text, ...args);
|
|
262
|
+
};
|
|
263
|
+
let logger2 = {
|
|
264
|
+
greet: (message)=>log("log", gradient(message))
|
|
265
|
+
};
|
|
266
|
+
Object.keys(LOG_TYPES).forEach((key)=>{
|
|
267
|
+
logger2[key] = (...args)=>log(key, ...args);
|
|
268
|
+
});
|
|
269
|
+
Object.defineProperty(logger2, "level", {
|
|
270
|
+
get: ()=>maxLevel,
|
|
271
|
+
set (val) {
|
|
272
|
+
maxLevel = val;
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
logger2.override = (customLogger)=>{
|
|
276
|
+
Object.assign(logger2, customLogger);
|
|
277
|
+
};
|
|
278
|
+
return logger2;
|
|
345
279
|
};
|
|
346
|
-
|
|
347
280
|
// src/index.ts
|
|
348
281
|
var dist_logger = createLogger();
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
;// CONCATENATED MODULE: external "node:fs"
|
|
352
|
-
|
|
353
282
|
var external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_MODULE_node_fs__;
|
|
354
|
-
|
|
355
|
-
;// CONCATENATED MODULE: external "node:fs/promises"
|
|
356
|
-
|
|
357
283
|
var promises_namespaceObject = __WEBPACK_EXTERNAL_MODULE_node_fs_promises__;
|
|
358
|
-
|
|
359
|
-
;// CONCATENATED MODULE: external "node:path"
|
|
360
|
-
|
|
361
284
|
var external_node_path_namespaceObject = __WEBPACK_EXTERNAL_MODULE_node_path__;
|
|
362
|
-
|
|
363
|
-
;// CONCATENATED MODULE: external "../compiled/picocolors/index.js"
|
|
364
|
-
|
|
365
285
|
var index_js_namespaceObject = __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js__;
|
|
366
|
-
|
|
367
|
-
;// CONCATENATED MODULE: ./src/utils/helper.ts
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
286
|
/**
|
|
374
287
|
* Node.js built-in modules.
|
|
375
288
|
* Copied from https://github.com/webpack/webpack/blob/dd44b206a9c50f4b4cb4d134e1a0bd0387b159a3/lib/node/NodeTargetPlugin.js#L12-L72
|
|
@@ -434,9 +347,7 @@ var index_js_namespaceObject = __WEBPACK_EXTERNAL_MODULE__compiled_picocolors_in
|
|
|
434
347
|
'pnpapi'
|
|
435
348
|
];
|
|
436
349
|
async function calcLongestCommonPath(absPaths) {
|
|
437
|
-
if (absPaths.length
|
|
438
|
-
return null;
|
|
439
|
-
}
|
|
350
|
+
if (0 === absPaths.length) return null;
|
|
440
351
|
// we support two cases
|
|
441
352
|
// 1. /packages-a/src/index.ts
|
|
442
353
|
// 2. D:/packages-a/src/index.ts
|
|
@@ -447,16 +358,12 @@ async function calcLongestCommonPath(absPaths) {
|
|
|
447
358
|
const currentPath = splitPaths[i];
|
|
448
359
|
const minLength = Math.min(lcaFragments.length, currentPath.length);
|
|
449
360
|
let j = 0;
|
|
450
|
-
while(j < minLength && lcaFragments[j] === currentPath[j])
|
|
451
|
-
j++;
|
|
452
|
-
}
|
|
361
|
+
while(j < minLength && lcaFragments[j] === currentPath[j])j++;
|
|
453
362
|
lcaFragments = lcaFragments.slice(0, j);
|
|
454
363
|
}
|
|
455
364
|
let lca = lcaFragments.length > 0 ? lcaFragments.join(sep) : sep;
|
|
456
365
|
const stats = await promises_namespaceObject["default"].stat(lca);
|
|
457
|
-
if (stats?.isFile())
|
|
458
|
-
lca = external_node_path_namespaceObject["default"].dirname(lca);
|
|
459
|
-
}
|
|
366
|
+
if (stats?.isFile()) lca = external_node_path_namespaceObject["default"].dirname(lca);
|
|
460
367
|
return lca;
|
|
461
368
|
}
|
|
462
369
|
const readPackageJson = (rootPath)=>{
|
|
@@ -472,94 +379,34 @@ const readPackageJson = (rootPath)=>{
|
|
|
472
379
|
return;
|
|
473
380
|
}
|
|
474
381
|
};
|
|
475
|
-
const isObject = (obj)=>Object.prototype.toString.call(obj)
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
for(const property in obj){
|
|
483
|
-
if (keys.includes(property)) {
|
|
484
|
-
continue;
|
|
485
|
-
}
|
|
486
|
-
const value = obj[property];
|
|
487
|
-
if (value && typeof value === 'object') {
|
|
488
|
-
clone[property] = omitDeep(value, keys);
|
|
489
|
-
} else {
|
|
490
|
-
clone[property] = value;
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
return clone;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
;// CONCATENATED MODULE: ./src/utils/logger.ts
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
// setup the logger level
|
|
501
|
-
if (process.env.DEBUG) {
|
|
502
|
-
dist_logger.level = 'verbose';
|
|
503
|
-
}
|
|
504
|
-
const isDebug = ()=>{
|
|
505
|
-
if (!process.env.DEBUG) {
|
|
506
|
-
return false;
|
|
507
|
-
}
|
|
508
|
-
logger.level = 'verbose';
|
|
509
|
-
// support `process.env.DEBUG` in e2e
|
|
510
|
-
const values = process.env.DEBUG.toLocaleLowerCase().split(',');
|
|
511
|
-
return [
|
|
512
|
-
'rslib',
|
|
513
|
-
'rsbuild',
|
|
514
|
-
'builder',
|
|
515
|
-
'*'
|
|
516
|
-
].some((key)=>values.includes(key));
|
|
517
|
-
};
|
|
518
|
-
function getTime() {
|
|
519
|
-
const now = new Date();
|
|
520
|
-
const hours = String(now.getHours()).padStart(2, '0');
|
|
521
|
-
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
522
|
-
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
523
|
-
return `${hours}:${minutes}:${seconds}`;
|
|
382
|
+
const isObject = (obj)=>'[object Object]' === Object.prototype.toString.call(obj);
|
|
383
|
+
const isEmptyObject = (obj)=>0 === Object.keys(obj).length;
|
|
384
|
+
function pick(obj, keys) {
|
|
385
|
+
return keys.reduce((ret, key)=>{
|
|
386
|
+
if (void 0 !== obj[key]) ret[key] = obj[key];
|
|
387
|
+
return ret;
|
|
388
|
+
}, {});
|
|
524
389
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
;// CONCATENATED MODULE: ./src/cli/prepare.ts
|
|
535
|
-
|
|
536
|
-
function initNodeEnv() {
|
|
537
|
-
if (false) {}
|
|
390
|
+
function omit(obj, keys) {
|
|
391
|
+
return Object.keys(obj).reduce((ret, key)=>{
|
|
392
|
+
if (!keys.includes(key)) ret[key] = obj[key];
|
|
393
|
+
return ret;
|
|
394
|
+
}, {});
|
|
538
395
|
}
|
|
396
|
+
// setup the logger level
|
|
397
|
+
if (process.env.DEBUG) dist_logger.level = 'verbose';
|
|
398
|
+
function initNodeEnv() {}
|
|
539
399
|
function prepareCli() {
|
|
540
400
|
initNodeEnv();
|
|
541
401
|
// Print a blank line to keep the greet log nice.
|
|
542
402
|
// Some package managers automatically output a blank line, some do not.
|
|
543
403
|
const { npm_execpath } = process.env;
|
|
544
|
-
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun'))
|
|
545
|
-
|
|
546
|
-
}
|
|
547
|
-
dist_logger.greet(` ${`Rslib v${"0.0.4"}`}\n`);
|
|
404
|
+
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
|
|
405
|
+
dist_logger.greet(` Rslib v0.0.5\n`);
|
|
548
406
|
}
|
|
549
|
-
|
|
550
|
-
;// CONCATENATED MODULE: external "../compiled/commander/index.js"
|
|
551
|
-
|
|
552
407
|
var commander_index_js_namespaceObject = __WEBPACK_EXTERNAL_MODULE__compiled_commander_index_js__;
|
|
553
|
-
|
|
554
|
-
;// CONCATENATED MODULE: external "@rsbuild/core"
|
|
555
|
-
|
|
556
408
|
var core_namespaceObject = __WEBPACK_EXTERNAL_MODULE__rsbuild_core__;
|
|
557
|
-
|
|
558
|
-
;// CONCATENATED MODULE: external "../compiled/fast-glob/index.js"
|
|
559
|
-
|
|
560
409
|
var fast_glob_index_js_namespaceObject = __WEBPACK_EXTERNAL_MODULE__compiled_fast_glob_index_js__;
|
|
561
|
-
|
|
562
|
-
;// CONCATENATED MODULE: ./src/constant.ts
|
|
563
410
|
const DEFAULT_CONFIG_NAME = 'rslib.config';
|
|
564
411
|
const DEFAULT_EXTENSIONS = [
|
|
565
412
|
'.js',
|
|
@@ -569,19 +416,15 @@ const DEFAULT_EXTENSIONS = [
|
|
|
569
416
|
'.cjs',
|
|
570
417
|
'.cts'
|
|
571
418
|
];
|
|
572
|
-
|
|
573
|
-
;// CONCATENATED MODULE: ./src/utils/extension.ts
|
|
574
|
-
|
|
419
|
+
const SWC_HELPERS = '@swc/helpers';
|
|
575
420
|
const getDefaultExtension = (options)=>{
|
|
576
421
|
const { format, pkgJson, autoExtension } = options;
|
|
577
422
|
let jsExtension = '.js';
|
|
578
423
|
let dtsExtension = '.d.ts';
|
|
579
|
-
if (!autoExtension) {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
};
|
|
584
|
-
}
|
|
424
|
+
if (!autoExtension) return {
|
|
425
|
+
jsExtension,
|
|
426
|
+
dtsExtension
|
|
427
|
+
};
|
|
585
428
|
if (!pkgJson) {
|
|
586
429
|
dist_logger.warn('autoExtension configuration will not be applied due to read package.json failed');
|
|
587
430
|
return {
|
|
@@ -589,12 +432,12 @@ const getDefaultExtension = (options)=>{
|
|
|
589
432
|
dtsExtension
|
|
590
433
|
};
|
|
591
434
|
}
|
|
592
|
-
const isModule = pkgJson.type
|
|
593
|
-
if (isModule &&
|
|
435
|
+
const isModule = 'module' === pkgJson.type;
|
|
436
|
+
if (isModule && 'cjs' === format) {
|
|
594
437
|
jsExtension = '.cjs';
|
|
595
438
|
dtsExtension = '.d.cts';
|
|
596
439
|
}
|
|
597
|
-
if (!isModule &&
|
|
440
|
+
if (!isModule && 'esm' === format) {
|
|
598
441
|
jsExtension = '.mjs';
|
|
599
442
|
dtsExtension = '.d.mts';
|
|
600
443
|
}
|
|
@@ -604,8 +447,6 @@ const getDefaultExtension = (options)=>{
|
|
|
604
447
|
isModule
|
|
605
448
|
};
|
|
606
449
|
};
|
|
607
|
-
|
|
608
|
-
;// CONCATENATED MODULE: ./src/utils/syntax.ts
|
|
609
450
|
/**
|
|
610
451
|
* The esX to browserslist mapping is transformed from esbuild:
|
|
611
452
|
* https://github.com/evanw/esbuild/blob/main/internal/compat/js_table.go
|
|
@@ -724,83 +565,56 @@ const getDefaultExtension = (options)=>{
|
|
|
724
565
|
}
|
|
725
566
|
};
|
|
726
567
|
const transformSyntaxToBrowserslist = (syntax)=>{
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
if (Array.isArray(version)) {
|
|
732
|
-
return version;
|
|
733
|
-
}
|
|
568
|
+
const handleSyntaxItem = (syntaxItem)=>{
|
|
569
|
+
if ('string' == typeof syntaxItem && syntaxItem.toLowerCase().startsWith('es')) {
|
|
570
|
+
if (syntaxItem.toLowerCase() in ESX_TO_BROWSERSLIST) return Object.entries(ESX_TO_BROWSERSLIST[syntaxItem]).flatMap(([engine, version])=>{
|
|
571
|
+
if (Array.isArray(version)) return version;
|
|
734
572
|
return `${engine} >= ${version}`;
|
|
735
573
|
});
|
|
574
|
+
throw new Error(`Unsupported ES version: ${syntaxItem}`);
|
|
736
575
|
}
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
throw new Error(`Unsupported syntax: ${syntax}`);
|
|
576
|
+
return [
|
|
577
|
+
syntaxItem
|
|
578
|
+
];
|
|
579
|
+
};
|
|
580
|
+
if (Array.isArray(syntax)) return syntax.flatMap(handleSyntaxItem);
|
|
581
|
+
return handleSyntaxItem(syntax);
|
|
744
582
|
};
|
|
745
|
-
|
|
746
|
-
;// CONCATENATED MODULE: ./src/config.ts
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
583
|
/**
|
|
757
584
|
* This function helps you to autocomplete configuration types.
|
|
758
585
|
* It accepts a Rslib config object, or a function that returns a config.
|
|
759
586
|
*/ function defineConfig(config) {
|
|
760
587
|
return config;
|
|
761
588
|
}
|
|
762
|
-
const findConfig = (basePath)=>
|
|
763
|
-
return DEFAULT_EXTENSIONS.map((ext)=>basePath + ext).find(external_node_fs_namespaceObject["default"].existsSync);
|
|
764
|
-
};
|
|
589
|
+
const findConfig = (basePath)=>DEFAULT_EXTENSIONS.map((ext)=>basePath + ext).find(external_node_fs_namespaceObject["default"].existsSync);
|
|
765
590
|
const resolveConfigPath = (root, customConfig)=>{
|
|
766
591
|
if (customConfig) {
|
|
767
|
-
const customConfigPath = (0,external_node_path_namespaceObject.isAbsolute)(customConfig) ? customConfig : (0,external_node_path_namespaceObject.join)(root, customConfig);
|
|
768
|
-
if (external_node_fs_namespaceObject["default"].existsSync(customConfigPath))
|
|
769
|
-
return customConfigPath;
|
|
770
|
-
}
|
|
592
|
+
const customConfigPath = (0, external_node_path_namespaceObject.isAbsolute)(customConfig) ? customConfig : (0, external_node_path_namespaceObject.join)(root, customConfig);
|
|
593
|
+
if (external_node_fs_namespaceObject["default"].existsSync(customConfigPath)) return customConfigPath;
|
|
771
594
|
dist_logger.warn(`Cannot find config file: ${index_js_namespaceObject["default"].dim(customConfigPath)}\n`);
|
|
772
595
|
}
|
|
773
|
-
const configFilePath = findConfig((0,external_node_path_namespaceObject.join)(root, DEFAULT_CONFIG_NAME));
|
|
774
|
-
if (configFilePath)
|
|
775
|
-
return configFilePath;
|
|
776
|
-
}
|
|
596
|
+
const configFilePath = findConfig((0, external_node_path_namespaceObject.join)(root, DEFAULT_CONFIG_NAME));
|
|
597
|
+
if (configFilePath) return configFilePath;
|
|
777
598
|
throw new Error(`${DEFAULT_CONFIG_NAME} not found in ${root}`);
|
|
778
599
|
};
|
|
779
600
|
async function loadConfig({ cwd = process.cwd(), path, envMode }) {
|
|
780
601
|
const configFilePath = resolveConfigPath(cwd, path);
|
|
781
|
-
const { content } = await (0,core_namespaceObject.loadConfig)({
|
|
782
|
-
cwd: (0,external_node_path_namespaceObject.dirname)(configFilePath),
|
|
602
|
+
const { content } = await (0, core_namespaceObject.loadConfig)({
|
|
603
|
+
cwd: (0, external_node_path_namespaceObject.dirname)(configFilePath),
|
|
783
604
|
path: configFilePath,
|
|
784
605
|
envMode
|
|
785
606
|
});
|
|
786
607
|
return content;
|
|
787
608
|
}
|
|
788
609
|
const composeExternalsWarnConfig = (format, ...externalsArray)=>{
|
|
789
|
-
if (
|
|
790
|
-
return {};
|
|
791
|
-
}
|
|
610
|
+
if ('esm' !== format) return {};
|
|
792
611
|
const externals = [];
|
|
793
|
-
for (const e of externalsArray.filter(Boolean))
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
} else {
|
|
797
|
-
// @ts-ignore
|
|
798
|
-
externals.push(e);
|
|
799
|
-
}
|
|
800
|
-
}
|
|
612
|
+
for (const e of externalsArray.filter(Boolean))if (Array.isArray(e)) externals.push(...e);
|
|
613
|
+
else // @ts-ignore
|
|
614
|
+
externals.push(e);
|
|
801
615
|
// Match logic is derived from https://github.com/webpack/webpack/blob/94aba382eccf3de1004d235045d4462918dfdbb7/lib/ExternalModuleFactoryPlugin.js#L166-L293.
|
|
802
616
|
const matchUserExternals = (externals, request, callback)=>{
|
|
803
|
-
if (typeof externals
|
|
617
|
+
if ('string' == typeof externals) {
|
|
804
618
|
if (externals === request) {
|
|
805
619
|
callback(true);
|
|
806
620
|
return;
|
|
@@ -821,9 +635,7 @@ const composeExternalsWarnConfig = (format, ...externalsArray)=>{
|
|
|
821
635
|
};
|
|
822
636
|
do {
|
|
823
637
|
asyncFlag = true;
|
|
824
|
-
if (i >= externals.length)
|
|
825
|
-
return callback();
|
|
826
|
-
}
|
|
638
|
+
if (i >= externals.length) return callback();
|
|
827
639
|
matchUserExternals(externals[i++], request, handleExternalsAndCallback);
|
|
828
640
|
}while (!asyncFlag);
|
|
829
641
|
asyncFlag = false;
|
|
@@ -835,8 +647,8 @@ const composeExternalsWarnConfig = (format, ...externalsArray)=>{
|
|
|
835
647
|
callback(true);
|
|
836
648
|
return;
|
|
837
649
|
}
|
|
838
|
-
} else if (
|
|
839
|
-
if (typeof externals
|
|
650
|
+
} else if ('function' == typeof externals) ;
|
|
651
|
+
else if ('object' == typeof externals) {
|
|
840
652
|
if (Object.prototype.hasOwnProperty.call(externals, request)) {
|
|
841
653
|
callback(true);
|
|
842
654
|
return;
|
|
@@ -850,15 +662,11 @@ const composeExternalsWarnConfig = (format, ...externalsArray)=>{
|
|
|
850
662
|
({ request, dependencyType, contextInfo }, callback)=>{
|
|
851
663
|
let externalized = false;
|
|
852
664
|
const _callback = (matched)=>{
|
|
853
|
-
if (matched)
|
|
854
|
-
externalized = true;
|
|
855
|
-
}
|
|
665
|
+
if (matched) externalized = true;
|
|
856
666
|
};
|
|
857
|
-
if (contextInfo.issuer &&
|
|
667
|
+
if (contextInfo.issuer && 'commonjs' === dependencyType) {
|
|
858
668
|
matchUserExternals(externals, request, _callback);
|
|
859
|
-
if (externalized)
|
|
860
|
-
dist_logger.warn(composeModuleImportWarn(request));
|
|
861
|
-
}
|
|
669
|
+
if (externalized) dist_logger.warn(composeModuleImportWarn(request));
|
|
862
670
|
}
|
|
863
671
|
callback();
|
|
864
672
|
}
|
|
@@ -868,9 +676,7 @@ const composeExternalsWarnConfig = (format, ...externalsArray)=>{
|
|
|
868
676
|
};
|
|
869
677
|
const composeAutoExternalConfig = (options)=>{
|
|
870
678
|
const { autoExternal, pkgJson, userExternals } = options;
|
|
871
|
-
if (!autoExternal) {
|
|
872
|
-
return {};
|
|
873
|
-
}
|
|
679
|
+
if (!autoExternal) return {};
|
|
874
680
|
if (!pkgJson) {
|
|
875
681
|
dist_logger.warn('autoExternal configuration will not be applied due to read package.json failed');
|
|
876
682
|
return {};
|
|
@@ -879,7 +685,7 @@ const composeAutoExternalConfig = (options)=>{
|
|
|
879
685
|
dependencies: true,
|
|
880
686
|
peerDependencies: true,
|
|
881
687
|
devDependencies: false,
|
|
882
|
-
...
|
|
688
|
+
...true === autoExternal ? {} : autoExternal
|
|
883
689
|
};
|
|
884
690
|
// User externals configuration has higher priority than autoExternal
|
|
885
691
|
// eg: autoExternal: ['react'], user: output: { externals: { react: 'react-1' } }
|
|
@@ -890,9 +696,7 @@ const composeAutoExternalConfig = (options)=>{
|
|
|
890
696
|
'peerDependencies',
|
|
891
697
|
'devDependencies'
|
|
892
698
|
].reduce((prev, type)=>{
|
|
893
|
-
if (externalOptions[type])
|
|
894
|
-
return pkgJson[type] ? prev.concat(Object.keys(pkgJson[type])) : prev;
|
|
895
|
-
}
|
|
699
|
+
if (externalOptions[type]) return pkgJson[type] ? prev.concat(Object.keys(pkgJson[type])) : prev;
|
|
896
700
|
return prev;
|
|
897
701
|
}, []).filter((name)=>!userExternalKeys.includes(name));
|
|
898
702
|
const uniqueExternals = Array.from(new Set(externals));
|
|
@@ -906,8 +710,86 @@ const composeAutoExternalConfig = (options)=>{
|
|
|
906
710
|
}
|
|
907
711
|
} : {};
|
|
908
712
|
};
|
|
713
|
+
function composeMinifyConfig(minify) {
|
|
714
|
+
if (void 0 !== minify) // User's minify configuration will be merged afterwards.
|
|
715
|
+
return {};
|
|
716
|
+
// When minify is not specified, Rslib will use a sane default for minify options.
|
|
717
|
+
// The default options will only perform dead code elimination and unused code elimination.
|
|
718
|
+
return {
|
|
719
|
+
output: {
|
|
720
|
+
minify: {
|
|
721
|
+
js: true,
|
|
722
|
+
css: false,
|
|
723
|
+
jsOptions: {
|
|
724
|
+
minimizerOptions: {
|
|
725
|
+
mangle: false,
|
|
726
|
+
minify: false,
|
|
727
|
+
compress: {
|
|
728
|
+
defaults: false,
|
|
729
|
+
unused: true,
|
|
730
|
+
dead_code: true,
|
|
731
|
+
toplevel: true
|
|
732
|
+
},
|
|
733
|
+
format: {
|
|
734
|
+
comments: 'all'
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
function composeBannerFooterConfig(banner, footer) {
|
|
743
|
+
const bannerConfig = pick(banner, [
|
|
744
|
+
'js',
|
|
745
|
+
'css'
|
|
746
|
+
]);
|
|
747
|
+
const footerConfig = pick(footer, [
|
|
748
|
+
'js',
|
|
749
|
+
'css'
|
|
750
|
+
]);
|
|
751
|
+
if (isEmptyObject(bannerConfig) && isEmptyObject(footerConfig)) return {};
|
|
752
|
+
const plugins = [];
|
|
753
|
+
if (!isEmptyObject(bannerConfig)) {
|
|
754
|
+
if (bannerConfig.js) plugins.push(new core_namespaceObject.rspack.BannerPlugin({
|
|
755
|
+
banner: bannerConfig.js,
|
|
756
|
+
stage: core_namespaceObject.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
|
|
757
|
+
raw: true,
|
|
758
|
+
include: /\.(js|mjs|cjs)$/
|
|
759
|
+
}));
|
|
760
|
+
if (bannerConfig.css) plugins.push(new core_namespaceObject.rspack.BannerPlugin({
|
|
761
|
+
banner: bannerConfig.css,
|
|
762
|
+
stage: core_namespaceObject.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
|
|
763
|
+
raw: true,
|
|
764
|
+
include: /\.(css)$/
|
|
765
|
+
}));
|
|
766
|
+
}
|
|
767
|
+
if (!isEmptyObject(footerConfig)) {
|
|
768
|
+
if (footerConfig.js) plugins.push(new core_namespaceObject.rspack.BannerPlugin({
|
|
769
|
+
banner: footerConfig.js,
|
|
770
|
+
stage: core_namespaceObject.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
|
|
771
|
+
raw: true,
|
|
772
|
+
footer: true,
|
|
773
|
+
include: /\.(js|mjs|cjs)$/
|
|
774
|
+
}));
|
|
775
|
+
if (footerConfig.css) plugins.push(new core_namespaceObject.rspack.BannerPlugin({
|
|
776
|
+
banner: footerConfig.css,
|
|
777
|
+
stage: core_namespaceObject.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE + 1,
|
|
778
|
+
raw: true,
|
|
779
|
+
footer: true,
|
|
780
|
+
include: /\.(css)$/
|
|
781
|
+
}));
|
|
782
|
+
}
|
|
783
|
+
return {
|
|
784
|
+
tools: {
|
|
785
|
+
rspack: {
|
|
786
|
+
plugins
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
}
|
|
909
791
|
async function createConstantRsbuildConfig() {
|
|
910
|
-
return (0,core_namespaceObject.defineConfig)({
|
|
792
|
+
return (0, core_namespaceObject.defineConfig)({
|
|
911
793
|
mode: 'production',
|
|
912
794
|
dev: {
|
|
913
795
|
progressBar: false
|
|
@@ -916,7 +798,8 @@ async function createConstantRsbuildConfig() {
|
|
|
916
798
|
htmlPlugin: false,
|
|
917
799
|
rspack: {
|
|
918
800
|
optimization: {
|
|
919
|
-
moduleIds: 'named'
|
|
801
|
+
moduleIds: 'named',
|
|
802
|
+
nodeEnv: false
|
|
920
803
|
},
|
|
921
804
|
experiments: {
|
|
922
805
|
rspackFuture: {
|
|
@@ -953,25 +836,6 @@ async function createConstantRsbuildConfig() {
|
|
|
953
836
|
},
|
|
954
837
|
output: {
|
|
955
838
|
filenameHash: false,
|
|
956
|
-
minify: {
|
|
957
|
-
js: true,
|
|
958
|
-
css: false,
|
|
959
|
-
jsOptions: {
|
|
960
|
-
minimizerOptions: {
|
|
961
|
-
mangle: false,
|
|
962
|
-
minify: false,
|
|
963
|
-
compress: {
|
|
964
|
-
defaults: false,
|
|
965
|
-
unused: true,
|
|
966
|
-
dead_code: true,
|
|
967
|
-
toplevel: true
|
|
968
|
-
},
|
|
969
|
-
format: {
|
|
970
|
-
comments: 'all'
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
},
|
|
975
839
|
distPath: {
|
|
976
840
|
js: './'
|
|
977
841
|
}
|
|
@@ -1037,9 +901,7 @@ const composeFormatConfig = (format)=>{
|
|
|
1037
901
|
throw new Error(`Unsupported format: ${format}`);
|
|
1038
902
|
}
|
|
1039
903
|
};
|
|
1040
|
-
const composeModuleImportWarn = (request)
|
|
1041
|
-
return `The externalized commonjs request ${index_js_namespaceObject["default"].green(`"${request}"`)} will use ${index_js_namespaceObject["default"].blue('"module"')} external type in ESM format. If you want to specify other external type, considering set the request and type with ${index_js_namespaceObject["default"].blue('"output.externals"')}.`;
|
|
1042
|
-
};
|
|
904
|
+
const composeModuleImportWarn = (request)=>`The externalized commonjs request ${index_js_namespaceObject["default"].green(`"${request}"`)} will use ${index_js_namespaceObject["default"].blue('"module"')} external type in ESM format. If you want to specify other external type, considering set the request and type with ${index_js_namespaceObject["default"].blue('"output.externals"')}.`;
|
|
1043
905
|
const composeExternalsConfig = (format, externals)=>{
|
|
1044
906
|
// TODO: Define the internal externals config in Rsbuild's externals instead
|
|
1045
907
|
// Rspack's externals as they will not be merged from different fields. All externals
|
|
@@ -1088,24 +950,22 @@ const composeAutoExtensionConfig = (config, autoExtension, pkgJson)=>{
|
|
|
1088
950
|
};
|
|
1089
951
|
const composeSyntaxConfig = (syntax, target)=>{
|
|
1090
952
|
// Defaults to ESNext, Rslib will assume all of the latest JavaScript and CSS features are supported.
|
|
1091
|
-
if (syntax) {
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
return config;
|
|
1102
|
-
}
|
|
1103
|
-
},
|
|
1104
|
-
output: {
|
|
1105
|
-
overrideBrowserslist: transformSyntaxToBrowserslist(syntax)
|
|
953
|
+
if (syntax) return {
|
|
954
|
+
tools: {
|
|
955
|
+
rspack: (config)=>{
|
|
956
|
+
// TODO: Rspack should could resolve `browserslist:{query}` like webpack.
|
|
957
|
+
// https://webpack.js.org/configuration/target/#browserslist
|
|
958
|
+
// Using 'es5' as a temporary solution for compatibility.
|
|
959
|
+
config.target = [
|
|
960
|
+
'es5'
|
|
961
|
+
];
|
|
962
|
+
return config;
|
|
1106
963
|
}
|
|
1107
|
-
}
|
|
1108
|
-
|
|
964
|
+
},
|
|
965
|
+
output: {
|
|
966
|
+
overrideBrowserslist: transformSyntaxToBrowserslist(syntax)
|
|
967
|
+
}
|
|
968
|
+
};
|
|
1109
969
|
// If `syntax` is not defined, Rslib will try to determine by the `target`, with the last version of the target.
|
|
1110
970
|
const lastTargetVersions = {
|
|
1111
971
|
node: [
|
|
@@ -1130,7 +990,7 @@ const composeSyntaxConfig = (syntax, target)=>{
|
|
|
1130
990
|
}
|
|
1131
991
|
},
|
|
1132
992
|
output: {
|
|
1133
|
-
overrideBrowserslist:
|
|
993
|
+
overrideBrowserslist: 'web' === target ? lastTargetVersions.web : 'node' === target ? lastTargetVersions.node : [
|
|
1134
994
|
...lastTargetVersions.node,
|
|
1135
995
|
...lastTargetVersions.web
|
|
1136
996
|
]
|
|
@@ -1138,16 +998,12 @@ const composeSyntaxConfig = (syntax, target)=>{
|
|
|
1138
998
|
};
|
|
1139
999
|
};
|
|
1140
1000
|
const composeEntryConfig = async (entries, bundle, root)=>{
|
|
1141
|
-
if (!entries) {
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
entry: entries
|
|
1148
|
-
}
|
|
1149
|
-
};
|
|
1150
|
-
}
|
|
1001
|
+
if (!entries) return {};
|
|
1002
|
+
if (false !== bundle) return {
|
|
1003
|
+
source: {
|
|
1004
|
+
entry: entries
|
|
1005
|
+
}
|
|
1006
|
+
};
|
|
1151
1007
|
// In bundleless mode, resolve glob patterns and convert them to entry object.
|
|
1152
1008
|
const resolvedEntries = {};
|
|
1153
1009
|
for (const key of Object.keys(entries)){
|
|
@@ -1156,23 +1012,19 @@ const composeEntryConfig = async (entries, bundle, root)=>{
|
|
|
1156
1012
|
// 1. A string of glob pattern: { entry: { index: 'src/*.ts' } }
|
|
1157
1013
|
// 2. An array of glob patterns: { entry: { index: ['src/*.ts', 'src/*.tsx'] } }
|
|
1158
1014
|
// Not supported for now: entry description object
|
|
1159
|
-
const entryFiles = Array.isArray(entry) ? entry : typeof entry
|
|
1015
|
+
const entryFiles = Array.isArray(entry) ? entry : 'string' == typeof entry ? [
|
|
1160
1016
|
entry
|
|
1161
1017
|
] : null;
|
|
1162
|
-
if (!entryFiles)
|
|
1163
|
-
throw new Error('Entry can only be a string or an array of strings for now');
|
|
1164
|
-
}
|
|
1018
|
+
if (!entryFiles) throw new Error('Entry can only be a string or an array of strings for now');
|
|
1165
1019
|
// Turn entries in array into each separate entry.
|
|
1166
|
-
const resolvedEntryFiles = await (0,fast_glob_index_js_namespaceObject["default"])(entryFiles, {
|
|
1020
|
+
const resolvedEntryFiles = await (0, fast_glob_index_js_namespaceObject["default"])(entryFiles, {
|
|
1167
1021
|
cwd: root
|
|
1168
1022
|
});
|
|
1169
|
-
if (resolvedEntryFiles.length
|
|
1170
|
-
throw new Error(`Cannot find ${resolvedEntryFiles}`);
|
|
1171
|
-
}
|
|
1023
|
+
if (0 === resolvedEntryFiles.length) throw new Error(`Cannot find ${resolvedEntryFiles}`);
|
|
1172
1024
|
// Similar to `rootDir` in tsconfig and `outbase` in esbuild.
|
|
1173
1025
|
const lcp = await calcLongestCommonPath(resolvedEntryFiles);
|
|
1174
1026
|
// Using the longest common path of all non-declaration input files by default.
|
|
1175
|
-
const outBase =
|
|
1027
|
+
const outBase = null === lcp ? root : lcp;
|
|
1176
1028
|
for (const file of resolvedEntryFiles){
|
|
1177
1029
|
const { dir, name } = external_node_path_namespaceObject["default"].parse(external_node_path_namespaceObject["default"].relative(outBase, file));
|
|
1178
1030
|
// Entry filename contains nested path to preserve source directory structure.
|
|
@@ -1202,9 +1054,7 @@ const composeBundleConfig = (jsExtension, bundle = true)=>{
|
|
|
1202
1054
|
// This may result in a change in semantics,
|
|
1203
1055
|
// user should use copy to keep origin file or use another separate entry to deal this
|
|
1204
1056
|
let request = data.request;
|
|
1205
|
-
if (request[0]
|
|
1206
|
-
request = (0,external_node_path_namespaceObject.extname)(request) ? request.replace(/\.[^.]+$/, jsExtension) : `${request}${jsExtension}`;
|
|
1207
|
-
}
|
|
1057
|
+
if ('.' === request[0]) request = (0, external_node_path_namespaceObject.extname)(request) ? request.replace(/\.[^.]+$/, jsExtension) : `${request}${jsExtension}`;
|
|
1208
1058
|
return callback(null, request);
|
|
1209
1059
|
}
|
|
1210
1060
|
callback();
|
|
@@ -1214,9 +1064,9 @@ const composeBundleConfig = (jsExtension, bundle = true)=>{
|
|
|
1214
1064
|
};
|
|
1215
1065
|
};
|
|
1216
1066
|
const composeDtsConfig = async (libConfig, dtsExtension)=>{
|
|
1217
|
-
const { dts, bundle, output, autoExternal } = libConfig;
|
|
1218
|
-
if (
|
|
1219
|
-
const { pluginDts } = await Promise.resolve(
|
|
1067
|
+
const { dts, bundle, output, autoExternal, banner, footer } = libConfig;
|
|
1068
|
+
if (false === dts || void 0 === dts) return {};
|
|
1069
|
+
const { pluginDts } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "rsbuild-plugin-dts"));
|
|
1220
1070
|
return {
|
|
1221
1071
|
plugins: [
|
|
1222
1072
|
pluginDts({
|
|
@@ -1224,7 +1074,9 @@ const composeDtsConfig = async (libConfig, dtsExtension)=>{
|
|
|
1224
1074
|
distPath: dts?.distPath ?? output?.distPath?.root ?? './dist',
|
|
1225
1075
|
abortOnError: dts?.abortOnError ?? true,
|
|
1226
1076
|
dtsExtension,
|
|
1227
|
-
autoExternal
|
|
1077
|
+
autoExternal,
|
|
1078
|
+
banner: banner?.dts,
|
|
1079
|
+
footer: footer?.dts
|
|
1228
1080
|
})
|
|
1229
1081
|
]
|
|
1230
1082
|
};
|
|
@@ -1276,36 +1128,64 @@ const composeTargetConfig = (target = 'web')=>{
|
|
|
1276
1128
|
throw new Error(`Unsupported platform: ${target}`);
|
|
1277
1129
|
}
|
|
1278
1130
|
};
|
|
1131
|
+
const composeExternalHelpersConfig = (externalHelpers, pkgJson)=>{
|
|
1132
|
+
let defaultConfig = {
|
|
1133
|
+
tools: {
|
|
1134
|
+
swc: {
|
|
1135
|
+
jsc: {
|
|
1136
|
+
externalHelpers: false
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
};
|
|
1141
|
+
if (externalHelpers) {
|
|
1142
|
+
const deps = [
|
|
1143
|
+
...Object.keys(pkgJson?.dependencies ?? []),
|
|
1144
|
+
...Object.keys(pkgJson?.devDependencies ?? [])
|
|
1145
|
+
];
|
|
1146
|
+
if (!deps.includes(SWC_HELPERS)) {
|
|
1147
|
+
dist_logger.error(`${index_js_namespaceObject["default"].green('externalHelpers')} is enabled, but the ${index_js_namespaceObject["default"].blue(SWC_HELPERS)} dependency declaration was not found in package.json.`);
|
|
1148
|
+
process.exit(1);
|
|
1149
|
+
}
|
|
1150
|
+
defaultConfig = Object.assign(defaultConfig, {
|
|
1151
|
+
output: {
|
|
1152
|
+
externals: new RegExp(`^${SWC_HELPERS}($|\\/|\\\\)`)
|
|
1153
|
+
}
|
|
1154
|
+
});
|
|
1155
|
+
defaultConfig.tools.swc.jsc.externalHelpers = true;
|
|
1156
|
+
}
|
|
1157
|
+
return defaultConfig;
|
|
1158
|
+
};
|
|
1279
1159
|
async function composeLibRsbuildConfig(config, configPath) {
|
|
1280
|
-
const rootPath = (0,external_node_path_namespaceObject.dirname)(configPath);
|
|
1160
|
+
const rootPath = (0, external_node_path_namespaceObject.dirname)(configPath);
|
|
1281
1161
|
const pkgJson = readPackageJson(rootPath);
|
|
1282
|
-
const { format, autoExtension = true, autoExternal = true } = config;
|
|
1162
|
+
const { format, banner = {}, footer = {}, autoExtension = true, autoExternal = true, externalHelpers = false } = config;
|
|
1283
1163
|
const formatConfig = composeFormatConfig(format);
|
|
1164
|
+
const externalHelpersConfig = composeExternalHelpersConfig(externalHelpers, pkgJson);
|
|
1284
1165
|
const externalsConfig = composeExternalsConfig(format, config.output?.externals);
|
|
1285
1166
|
const { config: autoExtensionConfig, jsExtension, dtsExtension } = composeAutoExtensionConfig(config, autoExtension, pkgJson);
|
|
1286
1167
|
const bundleConfig = composeBundleConfig(jsExtension, config.bundle);
|
|
1287
1168
|
const targetConfig = composeTargetConfig(config.output?.target);
|
|
1288
|
-
const syntaxConfig = composeSyntaxConfig(config
|
|
1169
|
+
const syntaxConfig = composeSyntaxConfig(config?.syntax, config.output?.target);
|
|
1289
1170
|
const autoExternalConfig = composeAutoExternalConfig({
|
|
1290
1171
|
autoExternal,
|
|
1291
1172
|
pkgJson,
|
|
1292
1173
|
userExternals: config.output?.externals
|
|
1293
1174
|
});
|
|
1294
|
-
const entryConfig = await composeEntryConfig(config.source?.entry, config.bundle, (0,external_node_path_namespaceObject.dirname)(configPath));
|
|
1175
|
+
const entryConfig = await composeEntryConfig(config.source?.entry, config.bundle, (0, external_node_path_namespaceObject.dirname)(configPath));
|
|
1295
1176
|
const dtsConfig = await composeDtsConfig(config, dtsExtension);
|
|
1296
1177
|
const externalsWarnConfig = composeExternalsWarnConfig(format, autoExternalConfig?.output?.externals, externalsConfig?.output?.externals);
|
|
1297
|
-
|
|
1298
|
-
|
|
1178
|
+
const minifyConfig = composeMinifyConfig(config.output?.minify);
|
|
1179
|
+
const bannerFooterConfig = composeBannerFooterConfig(banner, footer);
|
|
1180
|
+
return (0, core_namespaceObject.mergeRsbuildConfig)(formatConfig, externalHelpersConfig, externalsWarnConfig, externalsConfig, autoExternalConfig, autoExtensionConfig, syntaxConfig, bundleConfig, targetConfig, entryConfig, minifyConfig, dtsConfig, bannerFooterConfig);
|
|
1299
1181
|
}
|
|
1300
1182
|
async function composeCreateRsbuildConfig(rslibConfig, path) {
|
|
1301
1183
|
const constantRsbuildConfig = await createConstantRsbuildConfig();
|
|
1302
1184
|
const configPath = path ?? rslibConfig._privateMeta?.configFilePath;
|
|
1303
1185
|
const { lib: libConfigsArray, ...sharedRsbuildConfig } = rslibConfig;
|
|
1304
|
-
if (!libConfigsArray) {
|
|
1305
|
-
throw new Error(`Expect lib field to be an array, but got ${libConfigsArray}.`);
|
|
1306
|
-
}
|
|
1186
|
+
if (!libConfigsArray) throw new Error(`Expect lib field to be an array, but got ${libConfigsArray}.`);
|
|
1307
1187
|
const libConfigPromises = libConfigsArray.map(async (libConfig)=>{
|
|
1308
|
-
const userConfig = (0,core_namespaceObject.mergeRsbuildConfig)(sharedRsbuildConfig, libConfig);
|
|
1188
|
+
const userConfig = (0, core_namespaceObject.mergeRsbuildConfig)(sharedRsbuildConfig, libConfig);
|
|
1309
1189
|
// Merge the configuration of each environment based on the shared Rsbuild
|
|
1310
1190
|
// configuration and Lib configuration in the settings.
|
|
1311
1191
|
const libRsbuildConfig = await composeLibRsbuildConfig(userConfig, configPath);
|
|
@@ -1327,12 +1207,15 @@ async function composeCreateRsbuildConfig(rslibConfig, path) {
|
|
|
1327
1207
|
// We should state in the document that the built-in configuration should not be changed optionally
|
|
1328
1208
|
// In compose process of 2, we may read some config from 1, and reassemble the related config,
|
|
1329
1209
|
// so before final mergeRsbuildConfig, we reset some specified fields
|
|
1330
|
-
config: (0,core_namespaceObject.mergeRsbuildConfig)(constantRsbuildConfig, libRsbuildConfig,
|
|
1210
|
+
config: (0, core_namespaceObject.mergeRsbuildConfig)(constantRsbuildConfig, libRsbuildConfig, omit(userConfig, [
|
|
1331
1211
|
'bundle',
|
|
1332
1212
|
'format',
|
|
1333
1213
|
'autoExtension',
|
|
1334
1214
|
'autoExternal',
|
|
1335
1215
|
'syntax',
|
|
1216
|
+
'externalHelpers',
|
|
1217
|
+
'banner',
|
|
1218
|
+
'footer',
|
|
1336
1219
|
'dts'
|
|
1337
1220
|
]))
|
|
1338
1221
|
};
|
|
@@ -1355,17 +1238,14 @@ async function initRsbuild(rslibConfig) {
|
|
|
1355
1238
|
for (const { format, config } of rsbuildConfigObject){
|
|
1356
1239
|
const currentFormatCount = formatCount[format];
|
|
1357
1240
|
const currentFormatIndex = formatIndex[format]++;
|
|
1358
|
-
environments[
|
|
1241
|
+
environments[1 === currentFormatCount ? format : `${format}${currentFormatIndex}`] = config;
|
|
1359
1242
|
}
|
|
1360
|
-
return (0,core_namespaceObject.createRsbuild)({
|
|
1243
|
+
return (0, core_namespaceObject.createRsbuild)({
|
|
1361
1244
|
rsbuildConfig: {
|
|
1362
1245
|
environments
|
|
1363
1246
|
}
|
|
1364
1247
|
});
|
|
1365
1248
|
}
|
|
1366
|
-
|
|
1367
|
-
;// CONCATENATED MODULE: ./src/build.ts
|
|
1368
|
-
|
|
1369
1249
|
async function build(config, options) {
|
|
1370
1250
|
const rsbuildInstance = await initRsbuild(config);
|
|
1371
1251
|
await rsbuildInstance.build({
|
|
@@ -1373,17 +1253,11 @@ async function build(config, options) {
|
|
|
1373
1253
|
});
|
|
1374
1254
|
return rsbuildInstance;
|
|
1375
1255
|
}
|
|
1376
|
-
|
|
1377
|
-
;// CONCATENATED MODULE: ./src/cli/commands.ts
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
1256
|
const applyCommonOptions = (command)=>{
|
|
1383
1257
|
command.option('-c --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file');
|
|
1384
1258
|
};
|
|
1385
1259
|
function runCli() {
|
|
1386
|
-
commander_index_js_namespaceObject.program.name('rslib').usage('<command> [options]').version("0.0.
|
|
1260
|
+
commander_index_js_namespaceObject.program.name('rslib').usage('<command> [options]').version("0.0.5");
|
|
1387
1261
|
const buildCommand = commander_index_js_namespaceObject.program.command('build');
|
|
1388
1262
|
const inspectCommand = commander_index_js_namespaceObject.program.command('inspect');
|
|
1389
1263
|
[
|
|
@@ -1425,13 +1299,5 @@ function runCli() {
|
|
|
1425
1299
|
});
|
|
1426
1300
|
commander_index_js_namespaceObject.program.parse();
|
|
1427
1301
|
}
|
|
1428
|
-
|
|
1429
|
-
;// CONCATENATED MODULE: ./src/index.ts
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
const src_version = "0.0.4";
|
|
1436
|
-
|
|
1302
|
+
const src_version = "0.0.5";
|
|
1437
1303
|
export { build, defineConfig, loadConfig, dist_logger as logger, prepareCli, runCli, src_version as version };
|