@rsbuild/core 2.0.1 → 2.0.3
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 +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/http-proxy-middleware/index.d.ts +77 -1
- package/compiled/http-proxy-middleware/package.json +1 -1
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/lib/postcss.d.ts +5 -0
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/dist/753.js +116 -54
- package/dist/client/hmr.js +3 -1
- package/dist/cssUrlLoader.mjs +38 -0
- package/dist/http-proxy-middleware.js +14 -8
- package/dist/manifest-plugin.js +6 -6
- package/dist-types/configChain.d.ts +3 -0
- package/dist-types/helpers/overlayConfig.d.ts +4 -0
- package/dist-types/index.d.ts +1 -1
- package/dist-types/loader/cssUrlLoader.d.ts +9 -0
- package/dist-types/server/socketServer.d.ts +1 -1
- package/dist-types/types/config.d.ts +29 -23
- package/package.json +3 -3
- package/types.d.ts +4 -1
package/dist/753.js
CHANGED
|
@@ -384,8 +384,8 @@ __webpack_require__.add({
|
|
|
384
384
|
return (asyncHooks.AsyncResource && (res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')), res && res.runInAsyncScope) ? res.runInAsyncScope.bind(res, fn, null) : fn;
|
|
385
385
|
}
|
|
386
386
|
},
|
|
387
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
388
|
-
let yaml, { resolve } = __webpack_require__("node:path?435f"), config = __webpack_require__("../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js"), loadOptions = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
387
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.12_yaml@2.8.2/node_modules/postcss-load-config/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
388
|
+
let yaml, { resolve } = __webpack_require__("node:path?435f"), config = __webpack_require__("../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js"), loadOptions = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.12_yaml@2.8.2/node_modules/postcss-load-config/src/options.js"), loadPlugins = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.12_yaml@2.8.2/node_modules/postcss-load-config/src/plugins.js"), req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.12_yaml@2.8.2/node_modules/postcss-load-config/src/req.js");
|
|
389
389
|
async function processResult(ctx, result) {
|
|
390
390
|
let obj, file = result.filepath || '', projectConfig = ((obj = result.config) && obj.__esModule ? obj : {
|
|
391
391
|
default: obj
|
|
@@ -458,8 +458,8 @@ __webpack_require__.add({
|
|
|
458
458
|
});
|
|
459
459
|
};
|
|
460
460
|
},
|
|
461
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
462
|
-
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
461
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.12_yaml@2.8.2/node_modules/postcss-load-config/src/options.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
462
|
+
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.12_yaml@2.8.2/node_modules/postcss-load-config/src/req.js");
|
|
463
463
|
module.exports = async function options(config, file) {
|
|
464
464
|
if (config.parser && 'string' == typeof config.parser) try {
|
|
465
465
|
config.parser = await req(config.parser, file);
|
|
@@ -479,8 +479,8 @@ __webpack_require__.add({
|
|
|
479
479
|
return config;
|
|
480
480
|
};
|
|
481
481
|
},
|
|
482
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
483
|
-
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
482
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.12_yaml@2.8.2/node_modules/postcss-load-config/src/plugins.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
483
|
+
let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.12_yaml@2.8.2/node_modules/postcss-load-config/src/req.js");
|
|
484
484
|
async function load(plugin, options, file) {
|
|
485
485
|
try {
|
|
486
486
|
if (null == options || 0 === Object.keys(options).length) return await req(plugin, file);
|
|
@@ -496,7 +496,7 @@ __webpack_require__.add({
|
|
|
496
496
|
}), list;
|
|
497
497
|
};
|
|
498
498
|
},
|
|
499
|
-
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
499
|
+
"../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.12_yaml@2.8.2/node_modules/postcss-load-config/src/req.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
500
500
|
let tsx, jiti;
|
|
501
501
|
var __filename = __rspack_fileURLToPath(import.meta.url);
|
|
502
502
|
let { createRequire } = __webpack_require__("node:module?1bcb"), { pathToFileURL } = __webpack_require__("node:url?b4ec"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
|
|
@@ -2829,6 +2829,7 @@ let OVERRIDE_PATHS = new Set([
|
|
|
2829
2829
|
'resolve.conditionNames',
|
|
2830
2830
|
'resolve.mainFields',
|
|
2831
2831
|
'dev.writeToDisk',
|
|
2832
|
+
'dev.client.overlay.errors',
|
|
2832
2833
|
'provider',
|
|
2833
2834
|
'customLogger'
|
|
2834
2835
|
]), mergeConfig_merge = (x, y, path = '')=>{
|
|
@@ -3467,7 +3468,7 @@ function createPublicContext(context) {
|
|
|
3467
3468
|
async function createContext(options, userConfig, logger) {
|
|
3468
3469
|
let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = join(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
3469
3470
|
return {
|
|
3470
|
-
version: "2.0.
|
|
3471
|
+
version: "2.0.3",
|
|
3471
3472
|
rootPath,
|
|
3472
3473
|
distPath: '',
|
|
3473
3474
|
cachePath,
|
|
@@ -3660,6 +3661,7 @@ let configChain_CHAIN_ID = {
|
|
|
3660
3661
|
JS_RAW: 'js-raw',
|
|
3661
3662
|
CSS_MAIN: 'css',
|
|
3662
3663
|
CSS_RAW: 'css-raw',
|
|
3664
|
+
CSS_URL: 'css-url',
|
|
3663
3665
|
CSS_INLINE: 'css-inline',
|
|
3664
3666
|
SVG: 'svg',
|
|
3665
3667
|
SVG_RAW: 'svg-asset-raw',
|
|
@@ -3671,6 +3673,7 @@ let configChain_CHAIN_ID = {
|
|
|
3671
3673
|
USE: {
|
|
3672
3674
|
TS: 'ts',
|
|
3673
3675
|
CSS: 'css',
|
|
3676
|
+
CSS_URL: 'css-url',
|
|
3674
3677
|
SASS: 'sass',
|
|
3675
3678
|
LESS: 'less',
|
|
3676
3679
|
STYLUS: 'stylus',
|
|
@@ -4316,21 +4319,39 @@ let addTrailingSep = (dir)=>dir.endsWith(sep) ? dir : dir + sep, isStrictSubdir
|
|
|
4316
4319
|
...defaultOptions,
|
|
4317
4320
|
...userOptions
|
|
4318
4321
|
};
|
|
4319
|
-
}
|
|
4322
|
+
}, getConsolePureFuncs = (methods)=>methods.map((method)=>`console.${method}`), ALL_CONSOLE_PURE_FUNCS = getConsolePureFuncs([
|
|
4323
|
+
'assert',
|
|
4324
|
+
'clear',
|
|
4325
|
+
'count',
|
|
4326
|
+
'countReset',
|
|
4327
|
+
'debug',
|
|
4328
|
+
'dir',
|
|
4329
|
+
'dirxml',
|
|
4330
|
+
'error',
|
|
4331
|
+
'group',
|
|
4332
|
+
'groupCollapsed',
|
|
4333
|
+
'groupEnd',
|
|
4334
|
+
'info',
|
|
4335
|
+
'log',
|
|
4336
|
+
'profile',
|
|
4337
|
+
'profileEnd',
|
|
4338
|
+
'table',
|
|
4339
|
+
'time',
|
|
4340
|
+
'timeEnd',
|
|
4341
|
+
'timeLog',
|
|
4342
|
+
'timeStamp',
|
|
4343
|
+
'trace',
|
|
4344
|
+
'warn'
|
|
4345
|
+
]);
|
|
4320
4346
|
function getSwcMinimizerOptions(config, jsOptions) {
|
|
4321
4347
|
let options = {};
|
|
4322
4348
|
options.minimizerOptions ||= {}, options.minimizerOptions.format ||= {};
|
|
4323
4349
|
let { removeConsole } = config.performance;
|
|
4324
|
-
if (!0 === removeConsole
|
|
4325
|
-
|
|
4326
|
-
}
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
options.minimizerOptions.compress = {
|
|
4330
|
-
pure_funcs: pureFuncs
|
|
4331
|
-
};
|
|
4332
|
-
}
|
|
4333
|
-
if (config.output.legalComments) switch(config.output.legalComments){
|
|
4350
|
+
if (!0 === removeConsole ? options.minimizerOptions.compress = {
|
|
4351
|
+
pure_funcs: ALL_CONSOLE_PURE_FUNCS
|
|
4352
|
+
} : Array.isArray(removeConsole) && (options.minimizerOptions.compress = {
|
|
4353
|
+
pure_funcs: getConsolePureFuncs(removeConsole)
|
|
4354
|
+
}), config.output.legalComments) switch(config.output.legalComments){
|
|
4334
4355
|
case 'inline':
|
|
4335
4356
|
options.minimizerOptions.format.comments = 'some', options.extractComments = !1;
|
|
4336
4357
|
break;
|
|
@@ -4358,7 +4379,7 @@ function parseMinifyOptions(config) {
|
|
|
4358
4379
|
cssOptions: minify.cssOptions
|
|
4359
4380
|
};
|
|
4360
4381
|
}
|
|
4361
|
-
let postcss_load_config_src = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
4382
|
+
let postcss_load_config_src = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.12_yaml@2.8.2/node_modules/postcss-load-config/src/index.js");
|
|
4362
4383
|
var postcss_load_config_src_default = __webpack_require__.n(postcss_load_config_src);
|
|
4363
4384
|
function getLightningCSSLoaderOptions(config, targets, minify) {
|
|
4364
4385
|
let userOptions = 'object' == typeof config.tools.lightningcssLoader ? config.tools.lightningcssLoader : {}, initialOptions = {
|
|
@@ -5675,6 +5696,7 @@ function applySwcDecoratorConfig(swcConfig, config) {
|
|
|
5675
5696
|
throw Error(`${color.dim('[rsbuild:swc]')} Unknown decorators version: ${color.yellow(version)}`);
|
|
5676
5697
|
}
|
|
5677
5698
|
}
|
|
5699
|
+
let isRuntimeOverlayEnabled = (overlay)=>'object' == typeof overlay && !0 === overlay.runtime;
|
|
5678
5700
|
async function getLocalhostResolvedAddress() {
|
|
5679
5701
|
let { promises: dns } = await import("node:dns"), [defaultLookup, explicitLookup] = await Promise.all([
|
|
5680
5702
|
dns.lookup(LOCALHOST),
|
|
@@ -6022,6 +6044,8 @@ let noop = ()=>{}, normalizeLiveReload = (liveReload)=>'boolean' == typeof liveR
|
|
|
6022
6044
|
html: !1 !== liveReload.html
|
|
6023
6045
|
}, isTsError = (error)=>'message' in error && error.stack?.includes('ts-checker-rspack-plugin');
|
|
6024
6046
|
function applyHMREntry({ config, compiler, token, resolvedHost, resolvedPort }) {
|
|
6047
|
+
var overlay;
|
|
6048
|
+
let overlay1;
|
|
6025
6049
|
if (!((compiler)=>{
|
|
6026
6050
|
let { target } = compiler.options;
|
|
6027
6051
|
return !!target && (Array.isArray(target) ? target.includes('web') : 'web' === target);
|
|
@@ -6031,7 +6055,7 @@ function applyHMREntry({ config, compiler, token, resolvedHost, resolvedPort })
|
|
|
6031
6055
|
};
|
|
6032
6056
|
'<port>' === clientConfig.port && (clientConfig.port = resolvedPort);
|
|
6033
6057
|
let hmrEntry = `import { init } from '${toPosixPath(join(CLIENT_PATH, 'hmr.js'))}';
|
|
6034
|
-
${config.dev.client.overlay ? `import '${toPosixPath(join(CLIENT_PATH, 'overlay.js'))}';` : ''}
|
|
6058
|
+
${!0 === (overlay1 = overlay = config.dev.client.overlay) || 'object' == typeof overlay1 && !1 !== overlay1.errors || isRuntimeOverlayEnabled(overlay) ? `import '${toPosixPath(join(CLIENT_PATH, 'overlay.js'))}';` : ''}
|
|
6035
6059
|
init(
|
|
6036
6060
|
'${token}',
|
|
6037
6061
|
${JSON.stringify(clientConfig)},
|
|
@@ -6201,7 +6225,7 @@ function parseNode(line) {
|
|
|
6201
6225
|
column: parts[4] ? +parts[4] : null
|
|
6202
6226
|
} : null;
|
|
6203
6227
|
}
|
|
6204
|
-
let isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.test(methodName), parseFrame = async (frame, fs, context, cachedTraceMap)=>{
|
|
6228
|
+
let isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.test(methodName), isRspackRuntimeStack = (value)=>!!value && (value.includes('__webpack_require__') || value.startsWith('webpack/runtime/')), parseFrame = async (frame, fs, context, cachedTraceMap)=>{
|
|
6205
6229
|
let { file, column, lineNumber } = frame, sourceMapInfo = await getFileFromUrl(`${file}.map`, fs, context);
|
|
6206
6230
|
if (!sourceMapInfo || 'errorCode' in sourceMapInfo) return;
|
|
6207
6231
|
let { TraceMap, originalPositionFor } = await import("./trace-mapping.js"), sourceMapPath = sourceMapInfo.filename;
|
|
@@ -6245,22 +6269,31 @@ let isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.tes
|
|
|
6245
6269
|
let { file, lineNumber, column } = frame;
|
|
6246
6270
|
if (file) return null !== lineNumber ? null !== column ? `${file}:${lineNumber}:${column}` : `${file}:${lineNumber}` : file;
|
|
6247
6271
|
}, formatFullStack = async (stackFrames, context, fs, cachedTraceMap)=>{
|
|
6248
|
-
let
|
|
6272
|
+
let formattedFrames = [];
|
|
6249
6273
|
for (let frame of stackFrames){
|
|
6250
|
-
let parsedFrame = await parseFrame(frame, fs, context, cachedTraceMap), { methodName } = frame, parts = [];
|
|
6274
|
+
let location, parsedFrame = await parseFrame(frame, fs, context, cachedTraceMap), { methodName } = frame, parts = [];
|
|
6251
6275
|
isValidMethodName(methodName) && parts.push(methodName);
|
|
6252
6276
|
let parsed = !1;
|
|
6253
6277
|
if (parsedFrame) {
|
|
6254
6278
|
let { sourceMapPath, originalPosition } = parsedFrame, originalLocation = formatOriginalLocation(sourceMapPath, originalPosition, context);
|
|
6255
|
-
originalLocation && (parts.push(originalLocation), parsed = !0);
|
|
6279
|
+
originalLocation && (location = originalLocation, parts.push(originalLocation), parsed = !0);
|
|
6256
6280
|
}
|
|
6257
6281
|
if (!parsed && isVerbose(context.logger)) {
|
|
6258
6282
|
let frameString = formatFrameLocation(frame);
|
|
6259
|
-
frameString && parts.push(frameString);
|
|
6283
|
+
frameString && (location = frameString, parts.push(frameString));
|
|
6284
|
+
}
|
|
6285
|
+
let [first, second] = parts;
|
|
6286
|
+
if (first) {
|
|
6287
|
+
let isRspackRuntime = isRspackRuntimeStack(methodName) || isRspackRuntimeStack(location);
|
|
6288
|
+
formattedFrames.push({
|
|
6289
|
+
text: second ? `\n at ${first} (${second})` : `\n at ${first}`,
|
|
6290
|
+
isRspackRuntime,
|
|
6291
|
+
hasLocation: void 0 !== location
|
|
6292
|
+
});
|
|
6260
6293
|
}
|
|
6261
|
-
parts[0] && (result += `\n at ${parts[0]}`), parts[1] && (result += ` (${parts[1]})`);
|
|
6262
6294
|
}
|
|
6263
|
-
|
|
6295
|
+
let shouldFilterRspackRuntime = formattedFrames.some((frame)=>!frame.isRspackRuntime && frame.hasLocation);
|
|
6296
|
+
return formattedFrames.filter((frame)=>!(shouldFilterRspackRuntime && frame.isRspackRuntime)).map((frame)=>frame.text).join('');
|
|
6264
6297
|
}, formatBrowserErrorLog = async (message, context, fs, stackTrace, stackFrames, cachedTraceMap)=>{
|
|
6265
6298
|
var log;
|
|
6266
6299
|
let log1 = color.red(message);
|
|
@@ -6398,7 +6431,12 @@ class SocketServer {
|
|
|
6398
6431
|
});
|
|
6399
6432
|
}
|
|
6400
6433
|
sendError(errors, token) {
|
|
6401
|
-
let { rootPath } = this.context, formattedErrors = errors.map((item)=>formatStatsError(item, rootPath, 'error', this.context.logger)),
|
|
6434
|
+
let { rootPath } = this.context, formattedErrors = errors.map((item)=>formatStatsError(item, rootPath, 'error', this.context.logger)), environment = this.getEnvironmentByToken(token), overlay = environment?.config.dev.client.overlay, overlayErrors = formattedErrors;
|
|
6435
|
+
if (overlay && 'object' == typeof overlay && 'function' == typeof overlay.errors) {
|
|
6436
|
+
let { errors: filter } = overlay;
|
|
6437
|
+
overlayErrors = formattedErrors.filter((error)=>filter(Error(error)));
|
|
6438
|
+
}
|
|
6439
|
+
let html = overlayErrors.map((error)=>convertLinksInHtml(ansiHTML(escapeHtml(error)), rootPath)).join('\n\n').trim();
|
|
6402
6440
|
this.sendMessage({
|
|
6403
6441
|
type: 'errors',
|
|
6404
6442
|
data: {
|
|
@@ -6448,7 +6486,7 @@ class SocketServer {
|
|
|
6448
6486
|
let { browserLogs, client } = environment.config.dev;
|
|
6449
6487
|
if ('client-error' === payload.type && !context.buildState.hasErrors && browserLogs) {
|
|
6450
6488
|
let stackTrace = isObject(browserLogs) && browserLogs.stackTrace || DEFAULT_STACK_TRACE, outputFs = this.getOutputFileSystem(), stackFrames = payload.stack ? stack_trace_parser_esm_parse(payload.stack) : null, cachedTraceMap = new Map(), log = await formatBrowserErrorLog(payload.message, context, outputFs, stackTrace, stackFrames, cachedTraceMap);
|
|
6451
|
-
if (this.reportedBrowserLogs.has(log) || (this.reportedBrowserLogs.add(log), this.context.logger.error(`${color.cyan('[browser]')} ${log}`)),
|
|
6489
|
+
if (this.reportedBrowserLogs.has(log) || (this.reportedBrowserLogs.add(log), this.context.logger.error(`${color.cyan('[browser]')} ${log}`)), isRuntimeOverlayEnabled(client.overlay)) {
|
|
6452
6490
|
let resolvedLog = 'full' === stackTrace ? log : await formatBrowserErrorLog(payload.message, context, outputFs, 'full', stackFrames, cachedTraceMap);
|
|
6453
6491
|
this.sendMessage({
|
|
6454
6492
|
type: 'resolved-client-error',
|
|
@@ -7645,30 +7683,47 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
7645
7683
|
{
|
|
7646
7684
|
name: 'rsbuild:source-map',
|
|
7647
7685
|
setup (api) {
|
|
7686
|
+
let normalizeExtractOptions = (extract = {})=>{
|
|
7687
|
+
let hasLegacyJs = 'js' in extract, hasFlatFields = [
|
|
7688
|
+
'test',
|
|
7689
|
+
'include',
|
|
7690
|
+
'exclude'
|
|
7691
|
+
].some((key)=>void 0 !== extract[key]);
|
|
7692
|
+
if (!1 === extract.js) return !1;
|
|
7693
|
+
if (hasLegacyJs && !hasFlatFields) {
|
|
7694
|
+
var target;
|
|
7695
|
+
let legacyJs = !!(target = extract.js) && (!0 === target ? {} : {
|
|
7696
|
+
include: target.include?.map(normalizeRuleConditionPath),
|
|
7697
|
+
exclude: target.exclude?.map(normalizeRuleConditionPath)
|
|
7698
|
+
});
|
|
7699
|
+
return !!legacyJs && {
|
|
7700
|
+
name: 'source-map-extract-js',
|
|
7701
|
+
test: JS_REGEX,
|
|
7702
|
+
target: legacyJs
|
|
7703
|
+
};
|
|
7704
|
+
}
|
|
7705
|
+
let { test, include, exclude } = extract;
|
|
7706
|
+
return {
|
|
7707
|
+
name: 'source-map-extract',
|
|
7708
|
+
test: test ?? JS_REGEX,
|
|
7709
|
+
target: {
|
|
7710
|
+
include: include?.map(normalizeRuleConditionPath),
|
|
7711
|
+
exclude: exclude?.map(normalizeRuleConditionPath)
|
|
7712
|
+
}
|
|
7713
|
+
};
|
|
7714
|
+
};
|
|
7648
7715
|
api.modifyBundlerChain({
|
|
7649
7716
|
order: 'pre',
|
|
7650
7717
|
handler: (chain, { environment })=>{
|
|
7651
7718
|
let extractConfig = ((config)=>{
|
|
7652
|
-
var target;
|
|
7653
7719
|
let { sourceMap } = config.output;
|
|
7654
|
-
|
|
7655
|
-
if (!0 === sourceMap.extract) return {
|
|
7656
|
-
js: {}
|
|
7657
|
-
};
|
|
7658
|
-
let js = !!(target = sourceMap.extract.js) && (!0 === target ? {} : {
|
|
7659
|
-
include: target.include?.map(normalizeRuleConditionPath),
|
|
7660
|
-
exclude: target.exclude?.map(normalizeRuleConditionPath)
|
|
7661
|
-
});
|
|
7662
|
-
return !!js && {
|
|
7663
|
-
js
|
|
7664
|
-
};
|
|
7720
|
+
return 'object' == typeof sourceMap && !!sourceMap.extract && (!0 === sourceMap.extract ? normalizeExtractOptions() : 'object' == typeof sourceMap.extract && normalizeExtractOptions(sourceMap.extract));
|
|
7665
7721
|
})(environment.config);
|
|
7666
|
-
extractConfig && ((chain,
|
|
7667
|
-
|
|
7668
|
-
let rule = chain.module.rule(name).test(test).set('extractSourceMap', !0), { include, exclude } = target;
|
|
7722
|
+
extractConfig && ((chain, extractConfig)=>{
|
|
7723
|
+
let { name, test, target } = extractConfig, rule = chain.module.rule(name).test(test).set('extractSourceMap', !0), { include, exclude } = target;
|
|
7669
7724
|
if (include) for (let condition of include)rule.include.add(condition);
|
|
7670
7725
|
if (exclude) for (let condition of exclude)rule.exclude.add(condition);
|
|
7671
|
-
})(chain,
|
|
7726
|
+
})(chain, extractConfig);
|
|
7672
7727
|
}
|
|
7673
7728
|
}), api.modifyBundlerChain((chain, { rspack, environment, isDev, target })=>{
|
|
7674
7729
|
let { config } = environment, devtool = ((config)=>{
|
|
@@ -8205,6 +8260,8 @@ try {
|
|
|
8205
8260
|
cssRule.test(CSS_REGEX).dependency({
|
|
8206
8261
|
not: 'url'
|
|
8207
8262
|
});
|
|
8263
|
+
let urlRule = cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_URL).resourceQuery(/^\?url$/);
|
|
8264
|
+
urlRule.use(CHAIN_ID.USE.CSS_URL).loader(node_path.join(dirname, 'cssUrlLoader.mjs'));
|
|
8208
8265
|
let inlineRule = cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_INLINE).resourceQuery(INLINE_QUERY_REGEX);
|
|
8209
8266
|
cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_RAW).type('asset/source').resourceQuery(RAW_QUERY_REGEX);
|
|
8210
8267
|
let mainRule = cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_MAIN), emitCss = config.output.emitCss ?? 'web' === target;
|
|
@@ -8220,7 +8277,7 @@ try {
|
|
|
8220
8277
|
normal: 0,
|
|
8221
8278
|
inline: 0
|
|
8222
8279
|
}, updateRules = (callback, options = {})=>{
|
|
8223
|
-
options.skipMain || callback(mainRule, 'main'), callback(inlineRule, 'inline');
|
|
8280
|
+
options.skipMain || callback(mainRule, 'main'), callback(inlineRule, 'inline'), callback(urlRule, 'url');
|
|
8224
8281
|
}, cssLoaderPath = join(COMPILED_PATH, 'css-loader', 'index.js');
|
|
8225
8282
|
if (updateRules((rule)=>{
|
|
8226
8283
|
rule.use(CHAIN_ID.USE.CSS).loader(cssLoaderPath);
|
|
@@ -8232,7 +8289,7 @@ try {
|
|
|
8232
8289
|
webEnvironment && (browserslist = webEnvironment.browserslist, minifyCss = parseMinifyOptions(webEnvironment.config).minifyCss);
|
|
8233
8290
|
}
|
|
8234
8291
|
updateRules((rule, type)=>{
|
|
8235
|
-
let minify = ('inline' === type || config.output.injectStyles) && minifyCss, lightningcssOptions = getLightningCSSLoaderOptions(config, browserslist, minify);
|
|
8292
|
+
let minify = ('inline' === type || 'url' === type || config.output.injectStyles) && minifyCss, lightningcssOptions = getLightningCSSLoaderOptions(config, browserslist, minify);
|
|
8236
8293
|
rule.use(CHAIN_ID.USE.LIGHTNINGCSS).loader('builtin:lightningcss-loader').options(lightningcssOptions);
|
|
8237
8294
|
}, {
|
|
8238
8295
|
skipMain: !emitCss
|
|
@@ -8289,7 +8346,7 @@ try {
|
|
|
8289
8346
|
});
|
|
8290
8347
|
updateRules((rule, type)=>{
|
|
8291
8348
|
let finalOptions = cssLoaderOptions;
|
|
8292
|
-
finalOptions = 'inline' === type ? {
|
|
8349
|
+
finalOptions = 'inline' === type || 'url' === type ? {
|
|
8293
8350
|
...cssLoaderOptions,
|
|
8294
8351
|
exportType: 'string',
|
|
8295
8352
|
modules: !1,
|
|
@@ -8297,7 +8354,12 @@ try {
|
|
|
8297
8354
|
} : {
|
|
8298
8355
|
...cssLoaderOptions,
|
|
8299
8356
|
importLoaders: importLoaders.normal
|
|
8300
|
-
}, rule.use(CHAIN_ID.USE.CSS).options(finalOptions), rule.sideEffects(!0), rule.resolve.preferRelative(!0);
|
|
8357
|
+
}, rule.use(CHAIN_ID.USE.CSS).options(finalOptions), 'url' !== type && rule.sideEffects(!0), rule.resolve.preferRelative(!0);
|
|
8358
|
+
});
|
|
8359
|
+
let cssUrlFilename = getFilename(config, 'css', isProd), cssUrlPath = config.output.distPath.css;
|
|
8360
|
+
urlRule.use(CHAIN_ID.USE.CSS_URL).options({
|
|
8361
|
+
filename: 'function' == typeof cssUrlFilename ? (pathData, assetInfo)=>posix.join(cssUrlPath, cssUrlFilename(pathData, assetInfo)) : posix.join(cssUrlPath, cssUrlFilename),
|
|
8362
|
+
modules: cssLoaderOptions.modules
|
|
8301
8363
|
});
|
|
8302
8364
|
let isStringExport = 'string' === cssLoaderOptions.exportType;
|
|
8303
8365
|
if (isStringExport && mainRule.uses.has(CHAIN_ID.USE.MINI_CSS_EXTRACT) && mainRule.uses.delete(CHAIN_ID.USE.MINI_CSS_EXTRACT), emitCss && !config.output.injectStyles && !isStringExport) {
|
|
@@ -8680,7 +8742,7 @@ try {
|
|
|
8680
8742
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
|
|
8681
8743
|
let { output: { manifest }, dev: { writeToDisk } } = environment.config;
|
|
8682
8744
|
if (!1 === manifest) return;
|
|
8683
|
-
let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.
|
|
8745
|
+
let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.1/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
|
|
8684
8746
|
manifestFilenames.set(environment.name, manifestOptions.filename);
|
|
8685
8747
|
let pluginOptions = {
|
|
8686
8748
|
fileName: manifestOptions.filename,
|
|
@@ -9194,7 +9256,7 @@ let applyServerOptions = (command)=>{
|
|
|
9194
9256
|
};
|
|
9195
9257
|
function setupCommands() {
|
|
9196
9258
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
9197
|
-
cli.version("2.0.
|
|
9259
|
+
cli.version("2.0.3"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
|
|
9198
9260
|
default: 'auto'
|
|
9199
9261
|
}).option('--env-dir <dir>', 'Set the directory for loading `.env` files').option('--env-mode <mode>', 'Set the env mode to load the `.env.[mode]` file').option('--environment <name>', 'Set the environment name(s) to build', {
|
|
9200
9262
|
type: [
|
|
@@ -9271,7 +9333,7 @@ function initNodeEnv() {
|
|
|
9271
9333
|
}
|
|
9272
9334
|
function showGreeting() {
|
|
9273
9335
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
9274
|
-
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.
|
|
9336
|
+
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.3\n`);
|
|
9275
9337
|
}
|
|
9276
9338
|
function setupLogLevel() {
|
|
9277
9339
|
let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
|
|
@@ -9292,5 +9354,5 @@ function runCLI() {
|
|
|
9292
9354
|
src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
|
|
9293
9355
|
}
|
|
9294
9356
|
}
|
|
9295
|
-
let src_version = "2.0.
|
|
9357
|
+
let src_version = "2.0.3";
|
|
9296
9358
|
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, core_rspack as rspack, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger_createLogger as createLogger, mergeRsbuildConfig, runCLI, src_logger as logger, src_version as version };
|
package/dist/client/hmr.js
CHANGED
|
@@ -74,7 +74,9 @@ function init(token, config, serverHost, serverPort, serverBase, liveReload, bro
|
|
|
74
74
|
clearBuildErrors();
|
|
75
75
|
hasBuildErrors = true;
|
|
76
76
|
for (const error of text)logger.error(error);
|
|
77
|
-
|
|
77
|
+
const { overlay } = config;
|
|
78
|
+
if (createOverlay && (true === overlay || 'object' == typeof overlay && false !== overlay.errors)) if (html) createOverlay('Build failed', html);
|
|
79
|
+
else null == clearOverlay || clearOverlay();
|
|
78
80
|
}
|
|
79
81
|
function handleResolvedClientError({ id, message }) {
|
|
80
82
|
if (!createOverlay || hasBuildErrors) return;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import node_path from "node:path";
|
|
2
|
+
let CSS_MODULE_REGEX = /\.module\.\w+$/i, HASH_PLACEHOLDER_REGEX = /\[(?:[^:\]]+:)?(?:chunkhash|contenthash|hash|fullhash)(?::[^\]]+)?]/i, getRelativePath = (root, resourcePath)=>{
|
|
3
|
+
let relativePath = node_path.relative(root, resourcePath);
|
|
4
|
+
if (relativePath && !('..' === relativePath || relativePath.startsWith(`..${node_path.sep}`)) && !node_path.isAbsolute(relativePath)) return relativePath.replace(/\\/g, '/');
|
|
5
|
+
}, pitch = async function(remainingRequest) {
|
|
6
|
+
let root, resourcePath, nameSource, hash, options = this.getOptions();
|
|
7
|
+
if (((modules, resourcePath, resourceQuery, resourceFragment)=>{
|
|
8
|
+
if (!modules) return !1;
|
|
9
|
+
if (!0 === modules || 'string' == typeof modules) return !0;
|
|
10
|
+
let { auto } = modules;
|
|
11
|
+
return !1 !== auto && (auto instanceof RegExp ? auto.test(resourcePath) : 'function' == typeof auto ? auto(resourcePath, resourceQuery, resourceFragment) : CSS_MODULE_REGEX.test(resourcePath));
|
|
12
|
+
})(options.modules, this.resourcePath, this.resourceQuery, this.resourceFragment)) throw Error('[rsbuild:css] CSS Modules do not support the ?url query. Use ?inline to import the compiled CSS content as a string.');
|
|
13
|
+
let content = ((moduleExports)=>{
|
|
14
|
+
let content = moduleExports && 'object' == typeof moduleExports && 'default' in moduleExports ? moduleExports.default : moduleExports;
|
|
15
|
+
if ('string' != typeof content) throw Error('[rsbuild:css] Expected CSS ?url imports to export a string.');
|
|
16
|
+
return content;
|
|
17
|
+
})(await this.importModule(`!!${remainingRequest}`)), ext = node_path.extname(this.resourcePath), sourceFilename = node_path.relative(this.rootContext, this.resourcePath).replace(/\\/g, '/'), name = (root = this.rootContext, resourcePath = this.resourcePath, nameSource = getRelativePath(node_path.join(root, 'src'), resourcePath) ?? getRelativePath(root, resourcePath) ?? node_path.basename(resourcePath), ext ? nameSource.slice(0, -ext.length) : nameSource), contentHash = ((hash = this.utils.createHash(this._compilation.outputOptions.hashFunction)).update(Buffer.from(content)), hash.digest(this._compilation.outputOptions.hashDigest || 'hex')), pathData = {
|
|
18
|
+
contentHash,
|
|
19
|
+
chunk: {
|
|
20
|
+
name,
|
|
21
|
+
hash: contentHash,
|
|
22
|
+
contentHash: {
|
|
23
|
+
css: contentHash
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}, assetInfo = {
|
|
27
|
+
sourceFilename
|
|
28
|
+
}, filenameTemplate = 'function' == typeof options.filename ? options.filename(pathData, assetInfo) : options.filename, { path: filename, info } = this._compilation.getAssetPathWithInfo(filenameTemplate, pathData);
|
|
29
|
+
return this.emitFile(filename, content, void 0, {
|
|
30
|
+
...info,
|
|
31
|
+
...assetInfo,
|
|
32
|
+
immutable: info.immutable || HASH_PLACEHOLDER_REGEX.test(filenameTemplate)
|
|
33
|
+
}), `export default __webpack_public_path__ + ${JSON.stringify(filename)};`;
|
|
34
|
+
};
|
|
35
|
+
export default function(source) {
|
|
36
|
+
return source;
|
|
37
|
+
};
|
|
38
|
+
export { pitch };
|
|
@@ -6,6 +6,7 @@ import { EventEmitter } from "node:events";
|
|
|
6
6
|
import "node:net";
|
|
7
7
|
import "node:stream";
|
|
8
8
|
import { URL as external_node_url_URL } from "node:url";
|
|
9
|
+
import { URL as external_url_URL } from "url";
|
|
9
10
|
import "node:zlib";
|
|
10
11
|
import "node:querystring";
|
|
11
12
|
import { __webpack_require__ } from "./1~rslib-runtime.js";
|
|
@@ -2657,6 +2658,10 @@ let errorResponsePlugin = (proxyServer, options)=>{
|
|
|
2657
2658
|
warn: ()=>{},
|
|
2658
2659
|
error: ()=>{}
|
|
2659
2660
|
};
|
|
2661
|
+
function createUrl({ protocol, host, port, path }) {
|
|
2662
|
+
let ipv6Host = host?.includes(':') ? `[${host}]` : host, url = new external_url_URL(`${protocol || 'undefined:'}//${ipv6Host || '[::]'}`);
|
|
2663
|
+
return port && (url.port = port), path && (url.pathname = path), url;
|
|
2664
|
+
}
|
|
2660
2665
|
function logger_plugin_getPort(sockets) {
|
|
2661
2666
|
return Object.keys(sockets || {})?.[0]?.split(':')[1];
|
|
2662
2667
|
}
|
|
@@ -2668,14 +2673,15 @@ let loggerPlugin = (proxyServer, options)=>{
|
|
|
2668
2673
|
}), proxyServer.on('proxyRes', (proxyRes, req, res)=>{
|
|
2669
2674
|
let target, originalUrl = req.originalUrl ?? `${req.baseUrl || ''}${req.url}`;
|
|
2670
2675
|
try {
|
|
2671
|
-
let port = logger_plugin_getPort(proxyRes.req?.agent?.sockets),
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2676
|
+
let port = logger_plugin_getPort(proxyRes.req?.agent?.sockets), { protocol, host, path } = proxyRes.req;
|
|
2677
|
+
target = createUrl({
|
|
2678
|
+
protocol,
|
|
2679
|
+
host,
|
|
2680
|
+
port,
|
|
2681
|
+
path
|
|
2682
|
+
});
|
|
2677
2683
|
} catch (err) {
|
|
2678
|
-
(target = new external_node_url_URL(options.target)).pathname = proxyRes.req.path;
|
|
2684
|
+
console.error('[HPM] Unexpected error while creating target URL', err), (target = new external_node_url_URL(options.target)).pathname = proxyRes.req.path;
|
|
2679
2685
|
}
|
|
2680
2686
|
let targetUrl = target.toString(), exchange = `[HPM] ${req.method} ${originalUrl} -> ${targetUrl} [${proxyRes.statusCode}]`;
|
|
2681
2687
|
logger.info(exchange);
|
|
@@ -2899,7 +2905,7 @@ class HttpProxyMiddleware {
|
|
|
2899
2905
|
options.router && (newTarget = await getTarget(req, options)) && (Debug('router new target: "%s"', newTarget), options.target = newTarget);
|
|
2900
2906
|
};
|
|
2901
2907
|
applyPathRewrite = async (req, pathRewriter)=>{
|
|
2902
|
-
if (pathRewriter) {
|
|
2908
|
+
if (req.url && pathRewriter) {
|
|
2903
2909
|
let path = await pathRewriter(req.url, req);
|
|
2904
2910
|
'string' == typeof path ? (Debug('pathRewrite new path: %s', path), req.url = path) : Debug('pathRewrite: no rewritten path found: %s', req.url);
|
|
2905
2911
|
}
|
package/dist/manifest-plugin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __webpack_require__ } from "./1~rslib-runtime.js";
|
|
2
2
|
import "./753.js";
|
|
3
3
|
__webpack_require__.add({
|
|
4
|
-
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.
|
|
4
|
+
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.1/node_modules/rspack-manifest-plugin/dist/helpers.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
5
5
|
exports.transformFiles = exports.reduceChunk = exports.reduceAssets = exports.generateManifest = void 0;
|
|
6
6
|
let node_path_1 = __webpack_require__("node:path?435f");
|
|
7
7
|
exports.generateManifest = (compilation, files, { generate, seed = {} })=>generate ? generate(seed, files, Array.from(compilation.entrypoints.entries()).reduce((e, [name, entrypoint])=>Object.assign(e, {
|
|
@@ -61,9 +61,9 @@ __webpack_require__.add({
|
|
|
61
61
|
'sort'
|
|
62
62
|
].filter((fname)=>!!options[fname]).reduce((prev, fname)=>prev[fname](options[fname]), files).map(standardizeFilePaths);
|
|
63
63
|
},
|
|
64
|
-
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.
|
|
64
|
+
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.1/node_modules/rspack-manifest-plugin/dist/hooks.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
65
65
|
exports.getCompilerHooks = exports.emitHook = exports.beforeRunHook = void 0;
|
|
66
|
-
let node_fs_1 = __webpack_require__("node:fs?9592"), node_path_1 = __webpack_require__("node:path?435f"), lite_tapable_1 = __webpack_require__("../../node_modules/.pnpm/@rspack+lite-tapable@1.1.0/node_modules/@rspack/lite-tapable/dist/index.cjs"), helpers_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.
|
|
66
|
+
let node_fs_1 = __webpack_require__("node:fs?9592"), node_path_1 = __webpack_require__("node:path?435f"), lite_tapable_1 = __webpack_require__("../../node_modules/.pnpm/@rspack+lite-tapable@1.1.0/node_modules/@rspack/lite-tapable/dist/index.cjs"), helpers_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.1/node_modules/rspack-manifest-plugin/dist/helpers.js"), compilerHookMap = new WeakMap(), getCompilerHooks = (compiler)=>{
|
|
67
67
|
let hooks = compilerHookMap.get(compiler);
|
|
68
68
|
return void 0 === hooks && (hooks = {
|
|
69
69
|
afterEmit: new lite_tapable_1.SyncWaterfallHook([
|
|
@@ -112,9 +112,9 @@ __webpack_require__.add({
|
|
|
112
112
|
getCompilerHooks(compiler).afterEmit.call(manifest);
|
|
113
113
|
};
|
|
114
114
|
},
|
|
115
|
-
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.
|
|
115
|
+
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.1/node_modules/rspack-manifest-plugin/dist/index.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
116
116
|
exports.RspackManifestPlugin = void 0;
|
|
117
|
-
let node_path_1 = __webpack_require__("node:path?435f"), hooks_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.
|
|
117
|
+
let node_path_1 = __webpack_require__("node:path?435f"), hooks_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.1/node_modules/rspack-manifest-plugin/dist/hooks.js"), emitCountMap = new Map(), defaults = {
|
|
118
118
|
assetHookStage: 1 / 0,
|
|
119
119
|
basePath: '',
|
|
120
120
|
fileName: 'manifest.json',
|
|
@@ -683,5 +683,5 @@ __webpack_require__.add({
|
|
|
683
683
|
});
|
|
684
684
|
}
|
|
685
685
|
});
|
|
686
|
-
var RspackManifestPlugin = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.
|
|
686
|
+
var RspackManifestPlugin = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.1/node_modules/rspack-manifest-plugin/dist/index.js").RspackManifestPlugin;
|
|
687
687
|
export { RspackManifestPlugin };
|
|
@@ -45,6 +45,7 @@ export declare const CHAIN_ID: {
|
|
|
45
45
|
/** CSS oneOf rules */
|
|
46
46
|
readonly CSS_MAIN: 'css';
|
|
47
47
|
readonly CSS_RAW: 'css-raw';
|
|
48
|
+
readonly CSS_URL: 'css-url';
|
|
48
49
|
readonly CSS_INLINE: 'css-inline';
|
|
49
50
|
/** SVG oneOf rules */
|
|
50
51
|
readonly SVG: 'svg';
|
|
@@ -60,6 +61,8 @@ export declare const CHAIN_ID: {
|
|
|
60
61
|
readonly TS: 'ts';
|
|
61
62
|
/** css-loader */
|
|
62
63
|
readonly CSS: 'css';
|
|
64
|
+
/** CSS URL loader */
|
|
65
|
+
readonly CSS_URL: 'css-url';
|
|
63
66
|
/** sass-loader */
|
|
64
67
|
readonly SASS: 'sass';
|
|
65
68
|
/** less-loader */
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ClientConfig } from '../types';
|
|
2
|
+
export declare const isBuildOverlayEnabled: (overlay: ClientConfig['overlay']) => boolean;
|
|
3
|
+
export declare const isRuntimeOverlayEnabled: (overlay: ClientConfig['overlay']) => boolean;
|
|
4
|
+
export declare const isOverlayEnabled: (overlay: ClientConfig['overlay']) => boolean;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -20,4 +20,4 @@ export { mergeRsbuildConfig } from './mergeConfig';
|
|
|
20
20
|
export type { RsbuildDevServer } from './server/devServer';
|
|
21
21
|
export type { RsbuildServerBase, ServerStartResult, StartDevServerResult, StartPreviewServerResult, } from './server/helper';
|
|
22
22
|
export type { RsbuildPreviewServer } from './server/previewServer';
|
|
23
|
-
export type { AliasStrategy, AppIcon, AppIconItem, Build, BuildOptions, BuildResult, Charset, CleanDistPath, CleanDistPathObject, ClientConfig, CliShortcut, CompressOptions, ConfigChain, ConfigChainWithContext, Connect, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentConfig, EnvironmentContext, FilenameConfig, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlBasicTag, HtmlConfig, HtmlFallback, HtmlRspackPlugin, HtmlTag, HtmlTagContext, HtmlTagDescriptor, HtmlTagHandler, InitConfigsOptions, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InspectConfigOptions, InspectConfigResult, InternalContext, LegalComments, LogLevel, ManifestConfig, ManifestData, ManifestObjectConfig, MergedEnvironmentConfig, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyEnvironmentConfigUtils, ModifyHTMLContext, ModifyHTMLFn, ModifyHTMLTagsContext, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRsbuildConfigUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedResolveConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedSplitChunksConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterDevCompileFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartPreviewServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDevCompileFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartPreviewServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSOptions, PostCSSPlugin, PreconnectOption, PreviewOptions, PrintUrls, ProcessAssetsDescriptor, ProcessAssetsHandler, ProcessAssetsHook, ProgressBarConfig, ProxyBypass, ProxyConfig, ProxyFilter, ProxyOptions, PublicDir, PublicDirOptions, RequestHandler, ResolveConfig, ResolvedCreateRsbuildOptions, ResolveHandler, ResolveHook, ResourceHintsIncludeType, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerConfig, SetupMiddlewaresContext, SetupMiddlewaresFn, SourceConfig, SourceMap, SourceMapExtract, SourceMapExtractTarget, SplitChunks, SplitChunksConfig, SplitChunksPreset, SriAlgorithm, SriOptions, StartDevServerOptions, StyleLoaderOptions, ToolsConfig, TransformContext, TransformDescriptor, TransformHandler, TransformHook, TransformImport, WatchFiles, } from './types';
|
|
23
|
+
export type { AliasStrategy, AppIcon, AppIconItem, Build, BuildOptions, BuildResult, Charset, CleanDistPath, CleanDistPathObject, ClientConfig, CliShortcut, CompressOptions, ConfigChain, ConfigChainWithContext, Connect, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentConfig, EnvironmentContext, FilenameConfig, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlBasicTag, HtmlConfig, HtmlFallback, HtmlRspackPlugin, HtmlTag, HtmlTagContext, HtmlTagDescriptor, HtmlTagHandler, InitConfigsOptions, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InspectConfigOptions, InspectConfigResult, InternalContext, LegalComments, LogLevel, ManifestConfig, ManifestData, ManifestObjectConfig, MergedEnvironmentConfig, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyEnvironmentConfigUtils, ModifyHTMLContext, ModifyHTMLFn, ModifyHTMLTagsContext, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRsbuildConfigUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedResolveConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedSplitChunksConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterDevCompileFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartPreviewServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDevCompileFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartPreviewServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OverlayOptions, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSOptions, PostCSSPlugin, PreconnectOption, PreviewOptions, PrintUrls, ProcessAssetsDescriptor, ProcessAssetsHandler, ProcessAssetsHook, ProgressBarConfig, ProxyBypass, ProxyConfig, ProxyFilter, ProxyOptions, PublicDir, PublicDirOptions, RequestHandler, ResolveConfig, ResolvedCreateRsbuildOptions, ResolveHandler, ResolveHook, ResourceHintsIncludeType, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerConfig, SetupMiddlewaresContext, SetupMiddlewaresFn, SourceConfig, SourceMap, SourceMapExtract, SourceMapExtractOptions, SourceMapExtractTarget, SplitChunks, SplitChunksConfig, SplitChunksPreset, SriAlgorithm, SriOptions, StartDevServerOptions, StyleLoaderOptions, ToolsConfig, TransformContext, TransformDescriptor, TransformHandler, TransformHook, TransformImport, WatchFiles, } from './types';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AssetInfo, LoaderDefinitionFunction, PathData, PitchLoaderDefinitionFunction } from '@rspack/core';
|
|
2
|
+
import type { CSSLoaderOptions } from '../types';
|
|
3
|
+
type CSSUrlLoaderOptions = {
|
|
4
|
+
filename: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
|
5
|
+
modules: CSSLoaderOptions['modules'];
|
|
6
|
+
};
|
|
7
|
+
declare const cssUrlLoader: LoaderDefinitionFunction<CSSUrlLoaderOptions>;
|
|
8
|
+
export declare const pitch: PitchLoaderDefinitionFunction<CSSUrlLoaderOptions>;
|
|
9
|
+
export default cssUrlLoader;
|
|
@@ -78,7 +78,7 @@ export declare class SocketServer {
|
|
|
78
78
|
prepare(): Promise<void>;
|
|
79
79
|
onBuildDone(): void;
|
|
80
80
|
/**
|
|
81
|
-
* Send error messages to the client
|
|
81
|
+
* Send error messages to the client.
|
|
82
82
|
*/
|
|
83
83
|
sendError(errors: Rspack.StatsError[], token: string): void;
|
|
84
84
|
/**
|