@rsbuild/core 1.4.11 → 1.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/css-loader/index.js +18 -18
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/launch-editor-middleware/index.js +32 -21
- package/compiled/launch-editor-middleware/package.json +1 -1
- package/compiled/postcss-load-config/index.js +10 -10
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rsbuild-dev-middleware/index.js +25 -25
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-chain/types/index.d.ts +11 -0
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/compiled/style-loader/index.js +10 -10
- package/dist/client/hmr.js +13 -2
- package/dist/client/overlay.js +3 -1
- package/dist/index.cjs +1322 -217
- package/dist/index.js +1304 -209
- package/dist/transformLoader.mjs +7 -5
- package/dist/transformRawLoader.mjs +7 -5
- package/dist-types/configChain.d.ts +1 -1
- package/dist-types/constants.d.ts +1 -0
- package/dist-types/helpers/index.d.ts +2 -2
- package/dist-types/helpers/stats.d.ts +1 -0
- package/dist-types/rspack-plugins/RsbuildHtmlPlugin.d.ts +1 -0
- package/dist-types/server/compilationMiddleware.d.ts +0 -4
- package/dist-types/server/devServer.d.ts +7 -2
- package/dist-types/server/historyApiFallback.d.ts +2 -0
- package/dist-types/server/socketServer.d.ts +24 -7
- package/dist-types/types/config.d.ts +20 -10
- package/dist-types/types/hooks.d.ts +1 -1
- package/dist-types/types/plugin.d.ts +1 -2
- package/package.json +9 -10
- package/compiled/connect-history-api-fallback/index.d.ts +0 -1
- package/compiled/connect-history-api-fallback/index.js +0 -149
- package/compiled/connect-history-api-fallback/license +0 -21
- package/compiled/connect-history-api-fallback/package.json +0 -1
- package/compiled/rspack-chain/index.js +0 -1769
package/dist/index.cjs
CHANGED
|
@@ -164,6 +164,304 @@ var __webpack_modules__ = {
|
|
|
164
164
|
return null != val && 'object' == typeof val && !1 === Array.isArray(val);
|
|
165
165
|
};
|
|
166
166
|
},
|
|
167
|
+
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js": function(__unused_webpack_module, exports1) {
|
|
168
|
+
"use strict";
|
|
169
|
+
Object.defineProperty(exports1, "__esModule", {
|
|
170
|
+
value: !0
|
|
171
|
+
}), exports1.arrayToString = void 0, exports1.arrayToString = (array, space, next)=>{
|
|
172
|
+
let values = array.map(function(value, index) {
|
|
173
|
+
let result = next(value, index);
|
|
174
|
+
return void 0 === result ? String(result) : space + result.split("\n").join(`\n${space}`);
|
|
175
|
+
}).join(space ? ",\n" : ","), eol = space && values ? "\n" : "";
|
|
176
|
+
return `[${eol}${values}${eol}]`;
|
|
177
|
+
};
|
|
178
|
+
},
|
|
179
|
+
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js": function(__unused_webpack_module, exports1, __webpack_require__) {
|
|
180
|
+
"use strict";
|
|
181
|
+
Object.defineProperty(exports1, "__esModule", {
|
|
182
|
+
value: !0
|
|
183
|
+
}), exports1.FunctionParser = exports1.dedentFunction = exports1.functionToString = exports1.USED_METHOD_KEY = void 0;
|
|
184
|
+
let quote_1 = __webpack_require__("../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), METHOD_NAMES_ARE_QUOTED = '"' === ({
|
|
185
|
+
" " () {}
|
|
186
|
+
})[" "].toString().charAt(0), FUNCTION_PREFIXES = {
|
|
187
|
+
Function: "function ",
|
|
188
|
+
GeneratorFunction: "function* ",
|
|
189
|
+
AsyncFunction: "async function ",
|
|
190
|
+
AsyncGeneratorFunction: "async function* "
|
|
191
|
+
}, METHOD_PREFIXES = {
|
|
192
|
+
Function: "",
|
|
193
|
+
GeneratorFunction: "*",
|
|
194
|
+
AsyncFunction: "async ",
|
|
195
|
+
AsyncGeneratorFunction: "async *"
|
|
196
|
+
}, TOKENS_PRECEDING_REGEXPS = new Set("case delete else in instanceof new return throw typeof void , ; : + - ! ~ & | ^ * / % < > ? =".split(" "));
|
|
197
|
+
function dedentFunction(fnString) {
|
|
198
|
+
let found;
|
|
199
|
+
for (let line of fnString.split("\n").slice(1)){
|
|
200
|
+
let m = /^[\s\t]+/.exec(line);
|
|
201
|
+
if (!m) return fnString;
|
|
202
|
+
let [str] = m;
|
|
203
|
+
void 0 === found ? found = str : str.length < found.length && (found = str);
|
|
204
|
+
}
|
|
205
|
+
return found ? fnString.split(`\n${found}`).join("\n") : fnString;
|
|
206
|
+
}
|
|
207
|
+
exports1.USED_METHOD_KEY = new WeakSet(), exports1.functionToString = (fn, space, next, key)=>{
|
|
208
|
+
let name = "string" == typeof key ? key : void 0;
|
|
209
|
+
return void 0 !== name && exports1.USED_METHOD_KEY.add(fn), new FunctionParser(fn, space, next, name).stringify();
|
|
210
|
+
}, exports1.dedentFunction = dedentFunction;
|
|
211
|
+
class FunctionParser {
|
|
212
|
+
constructor(fn, indent, next, key){
|
|
213
|
+
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);
|
|
214
|
+
}
|
|
215
|
+
stringify() {
|
|
216
|
+
let value = this.tryParse();
|
|
217
|
+
return value ? dedentFunction(value) : `${this.keyPrefix}void ${this.next(this.fnString)}`;
|
|
218
|
+
}
|
|
219
|
+
getPrefix() {
|
|
220
|
+
return this.isMethodCandidate && !this.hadKeyword ? METHOD_PREFIXES[this.fnType] + this.keyQuote : this.keyPrefix + FUNCTION_PREFIXES[this.fnType];
|
|
221
|
+
}
|
|
222
|
+
tryParse() {
|
|
223
|
+
if ("}" !== this.fnString[this.fnString.length - 1]) return this.keyPrefix + this.fnString;
|
|
224
|
+
if (this.fn.name) {
|
|
225
|
+
let result = this.tryStrippingName();
|
|
226
|
+
if (result) return result;
|
|
227
|
+
}
|
|
228
|
+
let prevPos = this.pos;
|
|
229
|
+
if ("class" === this.consumeSyntax()) return this.fnString;
|
|
230
|
+
if (this.pos = prevPos, this.tryParsePrefixTokens()) {
|
|
231
|
+
let result = this.tryStrippingName();
|
|
232
|
+
if (result) return result;
|
|
233
|
+
let offset = this.pos;
|
|
234
|
+
switch(this.consumeSyntax("WORD_LIKE")){
|
|
235
|
+
case "WORD_LIKE":
|
|
236
|
+
this.isMethodCandidate && !this.hadKeyword && (offset = this.pos);
|
|
237
|
+
case "()":
|
|
238
|
+
if ("=>" === this.fnString.substr(this.pos, 2)) return this.keyPrefix + this.fnString;
|
|
239
|
+
this.pos = offset;
|
|
240
|
+
case '"':
|
|
241
|
+
case "'":
|
|
242
|
+
case "[]":
|
|
243
|
+
return this.getPrefix() + this.fnString.substr(this.pos);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
tryStrippingName() {
|
|
248
|
+
if (METHOD_NAMES_ARE_QUOTED) return;
|
|
249
|
+
let start = this.pos, prefix = this.fnString.substr(this.pos, this.fn.name.length);
|
|
250
|
+
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);
|
|
251
|
+
this.pos = start;
|
|
252
|
+
}
|
|
253
|
+
tryParsePrefixTokens() {
|
|
254
|
+
let posPrev = this.pos;
|
|
255
|
+
switch(this.hadKeyword = !1, this.fnType){
|
|
256
|
+
case "AsyncFunction":
|
|
257
|
+
if ("async" !== this.consumeSyntax()) return !1;
|
|
258
|
+
posPrev = this.pos;
|
|
259
|
+
case "Function":
|
|
260
|
+
return "function" === this.consumeSyntax() ? this.hadKeyword = !0 : this.pos = posPrev, !0;
|
|
261
|
+
case "AsyncGeneratorFunction":
|
|
262
|
+
if ("async" !== this.consumeSyntax()) return !1;
|
|
263
|
+
case "GeneratorFunction":
|
|
264
|
+
let token = this.consumeSyntax();
|
|
265
|
+
return "function" === token && (token = this.consumeSyntax(), this.hadKeyword = !0), "*" === token;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
consumeSyntax(wordLikeToken) {
|
|
269
|
+
let m = this.consumeMatch(/^(?:([A-Za-z_0-9$\xA0-\uFFFF]+)|=>|\+\+|\-\-|.)/);
|
|
270
|
+
if (!m) return;
|
|
271
|
+
let [token, match] = m;
|
|
272
|
+
if (this.consumeWhitespace(), match) return wordLikeToken || match;
|
|
273
|
+
switch(token){
|
|
274
|
+
case "(":
|
|
275
|
+
return this.consumeSyntaxUntil("(", ")");
|
|
276
|
+
case "[":
|
|
277
|
+
return this.consumeSyntaxUntil("[", "]");
|
|
278
|
+
case "{":
|
|
279
|
+
return this.consumeSyntaxUntil("{", "}");
|
|
280
|
+
case "`":
|
|
281
|
+
return this.consumeTemplate();
|
|
282
|
+
case '"':
|
|
283
|
+
return this.consumeRegExp(/^(?:[^\\"]|\\.)*"/, '"');
|
|
284
|
+
case "'":
|
|
285
|
+
return this.consumeRegExp(/^(?:[^\\']|\\.)*'/, "'");
|
|
286
|
+
}
|
|
287
|
+
return token;
|
|
288
|
+
}
|
|
289
|
+
consumeSyntaxUntil(startToken, endToken) {
|
|
290
|
+
let isRegExpAllowed = !0;
|
|
291
|
+
for(;;){
|
|
292
|
+
let token = this.consumeSyntax();
|
|
293
|
+
if (token === endToken) return startToken + endToken;
|
|
294
|
+
if (!token || ")" === token || "]" === token || "}" === token) return;
|
|
295
|
+
"/" === token && isRegExpAllowed && this.consumeMatch(/^(?:\\.|[^\\\/\n[]|\[(?:\\.|[^\]])*\])+\/[a-z]*/) ? (isRegExpAllowed = !1, this.consumeWhitespace()) : isRegExpAllowed = TOKENS_PRECEDING_REGEXPS.has(token);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
consumeMatch(re) {
|
|
299
|
+
let m = re.exec(this.fnString.substr(this.pos));
|
|
300
|
+
return m && (this.pos += m[0].length), m;
|
|
301
|
+
}
|
|
302
|
+
consumeRegExp(re, token) {
|
|
303
|
+
let m = re.exec(this.fnString.substr(this.pos));
|
|
304
|
+
if (m) return this.pos += m[0].length, this.consumeWhitespace(), token;
|
|
305
|
+
}
|
|
306
|
+
consumeTemplate() {
|
|
307
|
+
for(;;){
|
|
308
|
+
if (this.consumeMatch(/^(?:[^`$\\]|\\.|\$(?!{))*/), "`" === this.fnString[this.pos]) return this.pos++, this.consumeWhitespace(), "`";
|
|
309
|
+
if (!("${" === this.fnString.substr(this.pos, 2) && (this.pos += 2, this.consumeWhitespace(), this.consumeSyntaxUntil("{", "}")))) return;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
consumeWhitespace() {
|
|
313
|
+
this.consumeMatch(/^(?:\s|\/\/.*|\/\*[^]*?\*\/)*/);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
exports1.FunctionParser = FunctionParser;
|
|
317
|
+
},
|
|
318
|
+
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js": function(__unused_webpack_module, exports1, __webpack_require__) {
|
|
319
|
+
"use strict";
|
|
320
|
+
exports1.stringify = void 0;
|
|
321
|
+
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");
|
|
322
|
+
exports1.stringify = function(value, replacer, indent, options = {}) {
|
|
323
|
+
var replacer1;
|
|
324
|
+
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 = (replacer1 = replacer) ? (value, space, next, key)=>replacer1(value, space, (value)=>stringify_1.toString(value, space, next, key), key) : stringify_1.toString, onNext = (value, key)=>{
|
|
325
|
+
if (++valueCount > maxValues || skipUndefinedProperties && void 0 === value || path.length > maxDepth) return;
|
|
326
|
+
if (void 0 === key) return valueToString(value, space, onNext, key);
|
|
327
|
+
path.push(key);
|
|
328
|
+
let result = builder(value, key === ROOT_SENTINEL ? void 0 : key);
|
|
329
|
+
return path.pop(), result;
|
|
330
|
+
}, builder = references ? (value, key)=>{
|
|
331
|
+
if (null !== value && ("object" == typeof value || "function" == typeof value || "symbol" == typeof value)) {
|
|
332
|
+
if (tracking.has(value)) return unpack.set(path.slice(1), tracking.get(value)), valueToString(void 0, space, onNext, key);
|
|
333
|
+
tracking.set(value, path.slice(1));
|
|
334
|
+
}
|
|
335
|
+
return valueToString(value, space, onNext, key);
|
|
336
|
+
} : (value, key)=>{
|
|
337
|
+
if (stack.has(value)) return;
|
|
338
|
+
stack.add(value);
|
|
339
|
+
let result = valueToString(value, space, onNext, key);
|
|
340
|
+
return stack.delete(value), result;
|
|
341
|
+
}, result = onNext(value, ROOT_SENTINEL);
|
|
342
|
+
if (unpack.size) {
|
|
343
|
+
let sp = space ? " " : "", eol = space ? "\n" : "", wrapper = `var x${sp}=${sp}${result};${eol}`;
|
|
344
|
+
for (let [key, value] of unpack.entries()){
|
|
345
|
+
let keyPath = quote_1.stringifyPath(key, onNext), valuePath = quote_1.stringifyPath(value, onNext);
|
|
346
|
+
wrapper += `x${keyPath}${sp}=${sp}x${valuePath};${eol}`;
|
|
347
|
+
}
|
|
348
|
+
return `(function${sp}()${sp}{${eol}${wrapper}return x;${eol}}())`;
|
|
349
|
+
}
|
|
350
|
+
return result;
|
|
351
|
+
};
|
|
352
|
+
},
|
|
353
|
+
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js": function(__unused_webpack_module, exports1, __webpack_require__) {
|
|
354
|
+
"use strict";
|
|
355
|
+
Object.defineProperty(exports1, "__esModule", {
|
|
356
|
+
value: !0
|
|
357
|
+
}), exports1.objectToString = void 0;
|
|
358
|
+
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");
|
|
359
|
+
exports1.objectToString = (value, space, next, key)=>{
|
|
360
|
+
if ("function" == typeof Buffer && Buffer.isBuffer(value)) return `Buffer.from(${next(value.toString("base64"))}, 'base64')`;
|
|
361
|
+
if ("object" == typeof global && value === global) return globalToString(value, space, next, key);
|
|
362
|
+
let toString = OBJECT_TYPES[Object.prototype.toString.call(value)];
|
|
363
|
+
return toString ? toString(value, space, next, key) : void 0;
|
|
364
|
+
};
|
|
365
|
+
let globalToString = (value, space, next)=>`Function(${next("return this")})()`, OBJECT_TYPES = {
|
|
366
|
+
"[object Array]": array_1.arrayToString,
|
|
367
|
+
"[object Object]": (obj, indent, next, key)=>{
|
|
368
|
+
let eol = indent ? "\n" : "", space = indent ? " " : "", values = Object.keys(obj).reduce(function(values, key) {
|
|
369
|
+
let fn = obj[key], result = next(fn, key);
|
|
370
|
+
if (void 0 === result) return values;
|
|
371
|
+
let value = result.split("\n").join(`\n${indent}`);
|
|
372
|
+
return function_1.USED_METHOD_KEY.has(fn) ? values.push(`${indent}${value}`) : values.push(`${indent}${quote_1.quoteKey(key, next)}:${space}${value}`), values;
|
|
373
|
+
}, []).join(`,${eol}`);
|
|
374
|
+
return "" === values ? "{}" : `{${eol}${values}${eol}}`;
|
|
375
|
+
},
|
|
376
|
+
"[object Error]": (error, space, next)=>`new Error(${next(error.message)})`,
|
|
377
|
+
"[object Date]": (date)=>`new Date(${date.getTime()})`,
|
|
378
|
+
"[object String]": (str, space, next)=>`new String(${next(str.toString())})`,
|
|
379
|
+
"[object Number]": (num)=>`new Number(${num})`,
|
|
380
|
+
"[object Boolean]": (bool)=>`new Boolean(${bool})`,
|
|
381
|
+
"[object Set]": (set, space, next)=>`new Set(${next(Array.from(set))})`,
|
|
382
|
+
"[object Map]": (map, space, next)=>`new Map(${next(Array.from(map))})`,
|
|
383
|
+
"[object RegExp]": String,
|
|
384
|
+
"[object global]": globalToString,
|
|
385
|
+
"[object Window]": globalToString
|
|
386
|
+
};
|
|
387
|
+
},
|
|
388
|
+
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js": function(__unused_webpack_module, exports1) {
|
|
389
|
+
"use strict";
|
|
390
|
+
Object.defineProperty(exports1, "__esModule", {
|
|
391
|
+
value: !0
|
|
392
|
+
}), exports1.stringifyPath = exports1.quoteKey = exports1.isValidVariableName = exports1.IS_VALID_IDENTIFIER = exports1.quoteString = void 0;
|
|
393
|
+
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([
|
|
394
|
+
[
|
|
395
|
+
"\b",
|
|
396
|
+
"\\b"
|
|
397
|
+
],
|
|
398
|
+
[
|
|
399
|
+
"\t",
|
|
400
|
+
"\\t"
|
|
401
|
+
],
|
|
402
|
+
[
|
|
403
|
+
"\n",
|
|
404
|
+
"\\n"
|
|
405
|
+
],
|
|
406
|
+
[
|
|
407
|
+
"\f",
|
|
408
|
+
"\\f"
|
|
409
|
+
],
|
|
410
|
+
[
|
|
411
|
+
"\r",
|
|
412
|
+
"\\r"
|
|
413
|
+
],
|
|
414
|
+
[
|
|
415
|
+
"'",
|
|
416
|
+
"\\'"
|
|
417
|
+
],
|
|
418
|
+
[
|
|
419
|
+
'"',
|
|
420
|
+
'\\"'
|
|
421
|
+
],
|
|
422
|
+
[
|
|
423
|
+
"\\",
|
|
424
|
+
"\\\\"
|
|
425
|
+
]
|
|
426
|
+
]);
|
|
427
|
+
function escapeChar(char) {
|
|
428
|
+
return META_CHARS.get(char) || `\\u${`0000${char.charCodeAt(0).toString(16)}`.slice(-4)}`;
|
|
429
|
+
}
|
|
430
|
+
exports1.quoteString = function(str) {
|
|
431
|
+
return `'${str.replace(ESCAPABLE, escapeChar)}'`;
|
|
432
|
+
};
|
|
433
|
+
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(" "));
|
|
434
|
+
function isValidVariableName(name) {
|
|
435
|
+
return "string" == typeof name && !RESERVED_WORDS.has(name) && exports1.IS_VALID_IDENTIFIER.test(name);
|
|
436
|
+
}
|
|
437
|
+
exports1.IS_VALID_IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/, exports1.isValidVariableName = isValidVariableName, exports1.quoteKey = function(key, next) {
|
|
438
|
+
return isValidVariableName(key) ? key : next(key);
|
|
439
|
+
}, exports1.stringifyPath = function(path, next) {
|
|
440
|
+
let result = "";
|
|
441
|
+
for (let key of path)isValidVariableName(key) ? result += `.${key}` : result += `[${next(key)}]`;
|
|
442
|
+
return result;
|
|
443
|
+
};
|
|
444
|
+
},
|
|
445
|
+
"../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js": function(__unused_webpack_module, exports1, __webpack_require__) {
|
|
446
|
+
"use strict";
|
|
447
|
+
Object.defineProperty(exports1, "__esModule", {
|
|
448
|
+
value: !0
|
|
449
|
+
}), exports1.toString = void 0;
|
|
450
|
+
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 = {
|
|
451
|
+
string: quote_1.quoteString,
|
|
452
|
+
number: (value)=>Object.is(value, -0) ? "-0" : String(value),
|
|
453
|
+
boolean: String,
|
|
454
|
+
symbol: (value, space, next)=>{
|
|
455
|
+
let key = Symbol.keyFor(value);
|
|
456
|
+
return void 0 !== key ? `Symbol.for(${next(key)})` : `Symbol(${next(value.description)})`;
|
|
457
|
+
},
|
|
458
|
+
bigint: (value, space, next)=>`BigInt(${next(String(value))})`,
|
|
459
|
+
undefined: String,
|
|
460
|
+
object: object_1.objectToString,
|
|
461
|
+
function: function_1.functionToString
|
|
462
|
+
};
|
|
463
|
+
exports1.toString = (value, space, next, key)=>null === value ? "null" : PRIMITIVE_TYPES[typeof value](value, space, next, key);
|
|
464
|
+
},
|
|
167
465
|
"../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js": function(module) {
|
|
168
466
|
var toString = Object.prototype.toString;
|
|
169
467
|
function ctorName(val) {
|
|
@@ -723,12 +1021,6 @@ var __webpack_modules__ = {
|
|
|
723
1021
|
return module;
|
|
724
1022
|
});
|
|
725
1023
|
},
|
|
726
|
-
"../../compiled/connect-history-api-fallback/index.js": function(module) {
|
|
727
|
-
"use strict";
|
|
728
|
-
module.exports = import("../compiled/connect-history-api-fallback/index.js").then(function(module) {
|
|
729
|
-
return module;
|
|
730
|
-
});
|
|
731
|
-
},
|
|
732
1024
|
"../../compiled/connect/index.js": function(module) {
|
|
733
1025
|
"use strict";
|
|
734
1026
|
module.exports = import("../compiled/connect/index.js").then(function(module) {
|
|
@@ -753,6 +1045,12 @@ var __webpack_modules__ = {
|
|
|
753
1045
|
return module;
|
|
754
1046
|
});
|
|
755
1047
|
},
|
|
1048
|
+
"../../compiled/mrmime/index.js": function(module) {
|
|
1049
|
+
"use strict";
|
|
1050
|
+
module.exports = import("../compiled/mrmime/index.js").then(function(module) {
|
|
1051
|
+
return module;
|
|
1052
|
+
});
|
|
1053
|
+
},
|
|
756
1054
|
"../../compiled/on-finished/index.js": function(module) {
|
|
757
1055
|
"use strict";
|
|
758
1056
|
module.exports = import("../compiled/on-finished/index.js").then(function(module) {
|
|
@@ -902,7 +1200,7 @@ __webpack_require__.n = (module)=>{
|
|
|
902
1200
|
var __webpack_exports__ = {};
|
|
903
1201
|
for(var __webpack_i__ in (()=>{
|
|
904
1202
|
"use strict";
|
|
905
|
-
let swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin, isDockerCached, cachedResult;
|
|
1203
|
+
let swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin, isDockerCached, cachedResult, hmrClientPath, overlayClientPath;
|
|
906
1204
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
907
1205
|
PLUGIN_CSS_NAME: ()=>PLUGIN_CSS_NAME,
|
|
908
1206
|
createRsbuild: ()=>createRsbuild,
|
|
@@ -940,7 +1238,741 @@ for(var __webpack_i__ in (()=>{
|
|
|
940
1238
|
let external_node_url_namespaceObject = require("node:url");
|
|
941
1239
|
var cjs = __webpack_require__("../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js"), cjs_default = __webpack_require__.n(cjs);
|
|
942
1240
|
let picocolors_index_js_namespaceObject = require("../compiled/picocolors/index.js");
|
|
943
|
-
var picocolors_index_js_default = __webpack_require__.n(picocolors_index_js_namespaceObject);
|
|
1241
|
+
var picocolors_index_js_default = __webpack_require__.n(picocolors_index_js_namespaceObject), dist = __webpack_require__("../../node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js");
|
|
1242
|
+
function createMap(superClass) {
|
|
1243
|
+
return class extends superClass {
|
|
1244
|
+
extend(methods) {
|
|
1245
|
+
return this.shorthands = methods, methods.forEach((method)=>{
|
|
1246
|
+
this[method] = (value)=>this.set(method, value);
|
|
1247
|
+
}), this;
|
|
1248
|
+
}
|
|
1249
|
+
clear() {
|
|
1250
|
+
return this.store.clear(), this;
|
|
1251
|
+
}
|
|
1252
|
+
delete(key) {
|
|
1253
|
+
return this.store.delete(key), this;
|
|
1254
|
+
}
|
|
1255
|
+
order() {
|
|
1256
|
+
let entries = [
|
|
1257
|
+
...this.store
|
|
1258
|
+
].reduce((acc, [key, value])=>(acc[key] = value, acc), {}), names = Object.keys(entries), order = [
|
|
1259
|
+
...names
|
|
1260
|
+
];
|
|
1261
|
+
return names.forEach((name)=>{
|
|
1262
|
+
if (!entries[name]) return;
|
|
1263
|
+
let { __before, __after } = entries[name];
|
|
1264
|
+
__before && order.includes(__before) ? (order.splice(order.indexOf(name), 1), order.splice(order.indexOf(__before), 0, name)) : __after && order.includes(__after) && (order.splice(order.indexOf(name), 1), order.splice(order.indexOf(__after) + 1, 0, name));
|
|
1265
|
+
}), {
|
|
1266
|
+
entries,
|
|
1267
|
+
order
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
entries() {
|
|
1271
|
+
let { entries, order } = this.order();
|
|
1272
|
+
if (order.length) return entries;
|
|
1273
|
+
}
|
|
1274
|
+
values() {
|
|
1275
|
+
let { entries, order } = this.order();
|
|
1276
|
+
return order.map((name)=>entries[name]);
|
|
1277
|
+
}
|
|
1278
|
+
get(key) {
|
|
1279
|
+
return this.store.get(key);
|
|
1280
|
+
}
|
|
1281
|
+
getOrCompute(key, fn) {
|
|
1282
|
+
return this.has(key) || this.set(key, fn()), this.get(key);
|
|
1283
|
+
}
|
|
1284
|
+
has(key) {
|
|
1285
|
+
return this.store.has(key);
|
|
1286
|
+
}
|
|
1287
|
+
set(key, value) {
|
|
1288
|
+
return this.store.set(key, value), this;
|
|
1289
|
+
}
|
|
1290
|
+
merge(obj, omit = []) {
|
|
1291
|
+
return Object.keys(obj).forEach((key)=>{
|
|
1292
|
+
if (omit.includes(key)) return;
|
|
1293
|
+
let value = obj[key];
|
|
1294
|
+
(Array.isArray(value) || 'object' == typeof value) && null !== value && this.has(key) ? this.set(key, cjs(this.get(key), value)) : this.set(key, value);
|
|
1295
|
+
}), this;
|
|
1296
|
+
}
|
|
1297
|
+
clean(obj) {
|
|
1298
|
+
return Object.keys(obj).reduce((acc, key)=>{
|
|
1299
|
+
let value = obj[key];
|
|
1300
|
+
return void 0 === value || Array.isArray(value) && !value.length || '[object Object]' === Object.prototype.toString.call(value) && !Object.keys(value).length || (acc[key] = value), acc;
|
|
1301
|
+
}, {});
|
|
1302
|
+
}
|
|
1303
|
+
when(condition, whenTruthy = Function.prototype, whenFalsy = Function.prototype) {
|
|
1304
|
+
return condition ? whenTruthy(this) : whenFalsy(this), this;
|
|
1305
|
+
}
|
|
1306
|
+
constructor(...args){
|
|
1307
|
+
super(...args), this.store = new Map();
|
|
1308
|
+
}
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
function createChainable(superClass) {
|
|
1312
|
+
return class extends superClass {
|
|
1313
|
+
batch(handler) {
|
|
1314
|
+
return handler(this), this;
|
|
1315
|
+
}
|
|
1316
|
+
end() {
|
|
1317
|
+
return this.parent;
|
|
1318
|
+
}
|
|
1319
|
+
constructor(parent){
|
|
1320
|
+
super(), this.parent = parent;
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1324
|
+
let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = function(superClass) {
|
|
1325
|
+
return class extends superClass {
|
|
1326
|
+
set(...args) {
|
|
1327
|
+
return this.useMap = !0, this.value = void 0, super.set(...args);
|
|
1328
|
+
}
|
|
1329
|
+
clear() {
|
|
1330
|
+
return this.value = void 0, super.clear();
|
|
1331
|
+
}
|
|
1332
|
+
classCall(value) {
|
|
1333
|
+
return this.clear(), this.useMap = !1, this.value = value, this.parent;
|
|
1334
|
+
}
|
|
1335
|
+
entries() {
|
|
1336
|
+
return this.useMap ? super.entries() : this.value;
|
|
1337
|
+
}
|
|
1338
|
+
values() {
|
|
1339
|
+
return this.useMap ? super.values() : this.value;
|
|
1340
|
+
}
|
|
1341
|
+
constructor(...args){
|
|
1342
|
+
super(...args), this.value = void 0, this.useMap = !0;
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
}(createMap(createChainable(class extends Function {
|
|
1346
|
+
classCall() {
|
|
1347
|
+
throw Error('not implemented');
|
|
1348
|
+
}
|
|
1349
|
+
constructor(){
|
|
1350
|
+
return super(), new Proxy(this, {
|
|
1351
|
+
apply: (target, thisArg, args)=>target.classCall(...args)
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
}))), ChainedSet = function(superClass) {
|
|
1355
|
+
return class extends superClass {
|
|
1356
|
+
add(value) {
|
|
1357
|
+
return this.store.add(value), this;
|
|
1358
|
+
}
|
|
1359
|
+
prepend(value) {
|
|
1360
|
+
return this.store = new Set([
|
|
1361
|
+
value,
|
|
1362
|
+
...this.store
|
|
1363
|
+
]), this;
|
|
1364
|
+
}
|
|
1365
|
+
clear() {
|
|
1366
|
+
return this.store.clear(), this;
|
|
1367
|
+
}
|
|
1368
|
+
delete(value) {
|
|
1369
|
+
return this.store.delete(value), this;
|
|
1370
|
+
}
|
|
1371
|
+
values() {
|
|
1372
|
+
return [
|
|
1373
|
+
...this.store
|
|
1374
|
+
];
|
|
1375
|
+
}
|
|
1376
|
+
has(value) {
|
|
1377
|
+
return this.store.has(value);
|
|
1378
|
+
}
|
|
1379
|
+
merge(arr) {
|
|
1380
|
+
return void 0 !== arr && (this.store = new Set([
|
|
1381
|
+
...this.store,
|
|
1382
|
+
...arr
|
|
1383
|
+
])), this;
|
|
1384
|
+
}
|
|
1385
|
+
when(condition, whenTruthy = Function.prototype, whenFalsy = Function.prototype) {
|
|
1386
|
+
return condition ? whenTruthy(this) : whenFalsy(this), this;
|
|
1387
|
+
}
|
|
1388
|
+
constructor(...args){
|
|
1389
|
+
super(...args), this.store = new Set();
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
}(createChainable(Object)), Orderable = (Class)=>class extends Class {
|
|
1393
|
+
before(name) {
|
|
1394
|
+
if (this.__after) throw Error(`Unable to set .before(${JSON.stringify(name)}) with existing value for .after()`);
|
|
1395
|
+
return this.__before = name, this;
|
|
1396
|
+
}
|
|
1397
|
+
after(name) {
|
|
1398
|
+
if (this.__before) throw Error(`Unable to set .after(${JSON.stringify(name)}) with existing value for .before()`);
|
|
1399
|
+
return this.__after = name, this;
|
|
1400
|
+
}
|
|
1401
|
+
merge(obj, omit = []) {
|
|
1402
|
+
return obj.before && this.before(obj.before), obj.after && this.after(obj.after), super.merge(obj, [
|
|
1403
|
+
...omit,
|
|
1404
|
+
'before',
|
|
1405
|
+
'after'
|
|
1406
|
+
]);
|
|
1407
|
+
}
|
|
1408
|
+
}, src_Plugin = Orderable(class extends ChainedMap {
|
|
1409
|
+
use(plugin, args = []) {
|
|
1410
|
+
return this.set('plugin', plugin).set('args', args);
|
|
1411
|
+
}
|
|
1412
|
+
tap(f) {
|
|
1413
|
+
if (!this.has('plugin')) throw Error(`Cannot call .tap() on a plugin that has not yet been defined. Call ${this.type}('${this.name}').use(<Plugin>) first.`);
|
|
1414
|
+
return this.set('args', f(this.get('args') || [])), this;
|
|
1415
|
+
}
|
|
1416
|
+
set(key, value) {
|
|
1417
|
+
if ('args' === key && !Array.isArray(value)) throw Error('args must be an array of arguments');
|
|
1418
|
+
return super.set(key, value);
|
|
1419
|
+
}
|
|
1420
|
+
merge(obj, omit = []) {
|
|
1421
|
+
return 'plugin' in obj && this.set('plugin', obj.plugin), 'args' in obj && this.set('args', obj.args), super.merge(obj, [
|
|
1422
|
+
...omit,
|
|
1423
|
+
'args',
|
|
1424
|
+
'plugin'
|
|
1425
|
+
]);
|
|
1426
|
+
}
|
|
1427
|
+
toConfig() {
|
|
1428
|
+
let init = this.get('init'), plugin = this.get('plugin'), args = this.get('args'), pluginPath = null;
|
|
1429
|
+
if (void 0 === plugin) throw Error(`Invalid ${this.type} configuration: ${this.type}('${this.name}').use(<Plugin>) was not called to specify the plugin`);
|
|
1430
|
+
'string' == typeof plugin && (plugin = require(pluginPath = plugin));
|
|
1431
|
+
let constructorName = plugin.__expression ? `(${plugin.__expression})` : plugin.name, config = init(plugin, args);
|
|
1432
|
+
return Object.defineProperties(config, {
|
|
1433
|
+
__pluginName: {
|
|
1434
|
+
value: this.name
|
|
1435
|
+
},
|
|
1436
|
+
__pluginType: {
|
|
1437
|
+
value: this.type
|
|
1438
|
+
},
|
|
1439
|
+
__pluginArgs: {
|
|
1440
|
+
value: args
|
|
1441
|
+
},
|
|
1442
|
+
__pluginConstructorName: {
|
|
1443
|
+
value: constructorName
|
|
1444
|
+
},
|
|
1445
|
+
__pluginPath: {
|
|
1446
|
+
value: pluginPath
|
|
1447
|
+
}
|
|
1448
|
+
}), config;
|
|
1449
|
+
}
|
|
1450
|
+
constructor(parent, name, type = 'plugin'){
|
|
1451
|
+
super(parent), this.name = name, this.type = type, this.extend([
|
|
1452
|
+
'init'
|
|
1453
|
+
]), this.init((Plugin, args = [])=>'function' == typeof Plugin ? new Plugin(...args) : Plugin);
|
|
1454
|
+
}
|
|
1455
|
+
}), childMaps = [
|
|
1456
|
+
'alias',
|
|
1457
|
+
'fallback',
|
|
1458
|
+
'byDependency',
|
|
1459
|
+
'extensionAlias'
|
|
1460
|
+
], childSets = [
|
|
1461
|
+
'aliasFields',
|
|
1462
|
+
'conditionNames',
|
|
1463
|
+
"descriptionFiles",
|
|
1464
|
+
'extensions',
|
|
1465
|
+
'mainFields',
|
|
1466
|
+
'mainFiles',
|
|
1467
|
+
'exportsFields',
|
|
1468
|
+
'importsFields',
|
|
1469
|
+
'restrictions',
|
|
1470
|
+
'roots',
|
|
1471
|
+
'modules'
|
|
1472
|
+
];
|
|
1473
|
+
class Resolve_class extends ChainedMap {
|
|
1474
|
+
plugin(name) {
|
|
1475
|
+
return this.plugins.getOrCompute(name, ()=>new src_Plugin(this, name, 'resolve.plugin'));
|
|
1476
|
+
}
|
|
1477
|
+
get(key) {
|
|
1478
|
+
return childMaps.includes(key) ? this[key].entries() : childSets.includes(key) ? this[key].values() : super.get(key);
|
|
1479
|
+
}
|
|
1480
|
+
toConfig() {
|
|
1481
|
+
let config = Object.assign(this.entries() || {}, {
|
|
1482
|
+
plugins: this.plugins.values().map((plugin)=>plugin.toConfig())
|
|
1483
|
+
});
|
|
1484
|
+
return childMaps.forEach((key)=>{
|
|
1485
|
+
config[key] = this[key].entries();
|
|
1486
|
+
}), childSets.forEach((key)=>{
|
|
1487
|
+
config[key] = this[key].values();
|
|
1488
|
+
}), this.clean(config);
|
|
1489
|
+
}
|
|
1490
|
+
merge(obj, omit = []) {
|
|
1491
|
+
!omit.includes('plugin') && 'plugin' in obj && Object.keys(obj.plugin).forEach((name)=>this.plugin(name).merge(obj.plugin[name]));
|
|
1492
|
+
let omissions = [
|
|
1493
|
+
...childMaps,
|
|
1494
|
+
...childSets
|
|
1495
|
+
];
|
|
1496
|
+
return omissions.forEach((key)=>{
|
|
1497
|
+
!omit.includes(key) && key in obj && this[key].merge(obj[key]);
|
|
1498
|
+
}), super.merge(obj, [
|
|
1499
|
+
...omit,
|
|
1500
|
+
...omissions,
|
|
1501
|
+
'plugin'
|
|
1502
|
+
]);
|
|
1503
|
+
}
|
|
1504
|
+
constructor(parent){
|
|
1505
|
+
super(parent), childMaps.forEach((key)=>{
|
|
1506
|
+
this[key] = new ChainedMap(this);
|
|
1507
|
+
}), childSets.forEach((key)=>{
|
|
1508
|
+
this[key] = new ChainedSet(this);
|
|
1509
|
+
}), this.plugins = new ChainedMap(this), this.extend([
|
|
1510
|
+
'cachePredicate',
|
|
1511
|
+
'cacheWithContext',
|
|
1512
|
+
'enforceExtension',
|
|
1513
|
+
'symlinks',
|
|
1514
|
+
'unsafeCache',
|
|
1515
|
+
'preferRelative',
|
|
1516
|
+
'preferAbsolute',
|
|
1517
|
+
'tsConfig'
|
|
1518
|
+
]);
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
class ResolveLoader_class extends Resolve_class {
|
|
1522
|
+
toConfig() {
|
|
1523
|
+
return this.clean({
|
|
1524
|
+
modules: this.modules.values(),
|
|
1525
|
+
moduleExtensions: this.moduleExtensions.values(),
|
|
1526
|
+
packageMains: this.packageMains.values(),
|
|
1527
|
+
...super.toConfig()
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
merge(obj, omit = []) {
|
|
1531
|
+
let omissions = [
|
|
1532
|
+
'modules',
|
|
1533
|
+
'moduleExtensions',
|
|
1534
|
+
'packageMains'
|
|
1535
|
+
];
|
|
1536
|
+
return omissions.forEach((key)=>{
|
|
1537
|
+
!omit.includes(key) && key in obj && this[key].merge(obj[key]);
|
|
1538
|
+
}), super.merge(obj, [
|
|
1539
|
+
...omit,
|
|
1540
|
+
...omissions
|
|
1541
|
+
]);
|
|
1542
|
+
}
|
|
1543
|
+
constructor(parent){
|
|
1544
|
+
super(parent), this.modules = new ChainedSet(this), this.moduleExtensions = new ChainedSet(this), this.packageMains = new ChainedSet(this);
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
class Output_class extends ChainedMap {
|
|
1548
|
+
constructor(parent){
|
|
1549
|
+
super(parent), this.extend([
|
|
1550
|
+
'auxiliaryComment',
|
|
1551
|
+
'charset',
|
|
1552
|
+
'chunkFilename',
|
|
1553
|
+
'chunkLoadTimeout',
|
|
1554
|
+
'chunkLoadingGlobal',
|
|
1555
|
+
'chunkLoading',
|
|
1556
|
+
'chunkFormat',
|
|
1557
|
+
'enabledChunkLoadingTypes',
|
|
1558
|
+
'crossOriginLoading',
|
|
1559
|
+
'devtoolFallbackModuleFilenameTemplate',
|
|
1560
|
+
'devtoolModuleFilenameTemplate',
|
|
1561
|
+
'devtoolNamespace',
|
|
1562
|
+
'filename',
|
|
1563
|
+
'assetModuleFilename',
|
|
1564
|
+
'globalObject',
|
|
1565
|
+
'uniqueName',
|
|
1566
|
+
'hashDigest',
|
|
1567
|
+
'hashDigestLength',
|
|
1568
|
+
'hashFunction',
|
|
1569
|
+
'hashSalt',
|
|
1570
|
+
'hotUpdateChunkFilename',
|
|
1571
|
+
'hotUpdateGlobal',
|
|
1572
|
+
'hotUpdateMainFilename',
|
|
1573
|
+
'library',
|
|
1574
|
+
'libraryExport',
|
|
1575
|
+
'libraryTarget',
|
|
1576
|
+
'importFunctionName',
|
|
1577
|
+
'path',
|
|
1578
|
+
'pathinfo',
|
|
1579
|
+
'publicPath',
|
|
1580
|
+
"scriptType",
|
|
1581
|
+
'sourceMapFilename',
|
|
1582
|
+
'sourcePrefix',
|
|
1583
|
+
'strictModuleErrorHandling',
|
|
1584
|
+
'strictModuleExceptionHandling',
|
|
1585
|
+
'umdNamedDefine',
|
|
1586
|
+
'workerChunkLoading',
|
|
1587
|
+
'enabledLibraryTypes',
|
|
1588
|
+
'environment',
|
|
1589
|
+
'compareBeforeEmit',
|
|
1590
|
+
'wasmLoading',
|
|
1591
|
+
'webassemblyModuleFilename',
|
|
1592
|
+
'enabledWasmLoadingTypes',
|
|
1593
|
+
'iife',
|
|
1594
|
+
'module',
|
|
1595
|
+
'clean'
|
|
1596
|
+
]);
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
class DevServer_class extends ChainedMap {
|
|
1600
|
+
toConfig() {
|
|
1601
|
+
return this.clean({
|
|
1602
|
+
allowedHosts: this.allowedHosts.values(),
|
|
1603
|
+
...this.entries() || {}
|
|
1604
|
+
});
|
|
1605
|
+
}
|
|
1606
|
+
merge(obj, omit = []) {
|
|
1607
|
+
return !omit.includes('allowedHosts') && 'allowedHosts' in obj && this.allowedHosts.merge(obj.allowedHosts), super.merge(obj, [
|
|
1608
|
+
'allowedHosts'
|
|
1609
|
+
]);
|
|
1610
|
+
}
|
|
1611
|
+
constructor(parent){
|
|
1612
|
+
super(parent), this.allowedHosts = new ChainedSet(this), this.extend([
|
|
1613
|
+
'after',
|
|
1614
|
+
'before',
|
|
1615
|
+
'bonjour',
|
|
1616
|
+
'clientLogLevel',
|
|
1617
|
+
'compress',
|
|
1618
|
+
'contentBase',
|
|
1619
|
+
'contentBasePublicPath',
|
|
1620
|
+
'disableHostCheck',
|
|
1621
|
+
'filename',
|
|
1622
|
+
'headers',
|
|
1623
|
+
'historyApiFallback',
|
|
1624
|
+
'host',
|
|
1625
|
+
'hot',
|
|
1626
|
+
'hotOnly',
|
|
1627
|
+
'http2',
|
|
1628
|
+
'https',
|
|
1629
|
+
'index',
|
|
1630
|
+
'injectClient',
|
|
1631
|
+
'injectHot',
|
|
1632
|
+
'inline',
|
|
1633
|
+
'lazy',
|
|
1634
|
+
'liveReload',
|
|
1635
|
+
'mimeTypes',
|
|
1636
|
+
'noInfo',
|
|
1637
|
+
'onListening',
|
|
1638
|
+
'open',
|
|
1639
|
+
'openPage',
|
|
1640
|
+
'overlay',
|
|
1641
|
+
'pfx',
|
|
1642
|
+
'pfxPassphrase',
|
|
1643
|
+
'port',
|
|
1644
|
+
'proxy',
|
|
1645
|
+
'progress',
|
|
1646
|
+
'public',
|
|
1647
|
+
'publicPath',
|
|
1648
|
+
'quiet',
|
|
1649
|
+
'serveIndex',
|
|
1650
|
+
'setup',
|
|
1651
|
+
'socket',
|
|
1652
|
+
'sockHost',
|
|
1653
|
+
'sockPath',
|
|
1654
|
+
'sockPort',
|
|
1655
|
+
'staticOptions',
|
|
1656
|
+
'stats',
|
|
1657
|
+
'stdin',
|
|
1658
|
+
'transportMode',
|
|
1659
|
+
'useLocalIp',
|
|
1660
|
+
'watchContentBase',
|
|
1661
|
+
'watchOptions',
|
|
1662
|
+
'writeToDisk'
|
|
1663
|
+
]);
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
let Use = Orderable(class extends ChainedMap {
|
|
1667
|
+
tap(f) {
|
|
1668
|
+
return this.options(f(this.get('options'))), this;
|
|
1669
|
+
}
|
|
1670
|
+
merge(obj, omit = []) {
|
|
1671
|
+
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, [
|
|
1672
|
+
...omit,
|
|
1673
|
+
'loader',
|
|
1674
|
+
'options'
|
|
1675
|
+
]);
|
|
1676
|
+
}
|
|
1677
|
+
toConfig() {
|
|
1678
|
+
let config = this.clean(this.entries() || {});
|
|
1679
|
+
return Object.defineProperties(config, {
|
|
1680
|
+
__useName: {
|
|
1681
|
+
value: this.name
|
|
1682
|
+
},
|
|
1683
|
+
__ruleNames: {
|
|
1684
|
+
value: this.parent && this.parent.names
|
|
1685
|
+
},
|
|
1686
|
+
__ruleTypes: {
|
|
1687
|
+
value: this.parent && this.parent.ruleTypes
|
|
1688
|
+
}
|
|
1689
|
+
}), config;
|
|
1690
|
+
}
|
|
1691
|
+
constructor(parent, name){
|
|
1692
|
+
super(parent), this.name = name, this.extend([
|
|
1693
|
+
'loader',
|
|
1694
|
+
'options',
|
|
1695
|
+
'parallel'
|
|
1696
|
+
]);
|
|
1697
|
+
}
|
|
1698
|
+
});
|
|
1699
|
+
function toArray(arr) {
|
|
1700
|
+
return Array.isArray(arr) ? arr : [
|
|
1701
|
+
arr
|
|
1702
|
+
];
|
|
1703
|
+
}
|
|
1704
|
+
let Rule_Rule = Orderable(class extends ChainedMap {
|
|
1705
|
+
use(name) {
|
|
1706
|
+
return this.uses.getOrCompute(name, ()=>new Use(this, name));
|
|
1707
|
+
}
|
|
1708
|
+
rule(name) {
|
|
1709
|
+
return this.rules.getOrCompute(name, ()=>new Rule_Rule(this, name, 'rule'));
|
|
1710
|
+
}
|
|
1711
|
+
oneOf(name) {
|
|
1712
|
+
return this.oneOfs.getOrCompute(name, ()=>new Rule_Rule(this, name, 'oneOf'));
|
|
1713
|
+
}
|
|
1714
|
+
pre() {
|
|
1715
|
+
return this.enforce('pre');
|
|
1716
|
+
}
|
|
1717
|
+
post() {
|
|
1718
|
+
return this.enforce('post');
|
|
1719
|
+
}
|
|
1720
|
+
toConfig() {
|
|
1721
|
+
let config = this.clean(Object.assign(this.entries() || {}, {
|
|
1722
|
+
include: this.include.values(),
|
|
1723
|
+
exclude: this.exclude.values(),
|
|
1724
|
+
rules: this.rules.values().map((rule)=>rule.toConfig()),
|
|
1725
|
+
oneOf: this.oneOfs.values().map((oneOf)=>oneOf.toConfig()),
|
|
1726
|
+
use: this.uses.values().map((use)=>use.toConfig()),
|
|
1727
|
+
resolve: this.resolve.toConfig()
|
|
1728
|
+
}));
|
|
1729
|
+
return Object.defineProperties(config, {
|
|
1730
|
+
__ruleNames: {
|
|
1731
|
+
value: this.names
|
|
1732
|
+
},
|
|
1733
|
+
__ruleTypes: {
|
|
1734
|
+
value: this.ruleTypes
|
|
1735
|
+
}
|
|
1736
|
+
}), config;
|
|
1737
|
+
}
|
|
1738
|
+
merge(obj, omit = []) {
|
|
1739
|
+
return !omit.includes('include') && 'include' in obj && this.include.merge(toArray(obj.include)), !omit.includes('exclude') && 'exclude' in obj && this.exclude.merge(toArray(obj.exclude)), !omit.includes('use') && 'use' in obj && Object.keys(obj.use).forEach((name)=>this.use(name).merge(obj.use[name])), !omit.includes('rules') && 'rules' in obj && Object.keys(obj.rules).forEach((name)=>this.rule(name).merge(obj.rules[name])), !omit.includes('oneOf') && 'oneOf' in obj && Object.keys(obj.oneOf).forEach((name)=>this.oneOf(name).merge(obj.oneOf[name])), !omit.includes('resolve') && 'resolve' in obj && this.resolve.merge(obj.resolve), !omit.includes('test') && 'test' in obj && this.test(obj.test instanceof RegExp || 'function' == typeof obj.test ? obj.test : new RegExp(obj.test)), super.merge(obj, [
|
|
1740
|
+
...omit,
|
|
1741
|
+
'include',
|
|
1742
|
+
'exclude',
|
|
1743
|
+
'use',
|
|
1744
|
+
'rules',
|
|
1745
|
+
'oneOf',
|
|
1746
|
+
'resolve',
|
|
1747
|
+
'test'
|
|
1748
|
+
]);
|
|
1749
|
+
}
|
|
1750
|
+
constructor(parent, name, ruleType = 'rule'){
|
|
1751
|
+
super(parent), this.ruleName = name, this.names = [], this.ruleType = ruleType, this.ruleTypes = [];
|
|
1752
|
+
let rule = this;
|
|
1753
|
+
for(; rule instanceof Rule_Rule;)this.names.unshift(rule.ruleName), this.ruleTypes.unshift(rule.ruleType), rule = rule.parent;
|
|
1754
|
+
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([
|
|
1755
|
+
'fullySpecified'
|
|
1756
|
+
]), this.extend([
|
|
1757
|
+
'dependency',
|
|
1758
|
+
'enforce',
|
|
1759
|
+
'issuer',
|
|
1760
|
+
'issuerLayer',
|
|
1761
|
+
'layer',
|
|
1762
|
+
'mimetype',
|
|
1763
|
+
'parser',
|
|
1764
|
+
'generator',
|
|
1765
|
+
'resource',
|
|
1766
|
+
'resourceFragment',
|
|
1767
|
+
'resourceQuery',
|
|
1768
|
+
'sideEffects',
|
|
1769
|
+
'with',
|
|
1770
|
+
'test',
|
|
1771
|
+
'type'
|
|
1772
|
+
]);
|
|
1773
|
+
}
|
|
1774
|
+
});
|
|
1775
|
+
class Module_class extends ChainedMap {
|
|
1776
|
+
defaultRule(name) {
|
|
1777
|
+
return this.defaultRules.getOrCompute(name, ()=>new Rule_Rule(this, name, 'defaultRule'));
|
|
1778
|
+
}
|
|
1779
|
+
rule(name) {
|
|
1780
|
+
return this.rules.getOrCompute(name, ()=>new Rule_Rule(this, name, 'rule'));
|
|
1781
|
+
}
|
|
1782
|
+
toConfig() {
|
|
1783
|
+
return this.clean(Object.assign(this.entries() || {}, {
|
|
1784
|
+
defaultRules: this.defaultRules.values().map((r)=>r.toConfig()),
|
|
1785
|
+
generator: this.generator.entries(),
|
|
1786
|
+
parser: this.parser.entries(),
|
|
1787
|
+
rules: this.rules.values().map((r)=>r.toConfig())
|
|
1788
|
+
}));
|
|
1789
|
+
}
|
|
1790
|
+
merge(obj, omit = []) {
|
|
1791
|
+
return !omit.includes('rule') && 'rule' in obj && Object.keys(obj.rule).forEach((name)=>this.rule(name).merge(obj.rule[name])), !omit.includes('defaultRule') && 'defaultRule' in obj && Object.keys(obj.defaultRule).forEach((name)=>this.defaultRule(name).merge(obj.defaultRule[name])), super.merge(obj, [
|
|
1792
|
+
'rule',
|
|
1793
|
+
'defaultRule'
|
|
1794
|
+
]);
|
|
1795
|
+
}
|
|
1796
|
+
constructor(parent){
|
|
1797
|
+
super(parent), this.rules = new ChainedMap(this), this.defaultRules = new ChainedMap(this), this.generator = new ChainedMap(this), this.parser = new ChainedMap(this), this.extend([
|
|
1798
|
+
'noParse',
|
|
1799
|
+
'unsafeCache',
|
|
1800
|
+
'wrappedContextCritical',
|
|
1801
|
+
'exprContextRegExp',
|
|
1802
|
+
'wrappedContextRecursive',
|
|
1803
|
+
'strictExportPresence',
|
|
1804
|
+
'wrappedContextRegExp'
|
|
1805
|
+
]);
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
class Optimization_class extends ChainedMap {
|
|
1809
|
+
minimizer(name) {
|
|
1810
|
+
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+.");
|
|
1811
|
+
return this.minimizers.getOrCompute(name, ()=>new src_Plugin(this, name, 'optimization.minimizer'));
|
|
1812
|
+
}
|
|
1813
|
+
toConfig() {
|
|
1814
|
+
return this.clean(Object.assign(this.entries() || {}, {
|
|
1815
|
+
splitChunks: this.splitChunks.entries(),
|
|
1816
|
+
minimizer: this.minimizers.values().map((plugin)=>plugin.toConfig())
|
|
1817
|
+
}));
|
|
1818
|
+
}
|
|
1819
|
+
merge(obj, omit = []) {
|
|
1820
|
+
return !omit.includes('minimizer') && 'minimizer' in obj && Object.keys(obj.minimizer).forEach((name)=>this.minimizer(name).merge(obj.minimizer[name])), super.merge(obj, [
|
|
1821
|
+
...omit,
|
|
1822
|
+
'minimizer'
|
|
1823
|
+
]);
|
|
1824
|
+
}
|
|
1825
|
+
constructor(parent){
|
|
1826
|
+
super(parent), this.minimizers = new ChainedMap(this), this.splitChunks = new ChainedValueMap(this), this.extend([
|
|
1827
|
+
'minimize',
|
|
1828
|
+
'runtimeChunk',
|
|
1829
|
+
'emitOnErrors',
|
|
1830
|
+
'moduleIds',
|
|
1831
|
+
'chunkIds',
|
|
1832
|
+
'nodeEnv',
|
|
1833
|
+
'mangleWasmImports',
|
|
1834
|
+
'removeAvailableModules',
|
|
1835
|
+
'removeEmptyChunks',
|
|
1836
|
+
'mergeDuplicateChunks',
|
|
1837
|
+
'flagIncludedChunks',
|
|
1838
|
+
'providedExports',
|
|
1839
|
+
'usedExports',
|
|
1840
|
+
'concatenateModules',
|
|
1841
|
+
'sideEffects',
|
|
1842
|
+
'portableRecords',
|
|
1843
|
+
'mangleExports',
|
|
1844
|
+
'innerGraph',
|
|
1845
|
+
'realContentHash',
|
|
1846
|
+
'avoidEntryIife'
|
|
1847
|
+
]);
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
class Performance_class extends ChainedValueMap {
|
|
1851
|
+
constructor(parent){
|
|
1852
|
+
super(parent), this.extend([
|
|
1853
|
+
'assetFilter',
|
|
1854
|
+
'hints',
|
|
1855
|
+
'maxAssetSize',
|
|
1856
|
+
'maxEntrypointSize'
|
|
1857
|
+
]);
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
let castArray = (value)=>Array.isArray(value) ? value : [
|
|
1861
|
+
value
|
|
1862
|
+
];
|
|
1863
|
+
class src_class extends ChainedMap {
|
|
1864
|
+
static toString(config, { verbose = !1, configPrefix = 'config' } = {}) {
|
|
1865
|
+
return (0, dist.stringify)(config, (value, indent, stringify)=>{
|
|
1866
|
+
if (value && value.__pluginName) {
|
|
1867
|
+
let prefix = `/* ${configPrefix}.${value.__pluginType}('${value.__pluginName}') */\n`, constructorExpression = value.__pluginPath ? `(require(${stringify(value.__pluginPath)}))` : value.__pluginConstructorName;
|
|
1868
|
+
if (constructorExpression) {
|
|
1869
|
+
let args = stringify(value.__pluginArgs).slice(1, -1);
|
|
1870
|
+
return `${prefix}new ${constructorExpression}(${args})`;
|
|
1871
|
+
}
|
|
1872
|
+
return prefix + stringify(value.__pluginArgs && value.__pluginArgs.length ? {
|
|
1873
|
+
args: value.__pluginArgs
|
|
1874
|
+
} : {});
|
|
1875
|
+
}
|
|
1876
|
+
if (value && value.__ruleNames) {
|
|
1877
|
+
let ruleTypes = value.__ruleTypes;
|
|
1878
|
+
return `/* ${configPrefix}.module${value.__ruleNames.map((r, index)=>`.${ruleTypes ? ruleTypes[index] : 'rule'}('${r}')`).join('')}${value.__useName ? `.use('${value.__useName}')` : ""} */\n` + stringify(value);
|
|
1879
|
+
}
|
|
1880
|
+
return value && value.__expression ? value.__expression : 'function' == typeof value && !verbose && value.toString().length > 100 ? "function () { /* omitted long function */ }" : stringify(value);
|
|
1881
|
+
}, 2);
|
|
1882
|
+
}
|
|
1883
|
+
entry(name) {
|
|
1884
|
+
return this.entryPoints.getOrCompute(name, ()=>new ChainedSet(this));
|
|
1885
|
+
}
|
|
1886
|
+
plugin(name) {
|
|
1887
|
+
return this.plugins.getOrCompute(name, ()=>new src_Plugin(this, name));
|
|
1888
|
+
}
|
|
1889
|
+
toConfig() {
|
|
1890
|
+
let entryPoints = this.entryPoints.entries() || {}, baseConfig = this.entries() || {};
|
|
1891
|
+
return this.clean(Object.assign(baseConfig, {
|
|
1892
|
+
node: this.node.entries(),
|
|
1893
|
+
output: this.output.entries(),
|
|
1894
|
+
resolve: this.resolve.toConfig(),
|
|
1895
|
+
resolveLoader: this.resolveLoader.toConfig(),
|
|
1896
|
+
devServer: this.devServer.toConfig(),
|
|
1897
|
+
module: this.module.toConfig(),
|
|
1898
|
+
optimization: this.optimization.toConfig(),
|
|
1899
|
+
plugins: this.plugins.values().map((plugin)=>plugin.toConfig()),
|
|
1900
|
+
performance: this.performance.entries(),
|
|
1901
|
+
entry: ((entryPoints)=>{
|
|
1902
|
+
let entry = Object.keys(entryPoints).reduce((acc, key)=>Object.assign(acc, {
|
|
1903
|
+
[key]: entryPoints[key].values()
|
|
1904
|
+
}), {}), formattedEntry = {};
|
|
1905
|
+
for (let [entryName, entryValue] of Object.entries(entry)){
|
|
1906
|
+
let entryImport = [], entryDescription = null;
|
|
1907
|
+
for (let item of castArray(entryValue)){
|
|
1908
|
+
if ('string' == typeof item) {
|
|
1909
|
+
entryImport.push(item);
|
|
1910
|
+
continue;
|
|
1911
|
+
}
|
|
1912
|
+
item.import && entryImport.push(...castArray(item.import)), entryDescription ? Object.assign(entryDescription, item) : entryDescription = item;
|
|
1913
|
+
}
|
|
1914
|
+
formattedEntry[entryName] = entryDescription ? {
|
|
1915
|
+
...entryDescription,
|
|
1916
|
+
import: entryImport
|
|
1917
|
+
} : entryImport;
|
|
1918
|
+
}
|
|
1919
|
+
return formattedEntry;
|
|
1920
|
+
})(entryPoints)
|
|
1921
|
+
}));
|
|
1922
|
+
}
|
|
1923
|
+
toString(options) {
|
|
1924
|
+
return this.constructor.toString(this.toConfig(), options);
|
|
1925
|
+
}
|
|
1926
|
+
merge(obj = {}, omit = []) {
|
|
1927
|
+
let omissions = [
|
|
1928
|
+
'node',
|
|
1929
|
+
'output',
|
|
1930
|
+
'resolve',
|
|
1931
|
+
'resolveLoader',
|
|
1932
|
+
'devServer',
|
|
1933
|
+
'optimization',
|
|
1934
|
+
'performance',
|
|
1935
|
+
'module'
|
|
1936
|
+
];
|
|
1937
|
+
return !omit.includes('entry') && 'entry' in obj && Object.keys(obj.entry).forEach((name)=>this.entry(name).merge([].concat(obj.entry[name]))), !omit.includes('plugin') && 'plugin' in obj && Object.keys(obj.plugin).forEach((name)=>this.plugin(name).merge(obj.plugin[name])), omissions.forEach((key)=>{
|
|
1938
|
+
!omit.includes(key) && key in obj && this[key].merge(obj[key]);
|
|
1939
|
+
}), super.merge(obj, [
|
|
1940
|
+
...omit,
|
|
1941
|
+
...omissions,
|
|
1942
|
+
'entry',
|
|
1943
|
+
'plugin'
|
|
1944
|
+
]);
|
|
1945
|
+
}
|
|
1946
|
+
constructor(){
|
|
1947
|
+
super(), this.entryPoints = new ChainedMap(this), this.output = new Output_class(this), this.module = new Module_class(this), this.resolve = new Resolve_class(this), this.resolveLoader = new ResolveLoader_class(this), this.optimization = new Optimization_class(this), this.plugins = new ChainedMap(this), this.devServer = new DevServer_class(this), this.performance = new Performance_class(this), this.node = new ChainedValueMap(this), this.extend([
|
|
1948
|
+
'context',
|
|
1949
|
+
'mode',
|
|
1950
|
+
'devtool',
|
|
1951
|
+
'target',
|
|
1952
|
+
'watch',
|
|
1953
|
+
'watchOptions',
|
|
1954
|
+
'externals',
|
|
1955
|
+
'externalsType',
|
|
1956
|
+
'externalsPresets',
|
|
1957
|
+
'stats',
|
|
1958
|
+
'experiments',
|
|
1959
|
+
'amd',
|
|
1960
|
+
'bail',
|
|
1961
|
+
'cache',
|
|
1962
|
+
'dependencies',
|
|
1963
|
+
'ignoreWarnings',
|
|
1964
|
+
'loader',
|
|
1965
|
+
'parallelism',
|
|
1966
|
+
'profile',
|
|
1967
|
+
'recordsPath',
|
|
1968
|
+
'recordsInputPath',
|
|
1969
|
+
'recordsOutputPath',
|
|
1970
|
+
'name',
|
|
1971
|
+
'infrastructureLogging',
|
|
1972
|
+
'snapshot'
|
|
1973
|
+
]);
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
944
1976
|
let constants_filename = (0, external_node_url_namespaceObject.fileURLToPath)(__rslib_import_meta_url__), constants_dirname = (0, external_node_path_namespaceObject.dirname)(constants_filename), ROOT_DIST_DIR = 'dist', LOADER_PATH = (0, external_node_path_namespaceObject.join)(constants_dirname), STATIC_PATH = (0, external_node_path_namespaceObject.join)(constants_dirname, '../static'), COMPILED_PATH = (0, external_node_path_namespaceObject.join)(constants_dirname, '../compiled'), RSBUILD_OUTPUTS_PATH = '.rsbuild', DEFAULT_DEV_HOST = '0.0.0.0', DEFAULT_ASSET_PREFIX = '/', DEFAULT_WEB_BROWSERSLIST = [
|
|
945
1977
|
'chrome >= 87',
|
|
946
1978
|
'edge >= 88',
|
|
@@ -1164,7 +2196,16 @@ for(var __webpack_i__ in (()=>{
|
|
|
1164
2196
|
let getAllStatsErrors = (statsData)=>{
|
|
1165
2197
|
var _statsData_errors, _statsData_children;
|
|
1166
2198
|
return statsData.errorsCount && (null == (_statsData_errors = statsData.errors) ? void 0 : _statsData_errors.length) === 0 ? null == (_statsData_children = statsData.children) ? void 0 : _statsData_children.reduce((errors, curr)=>errors.concat(curr.errors || []), []) : statsData.errors;
|
|
1167
|
-
},
|
|
2199
|
+
}, getAssetsFromStats = (stats)=>stats.toJson({
|
|
2200
|
+
all: !1,
|
|
2201
|
+
assets: !0,
|
|
2202
|
+
cachedAssets: !0,
|
|
2203
|
+
groupAssetsByInfo: !1,
|
|
2204
|
+
groupAssetsByPath: !1,
|
|
2205
|
+
groupAssetsByChunk: !1,
|
|
2206
|
+
groupAssetsByExtension: !1,
|
|
2207
|
+
groupAssetsByEmitStatus: !1
|
|
2208
|
+
}).assets || [], getAllStatsWarnings = (statsData)=>{
|
|
1168
2209
|
var _statsData_warnings, _statsData_children;
|
|
1169
2210
|
return statsData.warningsCount && (null == (_statsData_warnings = statsData.warnings) ? void 0 : _statsData_warnings.length) === 0 ? null == (_statsData_children = statsData.children) ? void 0 : _statsData_children.reduce((warnings, curr)=>warnings.concat(curr.warnings || []), []) : statsData.warnings;
|
|
1170
2211
|
};
|
|
@@ -1209,7 +2250,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1209
2250
|
}
|
|
1210
2251
|
let rspackMinVersion = '1.2.4', setNodeEnv = (env)=>{
|
|
1211
2252
|
process.env.NODE_ENV = env;
|
|
1212
|
-
}, isFunction = (func)=>'function' == typeof func, isObject = (obj)=>'[object Object]' === Object.prototype.toString.call(obj), isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && Object.getPrototypeOf(obj) === Object.prototype,
|
|
2253
|
+
}, isFunction = (func)=>'function' == typeof func, isObject = (obj)=>'[object Object]' === Object.prototype.toString.call(obj), isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && Object.getPrototypeOf(obj) === Object.prototype, helpers_castArray = (arr)=>void 0 === arr ? [] : Array.isArray(arr) ? arr : [
|
|
1213
2254
|
arr
|
|
1214
2255
|
], cloneDeep = (value)=>null == value ? value : cjs_default()({}, value, {
|
|
1215
2256
|
isMergeableObject: isPlainObject
|
|
@@ -1299,10 +2340,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
1299
2340
|
isDebug() && (index_js_namespaceObject.logger.level = 'verbose'), index_js_namespaceObject.logger.override({
|
|
1300
2341
|
debug: (message, ...args)=>{
|
|
1301
2342
|
if ('verbose' !== index_js_namespaceObject.logger.level) return;
|
|
1302
|
-
let time = picocolors_index_js_default().gray(
|
|
2343
|
+
let time = picocolors_index_js_default().gray(function() {
|
|
1303
2344
|
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');
|
|
1304
2345
|
return `${hours}:${minutes}:${seconds}`;
|
|
1305
|
-
}()
|
|
2346
|
+
}());
|
|
1306
2347
|
console.log(` ${picocolors_index_js_default().magenta('rsbuild')} ${time} ${message}`, ...args);
|
|
1307
2348
|
}
|
|
1308
2349
|
});
|
|
@@ -1627,9 +2668,11 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
1627
2668
|
};
|
|
1628
2669
|
return {
|
|
1629
2670
|
tapEnvironment,
|
|
1630
|
-
tap: (handler)=>
|
|
2671
|
+
tap: (handler)=>{
|
|
2672
|
+
tapEnvironment({
|
|
1631
2673
|
handler
|
|
1632
|
-
})
|
|
2674
|
+
});
|
|
2675
|
+
},
|
|
1633
2676
|
callChain: async ({ environment, args: params })=>{
|
|
1634
2677
|
for (let callback of [
|
|
1635
2678
|
...preGroup,
|
|
@@ -1743,13 +2786,13 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
1743
2786
|
};
|
|
1744
2787
|
onBeforeCompile({
|
|
1745
2788
|
compiler,
|
|
1746
|
-
beforeCompile: async ()=>
|
|
2789
|
+
beforeCompile: async ()=>context.hooks.onBeforeBuild.callBatch({
|
|
1747
2790
|
bundlerConfigs,
|
|
1748
2791
|
environments: context.environments,
|
|
1749
2792
|
isWatch,
|
|
1750
2793
|
isFirstCompile
|
|
1751
2794
|
}),
|
|
1752
|
-
beforeEnvironmentCompiler: async (buildIndex)=>
|
|
2795
|
+
beforeEnvironmentCompiler: async (buildIndex)=>context.hooks.onBeforeEnvironmentCompile.callBatch({
|
|
1753
2796
|
environment: environmentList[buildIndex].name,
|
|
1754
2797
|
args: [
|
|
1755
2798
|
{
|
|
@@ -1790,7 +2833,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
1790
2833
|
};
|
|
1791
2834
|
onBeforeCompile({
|
|
1792
2835
|
compiler,
|
|
1793
|
-
beforeEnvironmentCompiler: async (buildIndex)=>
|
|
2836
|
+
beforeEnvironmentCompiler: async (buildIndex)=>context.hooks.onBeforeEnvironmentCompile.callBatch({
|
|
1794
2837
|
environment: environmentList[buildIndex].name,
|
|
1795
2838
|
args: [
|
|
1796
2839
|
{
|
|
@@ -1901,8 +2944,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
1901
2944
|
y
|
|
1902
2945
|
];
|
|
1903
2946
|
if (pair.some(Array.isArray)) return 'output.copy' !== path || pair.every(Array.isArray) ? [
|
|
1904
|
-
...
|
|
1905
|
-
...
|
|
2947
|
+
...helpers_castArray(x),
|
|
2948
|
+
...helpers_castArray(y)
|
|
1906
2949
|
] : Array.isArray(x) ? merge({
|
|
1907
2950
|
patterns: x
|
|
1908
2951
|
}, y, path) : merge(x, {
|
|
@@ -1996,7 +3039,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
1996
3039
|
wasm: 'static/wasm',
|
|
1997
3040
|
image: 'static/image',
|
|
1998
3041
|
media: 'static/media',
|
|
1999
|
-
assets: 'static/assets'
|
|
3042
|
+
assets: 'static/assets',
|
|
3043
|
+
favicon: './'
|
|
2000
3044
|
},
|
|
2001
3045
|
assetPrefix: DEFAULT_ASSET_PREFIX,
|
|
2002
3046
|
filename: {},
|
|
@@ -2144,7 +3188,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2144
3188
|
let { name, setup } = instance;
|
|
2145
3189
|
if (!(removedPlugins.has(name) || environment && (null == (_removedEnvPlugins_environment = removedEnvPlugins[environment]) ? void 0 : _removedEnvPlugins_environment.has(name)))) {
|
|
2146
3190
|
if (instance.apply && context.action) if (isFunction(instance.apply)) {
|
|
2147
|
-
if (!
|
|
3191
|
+
if (!instance.apply(context.originalConfig, {
|
|
2148
3192
|
action: context.action
|
|
2149
3193
|
})) continue;
|
|
2150
3194
|
} else {
|
|
@@ -2279,7 +3323,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2279
3323
|
async function createContext(options, userConfig) {
|
|
2280
3324
|
let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_namespaceObject.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
|
|
2281
3325
|
return {
|
|
2282
|
-
version: "1.4.
|
|
3326
|
+
version: "1.4.13",
|
|
2283
3327
|
rootPath,
|
|
2284
3328
|
distPath: '',
|
|
2285
3329
|
cachePath,
|
|
@@ -2317,8 +3361,6 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2317
3361
|
specifiedEnvironments
|
|
2318
3362
|
};
|
|
2319
3363
|
}
|
|
2320
|
-
let rspack_chain_index_js_namespaceObject = require("../compiled/rspack-chain/index.js");
|
|
2321
|
-
var rspack_chain_index_js_default = __webpack_require__.n(rspack_chain_index_js_namespaceObject);
|
|
2322
3364
|
let normalizePluginObject = (plugin)=>{
|
|
2323
3365
|
let { setup: _, ...rest } = plugin;
|
|
2324
3366
|
return {
|
|
@@ -2362,7 +3404,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2362
3404
|
index_js_namespaceObject.logger.success(`config inspection completed, generated files: \n\n${fileInfos}\n`);
|
|
2363
3405
|
}
|
|
2364
3406
|
function stringifyConfig(config, verbose) {
|
|
2365
|
-
return
|
|
3407
|
+
return src_class.toString(config, {
|
|
2366
3408
|
verbose
|
|
2367
3409
|
});
|
|
2368
3410
|
}
|
|
@@ -2462,14 +3504,14 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2462
3504
|
async function modifyBundlerChain(context, utils) {
|
|
2463
3505
|
var _utils_environment_config_tools;
|
|
2464
3506
|
index_js_namespaceObject.logger.debug('modify bundler chain');
|
|
2465
|
-
let bundlerChain = new (
|
|
3507
|
+
let bundlerChain = new src_class(), [modifiedBundlerChain] = await context.hooks.modifyBundlerChain.callChain({
|
|
2466
3508
|
environment: utils.environment.name,
|
|
2467
3509
|
args: [
|
|
2468
3510
|
bundlerChain,
|
|
2469
3511
|
utils
|
|
2470
3512
|
]
|
|
2471
3513
|
});
|
|
2472
|
-
if (null == (_utils_environment_config_tools = utils.environment.config.tools) ? void 0 : _utils_environment_config_tools.bundlerChain) for (let item of
|
|
3514
|
+
if (null == (_utils_environment_config_tools = utils.environment.config.tools) ? void 0 : _utils_environment_config_tools.bundlerChain) for (let item of helpers_castArray(utils.environment.config.tools.bundlerChain))await item(modifiedBundlerChain, utils);
|
|
2473
3515
|
return index_js_namespaceObject.logger.debug('modify bundler chain done'), modifiedBundlerChain;
|
|
2474
3516
|
}
|
|
2475
3517
|
let configChain_CHAIN_ID = {
|
|
@@ -2588,19 +3630,19 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2588
3630
|
...chainUtils,
|
|
2589
3631
|
mergeConfig: webpack_merge_dist.merge,
|
|
2590
3632
|
addRules (rules) {
|
|
2591
|
-
let ruleArr =
|
|
3633
|
+
let ruleArr = helpers_castArray(rules);
|
|
2592
3634
|
config.module || (config.module = {}), config.module.rules || (config.module.rules = []), config.module.rules.unshift(...ruleArr);
|
|
2593
3635
|
},
|
|
2594
3636
|
appendRules (rules) {
|
|
2595
|
-
let ruleArr =
|
|
3637
|
+
let ruleArr = helpers_castArray(rules);
|
|
2596
3638
|
config.module || (config.module = {}), config.module.rules || (config.module.rules = []), config.module.rules.push(...ruleArr);
|
|
2597
3639
|
},
|
|
2598
3640
|
prependPlugins (plugins) {
|
|
2599
|
-
let pluginArr =
|
|
3641
|
+
let pluginArr = helpers_castArray(plugins);
|
|
2600
3642
|
config.plugins || (config.plugins = []), config.plugins.unshift(...pluginArr);
|
|
2601
3643
|
},
|
|
2602
3644
|
appendPlugins (plugins) {
|
|
2603
|
-
let pluginArr =
|
|
3645
|
+
let pluginArr = helpers_castArray(plugins);
|
|
2604
3646
|
config.plugins || (config.plugins = []), config.plugins.push(...pluginArr);
|
|
2605
3647
|
},
|
|
2606
3648
|
removePlugin (pluginName) {
|
|
@@ -2612,7 +3654,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2612
3654
|
return {
|
|
2613
3655
|
rspack: rspack_rspack,
|
|
2614
3656
|
environment,
|
|
2615
|
-
env: process.env.NODE_ENV,
|
|
3657
|
+
env: process.env.NODE_ENV || '',
|
|
2616
3658
|
target,
|
|
2617
3659
|
isDev: 'development' === environment.config.mode,
|
|
2618
3660
|
isProd: 'production' === environment.config.mode,
|
|
@@ -2643,6 +3685,14 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2643
3685
|
}
|
|
2644
3686
|
return config.devServer && index_js_namespaceObject.logger.warn(`${picocolors_index_js_default().dim('[rsbuild:config]')} Find invalid Rspack config: "${picocolors_index_js_default().yellow('devServer')}". Note that Rspack's "devServer" config is not supported by Rsbuild. You can use Rsbuild's "dev" config to configure the Rsbuild dev server.`), rspackConfig;
|
|
2645
3687
|
}
|
|
3688
|
+
let allowedEnvironmentDevKeys = [
|
|
3689
|
+
'hmr',
|
|
3690
|
+
'liveReload',
|
|
3691
|
+
'writeToDisk',
|
|
3692
|
+
'assetPrefix',
|
|
3693
|
+
'progressBar',
|
|
3694
|
+
'lazyCompilation'
|
|
3695
|
+
];
|
|
2646
3696
|
async function modifyRsbuildConfig(context) {
|
|
2647
3697
|
var _context_config_plugins, _modified_plugins;
|
|
2648
3698
|
index_js_namespaceObject.logger.debug('modify Rsbuild config');
|
|
@@ -2676,7 +3726,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2676
3726
|
...createDefaultConfig(),
|
|
2677
3727
|
mode: (()=>{
|
|
2678
3728
|
if (config.mode) return config.mode;
|
|
2679
|
-
let nodeEnv = process.env.NODE_ENV;
|
|
3729
|
+
let nodeEnv = process.env.NODE_ENV || '';
|
|
2680
3730
|
return 'production' === nodeEnv || 'development' === nodeEnv ? nodeEnv : 'none';
|
|
2681
3731
|
})()
|
|
2682
3732
|
}, config), { watchFiles } = mergedConfig.dev;
|
|
@@ -2709,13 +3759,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2709
3759
|
applyEnvironmentDefaultConfig({
|
|
2710
3760
|
...mergeRsbuildConfig({
|
|
2711
3761
|
...rsbuildSharedConfig,
|
|
2712
|
-
dev: pick(dev,
|
|
2713
|
-
'writeToDisk',
|
|
2714
|
-
'hmr',
|
|
2715
|
-
'assetPrefix',
|
|
2716
|
-
'progressBar',
|
|
2717
|
-
'lazyCompilation'
|
|
2718
|
-
])
|
|
3762
|
+
dev: pick(dev, allowedEnvironmentDevKeys)
|
|
2719
3763
|
}, config)
|
|
2720
3764
|
})
|
|
2721
3765
|
]));
|
|
@@ -2727,24 +3771,18 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2727
3771
|
return {
|
|
2728
3772
|
[defaultEnvironmentName]: applyEnvironmentDefaultConfig({
|
|
2729
3773
|
...rsbuildSharedConfig,
|
|
2730
|
-
dev: pick(dev,
|
|
2731
|
-
'hmr',
|
|
2732
|
-
'assetPrefix',
|
|
2733
|
-
'progressBar',
|
|
2734
|
-
'lazyCompilation',
|
|
2735
|
-
'writeToDisk'
|
|
2736
|
-
])
|
|
3774
|
+
dev: pick(dev, allowedEnvironmentDevKeys)
|
|
2737
3775
|
})
|
|
2738
3776
|
};
|
|
2739
|
-
})(normalizedBaseConfig, context.rootPath, context.specifiedEnvironments),
|
|
3777
|
+
})(normalizedBaseConfig, context.rootPath, context.specifiedEnvironments), tsconfigPaths = new Set();
|
|
2740
3778
|
for (let [name, config] of Object.entries(mergedEnvironments)){
|
|
2741
3779
|
let environmentConfig = await modifyEnvironmentConfig(context, config, name), normalizedEnvironmentConfig = {
|
|
2742
3780
|
...environmentConfig,
|
|
2743
3781
|
dev: {
|
|
2744
|
-
...
|
|
2745
|
-
...
|
|
3782
|
+
...normalizedBaseConfig.dev,
|
|
3783
|
+
...environmentConfig.dev
|
|
2746
3784
|
},
|
|
2747
|
-
server
|
|
3785
|
+
server: normalizedBaseConfig.server
|
|
2748
3786
|
}, { tsconfigPath } = normalizedEnvironmentConfig.source;
|
|
2749
3787
|
if (tsconfigPath) {
|
|
2750
3788
|
let absoluteTsconfigPath = ensureAbsolutePath(context.rootPath, tsconfigPath);
|
|
@@ -2939,7 +3977,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2939
3977
|
}, types_namespaceObject = require("node:util/types");
|
|
2940
3978
|
var main = __webpack_require__("../../node_modules/.pnpm/dotenv-expand@12.0.2/node_modules/dotenv-expand/lib/main.js");
|
|
2941
3979
|
let DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
2942
|
-
function loadEnv({ cwd = process.cwd(), mode = process.env.NODE_ENV, prefixes = [
|
|
3980
|
+
function loadEnv({ cwd = process.cwd(), mode = process.env.NODE_ENV || '', prefixes = [
|
|
2943
3981
|
'PUBLIC_'
|
|
2944
3982
|
], processEnv = process.env } = {}) {
|
|
2945
3983
|
if ('local' === mode) throw Error(`${picocolors_index_js_default().dim('[rsbuild:loadEnv]')} ${picocolors_index_js_default().yellow('local')} cannot be used as a value for env mode, because ${picocolors_index_js_default().yellow('.env.local')} represents a temporary local file. Please use another value.`);
|
|
@@ -2980,11 +4018,11 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2980
4018
|
rawPublicVars
|
|
2981
4019
|
};
|
|
2982
4020
|
}
|
|
2983
|
-
let external_node_util_namespaceObject = require("node:util"),
|
|
4021
|
+
let external_node_util_namespaceObject = require("node:util"), chainStaticAssetRule = ({ emit, rule, maxSize, filename, assetType })=>{
|
|
2984
4022
|
let generatorOptions = {
|
|
2985
4023
|
filename
|
|
2986
4024
|
};
|
|
2987
|
-
|
|
4025
|
+
emit || (generatorOptions.emit = !1), rule.oneOf(`${assetType}-asset-url`).type('asset/resource').resourceQuery(/^\?(__inline=false|url)$/).set('generator', generatorOptions), rule.oneOf(`${assetType}-asset-inline`).type('asset/inline').resourceQuery(INLINE_QUERY_REGEX), rule.oneOf(`${assetType}-asset-raw`).type('asset/source').resourceQuery(RAW_QUERY_REGEX), rule.oneOf(`${assetType}-asset`).type('asset').parser({
|
|
2988
4026
|
dataUrlCondition: {
|
|
2989
4027
|
maxSize
|
|
2990
4028
|
}
|
|
@@ -3056,7 +4094,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3056
4094
|
}, parseMinifyOptions = (config)=>{
|
|
3057
4095
|
let isProd = 'production' === config.mode, { minify } = config.output;
|
|
3058
4096
|
if ('boolean' == typeof minify) {
|
|
3059
|
-
let shouldMinify =
|
|
4097
|
+
let shouldMinify = minify && isProd;
|
|
3060
4098
|
return {
|
|
3061
4099
|
minifyJs: shouldMinify,
|
|
3062
4100
|
minifyCss: shouldMinify
|
|
@@ -3108,12 +4146,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3108
4146
|
config: config.tools.postcss,
|
|
3109
4147
|
ctx: {
|
|
3110
4148
|
addPlugins (plugins) {
|
|
3111
|
-
extraPlugins.push(...
|
|
4149
|
+
extraPlugins.push(...helpers_castArray(plugins));
|
|
3112
4150
|
}
|
|
3113
4151
|
}
|
|
3114
4152
|
});
|
|
3115
4153
|
finalOptions.postcssOptions ||= {};
|
|
3116
|
-
let updatePostcssOptions = (options)=>(options.plugins ||= [], extraPlugins.length && options.plugins.push(...extraPlugins), options.plugins = options.plugins.map((plugin)=>((plugin)=>'function' == typeof plugin &&
|
|
4154
|
+
let updatePostcssOptions = (options)=>(options.plugins ||= [], extraPlugins.length && options.plugins.push(...extraPlugins), options.plugins = options.plugins.map((plugin)=>((plugin)=>'function' == typeof plugin && plugin.postcss)(plugin) ? plugin() : plugin), options.config = !1, options), { postcssOptions } = finalOptions;
|
|
3117
4155
|
if ('function' == typeof postcssOptions) {
|
|
3118
4156
|
let postcssOptionsWrapper = (loaderContext)=>{
|
|
3119
4157
|
let options = postcssOptions(loaderContext);
|
|
@@ -3160,16 +4198,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3160
4198
|
}, getAssets = async ()=>{
|
|
3161
4199
|
let distPath = stats.compilation.outputOptions.path;
|
|
3162
4200
|
if (!distPath) return [];
|
|
3163
|
-
let filteredAssets = (stats.
|
|
3164
|
-
all: !1,
|
|
3165
|
-
assets: !0,
|
|
3166
|
-
cachedAssets: !0,
|
|
3167
|
-
groupAssetsByInfo: !1,
|
|
3168
|
-
groupAssetsByPath: !1,
|
|
3169
|
-
groupAssetsByChunk: !1,
|
|
3170
|
-
groupAssetsByExtension: !1,
|
|
3171
|
-
groupAssetsByEmitStatus: !1
|
|
3172
|
-
}).assets || []).filter((asset)=>{
|
|
4201
|
+
let filteredAssets = getAssetsFromStats(stats).filter((asset)=>{
|
|
3173
4202
|
let assetInfo = {
|
|
3174
4203
|
name: asset.name,
|
|
3175
4204
|
size: asset.size
|
|
@@ -3279,22 +4308,26 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3279
4308
|
}));
|
|
3280
4309
|
class RsbuildHtmlPlugin {
|
|
3281
4310
|
apply(compiler) {
|
|
3282
|
-
let emitFavicon = async (compilation, favicon)=>{
|
|
4311
|
+
let emitFavicon = async ({ compilation, favicon, faviconDistPath })=>{
|
|
3283
4312
|
let buffer, name = external_node_path_default().basename(favicon);
|
|
3284
4313
|
if (compilation.assets[name]) return name;
|
|
3285
4314
|
if (!compilation.inputFileSystem) return addCompilationError(compilation, `${picocolors_index_js_default().dim('[rsbuild:html]')} Failed to read the favicon file as ${picocolors_index_js_default().yellow('compilation.inputFileSystem')} is not available.`), null;
|
|
3286
|
-
let
|
|
4315
|
+
let inputFilename = external_node_path_default().isAbsolute(favicon) ? favicon : external_node_path_default().join(compilation.compiler.context, favicon);
|
|
3287
4316
|
try {
|
|
3288
|
-
if (!(buffer = await (0, external_node_util_namespaceObject.promisify)(compilation.inputFileSystem.readFile)(
|
|
4317
|
+
if (!(buffer = await (0, external_node_util_namespaceObject.promisify)(compilation.inputFileSystem.readFile)(inputFilename))) throw Error('Buffer is undefined');
|
|
3289
4318
|
} catch (error) {
|
|
3290
|
-
return index_js_namespaceObject.logger.debug(`read favicon error: ${error}`), addCompilationError(compilation, `${picocolors_index_js_default().dim('[rsbuild:html]')} Failed to read the favicon file at ${picocolors_index_js_default().yellow(
|
|
4319
|
+
return index_js_namespaceObject.logger.debug(`read favicon error: ${error}`), addCompilationError(compilation, `${picocolors_index_js_default().dim('[rsbuild:html]')} Failed to read the favicon file at ${picocolors_index_js_default().yellow(inputFilename)}.`), null;
|
|
3291
4320
|
}
|
|
3292
|
-
let source = new compiler.webpack.sources.RawSource(buffer, !1);
|
|
3293
|
-
return compilation.emitAsset(
|
|
3294
|
-
}, addFavicon = async (headTags, favicon, compilation, publicPath)=>{
|
|
4321
|
+
let source = new compiler.webpack.sources.RawSource(buffer, !1), outputFilename = external_node_path_default().posix.join(faviconDistPath, name);
|
|
4322
|
+
return compilation.emitAsset(outputFilename, source), outputFilename;
|
|
4323
|
+
}, addFavicon = async ({ headTags, favicon, faviconDistPath, compilation, publicPath })=>{
|
|
3295
4324
|
let href = favicon;
|
|
3296
4325
|
if (!isURL(favicon)) {
|
|
3297
|
-
let name = await emitFavicon(
|
|
4326
|
+
let name = await emitFavicon({
|
|
4327
|
+
compilation,
|
|
4328
|
+
favicon,
|
|
4329
|
+
faviconDistPath
|
|
4330
|
+
});
|
|
3298
4331
|
if (null === name) return;
|
|
3299
4332
|
href = ensureAssetPrefix(name, publicPath);
|
|
3300
4333
|
}
|
|
@@ -3318,7 +4351,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3318
4351
|
hooks.alterAssetTagGroups.tapPromise(this.name, async (data)=>{
|
|
3319
4352
|
let html, extraData = getExtraDataByPlugin(data.plugin);
|
|
3320
4353
|
if (!extraData) return data;
|
|
3321
|
-
let { headTags, bodyTags } = data, { favicon, context, tagConfig, entryName, environment, templateContent } = extraData;
|
|
4354
|
+
let { headTags, bodyTags } = data, { favicon, faviconDistPath, context, tagConfig, entryName, environment, templateContent } = extraData;
|
|
3322
4355
|
if (!((html = templateContent) && /<title/i.test(html) && /<\/title/i.test(html))) {
|
|
3323
4356
|
var _data_plugin_options;
|
|
3324
4357
|
((headTags, title = '')=>{
|
|
@@ -3331,7 +4364,13 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3331
4364
|
});
|
|
3332
4365
|
})(headTags, null == (_data_plugin_options = data.plugin.options) ? void 0 : _data_plugin_options.title);
|
|
3333
4366
|
}
|
|
3334
|
-
favicon && await addFavicon(
|
|
4367
|
+
favicon && await addFavicon({
|
|
4368
|
+
headTags,
|
|
4369
|
+
favicon,
|
|
4370
|
+
faviconDistPath,
|
|
4371
|
+
compilation,
|
|
4372
|
+
publicPath: data.publicPath
|
|
4373
|
+
});
|
|
3335
4374
|
let tags = {
|
|
3336
4375
|
headTags: headTags.map(formatBasicTag),
|
|
3337
4376
|
bodyTags: bodyTags.map(formatBasicTag)
|
|
@@ -3846,10 +4885,10 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3846
4885
|
}
|
|
3847
4886
|
let message = '', maxNameLength = Math.max(...routes.map((r)=>r.entryName.length));
|
|
3848
4887
|
return urls.forEach(({ label, url }, index)=>{
|
|
3849
|
-
for (let r of (index > 0 && (message += '\n'), message += `
|
|
4888
|
+
for (let r of (index > 0 && (message += '\n'), message += ` \u{279C} ${label}\n`, routes))message += ` ${picocolors_index_js_default().dim('-')} ${picocolors_index_js_default().dim(r.entryName.padEnd(maxNameLength + 4))}${picocolors_index_js_default().cyan(normalizeUrl(`${url}${r.pathname}`))}\n`;
|
|
3850
4889
|
}), message;
|
|
3851
4890
|
}(urls, routes);
|
|
3852
|
-
return !
|
|
4891
|
+
return !trailingLineBreak && message.endsWith('\n') && (message = message.slice(0, -1)), index_js_namespaceObject.logger.log(message), message;
|
|
3853
4892
|
}
|
|
3854
4893
|
let getPort = async ({ host, port, strictPort, tryLimits = 20 })=>{
|
|
3855
4894
|
'string' == typeof port && (port = Number.parseInt(port, 10)), strictPort && (tryLimits = 1);
|
|
@@ -3950,7 +4989,9 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3950
4989
|
listened = !0;
|
|
3951
4990
|
}), ()=>new Promise((resolve, reject)=>{
|
|
3952
4991
|
for (let socket of pendingSockets)socket.destroy();
|
|
3953
|
-
listened ? server.close((err)=>
|
|
4992
|
+
listened ? server.close((err)=>{
|
|
4993
|
+
err ? reject(err) : resolve();
|
|
4994
|
+
}) : resolve();
|
|
3954
4995
|
});
|
|
3955
4996
|
}
|
|
3956
4997
|
let supportedChromiumBrowsers = [
|
|
@@ -4015,7 +5056,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4015
5056
|
} : Array.isArray(open) ? {
|
|
4016
5057
|
targets: open
|
|
4017
5058
|
} : {
|
|
4018
|
-
targets: open.target ?
|
|
5059
|
+
targets: open.target ? helpers_castArray(open.target) : [],
|
|
4019
5060
|
before: open.before
|
|
4020
5061
|
};
|
|
4021
5062
|
})(config);
|
|
@@ -4125,8 +5166,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4125
5166
|
return chunks;
|
|
4126
5167
|
}(compilation, options.type), sortedFilteredFiles = ((files, include, exclude)=>{
|
|
4127
5168
|
let includeRegExp = [], excludeRegExp = [], includeFn = [], excludeFn = [];
|
|
4128
|
-
if (include) for (let item of
|
|
4129
|
-
if (exclude) for (let item of
|
|
5169
|
+
if (include) for (let item of helpers_castArray(include))'string' == typeof item ? includeRegExp.push(new RegExp(item)) : isFunction(item) ? includeFn.push(item) : includeRegExp.push(item);
|
|
5170
|
+
if (exclude) for (let item of helpers_castArray(exclude))'string' == typeof item ? excludeRegExp.push(new RegExp(item)) : isFunction(item) ? excludeFn.push(item) : excludeRegExp.push(item);
|
|
4130
5171
|
return files.filter((file)=>{
|
|
4131
5172
|
let includeMatched = !1;
|
|
4132
5173
|
for (let item of includeRegExp)item.test(file) && (includeMatched = !0);
|
|
@@ -4409,16 +5450,23 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4409
5450
|
port: serverConfig.port
|
|
4410
5451
|
};
|
|
4411
5452
|
}
|
|
4412
|
-
let getCompilationMiddleware = async (compiler, options)=>{
|
|
4413
|
-
let { default: rsbuildDevMiddleware } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/rsbuild-dev-middleware/index.js")), {
|
|
5453
|
+
let compilationMiddleware_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__), getCompilationMiddleware = async (compiler, options)=>{
|
|
5454
|
+
let { default: rsbuildDevMiddleware } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/rsbuild-dev-middleware/index.js")), { callbacks, devConfig, serverConfig } = options, resolvedClientConfig = await getResolvedClientConfig(devConfig.client, serverConfig);
|
|
4414
5455
|
return applyToCompiler(compiler, (compiler, index)=>{
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
5456
|
+
let environment = Object.values(options.environments).find((env)=>env.index === index);
|
|
5457
|
+
if (!environment) return;
|
|
5458
|
+
let token = environment.webSocketToken;
|
|
5459
|
+
token && (!function({ config, compiler, devConfig, resolvedClientConfig, token }) {
|
|
5460
|
+
if (!((compiler)=>{
|
|
4419
5461
|
let { target } = compiler.options;
|
|
4420
5462
|
return !!target && (Array.isArray(target) ? target.includes('web') : 'web' === target);
|
|
4421
|
-
})(compiler))
|
|
5463
|
+
})(compiler)) return;
|
|
5464
|
+
let clientPaths = function(devConfig) {
|
|
5465
|
+
var _devConfig_client;
|
|
5466
|
+
let clientPaths = [];
|
|
5467
|
+
return (devConfig.hmr || devConfig.liveReload) && (hmrClientPath || (hmrClientPath = compilationMiddleware_require.resolve('@rsbuild/core/client/hmr')), clientPaths.push(hmrClientPath), (null == (_devConfig_client = devConfig.client) ? void 0 : _devConfig_client.overlay) && (overlayClientPath || (overlayClientPath = compilationMiddleware_require.resolve('@rsbuild/core/client/overlay')), clientPaths.push(overlayClientPath))), clientPaths;
|
|
5468
|
+
}(config.dev);
|
|
5469
|
+
if (clientPaths.length) for (let clientPath of (new compiler.webpack.DefinePlugin({
|
|
4422
5470
|
RSBUILD_WEB_SOCKET_TOKEN: JSON.stringify(token),
|
|
4423
5471
|
RSBUILD_CLIENT_CONFIG: JSON.stringify(devConfig.client),
|
|
4424
5472
|
RSBUILD_RESOLVED_CLIENT_CONFIG: JSON.stringify(resolvedClientConfig),
|
|
@@ -4428,10 +5476,10 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4428
5476
|
}).apply(compiler);
|
|
4429
5477
|
}({
|
|
4430
5478
|
compiler,
|
|
4431
|
-
clientPaths,
|
|
4432
5479
|
devConfig,
|
|
4433
5480
|
resolvedClientConfig,
|
|
4434
|
-
token
|
|
5481
|
+
token,
|
|
5482
|
+
config: environment.config
|
|
4435
5483
|
}), (({ compiler, token, callbacks: { onDone, onInvalid } })=>{
|
|
4436
5484
|
if (((compiler)=>{
|
|
4437
5485
|
let { target } = compiler.options;
|
|
@@ -4529,9 +5577,6 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4529
5577
|
socket && this.send(socket, messageStr);
|
|
4530
5578
|
} else for (let socket of this.sockets.values())this.send(socket, messageStr);
|
|
4531
5579
|
}
|
|
4532
|
-
singleWrite(socket, message) {
|
|
4533
|
-
this.send(socket, JSON.stringify(message));
|
|
4534
|
-
}
|
|
4535
5580
|
async close() {
|
|
4536
5581
|
for (let socket of (this.clearHeartbeatTimer(), this.wsServer.removeAllListeners(), this.wsServer.clients))socket.terminate();
|
|
4537
5582
|
for (let socket of this.sockets.values())socket.close();
|
|
@@ -4546,8 +5591,6 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4546
5591
|
socket.isAlive = !0;
|
|
4547
5592
|
}), this.sockets.set(token, socket), socket.on('close', ()=>{
|
|
4548
5593
|
this.sockets.delete(token);
|
|
4549
|
-
}), (this.options.hmr || this.options.liveReload) && this.singleWrite(socket, {
|
|
4550
|
-
type: 'hot'
|
|
4551
5594
|
}), this.stats && this.sendStats({
|
|
4552
5595
|
force: !0,
|
|
4553
5596
|
token
|
|
@@ -4587,13 +5630,13 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4587
5630
|
let initialChunks = this.initialChunks[token], shouldReload = !!statsJson.entrypoints && !!initialChunks && (a = initialChunks, b = newInitialChunks, !(a.size === b.size && [
|
|
4588
5631
|
...a
|
|
4589
5632
|
].every((value)=>b.has(value))));
|
|
4590
|
-
if (this.initialChunks[token] = newInitialChunks, shouldReload) return this.sockWrite({
|
|
5633
|
+
if (this.initialChunks[token] = newInitialChunks, shouldReload) return void this.sockWrite({
|
|
4591
5634
|
type: 'static-changed'
|
|
4592
5635
|
}, token);
|
|
4593
|
-
if (!force && statsJson && !statsJson.errorsCount && statsJson.assets && statsJson.assets.every((asset)=>!asset.emitted)) return this.sockWrite({
|
|
5636
|
+
if (!force && statsJson && !statsJson.errorsCount && statsJson.assets && statsJson.assets.every((asset)=>!asset.emitted)) return void this.sockWrite({
|
|
4594
5637
|
type: 'ok'
|
|
4595
5638
|
}, token);
|
|
4596
|
-
if (this.sockWrite({
|
|
5639
|
+
if (statsJson.hash && this.sockWrite({
|
|
4597
5640
|
type: 'hash',
|
|
4598
5641
|
data: statsJson.hash
|
|
4599
5642
|
}, token), statsJson.errorsCount) {
|
|
@@ -4601,7 +5644,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4601
5644
|
errors: getAllStatsErrors(statsJson),
|
|
4602
5645
|
warnings: []
|
|
4603
5646
|
});
|
|
4604
|
-
|
|
5647
|
+
this.sockWrite({
|
|
4605
5648
|
type: 'errors',
|
|
4606
5649
|
data: {
|
|
4607
5650
|
text: formattedErrors,
|
|
@@ -4761,20 +5804,22 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4761
5804
|
}(formattedErrors, root)
|
|
4762
5805
|
}
|
|
4763
5806
|
}, token);
|
|
5807
|
+
return;
|
|
4764
5808
|
}
|
|
4765
5809
|
if (statsJson.warningsCount) {
|
|
4766
5810
|
let { warnings: formattedWarnings } = formatStatsMessages({
|
|
4767
5811
|
warnings: getAllStatsWarnings(statsJson),
|
|
4768
5812
|
errors: []
|
|
4769
5813
|
});
|
|
4770
|
-
|
|
5814
|
+
this.sockWrite({
|
|
4771
5815
|
type: 'warnings',
|
|
4772
5816
|
data: {
|
|
4773
5817
|
text: formattedWarnings
|
|
4774
5818
|
}
|
|
4775
5819
|
}, token);
|
|
5820
|
+
return;
|
|
4776
5821
|
}
|
|
4777
|
-
|
|
5822
|
+
this.sockWrite({
|
|
4778
5823
|
type: 'ok'
|
|
4779
5824
|
}, token);
|
|
4780
5825
|
}
|
|
@@ -4803,7 +5848,6 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4803
5848
|
writable: !0
|
|
4804
5849
|
}) : obj[key] = value, obj;
|
|
4805
5850
|
}
|
|
4806
|
-
let compilationManager_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
|
|
4807
5851
|
class CompilationManager {
|
|
4808
5852
|
async init() {
|
|
4809
5853
|
await this.setupCompilationMiddleware(), await this.socketServer.prepare();
|
|
@@ -4825,25 +5869,17 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4825
5869
|
});
|
|
4826
5870
|
}
|
|
4827
5871
|
async setupCompilationMiddleware() {
|
|
4828
|
-
let { devConfig, serverConfig, publicPaths, environments } = this,
|
|
4829
|
-
var _devConfig_client;
|
|
4830
|
-
let clientPaths = [];
|
|
4831
|
-
return (devConfig.hmr || devConfig.liveReload) && (clientPaths.push(compilationManager_require.resolve('@rsbuild/core/client/hmr')), (null == (_devConfig_client = devConfig.client) ? void 0 : _devConfig_client.overlay) && clientPaths.push(`${compilationManager_require.resolve('@rsbuild/core/client/overlay')}`)), clientPaths;
|
|
4832
|
-
}(devConfig), middleware = await getCompilationMiddleware(this.compiler, {
|
|
5872
|
+
let { devConfig, serverConfig, publicPaths, environments } = this, middleware = await getCompilationMiddleware(this.compiler, {
|
|
4833
5873
|
callbacks: {
|
|
4834
5874
|
onInvalid: (token, fileName)=>{
|
|
4835
5875
|
if ('string' == typeof fileName && fileName.endsWith('.html')) return void this.socketServer.sockWrite({
|
|
4836
5876
|
type: 'static-changed'
|
|
4837
5877
|
}, token);
|
|
4838
|
-
this.socketServer.sockWrite({
|
|
4839
|
-
type: 'invalid'
|
|
4840
|
-
}, token);
|
|
4841
5878
|
},
|
|
4842
5879
|
onDone: (token, stats)=>{
|
|
4843
5880
|
this.socketServer.updateStats(stats, token);
|
|
4844
5881
|
}
|
|
4845
5882
|
},
|
|
4846
|
-
clientPaths,
|
|
4847
5883
|
devConfig,
|
|
4848
5884
|
serverConfig,
|
|
4849
5885
|
environments
|
|
@@ -4873,10 +5909,10 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4873
5909
|
}
|
|
4874
5910
|
let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xml/i, gzipMiddleware = ({ filter, level = external_node_zlib_default().constants.Z_BEST_SPEED } = {})=>(req, res, next)=>{
|
|
4875
5911
|
let gzip, writeHeadStatus;
|
|
4876
|
-
if (filter && !
|
|
5912
|
+
if (filter && !filter(req, res)) return void next();
|
|
4877
5913
|
let accept = req.headers['accept-encoding'], encoding = 'string' == typeof accept && ENCODING_REGEX.test(accept);
|
|
4878
5914
|
if ('HEAD' === req.method || !encoding) return void next();
|
|
4879
|
-
let started = !1,
|
|
5915
|
+
let started = !1, on = res.on.bind(res), end = res.end.bind(res), write = res.write.bind(res), writeHead = res.writeHead.bind(res), listeners = [], start = ()=>{
|
|
4880
5916
|
if (!started) {
|
|
4881
5917
|
if (started = !0, ((res)=>{
|
|
4882
5918
|
if (res.getHeader('Content-Encoding')) return !1;
|
|
@@ -4887,22 +5923,77 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4887
5923
|
})(res)) for (let listener of (res.setHeader('Content-Encoding', 'gzip'), res.removeHeader('Content-Length'), (gzip = external_node_zlib_default().createGzip({
|
|
4888
5924
|
level
|
|
4889
5925
|
})).on('data', (chunk)=>{
|
|
4890
|
-
|
|
4891
|
-
}), on
|
|
4892
|
-
end
|
|
5926
|
+
write(chunk) || gzip.pause();
|
|
5927
|
+
}), on('drain', ()=>gzip.resume()), gzip.on('end', ()=>{
|
|
5928
|
+
end();
|
|
4893
5929
|
}), listeners))gzip.on.apply(gzip, listener);
|
|
4894
5930
|
else for (let listener of listeners)on.apply(res, listener);
|
|
4895
|
-
writeHead
|
|
5931
|
+
writeHead(writeHeadStatus ?? res.statusCode);
|
|
4896
5932
|
}
|
|
4897
5933
|
};
|
|
4898
5934
|
res.writeHead = (status, reason, headers)=>{
|
|
4899
5935
|
if (reason) for (let [key, value] of Object.entries(headers || reason))res.setHeader(key, value);
|
|
4900
5936
|
return writeHeadStatus = status, res;
|
|
4901
|
-
}, res.write = (...args)=>(start(), gzip ? gzip.write(...args) : write.apply(res, args)), res.end = (...args)=>(start(), gzip ? gzip.end(...args) : end.apply(res, args)), res.on = (type, listener)=>(started ? gzip && 'drain' === type ? gzip.on(type, listener) : on
|
|
5937
|
+
}, res.write = (...args)=>(start(), gzip ? gzip.write(...args) : write.apply(res, args)), res.end = (...args)=>(start(), gzip ? gzip.end(...args) : end.apply(res, args)), res.on = (type, listener)=>(started ? gzip && 'drain' === type ? gzip.on(type, listener) : on(type, listener) : listeners.push([
|
|
4902
5938
|
type,
|
|
4903
5939
|
listener
|
|
4904
5940
|
]), res), next();
|
|
4905
|
-
}
|
|
5941
|
+
};
|
|
5942
|
+
function historyApiFallbackMiddleware(options = {}) {
|
|
5943
|
+
return (req, _res, next)=>{
|
|
5944
|
+
let rewriteTarget, { headers } = req;
|
|
5945
|
+
if (!req.url) return void next();
|
|
5946
|
+
if ('GET' !== req.method && 'HEAD' !== req.method) {
|
|
5947
|
+
index_js_namespaceObject.logger.debug('Not rewriting', req.method, req.url, 'because the method is not GET or HEAD.'), next();
|
|
5948
|
+
return;
|
|
5949
|
+
}
|
|
5950
|
+
if (!headers || 'string' != typeof headers.accept) {
|
|
5951
|
+
index_js_namespaceObject.logger.debug('Not rewriting', req.method, req.url, 'because the client did not send an HTTP accept header.'), next();
|
|
5952
|
+
return;
|
|
5953
|
+
}
|
|
5954
|
+
if (0 === headers.accept.indexOf('application/json')) {
|
|
5955
|
+
index_js_namespaceObject.logger.debug('Not rewriting', req.method, req.url, 'because the client prefers JSON.'), next();
|
|
5956
|
+
return;
|
|
5957
|
+
}
|
|
5958
|
+
let rewrites = options.rewrites || [], htmlAcceptHeaders = options.htmlAcceptHeaders || [
|
|
5959
|
+
'text/html',
|
|
5960
|
+
'*/*'
|
|
5961
|
+
], { accept } = headers;
|
|
5962
|
+
if (!htmlAcceptHeaders.some((item)=>accept.includes(item))) {
|
|
5963
|
+
index_js_namespaceObject.logger.debug('Not rewriting', req.method, req.url, 'because the client does not accept HTML.'), next();
|
|
5964
|
+
return;
|
|
5965
|
+
}
|
|
5966
|
+
let parsedUrl = function(req) {
|
|
5967
|
+
let proto = req.headers['x-forwarded-proto'] || 'http', host = req.headers['x-forwarded-host'] || req.headers.host || 'localhost';
|
|
5968
|
+
try {
|
|
5969
|
+
return new external_node_url_namespaceObject.URL(req.url || '/', `${proto}://${host}`);
|
|
5970
|
+
} catch {
|
|
5971
|
+
return null;
|
|
5972
|
+
}
|
|
5973
|
+
}(req);
|
|
5974
|
+
if (null === parsedUrl) return void next();
|
|
5975
|
+
for (let rewrite of rewrites){
|
|
5976
|
+
var _parsedUrl_pathname;
|
|
5977
|
+
let match = null == (_parsedUrl_pathname = parsedUrl.pathname) ? void 0 : _parsedUrl_pathname.match(rewrite.from);
|
|
5978
|
+
if (!match) continue;
|
|
5979
|
+
let rule = rewrite.to;
|
|
5980
|
+
'/' !== (rewriteTarget = 'string' == typeof rule ? rule : rule({
|
|
5981
|
+
parsedUrl,
|
|
5982
|
+
match,
|
|
5983
|
+
request: req
|
|
5984
|
+
})).charAt(0) && index_js_namespaceObject.logger.debug('We recommend using an absolute path for the rewrite target.', 'Received a non-absolute rewrite target', rewriteTarget, 'for URL', req.url), index_js_namespaceObject.logger.debug('Rewriting', req.method, req.url, 'to', rewriteTarget), req.url = rewriteTarget, next();
|
|
5985
|
+
return;
|
|
5986
|
+
}
|
|
5987
|
+
let { pathname } = parsedUrl;
|
|
5988
|
+
if (pathname && pathname.lastIndexOf('.') > pathname.lastIndexOf('/') && !0 !== options.disableDotRule) {
|
|
5989
|
+
index_js_namespaceObject.logger.debug('Not rewriting', req.method, req.url, 'because the path includes a dot (.) character.'), next();
|
|
5990
|
+
return;
|
|
5991
|
+
}
|
|
5992
|
+
let index = options.index || '/index.html';
|
|
5993
|
+
index_js_namespaceObject.logger.debug('Rewriting', req.method, req.url, 'to', index), req.url = index, next();
|
|
5994
|
+
};
|
|
5995
|
+
}
|
|
5996
|
+
let faviconFallbackMiddleware = (req, res, next)=>{
|
|
4906
5997
|
'/favicon.ico' === req.url ? (res.statusCode = 204, res.end()) : next();
|
|
4907
5998
|
}, getRequestLoggerMiddleware = async ()=>{
|
|
4908
5999
|
let { default: onFinished } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/on-finished/index.js"));
|
|
@@ -4932,7 +6023,10 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4932
6023
|
}, postfixRE = /[?#].*$/, getUrlPathname = (url)=>url.replace(postfixRE, ''), getBaseMiddleware = ({ base })=>async (req, res, next)=>{
|
|
4933
6024
|
var _req_headers_accept;
|
|
4934
6025
|
let url = req.url, pathname = getUrlPathname(url);
|
|
4935
|
-
if (pathname.startsWith(base))
|
|
6026
|
+
if (pathname.startsWith(base)) {
|
|
6027
|
+
req.url = stripBase(url, base), next();
|
|
6028
|
+
return;
|
|
6029
|
+
}
|
|
4936
6030
|
let redirectPath = addTrailingSlash(url) !== base ? joinUrlSegments(base, url) : base;
|
|
4937
6031
|
if ('/' === pathname || '/index.html' === pathname) {
|
|
4938
6032
|
res.writeHead(302, {
|
|
@@ -5017,10 +6111,10 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5017
6111
|
'/__open-in-editor',
|
|
5018
6112
|
launchEditorMiddleware()
|
|
5019
6113
|
]), middlewares.push((({ environments })=>async (req, res, next)=>{
|
|
5020
|
-
if ('/rsbuild-dev-server'
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
6114
|
+
if ('/rsbuild-dev-server' !== getUrlPathname(req.url)) return void next();
|
|
6115
|
+
res.writeHead(200, {
|
|
6116
|
+
'Content-Type': 'text/html; charset=utf-8'
|
|
6117
|
+
}), res.write(`<!DOCTYPE html>
|
|
5024
6118
|
<html>
|
|
5025
6119
|
<head>
|
|
5026
6120
|
<meta charset="utf-8"/>
|
|
@@ -5063,35 +6157,35 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5063
6157
|
<h1>Assets Report</h1>
|
|
5064
6158
|
</body>
|
|
5065
6159
|
</html>`);
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
res.write(null == list ? void 0 : list.join('')), res.write('</ul>');
|
|
5073
|
-
}
|
|
5074
|
-
res.end('</body></html>');
|
|
5075
|
-
} catch (err) {
|
|
5076
|
-
index_js_namespaceObject.logger.error(err), res.writeHead(500), res.end('Failed to list the files');
|
|
6160
|
+
try {
|
|
6161
|
+
for(let key in environments){
|
|
6162
|
+
res.write(`<h2>Environment: ${key}</h2>`);
|
|
6163
|
+
let list = [], environment = environments[key], stats = await environment.getStats(), assets = getAssetsFromStats(stats);
|
|
6164
|
+
for (let asset of (res.write('<ul>'), assets))list.push(`<li><a target="_blank" href="${null == asset ? void 0 : asset.name}">${null == asset ? void 0 : asset.name}</a></li>`);
|
|
6165
|
+
res.write(null == list ? void 0 : list.join('')), res.write('</ul>');
|
|
5077
6166
|
}
|
|
5078
|
-
|
|
6167
|
+
res.end('</body></html>');
|
|
6168
|
+
} catch (err) {
|
|
6169
|
+
index_js_namespaceObject.logger.error(err), res.writeHead(500), res.end('Failed to list the files');
|
|
6170
|
+
}
|
|
5079
6171
|
})({
|
|
5080
6172
|
environments: devServerAPI.environments
|
|
5081
6173
|
})), compilationManager && (middlewares.push(compilationManager.middleware), upgradeEvents.push(compilationManager.socketServer.upgrade), middlewares.push((req, res, next)=>{
|
|
5082
6174
|
var _req_url;
|
|
5083
6175
|
(null == (_req_url = req.url) ? void 0 : _req_url.endsWith('.hot-update.json')) && 'OPTIONS' !== req.method ? (res.statusCode = 404, res.end()) : next();
|
|
5084
6176
|
})), compilationManager && middlewares.push((({ distPath, compilationManager })=>async (req, res, next)=>{
|
|
5085
|
-
if (!maybeHTMLRequest(req)) return next();
|
|
5086
|
-
let pathname = getUrlPathname(req.url), rewrite = (newUrl)=>
|
|
6177
|
+
if (!maybeHTMLRequest(req)) return void next();
|
|
6178
|
+
let pathname = getUrlPathname(req.url), rewrite = (newUrl)=>{
|
|
6179
|
+
req.url = newUrl, compilationManager.middleware(req, res, (...args)=>{
|
|
5087
6180
|
next(...args);
|
|
5088
|
-
})
|
|
6181
|
+
});
|
|
6182
|
+
};
|
|
5089
6183
|
if (pathname.endsWith('/')) {
|
|
5090
6184
|
let newUrl = `${pathname}index.html`, filePath = external_node_path_default().join(distPath, newUrl);
|
|
5091
|
-
if (await middlewares_isFileExists(filePath, compilationManager.outputFileSystem)) return rewrite(newUrl);
|
|
6185
|
+
if (await middlewares_isFileExists(filePath, compilationManager.outputFileSystem)) return void rewrite(newUrl);
|
|
5092
6186
|
} else if (!external_node_path_default().extname(pathname)) {
|
|
5093
6187
|
let newUrl = `${pathname}.html`, filePath = external_node_path_default().join(distPath, newUrl);
|
|
5094
|
-
if (await middlewares_isFileExists(filePath, compilationManager.outputFileSystem)) return rewrite(newUrl);
|
|
6188
|
+
if (await middlewares_isFileExists(filePath, compilationManager.outputFileSystem)) return void rewrite(newUrl);
|
|
5095
6189
|
}
|
|
5096
6190
|
next();
|
|
5097
6191
|
})({
|
|
@@ -5105,23 +6199,22 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5105
6199
|
middlewares.push(assetMiddleware);
|
|
5106
6200
|
}
|
|
5107
6201
|
for (let callback of postCallbacks)callback();
|
|
5108
|
-
|
|
5109
|
-
if (!maybeHTMLRequest(req) || '/favicon.ico' === req.url || 'index' !== htmlFallback) return next();
|
|
6202
|
+
return compilationManager && middlewares.push((({ htmlFallback, distPath, compilationManager })=>async (req, res, next)=>{
|
|
6203
|
+
if (!maybeHTMLRequest(req) || '/favicon.ico' === req.url || 'index' !== htmlFallback) return void next();
|
|
5110
6204
|
let filePath = external_node_path_default().join(distPath, 'index.html');
|
|
5111
6205
|
if (await middlewares_isFileExists(filePath, compilationManager.outputFileSystem)) {
|
|
5112
6206
|
let newUrl = '/index.html';
|
|
5113
|
-
|
|
6207
|
+
'verbose' === index_js_namespaceObject.logger.level && index_js_namespaceObject.logger.debug(`${req.method} ${picocolors_index_js_default().gray(`${req.url} ${picocolors_index_js_default().yellow('fallback')} to ${newUrl}`)}`), req.url = newUrl, compilationManager.middleware(req, res, (...args)=>{
|
|
6208
|
+
next(...args);
|
|
6209
|
+
});
|
|
6210
|
+
return;
|
|
5114
6211
|
}
|
|
5115
6212
|
next();
|
|
5116
6213
|
})({
|
|
5117
6214
|
compilationManager,
|
|
5118
6215
|
distPath: context.distPath,
|
|
5119
6216
|
htmlFallback: server.htmlFallback
|
|
5120
|
-
})), server.historyApiFallback) {
|
|
5121
|
-
let { default: connectHistoryApiFallback } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/connect-history-api-fallback/index.js")), historyApiFallbackMiddleware = connectHistoryApiFallback(!0 === server.historyApiFallback ? {} : server.historyApiFallback);
|
|
5122
|
-
middlewares.push(historyApiFallbackMiddleware), (null == compilationManager ? void 0 : compilationManager.middleware) && middlewares.push(compilationManager.middleware);
|
|
5123
|
-
}
|
|
5124
|
-
return middlewares.push(faviconFallbackMiddleware), {
|
|
6217
|
+
})), server.historyApiFallback && (middlewares.push(historyApiFallbackMiddleware(!0 === server.historyApiFallback ? {} : server.historyApiFallback)), (null == compilationManager ? void 0 : compilationManager.middleware) && middlewares.push(compilationManager.middleware)), middlewares.push(faviconFallbackMiddleware), {
|
|
5125
6218
|
onUpgrade: (...args)=>{
|
|
5126
6219
|
for (let cb of upgradeEvents)cb(...args);
|
|
5127
6220
|
}
|
|
@@ -5134,7 +6227,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5134
6227
|
'sockWrite',
|
|
5135
6228
|
'environments'
|
|
5136
6229
|
]), before = [], after = [];
|
|
5137
|
-
for (let handler of
|
|
6230
|
+
for (let handler of helpers_castArray(setupMiddlewares))handler({
|
|
5138
6231
|
unshift: (...handlers)=>before.unshift(...handlers),
|
|
5139
6232
|
push: (...handlers)=>after.push(...handlers)
|
|
5140
6233
|
}, serverOptions);
|
|
@@ -5163,12 +6256,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5163
6256
|
'default',
|
|
5164
6257
|
...Object.keys(something)
|
|
5165
6258
|
])
|
|
5166
|
-
],
|
|
5167
|
-
for (let name of exports1)
|
|
6259
|
+
], syntheticModule = new SyntheticModule(exports1, ()=>{
|
|
6260
|
+
for (let name of exports1)syntheticModule.setExport(name, 'default' === name ? something : something[name]);
|
|
5168
6261
|
}, {
|
|
5169
6262
|
context
|
|
5170
6263
|
});
|
|
5171
|
-
return unlinked || (await
|
|
6264
|
+
return unlinked || (await syntheticModule.link(()=>{}), await syntheticModule.evaluate()), syntheticModule;
|
|
5172
6265
|
};
|
|
5173
6266
|
function basic_define_property(obj, key, value) {
|
|
5174
6267
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
@@ -5328,16 +6421,13 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5328
6421
|
initializeImportMeta: (meta, _)=>{
|
|
5329
6422
|
meta.url = (0, external_node_url_namespaceObject.pathToFileURL)(file.path).href;
|
|
5330
6423
|
},
|
|
5331
|
-
importModuleDynamically: async (specifier, module)=>{
|
|
5332
|
-
let result = await _require(external_node_path_default().dirname(file.path), specifier, {
|
|
6424
|
+
importModuleDynamically: async (specifier, module)=>asModule(await _require(external_node_path_default().dirname(file.path), specifier, {
|
|
5333
6425
|
esmMode: type_EsmMode.Evaluated
|
|
5334
|
-
})
|
|
5335
|
-
return await asModule(result, module.context);
|
|
5336
|
-
}
|
|
6426
|
+
}), module.context)
|
|
5337
6427
|
}), esmCache.set(file.path, esm)), context.esmMode === type_EsmMode.Unlinked) ? esm : (async ()=>{
|
|
5338
|
-
if (await esm.link(async (specifier, referencingModule)=>
|
|
6428
|
+
if (await esm.link(async (specifier, referencingModule)=>asModule(await _require(external_node_path_default().dirname(referencingModule.identifier ? referencingModule.identifier.slice(esmIdentifier.length + 1) : (0, external_node_url_namespaceObject.fileURLToPath)(referencingModule.url)), specifier, {
|
|
5339
6429
|
esmMode: type_EsmMode.Unlinked
|
|
5340
|
-
}), referencingModule.context, !0)),
|
|
6430
|
+
}), referencingModule.context, !0)), await esm.evaluate(), context.esmMode === type_EsmMode.Evaluated) return esm;
|
|
5341
6431
|
let ns = esm.namespace;
|
|
5342
6432
|
return ns.default && ns.default instanceof Promise ? ns.default : ns;
|
|
5343
6433
|
})();
|
|
@@ -5470,7 +6560,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5470
6560
|
let { watchFiles } = devConfig;
|
|
5471
6561
|
if (!watchFiles) return;
|
|
5472
6562
|
let watchers = [];
|
|
5473
|
-
for (let { paths, options, type } of
|
|
6563
|
+
for (let { paths, options, type } of helpers_castArray(watchFiles)){
|
|
5474
6564
|
let watchOptions = prepareWatchOptions(paths, options, type), watcher = await startWatchFiles(watchOptions, compilationManager, root);
|
|
5475
6565
|
watcher && watchers.push(watcher);
|
|
5476
6566
|
}
|
|
@@ -5773,13 +6863,9 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5773
6863
|
...'object' == typeof compress ? compress : void 0
|
|
5774
6864
|
}));
|
|
5775
6865
|
}
|
|
5776
|
-
|
|
6866
|
+
base && '/' !== base && this.middlewares.use(getBaseMiddleware({
|
|
5777
6867
|
base
|
|
5778
|
-
})), await this.applyStaticAssetMiddleware(), historyApiFallback)
|
|
5779
|
-
let { default: connectHistoryApiFallback } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/connect-history-api-fallback/index.js")), historyApiFallbackMiddleware = connectHistoryApiFallback(!0 === historyApiFallback ? {} : historyApiFallback);
|
|
5780
|
-
this.middlewares.use(historyApiFallbackMiddleware), await this.applyStaticAssetMiddleware();
|
|
5781
|
-
}
|
|
5782
|
-
this.middlewares.use(faviconFallbackMiddleware), this.middlewares.use(optionsFallbackMiddleware), this.middlewares.use(notFoundMiddleware);
|
|
6868
|
+
})), await this.applyStaticAssetMiddleware(), historyApiFallback && (this.middlewares.use(historyApiFallbackMiddleware(!0 === historyApiFallback ? {} : historyApiFallback)), await this.applyStaticAssetMiddleware()), this.middlewares.use(faviconFallbackMiddleware), this.middlewares.use(optionsFallbackMiddleware), this.middlewares.use(notFoundMiddleware);
|
|
5783
6869
|
}
|
|
5784
6870
|
async applyStaticAssetMiddleware() {
|
|
5785
6871
|
let { output: { path, assetPrefixes }, serverConfig: { htmlFallback } } = this.options, { default: sirv } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/sirv/index.js")), assetMiddleware = sirv(path, {
|
|
@@ -5927,7 +7013,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5927
7013
|
entryPoint.add(rest);
|
|
5928
7014
|
} else entryPoint.add(item);
|
|
5929
7015
|
};
|
|
5930
|
-
preEntry.forEach(addEntry), injectCoreJsEntry && addEntry(createVirtualModule('import "core-js";')),
|
|
7016
|
+
preEntry.forEach(addEntry), injectCoreJsEntry && addEntry(createVirtualModule('import "core-js";')), helpers_castArray(entry[entryName]).forEach(addEntry);
|
|
5931
7017
|
}
|
|
5932
7018
|
}), api.onBeforeCreateCompiler(({ bundlerConfigs })=>{
|
|
5933
7019
|
if (bundlerConfigs.every((config)=>!config.entry)) throw Error(`${picocolors_index_js_default().dim('[rsbuild:config]')} Could not find any entry module, please make sure that ${picocolors_index_js_default().yellow('src/index.(ts|js|tsx|jsx|mts|cts|mjs|cjs)')} exists, or customize entry through the ${picocolors_index_js_default().yellow('source.entry')} configuration.`);
|
|
@@ -6005,7 +7091,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6005
7091
|
let { dev, output, server } = config, publicPath = DEFAULT_ASSET_PREFIX;
|
|
6006
7092
|
if (isDev) {
|
|
6007
7093
|
if ('string' == typeof dev.assetPrefix) publicPath = dev.assetPrefix;
|
|
6008
|
-
else if (
|
|
7094
|
+
else if (dev.assetPrefix) {
|
|
6009
7095
|
let protocol = (null == (_context_devServer1 = context.devServer) ? void 0 : _context_devServer1.https) ? 'https' : 'http', hostname = (null == (_context_devServer2 = context.devServer) ? void 0 : _context_devServer2.hostname) || DEFAULT_DEV_HOST;
|
|
6010
7096
|
publicPath = hostname === DEFAULT_DEV_HOST ? `${protocol}://localhost:<port>/` : `${protocol}://${hostname}:<port>/`, server.base && '/' !== server.base && (publicPath = urlJoin(publicPath, server.base));
|
|
6011
7097
|
}
|
|
@@ -6092,7 +7178,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6092
7178
|
mergedAlias[pkgName] = pkgPath;
|
|
6093
7179
|
}
|
|
6094
7180
|
for (let name of Object.keys(mergedAlias)){
|
|
6095
|
-
let formattedValues =
|
|
7181
|
+
let formattedValues = helpers_castArray(mergedAlias[name]).map((value)=>'string' == typeof value && value.startsWith('.') ? ensureAbsolutePath(rootPath, value) : value);
|
|
6096
7182
|
chain.resolve.alias.set(name, 1 === formattedValues.length ? formattedValues[0] : formattedValues);
|
|
6097
7183
|
}
|
|
6098
7184
|
}({
|
|
@@ -6287,11 +7373,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6287
7373
|
let extraData = {
|
|
6288
7374
|
entryName,
|
|
6289
7375
|
context: context1,
|
|
6290
|
-
environment
|
|
7376
|
+
environment,
|
|
7377
|
+
faviconDistPath: config.output.distPath.favicon
|
|
6291
7378
|
};
|
|
6292
7379
|
extraDataMap.set(entryName, extraData), templateContent && (extraData.templateContent = templateContent);
|
|
6293
7380
|
let tagConfig = ((config)=>{
|
|
6294
|
-
let tags =
|
|
7381
|
+
let tags = helpers_castArray(config.html.tags).filter(Boolean);
|
|
6295
7382
|
if (tags.length) return {
|
|
6296
7383
|
append: !0,
|
|
6297
7384
|
hash: !1,
|
|
@@ -6368,7 +7455,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6368
7455
|
}, async ({ compilation, environment, sources })=>{
|
|
6369
7456
|
let { config } = environment, { appIcon } = config.html;
|
|
6370
7457
|
if (!appIcon) return;
|
|
6371
|
-
let distDir = config.output.distPath.image, manifestFile = appIcon.filename ?? 'manifest.webmanifest', publicPath = getPublicPathFromCompiler(compilation), icons = appIcon.icons.map((icon)=>((icon, distDir, publicPath)=>{
|
|
7458
|
+
let { lookup } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/mrmime/index.js")), distDir = config.output.distPath.image, manifestFile = appIcon.filename ?? 'manifest.webmanifest', publicPath = getPublicPathFromCompiler(compilation), icons = appIcon.icons.map((icon)=>((icon, distDir, publicPath, lookup)=>{
|
|
6372
7459
|
let { src, size } = icon, cached = iconFormatMap.get(src);
|
|
6373
7460
|
if (cached) return cached;
|
|
6374
7461
|
let sizes = `${size}x${size}`;
|
|
@@ -6378,7 +7465,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6378
7465
|
src,
|
|
6379
7466
|
sizes,
|
|
6380
7467
|
isURL: !0,
|
|
6381
|
-
mimeType:
|
|
7468
|
+
mimeType: lookup(src)
|
|
6382
7469
|
};
|
|
6383
7470
|
return iconFormatMap.set(src, formatted), formatted;
|
|
6384
7471
|
}
|
|
@@ -6389,10 +7476,10 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6389
7476
|
isURL: !1,
|
|
6390
7477
|
absolutePath,
|
|
6391
7478
|
relativePath,
|
|
6392
|
-
mimeType:
|
|
7479
|
+
mimeType: lookup(absolutePath)
|
|
6393
7480
|
};
|
|
6394
7481
|
return iconFormatMap.set(src, formatted), formatted;
|
|
6395
|
-
})(icon, distDir, publicPath)), tags = [];
|
|
7482
|
+
})(icon, distDir, publicPath, lookup)), tags = [];
|
|
6396
7483
|
for (let icon of icons){
|
|
6397
7484
|
if ('web-app-manifest' === icon.target && !appIcon.name) {
|
|
6398
7485
|
addCompilationError(compilation, `${picocolors_index_js_default().dim('[rsbuild:app-icon]')} ${picocolors_index_js_default().yellow('"appIcon.name"')} is required when ${picocolors_index_js_default().yellow('"target"')} is ${picocolors_index_js_default().yellow('"web-app-manifest"')}.`);
|
|
@@ -6805,7 +7892,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6805
7892
|
let finalPluginImport = ((options)=>{
|
|
6806
7893
|
if (!options) return [];
|
|
6807
7894
|
let imports = [];
|
|
6808
|
-
for (let item of
|
|
7895
|
+
for (let item of helpers_castArray(options))isFunction(item) ? imports = item(imports) ?? imports : imports.push(item);
|
|
6809
7896
|
return imports;
|
|
6810
7897
|
})(pluginImport);
|
|
6811
7898
|
(null == finalPluginImport ? void 0 : finalPluginImport.length) && (swcConfig.rspackExperiments ??= {}, swcConfig.rspackExperiments.import ??= [], swcConfig.rspackExperiments.import.push(...finalPluginImport));
|
|
@@ -6822,7 +7909,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6822
7909
|
default:
|
|
6823
7910
|
throw Error(`${picocolors_index_js_default().dim('[rsbuild:swc]')} Unknown decorators version: ${picocolors_index_js_default().yellow(version)}`);
|
|
6824
7911
|
}
|
|
6825
|
-
}(swcConfig, config),
|
|
7912
|
+
}(swcConfig, config), helpers_castArray(target1 = target).includes('web') || target1.includes('web-worker')) {
|
|
6826
7913
|
let polyfillMode = config.output.polyfill;
|
|
6827
7914
|
if ('off' === polyfillMode) swcConfig.env.mode = void 0;
|
|
6828
7915
|
else {
|
|
@@ -7043,7 +8130,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7043
8130
|
if (prefetch) {
|
|
7044
8131
|
let options = !0 === prefetch ? {} : prefetch;
|
|
7045
8132
|
excludes.length && (options.exclude = options.exclude ? [
|
|
7046
|
-
...
|
|
8133
|
+
...helpers_castArray(options.exclude),
|
|
7047
8134
|
...excludes
|
|
7048
8135
|
] : excludes), chain.plugin(CHAIN_ID.PLUGIN.HTML_PREFETCH).use(HtmlResourceHintsPlugin, [
|
|
7049
8136
|
options,
|
|
@@ -7054,7 +8141,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7054
8141
|
if (preload) {
|
|
7055
8142
|
let options = !0 === preload ? {} : preload;
|
|
7056
8143
|
excludes.length && (options.exclude = options.exclude ? [
|
|
7057
|
-
...
|
|
8144
|
+
...helpers_castArray(options.exclude),
|
|
7058
8145
|
...excludes
|
|
7059
8146
|
] : excludes), chain.plugin(CHAIN_ID.PLUGIN.HTML_PRELOAD).use(HtmlResourceHintsPlugin, [
|
|
7060
8147
|
options,
|
|
@@ -7386,7 +8473,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7386
8473
|
...envs.publicVars,
|
|
7387
8474
|
...config.source.define
|
|
7388
8475
|
}, 0 !== envs.filePaths.length && (config.dev ||= {}, config.dev.watchFiles = [
|
|
7389
|
-
...config.dev.watchFiles ?
|
|
8476
|
+
...config.dev.watchFiles ? helpers_castArray(config.dev.watchFiles) : [],
|
|
7390
8477
|
{
|
|
7391
8478
|
paths: envs.filePaths,
|
|
7392
8479
|
type: 'reload-server'
|
|
@@ -7608,42 +8695,60 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7608
8695
|
onAfterStartProdServer: hooks.onAfterStartProdServer.tap,
|
|
7609
8696
|
onBeforeStartProdServer: hooks.onBeforeStartProdServer.tap,
|
|
7610
8697
|
modifyRsbuildConfig: hooks.modifyRsbuildConfig.tap,
|
|
7611
|
-
modifyHTML: (handler)=>
|
|
8698
|
+
modifyHTML: (handler)=>{
|
|
8699
|
+
hooks.modifyHTML.tapEnvironment({
|
|
7612
8700
|
environment,
|
|
7613
8701
|
handler
|
|
7614
|
-
})
|
|
7615
|
-
|
|
8702
|
+
});
|
|
8703
|
+
},
|
|
8704
|
+
modifyHTMLTags: (handler)=>{
|
|
8705
|
+
hooks.modifyHTMLTags.tapEnvironment({
|
|
7616
8706
|
environment,
|
|
7617
8707
|
handler
|
|
7618
|
-
})
|
|
7619
|
-
|
|
8708
|
+
});
|
|
8709
|
+
},
|
|
8710
|
+
modifyBundlerChain: (handler)=>{
|
|
8711
|
+
hooks.modifyBundlerChain.tapEnvironment({
|
|
7620
8712
|
environment,
|
|
7621
8713
|
handler
|
|
7622
|
-
})
|
|
7623
|
-
|
|
8714
|
+
});
|
|
8715
|
+
},
|
|
8716
|
+
modifyRspackConfig: (handler)=>{
|
|
8717
|
+
hooks.modifyRspackConfig.tapEnvironment({
|
|
7624
8718
|
environment,
|
|
7625
8719
|
handler
|
|
7626
|
-
})
|
|
7627
|
-
|
|
8720
|
+
});
|
|
8721
|
+
},
|
|
8722
|
+
modifyWebpackChain: (handler)=>{
|
|
8723
|
+
hooks.modifyWebpackChain.tapEnvironment({
|
|
7628
8724
|
environment,
|
|
7629
8725
|
handler
|
|
7630
|
-
})
|
|
7631
|
-
|
|
8726
|
+
});
|
|
8727
|
+
},
|
|
8728
|
+
modifyWebpackConfig: (handler)=>{
|
|
8729
|
+
hooks.modifyWebpackConfig.tapEnvironment({
|
|
7632
8730
|
environment,
|
|
7633
8731
|
handler
|
|
7634
|
-
})
|
|
7635
|
-
|
|
8732
|
+
});
|
|
8733
|
+
},
|
|
8734
|
+
modifyEnvironmentConfig: (handler)=>{
|
|
8735
|
+
hooks.modifyEnvironmentConfig.tapEnvironment({
|
|
7636
8736
|
environment,
|
|
7637
8737
|
handler
|
|
7638
|
-
})
|
|
7639
|
-
|
|
8738
|
+
});
|
|
8739
|
+
},
|
|
8740
|
+
onAfterEnvironmentCompile: (handler)=>{
|
|
8741
|
+
hooks.onAfterEnvironmentCompile.tapEnvironment({
|
|
7640
8742
|
environment,
|
|
7641
8743
|
handler
|
|
7642
|
-
})
|
|
7643
|
-
|
|
8744
|
+
});
|
|
8745
|
+
},
|
|
8746
|
+
onBeforeEnvironmentCompile: (handler)=>{
|
|
8747
|
+
hooks.onBeforeEnvironmentCompile.tapEnvironment({
|
|
7644
8748
|
environment,
|
|
7645
8749
|
handler
|
|
7646
|
-
})
|
|
8750
|
+
});
|
|
8751
|
+
}
|
|
7647
8752
|
};
|
|
7648
8753
|
};
|
|
7649
8754
|
}({
|
|
@@ -7685,7 +8790,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7685
8790
|
build,
|
|
7686
8791
|
preview,
|
|
7687
8792
|
startDevServer: (...args)=>(context.action = 'dev', process.env.NODE_ENV || setNodeEnv('development'), providerInstance.startDevServer(...args)),
|
|
7688
|
-
createCompiler: (...args)=>(context.action || (context.action = 'development' === process.env.NODE_ENV ? 'dev' : 'build'), providerInstance.createCompiler(...args)),
|
|
8793
|
+
createCompiler: (...args)=>(context.action || (context.action = 'development' === (process.env.NODE_ENV || '') ? 'dev' : 'build'), providerInstance.createCompiler(...args)),
|
|
7689
8794
|
createDevServer: (...args)=>(context.action = 'dev', process.env.NODE_ENV || setNodeEnv('development'), providerInstance.createDevServer(...args)),
|
|
7690
8795
|
...pick(pluginManager, [
|
|
7691
8796
|
'addPlugins',
|
|
@@ -7789,7 +8894,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7789
8894
|
throw index_js_namespaceObject.logger.error(`Failed to load file with jiti: ${picocolors_index_js_default().dim(configFilePath)}`), err;
|
|
7790
8895
|
}
|
|
7791
8896
|
if ('function' == typeof configExport) {
|
|
7792
|
-
let command = process.argv[2], nodeEnv = process.env.NODE_ENV, result = await configExport({
|
|
8897
|
+
let command = process.argv[2], nodeEnv = process.env.NODE_ENV || '', result = await configExport({
|
|
7793
8898
|
env: nodeEnv,
|
|
7794
8899
|
command,
|
|
7795
8900
|
envMode: envMode || nodeEnv,
|
|
@@ -7816,17 +8921,17 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7816
8921
|
loader: commonOpts.configLoader
|
|
7817
8922
|
});
|
|
7818
8923
|
return config.dev ||= {}, config.source ||= {}, config.server ||= {}, commonOpts.base && (config.server.base = commonOpts.base), commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), commonOpts.logLevel && (config.logLevel = commonOpts.logLevel), !commonOpts.open || (null == (_config_server = config.server) ? void 0 : _config_server.open) || (config.server.open = commonOpts.open), commonOpts.host && (config.server.host = commonOpts.host), commonOpts.port && (config.server.port = commonOpts.port), void 0 === config.dev.cliShortcuts && (config.dev.cliShortcuts = !0), filePath && (config.dev.watchFiles = [
|
|
7819
|
-
...config.dev.watchFiles ?
|
|
8924
|
+
...config.dev.watchFiles ? helpers_castArray(config.dev.watchFiles) : [],
|
|
7820
8925
|
{
|
|
7821
8926
|
paths: filePath,
|
|
7822
8927
|
type: 'reload-server'
|
|
7823
8928
|
}
|
|
7824
8929
|
]), config;
|
|
7825
8930
|
};
|
|
7826
|
-
async function
|
|
7827
|
-
|
|
8931
|
+
async function init_init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
8932
|
+
var _commonOpts_environment, cwd, envDir;
|
|
8933
|
+
cliOptions && (commonOpts = cliOptions), commonOpts.environment = null == (_commonOpts_environment = commonOpts.environment) ? void 0 : _commonOpts_environment.flatMap((env)=>env.split(','));
|
|
7828
8934
|
try {
|
|
7829
|
-
var cwd, envDir;
|
|
7830
8935
|
let cwd1 = process.cwd(), root = commonOpts.root ? ensureAbsolutePath(cwd1, commonOpts.root) : cwd1, rsbuild = await createRsbuild({
|
|
7831
8936
|
cwd: root,
|
|
7832
8937
|
rsbuildConfig: ()=>init_loadConfig(root),
|
|
@@ -7841,7 +8946,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7841
8946
|
let files = [], config = rsbuild.getNormalizedConfig();
|
|
7842
8947
|
if (config.dev.watchFiles) for (let watchConfig of config.dev.watchFiles){
|
|
7843
8948
|
if ('reload-server' !== watchConfig.type) continue;
|
|
7844
|
-
let paths =
|
|
8949
|
+
let paths = helpers_castArray(watchConfig.paths);
|
|
7845
8950
|
watchConfig.options ? watchFilesForRestart({
|
|
7846
8951
|
files: paths,
|
|
7847
8952
|
rsbuild,
|
|
@@ -7875,7 +8980,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7875
8980
|
clear,
|
|
7876
8981
|
id: 'server'
|
|
7877
8982
|
});
|
|
7878
|
-
let rsbuild = await
|
|
8983
|
+
let rsbuild = await init_init({
|
|
7879
8984
|
isRestart: !0
|
|
7880
8985
|
});
|
|
7881
8986
|
return !!rsbuild && (await rsbuild.startDevServer(), !0);
|
|
@@ -7885,7 +8990,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7885
8990
|
clear,
|
|
7886
8991
|
id: 'build'
|
|
7887
8992
|
});
|
|
7888
|
-
let rsbuild = await
|
|
8993
|
+
let rsbuild = await init_init({
|
|
7889
8994
|
isRestart: !0,
|
|
7890
8995
|
isBuildWatch: !0
|
|
7891
8996
|
});
|
|
@@ -7930,11 +9035,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7930
9035
|
].includes(level) && (index_js_namespaceObject.logger.level = level);
|
|
7931
9036
|
}
|
|
7932
9037
|
let { npm_execpath } = process.env;
|
|
7933
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && index_js_namespaceObject.logger.log(), index_js_namespaceObject.logger.greet(` Rsbuild v1.4.
|
|
9038
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && index_js_namespaceObject.logger.log(), index_js_namespaceObject.logger.greet(` Rsbuild v1.4.13\n`);
|
|
7934
9039
|
try {
|
|
7935
9040
|
!function() {
|
|
7936
9041
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
7937
|
-
cli.help(), cli.version("1.4.
|
|
9042
|
+
cli.help(), cli.version("1.4.13"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
|
|
7938
9043
|
default: 'jiti'
|
|
7939
9044
|
}).option('-r, --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('-m, --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('--log-level <level>', 'specify the log level, can be `info`, `warn`, `error` or `silent`').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--environment <name>', 'specify the name of environment to build', {
|
|
7940
9045
|
type: [
|
|
@@ -7945,7 +9050,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7945
9050
|
let devCommand = cli.command('', 'starting the dev server').alias('dev'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
|
|
7946
9051
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
7947
9052
|
try {
|
|
7948
|
-
let rsbuild = await
|
|
9053
|
+
let rsbuild = await init_init({
|
|
7949
9054
|
cliOptions: options
|
|
7950
9055
|
});
|
|
7951
9056
|
await (null == rsbuild ? void 0 : rsbuild.startDevServer());
|
|
@@ -7954,7 +9059,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7954
9059
|
}
|
|
7955
9060
|
}), buildCommand.option('-w, --watch', 'turn on watch mode, watch for changes and rebuild').action(async (options)=>{
|
|
7956
9061
|
try {
|
|
7957
|
-
let rsbuild = await
|
|
9062
|
+
let rsbuild = await init_init({
|
|
7958
9063
|
cliOptions: options,
|
|
7959
9064
|
isBuildWatch: options.watch
|
|
7960
9065
|
}), buildInstance = await (null == rsbuild ? void 0 : rsbuild.build({
|
|
@@ -7966,7 +9071,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7966
9071
|
}
|
|
7967
9072
|
}), previewCommand.action(async (options)=>{
|
|
7968
9073
|
try {
|
|
7969
|
-
let rsbuild = await
|
|
9074
|
+
let rsbuild = await init_init({
|
|
7970
9075
|
cliOptions: options
|
|
7971
9076
|
});
|
|
7972
9077
|
await (null == rsbuild ? void 0 : rsbuild.preview());
|
|
@@ -7975,7 +9080,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7975
9080
|
}
|
|
7976
9081
|
}), inspectCommand.option('--output <output>', 'specify inspect content output path').option('--verbose', 'show full function definitions in output').action(async (options)=>{
|
|
7977
9082
|
try {
|
|
7978
|
-
let rsbuild = await
|
|
9083
|
+
let rsbuild = await init_init({
|
|
7979
9084
|
cliOptions: options
|
|
7980
9085
|
});
|
|
7981
9086
|
await (null == rsbuild ? void 0 : rsbuild.inspectConfig({
|
|
@@ -7992,7 +9097,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7992
9097
|
index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), index_js_namespaceObject.logger.error(err);
|
|
7993
9098
|
}
|
|
7994
9099
|
}
|
|
7995
|
-
let src_version = "1.4.
|
|
9100
|
+
let src_version = "1.4.13";
|
|
7996
9101
|
})(), exports.PLUGIN_CSS_NAME = __webpack_exports__.PLUGIN_CSS_NAME, exports.PLUGIN_SWC_NAME = __webpack_exports__.PLUGIN_SWC_NAME, exports.createRsbuild = __webpack_exports__.createRsbuild, exports.defaultAllowedOrigins = __webpack_exports__.defaultAllowedOrigins, exports.defineConfig = __webpack_exports__.defineConfig, exports.ensureAssetPrefix = __webpack_exports__.ensureAssetPrefix, exports.loadConfig = __webpack_exports__.loadConfig, exports.loadEnv = __webpack_exports__.loadEnv, exports.logger = __webpack_exports__.logger, exports.mergeRsbuildConfig = __webpack_exports__.mergeRsbuildConfig, exports.rspack = __webpack_exports__.rspack, exports.runCLI = __webpack_exports__.runCLI, exports.version = __webpack_exports__.version, __webpack_exports__)-1 === [
|
|
7997
9102
|
"PLUGIN_CSS_NAME",
|
|
7998
9103
|
"PLUGIN_SWC_NAME",
|