@rsbuild/core 2.0.14 → 2.1.0-beta.0
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/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-chain/types/index.d.ts +30 -7
- package/dist/349.js +10 -0
- package/dist/756.js +87 -58
- package/dist/cssUrlLoader.mjs +3 -7
- package/dist/http-proxy-middleware.js +3 -2
- package/dist/ignoreCssLoader.mjs +7 -1
- package/dist/memfs.js +104 -100
- package/dist/{manifest-plugin.js → rspack-manifest-plugin.js} +6 -6
- package/dist/transformLoader.mjs +6 -9
- package/dist-types/helpers/css.d.ts +3 -0
- package/dist-types/loader/ignoreCssLoader.d.ts +9 -2
- package/dist-types/server/cliShortcuts.d.ts +5 -1
- package/dist-types/server/helper.d.ts +3 -2
- package/dist-types/types/config.d.ts +10 -3
- package/package.json +7 -7
- /package/dist/{sirv.js → build.js} +0 -0
- /package/dist/{ws.js → wrapper.js} +0 -0
package/dist/756.js
CHANGED
|
@@ -84,23 +84,24 @@ __webpack_require__.add({
|
|
|
84
84
|
}, {});
|
|
85
85
|
}, module.exports = deepmerge;
|
|
86
86
|
},
|
|
87
|
-
"../../node_modules/.pnpm/dotenv-expand@13.0.
|
|
87
|
+
"../../node_modules/.pnpm/dotenv-expand@13.0.0_patch_hash=5ff37847fa487be2db4e4f14c2b21937f4e51cc7a43deea4506d4aaf3fa6149c/node_modules/dotenv-expand/lib/main.js" (module) {
|
|
88
88
|
function _resolveEscapeSequences(value) {
|
|
89
89
|
return value.replace(/\\\$/g, '$');
|
|
90
90
|
}
|
|
91
|
+
let propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
92
|
+
function getEnvValue(key, processEnv, runningParsed) {
|
|
93
|
+
return propertyIsEnumerable.call(processEnv, key) ? processEnv[key] : runningParsed[key];
|
|
94
|
+
}
|
|
91
95
|
function expandValue(value, processEnv, runningParsed) {
|
|
92
|
-
let match,
|
|
93
|
-
...runningParsed,
|
|
94
|
-
...processEnv
|
|
95
|
-
}, regex = /(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g, result = value, seen = new Set();
|
|
96
|
+
let match, regex = /(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g, result = value, seen = new Set();
|
|
96
97
|
for(; null !== (match = regex.exec(result));){
|
|
97
98
|
let defaultValue, value;
|
|
98
99
|
seen.add(result);
|
|
99
|
-
let [template, bracedExpression, unbracedExpression] = match, expression = bracedExpression || unbracedExpression, opRegex = /(:\+|\+|:-|-)/, opMatch = expression.match(opRegex), splitter = opMatch ? opMatch[0] : null, r = expression.split(splitter), key = r.shift();
|
|
100
|
+
let [template, bracedExpression, unbracedExpression] = match, expression = bracedExpression || unbracedExpression, opRegex = /(:\+|\+|:-|-)/, opMatch = expression.match(opRegex), splitter = opMatch ? opMatch[0] : null, r = expression.split(splitter), key = r.shift(), envValue = getEnvValue(key, processEnv, runningParsed);
|
|
100
101
|
if ([
|
|
101
102
|
':+',
|
|
102
103
|
'+'
|
|
103
|
-
].includes(splitter) ? (defaultValue =
|
|
104
|
+
].includes(splitter) ? (defaultValue = envValue ? r.join(splitter) : '', value = null) : (defaultValue = r.join(splitter), value = envValue), (result = value ? seen.has(value) ? result.replace(template, defaultValue) : result.replace(template, value) : result.replace(template, defaultValue)) === runningParsed[key]) break;
|
|
104
105
|
regex.lastIndex = 0;
|
|
105
106
|
}
|
|
106
107
|
return result;
|
|
@@ -1788,6 +1789,8 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
|
|
|
1788
1789
|
this[key] = new ChainedSet(this);
|
|
1789
1790
|
}), this.extend([
|
|
1790
1791
|
'enforceExtension',
|
|
1792
|
+
'fullySpecified',
|
|
1793
|
+
'pnp',
|
|
1791
1794
|
'symlinks',
|
|
1792
1795
|
'preferRelative',
|
|
1793
1796
|
'preferAbsolute',
|
|
@@ -1846,6 +1849,7 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
|
|
|
1846
1849
|
constructor(parent){
|
|
1847
1850
|
super(parent), this.extend([
|
|
1848
1851
|
'assetModuleFilename',
|
|
1852
|
+
'asyncChunks',
|
|
1849
1853
|
'bundlerInfo',
|
|
1850
1854
|
'chunkFilename',
|
|
1851
1855
|
'chunkLoadTimeout',
|
|
@@ -1854,6 +1858,8 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
|
|
|
1854
1858
|
'chunkFormat',
|
|
1855
1859
|
'enabledChunkLoadingTypes',
|
|
1856
1860
|
'crossOriginLoading',
|
|
1861
|
+
'cssChunkFilename',
|
|
1862
|
+
'cssFilename',
|
|
1857
1863
|
'devtoolFallbackModuleFilenameTemplate',
|
|
1858
1864
|
'devtoolModuleFilenameTemplate',
|
|
1859
1865
|
'devtoolNamespace',
|
|
@@ -1869,6 +1875,7 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
|
|
|
1869
1875
|
'hotUpdateMainFilename',
|
|
1870
1876
|
'library',
|
|
1871
1877
|
'importFunctionName',
|
|
1878
|
+
'importMetaName',
|
|
1872
1879
|
'path',
|
|
1873
1880
|
'pathinfo',
|
|
1874
1881
|
'publicPath',
|
|
@@ -1876,7 +1883,10 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
|
|
|
1876
1883
|
'sourceMapFilename',
|
|
1877
1884
|
'strictModuleErrorHandling',
|
|
1878
1885
|
'strictModuleExceptionHandling',
|
|
1886
|
+
'trustedTypes',
|
|
1879
1887
|
'workerChunkLoading',
|
|
1888
|
+
'workerPublicPath',
|
|
1889
|
+
'workerWasmLoading',
|
|
1880
1890
|
'enabledLibraryTypes',
|
|
1881
1891
|
'environment',
|
|
1882
1892
|
'compareBeforeEmit',
|
|
@@ -1983,6 +1993,7 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
|
|
|
1983
1993
|
}), Use = Orderable(class extends ChainedMap {
|
|
1984
1994
|
constructor(parent, name){
|
|
1985
1995
|
super(parent), this.name = name, this.extend([
|
|
1996
|
+
'ident',
|
|
1986
1997
|
'loader',
|
|
1987
1998
|
'options',
|
|
1988
1999
|
'parallel'
|
|
@@ -2023,20 +2034,22 @@ let Rule = Orderable(class extends ChainedMap {
|
|
|
2023
2034
|
super(parent), this.ruleName = name, this.names = [], this.ruleType = ruleType, this.ruleTypes = [];
|
|
2024
2035
|
let rule = this;
|
|
2025
2036
|
for(; rule instanceof Rule;)this.names.unshift(rule.ruleName), this.ruleTypes.unshift(rule.ruleType), rule = rule.parent;
|
|
2026
|
-
this.uses = new ChainedMap(this), this.include = new ChainedSet(this), this.exclude = new ChainedSet(this), this.rules = new ChainedMap(this), this.oneOfs = new ChainedMap(this), this.resolve = new Resolve(this), this.
|
|
2027
|
-
'fullySpecified'
|
|
2028
|
-
]), this.extend([
|
|
2037
|
+
this.uses = new ChainedMap(this), this.include = new ChainedSet(this), this.exclude = new ChainedSet(this), this.rules = new ChainedMap(this), this.oneOfs = new ChainedMap(this), this.resolve = new Resolve(this), this.extend([
|
|
2029
2038
|
'dependency',
|
|
2039
|
+
"descriptionData",
|
|
2030
2040
|
'enforce',
|
|
2041
|
+
'extractSourceMap',
|
|
2031
2042
|
'issuer',
|
|
2032
2043
|
'issuerLayer',
|
|
2033
2044
|
'layer',
|
|
2034
2045
|
'mimetype',
|
|
2046
|
+
'phase',
|
|
2035
2047
|
'parser',
|
|
2036
2048
|
'generator',
|
|
2037
2049
|
'resource',
|
|
2038
2050
|
'resourceFragment',
|
|
2039
2051
|
'resourceQuery',
|
|
2052
|
+
'scheme',
|
|
2040
2053
|
'sideEffects',
|
|
2041
2054
|
'with',
|
|
2042
2055
|
'test',
|
|
@@ -2182,12 +2195,13 @@ class RspackChain extends ChainedMap {
|
|
|
2182
2195
|
'bail',
|
|
2183
2196
|
'cache',
|
|
2184
2197
|
'dependencies',
|
|
2198
|
+
'extends',
|
|
2185
2199
|
'ignoreWarnings',
|
|
2186
2200
|
'loader',
|
|
2187
2201
|
'name',
|
|
2188
2202
|
'infrastructureLogging',
|
|
2189
|
-
'
|
|
2190
|
-
'
|
|
2203
|
+
'lazyCompilation',
|
|
2204
|
+
'incremental'
|
|
2191
2205
|
]);
|
|
2192
2206
|
}
|
|
2193
2207
|
static toString(config, { verbose = !1, configPrefix = 'config' } = {}) {
|
|
@@ -3483,7 +3497,7 @@ function createPublicContext(context) {
|
|
|
3483
3497
|
async function createContext(options, userConfig, logger) {
|
|
3484
3498
|
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;
|
|
3485
3499
|
return {
|
|
3486
|
-
version: "2.0.
|
|
3500
|
+
version: "2.1.0-beta.0",
|
|
3487
3501
|
rootPath,
|
|
3488
3502
|
distPath: '',
|
|
3489
3503
|
cachePath,
|
|
@@ -4136,18 +4150,15 @@ async function createCompiler_createCompiler(options) {
|
|
|
4136
4150
|
let { name } = context.environmentList[index], time = Date.now() - startTime;
|
|
4137
4151
|
context.buildState.time[name] = time;
|
|
4138
4152
|
let suffix = isMultiCompiler ? color.dim(` (${name})`) : '', timeStr = `${((seconds)=>{
|
|
4139
|
-
let time,
|
|
4153
|
+
let format = (time, unit)=>color.bold(`${time}${unit}`);
|
|
4140
4154
|
if (seconds < 10) {
|
|
4141
|
-
let
|
|
4142
|
-
return
|
|
4143
|
-
}
|
|
4144
|
-
if (seconds < 60) {
|
|
4145
|
-
let time;
|
|
4146
|
-
return `${time = seconds.toFixed(1), color.bold(time)} s`;
|
|
4155
|
+
let digits = seconds >= 0.01 ? 2 : 3;
|
|
4156
|
+
return format(seconds.toFixed(digits), 's');
|
|
4147
4157
|
}
|
|
4148
|
-
|
|
4158
|
+
if (seconds < 60) return format(seconds.toFixed(1), 's');
|
|
4159
|
+
let minutesLabel = format(Math.floor(seconds / 60).toFixed(0), 'm'), remainingSeconds = seconds % 60;
|
|
4149
4160
|
if (0 === remainingSeconds) return minutesLabel;
|
|
4150
|
-
let secondsLabel =
|
|
4161
|
+
let secondsLabel = format(remainingSeconds.toFixed(+(remainingSeconds % 1 != 0)), 's');
|
|
4151
4162
|
return `${minutesLabel} ${secondsLabel}`;
|
|
4152
4163
|
})(time / 1000)}${suffix}`;
|
|
4153
4164
|
hasErrors ? logger.error(`build failed in ${timeStr}`) : logger.ready(`built in ${timeStr}`);
|
|
@@ -4312,7 +4323,7 @@ let RSPACK_BUILD_ERROR = 'Rspack build failed.', build_build = async (initOption
|
|
|
4312
4323
|
stats,
|
|
4313
4324
|
close: async ()=>{}
|
|
4314
4325
|
};
|
|
4315
|
-
}, main = __webpack_require__("../../node_modules/.pnpm/dotenv-expand@13.0.
|
|
4326
|
+
}, main = __webpack_require__("../../node_modules/.pnpm/dotenv-expand@13.0.0_patch_hash=5ff37847fa487be2db4e4f14c2b21937f4e51cc7a43deea4506d4aaf3fa6149c/node_modules/dotenv-expand/lib/main.js"), DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
4316
4327
|
function loadEnv_parse(src) {
|
|
4317
4328
|
let match, obj = {}, lines = src.toString();
|
|
4318
4329
|
for(lines = lines.replace(/\r\n?/gm, '\n'); null != (match = DOTENV_LINE.exec(lines));){
|
|
@@ -5446,9 +5457,12 @@ class RsbuildHtmlPlugin {
|
|
|
5446
5457
|
let optPublicPath = tag.publicPath ?? tagConfig.publicPath;
|
|
5447
5458
|
'function' == typeof optPublicPath ? filename = optPublicPath(filename, data.publicPath) : 'string' == typeof optPublicPath ? filename = ensureAssetPrefix(filename, optPublicPath) : !1 !== optPublicPath && (filename = ensureAssetPrefix(filename, data.publicPath));
|
|
5448
5459
|
let optHash = tag.hash ?? tagConfig.hash;
|
|
5449
|
-
'function' == typeof optHash ? compilationHash.length && (filename = optHash(filename, compilationHash)) : 'string' == typeof optHash ? optHash.length && (filename = `${filename}?${optHash}`) : !0 === optHash && compilationHash.length && (filename = `${filename}?${compilationHash}`), attrs[filenameTag] = filename
|
|
5460
|
+
'function' == typeof optHash ? compilationHash.length && (filename = optHash(filename, compilationHash)) : 'string' == typeof optHash ? optHash.length && (filename = `${filename}?${optHash}`) : !0 === optHash && compilationHash.length && (filename = `${filename}?${compilationHash}`), attrs[filenameTag] = filename;
|
|
5450
5461
|
}
|
|
5451
|
-
ret.push(fromBasicTag(
|
|
5462
|
+
ret.push(fromBasicTag({
|
|
5463
|
+
...tag,
|
|
5464
|
+
attrs
|
|
5465
|
+
}));
|
|
5452
5466
|
}
|
|
5453
5467
|
return ret;
|
|
5454
5468
|
}, tags = [
|
|
@@ -5615,7 +5629,7 @@ let normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), formatPrefix = (inp
|
|
|
5615
5629
|
if (prefix?.startsWith('./') && (prefix = prefix.replace('./', '')), !prefix) return '/';
|
|
5616
5630
|
let hasLeadingSlash = prefix.startsWith('/'), hasTailSlash = prefix.endsWith('/');
|
|
5617
5631
|
return `${hasLeadingSlash ? '' : '/'}${prefix}${hasTailSlash ? '' : '/'}`;
|
|
5618
|
-
}, joinUrlPath = (basePath, pathname)=>'' === basePath ? pathname : '' === pathname ? basePath : addTrailingSlash(basePath) + pathname.replace(/^\/+/, ''), isUrlPathUnderBase = (pathname, base)=>{
|
|
5632
|
+
}, joinUrlPath = (basePath, pathname)=>'' === basePath ? pathname : '' === pathname ? basePath : addTrailingSlash(basePath) + pathname.replace(/^\/+/, ''), getMoreEntriesMessage = (moreEntries, cliShortcutsEnabled)=>cliShortcutsEnabled ? ` ${color.dim(`... ${moreEntries} more entries, press `)}${color.bold('u + enter')}${color.dim(' to show all')}\n` : ` ${color.dim(`... ${moreEntries} more entries, set `)}${color.bold('server.printUrls.maxRoutes')}${color.dim(' to show more')}\n`, isUrlPathUnderBase = (pathname, base)=>{
|
|
5619
5633
|
let basePath = removeTailingSlash(base);
|
|
5620
5634
|
return '' === basePath || pathname === basePath || pathname.startsWith(`${basePath}/`);
|
|
5621
5635
|
}, removeBasePath = (url, base)=>{
|
|
@@ -5638,20 +5652,21 @@ let normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), formatPrefix = (inp
|
|
|
5638
5652
|
pathname: prefix + ('index' === entryName && 'nested' !== outputStructure ? '' : entryName)
|
|
5639
5653
|
})).sort((a)=>'index' === a.entryName ? -1 : 1);
|
|
5640
5654
|
};
|
|
5641
|
-
function getURLMessages(urls, routes) {
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5655
|
+
function getURLMessages(urls, routes, { maxRoutes = 10, showAllRoutes, cliShortcutsEnabled }) {
|
|
5656
|
+
let routeLimit = showAllRoutes ? 1 / 0 : void 0 === maxRoutes ? 10 : maxRoutes === 1 / 0 ? maxRoutes : Math.max(0, Math.floor(maxRoutes)), printableRoutes = 0 === routeLimit ? [] : routes.slice(0, routeLimit), moreEntries = routeLimit > 0 ? routes.length - printableRoutes.length : 0;
|
|
5657
|
+
if (routes.length <= 1 || 0 === printableRoutes.length) {
|
|
5658
|
+
let pathname = printableRoutes.length ? printableRoutes[0].pathname : '', padWidth = Math.max(Math.max(...urls.map((u)=>u.label.trimEnd().length)) + 2, 10), message = urls.map(({ label, url })=>{
|
|
5645
5659
|
let normalizedPathname = normalizeUrl(`${url}${pathname}`), prefix = `➜ ${color.dim(label.trimEnd().padEnd(padWidth))}`;
|
|
5646
5660
|
return ` ${prefix}${color.cyan(normalizedPathname)}\n`;
|
|
5647
5661
|
}).join('');
|
|
5662
|
+
return moreEntries > 0 && (message += getMoreEntriesMessage(moreEntries, cliShortcutsEnabled)), message;
|
|
5648
5663
|
}
|
|
5649
|
-
let message = '', prevLabel = '', maxNameLength = Math.max(...
|
|
5664
|
+
let message = '', prevLabel = '', maxNameLength = Math.max(...printableRoutes.map((r)=>r.entryName.length));
|
|
5650
5665
|
return urls.forEach(({ label, url }, index)=>{
|
|
5651
|
-
for (let { entryName, pathname } of (prevLabel !== label && (index > 0 && (message += '\n'), message += ` ➜ ${label}\n`, prevLabel = label),
|
|
5652
|
-
}), message;
|
|
5666
|
+
for (let { entryName, pathname } of (prevLabel !== label && (index > 0 && (message += '\n'), message += ` ➜ ${label}\n`, prevLabel = label), printableRoutes))message += ` ${color.dim('-')} ${color.dim(entryName.padEnd(maxNameLength + 4))}${color.cyan(normalizeUrl(`${url}${pathname}`))}\n`;
|
|
5667
|
+
}), moreEntries > 0 && (message += getMoreEntriesMessage(moreEntries, cliShortcutsEnabled)), message;
|
|
5653
5668
|
}
|
|
5654
|
-
function printServerURLs({ urls: originalUrls, port, routes, protocol, printUrls, fallbackPathname,
|
|
5669
|
+
function printServerURLs({ urls: originalUrls, port, routes, protocol, printUrls, fallbackPathname, showAllRoutes, cliShortcutsEnabled, originalConfig, logger }) {
|
|
5655
5670
|
if (!1 === printUrls) return null;
|
|
5656
5671
|
let urls = originalUrls, useCustomUrl = isFunction(printUrls);
|
|
5657
5672
|
if (useCustomUrl) {
|
|
@@ -5681,8 +5696,12 @@ function printServerURLs({ urls: originalUrls, port, routes, protocol, printUrls
|
|
|
5681
5696
|
}
|
|
5682
5697
|
];
|
|
5683
5698
|
if (0 === printableRoutes.length && !useCustomUrl) return null;
|
|
5684
|
-
let message = getURLMessages(urls, printableRoutes
|
|
5685
|
-
|
|
5699
|
+
let printUrlsOptions = printUrls && 'object' == typeof printUrls ? printUrls : {}, message = getURLMessages(urls, printableRoutes, {
|
|
5700
|
+
maxRoutes: useCustomUrl ? 1 / 0 : printUrlsOptions.maxRoutes,
|
|
5701
|
+
showAllRoutes,
|
|
5702
|
+
cliShortcutsEnabled
|
|
5703
|
+
});
|
|
5704
|
+
return originalConfig && originalConfig.server?.host === void 0 && (message += ` ➜ ${color.dim('Network:')} ${color.dim('use')} ${color.bold('--host')} ${color.dim('to expose')}\n`), !0 === cliShortcutsEnabled && message.endsWith('\n') && (message = message.slice(0, -1)), logger.log(message), message;
|
|
5686
5705
|
}
|
|
5687
5706
|
let getPort = async ({ host, port, strictPort, tryLimits = 20 })=>{
|
|
5688
5707
|
'string' == typeof port && (port = Number.parseInt(port, 10)), strictPort && (tryLimits = 1);
|
|
@@ -6680,7 +6699,7 @@ function createAssetsMiddleware(context, ready, outputFileSystem) {
|
|
|
6680
6699
|
}
|
|
6681
6700
|
async function setupOutputFileSystem(writeToDisk, compilers) {
|
|
6682
6701
|
if (!0 !== writeToDisk) {
|
|
6683
|
-
let { createFsFromVolume, Volume } = await import("./memfs.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/memfs@4.57.
|
|
6702
|
+
let { createFsFromVolume, Volume } = await import("./memfs.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/memfs@4.57.7/node_modules/memfs/lib/index.js", 23)), outputFileSystem = createFsFromVolume(new Volume());
|
|
6684
6703
|
for (let compiler of compilers)compiler.outputFileSystem = outputFileSystem;
|
|
6685
6704
|
}
|
|
6686
6705
|
let compiler = compilers.find((compiler)=>!!compiler.outputFileSystem);
|
|
@@ -7052,9 +7071,9 @@ function convertLinksInHtml(text, root) {
|
|
|
7052
7071
|
}).join('\n');
|
|
7053
7072
|
}
|
|
7054
7073
|
function isEqualSet(a, b) {
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7074
|
+
if (a.size !== b.size) return !1;
|
|
7075
|
+
for (let value of a)if (!b.has(value)) return !1;
|
|
7076
|
+
return !0;
|
|
7058
7077
|
}
|
|
7059
7078
|
let parseQueryString = (req)=>{
|
|
7060
7079
|
let queryStr = req.url ? req.url.split('?')[1] : '';
|
|
@@ -7089,7 +7108,7 @@ class SocketServer {
|
|
|
7089
7108
|
}
|
|
7090
7109
|
async prepare() {
|
|
7091
7110
|
this.clearHeartbeatTimer();
|
|
7092
|
-
let { WebSocketServer } = await import("./
|
|
7111
|
+
let { WebSocketServer } = await import("./wrapper.js");
|
|
7093
7112
|
this.wsServer = new WebSocketServer({
|
|
7094
7113
|
noServer: !0,
|
|
7095
7114
|
path: this.options.client?.path
|
|
@@ -7194,11 +7213,15 @@ class SocketServer {
|
|
|
7194
7213
|
return this.context.environmentList.find(({ webSocketToken })=>webSocketToken === token);
|
|
7195
7214
|
}
|
|
7196
7215
|
getInitialChunks(stats) {
|
|
7197
|
-
let initialChunks = new Set();
|
|
7198
|
-
if (!
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7216
|
+
let initialChunks = new Set(), { entrypoints } = stats;
|
|
7217
|
+
if (!entrypoints) return initialChunks;
|
|
7218
|
+
let entryNames = Object.keys(entrypoints);
|
|
7219
|
+
for(let entryIndex = 0; entryIndex < entryNames.length; entryIndex++){
|
|
7220
|
+
let chunks = entrypoints[entryNames[entryIndex]]?.chunks;
|
|
7221
|
+
if (Array.isArray(chunks)) for(let index = 0; index < chunks.length; index++){
|
|
7222
|
+
let chunkName = chunks[index];
|
|
7223
|
+
void 0 !== chunkName && initialChunks.add('string' == typeof chunkName ? chunkName : String(chunkName));
|
|
7224
|
+
}
|
|
7202
7225
|
}
|
|
7203
7226
|
return initialChunks;
|
|
7204
7227
|
}
|
|
@@ -7324,7 +7347,9 @@ async function setupCliShortcuts({ help = !0, openPage, closeServer, printUrls,
|
|
|
7324
7347
|
{
|
|
7325
7348
|
key: 'u',
|
|
7326
7349
|
description: `${color.bold('u + enter')} ${color.dim('show urls')}`,
|
|
7327
|
-
action: printUrls
|
|
7350
|
+
action: ()=>printUrls({
|
|
7351
|
+
showAllRoutes: !0
|
|
7352
|
+
})
|
|
7328
7353
|
}
|
|
7329
7354
|
].filter(Boolean);
|
|
7330
7355
|
if (customShortcuts && !Array.isArray(shortcuts = customShortcuts(shortcuts))) throw Error(`${color.dim('[rsbuild:config]')} ${color.yellow('dev.cliShortcuts')} option must return an array of shortcuts.`);
|
|
@@ -7673,7 +7698,7 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
|
|
|
7673
7698
|
],
|
|
7674
7699
|
outputFileSystem: buildManager.outputFileSystem
|
|
7675
7700
|
})), server.publicDir.length) {
|
|
7676
|
-
let { default: sirv } = await import("./
|
|
7701
|
+
let { default: sirv } = await import("./build.js");
|
|
7677
7702
|
for (let { name } of server.publicDir){
|
|
7678
7703
|
let sirvMiddleware = sirv(name, {
|
|
7679
7704
|
etag: !0,
|
|
@@ -8124,14 +8149,15 @@ async function devServer_createDevServer(options, createCompiler, config, { getP
|
|
|
8124
8149
|
protocol,
|
|
8125
8150
|
port,
|
|
8126
8151
|
host
|
|
8127
|
-
}), cliShortcutsEnabled = isCliShortcutsEnabled(config), printUrls = ()=>printServerURLs({
|
|
8152
|
+
}), cliShortcutsEnabled = isCliShortcutsEnabled(config), printUrls = (options)=>printServerURLs({
|
|
8128
8153
|
urls,
|
|
8129
8154
|
port,
|
|
8130
8155
|
routes,
|
|
8131
8156
|
protocol,
|
|
8132
8157
|
printUrls: config.server.printUrls,
|
|
8133
8158
|
fallbackPathname,
|
|
8134
|
-
|
|
8159
|
+
showAllRoutes: options?.showAllRoutes,
|
|
8160
|
+
cliShortcutsEnabled,
|
|
8135
8161
|
originalConfig: context.originalConfig,
|
|
8136
8162
|
logger
|
|
8137
8163
|
}), openPage = async ()=>open_open({
|
|
@@ -8274,13 +8300,14 @@ async function startPreviewServer(context, config, { getPortSilently } = {}) {
|
|
|
8274
8300
|
middlewares
|
|
8275
8301
|
}), cleanupGracefulShutdown = setupGracefulShutdown(), serverTerminator = getServerTerminator(httpServer), closingPromise = null, closeServer = async ()=>(closingPromise || (closingPromise = (async ()=>{
|
|
8276
8302
|
removeCleanup(closeServer), cleanupGracefulShutdown(), await serverTerminator();
|
|
8277
|
-
})()), closingPromise), printUrls = ()=>printServerURLs({
|
|
8303
|
+
})()), closingPromise), printUrls = (options)=>printServerURLs({
|
|
8278
8304
|
urls,
|
|
8279
8305
|
port,
|
|
8280
8306
|
routes,
|
|
8281
8307
|
protocol,
|
|
8282
8308
|
printUrls: serverConfig.printUrls,
|
|
8283
|
-
|
|
8309
|
+
showAllRoutes: options?.showAllRoutes,
|
|
8310
|
+
cliShortcutsEnabled,
|
|
8284
8311
|
originalConfig: context.originalConfig,
|
|
8285
8312
|
logger
|
|
8286
8313
|
}), openPage = async ()=>open_open({
|
|
@@ -8381,7 +8408,7 @@ function applyDefaultPlugins(pluginManager, context) {
|
|
|
8381
8408
|
aggregateTimeout: 0
|
|
8382
8409
|
}), chain.performance.hints(!1), chain.experiments({
|
|
8383
8410
|
...chain.get('experiments'),
|
|
8384
|
-
|
|
8411
|
+
sourceImport: !0
|
|
8385
8412
|
}), chain.module.parser.merge({
|
|
8386
8413
|
javascript: {
|
|
8387
8414
|
typeReexportsPresence: 'tolerant'
|
|
@@ -9062,7 +9089,9 @@ try {
|
|
|
9062
9089
|
} : {
|
|
9063
9090
|
...cssLoaderOptions,
|
|
9064
9091
|
importLoaders: importLoaders.normal
|
|
9065
|
-
},
|
|
9092
|
+
}, emitCss || 'main' !== type || rule.use(CHAIN_ID.USE.IGNORE_CSS).options({
|
|
9093
|
+
modules: finalOptions.modules
|
|
9094
|
+
}), rule.use(CHAIN_ID.USE.CSS).options(finalOptions), 'url' !== type && rule.sideEffects(!0), rule.resolve.preferRelative(!0);
|
|
9066
9095
|
});
|
|
9067
9096
|
let cssUrlFilename = getFilename(config, 'css', isProd), cssUrlPath = config.output.distPath.css;
|
|
9068
9097
|
urlRule.use(CHAIN_ID.USE.CSS_URL).options({
|
|
@@ -9457,7 +9486,7 @@ try {
|
|
|
9457
9486
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
|
|
9458
9487
|
let { output: { manifest }, dev: { writeToDisk } } = environment.config;
|
|
9459
9488
|
if (!1 === manifest) return;
|
|
9460
|
-
let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.0.
|
|
9489
|
+
let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./rspack-manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.2_@rspack+core@2.1.0-beta.0/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
|
|
9461
9490
|
manifestFilenames.set(environment.name, manifestOptions.filename);
|
|
9462
9491
|
let pluginOptions = {
|
|
9463
9492
|
fileName: manifestOptions.filename,
|
|
@@ -9992,7 +10021,7 @@ let applyServerOptions = (command)=>{
|
|
|
9992
10021
|
};
|
|
9993
10022
|
function setupCommands() {
|
|
9994
10023
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
9995
|
-
cli.version("2.0.
|
|
10024
|
+
cli.version("2.1.0-beta.0"), 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)', {
|
|
9996
10025
|
default: 'auto'
|
|
9997
10026
|
}).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', {
|
|
9998
10027
|
type: [
|
|
@@ -10063,7 +10092,7 @@ function initNodeEnv(command) {
|
|
|
10063
10092
|
}
|
|
10064
10093
|
function showGreeting() {
|
|
10065
10094
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
10066
|
-
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.
|
|
10095
|
+
src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.1.0-beta.0\n`);
|
|
10067
10096
|
}
|
|
10068
10097
|
function setupLogLevel() {
|
|
10069
10098
|
if (cli_argv.length <= 3) return;
|
|
@@ -10085,5 +10114,5 @@ function runCLI() {
|
|
|
10085
10114
|
src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
|
|
10086
10115
|
}
|
|
10087
10116
|
}
|
|
10088
|
-
let src_version = "2.0.
|
|
10117
|
+
let src_version = "2.1.0-beta.0";
|
|
10089
10118
|
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, mrmime_lookup, runCLI, src_logger as logger, src_version as version };
|
package/dist/cssUrlLoader.mjs
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import node_path from "node:path";
|
|
2
|
-
|
|
2
|
+
import { isCSSModules } from "./349.js";
|
|
3
|
+
let HASH_PLACEHOLDER_REGEX = /\[(?:[^:\]]+:)?(?:chunkhash|contenthash|hash|fullhash)(?::[^\]]+)?]/i, getRelativePath = (root, resourcePath)=>{
|
|
3
4
|
let relativePath = node_path.relative(root, resourcePath);
|
|
4
5
|
if (relativePath && !('..' === relativePath || relativePath.startsWith(`..${node_path.sep}`)) && !node_path.isAbsolute(relativePath)) return relativePath.replace(/\\/g, '/');
|
|
5
6
|
}, pitch = async function(remainingRequest) {
|
|
6
7
|
let root, resourcePath, nameSource, hash, options = this.getOptions();
|
|
7
|
-
if ((
|
|
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.');
|
|
8
|
+
if (isCSSModules(options.modules, this)) throw Error('[rsbuild:css] CSS Modules do not support the ?url query. Use ?inline to import the compiled CSS content as a string.');
|
|
13
9
|
let content = ((moduleExports)=>{
|
|
14
10
|
let content = moduleExports && 'object' == typeof moduleExports && 'default' in moduleExports ? moduleExports.default : moduleExports;
|
|
15
11
|
if ('string' != typeof content) throw Error('[rsbuild:css] Expected CSS ?url imports to export a string.');
|
|
@@ -2673,8 +2673,9 @@ let Debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3/node_modul
|
|
|
2673
2673
|
};
|
|
2674
2674
|
function getStatusCode(errorCode) {
|
|
2675
2675
|
let statusCode;
|
|
2676
|
-
if (/HPE_INVALID/.test(errorCode))
|
|
2677
|
-
|
|
2676
|
+
if (/HPE_INVALID/.test(errorCode)) return 502;
|
|
2677
|
+
if (/HPM_ERR_INVALID_MULTIPART_/.test(errorCode)) return 400;
|
|
2678
|
+
switch(errorCode){
|
|
2678
2679
|
case 'ECONNRESET':
|
|
2679
2680
|
case 'ENOTFOUND':
|
|
2680
2681
|
case 'ECONNREFUSED':
|
package/dist/ignoreCssLoader.mjs
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { isCSSModules } from "./349.js";
|
|
2
|
+
let pitch = function() {
|
|
3
|
+
let { modules } = this.getOptions();
|
|
4
|
+
if (!isCSSModules(modules, this)) return '';
|
|
5
|
+
};
|
|
1
6
|
export default function(source) {
|
|
2
|
-
return
|
|
7
|
+
return source.includes('___CSS_LOADER_EXPORT___') ? '' : source;
|
|
3
8
|
};
|
|
9
|
+
export { pitch };
|