@rsbuild/core 2.0.0-beta.6 → 2.0.0-beta.8
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/bin/rsbuild.js +13 -0
- package/compiled/chokidar/index.d.ts +197 -29
- package/compiled/chokidar/package.json +1 -1
- package/compiled/connect-next/index.d.ts +56 -0
- package/compiled/connect-next/license +26 -0
- package/compiled/connect-next/package.json +1 -0
- package/compiled/cors/index.d.ts +56 -0
- package/compiled/cors/license +22 -0
- package/compiled/cors/package.json +1 -0
- package/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/jiti/dist/babel.cjs +60 -60
- package/compiled/jiti/dist/jiti.cjs +2 -2
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/lib/at-rule.d.ts +1 -1
- package/compiled/postcss/lib/comment.d.ts +1 -1
- package/compiled/postcss/lib/container.d.ts +1 -1
- package/compiled/postcss/lib/css-syntax-error.d.ts +1 -1
- package/compiled/postcss/lib/declaration.d.ts +1 -1
- package/compiled/postcss/lib/document.d.ts +1 -1
- package/compiled/postcss/lib/input.d.ts +1 -1
- package/compiled/postcss/lib/lazy-result.d.ts +1 -1
- package/compiled/postcss/lib/no-work-result.d.ts +1 -1
- package/compiled/postcss/lib/node.d.ts +1 -1
- package/compiled/postcss/lib/previous-map.d.ts +1 -1
- package/compiled/postcss/lib/processor.d.ts +1 -1
- package/compiled/postcss/lib/result.d.ts +1 -1
- package/compiled/postcss/lib/root.d.ts +1 -1
- package/compiled/postcss/lib/rule.d.ts +1 -1
- package/compiled/postcss/lib/stringifier.d.ts +1 -1
- package/compiled/postcss/lib/warning.d.ts +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rslog/index.d.ts +17 -1
- package/compiled/rslog/package.json +1 -1
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-chain/types/index.d.ts +0 -2
- package/compiled/rspack-manifest-plugin/index.d.ts +48 -0
- package/compiled/rspack-manifest-plugin/license +21 -0
- package/compiled/rspack-manifest-plugin/package.json +1 -0
- package/compiled/style-loader/index.js +37 -94
- package/compiled/style-loader/package.json +1 -1
- package/dist/{131.js → 958.js} +1125 -1083
- package/dist/chokidar.js +59 -57
- package/dist/client/hmr.js +2 -2
- package/dist/client/overlay.js +1 -1
- package/dist/connect-next.js +268 -0
- package/dist/{connect.js.LICENSE.txt → connect-next.js.LICENSE.txt} +3 -13
- package/dist/cors.js +2 -2
- package/dist/http-proxy-middleware.js +57 -552
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +31 -15
- package/dist/manifest-plugin.js +18 -18
- package/dist/memfs.js +217 -756
- package/dist/{710.js → mrmime.js} +2 -1
- package/dist/open.js +36 -34
- package/dist/range-parser.js +2 -2
- package/dist/remapping.js +2 -2
- package/dist/rslib-runtime.js +3 -3
- package/dist/sirv.js +14 -14
- package/dist/src.js +510 -0
- package/dist/tinyglobby.js +114 -69
- package/dist/transformLoader.mjs +38 -1
- package/dist/transformRawLoader.mjs +1 -1
- package/dist/ws.js +1541 -0
- package/dist-types/helpers/index.d.ts +1 -1
- package/dist-types/helpers/vendors.d.ts +0 -1
- package/dist-types/server/runner/asModule.d.ts +1 -1
- package/dist-types/server/socketServer.d.ts +1 -1
- package/dist-types/types/config.d.ts +4 -4
- package/dist-types/types/thirdParty.d.ts +14 -5
- package/package.json +13 -14
- package/compiled/chokidar/handler.d.ts +0 -90
- package/compiled/ws/index.d.ts +0 -437
- package/compiled/ws/index.js +0 -3166
- package/compiled/ws/license +0 -20
- package/compiled/ws/package.json +0 -1
- package/dist/397.js +0 -11
- package/dist/7.js +0 -1
- package/dist/712.js +0 -15
- package/dist/743.js +0 -7
- package/dist/88.js +0 -40
- package/dist/connect.js +0 -570
- package/dist-types/helpers/color.d.ts +0 -4
- /package/dist/{131.js.LICENSE.txt → 958.js.LICENSE.txt} +0 -0
- /package/dist/client/{59.js → 797.js} +0 -0
- /package/dist/{31.js → trace-mapping.js} +0 -0
package/dist/{131.js → 958.js}
RENAMED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
let flagForceColor, swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin;
|
|
3
|
-
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
4
|
-
import { createRequire as __rspack_createRequire } from "node:module";
|
|
1
|
+
/*! LICENSE: 958.js.LICENSE.txt */
|
|
2
|
+
let flagForceColor, runtimeProcessArgs, runtimeInfo, swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin;
|
|
3
|
+
import { fileURLToPath as __rspack_fileURLToPath, URL as external_node_url_URL, fileURLToPath, pathToFileURL } from "node:url";
|
|
4
|
+
import { createRequire as __rspack_createRequire, builtinModules, createRequire } from "node:module";
|
|
5
5
|
let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
6
6
|
import * as __rspack_external_async_hooks from "async_hooks";
|
|
7
|
-
import * as __rspack_external_events from "events";
|
|
8
7
|
import * as __rspack_external_fs from "fs";
|
|
9
|
-
import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
|
|
10
8
|
import * as __rspack_external_node_module_ab9f2194 from "node:module";
|
|
11
|
-
import * as
|
|
12
|
-
import * as __rspack_external_node_path_c5b9b54f from "node:path";
|
|
13
|
-
import * as __rspack_external_node_process_786449bf from "node:process";
|
|
14
|
-
import * as __rspack_external_node_tty_c64aab7e from "node:tty";
|
|
9
|
+
import node_path, * as __rspack_external_node_path_c5b9b54f from "node:path";
|
|
15
10
|
import * as __rspack_external_node_url_e96de089 from "node:url";
|
|
16
11
|
import * as __rspack_external_os from "os";
|
|
17
12
|
import * as __rspack_external_path from "path";
|
|
18
13
|
import * as __rspack_external_url from "url";
|
|
19
14
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
20
15
|
import { rspack as core_rspack } from "@rspack/core";
|
|
21
|
-
import {
|
|
16
|
+
import node_util, { stripVTControlCharacters } from "node:util";
|
|
17
|
+
import node_process from "node:process";
|
|
18
|
+
import node_os, { constants as external_node_os_constants } from "node:os";
|
|
19
|
+
import node_tty from "node:tty";
|
|
20
|
+
import { dirname as external_node_path_dirname, isAbsolute as external_node_path_isAbsolute, join, posix, relative, sep, win32 } from "node:path";
|
|
21
|
+
import node_fs, { existsSync } from "node:fs";
|
|
22
22
|
import { isPromise, isRegExp } from "node:util/types";
|
|
23
23
|
import node_zlib from "node:zlib";
|
|
24
24
|
__webpack_require__.add({
|
|
@@ -156,302 +156,8 @@ __webpack_require__.add({
|
|
|
156
156
|
return thunk.cancel = cleanup, thunk;
|
|
157
157
|
};
|
|
158
158
|
},
|
|
159
|
-
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js" (__unused_rspack_module, exports) {
|
|
160
|
-
Object.defineProperty(exports, "__esModule", {
|
|
161
|
-
value: !0
|
|
162
|
-
}), exports.arrayToString = void 0, exports.arrayToString = (array, space, next)=>{
|
|
163
|
-
let values = array.map(function(value, index) {
|
|
164
|
-
let result = next(value, index);
|
|
165
|
-
return void 0 === result ? String(result) : space + result.split("\n").join(`\n${space}`);
|
|
166
|
-
}).join(space ? ",\n" : ","), eol = space && values ? "\n" : "";
|
|
167
|
-
return `[${eol}${values}${eol}]`;
|
|
168
|
-
};
|
|
169
|
-
},
|
|
170
|
-
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
171
|
-
Object.defineProperty(exports, "__esModule", {
|
|
172
|
-
value: !0
|
|
173
|
-
}), exports.FunctionParser = exports.dedentFunction = exports.functionToString = exports.USED_METHOD_KEY = void 0;
|
|
174
|
-
let quote_1 = __webpack_require__("../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), METHOD_NAMES_ARE_QUOTED = '"' === ({
|
|
175
|
-
" " () {}
|
|
176
|
-
})[" "].toString().charAt(0), FUNCTION_PREFIXES = {
|
|
177
|
-
Function: "function ",
|
|
178
|
-
GeneratorFunction: "function* ",
|
|
179
|
-
AsyncFunction: "async function ",
|
|
180
|
-
AsyncGeneratorFunction: "async function* "
|
|
181
|
-
}, METHOD_PREFIXES = {
|
|
182
|
-
Function: "",
|
|
183
|
-
GeneratorFunction: "*",
|
|
184
|
-
AsyncFunction: "async ",
|
|
185
|
-
AsyncGeneratorFunction: "async *"
|
|
186
|
-
}, TOKENS_PRECEDING_REGEXPS = new Set("case delete else in instanceof new return throw typeof void , ; : + - ! ~ & | ^ * / % < > ? =".split(" "));
|
|
187
|
-
function dedentFunction(fnString) {
|
|
188
|
-
let found;
|
|
189
|
-
for (let line of fnString.split("\n").slice(1)){
|
|
190
|
-
let m = /^[\s\t]+/.exec(line);
|
|
191
|
-
if (!m) return fnString;
|
|
192
|
-
let [str] = m;
|
|
193
|
-
void 0 === found ? found = str : str.length < found.length && (found = str);
|
|
194
|
-
}
|
|
195
|
-
return found ? fnString.split(`\n${found}`).join("\n") : fnString;
|
|
196
|
-
}
|
|
197
|
-
exports.USED_METHOD_KEY = new WeakSet(), exports.functionToString = (fn, space, next, key)=>{
|
|
198
|
-
let name = "string" == typeof key ? key : void 0;
|
|
199
|
-
return void 0 !== name && exports.USED_METHOD_KEY.add(fn), new FunctionParser(fn, space, next, name).stringify();
|
|
200
|
-
}, exports.dedentFunction = dedentFunction;
|
|
201
|
-
class FunctionParser {
|
|
202
|
-
constructor(fn, indent, next, key){
|
|
203
|
-
this.fn = fn, this.indent = indent, this.next = next, this.key = key, this.pos = 0, this.hadKeyword = !1, this.fnString = Function.prototype.toString.call(fn), this.fnType = fn.constructor.name, this.keyQuote = void 0 === key ? "" : quote_1.quoteKey(key, next), this.keyPrefix = void 0 === key ? "" : `${this.keyQuote}:${indent ? " " : ""}`, this.isMethodCandidate = void 0 !== key && ("" === this.fn.name || this.fn.name === key);
|
|
204
|
-
}
|
|
205
|
-
stringify() {
|
|
206
|
-
let value = this.tryParse();
|
|
207
|
-
return value ? dedentFunction(value) : `${this.keyPrefix}void ${this.next(this.fnString)}`;
|
|
208
|
-
}
|
|
209
|
-
getPrefix() {
|
|
210
|
-
return this.isMethodCandidate && !this.hadKeyword ? METHOD_PREFIXES[this.fnType] + this.keyQuote : this.keyPrefix + FUNCTION_PREFIXES[this.fnType];
|
|
211
|
-
}
|
|
212
|
-
tryParse() {
|
|
213
|
-
if ("}" !== this.fnString[this.fnString.length - 1]) return this.keyPrefix + this.fnString;
|
|
214
|
-
if (this.fn.name) {
|
|
215
|
-
let result = this.tryStrippingName();
|
|
216
|
-
if (result) return result;
|
|
217
|
-
}
|
|
218
|
-
let prevPos = this.pos;
|
|
219
|
-
if ("class" === this.consumeSyntax()) return this.fnString;
|
|
220
|
-
if (this.pos = prevPos, this.tryParsePrefixTokens()) {
|
|
221
|
-
let result = this.tryStrippingName();
|
|
222
|
-
if (result) return result;
|
|
223
|
-
let offset = this.pos;
|
|
224
|
-
switch(this.consumeSyntax("WORD_LIKE")){
|
|
225
|
-
case "WORD_LIKE":
|
|
226
|
-
this.isMethodCandidate && !this.hadKeyword && (offset = this.pos);
|
|
227
|
-
case "()":
|
|
228
|
-
if ("=>" === this.fnString.substr(this.pos, 2)) return this.keyPrefix + this.fnString;
|
|
229
|
-
this.pos = offset;
|
|
230
|
-
case '"':
|
|
231
|
-
case "'":
|
|
232
|
-
case "[]":
|
|
233
|
-
return this.getPrefix() + this.fnString.substr(this.pos);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
tryStrippingName() {
|
|
238
|
-
if (METHOD_NAMES_ARE_QUOTED) return;
|
|
239
|
-
let start = this.pos, prefix = this.fnString.substr(this.pos, this.fn.name.length);
|
|
240
|
-
if (prefix === this.fn.name && (this.pos += prefix.length, "()" === this.consumeSyntax() && "{}" === this.consumeSyntax() && this.pos === this.fnString.length)) return (this.isMethodCandidate || !quote_1.isValidVariableName(prefix)) && (start += prefix.length), this.getPrefix() + this.fnString.substr(start);
|
|
241
|
-
this.pos = start;
|
|
242
|
-
}
|
|
243
|
-
tryParsePrefixTokens() {
|
|
244
|
-
let posPrev = this.pos;
|
|
245
|
-
switch(this.hadKeyword = !1, this.fnType){
|
|
246
|
-
case "AsyncFunction":
|
|
247
|
-
if ("async" !== this.consumeSyntax()) return !1;
|
|
248
|
-
posPrev = this.pos;
|
|
249
|
-
case "Function":
|
|
250
|
-
return "function" === this.consumeSyntax() ? this.hadKeyword = !0 : this.pos = posPrev, !0;
|
|
251
|
-
case "AsyncGeneratorFunction":
|
|
252
|
-
if ("async" !== this.consumeSyntax()) return !1;
|
|
253
|
-
case "GeneratorFunction":
|
|
254
|
-
let token = this.consumeSyntax();
|
|
255
|
-
return "function" === token && (token = this.consumeSyntax(), this.hadKeyword = !0), "*" === token;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
consumeSyntax(wordLikeToken) {
|
|
259
|
-
let m = this.consumeMatch(/^(?:([A-Za-z_0-9$\xA0-\uFFFF]+)|=>|\+\+|\-\-|.)/);
|
|
260
|
-
if (!m) return;
|
|
261
|
-
let [token, match] = m;
|
|
262
|
-
if (this.consumeWhitespace(), match) return wordLikeToken || match;
|
|
263
|
-
switch(token){
|
|
264
|
-
case "(":
|
|
265
|
-
return this.consumeSyntaxUntil("(", ")");
|
|
266
|
-
case "[":
|
|
267
|
-
return this.consumeSyntaxUntil("[", "]");
|
|
268
|
-
case "{":
|
|
269
|
-
return this.consumeSyntaxUntil("{", "}");
|
|
270
|
-
case "`":
|
|
271
|
-
return this.consumeTemplate();
|
|
272
|
-
case '"':
|
|
273
|
-
return this.consumeRegExp(/^(?:[^\\"]|\\.)*"/, '"');
|
|
274
|
-
case "'":
|
|
275
|
-
return this.consumeRegExp(/^(?:[^\\']|\\.)*'/, "'");
|
|
276
|
-
}
|
|
277
|
-
return token;
|
|
278
|
-
}
|
|
279
|
-
consumeSyntaxUntil(startToken, endToken) {
|
|
280
|
-
let isRegExpAllowed = !0;
|
|
281
|
-
for(;;){
|
|
282
|
-
let token = this.consumeSyntax();
|
|
283
|
-
if (token === endToken) return startToken + endToken;
|
|
284
|
-
if (!token || ")" === token || "]" === token || "}" === token) return;
|
|
285
|
-
"/" === token && isRegExpAllowed && this.consumeMatch(/^(?:\\.|[^\\\/\n[]|\[(?:\\.|[^\]])*\])+\/[a-z]*/) ? (isRegExpAllowed = !1, this.consumeWhitespace()) : isRegExpAllowed = TOKENS_PRECEDING_REGEXPS.has(token);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
consumeMatch(re) {
|
|
289
|
-
let m = re.exec(this.fnString.substr(this.pos));
|
|
290
|
-
return m && (this.pos += m[0].length), m;
|
|
291
|
-
}
|
|
292
|
-
consumeRegExp(re, token) {
|
|
293
|
-
let m = re.exec(this.fnString.substr(this.pos));
|
|
294
|
-
if (m) return this.pos += m[0].length, this.consumeWhitespace(), token;
|
|
295
|
-
}
|
|
296
|
-
consumeTemplate() {
|
|
297
|
-
for(;;){
|
|
298
|
-
if (this.consumeMatch(/^(?:[^`$\\]|\\.|\$(?!{))*/), "`" === this.fnString[this.pos]) return this.pos++, this.consumeWhitespace(), "`";
|
|
299
|
-
if (!("${" === this.fnString.substr(this.pos, 2) && (this.pos += 2, this.consumeWhitespace(), this.consumeSyntaxUntil("{", "}")))) return;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
consumeWhitespace() {
|
|
303
|
-
this.consumeMatch(/^(?:\s|\/\/.*|\/\*[^]*?\*\/)*/);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
exports.FunctionParser = FunctionParser;
|
|
307
|
-
},
|
|
308
|
-
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
309
|
-
exports.stringify = void 0;
|
|
310
|
-
let stringify_1 = __webpack_require__("../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js"), quote_1 = __webpack_require__("../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), ROOT_SENTINEL = Symbol("root");
|
|
311
|
-
function replacerToString(replacer) {
|
|
312
|
-
return replacer ? (value, space, next, key)=>replacer(value, space, (value)=>stringify_1.toString(value, space, next, key), key) : stringify_1.toString;
|
|
313
|
-
}
|
|
314
|
-
exports.stringify = function stringify(value, replacer, indent, options = {}) {
|
|
315
|
-
let space = "string" == typeof indent ? indent : " ".repeat(indent || 0), path = [], stack = new Set(), tracking = new Map(), unpack = new Map(), valueCount = 0, { maxDepth = 100, references = !1, skipUndefinedProperties = !1, maxValues = 100000 } = options, valueToString = replacerToString(replacer), onNext = (value, key)=>{
|
|
316
|
-
if (++valueCount > maxValues || skipUndefinedProperties && void 0 === value || path.length > maxDepth) return;
|
|
317
|
-
if (void 0 === key) return valueToString(value, space, onNext, key);
|
|
318
|
-
path.push(key);
|
|
319
|
-
let result = builder(value, key === ROOT_SENTINEL ? void 0 : key);
|
|
320
|
-
return path.pop(), result;
|
|
321
|
-
}, builder = references ? (value, key)=>{
|
|
322
|
-
if (null !== value && ("object" == typeof value || "function" == typeof value || "symbol" == typeof value)) {
|
|
323
|
-
if (tracking.has(value)) return unpack.set(path.slice(1), tracking.get(value)), valueToString(void 0, space, onNext, key);
|
|
324
|
-
tracking.set(value, path.slice(1));
|
|
325
|
-
}
|
|
326
|
-
return valueToString(value, space, onNext, key);
|
|
327
|
-
} : (value, key)=>{
|
|
328
|
-
if (stack.has(value)) return;
|
|
329
|
-
stack.add(value);
|
|
330
|
-
let result = valueToString(value, space, onNext, key);
|
|
331
|
-
return stack.delete(value), result;
|
|
332
|
-
}, result = onNext(value, ROOT_SENTINEL);
|
|
333
|
-
if (unpack.size) {
|
|
334
|
-
let sp = space ? " " : "", eol = space ? "\n" : "", wrapper = `var x${sp}=${sp}${result};${eol}`;
|
|
335
|
-
for (let [key, value] of unpack.entries()){
|
|
336
|
-
let keyPath = quote_1.stringifyPath(key, onNext), valuePath = quote_1.stringifyPath(value, onNext);
|
|
337
|
-
wrapper += `x${keyPath}${sp}=${sp}x${valuePath};${eol}`;
|
|
338
|
-
}
|
|
339
|
-
return `(function${sp}()${sp}{${eol}${wrapper}return x;${eol}}())`;
|
|
340
|
-
}
|
|
341
|
-
return result;
|
|
342
|
-
};
|
|
343
|
-
},
|
|
344
|
-
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
345
|
-
Object.defineProperty(exports, "__esModule", {
|
|
346
|
-
value: !0
|
|
347
|
-
}), exports.objectToString = void 0;
|
|
348
|
-
let quote_1 = __webpack_require__("../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), function_1 = __webpack_require__("../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"), array_1 = __webpack_require__("../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js");
|
|
349
|
-
exports.objectToString = (value, space, next, key)=>{
|
|
350
|
-
if ("function" == typeof Buffer && Buffer.isBuffer(value)) return `Buffer.from(${next(value.toString("base64"))}, 'base64')`;
|
|
351
|
-
if ("object" == typeof global && value === global) return globalToString(value, space, next, key);
|
|
352
|
-
let toString = OBJECT_TYPES[Object.prototype.toString.call(value)];
|
|
353
|
-
return toString ? toString(value, space, next, key) : void 0;
|
|
354
|
-
};
|
|
355
|
-
let globalToString = (value, space, next)=>`Function(${next("return this")})()`, OBJECT_TYPES = {
|
|
356
|
-
"[object Array]": array_1.arrayToString,
|
|
357
|
-
"[object Object]": (obj, indent, next, key)=>{
|
|
358
|
-
let eol = indent ? "\n" : "", space = indent ? " " : "", values = Object.keys(obj).reduce(function(values, key) {
|
|
359
|
-
let fn = obj[key], result = next(fn, key);
|
|
360
|
-
if (void 0 === result) return values;
|
|
361
|
-
let value = result.split("\n").join(`\n${indent}`);
|
|
362
|
-
return function_1.USED_METHOD_KEY.has(fn) ? values.push(`${indent}${value}`) : values.push(`${indent}${quote_1.quoteKey(key, next)}:${space}${value}`), values;
|
|
363
|
-
}, []).join(`,${eol}`);
|
|
364
|
-
return "" === values ? "{}" : `{${eol}${values}${eol}}`;
|
|
365
|
-
},
|
|
366
|
-
"[object Error]": (error, space, next)=>`new Error(${next(error.message)})`,
|
|
367
|
-
"[object Date]": (date)=>`new Date(${date.getTime()})`,
|
|
368
|
-
"[object String]": (str, space, next)=>`new String(${next(str.toString())})`,
|
|
369
|
-
"[object Number]": (num)=>`new Number(${num})`,
|
|
370
|
-
"[object Boolean]": (bool)=>`new Boolean(${bool})`,
|
|
371
|
-
"[object Set]": (set, space, next)=>`new Set(${next(Array.from(set))})`,
|
|
372
|
-
"[object Map]": (map, space, next)=>`new Map(${next(Array.from(map))})`,
|
|
373
|
-
"[object RegExp]": String,
|
|
374
|
-
"[object global]": globalToString,
|
|
375
|
-
"[object Window]": globalToString
|
|
376
|
-
};
|
|
377
|
-
},
|
|
378
|
-
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js" (__unused_rspack_module, exports) {
|
|
379
|
-
Object.defineProperty(exports, "__esModule", {
|
|
380
|
-
value: !0
|
|
381
|
-
}), exports.stringifyPath = exports.quoteKey = exports.isValidVariableName = exports.IS_VALID_IDENTIFIER = exports.quoteString = void 0;
|
|
382
|
-
let ESCAPABLE = /[\\\'\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, META_CHARS = new Map([
|
|
383
|
-
[
|
|
384
|
-
"\b",
|
|
385
|
-
"\\b"
|
|
386
|
-
],
|
|
387
|
-
[
|
|
388
|
-
"\t",
|
|
389
|
-
"\\t"
|
|
390
|
-
],
|
|
391
|
-
[
|
|
392
|
-
"\n",
|
|
393
|
-
"\\n"
|
|
394
|
-
],
|
|
395
|
-
[
|
|
396
|
-
"\f",
|
|
397
|
-
"\\f"
|
|
398
|
-
],
|
|
399
|
-
[
|
|
400
|
-
"\r",
|
|
401
|
-
"\\r"
|
|
402
|
-
],
|
|
403
|
-
[
|
|
404
|
-
"'",
|
|
405
|
-
"\\'"
|
|
406
|
-
],
|
|
407
|
-
[
|
|
408
|
-
'"',
|
|
409
|
-
'\\"'
|
|
410
|
-
],
|
|
411
|
-
[
|
|
412
|
-
"\\",
|
|
413
|
-
"\\\\"
|
|
414
|
-
]
|
|
415
|
-
]);
|
|
416
|
-
function escapeChar(char) {
|
|
417
|
-
return META_CHARS.get(char) || `\\u${`0000${char.charCodeAt(0).toString(16)}`.slice(-4)}`;
|
|
418
|
-
}
|
|
419
|
-
exports.quoteString = function quoteString(str) {
|
|
420
|
-
return `'${str.replace(ESCAPABLE, escapeChar)}'`;
|
|
421
|
-
};
|
|
422
|
-
let RESERVED_WORDS = new Set("break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "));
|
|
423
|
-
function isValidVariableName(name) {
|
|
424
|
-
return "string" == typeof name && !RESERVED_WORDS.has(name) && exports.IS_VALID_IDENTIFIER.test(name);
|
|
425
|
-
}
|
|
426
|
-
exports.IS_VALID_IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/, exports.isValidVariableName = isValidVariableName, exports.quoteKey = function quoteKey(key, next) {
|
|
427
|
-
return isValidVariableName(key) ? key : next(key);
|
|
428
|
-
}, exports.stringifyPath = function stringifyPath(path, next) {
|
|
429
|
-
let result = "";
|
|
430
|
-
for (let key of path)isValidVariableName(key) ? result += `.${key}` : result += `[${next(key)}]`;
|
|
431
|
-
return result;
|
|
432
|
-
};
|
|
433
|
-
},
|
|
434
|
-
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
435
|
-
Object.defineProperty(exports, "__esModule", {
|
|
436
|
-
value: !0
|
|
437
|
-
}), exports.toString = void 0;
|
|
438
|
-
let quote_1 = __webpack_require__("../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), object_1 = __webpack_require__("../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js"), function_1 = __webpack_require__("../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"), PRIMITIVE_TYPES = {
|
|
439
|
-
string: quote_1.quoteString,
|
|
440
|
-
number: (value)=>Object.is(value, -0) ? "-0" : String(value),
|
|
441
|
-
boolean: String,
|
|
442
|
-
symbol: (value, space, next)=>{
|
|
443
|
-
let key = Symbol.keyFor(value);
|
|
444
|
-
return void 0 !== key ? `Symbol.for(${next(key)})` : `Symbol(${next(value.description)})`;
|
|
445
|
-
},
|
|
446
|
-
bigint: (value, space, next)=>`BigInt(${next(String(value))})`,
|
|
447
|
-
undefined: String,
|
|
448
|
-
object: object_1.objectToString,
|
|
449
|
-
function: function_1.functionToString
|
|
450
|
-
};
|
|
451
|
-
exports.toString = (value, space, next, key)=>null === value ? "null" : PRIMITIVE_TYPES[typeof value](value, space, next, key);
|
|
452
|
-
},
|
|
453
159
|
"../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
454
|
-
let path = __webpack_require__("path"), fs = __webpack_require__("fs"), os = __webpack_require__("os"), url = __webpack_require__("url"), fsReadFileAsync = fs.promises.readFile;
|
|
160
|
+
let path = __webpack_require__("path?48c6"), fs = __webpack_require__("fs?5e1e"), os = __webpack_require__("os?6427"), url = __webpack_require__("url?e527"), fsReadFileAsync = fs.promises.readFile;
|
|
455
161
|
function getDefaultSearchPlaces(name, sync) {
|
|
456
162
|
return [
|
|
457
163
|
'package.json',
|
|
@@ -483,9 +189,7 @@ __webpack_require__.add({
|
|
|
483
189
|
'.json': __rspack_createRequire_require,
|
|
484
190
|
'.cjs': __rspack_createRequire_require,
|
|
485
191
|
noExt: jsonLoader
|
|
486
|
-
})
|
|
487
|
-
module.exports.defaultLoadersSync = defaultLoadersSync;
|
|
488
|
-
let dynamicImport = async (id)=>{
|
|
192
|
+
}), dynamicImport = async (id)=>{
|
|
489
193
|
try {
|
|
490
194
|
let fileUrl = url.pathToFileURL(id).href;
|
|
491
195
|
return (await import(fileUrl)).default;
|
|
@@ -524,108 +228,22 @@ __webpack_require__.add({
|
|
|
524
228
|
let key = path.extname(place) || 'noExt', loader = conf.loaders[key];
|
|
525
229
|
if (!loader) throw Error(`Missing loader for extension "${place}"`);
|
|
526
230
|
if ('function' != typeof loader) throw Error(`Loader for extension "${place}" is not a function: Received ${typeof loader}.`);
|
|
527
|
-
}), conf;
|
|
528
|
-
}
|
|
529
|
-
function getPackageProp(props, obj) {
|
|
530
|
-
return 'string' == typeof props && props in obj ? obj[props] : (Array.isArray(props) ? props : props.split('.')).reduce((acc, prop)=>void 0 === acc ? acc : acc[prop], obj) || null;
|
|
531
|
-
}
|
|
532
|
-
function validateFilePath(filepath) {
|
|
533
|
-
if (!filepath) throw Error('load must pass a non-empty string');
|
|
534
|
-
}
|
|
535
|
-
function validateLoader(loader, ext) {
|
|
536
|
-
if (!loader) throw Error(`No loader specified for extension "${ext}"`);
|
|
537
|
-
if ('function' != typeof loader) throw Error('loader is not a function');
|
|
538
|
-
}
|
|
539
|
-
module.exports.
|
|
540
|
-
|
|
541
|
-
module.exports.lilconfig = function lilconfig(name, options) {
|
|
542
|
-
let { ignoreEmptySearchPlaces, loaders, packageProp, searchPlaces, stopDir, transform, cache } = getOptions(name, options ?? {}, !1), searchCache = new Map(), loadCache = new Map(), emplace = makeEmplace(cache);
|
|
543
|
-
return {
|
|
544
|
-
async search (searchFrom = process.cwd()) {
|
|
545
|
-
let result = {
|
|
546
|
-
config: null,
|
|
547
|
-
filepath: ''
|
|
548
|
-
}, visited = new Set(), dir = searchFrom;
|
|
549
|
-
dirLoop: for(;;){
|
|
550
|
-
if (cache) {
|
|
551
|
-
let r = searchCache.get(dir);
|
|
552
|
-
if (void 0 !== r) {
|
|
553
|
-
for (let p of visited)searchCache.set(p, r);
|
|
554
|
-
return r;
|
|
555
|
-
}
|
|
556
|
-
visited.add(dir);
|
|
557
|
-
}
|
|
558
|
-
for (let searchPlace of searchPlaces){
|
|
559
|
-
let filepath = path.join(dir, searchPlace);
|
|
560
|
-
try {
|
|
561
|
-
await fs.promises.access(filepath);
|
|
562
|
-
} catch {
|
|
563
|
-
continue;
|
|
564
|
-
}
|
|
565
|
-
let content = String(await fsReadFileAsync(filepath)), loaderKey = path.extname(searchPlace) || 'noExt', loader = loaders[loaderKey];
|
|
566
|
-
if ('package.json' === searchPlace) {
|
|
567
|
-
let maybeConfig = getPackageProp(packageProp, await loader(filepath, content));
|
|
568
|
-
if (null != maybeConfig) {
|
|
569
|
-
result.config = maybeConfig, result.filepath = filepath;
|
|
570
|
-
break dirLoop;
|
|
571
|
-
}
|
|
572
|
-
continue;
|
|
573
|
-
}
|
|
574
|
-
let isEmpty = '' === content.trim();
|
|
575
|
-
if (!isEmpty || !ignoreEmptySearchPlaces) {
|
|
576
|
-
isEmpty ? (result.isEmpty = !0, result.config = void 0) : (validateLoader(loader, loaderKey), result.config = await loader(filepath, content)), result.filepath = filepath;
|
|
577
|
-
break dirLoop;
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
if (dir === stopDir || dir === parentDir(dir)) break;
|
|
581
|
-
dir = parentDir(dir);
|
|
582
|
-
}
|
|
583
|
-
let transformed = '' === result.filepath && null === result.config ? transform(null) : transform(result);
|
|
584
|
-
if (cache) for (let p of visited)searchCache.set(p, transformed);
|
|
585
|
-
return transformed;
|
|
586
|
-
},
|
|
587
|
-
async load (filepath) {
|
|
588
|
-
validateFilePath(filepath);
|
|
589
|
-
let absPath = path.resolve(process.cwd(), filepath);
|
|
590
|
-
if (cache && loadCache.has(absPath)) return loadCache.get(absPath);
|
|
591
|
-
let { base, ext } = path.parse(absPath), loaderKey = ext || 'noExt', loader = loaders[loaderKey];
|
|
592
|
-
validateLoader(loader, loaderKey);
|
|
593
|
-
let content = String(await fsReadFileAsync(absPath));
|
|
594
|
-
if ('package.json' === base) {
|
|
595
|
-
let pkg = await loader(absPath, content);
|
|
596
|
-
return emplace(loadCache, absPath, transform({
|
|
597
|
-
config: getPackageProp(packageProp, pkg),
|
|
598
|
-
filepath: absPath
|
|
599
|
-
}));
|
|
600
|
-
}
|
|
601
|
-
let result = {
|
|
602
|
-
config: null,
|
|
603
|
-
filepath: absPath
|
|
604
|
-
}, isEmpty = '' === content.trim();
|
|
605
|
-
return isEmpty && ignoreEmptySearchPlaces ? emplace(loadCache, absPath, transform({
|
|
606
|
-
config: void 0,
|
|
607
|
-
filepath: absPath,
|
|
608
|
-
isEmpty: !0
|
|
609
|
-
})) : (result.config = isEmpty ? void 0 : await loader(absPath, content), emplace(loadCache, absPath, transform(isEmpty ? {
|
|
610
|
-
...result,
|
|
611
|
-
isEmpty,
|
|
612
|
-
config: void 0
|
|
613
|
-
} : result)));
|
|
614
|
-
},
|
|
615
|
-
clearLoadCache () {
|
|
616
|
-
cache && loadCache.clear();
|
|
617
|
-
},
|
|
618
|
-
clearSearchCache () {
|
|
619
|
-
cache && searchCache.clear();
|
|
620
|
-
},
|
|
621
|
-
clearCaches () {
|
|
622
|
-
cache && (loadCache.clear(), searchCache.clear());
|
|
623
|
-
}
|
|
624
|
-
};
|
|
625
|
-
}, module.exports.lilconfigSync = function lilconfigSync(name, options) {
|
|
626
|
-
let { ignoreEmptySearchPlaces, loaders, packageProp, searchPlaces, stopDir, transform, cache } = getOptions(name, options ?? {}, !0), searchCache = new Map(), loadCache = new Map(), emplace = makeEmplace(cache);
|
|
231
|
+
}), conf;
|
|
232
|
+
}
|
|
233
|
+
function getPackageProp(props, obj) {
|
|
234
|
+
return 'string' == typeof props && props in obj ? obj[props] : (Array.isArray(props) ? props : props.split('.')).reduce((acc, prop)=>void 0 === acc ? acc : acc[prop], obj) || null;
|
|
235
|
+
}
|
|
236
|
+
function validateFilePath(filepath) {
|
|
237
|
+
if (!filepath) throw Error('load must pass a non-empty string');
|
|
238
|
+
}
|
|
239
|
+
function validateLoader(loader, ext) {
|
|
240
|
+
if (!loader) throw Error(`No loader specified for extension "${ext}"`);
|
|
241
|
+
if ('function' != typeof loader) throw Error('loader is not a function');
|
|
242
|
+
}
|
|
243
|
+
module.exports.lilconfig = function lilconfig(name, options) {
|
|
244
|
+
let { ignoreEmptySearchPlaces, loaders, packageProp, searchPlaces, stopDir, transform, cache } = getOptions(name, options ?? {}, !1), searchCache = new Map(), loadCache = new Map(), emplace = (c, filepath, res)=>(cache && c.set(filepath, res), res);
|
|
627
245
|
return {
|
|
628
|
-
search (searchFrom = process.cwd()) {
|
|
246
|
+
async search (searchFrom = process.cwd()) {
|
|
629
247
|
let result = {
|
|
630
248
|
config: null,
|
|
631
249
|
filepath: ''
|
|
@@ -642,13 +260,13 @@ __webpack_require__.add({
|
|
|
642
260
|
for (let searchPlace of searchPlaces){
|
|
643
261
|
let filepath = path.join(dir, searchPlace);
|
|
644
262
|
try {
|
|
645
|
-
fs.
|
|
263
|
+
await fs.promises.access(filepath);
|
|
646
264
|
} catch {
|
|
647
265
|
continue;
|
|
648
266
|
}
|
|
649
|
-
let loaderKey = path.extname(searchPlace) || 'noExt', loader = loaders[loaderKey]
|
|
267
|
+
let content = String(await fsReadFileAsync(filepath)), loaderKey = path.extname(searchPlace) || 'noExt', loader = loaders[loaderKey];
|
|
650
268
|
if ('package.json' === searchPlace) {
|
|
651
|
-
let maybeConfig = getPackageProp(packageProp, loader(filepath, content));
|
|
269
|
+
let maybeConfig = getPackageProp(packageProp, await loader(filepath, content));
|
|
652
270
|
if (null != maybeConfig) {
|
|
653
271
|
result.config = maybeConfig, result.filepath = filepath;
|
|
654
272
|
break dirLoop;
|
|
@@ -657,7 +275,7 @@ __webpack_require__.add({
|
|
|
657
275
|
}
|
|
658
276
|
let isEmpty = '' === content.trim();
|
|
659
277
|
if (!isEmpty || !ignoreEmptySearchPlaces) {
|
|
660
|
-
isEmpty ? (result.isEmpty = !0, result.config = void 0) : (validateLoader(loader, loaderKey), result.config = loader(filepath, content)), result.filepath = filepath;
|
|
278
|
+
isEmpty ? (result.isEmpty = !0, result.config = void 0) : (validateLoader(loader, loaderKey), result.config = await loader(filepath, content)), result.filepath = filepath;
|
|
661
279
|
break dirLoop;
|
|
662
280
|
}
|
|
663
281
|
}
|
|
@@ -668,26 +286,29 @@ __webpack_require__.add({
|
|
|
668
286
|
if (cache) for (let p of visited)searchCache.set(p, transformed);
|
|
669
287
|
return transformed;
|
|
670
288
|
},
|
|
671
|
-
load (filepath) {
|
|
289
|
+
async load (filepath) {
|
|
672
290
|
validateFilePath(filepath);
|
|
673
291
|
let absPath = path.resolve(process.cwd(), filepath);
|
|
674
292
|
if (cache && loadCache.has(absPath)) return loadCache.get(absPath);
|
|
675
293
|
let { base, ext } = path.parse(absPath), loaderKey = ext || 'noExt', loader = loaders[loaderKey];
|
|
676
294
|
validateLoader(loader, loaderKey);
|
|
677
|
-
let content = String(
|
|
678
|
-
if ('package.json' === base)
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
295
|
+
let content = String(await fsReadFileAsync(absPath));
|
|
296
|
+
if ('package.json' === base) {
|
|
297
|
+
let pkg = await loader(absPath, content);
|
|
298
|
+
return emplace(loadCache, absPath, transform({
|
|
299
|
+
config: getPackageProp(packageProp, pkg),
|
|
300
|
+
filepath: absPath
|
|
301
|
+
}));
|
|
302
|
+
}
|
|
682
303
|
let result = {
|
|
683
304
|
config: null,
|
|
684
305
|
filepath: absPath
|
|
685
306
|
}, isEmpty = '' === content.trim();
|
|
686
307
|
return isEmpty && ignoreEmptySearchPlaces ? emplace(loadCache, absPath, transform({
|
|
687
|
-
filepath: absPath,
|
|
688
308
|
config: void 0,
|
|
309
|
+
filepath: absPath,
|
|
689
310
|
isEmpty: !0
|
|
690
|
-
})) : (result.config = isEmpty ? void 0 : loader(absPath, content), emplace(loadCache, absPath, transform(isEmpty ? {
|
|
311
|
+
})) : (result.config = isEmpty ? void 0 : await loader(absPath, content), emplace(loadCache, absPath, transform(isEmpty ? {
|
|
691
312
|
...result,
|
|
692
313
|
isEmpty,
|
|
693
314
|
config: void 0
|
|
@@ -771,8 +392,8 @@ __webpack_require__.add({
|
|
|
771
392
|
return (asyncHooks.AsyncResource && (res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')), res && res.runInAsyncScope) ? res.runInAsyncScope.bind(res, fn, null) : fn;
|
|
772
393
|
}
|
|
773
394
|
},
|
|
774
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
775
|
-
let yaml, { resolve } = __webpack_require__("node:path"), config = __webpack_require__("../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js"), loadOptions = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
395
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
396
|
+
let yaml, { resolve } = __webpack_require__("node:path?f52c"), config = __webpack_require__("../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js"), loadOptions = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/options.js"), loadPlugins = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/plugins.js"), req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/req.js");
|
|
776
397
|
async function processResult(ctx, result) {
|
|
777
398
|
let obj, file = result.filepath || '', projectConfig = ((obj = result.config) && obj.__esModule ? obj : {
|
|
778
399
|
default: obj
|
|
@@ -845,8 +466,8 @@ __webpack_require__.add({
|
|
|
845
466
|
});
|
|
846
467
|
};
|
|
847
468
|
},
|
|
848
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
849
|
-
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
469
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/options.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
470
|
+
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/req.js");
|
|
850
471
|
module.exports = async function options(config, file) {
|
|
851
472
|
if (config.parser && 'string' == typeof config.parser) try {
|
|
852
473
|
config.parser = await req(config.parser, file);
|
|
@@ -866,8 +487,8 @@ __webpack_require__.add({
|
|
|
866
487
|
return config;
|
|
867
488
|
};
|
|
868
489
|
},
|
|
869
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
870
|
-
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
490
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/plugins.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
491
|
+
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/req.js");
|
|
871
492
|
async function load(plugin, options, file) {
|
|
872
493
|
try {
|
|
873
494
|
if (null == options || 0 === Object.keys(options).length) return await req(plugin, file);
|
|
@@ -883,10 +504,10 @@ __webpack_require__.add({
|
|
|
883
504
|
}), list;
|
|
884
505
|
};
|
|
885
506
|
},
|
|
886
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
507
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/req.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
887
508
|
let tsx, jiti;
|
|
888
509
|
var __filename = __rspack_fileURLToPath(import.meta.url);
|
|
889
|
-
let { createRequire } = __webpack_require__("node:module"), { pathToFileURL } = __webpack_require__("node:url"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
|
|
510
|
+
let { createRequire } = __webpack_require__("node:module?330e"), { pathToFileURL } = __webpack_require__("node:url?3475"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
|
|
890
511
|
module.exports = async function req(name, rootFile = __filename) {
|
|
891
512
|
let url = createRequire(rootFile).resolve(name);
|
|
892
513
|
try {
|
|
@@ -917,49 +538,55 @@ __webpack_require__.add({
|
|
|
917
538
|
async_hooks (module) {
|
|
918
539
|
module.exports = __rspack_external_async_hooks;
|
|
919
540
|
},
|
|
920
|
-
|
|
921
|
-
module.exports = __rspack_external_events;
|
|
922
|
-
},
|
|
923
|
-
fs (module) {
|
|
541
|
+
"fs?5e1e" (module) {
|
|
924
542
|
module.exports = __rspack_external_fs;
|
|
925
543
|
},
|
|
926
|
-
"node:
|
|
927
|
-
module.exports = __rspack_external_node_fs_5ea92f0c;
|
|
928
|
-
},
|
|
929
|
-
"node:module" (module) {
|
|
544
|
+
"node:module?330e" (module) {
|
|
930
545
|
module.exports = __rspack_external_node_module_ab9f2194;
|
|
931
546
|
},
|
|
932
|
-
"node:
|
|
933
|
-
module.exports = __rspack_external_node_os_74b4b876;
|
|
934
|
-
},
|
|
935
|
-
"node:path" (module) {
|
|
547
|
+
"node:path?f52c" (module) {
|
|
936
548
|
module.exports = __rspack_external_node_path_c5b9b54f;
|
|
937
549
|
},
|
|
938
|
-
"node:
|
|
939
|
-
module.exports = __rspack_external_node_process_786449bf;
|
|
940
|
-
},
|
|
941
|
-
"node:tty" (module) {
|
|
942
|
-
module.exports = __rspack_external_node_tty_c64aab7e;
|
|
943
|
-
},
|
|
944
|
-
"node:url" (module) {
|
|
550
|
+
"node:url?3475" (module) {
|
|
945
551
|
module.exports = __rspack_external_node_url_e96de089;
|
|
946
552
|
},
|
|
947
|
-
os (module) {
|
|
553
|
+
"os?6427" (module) {
|
|
948
554
|
module.exports = __rspack_external_os;
|
|
949
555
|
},
|
|
950
|
-
path (module) {
|
|
556
|
+
"path?48c6" (module) {
|
|
951
557
|
module.exports = __rspack_external_path;
|
|
952
558
|
},
|
|
953
|
-
url (module) {
|
|
559
|
+
"url?e527" (module) {
|
|
954
560
|
module.exports = __rspack_external_url;
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
561
|
+
},
|
|
562
|
+
events (module) {
|
|
563
|
+
module.exports = __rspack_createRequire_require("node:events");
|
|
564
|
+
}
|
|
565
|
+
}), function checkNodeVersion() {
|
|
566
|
+
let { versions } = process;
|
|
567
|
+
if (!("styleText" in node_util) && versions.node && !versions.bun && !versions.deno) throw Error(`Unsupported Node.js version: "${process.versions.node || 'unknown'}". Expected Node.js >= 20.`);
|
|
568
|
+
}();
|
|
569
|
+
let createStyler = (style)=>(text)=>node_util.styleText(style, String(text)), color = {
|
|
570
|
+
dim: createStyler('dim'),
|
|
571
|
+
red: createStyler('red'),
|
|
572
|
+
bold: createStyler('bold'),
|
|
573
|
+
blue: createStyler('blue'),
|
|
574
|
+
cyan: createStyler('cyan'),
|
|
575
|
+
gray: createStyler('gray'),
|
|
576
|
+
black: createStyler('black'),
|
|
577
|
+
green: createStyler('green'),
|
|
578
|
+
white: createStyler('white'),
|
|
579
|
+
reset: createStyler('reset'),
|
|
580
|
+
yellow: createStyler('yellow'),
|
|
581
|
+
magenta: createStyler('magenta'),
|
|
582
|
+
underline: createStyler('underline'),
|
|
583
|
+
strikethrough: createStyler('strikethrough')
|
|
584
|
+
};
|
|
585
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.argv) {
|
|
959
586
|
let prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--', position = argv.indexOf(prefix + flag), terminatorPosition = argv.indexOf('--');
|
|
960
587
|
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
961
588
|
}
|
|
962
|
-
let { env: dist_env } =
|
|
589
|
+
let { env: dist_env } = node_process;
|
|
963
590
|
function envForceColor() {
|
|
964
591
|
if (!('FORCE_COLOR' in dist_env)) return;
|
|
965
592
|
if ('true' === dist_env.FORCE_COLOR) return 1;
|
|
@@ -994,8 +621,8 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = !0 } = {}) {
|
|
|
994
621
|
if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
|
|
995
622
|
let min = forceColor || 0;
|
|
996
623
|
if ('dumb' === dist_env.TERM) return min;
|
|
997
|
-
if ('win32' ===
|
|
998
|
-
let osRelease =
|
|
624
|
+
if ('win32' === node_process.platform) {
|
|
625
|
+
let osRelease = node_os.release().split('.');
|
|
999
626
|
return Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586 ? Number(osRelease[2]) >= 14931 ? 3 : 2 : 1;
|
|
1000
627
|
}
|
|
1001
628
|
if ('CI' in dist_env) return [
|
|
@@ -1031,10 +658,10 @@ function createSupportsColor(stream, options = {}) {
|
|
|
1031
658
|
hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never') ? flagForceColor = 0 : (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) && (flagForceColor = 1);
|
|
1032
659
|
let supportsColor = {
|
|
1033
660
|
stdout: createSupportsColor({
|
|
1034
|
-
isTTY:
|
|
661
|
+
isTTY: node_tty.isatty(1)
|
|
1035
662
|
}),
|
|
1036
663
|
stderr: createSupportsColor({
|
|
1037
|
-
isTTY:
|
|
664
|
+
isTTY: node_tty.isatty(2)
|
|
1038
665
|
})
|
|
1039
666
|
}, colorLevel = supportsColor.stdout ? supportsColor.stdout.level : 0, errorStackRegExp = /at [^\r\n]{0,200}:\d+:\d+[\s\)]*$/, anonymousErrorStackRegExp = /at [^\r\n]{0,200}\(<anonymous>\)$/, indexErrorStackRegExp = /at [^\r\n]{0,200}\(index\s\d+\)$/, isWord = (char)=>!/[\s\n]/.test(char), LOG_LEVEL = {
|
|
1040
667
|
silent: -1,
|
|
@@ -1047,32 +674,32 @@ let supportsColor = {
|
|
|
1047
674
|
error: {
|
|
1048
675
|
label: 'error',
|
|
1049
676
|
level: 'error',
|
|
1050
|
-
color: red
|
|
677
|
+
color: color.red
|
|
1051
678
|
},
|
|
1052
679
|
warn: {
|
|
1053
680
|
label: 'warn',
|
|
1054
681
|
level: 'warn',
|
|
1055
|
-
color: yellow
|
|
682
|
+
color: color.yellow
|
|
1056
683
|
},
|
|
1057
684
|
info: {
|
|
1058
685
|
label: 'info',
|
|
1059
686
|
level: 'info',
|
|
1060
|
-
color: cyan
|
|
687
|
+
color: color.cyan
|
|
1061
688
|
},
|
|
1062
689
|
start: {
|
|
1063
690
|
label: 'start',
|
|
1064
691
|
level: 'info',
|
|
1065
|
-
color: cyan
|
|
692
|
+
color: color.cyan
|
|
1066
693
|
},
|
|
1067
694
|
ready: {
|
|
1068
695
|
label: 'ready',
|
|
1069
696
|
level: 'info',
|
|
1070
|
-
color: green
|
|
697
|
+
color: color.green
|
|
1071
698
|
},
|
|
1072
699
|
success: {
|
|
1073
700
|
label: 'success',
|
|
1074
701
|
level: 'info',
|
|
1075
|
-
color: green
|
|
702
|
+
color: color.green
|
|
1076
703
|
},
|
|
1077
704
|
log: {
|
|
1078
705
|
level: 'info'
|
|
@@ -1080,12 +707,12 @@ let supportsColor = {
|
|
|
1080
707
|
debug: {
|
|
1081
708
|
label: 'debug',
|
|
1082
709
|
level: 'verbose',
|
|
1083
|
-
color: magenta
|
|
710
|
+
color: color.magenta
|
|
1084
711
|
}
|
|
1085
712
|
}, normalizeErrorMessage = (err)=>{
|
|
1086
713
|
if (err.stack) {
|
|
1087
714
|
let [name, ...rest] = err.stack.split('\n');
|
|
1088
|
-
return name.startsWith('Error: ') && (name = name.slice(7)), `${name}\n${gray(rest.join('\n'))}`;
|
|
715
|
+
return name.startsWith('Error: ') && (name = name.slice(7)), `${name}\n${color.gray(rest.join('\n'))}`;
|
|
1089
716
|
}
|
|
1090
717
|
return err.message;
|
|
1091
718
|
}, src_logger = ((options = {})=>{
|
|
@@ -1094,20 +721,20 @@ let supportsColor = {
|
|
|
1094
721
|
if (LOG_LEVEL[level] > LOG_LEVEL[maxLevel]) return;
|
|
1095
722
|
if (null == message) return console.log();
|
|
1096
723
|
let label = '', text = '';
|
|
1097
|
-
if ('label' in logType && (label = (logType.label || '').padEnd(7), label = bold(logType.color ? logType.color(label) : label)), message instanceof Error) {
|
|
724
|
+
if ('label' in logType && (label = (logType.label || '').padEnd(7), label = color.bold(logType.color ? logType.color(label) : label)), message instanceof Error) {
|
|
1098
725
|
text += normalizeErrorMessage(message);
|
|
1099
726
|
let { cause } = message;
|
|
1100
|
-
cause && (text += yellow('\n [cause]: '), text += cause instanceof Error ? normalizeErrorMessage(cause) : String(cause));
|
|
1101
|
-
} else text = 'error' === level && 'string' == typeof message ? message.split('\n').map((line)=>errorStackRegExp.test(line) || anonymousErrorStackRegExp.test(line) || indexErrorStackRegExp.test(line) ? gray(line) : line).join('\n') : `${message}`;
|
|
727
|
+
cause && (text += color.yellow('\n [cause]: '), text += cause instanceof Error ? normalizeErrorMessage(cause) : String(cause));
|
|
728
|
+
} else text = 'error' === level && 'string' == typeof message ? message.split('\n').map((line)=>errorStackRegExp.test(line) || anonymousErrorStackRegExp.test(line) || indexErrorStackRegExp.test(line) ? color.gray(line) : line).join('\n') : `${message}`;
|
|
1102
729
|
console['error' === level || 'warn' === level ? level : 'log'](label.length ? `${label} ${text}` : text, ...args);
|
|
1103
730
|
}, logger = {
|
|
1104
731
|
greet: (message)=>log('log', ((message)=>{
|
|
1105
|
-
if (colorLevel < 3) return 2 === colorLevel ?
|
|
732
|
+
if (colorLevel < 3) return 2 === colorLevel ? color.cyan(message) : message;
|
|
1106
733
|
let chars = [
|
|
1107
734
|
...message
|
|
1108
735
|
], steps = chars.filter(isWord).length, r = 189, g = 255, b = 243, rStep = -115 / steps, gStep = -61 / steps, bStep = -89 / steps, output = '';
|
|
1109
736
|
for (let char of chars)isWord(char) && (r += rStep, g += gStep, b += bStep), output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
|
|
1110
|
-
return bold(output);
|
|
737
|
+
return color.bold(output);
|
|
1111
738
|
})(message))
|
|
1112
739
|
};
|
|
1113
740
|
return Object.keys(LOG_TYPES).forEach((key)=>{
|
|
@@ -1120,18 +747,7 @@ let supportsColor = {
|
|
|
1120
747
|
}), logger.override = (customLogger)=>{
|
|
1121
748
|
Object.assign(logger, customLogger);
|
|
1122
749
|
}, logger;
|
|
1123
|
-
})(),
|
|
1124
|
-
red: color_createStyler('red'),
|
|
1125
|
-
yellow: color_createStyler('yellow'),
|
|
1126
|
-
green: color_createStyler('green'),
|
|
1127
|
-
blue: color_createStyler('blue'),
|
|
1128
|
-
magenta: color_createStyler('magenta'),
|
|
1129
|
-
cyan: color_createStyler('cyan'),
|
|
1130
|
-
gray: color_createStyler('gray'),
|
|
1131
|
-
dim: color_createStyler('dim'),
|
|
1132
|
-
bold: color_createStyler('bold'),
|
|
1133
|
-
underline: color_createStyler('underline')
|
|
1134
|
-
}, isDebug = ()=>{
|
|
750
|
+
})(), isDebug = ()=>{
|
|
1135
751
|
if (!process.env.DEBUG) return !1;
|
|
1136
752
|
let values = process.env.DEBUG.toLocaleLowerCase().split(',');
|
|
1137
753
|
return [
|
|
@@ -1144,27 +760,19 @@ function getTime() {
|
|
|
1144
760
|
let now = new Date(), hours = String(now.getHours()).padStart(2, '0'), minutes = String(now.getMinutes()).padStart(2, '0'), seconds = String(now.getSeconds()).padStart(2, '0');
|
|
1145
761
|
return `${hours}:${minutes}:${seconds}`;
|
|
1146
762
|
}
|
|
1147
|
-
isDebug() && (src_logger.level = 'verbose'), src_logger.override({
|
|
1148
|
-
debug: (message, ...args)=>{
|
|
1149
|
-
if ('verbose' !== src_logger.level) return;
|
|
1150
|
-
let time = color.gray(getTime());
|
|
1151
|
-
console.log(` ${color.magenta('rsbuild')} ${time} ${message}`, ...args);
|
|
1152
|
-
}
|
|
1153
|
-
});
|
|
1154
|
-
let external_events_ = __webpack_require__("events");
|
|
1155
763
|
function toArr(any) {
|
|
1156
764
|
return null == any ? [] : Array.isArray(any) ? any : [
|
|
1157
765
|
any
|
|
1158
766
|
];
|
|
1159
767
|
}
|
|
1160
768
|
function toVal(out, key, val, opts) {
|
|
1161
|
-
var x, old = out[key], nxt = ~opts.string.indexOf(key) ? null == val || !0 === val ?
|
|
769
|
+
var x, old = out[key], nxt = ~opts.string.indexOf(key) ? null == val || !0 === val ? "" : String(val) : "boolean" == typeof val ? val : ~opts.boolean.indexOf(key) ? "false" !== val && ("true" === val || (out._.push(0 * (x = +val) == 0 ? x : val), !!val)) : 0 * (x = +val) == 0 ? x : val;
|
|
1162
770
|
out[key] = null == old ? nxt : Array.isArray(old) ? old.concat(nxt) : [
|
|
1163
771
|
old,
|
|
1164
772
|
nxt
|
|
1165
773
|
];
|
|
1166
774
|
}
|
|
1167
|
-
function
|
|
775
|
+
function lib_default(args, opts) {
|
|
1168
776
|
opts = opts || {};
|
|
1169
777
|
var k, arr, arg, name, val, out = {
|
|
1170
778
|
_: []
|
|
@@ -1178,21 +786,21 @@ function mri2(args, opts) {
|
|
|
1178
786
|
}
|
|
1179
787
|
let keys = strict ? Object.keys(opts.alias) : [];
|
|
1180
788
|
for(i = 0; i < len; i++){
|
|
1181
|
-
if (
|
|
789
|
+
if ("--" === (arg = args[i])) {
|
|
1182
790
|
out._ = out._.concat(args.slice(++i));
|
|
1183
791
|
break;
|
|
1184
792
|
}
|
|
1185
793
|
for(j = 0; j < arg.length && 45 === arg.charCodeAt(j); j++);
|
|
1186
794
|
if (0 === j) out._.push(arg);
|
|
1187
|
-
else if (
|
|
795
|
+
else if ("no-" === arg.substring(j, j + 3)) {
|
|
1188
796
|
if (name = arg.substring(j + 3), strict && !~keys.indexOf(name)) return opts.unknown(arg);
|
|
1189
797
|
out[name] = !1;
|
|
1190
798
|
} else {
|
|
1191
799
|
for(idx = j + 1; idx < arg.length && 61 !== arg.charCodeAt(idx); idx++);
|
|
1192
|
-
for(name = arg.substring(j, idx), val = arg.substring(++idx) || i + 1 === len || 45 === (
|
|
800
|
+
for(name = arg.substring(j, idx), val = arg.substring(++idx) || i + 1 === len || 45 === ("" + args[i + 1]).charCodeAt(0) || args[++i], arr = 2 === j ? [
|
|
1193
801
|
name
|
|
1194
802
|
] : name, idx = 0; idx < arr.length; idx++){
|
|
1195
|
-
if (name = arr[idx], strict && !~keys.indexOf(name)) return opts.unknown(
|
|
803
|
+
if (name = arr[idx], strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
|
|
1196
804
|
toVal(out, name, idx + 1 < arr.length || val, opts);
|
|
1197
805
|
}
|
|
1198
806
|
}
|
|
@@ -1201,44 +809,117 @@ function mri2(args, opts) {
|
|
|
1201
809
|
if (alibi) for(k in out)for(arr = opts.alias[k] || []; arr.length > 0;)out[arr.shift()] = out[k];
|
|
1202
810
|
return out;
|
|
1203
811
|
}
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
812
|
+
function removeBrackets(v) {
|
|
813
|
+
return v.replace(/[<[].+/, "").trim();
|
|
814
|
+
}
|
|
815
|
+
function findAllBrackets(v) {
|
|
816
|
+
let angledMatch, squareMatch, ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g, SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g, res = [], parse = (match)=>{
|
|
817
|
+
let variadic = !1, value = match[1];
|
|
818
|
+
return value.startsWith("...") && (value = value.slice(3), variadic = !0), {
|
|
819
|
+
required: match[0].startsWith("<"),
|
|
820
|
+
value,
|
|
821
|
+
variadic
|
|
822
|
+
};
|
|
823
|
+
};
|
|
824
|
+
for(; angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v);)res.push(parse(angledMatch));
|
|
825
|
+
for(; squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v);)res.push(parse(squareMatch));
|
|
826
|
+
return res;
|
|
827
|
+
}
|
|
828
|
+
function getMriOptions(options) {
|
|
829
|
+
let result = {
|
|
830
|
+
alias: {},
|
|
831
|
+
boolean: []
|
|
832
|
+
};
|
|
833
|
+
for (let [index, option] of options.entries())option.names.length > 1 && (result.alias[option.names[0]] = option.names.slice(1)), option.isBoolean && (option.negated && options.some((o, i)=>i !== index && o.names.some((name)=>option.names.includes(name)) && "boolean" == typeof o.required) || result.boolean.push(option.names[0]));
|
|
834
|
+
return result;
|
|
835
|
+
}
|
|
836
|
+
function findLongest(arr) {
|
|
837
|
+
return arr.sort((a, b)=>a.length > b.length ? -1 : 1)[0];
|
|
838
|
+
}
|
|
839
|
+
function padRight(str, length) {
|
|
840
|
+
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
|
|
841
|
+
}
|
|
842
|
+
function camelcase(input) {
|
|
843
|
+
return input.replaceAll(/([a-z])-([a-z])/g, (_, p1, p2)=>p1 + p2.toUpperCase());
|
|
844
|
+
}
|
|
845
|
+
function setDotProp(obj, keys, val) {
|
|
846
|
+
let current = obj;
|
|
847
|
+
for(let i = 0; i < keys.length; i++){
|
|
848
|
+
let key = keys[i];
|
|
849
|
+
if (i === keys.length - 1) {
|
|
850
|
+
current[key] = val;
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
853
|
+
if (null == current[key]) {
|
|
854
|
+
let nextKeyIsArrayIndex = +keys[i + 1] > -1;
|
|
855
|
+
current[key] = nextKeyIsArrayIndex ? [] : {};
|
|
856
|
+
}
|
|
857
|
+
current = current[key];
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
function setByType(obj, transforms) {
|
|
1208
861
|
for (let key of Object.keys(transforms)){
|
|
1209
862
|
let transform = transforms[key];
|
|
1210
|
-
transform.shouldTransform && (obj[key] =
|
|
863
|
+
transform.shouldTransform && (obj[key] = [
|
|
864
|
+
obj[key]
|
|
865
|
+
].flat(), "function" == typeof transform.transformFunction && (obj[key] = obj[key].map(transform.transformFunction)));
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
function getFileName(input) {
|
|
869
|
+
let m = /([^\\/]+)$/.exec(input);
|
|
870
|
+
return m ? m[1] : "";
|
|
871
|
+
}
|
|
872
|
+
function camelcaseOptionName(name) {
|
|
873
|
+
return name.split(".").map((v, i)=>0 === i ? camelcase(v) : v).join(".");
|
|
874
|
+
}
|
|
875
|
+
isDebug() && (src_logger.level = 'verbose'), src_logger.override({
|
|
876
|
+
debug: (message, ...args)=>{
|
|
877
|
+
if ('verbose' !== src_logger.level) return;
|
|
878
|
+
let time = color.gray(getTime());
|
|
879
|
+
console.log(` ${color.magenta('rsbuild')} ${time} ${message}`, ...args);
|
|
1211
880
|
}
|
|
1212
|
-
}
|
|
1213
|
-
|
|
881
|
+
});
|
|
882
|
+
var superClass, superClass1, CACError = class extends Error {
|
|
1214
883
|
constructor(message){
|
|
1215
|
-
super(message), this.name =
|
|
884
|
+
super(message), this.name = "CACError", "function" != typeof Error.captureStackTrace && (this.stack = Error(message).stack);
|
|
1216
885
|
}
|
|
1217
|
-
}
|
|
1218
|
-
|
|
886
|
+
}, Option = class {
|
|
887
|
+
rawName;
|
|
888
|
+
description;
|
|
889
|
+
name;
|
|
890
|
+
names;
|
|
891
|
+
isBoolean;
|
|
892
|
+
required;
|
|
893
|
+
config;
|
|
894
|
+
negated;
|
|
1219
895
|
constructor(rawName, description, config){
|
|
1220
|
-
this.rawName = rawName, this.description = description, this.config = Object.assign({}, config), rawName = rawName.
|
|
896
|
+
this.rawName = rawName, this.description = description, this.config = Object.assign({}, config), rawName = rawName.replaceAll(".*", ""), this.negated = !1, this.names = removeBrackets(rawName).split(",").map((v)=>{
|
|
1221
897
|
let name = v.trim().replace(/^-{1,2}/, "");
|
|
1222
898
|
return name.startsWith("no-") && (this.negated = !0, name = name.replace(/^no-/, "")), camelcaseOptionName(name);
|
|
1223
|
-
}).sort((a, b)=>a.length > b.length ? 1 : -1), this.name = this.names
|
|
899
|
+
}).sort((a, b)=>a.length > b.length ? 1 : -1), this.name = this.names.at(-1), this.negated && null == this.config.default && (this.config.default = !0), rawName.includes("<") ? this.required = !0 : rawName.includes("[") ? this.required = !1 : this.isBoolean = !0;
|
|
1224
900
|
}
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
|
|
901
|
+
};
|
|
902
|
+
if ("u" > typeof process) {
|
|
903
|
+
let runtimeName;
|
|
904
|
+
runtimeName = "u" > typeof Deno && "string" == typeof Deno.version?.deno ? "deno" : "u" > typeof Bun && "string" == typeof Bun.version ? "bun" : "node", runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`, runtimeProcessArgs = process.argv;
|
|
905
|
+
} else runtimeInfo = "u" < typeof navigator ? "unknown" : `${navigator.platform} ${navigator.userAgent}`;
|
|
906
|
+
var Command = class {
|
|
907
|
+
rawName;
|
|
908
|
+
description;
|
|
909
|
+
config;
|
|
910
|
+
cli;
|
|
911
|
+
options;
|
|
912
|
+
aliasNames;
|
|
913
|
+
name;
|
|
914
|
+
args;
|
|
915
|
+
commandAction;
|
|
916
|
+
usageText;
|
|
917
|
+
versionNumber;
|
|
918
|
+
examples;
|
|
919
|
+
helpCallback;
|
|
920
|
+
globalCommand;
|
|
1228
921
|
constructor(rawName, description, config = {}, cli){
|
|
1229
|
-
this.rawName = rawName, this.description = description, this.config = config, this.cli = cli, this.options = [], this.aliasNames = [], this.name = removeBrackets(rawName), this.args = (
|
|
1230
|
-
let angledMatch, squareMatch, ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g, SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g, res = [], parse = (match)=>{
|
|
1231
|
-
let variadic = !1, value = match[1];
|
|
1232
|
-
return value.startsWith("...") && (value = value.slice(3), variadic = !0), {
|
|
1233
|
-
required: match[0].startsWith("<"),
|
|
1234
|
-
value,
|
|
1235
|
-
variadic
|
|
1236
|
-
};
|
|
1237
|
-
};
|
|
1238
|
-
for(; angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v);)res.push(parse(angledMatch));
|
|
1239
|
-
for(; squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v);)res.push(parse(squareMatch));
|
|
1240
|
-
return res;
|
|
1241
|
-
})(rawName), this.examples = [];
|
|
922
|
+
this.rawName = rawName, this.description = description, this.config = config, this.cli = cli, this.options = [], this.aliasNames = [], this.name = removeBrackets(rawName), this.args = findAllBrackets(rawName), this.examples = [];
|
|
1242
923
|
}
|
|
1243
924
|
usage(text) {
|
|
1244
925
|
return this.usageText = text, this;
|
|
@@ -1291,221 +972,612 @@ class Command {
|
|
|
1291
972
|
sections.push({
|
|
1292
973
|
title: "Commands",
|
|
1293
974
|
body: commands.map((command)=>` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`).join("\n")
|
|
1294
|
-
}
|
|
975
|
+
}, {
|
|
1295
976
|
title: "For more info, run any command with the `--help` flag",
|
|
1296
977
|
body: commands.map((command)=>` $ ${name}${"" === command.name ? "" : ` ${command.name}`} --help`).join("\n")
|
|
1297
978
|
});
|
|
1298
979
|
}
|
|
1299
|
-
let options = this.isGlobalCommand ? globalOptions : [
|
|
1300
|
-
...this.options,
|
|
1301
|
-
...globalOptions || []
|
|
1302
|
-
];
|
|
1303
|
-
if (this.isGlobalCommand || this.isDefaultCommand || (options = options.filter((option)=>"version" !== option.name)), options.length > 0) {
|
|
1304
|
-
let longestOptionName = findLongest(options.map((option)=>option.rawName));
|
|
1305
|
-
sections.push({
|
|
1306
|
-
title: "Options",
|
|
1307
|
-
body: options.map((option)=>` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${void 0 === option.config.default ? "" : `(default: ${option.config.default})`}`).join("\n")
|
|
980
|
+
let options = this.isGlobalCommand ? globalOptions : [
|
|
981
|
+
...this.options,
|
|
982
|
+
...globalOptions || []
|
|
983
|
+
];
|
|
984
|
+
if (this.isGlobalCommand || this.isDefaultCommand || (options = options.filter((option)=>"version" !== option.name)), options.length > 0) {
|
|
985
|
+
let longestOptionName = findLongest(options.map((option)=>option.rawName));
|
|
986
|
+
sections.push({
|
|
987
|
+
title: "Options",
|
|
988
|
+
body: options.map((option)=>` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${void 0 === option.config.default ? "" : `(default: ${option.config.default})`}`).join("\n")
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
this.examples.length > 0 && sections.push({
|
|
992
|
+
title: "Examples",
|
|
993
|
+
body: this.examples.map((example)=>"function" == typeof example ? example(name) : example).join("\n")
|
|
994
|
+
}), helpCallback && (sections = helpCallback(sections) || sections), console.info(sections.map((section)=>section.title ? `${section.title}:\n${section.body}` : section.body).join("\n\n"));
|
|
995
|
+
}
|
|
996
|
+
outputVersion() {
|
|
997
|
+
let { name } = this.cli, { versionNumber } = this.cli.globalCommand;
|
|
998
|
+
versionNumber && console.info(`${name}/${versionNumber} ${runtimeInfo}`);
|
|
999
|
+
}
|
|
1000
|
+
checkRequiredArgs() {
|
|
1001
|
+
let minimalArgsCount = this.args.filter((arg)=>arg.required).length;
|
|
1002
|
+
if (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \`${this.rawName}\``);
|
|
1003
|
+
}
|
|
1004
|
+
checkUnknownOptions() {
|
|
1005
|
+
let { options, globalCommand } = this.cli;
|
|
1006
|
+
if (!this.config.allowUnknownOptions) {
|
|
1007
|
+
for (let name of Object.keys(options))if ("--" !== name && !this.hasOption(name) && !globalCommand.hasOption(name)) throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
checkOptionValue() {
|
|
1011
|
+
let { options: parsedOptions, globalCommand } = this.cli, options = [
|
|
1012
|
+
...globalCommand.options,
|
|
1013
|
+
...this.options
|
|
1014
|
+
];
|
|
1015
|
+
for (let option of options){
|
|
1016
|
+
let value = parsedOptions[option.name.split(".")[0]];
|
|
1017
|
+
if (option.required) {
|
|
1018
|
+
let hasNegated = options.some((o)=>o.negated && o.names.includes(option.name));
|
|
1019
|
+
if (!0 === value || !1 === value && !hasNegated) throw new CACError(`option \`${option.rawName}\` value is missing`);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
checkUnusedArgs() {
|
|
1024
|
+
let maximumArgsCount = this.args.some((arg)=>arg.variadic) ? 1 / 0 : this.args.length;
|
|
1025
|
+
if (maximumArgsCount < this.cli.args.length) throw new CACError(`Unused args: ${this.cli.args.slice(maximumArgsCount).map((arg)=>`\`${arg}\``).join(", ")}`);
|
|
1026
|
+
}
|
|
1027
|
+
}, GlobalCommand = class extends Command {
|
|
1028
|
+
constructor(cli){
|
|
1029
|
+
super("@@global@@", "", {}, cli);
|
|
1030
|
+
}
|
|
1031
|
+
}, CAC = class extends EventTarget {
|
|
1032
|
+
name;
|
|
1033
|
+
commands;
|
|
1034
|
+
globalCommand;
|
|
1035
|
+
matchedCommand;
|
|
1036
|
+
matchedCommandName;
|
|
1037
|
+
rawArgs;
|
|
1038
|
+
args;
|
|
1039
|
+
options;
|
|
1040
|
+
showHelpOnExit;
|
|
1041
|
+
showVersionOnExit;
|
|
1042
|
+
constructor(name = ""){
|
|
1043
|
+
super(), this.name = name, this.commands = [], this.rawArgs = [], this.args = [], this.options = {}, this.globalCommand = new GlobalCommand(this), this.globalCommand.usage("<command> [options]");
|
|
1044
|
+
}
|
|
1045
|
+
usage(text) {
|
|
1046
|
+
return this.globalCommand.usage(text), this;
|
|
1047
|
+
}
|
|
1048
|
+
command(rawName, description, config) {
|
|
1049
|
+
let command = new Command(rawName, description || "", config, this);
|
|
1050
|
+
return command.globalCommand = this.globalCommand, this.commands.push(command), command;
|
|
1051
|
+
}
|
|
1052
|
+
option(rawName, description, config) {
|
|
1053
|
+
return this.globalCommand.option(rawName, description, config), this;
|
|
1054
|
+
}
|
|
1055
|
+
help(callback) {
|
|
1056
|
+
return this.globalCommand.option("-h, --help", "Display this message"), this.globalCommand.helpCallback = callback, this.showHelpOnExit = !0, this;
|
|
1057
|
+
}
|
|
1058
|
+
version(version, customFlags = "-v, --version") {
|
|
1059
|
+
return this.globalCommand.version(version, customFlags), this.showVersionOnExit = !0, this;
|
|
1060
|
+
}
|
|
1061
|
+
example(example) {
|
|
1062
|
+
return this.globalCommand.example(example), this;
|
|
1063
|
+
}
|
|
1064
|
+
outputHelp() {
|
|
1065
|
+
this.matchedCommand ? this.matchedCommand.outputHelp() : this.globalCommand.outputHelp();
|
|
1066
|
+
}
|
|
1067
|
+
outputVersion() {
|
|
1068
|
+
this.globalCommand.outputVersion();
|
|
1069
|
+
}
|
|
1070
|
+
setParsedInfo({ args, options }, matchedCommand, matchedCommandName) {
|
|
1071
|
+
return this.args = args, this.options = options, matchedCommand && (this.matchedCommand = matchedCommand), matchedCommandName && (this.matchedCommandName = matchedCommandName), this;
|
|
1072
|
+
}
|
|
1073
|
+
unsetMatchedCommand() {
|
|
1074
|
+
this.matchedCommand = void 0, this.matchedCommandName = void 0;
|
|
1075
|
+
}
|
|
1076
|
+
parse(argv, { run = !0 } = {}) {
|
|
1077
|
+
if (!argv) {
|
|
1078
|
+
if (!runtimeProcessArgs) throw Error("No argv provided and runtime process argv is not available.");
|
|
1079
|
+
argv = runtimeProcessArgs;
|
|
1080
|
+
}
|
|
1081
|
+
this.rawArgs = argv, this.name || (this.name = argv[1] ? getFileName(argv[1]) : "cli");
|
|
1082
|
+
let shouldParse = !0;
|
|
1083
|
+
for (let command of this.commands){
|
|
1084
|
+
let parsed = this.mri(argv.slice(2), command), commandName = parsed.args[0];
|
|
1085
|
+
if (command.isMatched(commandName)) {
|
|
1086
|
+
shouldParse = !1;
|
|
1087
|
+
let parsedInfo = {
|
|
1088
|
+
...parsed,
|
|
1089
|
+
args: parsed.args.slice(1)
|
|
1090
|
+
};
|
|
1091
|
+
this.setParsedInfo(parsedInfo, command, commandName), this.dispatchEvent(new CustomEvent(`command:${commandName}`, {
|
|
1092
|
+
detail: command
|
|
1093
|
+
}));
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
if (shouldParse) {
|
|
1097
|
+
for (let command of this.commands)if (command.isDefaultCommand) {
|
|
1098
|
+
shouldParse = !1;
|
|
1099
|
+
let parsed = this.mri(argv.slice(2), command);
|
|
1100
|
+
this.setParsedInfo(parsed, command), this.dispatchEvent(new CustomEvent("command:!", {
|
|
1101
|
+
detail: command
|
|
1102
|
+
}));
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
if (shouldParse) {
|
|
1106
|
+
let parsed = this.mri(argv.slice(2));
|
|
1107
|
+
this.setParsedInfo(parsed);
|
|
1108
|
+
}
|
|
1109
|
+
this.options.help && this.showHelpOnExit && (this.outputHelp(), run = !1, this.unsetMatchedCommand()), this.options.version && this.showVersionOnExit && null == this.matchedCommandName && (this.outputVersion(), run = !1, this.unsetMatchedCommand());
|
|
1110
|
+
let parsedArgv = {
|
|
1111
|
+
args: this.args,
|
|
1112
|
+
options: this.options
|
|
1113
|
+
};
|
|
1114
|
+
return run && this.runMatchedCommand(), !this.matchedCommand && this.args[0] && this.dispatchEvent(new CustomEvent("command:*", {
|
|
1115
|
+
detail: this.args[0]
|
|
1116
|
+
})), parsedArgv;
|
|
1117
|
+
}
|
|
1118
|
+
mri(argv, command) {
|
|
1119
|
+
let cliOptions = [
|
|
1120
|
+
...this.globalCommand.options,
|
|
1121
|
+
...command ? command.options : []
|
|
1122
|
+
], mriOptions = getMriOptions(cliOptions), argsAfterDoubleDashes = [], doubleDashesIndex = argv.indexOf("--");
|
|
1123
|
+
-1 !== doubleDashesIndex && (argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1), argv = argv.slice(0, doubleDashesIndex));
|
|
1124
|
+
let parsed = lib_default(argv, mriOptions), args = (parsed = Object.keys(parsed).reduce((res, name)=>({
|
|
1125
|
+
...res,
|
|
1126
|
+
[camelcaseOptionName(name)]: parsed[name]
|
|
1127
|
+
}), {
|
|
1128
|
+
_: []
|
|
1129
|
+
}))._, options = {
|
|
1130
|
+
"--": argsAfterDoubleDashes
|
|
1131
|
+
}, ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue, transforms = Object.create(null);
|
|
1132
|
+
for (let cliOption of cliOptions){
|
|
1133
|
+
if (!ignoreDefault && void 0 !== cliOption.config.default) for (let name of cliOption.names)options[name] = cliOption.config.default;
|
|
1134
|
+
Array.isArray(cliOption.config.type) && void 0 === transforms[cliOption.name] && (transforms[cliOption.name] = Object.create(null), transforms[cliOption.name].shouldTransform = !0, transforms[cliOption.name].transformFunction = cliOption.config.type[0]);
|
|
1135
|
+
}
|
|
1136
|
+
for (let key of Object.keys(parsed))"_" !== key && (setDotProp(options, key.split("."), parsed[key]), setByType(options, transforms));
|
|
1137
|
+
return {
|
|
1138
|
+
args,
|
|
1139
|
+
options
|
|
1140
|
+
};
|
|
1141
|
+
}
|
|
1142
|
+
runMatchedCommand() {
|
|
1143
|
+
let { args, options, matchedCommand: command } = this;
|
|
1144
|
+
if (!command || !command.commandAction) return;
|
|
1145
|
+
command.checkUnknownOptions(), command.checkOptionValue(), command.checkRequiredArgs(), command.checkUnusedArgs();
|
|
1146
|
+
let actionArgs = [];
|
|
1147
|
+
return command.args.forEach((arg, index)=>{
|
|
1148
|
+
arg.variadic ? actionArgs.push(args.slice(index)) : actionArgs.push(args[index]);
|
|
1149
|
+
}), actionArgs.push(options), command.commandAction.apply(this, actionArgs);
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
let isDeno = "u" > typeof Deno, isWindows = 'win32' === process.platform, ROOT_DIST_DIR = 'dist', dirname = import.meta.dirname, STATIC_PATH = join(dirname, '../static'), CLIENT_PATH = join(dirname, 'client'), COMPILED_PATH = join(dirname, '../compiled'), RSBUILD_OUTPUTS_PATH = '.rsbuild', LOCALHOST = 'localhost', ALL_INTERFACES_IPV4 = '0.0.0.0', DEFAULT_ASSET_PREFIX = '/', DEFAULT_STACK_TRACE = 'summary', DEFAULT_WEB_BROWSERSLIST = [
|
|
1153
|
+
'chrome >= 107',
|
|
1154
|
+
'edge >= 107',
|
|
1155
|
+
'firefox >= 104',
|
|
1156
|
+
'safari >= 16'
|
|
1157
|
+
], DEFAULT_BROWSERSLIST = {
|
|
1158
|
+
web: DEFAULT_WEB_BROWSERSLIST,
|
|
1159
|
+
'web-worker': DEFAULT_WEB_BROWSERSLIST,
|
|
1160
|
+
node: [
|
|
1161
|
+
'node >= 20'
|
|
1162
|
+
]
|
|
1163
|
+
}, JS_REGEX = /\.(?:js|mjs|cjs|jsx)$/, SCRIPT_REGEX = /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/, CSS_REGEX = /\.css$/, RAW_QUERY_REGEX = /[?&]raw(?:&|=|$)/, INLINE_QUERY_REGEX = /[?&]inline(?:&|=|$)/, NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/, PLUGIN_SWC_NAME = 'rsbuild:swc', PLUGIN_CSS_NAME = 'rsbuild:css', FONT_EXTENSIONS = [
|
|
1164
|
+
'woff',
|
|
1165
|
+
'woff2',
|
|
1166
|
+
'eot',
|
|
1167
|
+
'ttf',
|
|
1168
|
+
'otf',
|
|
1169
|
+
'ttc'
|
|
1170
|
+
], IMAGE_EXTENSIONS = [
|
|
1171
|
+
'png',
|
|
1172
|
+
'jpg',
|
|
1173
|
+
'jpeg',
|
|
1174
|
+
'pjpeg',
|
|
1175
|
+
'pjp',
|
|
1176
|
+
'gif',
|
|
1177
|
+
'bmp',
|
|
1178
|
+
'webp',
|
|
1179
|
+
'ico',
|
|
1180
|
+
'apng',
|
|
1181
|
+
'avif',
|
|
1182
|
+
'tif',
|
|
1183
|
+
'tiff',
|
|
1184
|
+
'jfif',
|
|
1185
|
+
'cur'
|
|
1186
|
+
], VIDEO_EXTENSIONS = [
|
|
1187
|
+
'mp4',
|
|
1188
|
+
'webm',
|
|
1189
|
+
'ogg',
|
|
1190
|
+
'mov'
|
|
1191
|
+
], AUDIO_EXTENSIONS = [
|
|
1192
|
+
'mp3',
|
|
1193
|
+
'wav',
|
|
1194
|
+
'flac',
|
|
1195
|
+
'aac',
|
|
1196
|
+
'm4a',
|
|
1197
|
+
'opus'
|
|
1198
|
+
], LAZY_COMPILATION_IDENTIFIER = 'lazy-compilation-proxy';
|
|
1199
|
+
var __webpack_modules__ = {}, __webpack_module_cache__ = {};
|
|
1200
|
+
function __nested_rspack_require_65__(moduleId) {
|
|
1201
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
1202
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
1203
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
1204
|
+
exports: {}
|
|
1205
|
+
};
|
|
1206
|
+
return __webpack_modules__[moduleId](module, module.exports, __nested_rspack_require_65__), module.exports;
|
|
1207
|
+
}
|
|
1208
|
+
__nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65__.add = function(modules) {
|
|
1209
|
+
Object.assign(__nested_rspack_require_65__.m, modules);
|
|
1210
|
+
}, __nested_rspack_require_65__.add({
|
|
1211
|
+
"./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js" (module) {
|
|
1212
|
+
var isMergeableObject = function(value) {
|
|
1213
|
+
return isNonNullObject(value) && !isSpecial(value);
|
|
1214
|
+
};
|
|
1215
|
+
function isNonNullObject(value) {
|
|
1216
|
+
return !!value && 'object' == typeof value;
|
|
1217
|
+
}
|
|
1218
|
+
function isSpecial(value) {
|
|
1219
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
1220
|
+
return '[object RegExp]' === stringValue || '[object Date]' === stringValue || isReactElement(value);
|
|
1221
|
+
}
|
|
1222
|
+
var REACT_ELEMENT_TYPE = 'function' == typeof Symbol && Symbol.for ? Symbol.for('react.element') : 0xeac7;
|
|
1223
|
+
function isReactElement(value) {
|
|
1224
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
1225
|
+
}
|
|
1226
|
+
function emptyTarget(val) {
|
|
1227
|
+
return Array.isArray(val) ? [] : {};
|
|
1228
|
+
}
|
|
1229
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
1230
|
+
return !1 !== options.clone && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
|
1231
|
+
}
|
|
1232
|
+
function defaultArrayMerge(target, source, options) {
|
|
1233
|
+
return target.concat(source).map(function(element) {
|
|
1234
|
+
return cloneUnlessOtherwiseSpecified(element, options);
|
|
1308
1235
|
});
|
|
1309
1236
|
}
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
${section.body}` : section.body).join("\n\n"));
|
|
1315
|
-
}
|
|
1316
|
-
outputVersion() {
|
|
1317
|
-
let { name } = this.cli, { versionNumber } = this.cli.globalCommand;
|
|
1318
|
-
versionNumber && console.log(`${name}/${versionNumber} ${platformInfo}`);
|
|
1319
|
-
}
|
|
1320
|
-
checkRequiredArgs() {
|
|
1321
|
-
let minimalArgsCount = this.args.filter((arg)=>arg.required).length;
|
|
1322
|
-
if (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \`${this.rawName}\``);
|
|
1323
|
-
}
|
|
1324
|
-
checkUnknownOptions() {
|
|
1325
|
-
let { options, globalCommand } = this.cli;
|
|
1326
|
-
if (!this.config.allowUnknownOptions) {
|
|
1327
|
-
for (let name of Object.keys(options))if ("--" !== name && !this.hasOption(name) && !globalCommand.hasOption(name)) throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
|
|
1237
|
+
function getMergeFunction(key, options) {
|
|
1238
|
+
if (!options.customMerge) return deepmerge;
|
|
1239
|
+
var customMerge = options.customMerge(key);
|
|
1240
|
+
return 'function' == typeof customMerge ? customMerge : deepmerge;
|
|
1328
1241
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1242
|
+
function getEnumerableOwnPropertySymbols(target) {
|
|
1243
|
+
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
1244
|
+
return Object.propertyIsEnumerable.call(target, symbol);
|
|
1245
|
+
}) : [];
|
|
1246
|
+
}
|
|
1247
|
+
function getKeys(target) {
|
|
1248
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
1249
|
+
}
|
|
1250
|
+
function propertyIsOnObject(object, property) {
|
|
1251
|
+
try {
|
|
1252
|
+
return property in object;
|
|
1253
|
+
} catch (_) {
|
|
1254
|
+
return !1;
|
|
1340
1255
|
}
|
|
1341
1256
|
}
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1257
|
+
function propertyIsUnsafe(target, key) {
|
|
1258
|
+
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
1259
|
+
}
|
|
1260
|
+
function mergeObject(target, source, options) {
|
|
1261
|
+
var destination = {};
|
|
1262
|
+
return options.isMergeableObject(target) && getKeys(target).forEach(function(key) {
|
|
1263
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
1264
|
+
}), getKeys(source).forEach(function(key) {
|
|
1265
|
+
propertyIsUnsafe(target, key) || (propertyIsOnObject(target, key) && options.isMergeableObject(source[key]) ? destination[key] = getMergeFunction(key, options)(target[key], source[key], options) : destination[key] = cloneUnlessOtherwiseSpecified(source[key], options));
|
|
1266
|
+
}), destination;
|
|
1267
|
+
}
|
|
1268
|
+
function deepmerge(target, source, options) {
|
|
1269
|
+
(options = options || {}).arrayMerge = options.arrayMerge || defaultArrayMerge, options.isMergeableObject = options.isMergeableObject || isMergeableObject, options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
1270
|
+
var sourceIsArray = Array.isArray(source);
|
|
1271
|
+
return sourceIsArray !== Array.isArray(target) ? cloneUnlessOtherwiseSpecified(source, options) : sourceIsArray ? options.arrayMerge(target, source, options) : mergeObject(target, source, options);
|
|
1272
|
+
}
|
|
1273
|
+
deepmerge.all = function(array, options) {
|
|
1274
|
+
if (!Array.isArray(array)) throw Error('first argument should be an array');
|
|
1275
|
+
return array.reduce(function(prev, next) {
|
|
1276
|
+
return deepmerge(prev, next, options);
|
|
1277
|
+
}, {});
|
|
1278
|
+
}, module.exports = deepmerge;
|
|
1279
|
+
},
|
|
1280
|
+
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js" (__unused_rspack_module, exports) {
|
|
1281
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1282
|
+
value: !0
|
|
1283
|
+
}), exports.arrayToString = void 0, exports.arrayToString = (array, space, next)=>{
|
|
1284
|
+
let values = array.map(function(value, index) {
|
|
1285
|
+
let result = next(value, index);
|
|
1286
|
+
return void 0 === result ? String(result) : space + result.split("\n").join(`\n${space}`);
|
|
1287
|
+
}).join(space ? ",\n" : ","), eol = space && values ? "\n" : "";
|
|
1288
|
+
return `[${eol}${values}${eol}]`;
|
|
1289
|
+
};
|
|
1290
|
+
},
|
|
1291
|
+
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
1292
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1293
|
+
value: !0
|
|
1294
|
+
}), exports.FunctionParser = exports.dedentFunction = exports.functionToString = exports.USED_METHOD_KEY = void 0;
|
|
1295
|
+
let quote_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), METHOD_NAMES_ARE_QUOTED = '"' === ({
|
|
1296
|
+
" " () {}
|
|
1297
|
+
})[" "].toString().charAt(0), FUNCTION_PREFIXES = {
|
|
1298
|
+
Function: "function ",
|
|
1299
|
+
GeneratorFunction: "function* ",
|
|
1300
|
+
AsyncFunction: "async function ",
|
|
1301
|
+
AsyncGeneratorFunction: "async function* "
|
|
1302
|
+
}, METHOD_PREFIXES = {
|
|
1303
|
+
Function: "",
|
|
1304
|
+
GeneratorFunction: "*",
|
|
1305
|
+
AsyncFunction: "async ",
|
|
1306
|
+
AsyncGeneratorFunction: "async *"
|
|
1307
|
+
}, TOKENS_PRECEDING_REGEXPS = new Set("case delete else in instanceof new return throw typeof void , ; : + - ! ~ & | ^ * / % < > ? =".split(" "));
|
|
1308
|
+
function dedentFunction(fnString) {
|
|
1309
|
+
let found;
|
|
1310
|
+
for (let line of fnString.split("\n").slice(1)){
|
|
1311
|
+
let m = /^[\s\t]+/.exec(line);
|
|
1312
|
+
if (!m) return fnString;
|
|
1313
|
+
let [str] = m;
|
|
1314
|
+
void 0 === found ? found = str : str.length < found.length && (found = str);
|
|
1315
|
+
}
|
|
1316
|
+
return found ? fnString.split(`\n${found}`).join("\n") : fnString;
|
|
1317
|
+
}
|
|
1318
|
+
exports.USED_METHOD_KEY = new WeakSet(), exports.functionToString = (fn, space, next, key)=>{
|
|
1319
|
+
let name = "string" == typeof key ? key : void 0;
|
|
1320
|
+
return void 0 !== name && exports.USED_METHOD_KEY.add(fn), new FunctionParser(fn, space, next, name).stringify();
|
|
1321
|
+
}, exports.dedentFunction = dedentFunction;
|
|
1322
|
+
class FunctionParser {
|
|
1323
|
+
constructor(fn, indent, next, key){
|
|
1324
|
+
this.fn = fn, this.indent = indent, this.next = next, this.key = key, this.pos = 0, this.hadKeyword = !1, this.fnString = Function.prototype.toString.call(fn), this.fnType = fn.constructor.name, this.keyQuote = void 0 === key ? "" : quote_1.quoteKey(key, next), this.keyPrefix = void 0 === key ? "" : `${this.keyQuote}:${indent ? " " : ""}`, this.isMethodCandidate = void 0 !== key && ("" === this.fn.name || this.fn.name === key);
|
|
1325
|
+
}
|
|
1326
|
+
stringify() {
|
|
1327
|
+
let value = this.tryParse();
|
|
1328
|
+
return value ? dedentFunction(value) : `${this.keyPrefix}void ${this.next(this.fnString)}`;
|
|
1329
|
+
}
|
|
1330
|
+
getPrefix() {
|
|
1331
|
+
return this.isMethodCandidate && !this.hadKeyword ? METHOD_PREFIXES[this.fnType] + this.keyQuote : this.keyPrefix + FUNCTION_PREFIXES[this.fnType];
|
|
1332
|
+
}
|
|
1333
|
+
tryParse() {
|
|
1334
|
+
if ("}" !== this.fnString[this.fnString.length - 1]) return this.keyPrefix + this.fnString;
|
|
1335
|
+
if (this.fn.name) {
|
|
1336
|
+
let result = this.tryStrippingName();
|
|
1337
|
+
if (result) return result;
|
|
1338
|
+
}
|
|
1339
|
+
let prevPos = this.pos;
|
|
1340
|
+
if ("class" === this.consumeSyntax()) return this.fnString;
|
|
1341
|
+
if (this.pos = prevPos, this.tryParsePrefixTokens()) {
|
|
1342
|
+
let result = this.tryStrippingName();
|
|
1343
|
+
if (result) return result;
|
|
1344
|
+
let offset = this.pos;
|
|
1345
|
+
switch(this.consumeSyntax("WORD_LIKE")){
|
|
1346
|
+
case "WORD_LIKE":
|
|
1347
|
+
this.isMethodCandidate && !this.hadKeyword && (offset = this.pos);
|
|
1348
|
+
case "()":
|
|
1349
|
+
if ("=>" === this.fnString.substr(this.pos, 2)) return this.keyPrefix + this.fnString;
|
|
1350
|
+
this.pos = offset;
|
|
1351
|
+
case '"':
|
|
1352
|
+
case "'":
|
|
1353
|
+
case "[]":
|
|
1354
|
+
return this.getPrefix() + this.fnString.substr(this.pos);
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
tryStrippingName() {
|
|
1359
|
+
if (METHOD_NAMES_ARE_QUOTED) return;
|
|
1360
|
+
let start = this.pos, prefix = this.fnString.substr(this.pos, this.fn.name.length);
|
|
1361
|
+
if (prefix === this.fn.name && (this.pos += prefix.length, "()" === this.consumeSyntax() && "{}" === this.consumeSyntax() && this.pos === this.fnString.length)) return (this.isMethodCandidate || !quote_1.isValidVariableName(prefix)) && (start += prefix.length), this.getPrefix() + this.fnString.substr(start);
|
|
1362
|
+
this.pos = start;
|
|
1363
|
+
}
|
|
1364
|
+
tryParsePrefixTokens() {
|
|
1365
|
+
let posPrev = this.pos;
|
|
1366
|
+
switch(this.hadKeyword = !1, this.fnType){
|
|
1367
|
+
case "AsyncFunction":
|
|
1368
|
+
if ("async" !== this.consumeSyntax()) return !1;
|
|
1369
|
+
posPrev = this.pos;
|
|
1370
|
+
case "Function":
|
|
1371
|
+
return "function" === this.consumeSyntax() ? this.hadKeyword = !0 : this.pos = posPrev, !0;
|
|
1372
|
+
case "AsyncGeneratorFunction":
|
|
1373
|
+
if ("async" !== this.consumeSyntax()) return !1;
|
|
1374
|
+
case "GeneratorFunction":
|
|
1375
|
+
let token = this.consumeSyntax();
|
|
1376
|
+
return "function" === token && (token = this.consumeSyntax(), this.hadKeyword = !0), "*" === token;
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
consumeSyntax(wordLikeToken) {
|
|
1380
|
+
let m = this.consumeMatch(/^(?:([A-Za-z_0-9$\xA0-\uFFFF]+)|=>|\+\+|\-\-|.)/);
|
|
1381
|
+
if (!m) return;
|
|
1382
|
+
let [token, match] = m;
|
|
1383
|
+
if (this.consumeWhitespace(), match) return wordLikeToken || match;
|
|
1384
|
+
switch(token){
|
|
1385
|
+
case "(":
|
|
1386
|
+
return this.consumeSyntaxUntil("(", ")");
|
|
1387
|
+
case "[":
|
|
1388
|
+
return this.consumeSyntaxUntil("[", "]");
|
|
1389
|
+
case "{":
|
|
1390
|
+
return this.consumeSyntaxUntil("{", "}");
|
|
1391
|
+
case "`":
|
|
1392
|
+
return this.consumeTemplate();
|
|
1393
|
+
case '"':
|
|
1394
|
+
return this.consumeRegExp(/^(?:[^\\"]|\\.)*"/, '"');
|
|
1395
|
+
case "'":
|
|
1396
|
+
return this.consumeRegExp(/^(?:[^\\']|\\.)*'/, "'");
|
|
1397
|
+
}
|
|
1398
|
+
return token;
|
|
1398
1399
|
}
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1400
|
+
consumeSyntaxUntil(startToken, endToken) {
|
|
1401
|
+
let isRegExpAllowed = !0;
|
|
1402
|
+
for(;;){
|
|
1403
|
+
let token = this.consumeSyntax();
|
|
1404
|
+
if (token === endToken) return startToken + endToken;
|
|
1405
|
+
if (!token || ")" === token || "]" === token || "}" === token) return;
|
|
1406
|
+
"/" === token && isRegExpAllowed && this.consumeMatch(/^(?:\\.|[^\\\/\n[]|\[(?:\\.|[^\]])*\])+\/[a-z]*/) ? (isRegExpAllowed = !1, this.consumeWhitespace()) : isRegExpAllowed = TOKENS_PRECEDING_REGEXPS.has(token);
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
consumeMatch(re) {
|
|
1410
|
+
let m = re.exec(this.fnString.substr(this.pos));
|
|
1411
|
+
return m && (this.pos += m[0].length), m;
|
|
1412
|
+
}
|
|
1413
|
+
consumeRegExp(re, token) {
|
|
1414
|
+
let m = re.exec(this.fnString.substr(this.pos));
|
|
1415
|
+
if (m) return this.pos += m[0].length, this.consumeWhitespace(), token;
|
|
1416
|
+
}
|
|
1417
|
+
consumeTemplate() {
|
|
1418
|
+
for(;;){
|
|
1419
|
+
if (this.consumeMatch(/^(?:[^`$\\]|\\.|\$(?!{))*/), "`" === this.fnString[this.pos]) return this.pos++, this.consumeWhitespace(), "`";
|
|
1420
|
+
if (!("${" === this.fnString.substr(this.pos, 2) && (this.pos += 2, this.consumeWhitespace(), this.consumeSyntaxUntil("{", "}")))) return;
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
consumeWhitespace() {
|
|
1424
|
+
this.consumeMatch(/^(?:\s|\/\/.*|\/\*[^]*?\*\/)*/);
|
|
1405
1425
|
}
|
|
1406
1426
|
}
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1427
|
+
exports.FunctionParser = FunctionParser;
|
|
1428
|
+
},
|
|
1429
|
+
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
1430
|
+
exports.stringify = void 0;
|
|
1431
|
+
let stringify_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js"), quote_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), ROOT_SENTINEL = Symbol("root");
|
|
1432
|
+
function replacerToString(replacer) {
|
|
1433
|
+
return replacer ? (value, space, next, key)=>replacer(value, space, (value)=>stringify_1.toString(value, space, next, key), key) : stringify_1.toString;
|
|
1410
1434
|
}
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1435
|
+
exports.stringify = function stringify(value, replacer, indent, options = {}) {
|
|
1436
|
+
let space = "string" == typeof indent ? indent : " ".repeat(indent || 0), path = [], stack = new Set(), tracking = new Map(), unpack = new Map(), valueCount = 0, { maxDepth = 100, references = !1, skipUndefinedProperties = !1, maxValues = 100000 } = options, valueToString = replacerToString(replacer), onNext = (value, key)=>{
|
|
1437
|
+
if (++valueCount > maxValues || skipUndefinedProperties && void 0 === value || path.length > maxDepth) return;
|
|
1438
|
+
if (void 0 === key) return valueToString(value, space, onNext, key);
|
|
1439
|
+
path.push(key);
|
|
1440
|
+
let result = builder(value, key === ROOT_SENTINEL ? void 0 : key);
|
|
1441
|
+
return path.pop(), result;
|
|
1442
|
+
}, builder = references ? (value, key)=>{
|
|
1443
|
+
if (null !== value && ("object" == typeof value || "function" == typeof value || "symbol" == typeof value)) {
|
|
1444
|
+
if (tracking.has(value)) return unpack.set(path.slice(1), tracking.get(value)), valueToString(void 0, space, onNext, key);
|
|
1445
|
+
tracking.set(value, path.slice(1));
|
|
1446
|
+
}
|
|
1447
|
+
return valueToString(value, space, onNext, key);
|
|
1448
|
+
} : (value, key)=>{
|
|
1449
|
+
if (stack.has(value)) return;
|
|
1450
|
+
stack.add(value);
|
|
1451
|
+
let result = valueToString(value, space, onNext, key);
|
|
1452
|
+
return stack.delete(value), result;
|
|
1453
|
+
}, result = onNext(value, ROOT_SENTINEL);
|
|
1454
|
+
if (unpack.size) {
|
|
1455
|
+
let sp = space ? " " : "", eol = space ? "\n" : "", wrapper = `var x${sp}=${sp}${result};${eol}`;
|
|
1456
|
+
for (let [key, value] of unpack.entries()){
|
|
1457
|
+
let keyPath = quote_1.stringifyPath(key, onNext), valuePath = quote_1.stringifyPath(value, onNext);
|
|
1458
|
+
wrapper += `x${keyPath}${sp}=${sp}x${valuePath};${eol}`;
|
|
1459
|
+
}
|
|
1460
|
+
return `(function${sp}()${sp}{${eol}${wrapper}return x;${eol}}())`;
|
|
1461
|
+
}
|
|
1428
1462
|
return result;
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1463
|
+
};
|
|
1464
|
+
},
|
|
1465
|
+
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
1466
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1467
|
+
value: !0
|
|
1468
|
+
}), exports.objectToString = void 0;
|
|
1469
|
+
let quote_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), function_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"), array_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js");
|
|
1470
|
+
exports.objectToString = (value, space, next, key)=>{
|
|
1471
|
+
if ("function" == typeof Buffer && Buffer.isBuffer(value)) return `Buffer.from(${next(value.toString("base64"))}, 'base64')`;
|
|
1472
|
+
if ("object" == typeof global && value === global) return globalToString(value, space, next, key);
|
|
1473
|
+
let toString = OBJECT_TYPES[Object.prototype.toString.call(value)];
|
|
1474
|
+
return toString ? toString(value, space, next, key) : void 0;
|
|
1475
|
+
};
|
|
1476
|
+
let globalToString = (value, space, next)=>`Function(${next("return this")})()`, OBJECT_TYPES = {
|
|
1477
|
+
"[object Array]": array_1.arrayToString,
|
|
1478
|
+
"[object Object]": (obj, indent, next, key)=>{
|
|
1479
|
+
let eol = indent ? "\n" : "", space = indent ? " " : "", values = Object.keys(obj).reduce(function(values, key) {
|
|
1480
|
+
let fn = obj[key], result = next(fn, key);
|
|
1481
|
+
if (void 0 === result) return values;
|
|
1482
|
+
let value = result.split("\n").join(`\n${indent}`);
|
|
1483
|
+
return function_1.USED_METHOD_KEY.has(fn) ? values.push(`${indent}${value}`) : values.push(`${indent}${quote_1.quoteKey(key, next)}:${space}${value}`), values;
|
|
1484
|
+
}, []).join(`,${eol}`);
|
|
1485
|
+
return "" === values ? "{}" : `{${eol}${values}${eol}}`;
|
|
1486
|
+
},
|
|
1487
|
+
"[object Error]": (error, space, next)=>`new Error(${next(error.message)})`,
|
|
1488
|
+
"[object Date]": (date)=>`new Date(${date.getTime()})`,
|
|
1489
|
+
"[object String]": (str, space, next)=>`new String(${next(str.toString())})`,
|
|
1490
|
+
"[object Number]": (num)=>`new Number(${num})`,
|
|
1491
|
+
"[object Boolean]": (bool)=>`new Boolean(${bool})`,
|
|
1492
|
+
"[object Set]": (set, space, next)=>`new Set(${next(Array.from(set))})`,
|
|
1493
|
+
"[object Map]": (map, space, next)=>`new Map(${next(Array.from(map))})`,
|
|
1494
|
+
"[object RegExp]": String,
|
|
1495
|
+
"[object global]": globalToString,
|
|
1496
|
+
"[object Window]": globalToString
|
|
1497
|
+
};
|
|
1498
|
+
},
|
|
1499
|
+
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js" (__unused_rspack_module, exports) {
|
|
1500
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1501
|
+
value: !0
|
|
1502
|
+
}), exports.stringifyPath = exports.quoteKey = exports.isValidVariableName = exports.IS_VALID_IDENTIFIER = exports.quoteString = void 0;
|
|
1503
|
+
let ESCAPABLE = /[\\\'\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, META_CHARS = new Map([
|
|
1504
|
+
[
|
|
1505
|
+
"\b",
|
|
1506
|
+
"\\b"
|
|
1507
|
+
],
|
|
1508
|
+
[
|
|
1509
|
+
"\t",
|
|
1510
|
+
"\\t"
|
|
1511
|
+
],
|
|
1512
|
+
[
|
|
1513
|
+
"\n",
|
|
1514
|
+
"\\n"
|
|
1515
|
+
],
|
|
1516
|
+
[
|
|
1517
|
+
"\f",
|
|
1518
|
+
"\\f"
|
|
1519
|
+
],
|
|
1520
|
+
[
|
|
1521
|
+
"\r",
|
|
1522
|
+
"\\r"
|
|
1523
|
+
],
|
|
1524
|
+
[
|
|
1525
|
+
"'",
|
|
1526
|
+
"\\'"
|
|
1527
|
+
],
|
|
1528
|
+
[
|
|
1529
|
+
'"',
|
|
1530
|
+
'\\"'
|
|
1531
|
+
],
|
|
1532
|
+
[
|
|
1533
|
+
"\\",
|
|
1534
|
+
"\\\\"
|
|
1535
|
+
]
|
|
1536
|
+
]);
|
|
1537
|
+
function escapeChar(char) {
|
|
1538
|
+
return META_CHARS.get(char) || `\\u${`0000${char.charCodeAt(0).toString(16)}`.slice(-4)}`;
|
|
1441
1539
|
}
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
args,
|
|
1445
|
-
options
|
|
1540
|
+
exports.quoteString = function quoteString(str) {
|
|
1541
|
+
return `'${str.replace(ESCAPABLE, escapeChar)}'`;
|
|
1446
1542
|
};
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
],
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
'pjpeg',
|
|
1481
|
-
'pjp',
|
|
1482
|
-
'gif',
|
|
1483
|
-
'bmp',
|
|
1484
|
-
'webp',
|
|
1485
|
-
'ico',
|
|
1486
|
-
'apng',
|
|
1487
|
-
'avif',
|
|
1488
|
-
'tif',
|
|
1489
|
-
'tiff',
|
|
1490
|
-
'jfif',
|
|
1491
|
-
'cur'
|
|
1492
|
-
], VIDEO_EXTENSIONS = [
|
|
1493
|
-
'mp4',
|
|
1494
|
-
'webm',
|
|
1495
|
-
'ogg',
|
|
1496
|
-
'mov'
|
|
1497
|
-
], AUDIO_EXTENSIONS = [
|
|
1498
|
-
'mp3',
|
|
1499
|
-
'wav',
|
|
1500
|
-
'flac',
|
|
1501
|
-
'aac',
|
|
1502
|
-
'm4a',
|
|
1503
|
-
'opus'
|
|
1504
|
-
], LAZY_COMPILATION_IDENTIFIER = 'lazy-compilation-proxy', cjs = __webpack_require__("../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
|
|
1505
|
-
var cjs_default = __webpack_require__.n(cjs);
|
|
1506
|
-
let dist_0 = __webpack_require__("../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js");
|
|
1543
|
+
let RESERVED_WORDS = new Set("break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "));
|
|
1544
|
+
function isValidVariableName(name) {
|
|
1545
|
+
return "string" == typeof name && !RESERVED_WORDS.has(name) && exports.IS_VALID_IDENTIFIER.test(name);
|
|
1546
|
+
}
|
|
1547
|
+
exports.IS_VALID_IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/, exports.isValidVariableName = isValidVariableName, exports.quoteKey = function quoteKey(key, next) {
|
|
1548
|
+
return isValidVariableName(key) ? key : next(key);
|
|
1549
|
+
}, exports.stringifyPath = function stringifyPath(path, next) {
|
|
1550
|
+
let result = "";
|
|
1551
|
+
for (let key of path)isValidVariableName(key) ? result += `.${key}` : result += `[${next(key)}]`;
|
|
1552
|
+
return result;
|
|
1553
|
+
};
|
|
1554
|
+
},
|
|
1555
|
+
"./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
1556
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1557
|
+
value: !0
|
|
1558
|
+
}), exports.toString = void 0;
|
|
1559
|
+
let quote_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), object_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js"), function_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"), PRIMITIVE_TYPES = {
|
|
1560
|
+
string: quote_1.quoteString,
|
|
1561
|
+
number: (value)=>Object.is(value, -0) ? "-0" : String(value),
|
|
1562
|
+
boolean: String,
|
|
1563
|
+
symbol: (value, space, next)=>{
|
|
1564
|
+
let key = Symbol.keyFor(value);
|
|
1565
|
+
return void 0 !== key ? `Symbol.for(${next(key)})` : `Symbol(${next(value.description)})`;
|
|
1566
|
+
},
|
|
1567
|
+
bigint: (value, space, next)=>`BigInt(${next(String(value))})`,
|
|
1568
|
+
undefined: String,
|
|
1569
|
+
object: object_1.objectToString,
|
|
1570
|
+
function: function_1.functionToString
|
|
1571
|
+
};
|
|
1572
|
+
exports.toString = (value, space, next, key)=>null === value ? "null" : PRIMITIVE_TYPES[typeof value](value, space, next, key);
|
|
1573
|
+
}
|
|
1574
|
+
});
|
|
1575
|
+
let cjs = __nested_rspack_require_65__("./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
|
|
1507
1576
|
function createMap(superClass) {
|
|
1508
1577
|
return class extends superClass {
|
|
1578
|
+
constructor(...args){
|
|
1579
|
+
super(...args), this.store = new Map();
|
|
1580
|
+
}
|
|
1509
1581
|
extend(methods) {
|
|
1510
1582
|
return this.shorthands = methods, methods.forEach((method)=>{
|
|
1511
1583
|
this[method] = (value)=>this.set(method, value);
|
|
@@ -1556,7 +1628,7 @@ function createMap(superClass) {
|
|
|
1556
1628
|
return Object.keys(obj).forEach((key)=>{
|
|
1557
1629
|
if (omit.includes(key)) return;
|
|
1558
1630
|
let value = obj[key];
|
|
1559
|
-
(Array.isArray(value) || 'object' == typeof value) && null !== value && this.has(key) ? this.set(key,
|
|
1631
|
+
(Array.isArray(value) || 'object' == typeof value) && null !== value && this.has(key) ? this.set(key, cjs(this.get(key), value)) : this.set(key, value);
|
|
1560
1632
|
}), this;
|
|
1561
1633
|
}
|
|
1562
1634
|
clean(obj) {
|
|
@@ -1568,34 +1640,34 @@ function createMap(superClass) {
|
|
|
1568
1640
|
when(condition, whenTruthy = Function.prototype, whenFalsy = Function.prototype) {
|
|
1569
1641
|
return condition ? whenTruthy(this) : whenFalsy(this), this;
|
|
1570
1642
|
}
|
|
1571
|
-
constructor(...args){
|
|
1572
|
-
super(...args), this.store = new Map();
|
|
1573
|
-
}
|
|
1574
1643
|
};
|
|
1575
1644
|
}
|
|
1576
1645
|
function createChainable(superClass) {
|
|
1577
1646
|
return class extends superClass {
|
|
1647
|
+
constructor(parent){
|
|
1648
|
+
super(), this.parent = parent;
|
|
1649
|
+
}
|
|
1578
1650
|
batch(handler) {
|
|
1579
1651
|
return handler(this), this;
|
|
1580
1652
|
}
|
|
1581
1653
|
end() {
|
|
1582
1654
|
return this.parent;
|
|
1583
1655
|
}
|
|
1584
|
-
constructor(parent){
|
|
1585
|
-
super(), this.parent = parent;
|
|
1586
|
-
}
|
|
1587
1656
|
};
|
|
1588
1657
|
}
|
|
1589
1658
|
let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superClass = createMap(createChainable(class extends Function {
|
|
1590
|
-
classCall() {
|
|
1591
|
-
throw Error('not implemented');
|
|
1592
|
-
}
|
|
1593
1659
|
constructor(){
|
|
1594
1660
|
return super(), new Proxy(this, {
|
|
1595
1661
|
apply: (target, thisArg, args)=>target.classCall(...args)
|
|
1596
1662
|
});
|
|
1597
1663
|
}
|
|
1664
|
+
classCall() {
|
|
1665
|
+
throw Error('not implemented');
|
|
1666
|
+
}
|
|
1598
1667
|
})), class extends superClass {
|
|
1668
|
+
constructor(...args){
|
|
1669
|
+
super(...args), this.value = void 0, this.useMap = !0;
|
|
1670
|
+
}
|
|
1599
1671
|
set(...args) {
|
|
1600
1672
|
return this.useMap = !0, this.value = void 0, super.set(...args);
|
|
1601
1673
|
}
|
|
@@ -1611,10 +1683,10 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
|
|
|
1611
1683
|
values() {
|
|
1612
1684
|
return this.useMap ? super.values() : this.value;
|
|
1613
1685
|
}
|
|
1686
|
+
}), ChainedSet = (superClass1 = createChainable(Object), class extends superClass1 {
|
|
1614
1687
|
constructor(...args){
|
|
1615
|
-
super(...args), this.
|
|
1688
|
+
super(...args), this.store = new Set();
|
|
1616
1689
|
}
|
|
1617
|
-
}), ChainedSet = (superClass1 = createChainable(Object), class extends superClass1 {
|
|
1618
1690
|
add(value) {
|
|
1619
1691
|
return this.store.add(value), this;
|
|
1620
1692
|
}
|
|
@@ -1647,9 +1719,6 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
|
|
|
1647
1719
|
when(condition, whenTruthy = Function.prototype, whenFalsy = Function.prototype) {
|
|
1648
1720
|
return condition ? whenTruthy(this) : whenFalsy(this), this;
|
|
1649
1721
|
}
|
|
1650
|
-
constructor(...args){
|
|
1651
|
-
super(...args), this.store = new Set();
|
|
1652
|
-
}
|
|
1653
1722
|
}), childMaps = [
|
|
1654
1723
|
'alias',
|
|
1655
1724
|
'fallback',
|
|
@@ -1667,8 +1736,20 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
|
|
|
1667
1736
|
'restrictions',
|
|
1668
1737
|
'roots',
|
|
1669
1738
|
'modules'
|
|
1670
|
-
]
|
|
1671
|
-
|
|
1739
|
+
], Resolve = class extends ChainedMap {
|
|
1740
|
+
constructor(parent){
|
|
1741
|
+
super(parent), childMaps.forEach((key)=>{
|
|
1742
|
+
this[key] = new ChainedMap(this);
|
|
1743
|
+
}), childSets.forEach((key)=>{
|
|
1744
|
+
this[key] = new ChainedSet(this);
|
|
1745
|
+
}), this.extend([
|
|
1746
|
+
'enforceExtension',
|
|
1747
|
+
'symlinks',
|
|
1748
|
+
'preferRelative',
|
|
1749
|
+
'preferAbsolute',
|
|
1750
|
+
'tsConfig'
|
|
1751
|
+
]);
|
|
1752
|
+
}
|
|
1672
1753
|
get(key) {
|
|
1673
1754
|
return childMaps.includes(key) ? this[key].entries() : childSets.includes(key) ? this[key].values() : super.get(key);
|
|
1674
1755
|
}
|
|
@@ -1692,21 +1773,10 @@ class Resolve_class extends ChainedMap {
|
|
|
1692
1773
|
...omissions
|
|
1693
1774
|
]);
|
|
1694
1775
|
}
|
|
1776
|
+
}, ResolveLoader = class extends Resolve {
|
|
1695
1777
|
constructor(parent){
|
|
1696
|
-
super(parent),
|
|
1697
|
-
this[key] = new ChainedMap(this);
|
|
1698
|
-
}), childSets.forEach((key)=>{
|
|
1699
|
-
this[key] = new ChainedSet(this);
|
|
1700
|
-
}), this.extend([
|
|
1701
|
-
'enforceExtension',
|
|
1702
|
-
'symlinks',
|
|
1703
|
-
'preferRelative',
|
|
1704
|
-
'preferAbsolute',
|
|
1705
|
-
'tsConfig'
|
|
1706
|
-
]);
|
|
1778
|
+
super(parent), this.modules = new ChainedSet(this), this.moduleExtensions = new ChainedSet(this), this.packageMains = new ChainedSet(this);
|
|
1707
1779
|
}
|
|
1708
|
-
}
|
|
1709
|
-
class ResolveLoader_class extends Resolve_class {
|
|
1710
1780
|
toConfig() {
|
|
1711
1781
|
return this.clean({
|
|
1712
1782
|
modules: this.modules.values(),
|
|
@@ -1728,11 +1798,7 @@ class ResolveLoader_class extends Resolve_class {
|
|
|
1728
1798
|
...omissions
|
|
1729
1799
|
]);
|
|
1730
1800
|
}
|
|
1731
|
-
|
|
1732
|
-
super(parent), this.modules = new ChainedSet(this), this.moduleExtensions = new ChainedSet(this), this.packageMains = new ChainedSet(this);
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
class Output_class extends ChainedMap {
|
|
1801
|
+
}, Output = class extends ChainedMap {
|
|
1736
1802
|
constructor(parent){
|
|
1737
1803
|
super(parent), this.extend([
|
|
1738
1804
|
'assetModuleFilename',
|
|
@@ -1778,19 +1844,7 @@ class Output_class extends ChainedMap {
|
|
|
1778
1844
|
'clean'
|
|
1779
1845
|
]);
|
|
1780
1846
|
}
|
|
1781
|
-
}
|
|
1782
|
-
class DevServer_class extends ChainedMap {
|
|
1783
|
-
toConfig() {
|
|
1784
|
-
return this.clean({
|
|
1785
|
-
allowedHosts: this.allowedHosts.values(),
|
|
1786
|
-
...this.entries() || {}
|
|
1787
|
-
});
|
|
1788
|
-
}
|
|
1789
|
-
merge(obj, omit = []) {
|
|
1790
|
-
return !omit.includes('allowedHosts') && 'allowedHosts' in obj && this.allowedHosts.merge(obj.allowedHosts), super.merge(obj, [
|
|
1791
|
-
'allowedHosts'
|
|
1792
|
-
]);
|
|
1793
|
-
}
|
|
1847
|
+
}, DevServer = class extends ChainedMap {
|
|
1794
1848
|
constructor(parent){
|
|
1795
1849
|
super(parent), this.allowedHosts = new ChainedSet(this), this.extend([
|
|
1796
1850
|
'after',
|
|
@@ -1845,8 +1899,18 @@ class DevServer_class extends ChainedMap {
|
|
|
1845
1899
|
'writeToDisk'
|
|
1846
1900
|
]);
|
|
1847
1901
|
}
|
|
1848
|
-
|
|
1849
|
-
|
|
1902
|
+
toConfig() {
|
|
1903
|
+
return this.clean({
|
|
1904
|
+
allowedHosts: this.allowedHosts.values(),
|
|
1905
|
+
...this.entries() || {}
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1908
|
+
merge(obj, omit = []) {
|
|
1909
|
+
return !omit.includes('allowedHosts') && 'allowedHosts' in obj && this.allowedHosts.merge(obj.allowedHosts), super.merge(obj, [
|
|
1910
|
+
'allowedHosts'
|
|
1911
|
+
]);
|
|
1912
|
+
}
|
|
1913
|
+
}, Orderable = (Class)=>class extends Class {
|
|
1850
1914
|
before(name) {
|
|
1851
1915
|
if (this.__after) throw Error(`Unable to set .before(${JSON.stringify(name)}) with existing value for .after()`);
|
|
1852
1916
|
return this.__before = name, this;
|
|
@@ -1863,6 +1927,11 @@ let Orderable = (Class)=>class extends Class {
|
|
|
1863
1927
|
]);
|
|
1864
1928
|
}
|
|
1865
1929
|
}, src_Plugin = Orderable(class extends ChainedMap {
|
|
1930
|
+
constructor(parent, name, type = 'plugin'){
|
|
1931
|
+
super(parent), this.name = name, this.type = type, this.extend([
|
|
1932
|
+
'init'
|
|
1933
|
+
]), this.init((Plugin, args = [])=>'function' == typeof Plugin ? new Plugin(...args) : Plugin);
|
|
1934
|
+
}
|
|
1866
1935
|
use(plugin, args = []) {
|
|
1867
1936
|
return this.set('plugin', plugin).set('args', args);
|
|
1868
1937
|
}
|
|
@@ -1904,17 +1973,19 @@ let Orderable = (Class)=>class extends Class {
|
|
|
1904
1973
|
}
|
|
1905
1974
|
}), config;
|
|
1906
1975
|
}
|
|
1907
|
-
constructor(parent, name, type = 'plugin'){
|
|
1908
|
-
super(parent), this.name = name, this.type = type, this.extend([
|
|
1909
|
-
'init'
|
|
1910
|
-
]), this.init((Plugin, args = [])=>'function' == typeof Plugin ? new Plugin(...args) : Plugin);
|
|
1911
|
-
}
|
|
1912
1976
|
}), Use = Orderable(class extends ChainedMap {
|
|
1977
|
+
constructor(parent, name){
|
|
1978
|
+
super(parent), this.name = name, this.extend([
|
|
1979
|
+
'loader',
|
|
1980
|
+
'options',
|
|
1981
|
+
'parallel'
|
|
1982
|
+
]);
|
|
1983
|
+
}
|
|
1913
1984
|
tap(f) {
|
|
1914
1985
|
return this.options(f(this.get('options'))), this;
|
|
1915
1986
|
}
|
|
1916
1987
|
merge(obj, omit = []) {
|
|
1917
|
-
return !omit.includes('loader') && 'loader' in obj && this.loader(obj.loader), !omit.includes('options') && 'options' in obj && this.options(
|
|
1988
|
+
return !omit.includes('loader') && 'loader' in obj && this.loader(obj.loader), !omit.includes('options') && 'options' in obj && this.options(cjs(this.store.get('options') || {}, obj.options)), super.merge(obj, [
|
|
1918
1989
|
...omit,
|
|
1919
1990
|
'loader',
|
|
1920
1991
|
'options'
|
|
@@ -1934,13 +2005,6 @@ let Orderable = (Class)=>class extends Class {
|
|
|
1934
2005
|
}
|
|
1935
2006
|
}), config;
|
|
1936
2007
|
}
|
|
1937
|
-
constructor(parent, name){
|
|
1938
|
-
super(parent), this.name = name, this.extend([
|
|
1939
|
-
'loader',
|
|
1940
|
-
'options',
|
|
1941
|
-
'parallel'
|
|
1942
|
-
]);
|
|
1943
|
-
}
|
|
1944
2008
|
});
|
|
1945
2009
|
function toArray(arr) {
|
|
1946
2010
|
return Array.isArray(arr) ? arr : [
|
|
@@ -1948,6 +2012,30 @@ function toArray(arr) {
|
|
|
1948
2012
|
];
|
|
1949
2013
|
}
|
|
1950
2014
|
let Rule = Orderable(class extends ChainedMap {
|
|
2015
|
+
constructor(parent, name, ruleType = 'rule'){
|
|
2016
|
+
super(parent), this.ruleName = name, this.names = [], this.ruleType = ruleType, this.ruleTypes = [];
|
|
2017
|
+
let rule = this;
|
|
2018
|
+
for(; rule instanceof Rule;)this.names.unshift(rule.ruleName), this.ruleTypes.unshift(rule.ruleType), rule = rule.parent;
|
|
2019
|
+
this.uses = new ChainedMap(this), this.include = new ChainedSet(this), this.exclude = new ChainedSet(this), this.rules = new ChainedMap(this), this.oneOfs = new ChainedMap(this), this.resolve = new Resolve(this), this.resolve.extend([
|
|
2020
|
+
'fullySpecified'
|
|
2021
|
+
]), this.extend([
|
|
2022
|
+
'dependency',
|
|
2023
|
+
'enforce',
|
|
2024
|
+
'issuer',
|
|
2025
|
+
'issuerLayer',
|
|
2026
|
+
'layer',
|
|
2027
|
+
'mimetype',
|
|
2028
|
+
'parser',
|
|
2029
|
+
'generator',
|
|
2030
|
+
'resource',
|
|
2031
|
+
'resourceFragment',
|
|
2032
|
+
'resourceQuery',
|
|
2033
|
+
'sideEffects',
|
|
2034
|
+
'with',
|
|
2035
|
+
'test',
|
|
2036
|
+
'type'
|
|
2037
|
+
]);
|
|
2038
|
+
}
|
|
1951
2039
|
use(name) {
|
|
1952
2040
|
return this.uses.getOrCompute(name, ()=>new Use(this, name));
|
|
1953
2041
|
}
|
|
@@ -1993,32 +2081,12 @@ let Rule = Orderable(class extends ChainedMap {
|
|
|
1993
2081
|
'test'
|
|
1994
2082
|
]);
|
|
1995
2083
|
}
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
this.uses = new ChainedMap(this), this.include = new ChainedSet(this), this.exclude = new ChainedSet(this), this.rules = new ChainedMap(this), this.oneOfs = new ChainedMap(this), this.resolve = new Resolve_class(this), this.resolve.extend([
|
|
2001
|
-
'fullySpecified'
|
|
2002
|
-
]), this.extend([
|
|
2003
|
-
'dependency',
|
|
2004
|
-
'enforce',
|
|
2005
|
-
'issuer',
|
|
2006
|
-
'issuerLayer',
|
|
2007
|
-
'layer',
|
|
2008
|
-
'mimetype',
|
|
2009
|
-
'parser',
|
|
2010
|
-
'generator',
|
|
2011
|
-
'resource',
|
|
2012
|
-
'resourceFragment',
|
|
2013
|
-
'resourceQuery',
|
|
2014
|
-
'sideEffects',
|
|
2015
|
-
'with',
|
|
2016
|
-
'test',
|
|
2017
|
-
'type'
|
|
2084
|
+
}), dist_Module = class extends ChainedMap {
|
|
2085
|
+
constructor(parent){
|
|
2086
|
+
super(parent), this.rules = new ChainedMap(this), this.defaultRules = new ChainedMap(this), this.generator = new ChainedMap(this), this.parser = new ChainedMap(this), this.extend([
|
|
2087
|
+
'noParse'
|
|
2018
2088
|
]);
|
|
2019
2089
|
}
|
|
2020
|
-
});
|
|
2021
|
-
class Module_class extends ChainedMap {
|
|
2022
2090
|
defaultRule(name) {
|
|
2023
2091
|
return this.defaultRules.getOrCompute(name, ()=>new Rule(this, name, 'defaultRule'));
|
|
2024
2092
|
}
|
|
@@ -2039,30 +2107,7 @@ class Module_class extends ChainedMap {
|
|
|
2039
2107
|
'defaultRule'
|
|
2040
2108
|
]);
|
|
2041
2109
|
}
|
|
2042
|
-
|
|
2043
|
-
super(parent), this.rules = new ChainedMap(this), this.defaultRules = new ChainedMap(this), this.generator = new ChainedMap(this), this.parser = new ChainedMap(this), this.extend([
|
|
2044
|
-
'noParse',
|
|
2045
|
-
'unsafeCache'
|
|
2046
|
-
]);
|
|
2047
|
-
}
|
|
2048
|
-
}
|
|
2049
|
-
class Optimization_class extends ChainedMap {
|
|
2050
|
-
minimizer(name) {
|
|
2051
|
-
if (Array.isArray(name)) throw Error("optimization.minimizer() no longer supports being passed an array. Either switch to the new syntax (https://github.com/neutrinojs/webpack-chain#config-optimization-minimizers-adding) or downgrade to webpack-chain 4. If using Vue this likely means a Vue plugin has not yet been updated to support Vue CLI 4+.");
|
|
2052
|
-
return this.minimizers.getOrCompute(name, ()=>new src_Plugin(this, name, 'optimization.minimizer'));
|
|
2053
|
-
}
|
|
2054
|
-
toConfig() {
|
|
2055
|
-
return this.clean(Object.assign(this.entries() || {}, {
|
|
2056
|
-
splitChunks: this.splitChunks.entries(),
|
|
2057
|
-
minimizer: this.minimizers.values().map((plugin)=>plugin.toConfig())
|
|
2058
|
-
}));
|
|
2059
|
-
}
|
|
2060
|
-
merge(obj, omit = []) {
|
|
2061
|
-
return !omit.includes('minimizer') && 'minimizer' in obj && Object.keys(obj.minimizer).forEach((name)=>this.minimizer(name).merge(obj.minimizer[name])), super.merge(obj, [
|
|
2062
|
-
...omit,
|
|
2063
|
-
'minimizer'
|
|
2064
|
-
]);
|
|
2065
|
-
}
|
|
2110
|
+
}, Optimization = class extends ChainedMap {
|
|
2066
2111
|
constructor(parent){
|
|
2067
2112
|
super(parent), this.minimizers = new ChainedMap(this), this.splitChunks = new ChainedValueMap(this), this.extend([
|
|
2068
2113
|
'minimize',
|
|
@@ -2085,8 +2130,23 @@ class Optimization_class extends ChainedMap {
|
|
|
2085
2130
|
'avoidEntryIife'
|
|
2086
2131
|
]);
|
|
2087
2132
|
}
|
|
2088
|
-
|
|
2089
|
-
|
|
2133
|
+
minimizer(name) {
|
|
2134
|
+
if (Array.isArray(name)) throw Error("optimization.minimizer() no longer supports being passed an array. Either switch to the new syntax (https://github.com/neutrinojs/webpack-chain#config-optimization-minimizers-adding) or downgrade to webpack-chain 4. If using Vue this likely means a Vue plugin has not yet been updated to support Vue CLI 4+.");
|
|
2135
|
+
return this.minimizers.getOrCompute(name, ()=>new src_Plugin(this, name, 'optimization.minimizer'));
|
|
2136
|
+
}
|
|
2137
|
+
toConfig() {
|
|
2138
|
+
return this.clean(Object.assign(this.entries() || {}, {
|
|
2139
|
+
splitChunks: this.splitChunks.entries(),
|
|
2140
|
+
minimizer: this.minimizers.values().map((plugin)=>plugin.toConfig())
|
|
2141
|
+
}));
|
|
2142
|
+
}
|
|
2143
|
+
merge(obj, omit = []) {
|
|
2144
|
+
return !omit.includes('minimizer') && 'minimizer' in obj && Object.keys(obj.minimizer).forEach((name)=>this.minimizer(name).merge(obj.minimizer[name])), super.merge(obj, [
|
|
2145
|
+
...omit,
|
|
2146
|
+
'minimizer'
|
|
2147
|
+
]);
|
|
2148
|
+
}
|
|
2149
|
+
}, Performance = class extends ChainedValueMap {
|
|
2090
2150
|
constructor(parent){
|
|
2091
2151
|
super(parent), this.extend([
|
|
2092
2152
|
'assetFilter',
|
|
@@ -2095,13 +2155,36 @@ class Performance_class extends ChainedValueMap {
|
|
|
2095
2155
|
'maxEntrypointSize'
|
|
2096
2156
|
]);
|
|
2097
2157
|
}
|
|
2098
|
-
}
|
|
2099
|
-
let castArray = (value)=>Array.isArray(value) ? value : [
|
|
2158
|
+
}, dist = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js"), castArray = (value)=>Array.isArray(value) ? value : [
|
|
2100
2159
|
value
|
|
2101
|
-
]
|
|
2102
|
-
|
|
2160
|
+
], dist_src = class extends ChainedMap {
|
|
2161
|
+
constructor(){
|
|
2162
|
+
super(), this.entryPoints = new ChainedMap(this), this.output = new Output(this), this.module = new dist_Module(this), this.resolve = new Resolve(this), this.resolveLoader = new ResolveLoader(this), this.optimization = new Optimization(this), this.plugins = new ChainedMap(this), this.devServer = new DevServer(this), this.performance = new Performance(this), this.node = new ChainedValueMap(this), this.extend([
|
|
2163
|
+
'context',
|
|
2164
|
+
'mode',
|
|
2165
|
+
'devtool',
|
|
2166
|
+
'target',
|
|
2167
|
+
'watch',
|
|
2168
|
+
'watchOptions',
|
|
2169
|
+
'externals',
|
|
2170
|
+
'externalsType',
|
|
2171
|
+
'externalsPresets',
|
|
2172
|
+
'stats',
|
|
2173
|
+
'experiments',
|
|
2174
|
+
'amd',
|
|
2175
|
+
'bail',
|
|
2176
|
+
'cache',
|
|
2177
|
+
'dependencies',
|
|
2178
|
+
'ignoreWarnings',
|
|
2179
|
+
'loader',
|
|
2180
|
+
'name',
|
|
2181
|
+
'infrastructureLogging',
|
|
2182
|
+
'snapshot',
|
|
2183
|
+
'lazyCompilation'
|
|
2184
|
+
]);
|
|
2185
|
+
}
|
|
2103
2186
|
static toString(config, { verbose = !1, configPrefix = 'config' } = {}) {
|
|
2104
|
-
return (0,
|
|
2187
|
+
return (0, dist.stringify)(config, (value, indent, stringify)=>{
|
|
2105
2188
|
if (value && value.__pluginName) {
|
|
2106
2189
|
let prefix = `/* ${configPrefix}.${value.__pluginType}('${value.__pluginName}') */\n`, constructorExpression = value.__pluginPath ? `(require(${stringify(value.__pluginPath)}))` : value.__pluginConstructorName;
|
|
2107
2190
|
if (constructorExpression) {
|
|
@@ -2116,7 +2199,7 @@ class src_class extends ChainedMap {
|
|
|
2116
2199
|
let ruleTypes = value.__ruleTypes;
|
|
2117
2200
|
return `/* ${configPrefix}.module${value.__ruleNames.map((r, index)=>`.${ruleTypes ? ruleTypes[index] : 'rule'}('${r}')`).join('')}${value.__useName ? `.use('${value.__useName}')` : ""} */\n` + stringify(value);
|
|
2118
2201
|
}
|
|
2119
|
-
return value && value.__expression ? value.__expression : 'function' == typeof value && !verbose && value.toString().length > 100 ?
|
|
2202
|
+
return value && value.__expression ? value.__expression : 'function' == typeof value && !verbose && value.toString().length > 100 ? `function ${value.name || ''}() { /* omitted long function */ }` : stringify(value);
|
|
2120
2203
|
}, 2);
|
|
2121
2204
|
}
|
|
2122
2205
|
entry(name) {
|
|
@@ -2182,38 +2265,13 @@ class src_class extends ChainedMap {
|
|
|
2182
2265
|
'plugin'
|
|
2183
2266
|
]);
|
|
2184
2267
|
}
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
'mode',
|
|
2189
|
-
'devtool',
|
|
2190
|
-
'target',
|
|
2191
|
-
'watch',
|
|
2192
|
-
'watchOptions',
|
|
2193
|
-
'externals',
|
|
2194
|
-
'externalsType',
|
|
2195
|
-
'externalsPresets',
|
|
2196
|
-
'stats',
|
|
2197
|
-
'experiments',
|
|
2198
|
-
'amd',
|
|
2199
|
-
'bail',
|
|
2200
|
-
'cache',
|
|
2201
|
-
'dependencies',
|
|
2202
|
-
'ignoreWarnings',
|
|
2203
|
-
'loader',
|
|
2204
|
-
'profile',
|
|
2205
|
-
'name',
|
|
2206
|
-
'infrastructureLogging',
|
|
2207
|
-
'snapshot',
|
|
2208
|
-
'lazyCompilation'
|
|
2209
|
-
]);
|
|
2210
|
-
}
|
|
2211
|
-
}
|
|
2212
|
-
let external_node_module_ = __webpack_require__("node:module"), vendors_require = (0, external_node_module_.createRequire)(import.meta.url), requireCompiledPackage = (name)=>vendors_require(`${COMPILED_PATH}/${name}/index.js`), setNodeEnv = (env)=>{
|
|
2268
|
+
}, vendors_require = createRequire(import.meta.url), requireCompiledPackage = (name)=>vendors_require(`${COMPILED_PATH}/${name}/index.js`), cjs_0 = __webpack_require__("../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
|
|
2269
|
+
var cjs_0_default = __webpack_require__.n(cjs_0);
|
|
2270
|
+
let setNodeEnv = (env)=>{
|
|
2213
2271
|
process.env.NODE_ENV = env;
|
|
2214
2272
|
}, isFunction = (func)=>'function' == typeof func, isObject = (obj)=>'[object Object]' === Object.prototype.toString.call(obj), objectPrototype = Object.prototype, getProto = Object.getPrototypeOf, isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && getProto(obj) === objectPrototype, helpers_castArray = (arr)=>void 0 === arr ? [] : Array.isArray(arr) ? arr : [
|
|
2215
2273
|
arr
|
|
2216
|
-
], cloneDeep = (value)=>null == value ? value :
|
|
2274
|
+
], cloneDeep = (value)=>null == value ? value : cjs_0_default()({}, value, {
|
|
2217
2275
|
isMergeableObject: isPlainObject
|
|
2218
2276
|
});
|
|
2219
2277
|
function getFilename(config, type, isProd, isServer) {
|
|
@@ -2351,8 +2409,8 @@ function formatStatsError(stats, root, level = 'error') {
|
|
|
2351
2409
|
let snippet = fileName.replace(DATA_URI_PREFIX, '');
|
|
2352
2410
|
return snippet.length > 30 && (snippet = `${snippet.slice(0, 30)}...`), `File: ${color.cyan('data-uri virtual module')} ${color.dim(`(${snippet})`)}\n`;
|
|
2353
2411
|
}
|
|
2354
|
-
let prefix = root +
|
|
2355
|
-
return (fileName.startsWith(prefix) && (fileName = fileName.replace(prefix, `.${
|
|
2412
|
+
let prefix = root + sep;
|
|
2413
|
+
return (fileName.startsWith(prefix) && (fileName = fileName.replace(prefix, `.${sep}`)), /:\d+:\d+/.test(fileName)) ? `File: ${color.cyan(fileName)}\n` : stats.loc ? `File: ${color.cyan(`${fileName}:${stats.loc}`)}\n` : `File: ${color.cyan(`${fileName}:1:1`)}\n`;
|
|
2356
2414
|
})(fileName, stats, root)}${stats.message}`, verbose = isVerbose();
|
|
2357
2415
|
if (verbose && (stats.details && (message += `\nDetails: ${stats.details}\n`), stats.stack && (message += `\n${stats.stack}`)), 'error' === level || isVerbose()) {
|
|
2358
2416
|
let moduleTrace = formatModuleTrace(stats, fileName, level);
|
|
@@ -2379,7 +2437,7 @@ function formatStatsError(stats, root, level = 'error') {
|
|
|
2379
2437
|
let matchArray = stripVTControlCharacters(message).match(/Can't resolve '(\w+)'/);
|
|
2380
2438
|
if (!matchArray) return message;
|
|
2381
2439
|
let moduleName = matchArray[1];
|
|
2382
|
-
return moduleName &&
|
|
2440
|
+
return moduleName && builtinModules.includes(moduleName) ? getTips(moduleName) : message;
|
|
2383
2441
|
})(message = hintUnknownFiles(message)))).split('\n');
|
|
2384
2442
|
return (message = (lines = lines.filter((line, index, arr)=>0 === index || '' !== line.trim() || line.trim() !== arr[index - 1].trim())).join('\n')).trim();
|
|
2385
2443
|
}
|
|
@@ -2573,7 +2631,7 @@ let onBeforeCompile = ({ compiler, beforeCompile, beforeEnvironmentCompile, isWa
|
|
|
2573
2631
|
} else compiler.hooks.done.tapPromise('rsbuild:done', async (stats)=>{
|
|
2574
2632
|
await onEnvironmentDone(0, stats), await onDone(stats);
|
|
2575
2633
|
});
|
|
2576
|
-
}
|
|
2634
|
+
};
|
|
2577
2635
|
function _define_property(obj, key, value) {
|
|
2578
2636
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
2579
2637
|
value: value,
|
|
@@ -2590,7 +2648,7 @@ class BrowserslistError extends Error {
|
|
|
2590
2648
|
let isFileCache = {};
|
|
2591
2649
|
function isFile(file) {
|
|
2592
2650
|
if (file in isFileCache) return isFileCache[file];
|
|
2593
|
-
let result =
|
|
2651
|
+
let result = node_fs.existsSync(file) && node_fs.statSync(file).isFile();
|
|
2594
2652
|
return isFileCache[file] = result, result;
|
|
2595
2653
|
}
|
|
2596
2654
|
function dist_check(section) {
|
|
@@ -2600,7 +2658,7 @@ function dist_check(section) {
|
|
|
2600
2658
|
} else if ('string' != typeof section) throw new BrowserslistError(FORMAT);
|
|
2601
2659
|
}
|
|
2602
2660
|
function parsePackage(file) {
|
|
2603
|
-
let config = JSON.parse(
|
|
2661
|
+
let config = JSON.parse(node_fs.readFileSync(file).toString().replace(/^\uFEFF/m, ''));
|
|
2604
2662
|
if (config.browserlist && !config.browserslist) throw new BrowserslistError(`\`browserlist\` key instead of \`browserslist\` in ${file}`);
|
|
2605
2663
|
let list = config.browserslist;
|
|
2606
2664
|
for(let i in Array.isArray(list) && (list = {
|
|
@@ -2627,24 +2685,24 @@ function parseConfig(string) {
|
|
|
2627
2685
|
}
|
|
2628
2686
|
function readConfig(file) {
|
|
2629
2687
|
if (!isFile(file)) throw new BrowserslistError(`Can't read ${file} config`);
|
|
2630
|
-
return parseConfig(
|
|
2688
|
+
return parseConfig(node_fs.readFileSync(file, 'utf-8'));
|
|
2631
2689
|
}
|
|
2632
2690
|
function parsePackageOrReadConfig(file) {
|
|
2633
|
-
return 'package.json' ===
|
|
2691
|
+
return 'package.json' === node_path.basename(file) ? parsePackage(file) : readConfig(file);
|
|
2634
2692
|
}
|
|
2635
2693
|
function pickEnv(config, opts) {
|
|
2636
2694
|
return 'object' != typeof config ? config : config['string' == typeof opts.env ? opts.env : process.env.BROWSERSLIST_ENV ? process.env.BROWSERSLIST_ENV : process.env.NODE_ENV ? process.env.NODE_ENV : 'production'] || config.defaults;
|
|
2637
2695
|
}
|
|
2638
2696
|
function eachParent(file, callback) {
|
|
2639
|
-
let dir = isFile(file) ?
|
|
2697
|
+
let dir = isFile(file) ? node_path.dirname(file) : file, loc = node_path.resolve(dir);
|
|
2640
2698
|
do {
|
|
2641
2699
|
let result = callback(loc);
|
|
2642
2700
|
if (void 0 !== result) return result;
|
|
2643
|
-
}while (loc !== (loc =
|
|
2701
|
+
}while (loc !== (loc = node_path.dirname(loc)));
|
|
2644
2702
|
}
|
|
2645
2703
|
function findConfigFile(from) {
|
|
2646
2704
|
return eachParent(from, (dir)=>{
|
|
2647
|
-
let pkgBrowserslist, config =
|
|
2705
|
+
let pkgBrowserslist, config = node_path.join(dir, 'browserslist'), pkg = node_path.join(dir, 'package.json'), rc = node_path.join(dir, '.browserslistrc');
|
|
2648
2706
|
if (isFile(pkg)) try {
|
|
2649
2707
|
pkgBrowserslist = parsePackage(pkg);
|
|
2650
2708
|
} catch (e) {
|
|
@@ -2659,11 +2717,11 @@ function findConfigFile(from) {
|
|
|
2659
2717
|
}
|
|
2660
2718
|
let configCache = {};
|
|
2661
2719
|
function findConfig(from) {
|
|
2662
|
-
let resolved, fromDir = isFile(from =
|
|
2720
|
+
let resolved, fromDir = isFile(from = node_path.resolve(from)) ? node_path.dirname(from) : from;
|
|
2663
2721
|
if (fromDir in configCache) return configCache[fromDir];
|
|
2664
2722
|
let configFile = findConfigFile(from);
|
|
2665
2723
|
configFile && (resolved = parsePackageOrReadConfig(configFile));
|
|
2666
|
-
let configDir = configFile &&
|
|
2724
|
+
let configDir = configFile && node_path.dirname(configFile);
|
|
2667
2725
|
return eachParent(from, (dir)=>{
|
|
2668
2726
|
if (resolved && (configCache[dir] = resolved), dir === configDir) return null;
|
|
2669
2727
|
}), resolved;
|
|
@@ -2677,31 +2735,31 @@ function loadConfig(opts) {
|
|
|
2677
2735
|
}
|
|
2678
2736
|
}
|
|
2679
2737
|
function toRelativePath(base, filepath) {
|
|
2680
|
-
let relativePath =
|
|
2681
|
-
return '' === relativePath ? `.${
|
|
2738
|
+
let relativePath = relative(base, filepath);
|
|
2739
|
+
return '' === relativePath ? `.${sep}` : relativePath.startsWith('.') ? relativePath : `.${sep}${relativePath}`;
|
|
2682
2740
|
}
|
|
2683
2741
|
function getCommonParentPath(paths) {
|
|
2684
2742
|
let uniquePaths = [
|
|
2685
2743
|
...new Set(paths)
|
|
2686
2744
|
];
|
|
2687
2745
|
if (1 === uniquePaths.length) return uniquePaths[0];
|
|
2688
|
-
let [first, ...rest] = uniquePaths.map((p)=>p.split(
|
|
2746
|
+
let [first, ...rest] = uniquePaths.map((p)=>p.split(sep)), common = [];
|
|
2689
2747
|
for(let i = 0; i < first.length; i++){
|
|
2690
2748
|
let segment = first[i];
|
|
2691
2749
|
if (rest.every((p)=>p[i] === segment)) common.push(segment);
|
|
2692
2750
|
else break;
|
|
2693
2751
|
}
|
|
2694
|
-
return common.join(
|
|
2752
|
+
return common.join(sep);
|
|
2695
2753
|
}
|
|
2696
|
-
let
|
|
2754
|
+
let ensureAbsolutePath = (base, filePath)=>external_node_path_isAbsolute(filePath) ? filePath : join(base, filePath), getPathnameFromUrl = (url)=>{
|
|
2697
2755
|
try {
|
|
2698
2756
|
return url ? new URL(url, 'http://localhost').pathname : url;
|
|
2699
2757
|
} catch {
|
|
2700
2758
|
return url;
|
|
2701
2759
|
}
|
|
2702
|
-
}, dedupeNestedPaths = (paths)=>paths.sort((p1, p2)=>p2.length > p1.length ? -1 : 1).reduce((prev, curr)=>prev.find((p)=>curr.startsWith(p) || curr === p) ? prev : prev.concat(curr), []), toPosixPath = (filepath)=>'/' ===
|
|
2760
|
+
}, dedupeNestedPaths = (paths)=>paths.sort((p1, p2)=>p2.length > p1.length ? -1 : 1).reduce((prev, curr)=>prev.find((p)=>curr.startsWith(p) || curr === p) ? prev : prev.concat(curr), []), toPosixPath = (filepath)=>'/' === sep ? filepath : filepath.replace(/\\/g, '/'), normalizeRuleConditionPath = (filepath)=>isWindows && 'string' == typeof filepath && filepath.includes('/') && win32.isAbsolute(filepath) ? filepath.replace(/\//g, '\\') : filepath, isFileSync = (filePath)=>{
|
|
2703
2761
|
try {
|
|
2704
|
-
return
|
|
2762
|
+
return node_fs.statSync(filePath, {
|
|
2705
2763
|
throwIfNoEntry: !1
|
|
2706
2764
|
})?.isFile();
|
|
2707
2765
|
} catch (_) {
|
|
@@ -2709,7 +2767,7 @@ let getCompiledPath = (packageName)=>(0, external_node_path_.join)(COMPILED_PATH
|
|
|
2709
2767
|
}
|
|
2710
2768
|
};
|
|
2711
2769
|
function isEmptyDir(path) {
|
|
2712
|
-
let files =
|
|
2770
|
+
let files = node_fs.readdirSync(path);
|
|
2713
2771
|
return 0 === files.length || 1 === files.length && '.git' === files[0];
|
|
2714
2772
|
}
|
|
2715
2773
|
let findExists = (files)=>{
|
|
@@ -2717,10 +2775,10 @@ let findExists = (files)=>{
|
|
|
2717
2775
|
return !1;
|
|
2718
2776
|
};
|
|
2719
2777
|
async function pathExists(path) {
|
|
2720
|
-
return
|
|
2778
|
+
return node_fs.promises.access(path).then(()=>!0).catch(()=>!1);
|
|
2721
2779
|
}
|
|
2722
2780
|
async function isFileExists(file) {
|
|
2723
|
-
return
|
|
2781
|
+
return node_fs.promises.access(file, node_fs.constants.F_OK).then(()=>!0).catch(()=>!1);
|
|
2724
2782
|
}
|
|
2725
2783
|
async function fileExistsByCompilation({ inputFileSystem }, filePath) {
|
|
2726
2784
|
return new Promise((resolve)=>{
|
|
@@ -2738,16 +2796,16 @@ function readFileAsync(fs, filename) {
|
|
|
2738
2796
|
}
|
|
2739
2797
|
async function emptyDir(dir, keep = [], checkExists = !0) {
|
|
2740
2798
|
if (!checkExists || await pathExists(dir)) try {
|
|
2741
|
-
let entries = await
|
|
2799
|
+
let entries = await node_fs.promises.readdir(dir, {
|
|
2742
2800
|
withFileTypes: !0
|
|
2743
2801
|
});
|
|
2744
2802
|
await Promise.all(entries.map(async (entry)=>{
|
|
2745
|
-
let fullPath =
|
|
2803
|
+
let fullPath = node_path.join(dir, entry.name);
|
|
2746
2804
|
if (keep.length) {
|
|
2747
2805
|
let posixFullPath = toPosixPath(fullPath);
|
|
2748
2806
|
if (keep.some((regex)=>regex.test(posixFullPath))) return;
|
|
2749
2807
|
}
|
|
2750
|
-
entry.isDirectory() ? (await emptyDir(fullPath, keep, !1), keep.length || await
|
|
2808
|
+
entry.isDirectory() ? (await emptyDir(fullPath, keep, !1), keep.length || await node_fs.promises.rmdir(fullPath)) : await node_fs.promises.unlink(fullPath);
|
|
2751
2809
|
}));
|
|
2752
2810
|
} catch (err) {
|
|
2753
2811
|
src_logger.debug(`failed to empty dir: ${dir}`), src_logger.debug(err);
|
|
@@ -2764,6 +2822,7 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2764
2822
|
'resolve.extensions',
|
|
2765
2823
|
'resolve.conditionNames',
|
|
2766
2824
|
'resolve.mainFields',
|
|
2825
|
+
'dev.writeToDisk',
|
|
2767
2826
|
'provider'
|
|
2768
2827
|
]), mergeConfig_merge = (x, y, path = '')=>{
|
|
2769
2828
|
if (((key)=>{
|
|
@@ -2868,7 +2927,7 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2868
2927
|
scriptLoading: 'defer',
|
|
2869
2928
|
implementation: 'js'
|
|
2870
2929
|
},
|
|
2871
|
-
resolve: (swcHelpersPath || (swcHelpersPath = (
|
|
2930
|
+
resolve: (swcHelpersPath || (swcHelpersPath = external_node_path_dirname(vendors_require.resolve('@swc/helpers/package.json'))), {
|
|
2872
2931
|
alias: {
|
|
2873
2932
|
'@swc/helpers': swcHelpersPath
|
|
2874
2933
|
},
|
|
@@ -2965,7 +3024,7 @@ function getDefaultEntry(root) {
|
|
|
2965
3024
|
'cts',
|
|
2966
3025
|
'mjs',
|
|
2967
3026
|
'cjs'
|
|
2968
|
-
].map((ext)=>
|
|
3027
|
+
].map((ext)=>join(root, `src/index.${ext}`)));
|
|
2969
3028
|
return entryFile ? {
|
|
2970
3029
|
index: entryFile
|
|
2971
3030
|
} : {};
|
|
@@ -2976,7 +3035,7 @@ let withDefaultConfig = async (rootPath, userConfig)=>{
|
|
|
2976
3035
|
imports: !0,
|
|
2977
3036
|
entries: !1
|
|
2978
3037
|
}), !config.source.tsconfigPath) {
|
|
2979
|
-
let tsconfigPath =
|
|
3038
|
+
let tsconfigPath = join(rootPath, 'tsconfig.json');
|
|
2980
3039
|
await isFileExists(tsconfigPath) && (config.source.tsconfigPath = tsconfigPath);
|
|
2981
3040
|
}
|
|
2982
3041
|
return config;
|
|
@@ -2985,26 +3044,26 @@ function exit(exitCode, type) {
|
|
|
2985
3044
|
if (!isCalled) {
|
|
2986
3045
|
for (let callback of (isCalled = !0, exitHook_callbacks))callback(exitCode);
|
|
2987
3046
|
if ('SIGINT' === type) {
|
|
2988
|
-
let listeners =
|
|
2989
|
-
Array.isArray(listeners) && listeners.length <= 1 &&
|
|
3047
|
+
let listeners = node_process.listeners('SIGINT');
|
|
3048
|
+
Array.isArray(listeners) && listeners.length <= 1 && node_process.exit(exitCode);
|
|
2990
3049
|
}
|
|
2991
3050
|
}
|
|
2992
3051
|
}
|
|
2993
3052
|
function exitHook(onExit) {
|
|
2994
|
-
return exitHook_callbacks.add(onExit), isRegistered || (isRegistered = !0,
|
|
2995
|
-
exit(
|
|
2996
|
-
}),
|
|
2997
|
-
exit(
|
|
2998
|
-
}),
|
|
3053
|
+
return exitHook_callbacks.add(onExit), isRegistered || (isRegistered = !0, node_process.on('SIGINT', ()=>{
|
|
3054
|
+
exit(external_node_os_constants.signals.SIGINT + 128, 'SIGINT');
|
|
3055
|
+
}), node_process.once('SIGTERM', ()=>{
|
|
3056
|
+
exit(external_node_os_constants.signals.SIGTERM + 128, 'SIGTERM');
|
|
3057
|
+
}), node_process.once('exit', (exitCode)=>{
|
|
2999
3058
|
exit(exitCode, 'exit');
|
|
3000
3059
|
})), ()=>{
|
|
3001
3060
|
exitHook_callbacks.delete(onExit);
|
|
3002
3061
|
};
|
|
3003
3062
|
}
|
|
3004
|
-
let
|
|
3063
|
+
let addTrailingSlash = (s)=>s.endsWith('/') ? s : `${s}/`, isURL = (str)=>str.startsWith('http') || str.startsWith('//'), urlJoin = (base, path)=>{
|
|
3005
3064
|
let [urlProtocol, baseUrl] = base.split('://');
|
|
3006
|
-
return `${urlProtocol}://${
|
|
3007
|
-
}, ensureAssetPrefix = (url, assetPrefix = DEFAULT_ASSET_PREFIX)=>url.startsWith('//') ||
|
|
3065
|
+
return `${urlProtocol}://${posix.join(baseUrl, path)}`;
|
|
3066
|
+
}, ensureAssetPrefix = (url, assetPrefix = DEFAULT_ASSET_PREFIX)=>url.startsWith('//') || external_node_url_URL.canParse(url) || 'auto' === assetPrefix || 'function' == typeof assetPrefix ? url : assetPrefix.startsWith('http') ? urlJoin(assetPrefix, url) : assetPrefix.startsWith('//') ? urlJoin(`https:${assetPrefix}`, url).replace('https:', '') : posix.join(assetPrefix, url), formatPublicPath = (publicPath, withSlash = !0)=>'auto' === publicPath || '' === publicPath ? publicPath : withSlash ? addTrailingSlash(publicPath) : publicPath.replace(/\/+$/, ''), getPublicPathFromChain = (chain, withSlash = !0)=>{
|
|
3008
3067
|
let publicPath = chain.output.get('publicPath');
|
|
3009
3068
|
return 'string' == typeof publicPath ? formatPublicPath(publicPath, withSlash) : formatPublicPath(DEFAULT_ASSET_PREFIX, withSlash);
|
|
3010
3069
|
};
|
|
@@ -3127,7 +3186,7 @@ async function initPlugins({ context, pluginManager }) {
|
|
|
3127
3186
|
}
|
|
3128
3187
|
function getHTMLPathByEntry(entryName, config) {
|
|
3129
3188
|
let filename = getFilename(config, 'html').replace('[name]', entryName), prefix = config.output.distPath.html;
|
|
3130
|
-
return prefix.startsWith('/') && src_logger.warn(`${color.dim('[rsbuild:config]')} Absolute path is not recommended at ${color.yellow(`output.distPath.html: "${prefix}"`)}, use relative path instead.`),
|
|
3189
|
+
return prefix.startsWith('/') && src_logger.warn(`${color.dim('[rsbuild:config]')} Absolute path is not recommended at ${color.yellow(`output.distPath.html: "${prefix}"`)}, use relative path instead.`), posix.join(prefix, filename).replace(/^\/+/, '');
|
|
3131
3190
|
}
|
|
3132
3191
|
let mapProcessAssetsStage = (stage)=>{
|
|
3133
3192
|
let { Compilation } = core_rspack;
|
|
@@ -3245,7 +3304,7 @@ function initPluginAPI({ context, pluginManager }) {
|
|
|
3245
3304
|
if (descriptor.targets && !descriptor.targets.includes(target) || descriptor.environments && !descriptor.environments.includes(environmentContext.name)) return;
|
|
3246
3305
|
let rule = chain.module.rule(id);
|
|
3247
3306
|
descriptor.test && rule.test(descriptor.test), descriptor.resourceQuery && rule.resourceQuery(descriptor.resourceQuery), descriptor.layer && rule.layer(descriptor.layer), descriptor.issuerLayer && rule.issuerLayer(descriptor.issuerLayer), descriptor.issuer && rule.issuer(descriptor.issuer), descriptor.with && rule.with(descriptor.with), descriptor.mimetype && rule.mimetype(descriptor.mimetype), descriptor.order && 'default' !== descriptor.order ? rule.enforce(descriptor.order) : descriptor.enforce && rule.enforce(descriptor.enforce);
|
|
3248
|
-
let
|
|
3307
|
+
let loaderPath = join(dirname, descriptor.raw ? 'transformRawLoader.mjs' : 'transformLoader.mjs');
|
|
3249
3308
|
rule.use(id).loader(loaderPath).options({
|
|
3250
3309
|
id,
|
|
3251
3310
|
getEnvironment: ()=>environmentContext
|
|
@@ -3397,9 +3456,9 @@ function createPublicContext(context) {
|
|
|
3397
3456
|
});
|
|
3398
3457
|
}
|
|
3399
3458
|
async function createContext(options, userConfig) {
|
|
3400
|
-
let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath =
|
|
3459
|
+
let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = join(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
3401
3460
|
return {
|
|
3402
|
-
version: "2.0.0-beta.
|
|
3461
|
+
version: "2.0.0-beta.8",
|
|
3403
3462
|
rootPath,
|
|
3404
3463
|
distPath: '',
|
|
3405
3464
|
cachePath,
|
|
@@ -3434,33 +3493,33 @@ async function emitConfigFiles({ bundlerConfigs, environmentConfigs, extraConfig
|
|
|
3434
3493
|
...environmentConfigs.map(({ name, content })=>{
|
|
3435
3494
|
let outputFile = isSingle ? 'rsbuild.config.mjs' : `rsbuild.config.${name}.mjs`, label = isSingle ? 'Rsbuild config' : `Rsbuild config (${name})`;
|
|
3436
3495
|
return {
|
|
3437
|
-
path:
|
|
3496
|
+
path: join(outputPath, outputFile),
|
|
3438
3497
|
label,
|
|
3439
3498
|
content
|
|
3440
3499
|
};
|
|
3441
3500
|
}),
|
|
3442
3501
|
...bundlerConfigs.map(({ name, content })=>{
|
|
3443
|
-
let
|
|
3444
|
-
return
|
|
3502
|
+
let outputFilePath = join(outputPath, `rspack.config.${name}.mjs`);
|
|
3503
|
+
return node_fs.existsSync(outputFilePath) && (outputFilePath = outputFilePath.replace(/\.mjs$/, `.${Date.now()}.mjs`)), {
|
|
3445
3504
|
path: outputFilePath,
|
|
3446
3505
|
label: `Rspack Config (${name})`,
|
|
3447
3506
|
content
|
|
3448
3507
|
};
|
|
3449
3508
|
}),
|
|
3450
3509
|
...(extraConfigs || []).map(({ name, content })=>({
|
|
3451
|
-
path:
|
|
3510
|
+
path: join(outputPath, `${name}.config.mjs`),
|
|
3452
3511
|
label: `${upperFirst(name)} Config`,
|
|
3453
3512
|
content
|
|
3454
3513
|
}))
|
|
3455
3514
|
];
|
|
3456
|
-
await
|
|
3515
|
+
await node_fs.promises.mkdir(outputPath, {
|
|
3457
3516
|
recursive: !0
|
|
3458
|
-
}), await Promise.all(files.map(async (item)=>
|
|
3517
|
+
}), await Promise.all(files.map(async (item)=>node_fs.promises.writeFile(item.path, `export default ${item.content}`)));
|
|
3459
3518
|
let fileInfos = files.map((item)=>` - ${color.bold(color.yellow(item.label))}: ${color.underline(item.path)}`).join('\n');
|
|
3460
3519
|
src_logger.success(`config inspection completed, generated files: \n\n${fileInfos}\n`);
|
|
3461
3520
|
}
|
|
3462
3521
|
function stringifyConfig(config, verbose) {
|
|
3463
|
-
return
|
|
3522
|
+
return dist_src.toString(config, {
|
|
3464
3523
|
verbose
|
|
3465
3524
|
});
|
|
3466
3525
|
}
|
|
@@ -3487,7 +3546,7 @@ async function inspectConfig_inspectConfig({ context, pluginManager, bundlerConf
|
|
|
3487
3546
|
}
|
|
3488
3547
|
let outputPath = ((context, inspectOptions)=>{
|
|
3489
3548
|
let { outputPath } = inspectOptions;
|
|
3490
|
-
return outputPath ? (
|
|
3549
|
+
return outputPath ? external_node_path_isAbsolute(outputPath) ? outputPath : join(context.distPath, outputPath) : join(context.distPath, RSBUILD_OUTPUTS_PATH);
|
|
3491
3550
|
})(context, inspectOptions), stringifiedExtraConfigs = inspectOptions.extraConfigs ? Object.entries(inspectOptions.extraConfigs).map(([name, content])=>({
|
|
3492
3551
|
name,
|
|
3493
3552
|
content: 'string' == typeof content ? content : stringifyConfig(content, inspectOptions.verbose)
|
|
@@ -3548,7 +3607,7 @@ function reduceConfigsMergeContext({ initial, config, ctx, mergeFn = Object.assi
|
|
|
3548
3607
|
}
|
|
3549
3608
|
async function modifyBundlerChain(context, utils) {
|
|
3550
3609
|
src_logger.debug('applying modifyBundlerChain hook');
|
|
3551
|
-
let rspackChain = new
|
|
3610
|
+
let rspackChain = new dist_src(), [modifiedBundlerChain] = await context.hooks.modifyBundlerChain.callChain({
|
|
3552
3611
|
environment: utils.environment.name,
|
|
3553
3612
|
args: [
|
|
3554
3613
|
rspackChain,
|
|
@@ -3762,7 +3821,7 @@ async function initRsbuildConfig({ context, pluginManager }) {
|
|
|
3762
3821
|
let normalizedBaseConfig = (config = context.config, rootPath = context.rootPath, config.server ||= {}, config.server.host = 'string' == typeof (host = config.server.host) ? host : !0 === host ? ALL_INTERFACES_IPV4 : LOCALHOST, config.server.publicDir = ((rootPath, publicDir)=>{
|
|
3763
3822
|
if (!1 === publicDir) return [];
|
|
3764
3823
|
let defaultConfig = {
|
|
3765
|
-
name:
|
|
3824
|
+
name: join(rootPath, 'public'),
|
|
3766
3825
|
copyOnBuild: 'auto',
|
|
3767
3826
|
watch: !1,
|
|
3768
3827
|
ignore: []
|
|
@@ -3776,7 +3835,7 @@ async function initRsbuildConfig({ context, pluginManager }) {
|
|
|
3776
3835
|
...defaultConfig,
|
|
3777
3836
|
...options
|
|
3778
3837
|
};
|
|
3779
|
-
return (
|
|
3838
|
+
return external_node_path_isAbsolute(merged.name) || (merged.name = join(rootPath, merged.name)), merged;
|
|
3780
3839
|
};
|
|
3781
3840
|
return Array.isArray(publicDir) ? publicDir.map((options)=>mergeWithDefault(options)) : [
|
|
3782
3841
|
mergeWithDefault(publicDir)
|
|
@@ -3881,13 +3940,13 @@ async function initConfigs_initConfigs({ context, pluginManager, rsbuildOptions
|
|
|
3881
3940
|
};
|
|
3882
3941
|
}
|
|
3883
3942
|
function cutPath(originalFilePath, root) {
|
|
3884
|
-
let prefix = root.endsWith(
|
|
3943
|
+
let prefix = root.endsWith(sep) ? root : root + sep, filePath = originalFilePath;
|
|
3885
3944
|
filePath.startsWith(prefix) && (filePath = filePath.slice(prefix.length));
|
|
3886
|
-
let parts = filePath.split(
|
|
3887
|
-
return parts.length > 3 ? parts.slice(-3).join(
|
|
3945
|
+
let parts = filePath.split(sep).filter(Boolean);
|
|
3946
|
+
return parts.length > 3 ? parts.slice(-3).join(sep) : parts.join(sep);
|
|
3888
3947
|
}
|
|
3889
3948
|
function isLikelyFile(filePath) {
|
|
3890
|
-
return (filePath.split(
|
|
3949
|
+
return (filePath.split(sep).pop() || '').includes('.');
|
|
3891
3950
|
}
|
|
3892
3951
|
function formatFileList(paths, rootPath) {
|
|
3893
3952
|
let files = paths.filter(isLikelyFile);
|
|
@@ -4154,8 +4213,8 @@ function loadEnv({ cwd = process.cwd(), mode = process.env.NODE_ENV || '', prefi
|
|
|
4154
4213
|
'.env.local',
|
|
4155
4214
|
`.env.${mode}`,
|
|
4156
4215
|
`.env.${mode}.local`
|
|
4157
|
-
].map((filename)=>
|
|
4158
|
-
for (let envPath of filePaths)Object.assign(parsed, loadEnv_parse(
|
|
4216
|
+
].map((filename)=>join(cwd, filename)).filter(isFileSync), parsed = {};
|
|
4217
|
+
for (let envPath of filePaths)Object.assign(parsed, loadEnv_parse(node_fs.readFileSync(envPath))), src_logger.debug('loaded env file:', envPath);
|
|
4159
4218
|
parsed.NODE_ENV && (processEnv.NODE_ENV = parsed.NODE_ENV), (0, main.expand)({
|
|
4160
4219
|
parsed,
|
|
4161
4220
|
processEnv
|
|
@@ -4199,10 +4258,10 @@ function getRegExpForExts(exts) {
|
|
|
4199
4258
|
return RegExp(1 === normalizedExts.length ? `\\.${matcher}$` : `\\.(?:${matcher})$`, 'i');
|
|
4200
4259
|
}
|
|
4201
4260
|
function getCacheDirectory({ cacheDirectory }, context) {
|
|
4202
|
-
return cacheDirectory ? (
|
|
4261
|
+
return cacheDirectory ? external_node_path_isAbsolute(cacheDirectory) ? cacheDirectory : join(context.rootPath, cacheDirectory) : join(context.cachePath, 'rspack');
|
|
4203
4262
|
}
|
|
4204
4263
|
async function getBuildDependencies(context, config, environmentContext, additionalDependencies) {
|
|
4205
|
-
let rootPackageJson =
|
|
4264
|
+
let rootPackageJson = join(context.rootPath, 'package.json'), browserslistConfig = join(context.rootPath, '.browserslistrc'), buildDependencies = {};
|
|
4206
4265
|
await isFileExists(rootPackageJson) && (buildDependencies.packageJson = [
|
|
4207
4266
|
rootPackageJson
|
|
4208
4267
|
]);
|
|
@@ -4219,12 +4278,12 @@ async function getBuildDependencies(context, config, environmentContext, additio
|
|
|
4219
4278
|
'js',
|
|
4220
4279
|
'cjs',
|
|
4221
4280
|
'mjs'
|
|
4222
|
-
].map((ext)=>
|
|
4281
|
+
].map((ext)=>join(context.rootPath, `tailwind.config.${ext}`)));
|
|
4223
4282
|
return tailwindConfig && (buildDependencies.tailwindcss = [
|
|
4224
4283
|
tailwindConfig
|
|
4225
4284
|
]), additionalDependencies && (buildDependencies.additional = additionalDependencies), buildDependencies;
|
|
4226
4285
|
}
|
|
4227
|
-
let addTrailingSep = (dir)=>dir.endsWith(
|
|
4286
|
+
let addTrailingSep = (dir)=>dir.endsWith(sep) ? dir : dir + sep, isStrictSubdir = (parent, child)=>{
|
|
4228
4287
|
let parentDir = addTrailingSep(parent), childDir = addTrailingSep(child);
|
|
4229
4288
|
return parentDir !== childDir && childDir.startsWith(parentDir);
|
|
4230
4289
|
}, normalizeCleanDistPath = (userOptions)=>{
|
|
@@ -4262,7 +4321,7 @@ function getSwcMinimizerOptions(config, jsOptions) {
|
|
|
4262
4321
|
case 'none':
|
|
4263
4322
|
options.minimizerOptions.format.comments = !1, options.extractComments = !1;
|
|
4264
4323
|
}
|
|
4265
|
-
return (options.minimizerOptions.format.asciiOnly = 'ascii' === config.output.charset, jsOptions) ?
|
|
4324
|
+
return (options.minimizerOptions.format.asciiOnly = 'ascii' === config.output.charset, jsOptions) ? cjs_0_default()(options, jsOptions) : options;
|
|
4266
4325
|
}
|
|
4267
4326
|
function parseMinifyOptions(config) {
|
|
4268
4327
|
let isProd = 'production' === config.mode, { minify = !0 } = config.output;
|
|
@@ -4280,8 +4339,8 @@ function parseMinifyOptions(config) {
|
|
|
4280
4339
|
cssOptions: minify.cssOptions
|
|
4281
4340
|
};
|
|
4282
4341
|
}
|
|
4283
|
-
let
|
|
4284
|
-
var
|
|
4342
|
+
let postcss_load_config_src = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/index.js");
|
|
4343
|
+
var postcss_load_config_src_default = __webpack_require__.n(postcss_load_config_src);
|
|
4285
4344
|
function getLightningCSSLoaderOptions(config, targets, minify) {
|
|
4286
4345
|
let userOptions = 'object' == typeof config.tools.lightningcssLoader ? config.tools.lightningcssLoader : {}, initialOptions = {
|
|
4287
4346
|
targets,
|
|
@@ -4304,7 +4363,7 @@ let clonePostCSSConfig = (config)=>({
|
|
|
4304
4363
|
async function loadUserPostcssrc(root, postcssrcCache) {
|
|
4305
4364
|
let cached = postcssrcCache.get(root);
|
|
4306
4365
|
if (cached) return clonePostCSSConfig(await cached);
|
|
4307
|
-
let promise =
|
|
4366
|
+
let promise = postcss_load_config_src_default()({}, root).catch((err)=>{
|
|
4308
4367
|
if (err.message?.includes('No PostCSS Config found')) return {};
|
|
4309
4368
|
throw err;
|
|
4310
4369
|
});
|
|
@@ -4315,7 +4374,7 @@ let getPostcssLoaderOptions = async ({ config, root, postcssrcCache })=>{
|
|
|
4315
4374
|
userOptions.plugins ||= [];
|
|
4316
4375
|
let finalOptions = reduceConfigsWithContext({
|
|
4317
4376
|
initial: {
|
|
4318
|
-
implementation:
|
|
4377
|
+
implementation: join(COMPILED_PATH, 'postcss', 'index.js'),
|
|
4319
4378
|
postcssOptions: userOptions,
|
|
4320
4379
|
sourceMap: getCSSSourceMap(config)
|
|
4321
4380
|
},
|
|
@@ -4383,14 +4442,14 @@ async function gzipSize(input) {
|
|
|
4383
4442
|
return Buffer.byteLength(data);
|
|
4384
4443
|
}
|
|
4385
4444
|
function getSnapshotPath(dir, snapshotHash) {
|
|
4386
|
-
return snapshotHash ?
|
|
4445
|
+
return snapshotHash ? node_path.join(dir, `rsbuild/file-sizes-${snapshotHash}.json`) : node_path.join(dir, 'rsbuild/file-sizes.json');
|
|
4387
4446
|
}
|
|
4388
4447
|
function normalizeFilePath(filePath) {
|
|
4389
4448
|
return filePath.replace(/\.[a-f0-9]{8,}\./g, '.');
|
|
4390
4449
|
}
|
|
4391
4450
|
async function loadPrevSnapshots(snapshotPath) {
|
|
4392
4451
|
try {
|
|
4393
|
-
let content = await
|
|
4452
|
+
let content = await node_fs.promises.readFile(snapshotPath, 'utf-8');
|
|
4394
4453
|
return JSON.parse(content);
|
|
4395
4454
|
} catch {
|
|
4396
4455
|
return null;
|
|
@@ -4398,9 +4457,9 @@ async function loadPrevSnapshots(snapshotPath) {
|
|
|
4398
4457
|
}
|
|
4399
4458
|
async function saveSnapshots(snapshotPath, snapshots) {
|
|
4400
4459
|
try {
|
|
4401
|
-
await
|
|
4460
|
+
await node_fs.promises.mkdir(node_path.dirname(snapshotPath), {
|
|
4402
4461
|
recursive: !0
|
|
4403
|
-
}), await
|
|
4462
|
+
}), await node_fs.promises.writeFile(snapshotPath, JSON.stringify(snapshots, null, 2));
|
|
4404
4463
|
} catch (err) {
|
|
4405
4464
|
src_logger.debug('Failed to save file size snapshots:', err);
|
|
4406
4465
|
}
|
|
@@ -4436,7 +4495,7 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
|
|
|
4436
4495
|
if (!showTotal && !showDetail) return {
|
|
4437
4496
|
logs
|
|
4438
4497
|
};
|
|
4439
|
-
let relativeDistPath =
|
|
4498
|
+
let relativeDistPath = node_path.relative(rootPath, distPath), snapshot = {
|
|
4440
4499
|
files: {},
|
|
4441
4500
|
totalSize: 0,
|
|
4442
4501
|
totalGzipSize: 0
|
|
@@ -4458,7 +4517,7 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
|
|
|
4458
4517
|
isSignificantDiff(gzipDiff) && (gzipSizeLabel += ` ${formatDiff(gzipDiff).label}`);
|
|
4459
4518
|
}
|
|
4460
4519
|
}
|
|
4461
|
-
let folder =
|
|
4520
|
+
let folder = node_path.join(relativeDistPath, node_path.dirname(filePath)), filename = node_path.basename(filePath), filenameLabel = color.dim(folder + node_path.sep) + (JS_REGEX.test(filename) ? color.cyan(filename) : filename.endsWith('.css') ? color.yellow(filename) : filename.endsWith('.html') ? color.green(filename) : color.magenta(filename)), filenameLength = (folder + node_path.sep + filename).length;
|
|
4462
4521
|
return {
|
|
4463
4522
|
filePath,
|
|
4464
4523
|
filename,
|
|
@@ -4476,7 +4535,7 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
|
|
|
4476
4535
|
try {
|
|
4477
4536
|
content = value.source();
|
|
4478
4537
|
} catch {
|
|
4479
|
-
content =
|
|
4538
|
+
content = node_fs.readFileSync(node_path.join(distPath, filePath));
|
|
4480
4539
|
}
|
|
4481
4540
|
return {
|
|
4482
4541
|
filePath,
|
|
@@ -4627,17 +4686,17 @@ class RsbuildHtmlPlugin {
|
|
|
4627
4686
|
}
|
|
4628
4687
|
apply(compiler) {
|
|
4629
4688
|
let emitFavicon = async ({ compilation, favicon, faviconDistPath })=>{
|
|
4630
|
-
let fileContent, name =
|
|
4689
|
+
let fileContent, name = node_path.basename(favicon);
|
|
4631
4690
|
if (compilation.assets[name]) return name;
|
|
4632
4691
|
let inputFs = compilation.inputFileSystem;
|
|
4633
4692
|
if (!inputFs) return addCompilationError(compilation, `${color.dim('[rsbuild:html]')} Failed to read the favicon file as ${color.yellow('compilation.inputFileSystem')} is not available.`), null;
|
|
4634
|
-
let inputFilename =
|
|
4693
|
+
let inputFilename = node_path.isAbsolute(favicon) ? favicon : node_path.join(compilation.compiler.context, favicon);
|
|
4635
4694
|
try {
|
|
4636
4695
|
fileContent = await readFileAsync(inputFs, inputFilename);
|
|
4637
4696
|
} catch (error) {
|
|
4638
4697
|
return src_logger.debug(`read favicon error: ${error}`), addCompilationError(compilation, `${color.dim('[rsbuild:html]')} Failed to read the favicon file at ${color.yellow(inputFilename)}.`), null;
|
|
4639
4698
|
}
|
|
4640
|
-
let source = new core_rspack.sources.RawSource(fileContent, !1), outputFilename =
|
|
4699
|
+
let source = new core_rspack.sources.RawSource(fileContent, !1), outputFilename = node_path.posix.join(faviconDistPath, name);
|
|
4641
4700
|
return compilation.emitAsset(outputFilename, source), outputFilename;
|
|
4642
4701
|
}, addFavicon = async ({ headTags, favicon, faviconDistPath, compilation, publicPath })=>{
|
|
4643
4702
|
let href = favicon;
|
|
@@ -4796,12 +4855,12 @@ async function getTemplate(entryName, config, rootPath) {
|
|
|
4796
4855
|
templateContent: (mountId = config.html.mountId, `<!DOCTYPE html><html><head></head><body><div id="${mountId}"></div></body></html>`)
|
|
4797
4856
|
};
|
|
4798
4857
|
}
|
|
4799
|
-
let absolutePath = (
|
|
4858
|
+
let absolutePath = external_node_path_isAbsolute(templatePath) ? templatePath : node_path.join(rootPath, templatePath);
|
|
4800
4859
|
if (!existTemplatePath.has(absolutePath)) {
|
|
4801
4860
|
if (!await isFileExists(absolutePath)) throw Error(`${color.dim('[rsbuild:html]')} Failed to resolve HTML template, check if the file exists: ${color.yellow(absolutePath)}`);
|
|
4802
4861
|
existTemplatePath.add(absolutePath);
|
|
4803
4862
|
}
|
|
4804
|
-
let templateContent = await
|
|
4863
|
+
let templateContent = await node_fs.promises.readFile(absolutePath, 'utf-8');
|
|
4805
4864
|
return {
|
|
4806
4865
|
templatePath: absolutePath,
|
|
4807
4866
|
templateContent
|
|
@@ -4890,7 +4949,7 @@ let normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), joinUrlSegments = (
|
|
|
4890
4949
|
if (0 === environmentWithHtml.length) return [];
|
|
4891
4950
|
let commonDistPath = getCommonParentPath(environmentWithHtml.map((item)=>item.distPath));
|
|
4892
4951
|
return environmentWithHtml.reduce((prev, environmentContext)=>{
|
|
4893
|
-
let { distPath, config } = environmentContext, distPrefix =
|
|
4952
|
+
let { distPath, config } = environmentContext, distPrefix = relative(commonDistPath, distPath).split(sep).join('/'), routes = formatRoutes(environmentContext.htmlPaths, context.normalizedConfig.server.base, posix.join(distPrefix, config.output.distPath.html), config.html.outputStructure);
|
|
4894
4953
|
return prev.concat(...routes);
|
|
4895
4954
|
}, []);
|
|
4896
4955
|
}, formatRoutes = (entry, base, distPathPrefix, outputStructure)=>{
|
|
@@ -5005,7 +5064,7 @@ let getPort = async ({ host, port, strictPort, tryLimits = 20 })=>{
|
|
|
5005
5064
|
];
|
|
5006
5065
|
}
|
|
5007
5066
|
let ipv4Interfaces = (()=>{
|
|
5008
|
-
let interfaces =
|
|
5067
|
+
let interfaces = node_os.networkInterfaces(), ipv4Interfaces = new Map();
|
|
5009
5068
|
for (let key of Object.keys(interfaces))for (let detail of interfaces[key]){
|
|
5010
5069
|
let familyV4Value = 'string' == typeof detail.family ? 'IPv4' : 4;
|
|
5011
5070
|
detail.family !== familyV4Value || ipv4Interfaces.has(detail.address) || ipv4Interfaces.set(detail.address, detail);
|
|
@@ -5077,10 +5136,7 @@ async function openBrowser(url) {
|
|
|
5077
5136
|
src_logger.debug("failed to open start URL with apple script."), src_logger.debug(err);
|
|
5078
5137
|
}
|
|
5079
5138
|
}
|
|
5080
|
-
let { apps, default: baseOpen } = await import("./open.js")
|
|
5081
|
-
apps: mod.open_apps,
|
|
5082
|
-
default: mod.node_modules_open
|
|
5083
|
-
}));
|
|
5139
|
+
let { apps, default: baseOpen } = await import("./open.js");
|
|
5084
5140
|
try {
|
|
5085
5141
|
let options = browser ? {
|
|
5086
5142
|
app: {
|
|
@@ -5097,9 +5153,9 @@ async function openBrowser(url) {
|
|
|
5097
5153
|
}
|
|
5098
5154
|
let openedURLs = [], replacePortPlaceholder = (url, port)=>url.replace(/<port>/g, String(port));
|
|
5099
5155
|
function resolveUrl(str, base) {
|
|
5100
|
-
if (
|
|
5156
|
+
if (external_node_url_URL.canParse(str)) return str;
|
|
5101
5157
|
try {
|
|
5102
|
-
return new
|
|
5158
|
+
return new external_node_url_URL(str, base).href;
|
|
5103
5159
|
} catch {
|
|
5104
5160
|
throw Error(`${color.dim('[rsbuild:open]')} Invalid input: ${color.yellow(str)} is not a valid URL or pathname`);
|
|
5105
5161
|
}
|
|
@@ -5210,7 +5266,7 @@ function applyAlias({ chain, config, rootPath }) {
|
|
|
5210
5266
|
continue;
|
|
5211
5267
|
}
|
|
5212
5268
|
try {
|
|
5213
|
-
pkgPath = (
|
|
5269
|
+
pkgPath = external_node_path_dirname(vendors_require.resolve(`${pkgName}/package.json`, {
|
|
5214
5270
|
paths: [
|
|
5215
5271
|
rootPath
|
|
5216
5272
|
]
|
|
@@ -5225,8 +5281,8 @@ function applyAlias({ chain, config, rootPath }) {
|
|
|
5225
5281
|
let trailing = [
|
|
5226
5282
|
'node_modules',
|
|
5227
5283
|
...pkgName.split('/')
|
|
5228
|
-
].join(
|
|
5229
|
-
for(; !pkgPath.endsWith(trailing) && pkgPath.includes('node_modules');)pkgPath = (
|
|
5284
|
+
].join(sep);
|
|
5285
|
+
for(; !pkgPath.endsWith(trailing) && pkgPath.includes('node_modules');)pkgPath = external_node_path_dirname(pkgPath);
|
|
5230
5286
|
} catch {
|
|
5231
5287
|
src_logger.debug(`${color.dim('[rsbuild:resolve]')} The package ${color.yellow(pkgName)} is not resolved in the project, dedupe option for ${color.yellow(pkgName)} will be ignored.`);
|
|
5232
5288
|
continue;
|
|
@@ -5261,7 +5317,7 @@ function extractChunks(compilation, includeType) {
|
|
|
5261
5317
|
return chunks;
|
|
5262
5318
|
}
|
|
5263
5319
|
function getResourceType({ href, file }) {
|
|
5264
|
-
let url = new
|
|
5320
|
+
let url = new external_node_url_URL(file || href, 'https://example.com'), extension = node_path.extname(url.pathname).slice(1);
|
|
5265
5321
|
return [
|
|
5266
5322
|
'css'
|
|
5267
5323
|
].includes(extension) ? 'style' : IMAGE_EXTENSIONS.includes(extension) ? 'image' : VIDEO_EXTENSIONS.includes(extension) ? 'video' : AUDIO_EXTENSIONS.includes(extension) ? 'audio' : FONT_EXTENSIONS.includes(extension) ? 'font' : [
|
|
@@ -5352,15 +5408,15 @@ function resolveLayer(value) {
|
|
|
5352
5408
|
return "OVERVIEW" === value ? 'info' : "ALL" === value ? 'trace' : value;
|
|
5353
5409
|
}
|
|
5354
5410
|
async function ensureFileDir(outputFilePath) {
|
|
5355
|
-
let dir =
|
|
5356
|
-
await
|
|
5411
|
+
let dir = node_path.dirname(outputFilePath);
|
|
5412
|
+
await node_fs.promises.mkdir(dir, {
|
|
5357
5413
|
recursive: !0
|
|
5358
5414
|
});
|
|
5359
5415
|
}
|
|
5360
5416
|
async function applyProfile(root, filterValue, traceLayer = 'perfetto', traceOutput) {
|
|
5361
5417
|
if ('perfetto' !== traceLayer && 'logger' !== traceLayer) throw Error(`unsupported trace layer: ${traceLayer}`);
|
|
5362
5418
|
if (!traceOutput) {
|
|
5363
|
-
let timestamp = Date.now(), defaultOutputDir =
|
|
5419
|
+
let timestamp = Date.now(), defaultOutputDir = node_path.join(root, `.rspack-profile-${timestamp}-${process.pid}`), defaultRustTracePerfettoOutput = node_path.join(defaultOutputDir, 'rspack.pftrace');
|
|
5364
5420
|
traceOutput = 'perfetto' === traceLayer ? defaultRustTracePerfettoOutput : 'stdout';
|
|
5365
5421
|
}
|
|
5366
5422
|
let filter = resolveLayer(filterValue);
|
|
@@ -5573,12 +5629,12 @@ function applyCoreJs(swcConfig, polyfillMode, rootPath) {
|
|
|
5573
5629
|
}
|
|
5574
5630
|
})(rootPath), version = ((corejsPkgPath)=>{
|
|
5575
5631
|
try {
|
|
5576
|
-
let rawJson =
|
|
5632
|
+
let rawJson = node_fs.readFileSync(corejsPkgPath, 'utf-8'), { version } = JSON.parse(rawJson), [major, minor] = version.split('.');
|
|
5577
5633
|
return `${major}.${minor}`;
|
|
5578
5634
|
} catch {
|
|
5579
5635
|
return '3';
|
|
5580
5636
|
}
|
|
5581
|
-
})(coreJsPath), coreJsDir =
|
|
5637
|
+
})(coreJsPath), coreJsDir = node_path.dirname(coreJsPath);
|
|
5582
5638
|
return swcConfig.env.coreJs = version, 'usage' === polyfillMode && (swcConfig.env.shippedProposals = !0), coreJsDir;
|
|
5583
5639
|
}
|
|
5584
5640
|
function applyTransformImport(swcConfig, pluginImport) {
|
|
@@ -5638,7 +5694,7 @@ async function getFileFromUrl(url, outputFileSystem, context) {
|
|
|
5638
5694
|
if (pathname.includes('\0')) return {
|
|
5639
5695
|
errorCode: 400
|
|
5640
5696
|
};
|
|
5641
|
-
if (UP_PATH_REGEXP.test(
|
|
5697
|
+
if (UP_PATH_REGEXP.test(node_path.normalize(`./${pathname}`))) return {
|
|
5642
5698
|
errorCode: 403
|
|
5643
5699
|
};
|
|
5644
5700
|
let stat = async (filename)=>new Promise((resolve, reject)=>{
|
|
@@ -5648,9 +5704,9 @@ async function getFileFromUrl(url, outputFileSystem, context) {
|
|
|
5648
5704
|
}), { environmentList, publicPathnames } = context, distPaths = environmentList.map((env)=>env.distPath), possibleFilenames = new Set();
|
|
5649
5705
|
for (let [index, distPath] of distPaths.entries()){
|
|
5650
5706
|
let prefix = publicPathnames[index];
|
|
5651
|
-
prefix && '/' !== prefix && pathname.startsWith(prefix) && possibleFilenames.add(
|
|
5707
|
+
prefix && '/' !== prefix && pathname.startsWith(prefix) && possibleFilenames.add(node_path.join(distPath, pathname.slice(prefix.length)));
|
|
5652
5708
|
}
|
|
5653
|
-
for (let distPath of distPaths)possibleFilenames.add(
|
|
5709
|
+
for (let distPath of distPaths)possibleFilenames.add(node_path.join(distPath, pathname));
|
|
5654
5710
|
for (let filename of possibleFilenames){
|
|
5655
5711
|
let fsStats;
|
|
5656
5712
|
try {
|
|
@@ -5664,7 +5720,7 @@ async function getFileFromUrl(url, outputFileSystem, context) {
|
|
|
5664
5720
|
fsStats
|
|
5665
5721
|
};
|
|
5666
5722
|
if (fsStats.isDirectory()) {
|
|
5667
|
-
filename =
|
|
5723
|
+
filename = node_path.join(filename, 'index.html');
|
|
5668
5724
|
try {
|
|
5669
5725
|
fsStats = await stat(filename);
|
|
5670
5726
|
} catch {
|
|
@@ -5709,9 +5765,7 @@ function createReadStreamOrReadFileSync(filename, outputFileSystem, start, end)
|
|
|
5709
5765
|
};
|
|
5710
5766
|
}
|
|
5711
5767
|
async function getContentType(str) {
|
|
5712
|
-
let { lookup } = await import("./
|
|
5713
|
-
lookup: mod.lookup
|
|
5714
|
-
})), mime = lookup(str);
|
|
5768
|
+
let { lookup } = await import("./mrmime.js"), mime = lookup(str);
|
|
5715
5769
|
return !!mime && ((mime.startsWith('text/') || 'application/json' === mime || 'application/manifest+json' === mime) && (mime += '; charset=utf-8'), mime);
|
|
5716
5770
|
}
|
|
5717
5771
|
let BYTES_RANGE_REGEXP = /^ *bytes/i;
|
|
@@ -5914,26 +5968,26 @@ function createMiddleware(context, ready, outputFileSystem) {
|
|
|
5914
5968
|
}
|
|
5915
5969
|
async function setupOutputFileSystem(writeToDisk, compilers) {
|
|
5916
5970
|
if (!0 !== writeToDisk) {
|
|
5917
|
-
let { createFsFromVolume, Volume } = await import("./memfs.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/memfs@4.56.
|
|
5971
|
+
let { createFsFromVolume, Volume } = await import("./memfs.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/memfs@4.56.11_tslib@2.8.1/node_modules/memfs/lib/index.js", 23)), outputFileSystem = createFsFromVolume(new Volume());
|
|
5918
5972
|
for (let compiler of compilers)compiler.outputFileSystem = outputFileSystem;
|
|
5919
5973
|
}
|
|
5920
5974
|
let compiler = compilers.find((compiler)=>!!compiler.outputFileSystem);
|
|
5921
|
-
return compiler?.outputFileSystem ??
|
|
5975
|
+
return compiler?.outputFileSystem ?? node_fs;
|
|
5922
5976
|
}
|
|
5923
5977
|
function setupWriteToDisk(compilers, writeToDisk) {
|
|
5924
5978
|
for (let compiler of compilers)compiler.hooks.emit.tap('DevMiddleware', ()=>{
|
|
5925
5979
|
compiler.__hasRsbuildAssetEmittedCallback || (compiler.hooks.assetEmitted.tapAsync('DevMiddleware', (_file, info, callback)=>{
|
|
5926
5980
|
let { targetPath, content, compilation } = info;
|
|
5927
5981
|
if (!(!writeToDisk || 'function' != typeof writeToDisk || writeToDisk(targetPath, compilation.name))) return void callback();
|
|
5928
|
-
let dir =
|
|
5929
|
-
|
|
5982
|
+
let dir = node_path.dirname(targetPath), name = compiler.options.name ? `Child "${compiler.options.name}": ` : '';
|
|
5983
|
+
node_fs.mkdir(dir, {
|
|
5930
5984
|
recursive: !0
|
|
5931
5985
|
}, (mkdirError)=>{
|
|
5932
5986
|
if (mkdirError) {
|
|
5933
5987
|
src_logger.error(`[rsbuild:middleware] ${name}Unable to write "${dir}" directory to disk:\n${mkdirError.message}`), callback(mkdirError);
|
|
5934
5988
|
return;
|
|
5935
5989
|
}
|
|
5936
|
-
|
|
5990
|
+
node_fs.writeFile(targetPath, content, (writeFileError)=>{
|
|
5937
5991
|
if (writeFileError) {
|
|
5938
5992
|
src_logger.error(`[rsbuild:middleware] ${name}Unable to write "${targetPath}" asset to disk:\n${writeFileError.message}`), callback(writeFileError);
|
|
5939
5993
|
return;
|
|
@@ -5960,8 +6014,8 @@ function applyHMREntry({ config, compiler, token, resolvedHost, resolvedPort })
|
|
|
5960
6014
|
...config.dev.client
|
|
5961
6015
|
};
|
|
5962
6016
|
'<port>' === clientConfig.port && (clientConfig.port = resolvedPort);
|
|
5963
|
-
let hmrEntry = `import { init } from '${toPosixPath(
|
|
5964
|
-
${config.dev.client.overlay ? `import '${toPosixPath(
|
|
6017
|
+
let hmrEntry = `import { init } from '${toPosixPath(join(CLIENT_PATH, 'hmr.js'))}';
|
|
6018
|
+
${config.dev.client.overlay ? `import '${toPosixPath(join(CLIENT_PATH, 'overlay.js'))}';` : ''}
|
|
5965
6019
|
init(
|
|
5966
6020
|
'${token}',
|
|
5967
6021
|
${JSON.stringify(clientConfig)},
|
|
@@ -6133,10 +6187,7 @@ function parseNode(line) {
|
|
|
6133
6187
|
let isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.test(methodName), parseFrame = async (frame, fs, context, cachedTraceMap)=>{
|
|
6134
6188
|
let { file, column, lineNumber } = frame, sourceMapInfo = await getFileFromUrl(`${file}.map`, fs, context);
|
|
6135
6189
|
if (!sourceMapInfo || 'errorCode' in sourceMapInfo) return;
|
|
6136
|
-
let { TraceMap, originalPositionFor } = await import("./
|
|
6137
|
-
TraceMap: mod.TraceMap,
|
|
6138
|
-
originalPositionFor: mod.originalPositionFor
|
|
6139
|
-
})), sourceMapPath = sourceMapInfo.filename;
|
|
6190
|
+
let { TraceMap, originalPositionFor } = await import("./trace-mapping.js"), sourceMapPath = sourceMapInfo.filename;
|
|
6140
6191
|
try {
|
|
6141
6192
|
let tracer = cachedTraceMap.get(sourceMapPath);
|
|
6142
6193
|
if (!tracer) {
|
|
@@ -6169,8 +6220,8 @@ let isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.tes
|
|
|
6169
6220
|
if (!source) return;
|
|
6170
6221
|
let result = ((source, sourceMapPath, context)=>{
|
|
6171
6222
|
if (source.startsWith('webpack/runtime/')) return source;
|
|
6172
|
-
let absoluteSourcePath =
|
|
6173
|
-
return
|
|
6223
|
+
let absoluteSourcePath = node_path.isAbsolute(source) ? source : node_path.join(node_path.dirname(sourceMapPath), source);
|
|
6224
|
+
return node_path.relative(context.rootPath, absoluteSourcePath);
|
|
6174
6225
|
})(source, sourceMapPath, context);
|
|
6175
6226
|
return null !== line && (result += null === column ? `:${line}` : `:${line}:${column}`), result;
|
|
6176
6227
|
}, formatFrameLocation = (frame)=>{
|
|
@@ -6269,7 +6320,7 @@ function convertLinksInHtml(text, root) {
|
|
|
6269
6320
|
if (!file.startsWith('file://')) return file;
|
|
6270
6321
|
let windows = file.replace(FILE_URI_WINDOWS_RE, '$1');
|
|
6271
6322
|
return windows !== file ? windows : file.replace(FILE_URI_UNIX_RE, '');
|
|
6272
|
-
})(file)).includes('</span>') && !file.includes('<span'), filePath = hasClosingSpan ? file.replace('</span>', '') : file, isAbsolute =
|
|
6323
|
+
})(file)).includes('</span>') && !file.includes('<span'), filePath = hasClosingSpan ? file.replace('</span>', '') : file, isAbsolute = node_path.isAbsolute(filePath), absolutePath = root && !isAbsolute ? node_path.join(root, filePath) : filePath, displayPath = formatDisplayPath(filePath, isAbsolute, root);
|
|
6273
6324
|
return `<a class="file-link" data-file="${absolutePath}">${displayPath}</a>${hasClosingSpan ? '</span>' : ''}`;
|
|
6274
6325
|
});
|
|
6275
6326
|
return replacedLine.replace(URL_RE, (url)=>`<a class="url-link" href="${url}" target="_blank" rel="noopener noreferrer">${url}</a>`);
|
|
@@ -6311,10 +6362,10 @@ class SocketServer {
|
|
|
6311
6362
|
clearHeartbeatTimer() {
|
|
6312
6363
|
this.heartbeatTimer && (clearTimeout(this.heartbeatTimer), this.heartbeatTimer = null);
|
|
6313
6364
|
}
|
|
6314
|
-
prepare() {
|
|
6365
|
+
async prepare() {
|
|
6315
6366
|
this.clearHeartbeatTimer();
|
|
6316
|
-
let
|
|
6317
|
-
this.wsServer = new
|
|
6367
|
+
let { WebSocketServer } = await import("./ws.js");
|
|
6368
|
+
this.wsServer = new WebSocketServer({
|
|
6318
6369
|
noServer: !0,
|
|
6319
6370
|
path: this.options.client?.path
|
|
6320
6371
|
}), this.wsServer.on('error', (err)=>{
|
|
@@ -6469,12 +6520,12 @@ class BuildManager {
|
|
|
6469
6520
|
resolvedPort;
|
|
6470
6521
|
context;
|
|
6471
6522
|
constructor({ config, context, compiler, resolvedPort }){
|
|
6472
|
-
this.config = config, this.context = context, this.compiler = compiler, this.resolvedPort = resolvedPort, this.outputFileSystem =
|
|
6523
|
+
this.config = config, this.context = context, this.compiler = compiler, this.resolvedPort = resolvedPort, this.outputFileSystem = node_fs, this.socketServer = new SocketServer(context, config.dev, ()=>this.outputFileSystem), this.context.socketServer = this.socketServer;
|
|
6473
6524
|
}
|
|
6474
6525
|
async init() {
|
|
6475
|
-
await this.setupCompilationMiddleware(), this.socketServer.prepare();
|
|
6526
|
+
await this.setupCompilationMiddleware(), await this.socketServer.prepare();
|
|
6476
6527
|
let { compiler } = this;
|
|
6477
|
-
this.outputFileSystem = (compiler_isMultiCompiler(compiler) ? compiler.compilers[0].outputFileSystem : compiler.outputFileSystem) ||
|
|
6528
|
+
this.outputFileSystem = (compiler_isMultiCompiler(compiler) ? compiler.compilers[0].outputFileSystem : compiler.outputFileSystem) || node_fs;
|
|
6478
6529
|
}
|
|
6479
6530
|
watch() {
|
|
6480
6531
|
this.assetsMiddleware.watch();
|
|
@@ -6490,7 +6541,7 @@ class BuildManager {
|
|
|
6490
6541
|
});
|
|
6491
6542
|
});
|
|
6492
6543
|
}
|
|
6493
|
-
readFileSync = (fileName)=>'readFileSync' in this.outputFileSystem ? this.outputFileSystem.readFileSync(fileName, 'utf-8') :
|
|
6544
|
+
readFileSync = (fileName)=>'readFileSync' in this.outputFileSystem ? this.outputFileSystem.readFileSync(fileName, 'utf-8') : node_fs.readFileSync(fileName, 'utf-8');
|
|
6494
6545
|
async setupCompilationMiddleware() {
|
|
6495
6546
|
let { config, context } = this, middleware = await assets_middleware_assetsMiddleware({
|
|
6496
6547
|
config,
|
|
@@ -6641,7 +6692,7 @@ function historyApiFallback_historyApiFallbackMiddleware(options = {}) {
|
|
|
6641
6692
|
function parseReqUrl(req) {
|
|
6642
6693
|
let proto = req.headers['x-forwarded-proto'] || 'http', host = req.headers['x-forwarded-host'] || req.headers.host || LOCALHOST;
|
|
6643
6694
|
try {
|
|
6644
|
-
return new
|
|
6695
|
+
return new external_node_url_URL(req.url || '/', `${proto}://${host}`);
|
|
6645
6696
|
} catch {
|
|
6646
6697
|
return null;
|
|
6647
6698
|
}
|
|
@@ -6759,7 +6810,7 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
|
|
|
6759
6810
|
server.base && '/' !== server.base && middlewares.use(getBaseUrlMiddleware({
|
|
6760
6811
|
base: server.base
|
|
6761
6812
|
}));
|
|
6762
|
-
let { default: launchEditorMiddleware } = await import("./launch-editor-middleware.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/launch-editor-middleware@2.13.
|
|
6813
|
+
let { default: launchEditorMiddleware } = await import("./launch-editor-middleware.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/launch-editor-middleware@2.13.1/node_modules/launch-editor-middleware/index.js", 23));
|
|
6763
6814
|
if (middlewares.use('/__open-in-editor', launchEditorMiddleware()), middlewares.use((({ environments })=>async function viewingServedFilesMiddleware(req, res, next) {
|
|
6764
6815
|
if ('/rsbuild-dev-server' !== req.url.replace(postfixRE, '')) return void next();
|
|
6765
6816
|
res.writeHead(200, {
|
|
@@ -6830,10 +6881,10 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
|
|
|
6830
6881
|
});
|
|
6831
6882
|
};
|
|
6832
6883
|
if (pathname.endsWith('/')) {
|
|
6833
|
-
let newUrl = `${pathname}index.html`, filePath =
|
|
6884
|
+
let newUrl = `${pathname}index.html`, filePath = node_path.join(distPath, newUrl);
|
|
6834
6885
|
if (await middlewares_isFileExists(filePath, buildManager.outputFileSystem)) return void rewrite(newUrl);
|
|
6835
|
-
} else if (!
|
|
6836
|
-
let newUrl = `${pathname}.html`, filePath =
|
|
6886
|
+
} else if (!node_path.extname(pathname)) {
|
|
6887
|
+
let newUrl = `${pathname}.html`, filePath = node_path.join(distPath, newUrl);
|
|
6837
6888
|
if (await middlewares_isFileExists(filePath, buildManager.outputFileSystem)) return void rewrite(newUrl);
|
|
6838
6889
|
}
|
|
6839
6890
|
next();
|
|
@@ -6841,9 +6892,7 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
|
|
|
6841
6892
|
buildManager,
|
|
6842
6893
|
distPath: context.distPath
|
|
6843
6894
|
})), server.publicDir.length) {
|
|
6844
|
-
let { default: sirv } = await import("./sirv.js")
|
|
6845
|
-
default: mod.build
|
|
6846
|
-
}));
|
|
6895
|
+
let { default: sirv } = await import("./sirv.js");
|
|
6847
6896
|
for (let { name } of server.publicDir){
|
|
6848
6897
|
let sirvMiddleware = sirv(name, {
|
|
6849
6898
|
etag: !0,
|
|
@@ -6857,7 +6906,7 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
|
|
|
6857
6906
|
for (let callback of postCallbacks)await callback();
|
|
6858
6907
|
return server.historyApiFallback && (middlewares.use(historyApiFallback_historyApiFallbackMiddleware(!0 === server.historyApiFallback ? {} : server.historyApiFallback)), buildManager?.assetsMiddleware && middlewares.use(buildManager.assetsMiddleware)), buildManager && server.htmlFallback && middlewares.use((({ distPath, buildManager })=>async function htmlFallbackMiddleware(req, res, next) {
|
|
6859
6908
|
if (!maybeHTMLRequest(req) || '/favicon.ico' === req.url) return void next();
|
|
6860
|
-
let filePath =
|
|
6909
|
+
let filePath = node_path.join(distPath, 'index.html');
|
|
6861
6910
|
if (await middlewares_isFileExists(filePath, buildManager.outputFileSystem)) {
|
|
6862
6911
|
let newUrl = '/index.html';
|
|
6863
6912
|
isVerbose() && src_logger.debug(` ${req.method} ${req.url} ${color.yellow('fallback to')} ${newUrl}`), req.url = newUrl, buildManager.assetsMiddleware(req, res, (...args)=>{
|
|
@@ -6905,16 +6954,19 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
|
|
|
6905
6954
|
},
|
|
6906
6955
|
onUpgrade
|
|
6907
6956
|
};
|
|
6908
|
-
}, asModule = async (
|
|
6957
|
+
}, isModuleNamespaceObject = (moduleExports)=>'[object Module]' === Object.prototype.toString.call(moduleExports), asModule = async (moduleExports, context, unlinked)=>{
|
|
6909
6958
|
let { Module, SyntheticModule } = await import("node:vm");
|
|
6910
|
-
if (
|
|
6959
|
+
if (moduleExports instanceof Module) return moduleExports;
|
|
6911
6960
|
let exports = [
|
|
6912
6961
|
...new Set([
|
|
6913
6962
|
'default',
|
|
6914
|
-
...Object.keys(
|
|
6963
|
+
...Object.keys(moduleExports)
|
|
6915
6964
|
])
|
|
6916
6965
|
], syntheticModule = new SyntheticModule(exports, ()=>{
|
|
6917
|
-
for (let name of exports)
|
|
6966
|
+
for (let name of exports)if ('default' === name) {
|
|
6967
|
+
let defaultExport = isModuleNamespaceObject(moduleExports) && 'default' in moduleExports ? moduleExports.default : moduleExports;
|
|
6968
|
+
syntheticModule.setExport(name, defaultExport);
|
|
6969
|
+
} else syntheticModule.setExport(name, moduleExports[name]);
|
|
6918
6970
|
}, {
|
|
6919
6971
|
context
|
|
6920
6972
|
});
|
|
@@ -6939,11 +6991,11 @@ class BasicRunner {
|
|
|
6939
6991
|
}
|
|
6940
6992
|
getFile(modulePath, currentDirectory) {
|
|
6941
6993
|
if (Array.isArray(modulePath)) return {
|
|
6942
|
-
path:
|
|
6994
|
+
path: node_path.join(currentDirectory, '.array-require.js'),
|
|
6943
6995
|
content: `module.exports = (${modulePath.map((arg)=>`require(${JSON.stringify(`./${arg}`)})`).join(', ')});`,
|
|
6944
6996
|
subPath: ''
|
|
6945
6997
|
};
|
|
6946
|
-
let joinedPath = /^\.\.?\//.test(modulePath) ?
|
|
6998
|
+
let joinedPath = /^\.\.?\//.test(modulePath) ? node_path.join(currentDirectory, modulePath) : modulePath;
|
|
6947
6999
|
return this._options.isBundleOutput(joinedPath) ? {
|
|
6948
7000
|
path: joinedPath,
|
|
6949
7001
|
content: this._options.readFileSync(joinedPath),
|
|
@@ -6997,10 +7049,10 @@ class CommonJsRunner extends BasicRunner {
|
|
|
6997
7049
|
createModuleScope(requireFn, m, file) {
|
|
6998
7050
|
return {
|
|
6999
7051
|
...this.baseModuleScope,
|
|
7000
|
-
require: requireFn.bind(null,
|
|
7052
|
+
require: requireFn.bind(null, node_path.dirname(file.path)),
|
|
7001
7053
|
module: m,
|
|
7002
7054
|
exports: m.exports,
|
|
7003
|
-
__dirname:
|
|
7055
|
+
__dirname: node_path.dirname(file.path),
|
|
7004
7056
|
__filename: file.path,
|
|
7005
7057
|
define: cjs_define
|
|
7006
7058
|
};
|
|
@@ -7064,15 +7116,15 @@ class EsmRunner extends CommonJsRunner {
|
|
|
7064
7116
|
let esm = esmCache.get(file.path);
|
|
7065
7117
|
return (esm || (esm = new vm.SourceTextModule(file.content, {
|
|
7066
7118
|
identifier: file.path,
|
|
7067
|
-
url: `${
|
|
7119
|
+
url: `${pathToFileURL(file.path).href}?${esmIdentifier}`,
|
|
7068
7120
|
initializeImportMeta: (meta, _)=>{
|
|
7069
|
-
meta.url =
|
|
7121
|
+
meta.url = pathToFileURL(file.path).href;
|
|
7070
7122
|
},
|
|
7071
|
-
importModuleDynamically: async (specifier, module)=>asModule(await _require(
|
|
7123
|
+
importModuleDynamically: async (specifier, module)=>asModule(await _require(node_path.dirname(file.path), specifier, {
|
|
7072
7124
|
esmMode: 1
|
|
7073
7125
|
}), module.context)
|
|
7074
7126
|
}), esmCache.set(file.path, esm)), 2 === context.esmMode) ? esm : (async ()=>{
|
|
7075
|
-
if (await esm.link(async (specifier, referencingModule)=>asModule(await _require(
|
|
7127
|
+
if (await esm.link(async (specifier, referencingModule)=>asModule(await _require(node_path.dirname(referencingModule.identifier ?? fileURLToPath(referencingModule.url)), specifier, {
|
|
7076
7128
|
esmMode: 2
|
|
7077
7129
|
}), referencingModule.context, !0)), await esm.evaluate(), 1 === context.esmMode) return esm;
|
|
7078
7130
|
let ns = esm.namespace;
|
|
@@ -7115,7 +7167,7 @@ let runner_run = async ({ bundlePath, ...runnerFactoryOptions })=>{
|
|
|
7115
7167
|
}, []);
|
|
7116
7168
|
if (0 === files.length) throw Error(`${color.dim('[rsbuild:loadBundle]')} Failed to get bundle by entryName: ${color.yellow(entryName)}`);
|
|
7117
7169
|
if (files.length > 1) throw Error(`${color.dim('[rsbuild:loadBundle]')} Only support load single entry chunk, but got ${color.yellow(files.length)}: ${files.join(',')}`);
|
|
7118
|
-
let allChunkFiles = chunks?.flatMap((c)=>c.files).map((file)=>
|
|
7170
|
+
let allChunkFiles = chunks?.flatMap((c)=>c.files).map((file)=>join(outputPath, file)) || [];
|
|
7119
7171
|
return await runner_run({
|
|
7120
7172
|
bundlePath: files[0],
|
|
7121
7173
|
dist: outputPath,
|
|
@@ -7149,7 +7201,7 @@ let runner_run = async ({ bundlePath, ...runnerFactoryOptions })=>{
|
|
|
7149
7201
|
}, shutdownRefCount = 0, setupGracefulShutdown = ()=>{
|
|
7150
7202
|
shutdownRefCount++;
|
|
7151
7203
|
let onSigterm = ()=>{
|
|
7152
|
-
handleTermination(
|
|
7204
|
+
handleTermination(external_node_os_constants.signals.SIGTERM + 128);
|
|
7153
7205
|
};
|
|
7154
7206
|
process.once('SIGTERM', onSigterm);
|
|
7155
7207
|
let isCI = 'true' === process.env.CI, onStdinEnd = ()=>{
|
|
@@ -7223,13 +7275,9 @@ function prepareWatchOptions(paths, options = {}, type) {
|
|
|
7223
7275
|
}
|
|
7224
7276
|
let GLOB_REGEX = /[*?{}[\]()!+|]/;
|
|
7225
7277
|
async function createChokidar(pathOrGlobs, root, options) {
|
|
7226
|
-
let { default: chokidar } = await import("./chokidar.js").
|
|
7227
|
-
default: mod.chokidar
|
|
7228
|
-
})), watchFiles = new Set(), globPatterns = pathOrGlobs.filter((pathOrGlob)=>!!GLOB_REGEX.test(pathOrGlob) || (watchFiles.add(pathOrGlob), !1));
|
|
7278
|
+
let { default: chokidar } = await import("./chokidar.js"), watchFiles = new Set(), globPatterns = pathOrGlobs.filter((pathOrGlob)=>!!GLOB_REGEX.test(pathOrGlob) || (watchFiles.add(pathOrGlob), !1));
|
|
7229
7279
|
if (globPatterns.length) {
|
|
7230
|
-
let { glob } = await import("./tinyglobby.js")
|
|
7231
|
-
glob: mod.glob
|
|
7232
|
-
}));
|
|
7280
|
+
let { glob } = await import("./tinyglobby.js");
|
|
7233
7281
|
for (let file of (await glob(globPatterns, {
|
|
7234
7282
|
cwd: root,
|
|
7235
7283
|
absolute: !0
|
|
@@ -7324,7 +7372,7 @@ async function devServer_createDevServer(options, createCompiler, config, { getP
|
|
|
7324
7372
|
}, cacheableLoadBundle = createCacheableFunction(loadBundle), cacheableTransformedHtml = createCacheableFunction((_stats, entryName, utils)=>((entryName, utils)=>{
|
|
7325
7373
|
let { htmlPaths, distPath } = utils.environment, htmlPath = htmlPaths[entryName];
|
|
7326
7374
|
if (!htmlPath) throw Error(`${color.dim('[rsbuild:getTransformedHtml]')} Failed to get HTML file by entryName: ${color.yellow(entryName)}`);
|
|
7327
|
-
let fileName =
|
|
7375
|
+
let fileName = join(distPath, htmlPath);
|
|
7328
7376
|
return utils.readFileSync(fileName);
|
|
7329
7377
|
})(entryName, utils)), environmentAPI = {}, getErrorMsg = (method)=>`${color.dim('[rsbuild:server]')} Can not call ${color.yellow(method)} when ${color.yellow('runCompile')} is false`;
|
|
7330
7378
|
context.environmentList.forEach((environment, index)=>{
|
|
@@ -7350,7 +7398,7 @@ async function devServer_createDevServer(options, createCompiler, config, { getP
|
|
|
7350
7398
|
}
|
|
7351
7399
|
};
|
|
7352
7400
|
});
|
|
7353
|
-
let {
|
|
7401
|
+
let { connect } = await import("./connect-next.js"), middlewares = connect(), httpServer = middlewareMode ? null : await createHttpServer({
|
|
7354
7402
|
serverConfig: config.server,
|
|
7355
7403
|
middlewares
|
|
7356
7404
|
}), devServer = {
|
|
@@ -7416,7 +7464,7 @@ async function devServer_createDevServer(options, createCompiler, config, { getP
|
|
|
7416
7464
|
}), buildManager?.watch(), src_logger.debug('create dev server done'), devServer;
|
|
7417
7465
|
}
|
|
7418
7466
|
async function startPreviewServer(context, config, { getPortSilently } = {}) {
|
|
7419
|
-
let {
|
|
7467
|
+
let { connect } = await import("./connect-next.js"), middlewares = connect(), { port, portTip } = await resolvePort(config), serverConfig = config.server, { host, headers, proxy, historyApiFallback, compress, base, cors } = serverConfig, protocol = serverConfig.https ? 'https' : 'http', routes = getRoutes(context), urls = await getAddressUrls({
|
|
7420
7468
|
protocol,
|
|
7421
7469
|
port,
|
|
7422
7470
|
host
|
|
@@ -7456,9 +7504,7 @@ async function startPreviewServer(context, config, { getPortSilently } = {}) {
|
|
|
7456
7504
|
environments: context.environments
|
|
7457
7505
|
});
|
|
7458
7506
|
let applyStaticAssetMiddleware = async ()=>{
|
|
7459
|
-
let { default: sirv } = await import("./sirv.js").
|
|
7460
|
-
default: mod.build
|
|
7461
|
-
})), assetsMiddleware = sirv(context.distPath, {
|
|
7507
|
+
let { default: sirv } = await import("./sirv.js"), assetsMiddleware = sirv(context.distPath, {
|
|
7462
7508
|
etag: !0,
|
|
7463
7509
|
dev: !0,
|
|
7464
7510
|
ignores: [
|
|
@@ -7647,11 +7693,11 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
7647
7693
|
}), jsPath = config.output.distPath.js, jsAsyncPath = void 0 !== (jsAsync = config.output.distPath.jsAsync) ? jsAsync : isServer ? jsPath : jsPath ? `${jsPath}/async` : 'async', jsFilename = getFilename(config, 'js', isProd, isServer), isJsFilenameFn = 'function' == typeof jsFilename;
|
|
7648
7694
|
if (chain.output.path(distPath).filename(isJsFilenameFn ? (...args)=>{
|
|
7649
7695
|
let name = jsFilename(...args);
|
|
7650
|
-
return
|
|
7651
|
-
} :
|
|
7696
|
+
return posix.join(jsPath, name);
|
|
7697
|
+
} : posix.join(jsPath, jsFilename)).chunkFilename(isJsFilenameFn ? (...args)=>{
|
|
7652
7698
|
let name = jsFilename(...args);
|
|
7653
|
-
return
|
|
7654
|
-
} :
|
|
7699
|
+
return posix.join(jsAsyncPath, name);
|
|
7700
|
+
} : posix.join(jsAsyncPath, jsFilename)).publicPath(publicPath).bundlerInfo({
|
|
7655
7701
|
force: !1
|
|
7656
7702
|
}), isServer && chain.output.library({
|
|
7657
7703
|
type: 'commonjs2',
|
|
@@ -7749,7 +7795,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
7749
7795
|
} : void 0;
|
|
7750
7796
|
})(environment, params.isDev)),
|
|
7751
7797
|
(()=>{
|
|
7752
|
-
let { rootPath, distPath } = api.context, config = api.getNormalizedConfig(), targetPath =
|
|
7798
|
+
let { rootPath, distPath } = api.context, config = api.getNormalizedConfig(), targetPath = join(distPath, RSBUILD_OUTPUTS_PATH), { enable } = normalizeCleanDistPath(config.output.cleanDistPath);
|
|
7753
7799
|
if (!0 === enable || 'auto' === enable && isStrictSubdir(rootPath, targetPath)) return {
|
|
7754
7800
|
path: targetPath
|
|
7755
7801
|
};
|
|
@@ -7782,8 +7828,8 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
7782
7828
|
let distDir = config.output.distPath[assetType], filename = getFilename(config, assetType, isProd);
|
|
7783
7829
|
return 'function' == typeof filename ? (...args)=>{
|
|
7784
7830
|
let name = filename(...args);
|
|
7785
|
-
return
|
|
7786
|
-
} :
|
|
7831
|
+
return node_path.posix.join(distDir, name);
|
|
7832
|
+
} : node_path.posix.join(distDir, filename);
|
|
7787
7833
|
}, createAssetRule = (assetType, exts, emit)=>{
|
|
7788
7834
|
let regExp = getRegExpForExts(exts), { dataUriLimit } = config.output, maxSize = 'number' == typeof dataUriLimit ? dataUriLimit : dataUriLimit[assetType];
|
|
7789
7835
|
chainStaticAssetRule({
|
|
@@ -7862,7 +7908,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
7862
7908
|
'png',
|
|
7863
7909
|
'svg'
|
|
7864
7910
|
], publicDirs = Array.from(new Set(publicDir.map(({ name })=>name))), faviconPaths = [];
|
|
7865
|
-
for (let publicDir of publicDirs)for (let ext of extensions)faviconPaths.push(
|
|
7911
|
+
for (let publicDir of publicDirs)for (let ext of extensions)faviconPaths.push(node_path.join(publicDir, `favicon.${ext}`));
|
|
7866
7912
|
let faviconPath = findExists(faviconPaths);
|
|
7867
7913
|
return faviconPath && (defaultFavicon = faviconPath), defaultFavicon;
|
|
7868
7914
|
})();
|
|
@@ -7919,9 +7965,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
7919
7965
|
}, async ({ compilation, environment, sources })=>{
|
|
7920
7966
|
let { config } = environment, { appIcon } = config.html;
|
|
7921
7967
|
if (!appIcon) return;
|
|
7922
|
-
let { lookup } = await import("./
|
|
7923
|
-
lookup: mod.lookup
|
|
7924
|
-
})), distDir = config.output.distPath.image, manifestFile = appIcon.filename ?? 'manifest.webmanifest', publicPath = getPublicPathFromCompiler(compilation), icons = appIcon.icons.map((icon)=>((icon, distDir, publicPath, lookup)=>{
|
|
7968
|
+
let { lookup } = await import("./mrmime.js"), distDir = config.output.distPath.image, manifestFile = appIcon.filename ?? 'manifest.webmanifest', publicPath = getPublicPathFromCompiler(compilation), icons = appIcon.icons.map((icon)=>((icon, distDir, publicPath, lookup)=>{
|
|
7925
7969
|
let { src, size } = icon, cacheKey = `${distDir}|${publicPath}|${src}`, cached = iconFormatMap.get(cacheKey);
|
|
7926
7970
|
if (cached) return cached;
|
|
7927
7971
|
let sizes = `${size}x${size}`;
|
|
@@ -7935,7 +7979,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
7935
7979
|
};
|
|
7936
7980
|
return iconFormatMap.set(cacheKey, formatted), formatted;
|
|
7937
7981
|
}
|
|
7938
|
-
let absolutePath =
|
|
7982
|
+
let absolutePath = node_path.isAbsolute(src) ? src : node_path.join(api.context.rootPath, src), relativePath = node_path.posix.join(distDir, node_path.basename(absolutePath)), formatted = {
|
|
7939
7983
|
...icon,
|
|
7940
7984
|
sizes,
|
|
7941
7985
|
src: ensureAssetPrefix(relativePath, publicPath),
|
|
@@ -8013,7 +8057,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8013
8057
|
name: 'rsbuild:wasm',
|
|
8014
8058
|
setup (api) {
|
|
8015
8059
|
api.modifyBundlerChain((chain, { CHAIN_ID, environment, isProd })=>{
|
|
8016
|
-
let { config } = environment, distPath = config.output.distPath.wasm, filename =
|
|
8060
|
+
let { config } = environment, distPath = config.output.distPath.wasm, filename = posix.join(distPath, getFilename(config, 'wasm', isProd));
|
|
8017
8061
|
chain.output.webassemblyModuleFilename(filename), chain.module.rule(CHAIN_ID.RULE.WASM).test(/\.wasm$/).dependency('url').type('asset/resource').set('generator', {
|
|
8018
8062
|
filename
|
|
8019
8063
|
});
|
|
@@ -8030,7 +8074,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8030
8074
|
],
|
|
8031
8075
|
raw: !0
|
|
8032
8076
|
}, ({ code, emitFile, resourcePath })=>{
|
|
8033
|
-
let name, filename = (name = resourcePath &&
|
|
8077
|
+
let name, filename = (name = resourcePath && node_path.parse(resourcePath).name) ? `${name}.node` : null;
|
|
8034
8078
|
if (null === filename) throw Error(`${color.dim('[rsbuild:nodeAddons]')} Failed to load Node.js addon: ${color.yellow(resourcePath)}`);
|
|
8035
8079
|
emitFile(filename, code);
|
|
8036
8080
|
let config = api.getNormalizedConfig(), handleErrorSnippet = `throw new Error('Failed to load Node.js addon: "${filename}"', {
|
|
@@ -8107,15 +8151,15 @@ try {
|
|
|
8107
8151
|
initial: {},
|
|
8108
8152
|
config: config.tools.styleLoader
|
|
8109
8153
|
});
|
|
8110
|
-
mainRule.use(CHAIN_ID.USE.STYLE).loader(
|
|
8154
|
+
mainRule.use(CHAIN_ID.USE.STYLE).loader(join(COMPILED_PATH, 'style-loader', 'index.js')).options(styleLoaderOptions);
|
|
8111
8155
|
} else mainRule.use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader((cssExtractPlugin || core_rspack.CssExtractRspackPlugin).loader).options(config.tools.cssExtract.loaderOptions);
|
|
8112
|
-
else mainRule.use(CHAIN_ID.USE.IGNORE_CSS).loader(
|
|
8156
|
+
else mainRule.use(CHAIN_ID.USE.IGNORE_CSS).loader(node_path.join(dirname, 'ignoreCssLoader.mjs'));
|
|
8113
8157
|
let importLoaders = {
|
|
8114
8158
|
normal: 0,
|
|
8115
8159
|
inline: 0
|
|
8116
8160
|
}, updateRules = (callback, options = {})=>{
|
|
8117
8161
|
options.skipMain || callback(mainRule, 'main'), callback(inlineRule, 'inline');
|
|
8118
|
-
}, cssLoaderPath =
|
|
8162
|
+
}, cssLoaderPath = join(COMPILED_PATH, 'css-loader', 'index.js');
|
|
8119
8163
|
if (updateRules((rule)=>{
|
|
8120
8164
|
rule.use(CHAIN_ID.USE.CSS).loader(cssLoaderPath);
|
|
8121
8165
|
}), !1 !== config.tools.lightningcssLoader) {
|
|
@@ -8139,7 +8183,7 @@ try {
|
|
|
8139
8183
|
});
|
|
8140
8184
|
if ('function' == typeof postcssLoaderOptions.postcssOptions || postcssLoaderOptions.postcssOptions?.plugins?.length) {
|
|
8141
8185
|
emitCss && importLoaders.normal++, importLoaders.inline++;
|
|
8142
|
-
let postcssLoaderPath =
|
|
8186
|
+
let postcssLoaderPath = join(COMPILED_PATH, 'postcss-loader', 'index.js');
|
|
8143
8187
|
updateRules((rule)=>{
|
|
8144
8188
|
rule.use(CHAIN_ID.USE.POSTCSS).loader(postcssLoaderPath).options(postcssLoaderOptions);
|
|
8145
8189
|
}, {
|
|
@@ -8174,7 +8218,7 @@ try {
|
|
|
8174
8218
|
sourceMap: getCSSSourceMap(config)
|
|
8175
8219
|
},
|
|
8176
8220
|
config: config.tools.cssLoader,
|
|
8177
|
-
mergeFn:
|
|
8221
|
+
mergeFn: cjs_0_default()
|
|
8178
8222
|
}), !emitCss);
|
|
8179
8223
|
})({
|
|
8180
8224
|
config,
|
|
@@ -8200,12 +8244,12 @@ try {
|
|
|
8200
8244
|
{
|
|
8201
8245
|
filename: isCssFilenameFn ? (...args)=>{
|
|
8202
8246
|
let name = cssFilename(...args);
|
|
8203
|
-
return
|
|
8204
|
-
} :
|
|
8247
|
+
return posix.join(cssPath, name);
|
|
8248
|
+
} : posix.join(cssPath, cssFilename),
|
|
8205
8249
|
chunkFilename: isCssFilenameFn ? (...args)=>{
|
|
8206
8250
|
let name = cssFilename(...args);
|
|
8207
|
-
return
|
|
8208
|
-
} :
|
|
8251
|
+
return posix.join(cssAsyncPath, name);
|
|
8252
|
+
} : posix.join(cssAsyncPath, cssFilename),
|
|
8209
8253
|
...extractPluginOptions
|
|
8210
8254
|
}
|
|
8211
8255
|
]);
|
|
@@ -8235,7 +8279,7 @@ try {
|
|
|
8235
8279
|
'errorRecovery'
|
|
8236
8280
|
])
|
|
8237
8281
|
}
|
|
8238
|
-
}, mergedOptions = cssOptions ?
|
|
8282
|
+
}, mergedOptions = cssOptions ? cjs_0_default()(defaultOptions, cssOptions) : defaultOptions;
|
|
8239
8283
|
chain.optimization.minimizer(CHAIN_ID.MINIMIZER.CSS).use(rspack.LightningCssMinimizerRspackPlugin, [
|
|
8240
8284
|
mergedOptions
|
|
8241
8285
|
]).end();
|
|
@@ -8265,7 +8309,7 @@ try {
|
|
|
8265
8309
|
api.modifyBundlerChain({
|
|
8266
8310
|
order: 'pre',
|
|
8267
8311
|
handler: (chain, { CHAIN_ID, isDev, isProd, target, environment })=>{
|
|
8268
|
-
let { config, browserslist } = environment, cacheRoot =
|
|
8312
|
+
let { config, browserslist } = environment, cacheRoot = node_path.join(api.context.cachePath, '.swc'), rule = chain.module.rule(CHAIN_ID.RULE.JS).test(SCRIPT_REGEX).dependency({
|
|
8269
8313
|
not: 'url'
|
|
8270
8314
|
});
|
|
8271
8315
|
rule.oneOf(CHAIN_ID.ONE_OF.JS_RAW).resourceQuery(RAW_QUERY_REGEX).type('asset/source');
|
|
@@ -8301,7 +8345,7 @@ try {
|
|
|
8301
8345
|
let mergedConfig = reduceConfigs({
|
|
8302
8346
|
initial: swcConfig,
|
|
8303
8347
|
config: config.tools.swc,
|
|
8304
|
-
mergeFn:
|
|
8348
|
+
mergeFn: cjs_0_default()
|
|
8305
8349
|
});
|
|
8306
8350
|
mergedConfig.jsc?.target !== void 0 && mergedConfig.env?.targets !== void 0 && 1 === Object.keys(mergedConfig.env).length && delete mergedConfig.env, mainRule.use(CHAIN_ID.USE.SWC).loader(builtinSwcLoaderName).options(mergedConfig), dataUriRule.resolve.set('fullySpecified', !1).end().use(CHAIN_ID.USE.SWC).loader(builtinSwcLoaderName).options(cloneDeep(mergedConfig));
|
|
8307
8351
|
}
|
|
@@ -8455,7 +8499,7 @@ try {
|
|
|
8455
8499
|
return;
|
|
8456
8500
|
}
|
|
8457
8501
|
try {
|
|
8458
|
-
let moduleURL = isWindows ?
|
|
8502
|
+
let moduleURL = isWindows ? pathToFileURL(packagePath).href : packagePath;
|
|
8459
8503
|
module = await import(moduleURL);
|
|
8460
8504
|
} catch {
|
|
8461
8505
|
src_logger.error(`\`process.env.RSDOCTOR\` enabled, but failed to load ${color.bold(color.yellow(packageName))} module.`);
|
|
@@ -8546,19 +8590,17 @@ try {
|
|
|
8546
8590
|
api.onAfterStartDevServer(onStartServer), api.onAfterStartPreviewServer(onStartServer), api.onBeforeBuild(async ({ isFirstCompile, environments })=>{
|
|
8547
8591
|
if (isFirstCompile) for (let { name: publicDir, copyOnBuild, ignore } of api.getNormalizedConfig().server.publicDir){
|
|
8548
8592
|
let shouldCopy;
|
|
8549
|
-
if (!1 === copyOnBuild || !
|
|
8593
|
+
if (!1 === copyOnBuild || !node_fs.existsSync(publicDir)) continue;
|
|
8550
8594
|
let distPaths = dedupeNestedPaths(Object.values(environments).filter(({ config })=>!0 === copyOnBuild || 'auto' === copyOnBuild && 'node' !== config.output.target).map(({ distPath })=>distPath));
|
|
8551
8595
|
if (ignore?.length) {
|
|
8552
|
-
let { globSync } = await import("./tinyglobby.js")
|
|
8553
|
-
globSync: mod.globSync
|
|
8554
|
-
})), ignoredSet = new Set(globSync(ignore, {
|
|
8596
|
+
let { globSync } = await import("./tinyglobby.js"), ignoredSet = new Set(globSync(ignore, {
|
|
8555
8597
|
cwd: publicDir,
|
|
8556
8598
|
absolute: !1,
|
|
8557
8599
|
dot: !0,
|
|
8558
8600
|
onlyFiles: !1
|
|
8559
8601
|
}).map((item)=>item.replace(/\\/g, '/').replace(/\/$/, '')));
|
|
8560
8602
|
shouldCopy = (source)=>{
|
|
8561
|
-
let relativePath =
|
|
8603
|
+
let relativePath = node_path.relative(publicDir, source);
|
|
8562
8604
|
if (!relativePath) return !0;
|
|
8563
8605
|
let normalizedPath = relativePath.replace(/\\/g, '/');
|
|
8564
8606
|
return !ignoredSet.has(normalizedPath);
|
|
@@ -8566,13 +8608,13 @@ try {
|
|
|
8566
8608
|
}
|
|
8567
8609
|
try {
|
|
8568
8610
|
await Promise.all(distPaths.map(async (distPath)=>{
|
|
8569
|
-
isDeno &&
|
|
8611
|
+
isDeno && node_fs.existsSync(distPath) && await node_fs.promises.rm(distPath, {
|
|
8570
8612
|
recursive: !0,
|
|
8571
8613
|
force: !0
|
|
8572
|
-
}), await
|
|
8614
|
+
}), await node_fs.promises.cp(publicDir, distPath, {
|
|
8573
8615
|
recursive: !0,
|
|
8574
8616
|
dereference: !0,
|
|
8575
|
-
mode:
|
|
8617
|
+
mode: node_fs.constants.COPYFILE_FICLONE,
|
|
8576
8618
|
filter: shouldCopy
|
|
8577
8619
|
});
|
|
8578
8620
|
}));
|
|
@@ -8590,7 +8632,7 @@ try {
|
|
|
8590
8632
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
|
|
8591
8633
|
let { output: { manifest }, dev: { writeToDisk } } = environment.config;
|
|
8592
8634
|
if (!1 === manifest) return;
|
|
8593
|
-
let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-beta.
|
|
8635
|
+
let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-beta.6_@module-federation+runtime-tools@2.1.0_@swc+helpers@0.5.19_/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
|
|
8594
8636
|
manifestFilenames.set(environment.name, manifestOptions.filename);
|
|
8595
8637
|
let pluginOptions = {
|
|
8596
8638
|
fileName: manifestOptions.filename,
|
|
@@ -8711,7 +8753,7 @@ try {
|
|
|
8711
8753
|
enabled: !0,
|
|
8712
8754
|
hashFuncNames: helpers_castArray(algorithm)
|
|
8713
8755
|
};
|
|
8714
|
-
'js' === config.html.implementation && !1 !== config.tools.htmlPlugin && (pluginOptions.htmlPlugin =
|
|
8756
|
+
'js' === config.html.implementation && !1 !== config.tools.htmlPlugin && (pluginOptions.htmlPlugin = node_path.join(COMPILED_PATH, 'html-rspack-plugin/index.js')), chain.plugin(CHAIN_ID.PLUGIN.SUBRESOURCE_INTEGRITY).use(rspack.SubresourceIntegrityPlugin, [
|
|
8715
8757
|
pluginOptions
|
|
8716
8758
|
]);
|
|
8717
8759
|
});
|
|
@@ -8822,7 +8864,7 @@ async function createRsbuild(options = {}) {
|
|
|
8822
8864
|
pluginManager
|
|
8823
8865
|
}), { distPath } = context, { checkDistDir = !0 } = options;
|
|
8824
8866
|
if (checkDistDir) {
|
|
8825
|
-
if (!
|
|
8867
|
+
if (!existsSync(distPath)) throw Error(`${color.dim('[rsbuild:preview]')} The output directory ${color.yellow(distPath)} does not exist, please build the project before previewing.`);
|
|
8826
8868
|
if (isEmptyDir(distPath)) throw Error(`${color.dim('[rsbuild:preview]')} The output directory ${color.yellow(distPath)} is empty, please build the project before previewing.`);
|
|
8827
8869
|
}
|
|
8828
8870
|
return startPreviewServer(context, config, options);
|
|
@@ -8925,8 +8967,8 @@ function defineConfig(config) {
|
|
|
8925
8967
|
async function loadConfig_loadConfig({ cwd = process.cwd(), path, envMode, meta, loader = 'auto' } = {}) {
|
|
8926
8968
|
let configExport, configFilePath = ((root, customConfig)=>{
|
|
8927
8969
|
if (customConfig) {
|
|
8928
|
-
let customConfigPath = (
|
|
8929
|
-
if (
|
|
8970
|
+
let customConfigPath = external_node_path_isAbsolute(customConfig) ? customConfig : join(root, customConfig);
|
|
8971
|
+
if (node_fs.existsSync(customConfigPath)) return customConfigPath;
|
|
8930
8972
|
throw Error(`${color.dim('[rsbuild:loadConfig]')} Cannot find config file: ${color.dim(customConfigPath)}`);
|
|
8931
8973
|
}
|
|
8932
8974
|
for (let file of [
|
|
@@ -8937,8 +8979,8 @@ async function loadConfig_loadConfig({ cwd = process.cwd(), path, envMode, meta,
|
|
|
8937
8979
|
'rsbuild.config.mts',
|
|
8938
8980
|
'rsbuild.config.cts'
|
|
8939
8981
|
]){
|
|
8940
|
-
let configFile =
|
|
8941
|
-
if (
|
|
8982
|
+
let configFile = join(root, file);
|
|
8983
|
+
if (node_fs.existsSync(configFile)) return configFile;
|
|
8942
8984
|
}
|
|
8943
8985
|
return null;
|
|
8944
8986
|
})(cwd, path);
|
|
@@ -8950,7 +8992,7 @@ async function loadConfig_loadConfig({ cwd = process.cwd(), path, envMode, meta,
|
|
|
8950
8992
|
configFilePath
|
|
8951
8993
|
}, config);
|
|
8952
8994
|
if ('native' === loader || 'auto' === loader && (process.features.typescript || process.versions.bun || process.versions.deno) || /\.(?:js|mjs|cjs)$/.test(configFilePath)) try {
|
|
8953
|
-
let configFileURL =
|
|
8995
|
+
let configFileURL = pathToFileURL(configFilePath).href, exportModule = await import(`${configFileURL}?t=${Date.now()}`);
|
|
8954
8996
|
configExport = exportModule.default ? exportModule.default : exportModule;
|
|
8955
8997
|
} catch (err) {
|
|
8956
8998
|
let errorMessage = `Failed to load file with native loader: ${color.dim(configFilePath)}`;
|
|
@@ -9014,7 +9056,7 @@ async function init_init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
|
9014
9056
|
config: ()=>init_loadConfig(root),
|
|
9015
9057
|
environment: commonOpts.environment,
|
|
9016
9058
|
loadEnv: !1 !== commonOpts.env && {
|
|
9017
|
-
cwd: (envDir = commonOpts.envDir) ?
|
|
9059
|
+
cwd: (envDir = commonOpts.envDir) ? node_path.isAbsolute(envDir) ? envDir : node_path.join(root, envDir) : root,
|
|
9018
9060
|
mode: commonOpts.envMode
|
|
9019
9061
|
}
|
|
9020
9062
|
});
|
|
@@ -9046,7 +9088,7 @@ let cleaners = [], onBeforeRestartServer = (cleaner)=>{
|
|
|
9046
9088
|
cleaners.push(cleaner);
|
|
9047
9089
|
}, beforeRestart = async ({ filePath, clear = !0, id })=>{
|
|
9048
9090
|
if (clear && isTTY() && !process.env.DEBUG && process.stdout.write('\x1B[H\x1B[2J'), filePath) {
|
|
9049
|
-
let filename =
|
|
9091
|
+
let filename = node_path.basename(filePath);
|
|
9050
9092
|
src_logger.info(`restarting ${id} as ${color.yellow(filename)} changed\n`);
|
|
9051
9093
|
} else src_logger.info(`restarting ${id}...\n`);
|
|
9052
9094
|
for (let cleaner of cleaners)await cleaner();
|
|
@@ -9095,7 +9137,7 @@ let applyServerOptions = (command)=>{
|
|
|
9095
9137
|
};
|
|
9096
9138
|
function setupCommands() {
|
|
9097
9139
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
9098
|
-
cli.version("2.0.0-beta.
|
|
9140
|
+
cli.version("2.0.0-beta.8"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
|
|
9099
9141
|
default: 'auto'
|
|
9100
9142
|
}).option('--env-dir <dir>', 'Set the directory for loading `.env` files').option('--env-mode <mode>', 'Set the env mode to load the `.env.[mode]` file').option('--environment <name>', 'Set the environment name(s) to build', {
|
|
9101
9143
|
type: [
|
|
@@ -9164,7 +9206,7 @@ function initNodeEnv() {
|
|
|
9164
9206
|
}
|
|
9165
9207
|
function showGreeting() {
|
|
9166
9208
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
9167
|
-
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.0-beta.
|
|
9209
|
+
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.0-beta.8\n`);
|
|
9168
9210
|
}
|
|
9169
9211
|
function setupLogLevel() {
|
|
9170
9212
|
let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
|
|
@@ -9185,5 +9227,5 @@ function runCLI() {
|
|
|
9185
9227
|
src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
|
|
9186
9228
|
}
|
|
9187
9229
|
}
|
|
9188
|
-
let src_version = "2.0.0-beta.
|
|
9189
|
-
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, core_rspack as rspack, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix,
|
|
9230
|
+
let src_version = "2.0.0-beta.8";
|
|
9231
|
+
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, core_rspack as rspack, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, runCLI, src_logger as logger, src_version as version };
|