@rsbuild/core 1.6.5 → 1.6.7-canary-57e2a56d-20251120152633
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 +15 -15
- package/compiled/html-rspack-plugin/package.json +1 -1
- package/compiled/memfs/index.d.ts +1 -0
- package/compiled/memfs/index.js +135 -121
- package/compiled/memfs/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/dist/0~open.js +335 -345
- package/dist/0~range-parser.js +3 -6
- package/dist/169.js +9810 -0
- package/dist/476.mjs +8 -0
- package/dist/client/overlay.js +3 -3
- package/dist/ignoreCssLoader.mjs +2 -3
- package/dist/index.cjs +88 -97
- package/dist/index.js +1 -9899
- package/dist/rslib-runtime.js +44 -0
- package/dist/transformLoader.mjs +3 -9
- package/dist/transformRawLoader.mjs +4 -9
- package/dist-types/hooks.d.ts +2 -2
- package/dist-types/types/config.d.ts +37 -7
- package/dist-types/types/context.d.ts +2 -0
- package/dist-types/types/hooks.d.ts +4 -0
- package/dist-types/types/rsbuild.d.ts +1 -1
- package/package.json +9 -9
- /package/dist/{index.js.LICENSE.txt → 169.js.LICENSE.txt} +0 -0
package/dist/476.mjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
let constants_dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
process.platform, join(constants_dirname), join(constants_dirname, '../static');
|
|
6
|
+
let COMPILED_PATH = join(constants_dirname, '../compiled'), vendors_require = createRequire(import.meta.url), requireCompiledPackage = (name)=>vendors_require(`${COMPILED_PATH}/${name}/index.js`);
|
|
7
|
+
requireCompiledPackage('picocolors');
|
|
8
|
+
export { requireCompiledPackage };
|
package/dist/client/overlay.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { registerOverlay } from "./hmr";
|
|
1
|
+
import { registerOverlay } from "./hmr.js";
|
|
2
2
|
function _define_property(obj, key, value) {
|
|
3
3
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
4
4
|
value: value,
|
|
@@ -9,8 +9,8 @@ function _define_property(obj, key, value) {
|
|
|
9
9
|
else obj[key] = value;
|
|
10
10
|
return obj;
|
|
11
11
|
}
|
|
12
|
-
const { HTMLElement = class {
|
|
13
|
-
}, customElements } = 'undefined' != typeof window ? window : globalThis;
|
|
12
|
+
const { HTMLElement: HTMLElement = class {
|
|
13
|
+
}, customElements: customElements } = 'undefined' != typeof window ? window : globalThis;
|
|
14
14
|
class ErrorOverlay extends HTMLElement {
|
|
15
15
|
constructor(html){
|
|
16
16
|
var _root_querySelector, _root_querySelector1;
|
package/dist/ignoreCssLoader.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -3039,7 +3039,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3039
3039
|
onAfterEnvironmentCompile: createEnvironmentAsyncHook()
|
|
3040
3040
|
};
|
|
3041
3041
|
}
|
|
3042
|
-
let onBeforeCompile = ({ compiler, beforeCompile,
|
|
3042
|
+
let onBeforeCompile = ({ compiler, beforeCompile, beforeEnvironmentCompile, isWatch })=>{
|
|
3043
3043
|
let name = 'rsbuild:beforeCompile';
|
|
3044
3044
|
if (compiler_isMultiCompiler(compiler)) {
|
|
3045
3045
|
let waitBeforeCompileDone, { compilers } = compiler;
|
|
@@ -3049,11 +3049,11 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3049
3049
|
for(let index = 0; index < compilers.length; index++){
|
|
3050
3050
|
let compiler = compilers[index];
|
|
3051
3051
|
(isWatch ? compiler.hooks.watchRun : compiler.hooks.run).tapPromise(name, async ()=>{
|
|
3052
|
-
waitBeforeCompileDone || (waitBeforeCompileDone = beforeCompile
|
|
3052
|
+
waitBeforeCompileDone || (waitBeforeCompileDone = beforeCompile()), await waitBeforeCompileDone, await beforeEnvironmentCompile(index);
|
|
3053
3053
|
});
|
|
3054
3054
|
}
|
|
3055
3055
|
} else (isWatch ? compiler.hooks.watchRun : compiler.hooks.run).tapPromise(name, async ()=>{
|
|
3056
|
-
await beforeCompile
|
|
3056
|
+
await beforeCompile(), await beforeEnvironmentCompile(0);
|
|
3057
3057
|
});
|
|
3058
3058
|
}, onCompileDone = ({ compiler, onDone, onEnvironmentDone, MultiStatsCtor })=>{
|
|
3059
3059
|
if (compiler_isMultiCompiler(compiler)) {
|
|
@@ -3073,22 +3073,24 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3073
3073
|
});
|
|
3074
3074
|
}, registerBuildHook = ({ context, isWatch, compiler, bundlerConfigs, MultiStatsCtor })=>{
|
|
3075
3075
|
let isFirstCompile = !0, { environmentList } = context, onDone = async (stats)=>{
|
|
3076
|
-
let
|
|
3076
|
+
let promise = context.hooks.onAfterBuild.callBatch({
|
|
3077
3077
|
isFirstCompile,
|
|
3078
3078
|
stats,
|
|
3079
3079
|
environments: context.environments,
|
|
3080
3080
|
isWatch
|
|
3081
3081
|
});
|
|
3082
|
-
isFirstCompile = !1, await
|
|
3083
|
-
}, onEnvironmentDone = async (
|
|
3082
|
+
isFirstCompile = !1, await promise;
|
|
3083
|
+
}, onEnvironmentDone = async (index, stats)=>{
|
|
3084
|
+
let environment = environmentList[index], time = context.buildState.time[environment.name] ?? 0;
|
|
3084
3085
|
await context.hooks.onAfterEnvironmentCompile.callBatch({
|
|
3085
|
-
environment:
|
|
3086
|
+
environment: environment.name,
|
|
3086
3087
|
args: [
|
|
3087
3088
|
{
|
|
3088
3089
|
isFirstCompile,
|
|
3089
3090
|
stats,
|
|
3090
|
-
environment
|
|
3091
|
-
isWatch
|
|
3091
|
+
environment,
|
|
3092
|
+
isWatch,
|
|
3093
|
+
time
|
|
3092
3094
|
}
|
|
3093
3095
|
]
|
|
3094
3096
|
});
|
|
@@ -3101,17 +3103,20 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3101
3103
|
isWatch,
|
|
3102
3104
|
isFirstCompile
|
|
3103
3105
|
}),
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
+
beforeEnvironmentCompile: async (buildIndex)=>{
|
|
3107
|
+
let environment = environmentList[buildIndex];
|
|
3108
|
+
return context.hooks.onBeforeEnvironmentCompile.callBatch({
|
|
3109
|
+
environment: environment.name,
|
|
3106
3110
|
args: [
|
|
3107
3111
|
{
|
|
3108
|
-
bundlerConfig: bundlerConfigs
|
|
3109
|
-
environment
|
|
3112
|
+
bundlerConfig: bundlerConfigs[buildIndex],
|
|
3113
|
+
environment,
|
|
3110
3114
|
isWatch,
|
|
3111
3115
|
isFirstCompile
|
|
3112
3116
|
}
|
|
3113
3117
|
]
|
|
3114
|
-
})
|
|
3118
|
+
});
|
|
3119
|
+
},
|
|
3115
3120
|
isWatch
|
|
3116
3121
|
}), onCompileDone({
|
|
3117
3122
|
compiler,
|
|
@@ -3121,38 +3126,43 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3121
3126
|
});
|
|
3122
3127
|
}, registerDevHook = ({ context, compiler, bundlerConfigs, MultiStatsCtor })=>{
|
|
3123
3128
|
let isFirstCompile = !0, { environmentList } = context, onDone = async (stats)=>{
|
|
3124
|
-
let
|
|
3129
|
+
let promise = context.hooks.onAfterDevCompile.callBatch({
|
|
3125
3130
|
isFirstCompile,
|
|
3126
3131
|
stats,
|
|
3127
3132
|
environments: context.environments
|
|
3128
3133
|
});
|
|
3129
|
-
isFirstCompile = !1, await
|
|
3130
|
-
}, onEnvironmentDone = async (
|
|
3134
|
+
isFirstCompile = !1, await promise;
|
|
3135
|
+
}, onEnvironmentDone = async (index, stats)=>{
|
|
3136
|
+
let environment = environmentList[index], time = context.buildState.time[environment.name] ?? 0;
|
|
3131
3137
|
await context.hooks.onAfterEnvironmentCompile.callBatch({
|
|
3132
|
-
environment:
|
|
3138
|
+
environment: environment.name,
|
|
3133
3139
|
args: [
|
|
3134
3140
|
{
|
|
3135
3141
|
isFirstCompile,
|
|
3136
3142
|
stats,
|
|
3137
|
-
environment
|
|
3138
|
-
isWatch: !0
|
|
3143
|
+
environment,
|
|
3144
|
+
isWatch: !0,
|
|
3145
|
+
time
|
|
3139
3146
|
}
|
|
3140
3147
|
]
|
|
3141
3148
|
});
|
|
3142
3149
|
};
|
|
3143
3150
|
onBeforeCompile({
|
|
3144
3151
|
compiler,
|
|
3145
|
-
|
|
3146
|
-
|
|
3152
|
+
beforeEnvironmentCompile: async (buildIndex)=>{
|
|
3153
|
+
let environment = environmentList[buildIndex];
|
|
3154
|
+
return context.hooks.onBeforeEnvironmentCompile.callBatch({
|
|
3155
|
+
environment: environment.name,
|
|
3147
3156
|
args: [
|
|
3148
3157
|
{
|
|
3149
|
-
bundlerConfig: bundlerConfigs
|
|
3150
|
-
environment
|
|
3158
|
+
bundlerConfig: bundlerConfigs[buildIndex],
|
|
3159
|
+
environment,
|
|
3151
3160
|
isWatch: !0,
|
|
3152
3161
|
isFirstCompile
|
|
3153
3162
|
}
|
|
3154
3163
|
]
|
|
3155
|
-
})
|
|
3164
|
+
});
|
|
3165
|
+
},
|
|
3156
3166
|
beforeCompile: async ()=>context.hooks.onBeforeDevCompile.callBatch({
|
|
3157
3167
|
bundlerConfigs,
|
|
3158
3168
|
environments: context.environments,
|
|
@@ -3309,7 +3319,6 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3309
3319
|
function getStatsOptions(compiler, action) {
|
|
3310
3320
|
let defaultOptions = {
|
|
3311
3321
|
all: !1,
|
|
3312
|
-
timings: !0,
|
|
3313
3322
|
errors: !0,
|
|
3314
3323
|
warnings: !0,
|
|
3315
3324
|
moduleTrace: !0,
|
|
@@ -3796,7 +3805,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3796
3805
|
exitHook_callbacks.delete(onExit);
|
|
3797
3806
|
};
|
|
3798
3807
|
}
|
|
3799
|
-
let addTrailingSlash = (s)=>s.endsWith('/') ? s : `${s}/`, isURL = (str)=>str.startsWith('http') || str.startsWith('
|
|
3808
|
+
let addTrailingSlash = (s)=>s.endsWith('/') ? s : `${s}/`, isURL = (str)=>str.startsWith('http') || str.startsWith('//'), urlJoin = (base, path)=>{
|
|
3800
3809
|
let [urlProtocol, baseUrl] = base.split('://');
|
|
3801
3810
|
return `${urlProtocol}://${external_node_path_.posix.join(baseUrl, path)}`;
|
|
3802
3811
|
}, canParse = (url)=>{
|
|
@@ -4156,7 +4165,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4156
4165
|
}
|
|
4157
4166
|
let browsersListCache = new Map();
|
|
4158
4167
|
function getBrowserslist(path) {
|
|
4159
|
-
let env = process.env.NODE_ENV, cacheKey = path
|
|
4168
|
+
let env = process.env.NODE_ENV, cacheKey = `${path}:${env ?? ''}`;
|
|
4160
4169
|
if (browsersListCache.has(cacheKey)) return browsersListCache.get(cacheKey);
|
|
4161
4170
|
let result = loadConfig({
|
|
4162
4171
|
path,
|
|
@@ -4221,7 +4230,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4221
4230
|
async function createContext(options, userConfig) {
|
|
4222
4231
|
let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
|
|
4223
4232
|
return {
|
|
4224
|
-
version: "1.6.
|
|
4233
|
+
version: "1.6.7-canary-57e2a56d-20251120152633",
|
|
4225
4234
|
rootPath,
|
|
4226
4235
|
distPath: '',
|
|
4227
4236
|
cachePath,
|
|
@@ -4239,7 +4248,8 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4239
4248
|
buildState: {
|
|
4240
4249
|
stats: null,
|
|
4241
4250
|
status: 'idle',
|
|
4242
|
-
hasErrors: !1
|
|
4251
|
+
hasErrors: !1,
|
|
4252
|
+
time: {}
|
|
4243
4253
|
}
|
|
4244
4254
|
};
|
|
4245
4255
|
}
|
|
@@ -4765,7 +4775,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4765
4775
|
let isVersionLogged = !1, isCompiling = !1, logRspackVersion = ()=>{
|
|
4766
4776
|
isVersionLogged || (logger.debug(`using Rspack v${rspack_rspack.rspackVersion}`), isVersionLogged = !0);
|
|
4767
4777
|
}, lazyModules = new Set();
|
|
4768
|
-
|
|
4778
|
+
compiler.hooks.infrastructureLog.tap(HOOK_NAME, (name, _, args)=>{
|
|
4769
4779
|
let log = args[0];
|
|
4770
4780
|
if ('LazyCompilation' === name && 'string' == typeof log && log.startsWith('lazy-compilation-proxy')) {
|
|
4771
4781
|
let resource = log.split(' ')[0];
|
|
@@ -4776,28 +4786,33 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4776
4786
|
lazyModules.add(relativePath);
|
|
4777
4787
|
}
|
|
4778
4788
|
}
|
|
4779
|
-
})
|
|
4780
|
-
|
|
4789
|
+
});
|
|
4790
|
+
let startTime = null;
|
|
4791
|
+
compiler.hooks.run.tap(HOOK_NAME, ()=>{
|
|
4792
|
+
startTime = Date.now(), context.buildState.status = 'building';
|
|
4781
4793
|
}), compiler.hooks.watchRun.tap(HOOK_NAME, (compiler)=>{
|
|
4782
|
-
context.buildState.status = 'building', logRspackVersion(), isCompiling || printBuildLog(compiler, context, lazyModules), lazyModules.size && lazyModules.clear(), isCompiling = !0;
|
|
4794
|
+
startTime = Date.now(), context.buildState.status = 'building', logRspackVersion(), isCompiling || printBuildLog(compiler, context, lazyModules), lazyModules.size && lazyModules.clear(), isCompiling = !0;
|
|
4783
4795
|
}), compiler.hooks.invalid.tap(HOOK_NAME, ()=>{
|
|
4784
4796
|
context.buildState.stats = null, context.buildState.status = 'idle', context.buildState.hasErrors = !1;
|
|
4785
4797
|
}), 'build' === context.action && (isMultiCompiler ? compiler.compilers[0] : compiler).hooks.run.tap(HOOK_NAME, ()=>{
|
|
4786
4798
|
logger.info('build started...'), logRspackVersion();
|
|
4799
|
+
});
|
|
4800
|
+
let printTime = (index, hasErrors)=>{
|
|
4801
|
+
if (null === startTime) return;
|
|
4802
|
+
let { name } = context.environmentList[index], time = Date.now() - startTime;
|
|
4803
|
+
context.buildState.time[name] = time;
|
|
4804
|
+
let suffix = isMultiCompiler ? color.dim(` (${name})`) : '', timeStr = `${prettyTime(time / 1000)}${suffix}`;
|
|
4805
|
+
hasErrors ? logger.error(`build failed in ${timeStr}`) : logger.ready(`built in ${timeStr}`);
|
|
4806
|
+
};
|
|
4807
|
+
return isMultiCompiler && compiler.compilers.forEach((item, index)=>{
|
|
4808
|
+
item.hooks.done.tap(HOOK_NAME, (stats)=>{
|
|
4809
|
+
printTime(index, stats.hasErrors());
|
|
4810
|
+
});
|
|
4787
4811
|
}), compiler.hooks.done.tap(HOOK_NAME, (statsInstance)=>{
|
|
4788
4812
|
let stats = getRsbuildStats(statsInstance, compiler, context.action), hasErrors = statsInstance.hasErrors();
|
|
4789
4813
|
context.buildState.stats = stats, context.buildState.status = 'done', context.buildState.hasErrors = hasErrors, context.socketServer?.onBuildDone();
|
|
4790
|
-
let printTime = (statsItem, index)=>{
|
|
4791
|
-
if (statsItem.time) {
|
|
4792
|
-
let time = prettyTime(statsItem.time / 1000), { name } = rspackConfigs[index], suffix = name && isMultiCompiler ? color.dim(` (${name})`) : '';
|
|
4793
|
-
logger.ready(`built in ${time}${suffix}`);
|
|
4794
|
-
}
|
|
4795
|
-
};
|
|
4796
|
-
hasErrors || (isMultiCompiler && stats.children?.length ? stats.children.forEach((item, index)=>{
|
|
4797
|
-
printTime(item, index);
|
|
4798
|
-
}) : printTime(stats, 0));
|
|
4799
4814
|
let { message, level } = formatStats(stats, hasErrors);
|
|
4800
|
-
'error' === level && logger.error(message), 'warning' === level && logger.warn(message), isCompiling = !1;
|
|
4815
|
+
'error' === level && logger.error(message), 'warning' === level && logger.warn(message), isMultiCompiler || printTime(0, hasErrors), isCompiling = !1;
|
|
4801
4816
|
}), 'dev' === context.action && registerDevHook({
|
|
4802
4817
|
context,
|
|
4803
4818
|
compiler,
|
|
@@ -4813,7 +4828,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4813
4828
|
}
|
|
4814
4829
|
let RSPACK_BUILD_ERROR = 'Rspack build failed.', build_build = async (initOptions, { watch, compiler: customCompiler } = {})=>{
|
|
4815
4830
|
let compiler, bundlerConfigs, { context } = initOptions;
|
|
4816
|
-
if (customCompiler) compiler = customCompiler;
|
|
4831
|
+
if (customCompiler) compiler = customCompiler, bundlerConfigs = customCompiler.options;
|
|
4817
4832
|
else {
|
|
4818
4833
|
let result = await createCompiler_createCompiler(initOptions);
|
|
4819
4834
|
compiler = result.compiler, bundlerConfigs = result.rspackConfigs;
|
|
@@ -4906,8 +4921,13 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4906
4921
|
}).set('generator', generatorOptions);
|
|
4907
4922
|
};
|
|
4908
4923
|
function getRegExpForExts(exts) {
|
|
4909
|
-
let
|
|
4910
|
-
|
|
4924
|
+
let normalizedExts = [];
|
|
4925
|
+
for (let ext of exts){
|
|
4926
|
+
let trimmed = ext.trim();
|
|
4927
|
+
normalizedExts.push(trimmed.startsWith('.') ? trimmed.slice(1) : trimmed);
|
|
4928
|
+
}
|
|
4929
|
+
let matcher = normalizedExts.join('|');
|
|
4930
|
+
return RegExp(1 === normalizedExts.length ? `\\.${matcher}$` : `\\.(?:${matcher})$`, 'i');
|
|
4911
4931
|
}
|
|
4912
4932
|
let isUseAnalyzer = (config)=>process.env.BUNDLE_ANALYZE || config.performance?.bundleAnalyze;
|
|
4913
4933
|
function pluginBundleAnalyzer() {
|
|
@@ -4961,7 +4981,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4961
4981
|
function getCacheDirectory({ cacheDirectory }, context) {
|
|
4962
4982
|
return cacheDirectory ? (0, external_node_path_.isAbsolute)(cacheDirectory) ? cacheDirectory : (0, external_node_path_.join)(context.rootPath, cacheDirectory) : (0, external_node_path_.join)(context.cachePath, context.bundlerType);
|
|
4963
4983
|
}
|
|
4964
|
-
async function getBuildDependencies(context, config, environmentContext,
|
|
4984
|
+
async function getBuildDependencies(context, config, environmentContext, additionalDependencies) {
|
|
4965
4985
|
let rootPackageJson = (0, external_node_path_.join)(context.rootPath, 'package.json'), browserslistConfig = (0, external_node_path_.join)(context.rootPath, '.browserslistrc'), buildDependencies = {};
|
|
4966
4986
|
await isFileExists(rootPackageJson) && (buildDependencies.packageJson = [
|
|
4967
4987
|
rootPackageJson
|
|
@@ -4982,10 +5002,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
4982
5002
|
].map((ext)=>(0, external_node_path_.join)(context.rootPath, `tailwind.config.${ext}`)));
|
|
4983
5003
|
return tailwindConfig && (buildDependencies.tailwindcss = [
|
|
4984
5004
|
tailwindConfig
|
|
4985
|
-
]),
|
|
4986
|
-
...buildDependencies,
|
|
4987
|
-
...userBuildDependencies
|
|
4988
|
-
};
|
|
5005
|
+
]), additionalDependencies && (buildDependencies.additional = additionalDependencies), buildDependencies;
|
|
4989
5006
|
}
|
|
4990
5007
|
let addTrailingSep = (dir)=>dir.endsWith(external_node_path_.sep) ? dir : dir + external_node_path_.sep, isStrictSubdir = (parent, child)=>{
|
|
4991
5008
|
let parentDir = addTrailingSep(parent), childDir = addTrailingSep(child);
|
|
@@ -5056,8 +5073,9 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5056
5073
|
},
|
|
5057
5074
|
config: config.tools.postcss,
|
|
5058
5075
|
ctx: {
|
|
5059
|
-
addPlugins (plugins) {
|
|
5060
|
-
|
|
5076
|
+
addPlugins (plugins, options = {}) {
|
|
5077
|
+
let { order = 'post' } = options, list = helpers_castArray(plugins);
|
|
5078
|
+
'pre' === order ? extraPlugins.unshift(...list) : extraPlugins.push(...list);
|
|
5061
5079
|
}
|
|
5062
5080
|
}
|
|
5063
5081
|
});
|
|
@@ -5789,37 +5807,6 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5789
5807
|
...manifest
|
|
5790
5808
|
};
|
|
5791
5809
|
}
|
|
5792
|
-
class PatchSplitChunksPlugin {
|
|
5793
|
-
name;
|
|
5794
|
-
constructor(name){
|
|
5795
|
-
this.name = name;
|
|
5796
|
-
}
|
|
5797
|
-
apply(compiler) {
|
|
5798
|
-
let { splitChunks } = compiler.options.optimization;
|
|
5799
|
-
if (!splitChunks) return;
|
|
5800
|
-
let applyPatch = (config)=>{
|
|
5801
|
-
if ('object' != typeof config || (0, types_namespaceObject.isRegExp)(config)) return;
|
|
5802
|
-
let { chunks } = config;
|
|
5803
|
-
if (chunks && 'async' !== chunks) {
|
|
5804
|
-
if ('function' == typeof chunks) {
|
|
5805
|
-
config.chunks = (chunk)=>(!chunk.name || chunk.name !== this.name) && chunks(chunk);
|
|
5806
|
-
return;
|
|
5807
|
-
}
|
|
5808
|
-
if ('all' === chunks) {
|
|
5809
|
-
config.chunks = (chunk)=>!chunk.name || chunk.name !== this.name;
|
|
5810
|
-
return;
|
|
5811
|
-
}
|
|
5812
|
-
if ('initial' === chunks) {
|
|
5813
|
-
config.chunks = (chunk)=>(!chunk.name || chunk.name !== this.name) && chunk.isOnlyInitial();
|
|
5814
|
-
return;
|
|
5815
|
-
}
|
|
5816
|
-
}
|
|
5817
|
-
};
|
|
5818
|
-
applyPatch(splitChunks);
|
|
5819
|
-
let { cacheGroups } = splitChunks;
|
|
5820
|
-
if (cacheGroups) for (let cacheGroupKey of Object.keys(cacheGroups))cacheGroups[cacheGroupKey] && applyPatch(cacheGroups[cacheGroupKey]);
|
|
5821
|
-
}
|
|
5822
|
-
}
|
|
5823
5810
|
function pluginModuleFederation() {
|
|
5824
5811
|
return {
|
|
5825
5812
|
name: 'rsbuild:module-federation',
|
|
@@ -5844,9 +5831,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5844
5831
|
let { options } = config.moduleFederation;
|
|
5845
5832
|
chain.plugin(CHAIN_ID.PLUGIN.MODULE_FEDERATION).use(rspack_rspack.container.ModuleFederationPlugin, [
|
|
5846
5833
|
options
|
|
5847
|
-
]), options.name && (
|
|
5848
|
-
options.name
|
|
5849
|
-
]), chain.output.get('uniqueName') || chain.output.set('uniqueName', options.name));
|
|
5834
|
+
]), options.name && !chain.output.get('uniqueName') && chain.output.set('uniqueName', options.name);
|
|
5850
5835
|
}));
|
|
5851
5836
|
}
|
|
5852
5837
|
};
|
|
@@ -8332,8 +8317,16 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
8332
8317
|
};
|
|
8333
8318
|
preEntry.forEach(addEntry), injectCoreJsEntry && addEntry(createVirtualModule('import "core-js";')), helpers_castArray(entry[entryName]).forEach(addEntry);
|
|
8334
8319
|
}
|
|
8335
|
-
}), api.onBeforeCreateCompiler(
|
|
8336
|
-
|
|
8320
|
+
}), api.onBeforeCreateCompiler({
|
|
8321
|
+
order: 'post',
|
|
8322
|
+
handler: ({ bundlerConfigs })=>{
|
|
8323
|
+
if (bundlerConfigs.some((config)=>config.entry)) return;
|
|
8324
|
+
let isModuleFederationPlugin = (plugin)=>isObject(plugin) && 'ModuleFederationPlugin' === plugin.constructor.name;
|
|
8325
|
+
if (bundlerConfigs.some(({ plugins })=>plugins?.some(isModuleFederationPlugin))) return void bundlerConfigs.forEach((config)=>{
|
|
8326
|
+
config.entry = {};
|
|
8327
|
+
});
|
|
8328
|
+
throw Error(`${color.dim('[rsbuild:config]')} Could not find any entry module, please make sure that ${color.yellow('src/index.(ts|js|tsx|jsx|mts|cts|mjs|cjs)')} exists, or customize entry through the ${color.yellow('source.entry')} configuration.`);
|
|
8329
|
+
}
|
|
8337
8330
|
});
|
|
8338
8331
|
}
|
|
8339
8332
|
},
|
|
@@ -8384,9 +8377,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
8384
8377
|
let { config } = environment, { bundlerType } = api.context, buildCache = config.performance.buildCache ?? 'webpack' === bundlerType;
|
|
8385
8378
|
if (!1 === buildCache) return;
|
|
8386
8379
|
cacheEnabled = !0;
|
|
8387
|
-
let { context } = api, cacheConfig = 'boolean' == typeof buildCache ? {} : buildCache, cacheDirectory = getCacheDirectory(cacheConfig, context), buildDependencies = await getBuildDependencies(context, config, environment, cacheConfig.buildDependencies
|
|
8388
|
-
userBuildDependencies: cacheConfig.buildDependencies
|
|
8389
|
-
} : {});
|
|
8380
|
+
let { context } = api, cacheConfig = 'boolean' == typeof buildCache ? {} : buildCache, cacheDirectory = getCacheDirectory(cacheConfig, context), buildDependencies = await getBuildDependencies(context, config, environment, cacheConfig.buildDependencies);
|
|
8390
8381
|
'webpack' === bundlerType && await validateWebpackCache(cacheDirectory, buildDependencies);
|
|
8391
8382
|
let cacheVersion = Array.isArray(cacheConfig.cacheDigest) && cacheConfig.cacheDigest.length ? `${environment.name}-${env}-${await helpers_hash(JSON.stringify(cacheConfig.cacheDigest))}` : `${environment.name}-${env}`;
|
|
8392
8383
|
'rspack' === bundlerType ? (chain.cache(!0), chain.experiments({
|
|
@@ -9135,7 +9126,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
9135
9126
|
api.modifyBundlerChain((chain, { environment, target })=>{
|
|
9136
9127
|
let { config } = environment;
|
|
9137
9128
|
if (config.output.module) {
|
|
9138
|
-
if ('
|
|
9129
|
+
if ('node' === target && chain.output.library({
|
|
9139
9130
|
...chain.output.get('library'),
|
|
9140
9131
|
type: 'module'
|
|
9141
9132
|
}), 'web-worker' === target) throw Error('[rsbuild:config] `output.module` is not supported for web-worker target.');
|
|
@@ -9868,7 +9859,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
9868
9859
|
};
|
|
9869
9860
|
function setupCommands() {
|
|
9870
9861
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
9871
|
-
cli.version("1.6.
|
|
9862
|
+
cli.version("1.6.7-canary-57e2a56d-20251120152633"), 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)', {
|
|
9872
9863
|
default: 'auto'
|
|
9873
9864
|
}).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', {
|
|
9874
9865
|
type: [
|
|
@@ -9937,7 +9928,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
9937
9928
|
}
|
|
9938
9929
|
function showGreeting() {
|
|
9939
9930
|
let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
|
|
9940
|
-
logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.
|
|
9931
|
+
logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.7-canary-57e2a56d-20251120152633\n`);
|
|
9941
9932
|
}
|
|
9942
9933
|
function setupLogLevel() {
|
|
9943
9934
|
let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
|
|
@@ -9958,7 +9949,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
9958
9949
|
logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
|
|
9959
9950
|
}
|
|
9960
9951
|
}
|
|
9961
|
-
let src_version = "1.6.
|
|
9952
|
+
let src_version = "1.6.7-canary-57e2a56d-20251120152633";
|
|
9962
9953
|
})(), 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 === [
|
|
9963
9954
|
"PLUGIN_CSS_NAME",
|
|
9964
9955
|
"PLUGIN_SWC_NAME",
|