@rsbuild/core 1.4.10 → 1.4.12
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/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 +5 -1
- package/dist/client/overlay.js +3 -1
- package/dist/index.cjs +1316 -202
- package/dist/index.js +1294 -189
- 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 +0 -1
- package/dist-types/helpers/index.d.ts +3 -2
- package/dist-types/helpers/stats.d.ts +1 -0
- package/dist-types/index.d.ts +1 -1
- package/dist-types/pluginHelper.d.ts +1 -4
- package/dist-types/rspack.d.ts +2 -0
- package/dist-types/server/historyApiFallback.d.ts +2 -0
- package/dist-types/types/config.d.ts +14 -8
- package/dist-types/types/hooks.d.ts +1 -1
- package/dist-types/types/plugin.d.ts +1 -2
- package/package.json +6 -7
- 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-types/{rspack → rspack-plugins}/RsbuildHtmlPlugin.d.ts +0 -0
- /package/dist-types/{rspack → rspack-plugins}/resource-hints/HtmlResourceHintsPlugin.d.ts +0 -0
- /package/dist-types/{rspack → rspack-plugins}/resource-hints/doesChunkBelongToHtml.d.ts +0 -0
- /package/dist-types/{rspack → rspack-plugins}/resource-hints/extractChunks.d.ts +0 -0
- /package/dist-types/{rspack → rspack-plugins}/resource-hints/getResourceType.d.ts +0 -0
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) {
|
|
@@ -914,7 +1212,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
914
1212
|
PLUGIN_SWC_NAME: ()=>PLUGIN_SWC_NAME,
|
|
915
1213
|
defaultAllowedOrigins: ()=>defaultAllowedOrigins,
|
|
916
1214
|
ensureAssetPrefix: ()=>ensureAssetPrefix,
|
|
917
|
-
rspack: ()=>
|
|
1215
|
+
rspack: ()=>rspack_rspack,
|
|
918
1216
|
runCLI: ()=>runCLI,
|
|
919
1217
|
defineConfig: ()=>defineConfig
|
|
920
1218
|
});
|
|
@@ -935,12 +1233,746 @@ for(var __webpack_i__ in (()=>{
|
|
|
935
1233
|
setCssExtractPlugin: ()=>setCssExtractPlugin,
|
|
936
1234
|
setHTMLPlugin: ()=>setHTMLPlugin
|
|
937
1235
|
});
|
|
938
|
-
let
|
|
1236
|
+
let external_node_module_namespaceObject = require("node:module"), rspack_rspack = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__)('@rspack/core'), index_js_namespaceObject = require("../compiled/rslog/index.js"), external_node_path_namespaceObject = require("node:path");
|
|
939
1237
|
var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
|
|
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',
|
|
@@ -952,7 +1984,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
952
1984
|
node: [
|
|
953
1985
|
'node >= 16'
|
|
954
1986
|
]
|
|
955
|
-
},
|
|
1987
|
+
}, JS_REGEX = /\.(?:js|mjs|cjs|jsx)$/, SCRIPT_REGEX = /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/, CSS_REGEX = /\.css$/, RAW_QUERY_REGEX = /^\?raw$/, INLINE_QUERY_REGEX = /^\?inline$/, NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/, PLUGIN_SWC_NAME = 'rsbuild:swc', PLUGIN_CSS_NAME = 'rsbuild:css', FONT_EXTENSIONS = [
|
|
956
1988
|
'woff',
|
|
957
1989
|
'woff2',
|
|
958
1990
|
'eot',
|
|
@@ -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
|
|
@@ -1257,6 +2298,8 @@ for(var __webpack_i__ in (()=>{
|
|
|
1257
2298
|
return filename.media ?? `[name]${hash}[ext]`;
|
|
1258
2299
|
case 'assets':
|
|
1259
2300
|
return filename.assets ?? `[name]${hash}[ext]`;
|
|
2301
|
+
case 'wasm':
|
|
2302
|
+
return filename.wasm ?? '[hash].module.wasm';
|
|
1260
2303
|
default:
|
|
1261
2304
|
throw Error(`${picocolors_index_js_default().dim('[rsbuild:config]')} unknown key ${picocolors_index_js_default().yellow(type)} in ${picocolors_index_js_default().yellow('output.filename')}`);
|
|
1262
2305
|
}
|
|
@@ -1297,10 +2340,10 @@ for(var __webpack_i__ in (()=>{
|
|
|
1297
2340
|
isDebug() && (index_js_namespaceObject.logger.level = 'verbose'), index_js_namespaceObject.logger.override({
|
|
1298
2341
|
debug: (message, ...args)=>{
|
|
1299
2342
|
if ('verbose' !== index_js_namespaceObject.logger.level) return;
|
|
1300
|
-
let time = picocolors_index_js_default().gray(
|
|
2343
|
+
let time = picocolors_index_js_default().gray(function() {
|
|
1301
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');
|
|
1302
2345
|
return `${hours}:${minutes}:${seconds}`;
|
|
1303
|
-
}()
|
|
2346
|
+
}());
|
|
1304
2347
|
console.log(` ${picocolors_index_js_default().magenta('rsbuild')} ${time} ${message}`, ...args);
|
|
1305
2348
|
}
|
|
1306
2349
|
});
|
|
@@ -1625,9 +2668,11 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
1625
2668
|
};
|
|
1626
2669
|
return {
|
|
1627
2670
|
tapEnvironment,
|
|
1628
|
-
tap: (handler)=>
|
|
2671
|
+
tap: (handler)=>{
|
|
2672
|
+
tapEnvironment({
|
|
1629
2673
|
handler
|
|
1630
|
-
})
|
|
2674
|
+
});
|
|
2675
|
+
},
|
|
1631
2676
|
callChain: async ({ environment, args: params })=>{
|
|
1632
2677
|
for (let callback of [
|
|
1633
2678
|
...preGroup,
|
|
@@ -1741,13 +2786,13 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
1741
2786
|
};
|
|
1742
2787
|
onBeforeCompile({
|
|
1743
2788
|
compiler,
|
|
1744
|
-
beforeCompile: async ()=>
|
|
2789
|
+
beforeCompile: async ()=>context.hooks.onBeforeBuild.callBatch({
|
|
1745
2790
|
bundlerConfigs,
|
|
1746
2791
|
environments: context.environments,
|
|
1747
2792
|
isWatch,
|
|
1748
2793
|
isFirstCompile
|
|
1749
2794
|
}),
|
|
1750
|
-
beforeEnvironmentCompiler: async (buildIndex)=>
|
|
2795
|
+
beforeEnvironmentCompiler: async (buildIndex)=>context.hooks.onBeforeEnvironmentCompile.callBatch({
|
|
1751
2796
|
environment: environmentList[buildIndex].name,
|
|
1752
2797
|
args: [
|
|
1753
2798
|
{
|
|
@@ -1788,7 +2833,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
1788
2833
|
};
|
|
1789
2834
|
onBeforeCompile({
|
|
1790
2835
|
compiler,
|
|
1791
|
-
beforeEnvironmentCompiler: async (buildIndex)=>
|
|
2836
|
+
beforeEnvironmentCompiler: async (buildIndex)=>context.hooks.onBeforeEnvironmentCompile.callBatch({
|
|
1792
2837
|
environment: environmentList[buildIndex].name,
|
|
1793
2838
|
args: [
|
|
1794
2839
|
{
|
|
@@ -1873,7 +2918,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
1873
2918
|
if (void 0 !== result) return result;
|
|
1874
2919
|
}while (loc !== (loc = external_node_path_namespaceObject.dirname(loc)));
|
|
1875
2920
|
}
|
|
1876
|
-
let configCache = {},
|
|
2921
|
+
let configCache = {}, OVERRIDE_PATHS = [
|
|
1877
2922
|
'performance.removeConsole',
|
|
1878
2923
|
'output.inlineScripts',
|
|
1879
2924
|
'output.inlineStyles',
|
|
@@ -1899,8 +2944,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
1899
2944
|
y
|
|
1900
2945
|
];
|
|
1901
2946
|
if (pair.some(Array.isArray)) return 'output.copy' !== path || pair.every(Array.isArray) ? [
|
|
1902
|
-
...
|
|
1903
|
-
...
|
|
2947
|
+
...helpers_castArray(x),
|
|
2948
|
+
...helpers_castArray(y)
|
|
1904
2949
|
] : Array.isArray(x) ? merge({
|
|
1905
2950
|
patterns: x
|
|
1906
2951
|
}, y, path) : merge(x, {
|
|
@@ -2142,7 +3187,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2142
3187
|
let { name, setup } = instance;
|
|
2143
3188
|
if (!(removedPlugins.has(name) || environment && (null == (_removedEnvPlugins_environment = removedEnvPlugins[environment]) ? void 0 : _removedEnvPlugins_environment.has(name)))) {
|
|
2144
3189
|
if (instance.apply && context.action) if (isFunction(instance.apply)) {
|
|
2145
|
-
if (!
|
|
3190
|
+
if (!instance.apply(context.originalConfig, {
|
|
2146
3191
|
action: context.action
|
|
2147
3192
|
})) continue;
|
|
2148
3193
|
} else {
|
|
@@ -2277,7 +3322,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2277
3322
|
async function createContext(options, userConfig) {
|
|
2278
3323
|
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';
|
|
2279
3324
|
return {
|
|
2280
|
-
version: "1.4.
|
|
3325
|
+
version: "1.4.12",
|
|
2281
3326
|
rootPath,
|
|
2282
3327
|
distPath: '',
|
|
2283
3328
|
cachePath,
|
|
@@ -2315,8 +3360,6 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2315
3360
|
specifiedEnvironments
|
|
2316
3361
|
};
|
|
2317
3362
|
}
|
|
2318
|
-
let rspack_chain_index_js_namespaceObject = require("../compiled/rspack-chain/index.js");
|
|
2319
|
-
var rspack_chain_index_js_default = __webpack_require__.n(rspack_chain_index_js_namespaceObject);
|
|
2320
3363
|
let normalizePluginObject = (plugin)=>{
|
|
2321
3364
|
let { setup: _, ...rest } = plugin;
|
|
2322
3365
|
return {
|
|
@@ -2360,7 +3403,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2360
3403
|
index_js_namespaceObject.logger.success(`config inspection completed, generated files: \n\n${fileInfos}\n`);
|
|
2361
3404
|
}
|
|
2362
3405
|
function stringifyConfig(config, verbose) {
|
|
2363
|
-
return
|
|
3406
|
+
return src_class.toString(config, {
|
|
2364
3407
|
verbose
|
|
2365
3408
|
});
|
|
2366
3409
|
}
|
|
@@ -2460,14 +3503,14 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2460
3503
|
async function modifyBundlerChain(context, utils) {
|
|
2461
3504
|
var _utils_environment_config_tools;
|
|
2462
3505
|
index_js_namespaceObject.logger.debug('modify bundler chain');
|
|
2463
|
-
let bundlerChain = new (
|
|
3506
|
+
let bundlerChain = new src_class(), [modifiedBundlerChain] = await context.hooks.modifyBundlerChain.callChain({
|
|
2464
3507
|
environment: utils.environment.name,
|
|
2465
3508
|
args: [
|
|
2466
3509
|
bundlerChain,
|
|
2467
3510
|
utils
|
|
2468
3511
|
]
|
|
2469
3512
|
});
|
|
2470
|
-
if (null == (_utils_environment_config_tools = utils.environment.config.tools) ? void 0 : _utils_environment_config_tools.bundlerChain) for (let item of
|
|
3513
|
+
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);
|
|
2471
3514
|
return index_js_namespaceObject.logger.debug('modify bundler chain done'), modifiedBundlerChain;
|
|
2472
3515
|
}
|
|
2473
3516
|
let configChain_CHAIN_ID = {
|
|
@@ -2556,7 +3599,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2556
3599
|
plugin && (pluginHelper_htmlPlugin = plugin);
|
|
2557
3600
|
}, getHTMLPlugin = ()=>(pluginHelper_htmlPlugin || (pluginHelper_htmlPlugin = pluginHelper_require('../compiled/html-rspack-plugin/index.js')), pluginHelper_htmlPlugin), setCssExtractPlugin = (plugin)=>{
|
|
2558
3601
|
cssExtractPlugin = plugin;
|
|
2559
|
-
}, getCssExtractPlugin = ()=>cssExtractPlugin ||
|
|
3602
|
+
}, getCssExtractPlugin = ()=>cssExtractPlugin || rspack_rspack.CssExtractRspackPlugin;
|
|
2560
3603
|
async function modifyRspackConfig(context, rspackConfig, chainUtils) {
|
|
2561
3604
|
var _utils_environment_config_tools;
|
|
2562
3605
|
index_js_namespaceObject.logger.debug('modify Rspack config');
|
|
@@ -2586,19 +3629,19 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2586
3629
|
...chainUtils,
|
|
2587
3630
|
mergeConfig: webpack_merge_dist.merge,
|
|
2588
3631
|
addRules (rules) {
|
|
2589
|
-
let ruleArr =
|
|
3632
|
+
let ruleArr = helpers_castArray(rules);
|
|
2590
3633
|
config.module || (config.module = {}), config.module.rules || (config.module.rules = []), config.module.rules.unshift(...ruleArr);
|
|
2591
3634
|
},
|
|
2592
3635
|
appendRules (rules) {
|
|
2593
|
-
let ruleArr =
|
|
3636
|
+
let ruleArr = helpers_castArray(rules);
|
|
2594
3637
|
config.module || (config.module = {}), config.module.rules || (config.module.rules = []), config.module.rules.push(...ruleArr);
|
|
2595
3638
|
},
|
|
2596
3639
|
prependPlugins (plugins) {
|
|
2597
|
-
let pluginArr =
|
|
3640
|
+
let pluginArr = helpers_castArray(plugins);
|
|
2598
3641
|
config.plugins || (config.plugins = []), config.plugins.unshift(...pluginArr);
|
|
2599
3642
|
},
|
|
2600
3643
|
appendPlugins (plugins) {
|
|
2601
|
-
let pluginArr =
|
|
3644
|
+
let pluginArr = helpers_castArray(plugins);
|
|
2602
3645
|
config.plugins || (config.plugins = []), config.plugins.push(...pluginArr);
|
|
2603
3646
|
},
|
|
2604
3647
|
removePlugin (pluginName) {
|
|
@@ -2607,11 +3650,10 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2607
3650
|
};
|
|
2608
3651
|
}
|
|
2609
3652
|
function getChainUtils(target, environment) {
|
|
2610
|
-
let nodeEnv = process.env.NODE_ENV;
|
|
2611
3653
|
return {
|
|
2612
|
-
rspack:
|
|
3654
|
+
rspack: rspack_rspack,
|
|
2613
3655
|
environment,
|
|
2614
|
-
env:
|
|
3656
|
+
env: process.env.NODE_ENV || '',
|
|
2615
3657
|
target,
|
|
2616
3658
|
isDev: 'development' === environment.config.mode,
|
|
2617
3659
|
isProd: 'production' === environment.config.mode,
|
|
@@ -2622,7 +3664,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2622
3664
|
};
|
|
2623
3665
|
}
|
|
2624
3666
|
async function generateRspackConfig({ target, context, environment }) {
|
|
2625
|
-
let chainUtils = getChainUtils(target, context.environments[environment]), { BannerPlugin, DefinePlugin, IgnorePlugin, ProvidePlugin, SourceMapDevToolPlugin, HotModuleReplacementPlugin } =
|
|
3667
|
+
let chainUtils = getChainUtils(target, context.environments[environment]), { BannerPlugin, DefinePlugin, IgnorePlugin, ProvidePlugin, SourceMapDevToolPlugin, HotModuleReplacementPlugin } = rspack_rspack, rspackConfig = (await modifyBundlerChain(context, {
|
|
2626
3668
|
...chainUtils,
|
|
2627
3669
|
bundler: {
|
|
2628
3670
|
BannerPlugin,
|
|
@@ -2675,7 +3717,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2675
3717
|
...createDefaultConfig(),
|
|
2676
3718
|
mode: (()=>{
|
|
2677
3719
|
if (config.mode) return config.mode;
|
|
2678
|
-
let nodeEnv = process.env.NODE_ENV;
|
|
3720
|
+
let nodeEnv = process.env.NODE_ENV || '';
|
|
2679
3721
|
return 'production' === nodeEnv || 'development' === nodeEnv ? nodeEnv : 'none';
|
|
2680
3722
|
})()
|
|
2681
3723
|
}, config), { watchFiles } = mergedConfig.dev;
|
|
@@ -2839,9 +3881,9 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2839
3881
|
if (await context.hooks.onBeforeCreateCompiler.callBatch({
|
|
2840
3882
|
bundlerConfigs: rspackConfigs,
|
|
2841
3883
|
environments: context.environments
|
|
2842
|
-
}), !await isSatisfyRspackVersion(
|
|
2843
|
-
let isMultiCompiler = rspackConfigs.length > 1, compiler = isMultiCompiler ? (
|
|
2844
|
-
isVersionLogged || (index_js_namespaceObject.logger.debug(`use Rspack v${
|
|
3884
|
+
}), !await isSatisfyRspackVersion(rspack_rspack.rspackVersion)) throw Error(`${picocolors_index_js_default().dim('[rsbuild]')} The current Rspack version does not meet the requirements, the minimum supported version of Rspack is ${picocolors_index_js_default().green(rspackMinVersion)}`);
|
|
3885
|
+
let isMultiCompiler = rspackConfigs.length > 1, compiler = isMultiCompiler ? rspack_rspack(rspackConfigs) : rspack_rspack(rspackConfigs[0]), isVersionLogged = !1, isCompiling = !1, logRspackVersion = ()=>{
|
|
3886
|
+
isVersionLogged || (index_js_namespaceObject.logger.debug(`use Rspack v${rspack_rspack.rspackVersion}`), isVersionLogged = !0);
|
|
2845
3887
|
};
|
|
2846
3888
|
return compiler.hooks.watchRun.tap('rsbuild:compiling', (compiler)=>{
|
|
2847
3889
|
logRspackVersion(), isCompiling || function(compiler, context) {
|
|
@@ -2888,7 +3930,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2888
3930
|
context,
|
|
2889
3931
|
compiler,
|
|
2890
3932
|
bundlerConfigs: rspackConfigs,
|
|
2891
|
-
MultiStatsCtor:
|
|
3933
|
+
MultiStatsCtor: rspack_rspack.MultiStats
|
|
2892
3934
|
}), await context.hooks.onAfterCreateCompiler.callBatch({
|
|
2893
3935
|
compiler,
|
|
2894
3936
|
environments: context.environments
|
|
@@ -2909,16 +3951,19 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2909
3951
|
bundlerConfigs,
|
|
2910
3952
|
compiler,
|
|
2911
3953
|
isWatch: !!watch,
|
|
2912
|
-
MultiStatsCtor:
|
|
2913
|
-
}), watch)
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
3954
|
+
MultiStatsCtor: rspack_rspack.MultiStats
|
|
3955
|
+
}), watch) {
|
|
3956
|
+
let watchOptions = bundlerConfigs ? bundlerConfigs.map((options)=>options.watchOptions || {}) : [];
|
|
3957
|
+
return compiler.watch(watchOptions.length > 1 ? watchOptions : watchOptions[0] || {}, (err)=>{
|
|
3958
|
+
err && index_js_namespaceObject.logger.error(err);
|
|
3959
|
+
}), {
|
|
3960
|
+
close: ()=>new Promise((resolve)=>{
|
|
3961
|
+
compiler.close(()=>{
|
|
3962
|
+
resolve();
|
|
3963
|
+
});
|
|
3964
|
+
})
|
|
3965
|
+
};
|
|
3966
|
+
}
|
|
2922
3967
|
let { stats } = await new Promise((resolve, reject)=>{
|
|
2923
3968
|
compiler.run((err, stats)=>{
|
|
2924
3969
|
compiler.close((closeErr)=>{
|
|
@@ -2935,7 +3980,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2935
3980
|
}, types_namespaceObject = require("node:util/types");
|
|
2936
3981
|
var main = __webpack_require__("../../node_modules/.pnpm/dotenv-expand@12.0.2/node_modules/dotenv-expand/lib/main.js");
|
|
2937
3982
|
let DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
2938
|
-
function loadEnv({ cwd = process.cwd(), mode = process.env.NODE_ENV, prefixes = [
|
|
3983
|
+
function loadEnv({ cwd = process.cwd(), mode = process.env.NODE_ENV || '', prefixes = [
|
|
2939
3984
|
'PUBLIC_'
|
|
2940
3985
|
], processEnv = process.env } = {}) {
|
|
2941
3986
|
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.`);
|
|
@@ -2976,11 +4021,11 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2976
4021
|
rawPublicVars
|
|
2977
4022
|
};
|
|
2978
4023
|
}
|
|
2979
|
-
let external_node_util_namespaceObject = require("node:util"),
|
|
4024
|
+
let external_node_util_namespaceObject = require("node:util"), chainStaticAssetRule = ({ emit, rule, maxSize, filename, assetType })=>{
|
|
2980
4025
|
let generatorOptions = {
|
|
2981
4026
|
filename
|
|
2982
4027
|
};
|
|
2983
|
-
|
|
4028
|
+
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({
|
|
2984
4029
|
dataUrlCondition: {
|
|
2985
4030
|
maxSize
|
|
2986
4031
|
}
|
|
@@ -3052,7 +4097,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3052
4097
|
}, parseMinifyOptions = (config)=>{
|
|
3053
4098
|
let isProd = 'production' === config.mode, { minify } = config.output;
|
|
3054
4099
|
if ('boolean' == typeof minify) {
|
|
3055
|
-
let shouldMinify =
|
|
4100
|
+
let shouldMinify = minify && isProd;
|
|
3056
4101
|
return {
|
|
3057
4102
|
minifyJs: shouldMinify,
|
|
3058
4103
|
minifyCss: shouldMinify
|
|
@@ -3104,12 +4149,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3104
4149
|
config: config.tools.postcss,
|
|
3105
4150
|
ctx: {
|
|
3106
4151
|
addPlugins (plugins) {
|
|
3107
|
-
extraPlugins.push(...
|
|
4152
|
+
extraPlugins.push(...helpers_castArray(plugins));
|
|
3108
4153
|
}
|
|
3109
4154
|
}
|
|
3110
4155
|
});
|
|
3111
4156
|
finalOptions.postcssOptions ||= {};
|
|
3112
|
-
let updatePostcssOptions = (options)=>(options.plugins ||= [], extraPlugins.length && options.plugins.push(...extraPlugins), options.plugins = options.plugins.map((plugin)=>((plugin)=>'function' == typeof plugin &&
|
|
4157
|
+
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;
|
|
3113
4158
|
if ('function' == typeof postcssOptions) {
|
|
3114
4159
|
let postcssOptionsWrapper = (loaderContext)=>{
|
|
3115
4160
|
let options = postcssOptions(loaderContext);
|
|
@@ -3139,7 +4184,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3139
4184
|
let EXCLUDE_ASSET_REGEX = /\.(?:map|LICENSE\.txt|d\.ts)$/, excludeAsset = (asset)=>EXCLUDE_ASSET_REGEX.test(asset.name), getAssetColor = (size)=>size > 300000 ? picocolors_index_js_default().red : size > 100000 ? picocolors_index_js_default().yellow : picocolors_index_js_default().green, calcFileSize = (len)=>{
|
|
3140
4185
|
let val = len / 1000;
|
|
3141
4186
|
return `${val.toFixed(val < 1 ? 2 : 1)} kB`;
|
|
3142
|
-
}, coloringAssetName = (assetName)=>JS_REGEX.test(assetName) ? picocolors_index_js_default().cyan(assetName) :
|
|
4187
|
+
}, coloringAssetName = (assetName)=>JS_REGEX.test(assetName) ? picocolors_index_js_default().cyan(assetName) : assetName.endsWith('.css') ? picocolors_index_js_default().yellow(assetName) : assetName.endsWith('.html') ? picocolors_index_js_default().green(assetName) : picocolors_index_js_default().magenta(assetName), COMPRESSIBLE_REGEX = /\.(?:js|css|html|json|svg|txt|xml|xhtml|wasm|manifest|md)$/i;
|
|
3143
4188
|
async function printFileSizes(options, stats, rootPath, environmentName) {
|
|
3144
4189
|
let logs = [], showTotal = !1 !== options.total, showDetail = !1 !== options.detail, exclude = options.exclude ?? excludeAsset;
|
|
3145
4190
|
if (!showTotal && !showDetail) return logs;
|
|
@@ -3156,16 +4201,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3156
4201
|
}, getAssets = async ()=>{
|
|
3157
4202
|
let distPath = stats.compilation.outputOptions.path;
|
|
3158
4203
|
if (!distPath) return [];
|
|
3159
|
-
let filteredAssets = (stats.
|
|
3160
|
-
all: !1,
|
|
3161
|
-
assets: !0,
|
|
3162
|
-
cachedAssets: !0,
|
|
3163
|
-
groupAssetsByInfo: !1,
|
|
3164
|
-
groupAssetsByPath: !1,
|
|
3165
|
-
groupAssetsByChunk: !1,
|
|
3166
|
-
groupAssetsByExtension: !1,
|
|
3167
|
-
groupAssetsByEmitStatus: !1
|
|
3168
|
-
}).assets || []).filter((asset)=>{
|
|
4204
|
+
let filteredAssets = getAssetsFromStats(stats).filter((asset)=>{
|
|
3169
4205
|
let assetInfo = {
|
|
3170
4206
|
name: asset.name,
|
|
3171
4207
|
size: asset.size
|
|
@@ -3842,10 +4878,10 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3842
4878
|
}
|
|
3843
4879
|
let message = '', maxNameLength = Math.max(...routes.map((r)=>r.entryName.length));
|
|
3844
4880
|
return urls.forEach(({ label, url }, index)=>{
|
|
3845
|
-
for (let r of (index > 0 && (message += '\n'), message += `
|
|
4881
|
+
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`;
|
|
3846
4882
|
}), message;
|
|
3847
4883
|
}(urls, routes);
|
|
3848
|
-
return !
|
|
4884
|
+
return !trailingLineBreak && message.endsWith('\n') && (message = message.slice(0, -1)), index_js_namespaceObject.logger.log(message), message;
|
|
3849
4885
|
}
|
|
3850
4886
|
let getPort = async ({ host, port, strictPort, tryLimits = 20 })=>{
|
|
3851
4887
|
'string' == typeof port && (port = Number.parseInt(port, 10)), strictPort && (tryLimits = 1);
|
|
@@ -3946,7 +4982,9 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3946
4982
|
listened = !0;
|
|
3947
4983
|
}), ()=>new Promise((resolve, reject)=>{
|
|
3948
4984
|
for (let socket of pendingSockets)socket.destroy();
|
|
3949
|
-
listened ? server.close((err)=>
|
|
4985
|
+
listened ? server.close((err)=>{
|
|
4986
|
+
err ? reject(err) : resolve();
|
|
4987
|
+
}) : resolve();
|
|
3950
4988
|
});
|
|
3951
4989
|
}
|
|
3952
4990
|
let supportedChromiumBrowsers = [
|
|
@@ -4011,7 +5049,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4011
5049
|
} : Array.isArray(open) ? {
|
|
4012
5050
|
targets: open
|
|
4013
5051
|
} : {
|
|
4014
|
-
targets: open.target ?
|
|
5052
|
+
targets: open.target ? helpers_castArray(open.target) : [],
|
|
4015
5053
|
before: open.before
|
|
4016
5054
|
};
|
|
4017
5055
|
})(config);
|
|
@@ -4121,8 +5159,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4121
5159
|
return chunks;
|
|
4122
5160
|
}(compilation, options.type), sortedFilteredFiles = ((files, include, exclude)=>{
|
|
4123
5161
|
let includeRegExp = [], excludeRegExp = [], includeFn = [], excludeFn = [];
|
|
4124
|
-
if (include) for (let item of
|
|
4125
|
-
if (exclude) for (let item of
|
|
5162
|
+
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);
|
|
5163
|
+
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);
|
|
4126
5164
|
return files.filter((file)=>{
|
|
4127
5165
|
let includeMatched = !1;
|
|
4128
5166
|
for (let item of includeRegExp)item.test(file) && (includeMatched = !0);
|
|
@@ -4209,7 +5247,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4209
5247
|
traceOutput = 'perfetto' === traceLayer ? defaultRustTracePerfettoOutput : 'stdout';
|
|
4210
5248
|
}
|
|
4211
5249
|
let filter = "OVERVIEW" === (value = filterValue) ? 'info' : "ALL" === value ? 'trace' : value;
|
|
4212
|
-
return await ensureFileDir(traceOutput), await
|
|
5250
|
+
return await ensureFileDir(traceOutput), await rspack_rspack.experiments.globalTrace.register(filter, traceLayer, traceOutput), traceOutput;
|
|
4213
5251
|
}
|
|
4214
5252
|
let MODULE_PATH_REGEX = /.*[\\/]node_modules[\\/](?!\.pnpm[\\/])(?:(@[^\\/]+)[\\/])?([^\\/]+)/, SPLIT_STRATEGY_DISPATCHER = {
|
|
4215
5253
|
'split-by-experience': function(ctx) {
|
|
@@ -4583,10 +5621,10 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4583
5621
|
let initialChunks = this.initialChunks[token], shouldReload = !!statsJson.entrypoints && !!initialChunks && (a = initialChunks, b = newInitialChunks, !(a.size === b.size && [
|
|
4584
5622
|
...a
|
|
4585
5623
|
].every((value)=>b.has(value))));
|
|
4586
|
-
if (this.initialChunks[token] = newInitialChunks, shouldReload) return this.sockWrite({
|
|
5624
|
+
if (this.initialChunks[token] = newInitialChunks, shouldReload) return void this.sockWrite({
|
|
4587
5625
|
type: 'static-changed'
|
|
4588
5626
|
}, token);
|
|
4589
|
-
if (!force && statsJson && !statsJson.errorsCount && statsJson.assets && statsJson.assets.every((asset)=>!asset.emitted)) return this.sockWrite({
|
|
5627
|
+
if (!force && statsJson && !statsJson.errorsCount && statsJson.assets && statsJson.assets.every((asset)=>!asset.emitted)) return void this.sockWrite({
|
|
4590
5628
|
type: 'ok'
|
|
4591
5629
|
}, token);
|
|
4592
5630
|
if (this.sockWrite({
|
|
@@ -4597,7 +5635,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4597
5635
|
errors: getAllStatsErrors(statsJson),
|
|
4598
5636
|
warnings: []
|
|
4599
5637
|
});
|
|
4600
|
-
|
|
5638
|
+
this.sockWrite({
|
|
4601
5639
|
type: 'errors',
|
|
4602
5640
|
data: {
|
|
4603
5641
|
text: formattedErrors,
|
|
@@ -4757,20 +5795,22 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4757
5795
|
}(formattedErrors, root)
|
|
4758
5796
|
}
|
|
4759
5797
|
}, token);
|
|
5798
|
+
return;
|
|
4760
5799
|
}
|
|
4761
5800
|
if (statsJson.warningsCount) {
|
|
4762
5801
|
let { warnings: formattedWarnings } = formatStatsMessages({
|
|
4763
5802
|
warnings: getAllStatsWarnings(statsJson),
|
|
4764
5803
|
errors: []
|
|
4765
5804
|
});
|
|
4766
|
-
|
|
5805
|
+
this.sockWrite({
|
|
4767
5806
|
type: 'warnings',
|
|
4768
5807
|
data: {
|
|
4769
5808
|
text: formattedWarnings
|
|
4770
5809
|
}
|
|
4771
5810
|
}, token);
|
|
5811
|
+
return;
|
|
4772
5812
|
}
|
|
4773
|
-
|
|
5813
|
+
this.sockWrite({
|
|
4774
5814
|
type: 'ok'
|
|
4775
5815
|
}, token);
|
|
4776
5816
|
}
|
|
@@ -4824,11 +5864,11 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4824
5864
|
let { devConfig, serverConfig, publicPaths, environments } = this, clientPaths = function(devConfig) {
|
|
4825
5865
|
var _devConfig_client;
|
|
4826
5866
|
let clientPaths = [];
|
|
4827
|
-
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(
|
|
5867
|
+
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;
|
|
4828
5868
|
}(devConfig), middleware = await getCompilationMiddleware(this.compiler, {
|
|
4829
5869
|
callbacks: {
|
|
4830
5870
|
onInvalid: (token, fileName)=>{
|
|
4831
|
-
if ('string' == typeof fileName &&
|
|
5871
|
+
if ('string' == typeof fileName && fileName.endsWith('.html')) return void this.socketServer.sockWrite({
|
|
4832
5872
|
type: 'static-changed'
|
|
4833
5873
|
}, token);
|
|
4834
5874
|
this.socketServer.sockWrite({
|
|
@@ -4869,10 +5909,10 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4869
5909
|
}
|
|
4870
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)=>{
|
|
4871
5911
|
let gzip, writeHeadStatus;
|
|
4872
|
-
if (filter && !
|
|
5912
|
+
if (filter && !filter(req, res)) return void next();
|
|
4873
5913
|
let accept = req.headers['accept-encoding'], encoding = 'string' == typeof accept && ENCODING_REGEX.test(accept);
|
|
4874
5914
|
if ('HEAD' === req.method || !encoding) return void next();
|
|
4875
|
-
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 = ()=>{
|
|
4876
5916
|
if (!started) {
|
|
4877
5917
|
if (started = !0, ((res)=>{
|
|
4878
5918
|
if (res.getHeader('Content-Encoding')) return !1;
|
|
@@ -4883,22 +5923,77 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4883
5923
|
})(res)) for (let listener of (res.setHeader('Content-Encoding', 'gzip'), res.removeHeader('Content-Length'), (gzip = external_node_zlib_default().createGzip({
|
|
4884
5924
|
level
|
|
4885
5925
|
})).on('data', (chunk)=>{
|
|
4886
|
-
|
|
4887
|
-
}), on
|
|
4888
|
-
end
|
|
5926
|
+
write(chunk) || gzip.pause();
|
|
5927
|
+
}), on('drain', ()=>gzip.resume()), gzip.on('end', ()=>{
|
|
5928
|
+
end();
|
|
4889
5929
|
}), listeners))gzip.on.apply(gzip, listener);
|
|
4890
5930
|
else for (let listener of listeners)on.apply(res, listener);
|
|
4891
|
-
writeHead
|
|
5931
|
+
writeHead(writeHeadStatus ?? res.statusCode);
|
|
4892
5932
|
}
|
|
4893
5933
|
};
|
|
4894
5934
|
res.writeHead = (status, reason, headers)=>{
|
|
4895
5935
|
if (reason) for (let [key, value] of Object.entries(headers || reason))res.setHeader(key, value);
|
|
4896
5936
|
return writeHeadStatus = status, res;
|
|
4897
|
-
}, 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([
|
|
4898
5938
|
type,
|
|
4899
5939
|
listener
|
|
4900
5940
|
]), res), next();
|
|
4901
|
-
}
|
|
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)=>{
|
|
4902
5997
|
'/favicon.ico' === req.url ? (res.statusCode = 204, res.end()) : next();
|
|
4903
5998
|
}, getRequestLoggerMiddleware = async ()=>{
|
|
4904
5999
|
let { default: onFinished } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/on-finished/index.js"));
|
|
@@ -4928,7 +6023,10 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4928
6023
|
}, postfixRE = /[?#].*$/, getUrlPathname = (url)=>url.replace(postfixRE, ''), getBaseMiddleware = ({ base })=>async (req, res, next)=>{
|
|
4929
6024
|
var _req_headers_accept;
|
|
4930
6025
|
let url = req.url, pathname = getUrlPathname(url);
|
|
4931
|
-
if (pathname.startsWith(base))
|
|
6026
|
+
if (pathname.startsWith(base)) {
|
|
6027
|
+
req.url = stripBase(url, base), next();
|
|
6028
|
+
return;
|
|
6029
|
+
}
|
|
4932
6030
|
let redirectPath = addTrailingSlash(url) !== base ? joinUrlSegments(base, url) : base;
|
|
4933
6031
|
if ('/' === pathname || '/index.html' === pathname) {
|
|
4934
6032
|
res.writeHead(302, {
|
|
@@ -5003,7 +6101,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5003
6101
|
var _childCompiler_options_experiments;
|
|
5004
6102
|
return null == (_childCompiler_options_experiments = childCompiler.options.experiments) ? void 0 : _childCompiler_options_experiments.lazyCompilation;
|
|
5005
6103
|
}) : null == (_compiler_options_experiments = compiler.options.experiments) ? void 0 : _compiler_options_experiments.lazyCompilation;
|
|
5006
|
-
})() && middlewares.push(
|
|
6104
|
+
})() && middlewares.push(rspack_rspack.experiments.lazyCompilationMiddleware(compiler));
|
|
5007
6105
|
}
|
|
5008
6106
|
server.base && '/' !== server.base && middlewares.push(getBaseMiddleware({
|
|
5009
6107
|
base: server.base
|
|
@@ -5013,10 +6111,10 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5013
6111
|
'/__open-in-editor',
|
|
5014
6112
|
launchEditorMiddleware()
|
|
5015
6113
|
]), middlewares.push((({ environments })=>async (req, res, next)=>{
|
|
5016
|
-
if ('/rsbuild-dev-server'
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
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>
|
|
5020
6118
|
<html>
|
|
5021
6119
|
<head>
|
|
5022
6120
|
<meta charset="utf-8"/>
|
|
@@ -5059,35 +6157,35 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5059
6157
|
<h1>Assets Report</h1>
|
|
5060
6158
|
</body>
|
|
5061
6159
|
</html>`);
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
res.write(null == list ? void 0 : list.join('')), res.write('</ul>');
|
|
5069
|
-
}
|
|
5070
|
-
res.end('</body></html>');
|
|
5071
|
-
} catch (err) {
|
|
5072
|
-
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>');
|
|
5073
6166
|
}
|
|
5074
|
-
|
|
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
|
+
}
|
|
5075
6171
|
})({
|
|
5076
6172
|
environments: devServerAPI.environments
|
|
5077
6173
|
})), compilationManager && (middlewares.push(compilationManager.middleware), upgradeEvents.push(compilationManager.socketServer.upgrade), middlewares.push((req, res, next)=>{
|
|
5078
6174
|
var _req_url;
|
|
5079
6175
|
(null == (_req_url = req.url) ? void 0 : _req_url.endsWith('.hot-update.json')) && 'OPTIONS' !== req.method ? (res.statusCode = 404, res.end()) : next();
|
|
5080
6176
|
})), compilationManager && middlewares.push((({ distPath, compilationManager })=>async (req, res, next)=>{
|
|
5081
|
-
if (!maybeHTMLRequest(req)) return next();
|
|
5082
|
-
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)=>{
|
|
5083
6180
|
next(...args);
|
|
5084
|
-
})
|
|
6181
|
+
});
|
|
6182
|
+
};
|
|
5085
6183
|
if (pathname.endsWith('/')) {
|
|
5086
6184
|
let newUrl = `${pathname}index.html`, filePath = external_node_path_default().join(distPath, newUrl);
|
|
5087
|
-
if (await middlewares_isFileExists(filePath, compilationManager.outputFileSystem)) return rewrite(newUrl);
|
|
6185
|
+
if (await middlewares_isFileExists(filePath, compilationManager.outputFileSystem)) return void rewrite(newUrl);
|
|
5088
6186
|
} else if (!external_node_path_default().extname(pathname)) {
|
|
5089
6187
|
let newUrl = `${pathname}.html`, filePath = external_node_path_default().join(distPath, newUrl);
|
|
5090
|
-
if (await middlewares_isFileExists(filePath, compilationManager.outputFileSystem)) return rewrite(newUrl);
|
|
6188
|
+
if (await middlewares_isFileExists(filePath, compilationManager.outputFileSystem)) return void rewrite(newUrl);
|
|
5091
6189
|
}
|
|
5092
6190
|
next();
|
|
5093
6191
|
})({
|
|
@@ -5101,23 +6199,22 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5101
6199
|
middlewares.push(assetMiddleware);
|
|
5102
6200
|
}
|
|
5103
6201
|
for (let callback of postCallbacks)callback();
|
|
5104
|
-
|
|
5105
|
-
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();
|
|
5106
6204
|
let filePath = external_node_path_default().join(distPath, 'index.html');
|
|
5107
6205
|
if (await middlewares_isFileExists(filePath, compilationManager.outputFileSystem)) {
|
|
5108
6206
|
let newUrl = '/index.html';
|
|
5109
|
-
|
|
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;
|
|
5110
6211
|
}
|
|
5111
6212
|
next();
|
|
5112
6213
|
})({
|
|
5113
6214
|
compilationManager,
|
|
5114
6215
|
distPath: context.distPath,
|
|
5115
6216
|
htmlFallback: server.htmlFallback
|
|
5116
|
-
})), server.historyApiFallback) {
|
|
5117
|
-
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);
|
|
5118
|
-
middlewares.push(historyApiFallbackMiddleware), (null == compilationManager ? void 0 : compilationManager.middleware) && middlewares.push(compilationManager.middleware);
|
|
5119
|
-
}
|
|
5120
|
-
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), {
|
|
5121
6218
|
onUpgrade: (...args)=>{
|
|
5122
6219
|
for (let cb of upgradeEvents)cb(...args);
|
|
5123
6220
|
}
|
|
@@ -5130,7 +6227,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5130
6227
|
'sockWrite',
|
|
5131
6228
|
'environments'
|
|
5132
6229
|
]), before = [], after = [];
|
|
5133
|
-
for (let handler of
|
|
6230
|
+
for (let handler of helpers_castArray(setupMiddlewares))handler({
|
|
5134
6231
|
unshift: (...handlers)=>before.unshift(...handlers),
|
|
5135
6232
|
push: (...handlers)=>after.push(...handlers)
|
|
5136
6233
|
}, serverOptions);
|
|
@@ -5324,14 +6421,11 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5324
6421
|
initializeImportMeta: (meta, _)=>{
|
|
5325
6422
|
meta.url = (0, external_node_url_namespaceObject.pathToFileURL)(file.path).href;
|
|
5326
6423
|
},
|
|
5327
|
-
importModuleDynamically: async (specifier, module)=>{
|
|
5328
|
-
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, {
|
|
5329
6425
|
esmMode: type_EsmMode.Evaluated
|
|
5330
|
-
})
|
|
5331
|
-
return await asModule(result, module.context);
|
|
5332
|
-
}
|
|
6426
|
+
}), module.context)
|
|
5333
6427
|
}), esmCache.set(file.path, esm)), context.esmMode === type_EsmMode.Unlinked) ? esm : (async ()=>{
|
|
5334
|
-
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, {
|
|
5335
6429
|
esmMode: type_EsmMode.Unlinked
|
|
5336
6430
|
}), referencingModule.context, !0)), esm.instantiate && esm.instantiate(), await esm.evaluate(), context.esmMode === type_EsmMode.Evaluated) return esm;
|
|
5337
6431
|
let ns = esm.namespace;
|
|
@@ -5466,7 +6560,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5466
6560
|
let { watchFiles } = devConfig;
|
|
5467
6561
|
if (!watchFiles) return;
|
|
5468
6562
|
let watchers = [];
|
|
5469
|
-
for (let { paths, options, type } of
|
|
6563
|
+
for (let { paths, options, type } of helpers_castArray(watchFiles)){
|
|
5470
6564
|
let watchOptions = prepareWatchOptions(paths, options, type), watcher = await startWatchFiles(watchOptions, compilationManager, root);
|
|
5471
6565
|
watcher && watchers.push(watcher);
|
|
5472
6566
|
}
|
|
@@ -5769,13 +6863,9 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5769
6863
|
...'object' == typeof compress ? compress : void 0
|
|
5770
6864
|
}));
|
|
5771
6865
|
}
|
|
5772
|
-
|
|
6866
|
+
base && '/' !== base && this.middlewares.use(getBaseMiddleware({
|
|
5773
6867
|
base
|
|
5774
|
-
})), await this.applyStaticAssetMiddleware(), historyApiFallback)
|
|
5775
|
-
let { default: connectHistoryApiFallback } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/connect-history-api-fallback/index.js")), historyApiFallbackMiddleware = connectHistoryApiFallback(!0 === historyApiFallback ? {} : historyApiFallback);
|
|
5776
|
-
this.middlewares.use(historyApiFallbackMiddleware), await this.applyStaticAssetMiddleware();
|
|
5777
|
-
}
|
|
5778
|
-
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);
|
|
5779
6869
|
}
|
|
5780
6870
|
async applyStaticAssetMiddleware() {
|
|
5781
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, {
|
|
@@ -5896,10 +6986,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5896
6986
|
aggregateTimeout: 0
|
|
5897
6987
|
}), chain.performance.hints(!1), chain.module.parser.merge({
|
|
5898
6988
|
javascript: {
|
|
5899
|
-
exportsPresence: 'error'
|
|
6989
|
+
exportsPresence: 'error',
|
|
6990
|
+
typeReexportsPresence: 'tolerant'
|
|
5900
6991
|
}
|
|
5901
6992
|
}), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), isDev && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)), 'rspack' === api.context.bundlerType && chain.experiments({
|
|
5902
6993
|
...chain.get('experiments'),
|
|
6994
|
+
typeReexportsPresence: !0,
|
|
5903
6995
|
rspackFuture: {
|
|
5904
6996
|
bundlerInfo: {
|
|
5905
6997
|
force: !1
|
|
@@ -5921,7 +7013,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5921
7013
|
entryPoint.add(rest);
|
|
5922
7014
|
} else entryPoint.add(item);
|
|
5923
7015
|
};
|
|
5924
|
-
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);
|
|
5925
7017
|
}
|
|
5926
7018
|
}), api.onBeforeCreateCompiler(({ bundlerConfigs })=>{
|
|
5927
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.`);
|
|
@@ -5992,14 +7084,14 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5992
7084
|
{
|
|
5993
7085
|
name: 'rsbuild:output',
|
|
5994
7086
|
setup (api) {
|
|
5995
|
-
api.modifyBundlerChain(async (chain, { CHAIN_ID, isDev, isProd, isServer, environment })=>{
|
|
7087
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID, isDev, isProd, isServer, environment, rspack })=>{
|
|
5996
7088
|
var jsPath, isServer1, jsAsync;
|
|
5997
7089
|
let { distPath, config } = environment, publicPath = function({ isDev, config, context }) {
|
|
5998
7090
|
var _context_devServer, _context_devServer1, _context_devServer2;
|
|
5999
7091
|
let { dev, output, server } = config, publicPath = DEFAULT_ASSET_PREFIX;
|
|
6000
7092
|
if (isDev) {
|
|
6001
7093
|
if ('string' == typeof dev.assetPrefix) publicPath = dev.assetPrefix;
|
|
6002
|
-
else if (
|
|
7094
|
+
else if (dev.assetPrefix) {
|
|
6003
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;
|
|
6004
7096
|
publicPath = hostname === DEFAULT_DEV_HOST ? `${protocol}://localhost:<port>/` : `${protocol}://${hostname}:<port>/`, server.base && '/' !== server.base && (publicPath = urlJoin(publicPath, server.base));
|
|
6005
7097
|
}
|
|
@@ -6024,7 +7116,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6024
7116
|
let { copy } = config.output, options = Array.isArray(copy) ? {
|
|
6025
7117
|
patterns: copy
|
|
6026
7118
|
} : copy;
|
|
6027
|
-
chain.plugin(CHAIN_ID.PLUGIN.COPY).use(
|
|
7119
|
+
chain.plugin(CHAIN_ID.PLUGIN.COPY).use(rspack.CopyRspackPlugin, [
|
|
6028
7120
|
options
|
|
6029
7121
|
]);
|
|
6030
7122
|
}
|
|
@@ -6086,7 +7178,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6086
7178
|
mergedAlias[pkgName] = pkgPath;
|
|
6087
7179
|
}
|
|
6088
7180
|
for (let name of Object.keys(mergedAlias)){
|
|
6089
|
-
let formattedValues =
|
|
7181
|
+
let formattedValues = helpers_castArray(mergedAlias[name]).map((value)=>'string' == typeof value && value.startsWith('.') ? ensureAbsolutePath(rootPath, value) : value);
|
|
6090
7182
|
chain.resolve.alias.set(name, 1 === formattedValues.length ? formattedValues[0] : formattedValues);
|
|
6091
7183
|
}
|
|
6092
7184
|
}({
|
|
@@ -6285,7 +7377,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6285
7377
|
};
|
|
6286
7378
|
extraDataMap.set(entryName, extraData), templateContent && (extraData.templateContent = templateContent);
|
|
6287
7379
|
let tagConfig = ((config)=>{
|
|
6288
|
-
let tags =
|
|
7380
|
+
let tags = helpers_castArray(config.html.tags).filter(Boolean);
|
|
6289
7381
|
if (tags.length) return {
|
|
6290
7382
|
append: !0,
|
|
6291
7383
|
hash: !1,
|
|
@@ -6362,7 +7454,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6362
7454
|
}, async ({ compilation, environment, sources })=>{
|
|
6363
7455
|
let { config } = environment, { appIcon } = config.html;
|
|
6364
7456
|
if (!appIcon) return;
|
|
6365
|
-
let distDir = config.output.distPath.image, manifestFile = appIcon.filename ?? 'manifest.webmanifest', publicPath = getPublicPathFromCompiler(compilation), icons = appIcon.icons.map((icon)=>((icon, distDir, publicPath)=>{
|
|
7457
|
+
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)=>{
|
|
6366
7458
|
let { src, size } = icon, cached = iconFormatMap.get(src);
|
|
6367
7459
|
if (cached) return cached;
|
|
6368
7460
|
let sizes = `${size}x${size}`;
|
|
@@ -6372,7 +7464,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6372
7464
|
src,
|
|
6373
7465
|
sizes,
|
|
6374
7466
|
isURL: !0,
|
|
6375
|
-
mimeType:
|
|
7467
|
+
mimeType: lookup(src)
|
|
6376
7468
|
};
|
|
6377
7469
|
return iconFormatMap.set(src, formatted), formatted;
|
|
6378
7470
|
}
|
|
@@ -6383,10 +7475,10 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6383
7475
|
isURL: !1,
|
|
6384
7476
|
absolutePath,
|
|
6385
7477
|
relativePath,
|
|
6386
|
-
mimeType:
|
|
7478
|
+
mimeType: lookup(absolutePath)
|
|
6387
7479
|
};
|
|
6388
7480
|
return iconFormatMap.set(src, formatted), formatted;
|
|
6389
|
-
})(icon, distDir, publicPath)), tags = [];
|
|
7481
|
+
})(icon, distDir, publicPath, lookup)), tags = [];
|
|
6390
7482
|
for (let icon of icons){
|
|
6391
7483
|
if ('web-app-manifest' === icon.target && !appIcon.name) {
|
|
6392
7484
|
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"')}.`);
|
|
@@ -6456,15 +7548,13 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
6456
7548
|
{
|
|
6457
7549
|
name: 'rsbuild:wasm',
|
|
6458
7550
|
setup (api) {
|
|
6459
|
-
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment })=>{
|
|
6460
|
-
let { config } = environment, distPath = config.output.distPath.wasm;
|
|
7551
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isProd })=>{
|
|
7552
|
+
let { config } = environment, distPath = config.output.distPath.wasm, filename = external_node_path_namespaceObject.posix.join(distPath, getFilename(config, 'wasm', isProd));
|
|
6461
7553
|
chain.experiments({
|
|
6462
7554
|
...chain.get('experiments'),
|
|
6463
7555
|
asyncWebAssembly: !0
|
|
6464
|
-
})
|
|
6465
|
-
|
|
6466
|
-
chain.output.webassemblyModuleFilename(wasmFilename), chain.module.rule(CHAIN_ID.RULE.WASM).test(/\.wasm$/).dependency('url').type('asset/resource').set('generator', {
|
|
6467
|
-
filename: wasmFilename
|
|
7556
|
+
}), chain.output.webassemblyModuleFilename(filename), chain.module.rule(CHAIN_ID.RULE.WASM).test(/\.wasm$/).dependency('url').type('asset/resource').set('generator', {
|
|
7557
|
+
filename
|
|
6468
7558
|
});
|
|
6469
7559
|
});
|
|
6470
7560
|
}
|
|
@@ -6668,9 +7758,9 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6668
7758
|
name: 'rsbuild:minimize',
|
|
6669
7759
|
setup (api) {
|
|
6670
7760
|
let isRspack = 'rspack' === api.context.bundlerType;
|
|
6671
|
-
api.modifyBundlerChain(async (chain, { environment, CHAIN_ID })=>{
|
|
7761
|
+
api.modifyBundlerChain(async (chain, { environment, CHAIN_ID, rspack })=>{
|
|
6672
7762
|
let { config } = environment, { minifyJs, minifyCss, jsOptions, cssOptions } = parseMinifyOptions(config);
|
|
6673
|
-
if (chain.optimization.minimize(minifyJs || minifyCss), minifyJs && isRspack && chain.optimization.minimizer(CHAIN_ID.MINIMIZER.JS).use(
|
|
7763
|
+
if (chain.optimization.minimize(minifyJs || minifyCss), minifyJs && isRspack && chain.optimization.minimizer(CHAIN_ID.MINIMIZER.JS).use(rspack.SwcJsMinimizerRspackPlugin, [
|
|
6674
7764
|
((config, jsOptions)=>{
|
|
6675
7765
|
let options = {};
|
|
6676
7766
|
options.minimizerOptions ||= {}, options.minimizerOptions.format ||= {};
|
|
@@ -6711,7 +7801,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6711
7801
|
])
|
|
6712
7802
|
}
|
|
6713
7803
|
}, mergedOptions = cssOptions ? cjs_default()(defaultOptions, cssOptions) : defaultOptions;
|
|
6714
|
-
chain.optimization.minimizer(CHAIN_ID.MINIMIZER.CSS).use(
|
|
7804
|
+
chain.optimization.minimizer(CHAIN_ID.MINIMIZER.CSS).use(rspack.LightningCssMinimizerRspackPlugin, [
|
|
6715
7805
|
mergedOptions
|
|
6716
7806
|
]).end();
|
|
6717
7807
|
}
|
|
@@ -6721,11 +7811,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6721
7811
|
{
|
|
6722
7812
|
name: 'rsbuild:progress',
|
|
6723
7813
|
setup (api) {
|
|
6724
|
-
'webpack' !== api.context.bundlerType && api.modifyBundlerChain(async (chain, { CHAIN_ID, environment })=>{
|
|
7814
|
+
'webpack' !== api.context.bundlerType && api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, rspack })=>{
|
|
6725
7815
|
let { config } = environment, options = config.dev.progressBar;
|
|
6726
7816
|
if (!options) return;
|
|
6727
7817
|
let prefix = !0 !== options && void 0 !== options.id ? options.id : environment.name;
|
|
6728
|
-
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(
|
|
7818
|
+
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(rspack.ProgressPlugin, [
|
|
6729
7819
|
{
|
|
6730
7820
|
prefix,
|
|
6731
7821
|
...!0 === options ? {} : options
|
|
@@ -6784,6 +7874,12 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6784
7874
|
isModule: 'unknown',
|
|
6785
7875
|
env: {
|
|
6786
7876
|
targets: browserslist
|
|
7877
|
+
},
|
|
7878
|
+
rspackExperiments: {
|
|
7879
|
+
collectTypeScriptInfo: {
|
|
7880
|
+
typeExports: !0,
|
|
7881
|
+
exportedEnum: !1
|
|
7882
|
+
}
|
|
6787
7883
|
}
|
|
6788
7884
|
};
|
|
6789
7885
|
}({
|
|
@@ -6795,7 +7891,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6795
7891
|
let finalPluginImport = ((options)=>{
|
|
6796
7892
|
if (!options) return [];
|
|
6797
7893
|
let imports = [];
|
|
6798
|
-
for (let item of
|
|
7894
|
+
for (let item of helpers_castArray(options))isFunction(item) ? imports = item(imports) ?? imports : imports.push(item);
|
|
6799
7895
|
return imports;
|
|
6800
7896
|
})(pluginImport);
|
|
6801
7897
|
(null == finalPluginImport ? void 0 : finalPluginImport.length) && (swcConfig.rspackExperiments ??= {}, swcConfig.rspackExperiments.import ??= [], swcConfig.rspackExperiments.import.push(...finalPluginImport));
|
|
@@ -6812,7 +7908,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6812
7908
|
default:
|
|
6813
7909
|
throw Error(`${picocolors_index_js_default().dim('[rsbuild:swc]')} Unknown decorators version: ${picocolors_index_js_default().yellow(version)}`);
|
|
6814
7910
|
}
|
|
6815
|
-
}(swcConfig, config),
|
|
7911
|
+
}(swcConfig, config), helpers_castArray(target1 = target).includes('web') || target1.includes('web-worker')) {
|
|
6816
7912
|
let polyfillMode = config.output.polyfill;
|
|
6817
7913
|
if ('off' === polyfillMode) swcConfig.env.mode = void 0;
|
|
6818
7914
|
else {
|
|
@@ -7033,7 +8129,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7033
8129
|
if (prefetch) {
|
|
7034
8130
|
let options = !0 === prefetch ? {} : prefetch;
|
|
7035
8131
|
excludes.length && (options.exclude = options.exclude ? [
|
|
7036
|
-
...
|
|
8132
|
+
...helpers_castArray(options.exclude),
|
|
7037
8133
|
...excludes
|
|
7038
8134
|
] : excludes), chain.plugin(CHAIN_ID.PLUGIN.HTML_PREFETCH).use(HtmlResourceHintsPlugin, [
|
|
7039
8135
|
options,
|
|
@@ -7044,7 +8140,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7044
8140
|
if (preload) {
|
|
7045
8141
|
let options = !0 === preload ? {} : preload;
|
|
7046
8142
|
excludes.length && (options.exclude = options.exclude ? [
|
|
7047
|
-
...
|
|
8143
|
+
...helpers_castArray(options.exclude),
|
|
7048
8144
|
...excludes
|
|
7049
8145
|
] : excludes), chain.plugin(CHAIN_ID.PLUGIN.HTML_PRELOAD).use(HtmlResourceHintsPlugin, [
|
|
7050
8146
|
options,
|
|
@@ -7246,7 +8342,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7246
8342
|
let { config } = environment;
|
|
7247
8343
|
if (!(null == (_config_moduleFederation = config.moduleFederation) ? void 0 : _config_moduleFederation.options) || 'web' !== target) return;
|
|
7248
8344
|
let { options } = config.moduleFederation;
|
|
7249
|
-
chain.plugin(CHAIN_ID.PLUGIN.MODULE_FEDERATION).use(
|
|
8345
|
+
chain.plugin(CHAIN_ID.PLUGIN.MODULE_FEDERATION).use(rspack_rspack.container.ModuleFederationPlugin, [
|
|
7250
8346
|
options
|
|
7251
8347
|
]), options.name && (options.exposes && chain.plugin('mf-patch-split-chunks').use(PatchSplitChunksPlugin, [
|
|
7252
8348
|
options.name
|
|
@@ -7267,7 +8363,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7267
8363
|
api.onBeforeBuild(({ isFirstCompile })=>{
|
|
7268
8364
|
isFirstCompile && onStart();
|
|
7269
8365
|
}), api.onBeforeStartDevServer(onStart), api.onExit(()=>{
|
|
7270
|
-
traceOutput && (
|
|
8366
|
+
traceOutput && (rspack_rspack.experiments.globalTrace.cleanup(), index_js_namespaceObject.logger.info(`profile file saved to ${picocolors_index_js_default().cyan(traceOutput)}`));
|
|
7271
8367
|
});
|
|
7272
8368
|
}
|
|
7273
8369
|
},
|
|
@@ -7305,7 +8401,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7305
8401
|
{
|
|
7306
8402
|
name: 'rsbuild:sri',
|
|
7307
8403
|
setup (api) {
|
|
7308
|
-
api.modifyBundlerChain((chain, { environment, CHAIN_ID })=>{
|
|
8404
|
+
api.modifyBundlerChain((chain, { environment, CHAIN_ID, rspack })=>{
|
|
7309
8405
|
if ('webpack' === api.context.bundlerType) return;
|
|
7310
8406
|
let { config, htmlPaths } = environment;
|
|
7311
8407
|
if (0 === Object.keys(htmlPaths).length) return;
|
|
@@ -7314,7 +8410,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7314
8410
|
let crossorigin = chain.output.get('crossOriginLoading');
|
|
7315
8411
|
(!1 === crossorigin || void 0 === crossorigin) && chain.output.crossOriginLoading('anonymous');
|
|
7316
8412
|
let { algorithm = 'sha384' } = sri;
|
|
7317
|
-
chain.plugin(CHAIN_ID.PLUGIN.SUBRESOURCE_INTEGRITY).use(
|
|
8413
|
+
chain.plugin(CHAIN_ID.PLUGIN.SUBRESOURCE_INTEGRITY).use(rspack.experiments.SubresourceIntegrityPlugin, [
|
|
7318
8414
|
{
|
|
7319
8415
|
enabled: !0,
|
|
7320
8416
|
hashFuncNames: [
|
|
@@ -7376,7 +8472,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7376
8472
|
...envs.publicVars,
|
|
7377
8473
|
...config.source.define
|
|
7378
8474
|
}, 0 !== envs.filePaths.length && (config.dev ||= {}, config.dev.watchFiles = [
|
|
7379
|
-
...config.dev.watchFiles ?
|
|
8475
|
+
...config.dev.watchFiles ? helpers_castArray(config.dev.watchFiles) : [],
|
|
7380
8476
|
{
|
|
7381
8477
|
paths: envs.filePaths,
|
|
7382
8478
|
type: 'reload-server'
|
|
@@ -7598,42 +8694,60 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7598
8694
|
onAfterStartProdServer: hooks.onAfterStartProdServer.tap,
|
|
7599
8695
|
onBeforeStartProdServer: hooks.onBeforeStartProdServer.tap,
|
|
7600
8696
|
modifyRsbuildConfig: hooks.modifyRsbuildConfig.tap,
|
|
7601
|
-
modifyHTML: (handler)=>
|
|
8697
|
+
modifyHTML: (handler)=>{
|
|
8698
|
+
hooks.modifyHTML.tapEnvironment({
|
|
7602
8699
|
environment,
|
|
7603
8700
|
handler
|
|
7604
|
-
})
|
|
7605
|
-
|
|
8701
|
+
});
|
|
8702
|
+
},
|
|
8703
|
+
modifyHTMLTags: (handler)=>{
|
|
8704
|
+
hooks.modifyHTMLTags.tapEnvironment({
|
|
7606
8705
|
environment,
|
|
7607
8706
|
handler
|
|
7608
|
-
})
|
|
7609
|
-
|
|
8707
|
+
});
|
|
8708
|
+
},
|
|
8709
|
+
modifyBundlerChain: (handler)=>{
|
|
8710
|
+
hooks.modifyBundlerChain.tapEnvironment({
|
|
7610
8711
|
environment,
|
|
7611
8712
|
handler
|
|
7612
|
-
})
|
|
7613
|
-
|
|
8713
|
+
});
|
|
8714
|
+
},
|
|
8715
|
+
modifyRspackConfig: (handler)=>{
|
|
8716
|
+
hooks.modifyRspackConfig.tapEnvironment({
|
|
7614
8717
|
environment,
|
|
7615
8718
|
handler
|
|
7616
|
-
})
|
|
7617
|
-
|
|
8719
|
+
});
|
|
8720
|
+
},
|
|
8721
|
+
modifyWebpackChain: (handler)=>{
|
|
8722
|
+
hooks.modifyWebpackChain.tapEnvironment({
|
|
7618
8723
|
environment,
|
|
7619
8724
|
handler
|
|
7620
|
-
})
|
|
7621
|
-
|
|
8725
|
+
});
|
|
8726
|
+
},
|
|
8727
|
+
modifyWebpackConfig: (handler)=>{
|
|
8728
|
+
hooks.modifyWebpackConfig.tapEnvironment({
|
|
7622
8729
|
environment,
|
|
7623
8730
|
handler
|
|
7624
|
-
})
|
|
7625
|
-
|
|
8731
|
+
});
|
|
8732
|
+
},
|
|
8733
|
+
modifyEnvironmentConfig: (handler)=>{
|
|
8734
|
+
hooks.modifyEnvironmentConfig.tapEnvironment({
|
|
7626
8735
|
environment,
|
|
7627
8736
|
handler
|
|
7628
|
-
})
|
|
7629
|
-
|
|
8737
|
+
});
|
|
8738
|
+
},
|
|
8739
|
+
onAfterEnvironmentCompile: (handler)=>{
|
|
8740
|
+
hooks.onAfterEnvironmentCompile.tapEnvironment({
|
|
7630
8741
|
environment,
|
|
7631
8742
|
handler
|
|
7632
|
-
})
|
|
7633
|
-
|
|
8743
|
+
});
|
|
8744
|
+
},
|
|
8745
|
+
onBeforeEnvironmentCompile: (handler)=>{
|
|
8746
|
+
hooks.onBeforeEnvironmentCompile.tapEnvironment({
|
|
7634
8747
|
environment,
|
|
7635
8748
|
handler
|
|
7636
|
-
})
|
|
8749
|
+
});
|
|
8750
|
+
}
|
|
7637
8751
|
};
|
|
7638
8752
|
};
|
|
7639
8753
|
}({
|
|
@@ -7675,7 +8789,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7675
8789
|
build,
|
|
7676
8790
|
preview,
|
|
7677
8791
|
startDevServer: (...args)=>(context.action = 'dev', process.env.NODE_ENV || setNodeEnv('development'), providerInstance.startDevServer(...args)),
|
|
7678
|
-
createCompiler: (...args)=>(context.action || (context.action = 'development' === process.env.NODE_ENV ? 'dev' : 'build'), providerInstance.createCompiler(...args)),
|
|
8792
|
+
createCompiler: (...args)=>(context.action || (context.action = 'development' === (process.env.NODE_ENV || '') ? 'dev' : 'build'), providerInstance.createCompiler(...args)),
|
|
7679
8793
|
createDevServer: (...args)=>(context.action = 'dev', process.env.NODE_ENV || setNodeEnv('development'), providerInstance.createDevServer(...args)),
|
|
7680
8794
|
...pick(pluginManager, [
|
|
7681
8795
|
'addPlugins',
|
|
@@ -7779,7 +8893,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7779
8893
|
throw index_js_namespaceObject.logger.error(`Failed to load file with jiti: ${picocolors_index_js_default().dim(configFilePath)}`), err;
|
|
7780
8894
|
}
|
|
7781
8895
|
if ('function' == typeof configExport) {
|
|
7782
|
-
let command = process.argv[2], nodeEnv = process.env.NODE_ENV, result = await configExport({
|
|
8896
|
+
let command = process.argv[2], nodeEnv = process.env.NODE_ENV || '', result = await configExport({
|
|
7783
8897
|
env: nodeEnv,
|
|
7784
8898
|
command,
|
|
7785
8899
|
envMode: envMode || nodeEnv,
|
|
@@ -7806,17 +8920,17 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7806
8920
|
loader: commonOpts.configLoader
|
|
7807
8921
|
});
|
|
7808
8922
|
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 = [
|
|
7809
|
-
...config.dev.watchFiles ?
|
|
8923
|
+
...config.dev.watchFiles ? helpers_castArray(config.dev.watchFiles) : [],
|
|
7810
8924
|
{
|
|
7811
8925
|
paths: filePath,
|
|
7812
8926
|
type: 'reload-server'
|
|
7813
8927
|
}
|
|
7814
8928
|
]), config;
|
|
7815
8929
|
};
|
|
7816
|
-
async function
|
|
7817
|
-
|
|
8930
|
+
async function init_init({ cliOptions, isRestart, isBuildWatch = !1 }) {
|
|
8931
|
+
var _commonOpts_environment, cwd, envDir;
|
|
8932
|
+
cliOptions && (commonOpts = cliOptions), commonOpts.environment = null == (_commonOpts_environment = commonOpts.environment) ? void 0 : _commonOpts_environment.flatMap((env)=>env.split(','));
|
|
7818
8933
|
try {
|
|
7819
|
-
var cwd, envDir;
|
|
7820
8934
|
let cwd1 = process.cwd(), root = commonOpts.root ? ensureAbsolutePath(cwd1, commonOpts.root) : cwd1, rsbuild = await createRsbuild({
|
|
7821
8935
|
cwd: root,
|
|
7822
8936
|
rsbuildConfig: ()=>init_loadConfig(root),
|
|
@@ -7831,7 +8945,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7831
8945
|
let files = [], config = rsbuild.getNormalizedConfig();
|
|
7832
8946
|
if (config.dev.watchFiles) for (let watchConfig of config.dev.watchFiles){
|
|
7833
8947
|
if ('reload-server' !== watchConfig.type) continue;
|
|
7834
|
-
let paths =
|
|
8948
|
+
let paths = helpers_castArray(watchConfig.paths);
|
|
7835
8949
|
watchConfig.options ? watchFilesForRestart({
|
|
7836
8950
|
files: paths,
|
|
7837
8951
|
rsbuild,
|
|
@@ -7865,7 +8979,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7865
8979
|
clear,
|
|
7866
8980
|
id: 'server'
|
|
7867
8981
|
});
|
|
7868
|
-
let rsbuild = await
|
|
8982
|
+
let rsbuild = await init_init({
|
|
7869
8983
|
isRestart: !0
|
|
7870
8984
|
});
|
|
7871
8985
|
return !!rsbuild && (await rsbuild.startDevServer(), !0);
|
|
@@ -7875,7 +8989,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7875
8989
|
clear,
|
|
7876
8990
|
id: 'build'
|
|
7877
8991
|
});
|
|
7878
|
-
let rsbuild = await
|
|
8992
|
+
let rsbuild = await init_init({
|
|
7879
8993
|
isRestart: !0,
|
|
7880
8994
|
isBuildWatch: !0
|
|
7881
8995
|
});
|
|
@@ -7920,11 +9034,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7920
9034
|
].includes(level) && (index_js_namespaceObject.logger.level = level);
|
|
7921
9035
|
}
|
|
7922
9036
|
let { npm_execpath } = process.env;
|
|
7923
|
-
(!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.
|
|
9037
|
+
(!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.12\n`);
|
|
7924
9038
|
try {
|
|
7925
9039
|
!function() {
|
|
7926
9040
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
7927
|
-
cli.help(), cli.version("1.4.
|
|
9041
|
+
cli.help(), cli.version("1.4.12"), 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`', {
|
|
7928
9042
|
default: 'jiti'
|
|
7929
9043
|
}).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', {
|
|
7930
9044
|
type: [
|
|
@@ -7935,7 +9049,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7935
9049
|
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');
|
|
7936
9050
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
7937
9051
|
try {
|
|
7938
|
-
let rsbuild = await
|
|
9052
|
+
let rsbuild = await init_init({
|
|
7939
9053
|
cliOptions: options
|
|
7940
9054
|
});
|
|
7941
9055
|
await (null == rsbuild ? void 0 : rsbuild.startDevServer());
|
|
@@ -7944,7 +9058,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7944
9058
|
}
|
|
7945
9059
|
}), buildCommand.option('-w, --watch', 'turn on watch mode, watch for changes and rebuild').action(async (options)=>{
|
|
7946
9060
|
try {
|
|
7947
|
-
let rsbuild = await
|
|
9061
|
+
let rsbuild = await init_init({
|
|
7948
9062
|
cliOptions: options,
|
|
7949
9063
|
isBuildWatch: options.watch
|
|
7950
9064
|
}), buildInstance = await (null == rsbuild ? void 0 : rsbuild.build({
|
|
@@ -7956,7 +9070,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7956
9070
|
}
|
|
7957
9071
|
}), previewCommand.action(async (options)=>{
|
|
7958
9072
|
try {
|
|
7959
|
-
let rsbuild = await
|
|
9073
|
+
let rsbuild = await init_init({
|
|
7960
9074
|
cliOptions: options
|
|
7961
9075
|
});
|
|
7962
9076
|
await (null == rsbuild ? void 0 : rsbuild.preview());
|
|
@@ -7965,7 +9079,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7965
9079
|
}
|
|
7966
9080
|
}), inspectCommand.option('--output <output>', 'specify inspect content output path').option('--verbose', 'show full function definitions in output').action(async (options)=>{
|
|
7967
9081
|
try {
|
|
7968
|
-
let rsbuild = await
|
|
9082
|
+
let rsbuild = await init_init({
|
|
7969
9083
|
cliOptions: options
|
|
7970
9084
|
});
|
|
7971
9085
|
await (null == rsbuild ? void 0 : rsbuild.inspectConfig({
|
|
@@ -7982,7 +9096,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7982
9096
|
index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), index_js_namespaceObject.logger.error(err);
|
|
7983
9097
|
}
|
|
7984
9098
|
}
|
|
7985
|
-
let src_version = "1.4.
|
|
9099
|
+
let src_version = "1.4.12";
|
|
7986
9100
|
})(), 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 === [
|
|
7987
9101
|
"PLUGIN_CSS_NAME",
|
|
7988
9102
|
"PLUGIN_SWC_NAME",
|