@rspack/core 2.0.0-canary-20260116 → 2.0.0-canary.20260120
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/dist/Compiler.d.ts +3 -1
- package/dist/RuntimeGlobals.d.ts +1 -1
- package/dist/builtin-loader/lightningcss/index.d.ts +11 -9
- package/dist/builtin-loader/lightningcss/target.d.ts +4 -0
- package/dist/builtin-loader/swc/index.d.ts +2 -2
- package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +2 -0
- package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +5 -4
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +3 -2
- package/dist/config/adapterRuleUse.d.ts +2 -1
- package/dist/config/defaults.d.ts +4 -2
- package/dist/config/target.d.ts +14 -11
- package/dist/config/types.d.ts +13 -1
- package/dist/cssExtractLoader.js +3 -3
- package/dist/index.js +452 -143
- package/dist/util/targetsVersion.d.ts +2 -0
- package/hot/lazy-compilation-node.js +91 -34
- package/hot/lazy-compilation-web.js +61 -35
- package/package.json +8 -7
- package/compiled/browserslist-load-config/index.d.ts +0 -21
- package/compiled/browserslist-load-config/index.js +0 -252
- package/compiled/browserslist-load-config/license +0 -21
- package/compiled/browserslist-load-config/package.json +0 -1
- package/dist/builtin-loader/index.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -2163,6 +2163,11 @@ class EnableLibraryPlugin extends RspackBuiltinPlugin {
|
|
|
2163
2163
|
}
|
|
2164
2164
|
}
|
|
2165
2165
|
let EnableWasmLoadingPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EnableWasmLoadingPlugin, (type)=>type), EnsureChunkConditionsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EnsureChunkConditionsPlugin, ()=>{}), RemoveDuplicateModulesPlugin = base_create(binding_namespaceObject.BuiltinPluginName.RemoveDuplicateModulesPlugin, ()=>({}));
|
|
2166
|
+
function applyLimits(options) {
|
|
2167
|
+
options.optimization.concatenateModules = !1, options.optimization.removeEmptyChunks = !1, options.output.chunkFormat = !1, options.output.module = !0, options.output.chunkLoading && 'import' !== options.output.chunkLoading && (options.output.chunkLoading = 'import'), void 0 === options.output.chunkLoading && (options.output.chunkLoading = 'import');
|
|
2168
|
+
let { splitChunks } = options.optimization;
|
|
2169
|
+
void 0 === splitChunks && (splitChunks = options.optimization.splitChunks = {}), !1 !== splitChunks && (splitChunks.chunks = 'all', splitChunks.minSize = 0, splitChunks.maxAsyncRequests = 1 / 0, splitChunks.maxInitialRequests = 1 / 0, splitChunks.cacheGroups ??= {}, splitChunks.cacheGroups.default = !1, splitChunks.cacheGroups.defaultVendors = !1);
|
|
2170
|
+
}
|
|
2166
2171
|
class EsmLibraryPlugin {
|
|
2167
2172
|
static PLUGIN_NAME = 'EsmLibraryPlugin';
|
|
2168
2173
|
options;
|
|
@@ -2171,12 +2176,8 @@ class EsmLibraryPlugin {
|
|
|
2171
2176
|
}
|
|
2172
2177
|
apply(compiler) {
|
|
2173
2178
|
var config;
|
|
2174
|
-
let err
|
|
2175
|
-
if (
|
|
2176
|
-
options.optimization.concatenateModules = !1, options.optimization.removeEmptyChunks = !1, options.output.chunkFormat = !1, options.output.module = !0, options.output.chunkLoading && 'import' !== options.output.chunkLoading && (logger.warn(`\`output.chunkLoading\` should be \`"import"\` or \`false\`, but got ${options.output.chunkLoading}, changed it to \`"import"\``), options.output.chunkLoading = 'import'), void 0 === options.output.chunkLoading && (options.output.chunkLoading = 'import'), options.output.library && (options.output.library = void 0);
|
|
2177
|
-
let { splitChunks } = options.optimization;
|
|
2178
|
-
void 0 === splitChunks && (splitChunks = options.optimization.splitChunks = {}), !1 !== splitChunks && (splitChunks.chunks = 'all', splitChunks.minSize = 0, splitChunks.maxAsyncRequests = 1 / 0, splitChunks.maxInitialRequests = 1 / 0, splitChunks.cacheGroups ??= {}, splitChunks.cacheGroups.default = !1, splitChunks.cacheGroups.defaultVendors = !1);
|
|
2179
|
-
}(compiler.options, logger), new RemoveDuplicateModulesPlugin().apply(compiler), err = (config = compiler.options).optimization.concatenateModules ? 'You should disable `config.optimization.concatenateModules`' : !1 !== config.output.chunkFormat ? 'You should disable default chunkFormat by `config.output.chunkFormat = false`' : void 0) throw new lib_WebpackError(`Conflicted config for ${EsmLibraryPlugin.PLUGIN_NAME}: ${err}`);
|
|
2179
|
+
let err;
|
|
2180
|
+
if (applyLimits(compiler.options), new RemoveDuplicateModulesPlugin().apply(compiler), err = (config = compiler.options).optimization.concatenateModules ? 'You should disable `config.optimization.concatenateModules`' : !1 !== config.output.chunkFormat ? (console.log(config.output.chunkFormat), 'You should disable default chunkFormat by `config.output.chunkFormat = false`') : void 0) throw new lib_WebpackError(`Conflicted config for ${EsmLibraryPlugin.PLUGIN_NAME}: ${err}`);
|
|
2180
2181
|
compiler.__internal__registerBuiltinPlugin({
|
|
2181
2182
|
name: binding_namespaceObject.BuiltinPluginName.EsmLibraryPlugin,
|
|
2182
2183
|
options: {
|
|
@@ -2204,7 +2205,11 @@ function stringifyLoaderObject(o) {
|
|
|
2204
2205
|
let unsupported = (name, issue)=>{
|
|
2205
2206
|
let s = `${name} is not supported by Rspack.`;
|
|
2206
2207
|
throw issue && (s += ` Refer to issue ${issue} for more information.`), Error(s);
|
|
2207
|
-
}, warnedMessages = new Set()
|
|
2208
|
+
}, warnedMessages = new Set();
|
|
2209
|
+
function deprecate(message) {
|
|
2210
|
+
warnedMessages.has(message) || (warnedMessages.add(message), console.warn(`[Rspack Deprecation] ${message}`));
|
|
2211
|
+
}
|
|
2212
|
+
let WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>'' === relativePath ? './.' : '..' === relativePath ? '../.' : relativePath.startsWith('../') ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
|
|
2208
2213
|
if ('/' === maybeAbsolutePath[0]) {
|
|
2209
2214
|
if (maybeAbsolutePath.length > 1 && '/' === maybeAbsolutePath[maybeAbsolutePath.length - 1]) return maybeAbsolutePath;
|
|
2210
2215
|
let querySplitPos = maybeAbsolutePath.indexOf('?'), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
|
|
@@ -2285,6 +2290,40 @@ let unsupported = (name, issue)=>{
|
|
|
2285
2290
|
query: match[2] ? match[2].replace(/\u200b(.)/g, '$1') : ''
|
|
2286
2291
|
};
|
|
2287
2292
|
});
|
|
2293
|
+
function encodeVersion(version) {
|
|
2294
|
+
let [major, minor = 0, patch = 0] = version.split('-')[0].split('.').map((v)=>parseInt(v, 10));
|
|
2295
|
+
return Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch) ? null : major << 16 | minor << 8 | patch;
|
|
2296
|
+
}
|
|
2297
|
+
function decodeVersion(n) {
|
|
2298
|
+
return `${n >> 16 & 0xff}.${n >> 8 & 0xff}.${0xff & n}`;
|
|
2299
|
+
}
|
|
2300
|
+
function encodeTargets(targets) {
|
|
2301
|
+
return Object.fromEntries(Object.entries(targets).map(([k, v])=>[
|
|
2302
|
+
k,
|
|
2303
|
+
encodeVersion(v)
|
|
2304
|
+
]));
|
|
2305
|
+
}
|
|
2306
|
+
function defaultTargetsFromRspackTargets(targets) {
|
|
2307
|
+
let REMAP = {
|
|
2308
|
+
and_chr: 'chrome',
|
|
2309
|
+
and_ff: 'firefox',
|
|
2310
|
+
ie_mob: 'ie',
|
|
2311
|
+
op_mob: 'opera',
|
|
2312
|
+
and_qq: null,
|
|
2313
|
+
and_uc: null,
|
|
2314
|
+
baidu: null,
|
|
2315
|
+
bb: null,
|
|
2316
|
+
kaios: null,
|
|
2317
|
+
op_mini: null
|
|
2318
|
+
}, result = {};
|
|
2319
|
+
for (let [k, v] of Object.entries(targets)){
|
|
2320
|
+
let remap = REMAP[k];
|
|
2321
|
+
if (null === remap) continue;
|
|
2322
|
+
let name = remap || k, version = encodeVersion(v);
|
|
2323
|
+
null !== version && (result[name] = version);
|
|
2324
|
+
}
|
|
2325
|
+
return result;
|
|
2326
|
+
}
|
|
2288
2327
|
function toFeatures(featureOptions) {
|
|
2289
2328
|
let feature = 0;
|
|
2290
2329
|
for (let key of Reflect.ownKeys(featureOptions))if (!0 === featureOptions[key]) switch(key){
|
|
@@ -2359,6 +2398,12 @@ function toFeatures(featureOptions) {
|
|
|
2359
2398
|
}
|
|
2360
2399
|
return feature;
|
|
2361
2400
|
}
|
|
2401
|
+
function resolveCollectTypeScriptInfo(options) {
|
|
2402
|
+
return {
|
|
2403
|
+
typeExports: options.typeExports,
|
|
2404
|
+
exportedEnum: !0 === options.exportedEnum ? 'all' : !1 === options.exportedEnum || void 0 === options.exportedEnum ? 'none' : 'const-only'
|
|
2405
|
+
};
|
|
2406
|
+
}
|
|
2362
2407
|
let $assets = Symbol('assets');
|
|
2363
2408
|
Object.defineProperty(binding_default().KnownBuildInfo.prototype, node_util.inspect.custom, {
|
|
2364
2409
|
enumerable: !0,
|
|
@@ -3332,7 +3377,7 @@ async function runLoaders(compiler, context) {
|
|
|
3332
3377
|
_compiler: {
|
|
3333
3378
|
options: {
|
|
3334
3379
|
experiments: {
|
|
3335
|
-
css:
|
|
3380
|
+
css: !0
|
|
3336
3381
|
}
|
|
3337
3382
|
}
|
|
3338
3383
|
},
|
|
@@ -3575,15 +3620,38 @@ function createRawModuleRuleUses(uses, path, options) {
|
|
|
3575
3620
|
let o, isBuiltin = !1;
|
|
3576
3621
|
if (use.loader.startsWith(BUILTIN_LOADER_PREFIX)) {
|
|
3577
3622
|
let temp = function(identifier, o, options) {
|
|
3578
|
-
if (identifier.startsWith(`${BUILTIN_LOADER_PREFIX}swc-loader`)) return ((
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
options.jsc ??= {}, options.jsc.experimental ??= {}, options.jsc.experimental.disableAllLints ??= !0, options.
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3623
|
+
if (identifier.startsWith(`${BUILTIN_LOADER_PREFIX}swc-loader`)) return ((o, composeOptions)=>{
|
|
3624
|
+
let options = o ?? {};
|
|
3625
|
+
if ('object' == typeof options) {
|
|
3626
|
+
if (options.jsc ??= {}, options.jsc.experimental ??= {}, options.jsc.experimental.disableAllLints ??= !0, options.env?.targets === void 0 && options.jsc?.target === void 0) {
|
|
3627
|
+
if (composeOptions.compiler.target?.targets) options.env ??= {}, options.env.targets ??= function(targets) {
|
|
3628
|
+
let REMAP = {
|
|
3629
|
+
and_chr: 'chrome',
|
|
3630
|
+
and_ff: 'firefox',
|
|
3631
|
+
ie_mob: 'ie',
|
|
3632
|
+
ios_saf: 'ios',
|
|
3633
|
+
op_mob: 'opera',
|
|
3634
|
+
and_qq: null,
|
|
3635
|
+
and_uc: null,
|
|
3636
|
+
baidu: null,
|
|
3637
|
+
bb: null,
|
|
3638
|
+
kaios: null,
|
|
3639
|
+
op_mini: null
|
|
3640
|
+
}, result = {};
|
|
3641
|
+
for (let [k, version] of Object.entries(targets)){
|
|
3642
|
+
let remap = REMAP[k];
|
|
3643
|
+
null !== remap && (result[remap || k] = version);
|
|
3644
|
+
}
|
|
3645
|
+
return result;
|
|
3646
|
+
}(composeOptions.compiler.target.targets);
|
|
3647
|
+
else if (composeOptions.compiler.target?.esVersion) {
|
|
3648
|
+
let { esVersion } = composeOptions.compiler.target;
|
|
3649
|
+
options.jsc.target ??= esVersion >= 2015 ? `es${esVersion}` : 'es5';
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
options.collectTypeScriptInfo && (options.collectTypeScriptInfo = resolveCollectTypeScriptInfo(options.collectTypeScriptInfo));
|
|
3585
3653
|
let { rspackExperiments } = options;
|
|
3586
|
-
rspackExperiments && (rspackExperiments.import || rspackExperiments.pluginImport) && (rspackExperiments.import = function(pluginImport) {
|
|
3654
|
+
rspackExperiments && ((rspackExperiments.import || rspackExperiments.pluginImport) && (rspackExperiments.import = function(pluginImport) {
|
|
3587
3655
|
if (pluginImport) return pluginImport.map((config)=>{
|
|
3588
3656
|
let rawConfig = {
|
|
3589
3657
|
...config,
|
|
@@ -3601,15 +3669,18 @@ function createRawModuleRuleUses(uses, path, options) {
|
|
|
3601
3669
|
styleLibraryDirectory: config.styleLibraryDirectory
|
|
3602
3670
|
}), rawConfig;
|
|
3603
3671
|
});
|
|
3604
|
-
}(rspackExperiments.import || rspackExperiments.pluginImport));
|
|
3672
|
+
}(rspackExperiments.import || rspackExperiments.pluginImport)), rspackExperiments.collectTypeScriptInfo && (deprecate('`rspackExperiments.collectTypeScriptInfo` is deprecated and will be removed in Rspack v2.0. Use top-level `collectTypeScriptInfo` instead.'), options.collectTypeScriptInfo || (options.collectTypeScriptInfo = resolveCollectTypeScriptInfo(rspackExperiments.collectTypeScriptInfo)), delete rspackExperiments.collectTypeScriptInfo));
|
|
3605
3673
|
}
|
|
3606
3674
|
return options;
|
|
3607
|
-
})(o,
|
|
3608
|
-
if (identifier.startsWith(`${BUILTIN_LOADER_PREFIX}lightningcss-loader`))
|
|
3609
|
-
|
|
3610
|
-
|
|
3675
|
+
})(o, options);
|
|
3676
|
+
if (identifier.startsWith(`${BUILTIN_LOADER_PREFIX}lightningcss-loader`)) {
|
|
3677
|
+
let options1;
|
|
3678
|
+
return 'object' == typeof (options1 = o ?? {}) && ('string' == typeof options1.targets ? options1.targets = [
|
|
3679
|
+
options1.targets
|
|
3680
|
+
] : 'object' != typeof options1.targets || Array.isArray(options1.targets) ? void 0 === options1.targets && options.compiler.target?.targets && (options1.targets = defaultTargetsFromRspackTargets(options.compiler.target.targets)) : options1.targets = encodeTargets(options1.targets), options1.include && 'object' == typeof options1.include && (options1.include = toFeatures(options1.include)), options1.exclude && 'object' == typeof options1.exclude && (options1.exclude = toFeatures(options1.exclude))), options1;
|
|
3681
|
+
}
|
|
3611
3682
|
return o;
|
|
3612
|
-
}(use.loader, use.options,
|
|
3683
|
+
}(use.loader, use.options, options1);
|
|
3613
3684
|
o = isNil(temp) ? void 0 : 'string' == typeof temp ? temp : JSON.stringify(temp, null, 2), isBuiltin = !0;
|
|
3614
3685
|
}
|
|
3615
3686
|
return {
|
|
@@ -4277,9 +4348,13 @@ let JsLoaderRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName
|
|
|
4277
4348
|
path,
|
|
4278
4349
|
type
|
|
4279
4350
|
};
|
|
4280
|
-
}), LightningCssMinimizerRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName.LightningCssMinimizerRspackPlugin, (options)
|
|
4281
|
-
let { include, exclude, nonStandard, pseudoClasses, drafts } = options?.minimizerOptions ?? {}, targets =
|
|
4282
|
-
|
|
4351
|
+
}), LightningCssMinimizerRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName.LightningCssMinimizerRspackPlugin, function(options) {
|
|
4352
|
+
let { include, exclude, nonStandard, pseudoClasses, drafts } = options?.minimizerOptions ?? {}, targets = [
|
|
4353
|
+
'fully supports es6'
|
|
4354
|
+
];
|
|
4355
|
+
return options?.minimizerOptions?.targets ? 'string' == typeof options.minimizerOptions.targets ? targets = [
|
|
4356
|
+
options.minimizerOptions.targets
|
|
4357
|
+
] : Array.isArray(options.minimizerOptions.targets) ? targets = options.minimizerOptions.targets : 'object' == typeof options.minimizerOptions.targets && (targets = encodeTargets(options.minimizerOptions.targets)) : this.target.targets && (targets = defaultTargetsFromRspackTargets(this.target.targets)), {
|
|
4283
4358
|
test: options?.test,
|
|
4284
4359
|
include: options?.include,
|
|
4285
4360
|
exclude: options?.exclude,
|
|
@@ -4289,9 +4364,7 @@ let JsLoaderRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName
|
|
|
4289
4364
|
unusedSymbols: options?.minimizerOptions?.unusedSymbols ?? [],
|
|
4290
4365
|
include: include ? toFeatures(include) : void 0,
|
|
4291
4366
|
exclude: exclude ? toFeatures(exclude) : void 0,
|
|
4292
|
-
targets
|
|
4293
|
-
targets
|
|
4294
|
-
] : targets,
|
|
4367
|
+
targets,
|
|
4295
4368
|
drafts: drafts ? {
|
|
4296
4369
|
customMedia: drafts.customMedia ?? !1
|
|
4297
4370
|
} : void 0,
|
|
@@ -4348,16 +4421,44 @@ function applyPlugin(compiler, options, activeModules) {
|
|
|
4348
4421
|
}
|
|
4349
4422
|
let lazyCompilationMiddlewareInternal = (compiler, activeModules, lazyCompilationPrefix)=>{
|
|
4350
4423
|
let logger = compiler.getInfrastructureLogger('LazyCompilation');
|
|
4351
|
-
return (req, res, next)=>{
|
|
4352
|
-
if (!req.url?.startsWith(lazyCompilationPrefix)) return next?.();
|
|
4353
|
-
let modules =
|
|
4354
|
-
|
|
4424
|
+
return async (req, res, next)=>{
|
|
4425
|
+
if (!req.url?.startsWith(lazyCompilationPrefix) || 'POST' !== req.method) return next?.();
|
|
4426
|
+
let modules = [];
|
|
4427
|
+
try {
|
|
4428
|
+
modules = await function(req) {
|
|
4429
|
+
if (void 0 !== req.body) {
|
|
4430
|
+
if (Array.isArray(req.body)) return Promise.resolve(req.body);
|
|
4431
|
+
if ('string' == typeof req.body) return Promise.resolve(req.body.split('\n').filter(Boolean));
|
|
4432
|
+
throw Error('Invalid body type');
|
|
4433
|
+
}
|
|
4434
|
+
return new Promise((resolve, reject)=>{
|
|
4435
|
+
if (req.aborted || req.destroyed) return void reject(Error('Request was aborted before body could be read'));
|
|
4436
|
+
let cleanup = ()=>{
|
|
4437
|
+
req.removeListener('data', onData), req.removeListener('end', onEnd), req.removeListener('error', onError), req.removeListener('close', onClose), req.removeListener('aborted', onAborted);
|
|
4438
|
+
}, chunks = [], onData = (chunk)=>{
|
|
4439
|
+
chunks.push(chunk);
|
|
4440
|
+
}, onEnd = ()=>{
|
|
4441
|
+
cleanup(), resolve(Buffer.concat(chunks).toString('utf8').split('\n').filter(Boolean));
|
|
4442
|
+
}, onError = (err)=>{
|
|
4443
|
+
cleanup(), reject(err);
|
|
4444
|
+
}, onClose = ()=>{
|
|
4445
|
+
cleanup(), reject(Error('Request was closed before body could be read'));
|
|
4446
|
+
}, onAborted = ()=>{
|
|
4447
|
+
cleanup(), reject(Error('Request was aborted before body could be read'));
|
|
4448
|
+
};
|
|
4449
|
+
req.on('data', onData), req.on('end', onEnd), req.on('error', onError), req.on('close', onClose), req.on('aborted', onAborted);
|
|
4450
|
+
});
|
|
4451
|
+
}(req);
|
|
4452
|
+
} catch (err) {
|
|
4453
|
+
logger.error('Failed to parse request body: ' + err), res.writeHead(400), res.end('Bad Request');
|
|
4454
|
+
return;
|
|
4455
|
+
}
|
|
4355
4456
|
let moduleActivated = [];
|
|
4356
4457
|
for (let key of modules){
|
|
4357
4458
|
let activated = activeModules.has(key);
|
|
4358
4459
|
activeModules.add(key), activated || (logger.log(`${key} is now in use and will be compiled.`), moduleActivated.push(key));
|
|
4359
4460
|
}
|
|
4360
|
-
moduleActivated.length && compiler.watching && compiler.watching.invalidate();
|
|
4461
|
+
moduleActivated.length && compiler.watching && compiler.watching.invalidate(), res.writeHead(200), res.write('\n'), res.end();
|
|
4361
4462
|
};
|
|
4362
4463
|
};
|
|
4363
4464
|
class MangleExportsPlugin extends RspackBuiltinPlugin {
|
|
@@ -4661,8 +4762,8 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
|
|
|
4661
4762
|
function normalizePath(path) {
|
|
4662
4763
|
return path.replace(/\?.*$/, '').split(sep).join('/');
|
|
4663
4764
|
}
|
|
4664
|
-
let SwcJsMinimizerRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SwcJsMinimizerRspackPlugin, (options)
|
|
4665
|
-
let compress = options?.minimizerOptions?.compress ?? !0, mangle = options?.minimizerOptions?.mangle ?? !0, ecma = options?.minimizerOptions?.ecma ?? 5, format = {
|
|
4765
|
+
let SwcJsMinimizerRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SwcJsMinimizerRspackPlugin, function(options) {
|
|
4766
|
+
let compress = options?.minimizerOptions?.compress ?? !0, mangle = options?.minimizerOptions?.mangle ?? !0, ecma = options?.minimizerOptions?.ecma ?? (this.target?.esVersion && this.target.esVersion > 2022 ? 2022 : this.target.esVersion) ?? 5, format = {
|
|
4666
4767
|
comments: !1,
|
|
4667
4768
|
...options?.minimizerOptions?.format
|
|
4668
4769
|
};
|
|
@@ -4968,7 +5069,140 @@ let DYNAMIC_INFO = Symbol('cleverMerge dynamic info'), mergeCache = new WeakMap(
|
|
|
4968
5069
|
default:
|
|
4969
5070
|
throw Error('Not implemented');
|
|
4970
5071
|
}
|
|
4971
|
-
}
|
|
5072
|
+
};
|
|
5073
|
+
class BrowserslistError extends Error {
|
|
5074
|
+
constructor(message){
|
|
5075
|
+
var key, value;
|
|
5076
|
+
super(message), value = void 0, (key = "browserslist") in this ? Object.defineProperty(this, key, {
|
|
5077
|
+
value: value,
|
|
5078
|
+
enumerable: !0,
|
|
5079
|
+
configurable: !0,
|
|
5080
|
+
writable: !0
|
|
5081
|
+
}) : this[key] = value, this.name = 'BrowserslistError', this.browserslist = !0, Error.captureStackTrace && Error.captureStackTrace(this, BrowserslistError);
|
|
5082
|
+
}
|
|
5083
|
+
}
|
|
5084
|
+
let isFileCache = {};
|
|
5085
|
+
function isFile(file) {
|
|
5086
|
+
if (file in isFileCache) return isFileCache[file];
|
|
5087
|
+
let result = node_fs.existsSync(file) && node_fs.statSync(file).isFile();
|
|
5088
|
+
return isFileCache[file] = result, result;
|
|
5089
|
+
}
|
|
5090
|
+
function parsePackage(file) {
|
|
5091
|
+
let config = JSON.parse(node_fs.readFileSync(file).toString().replace(/^\uFEFF/m, ''));
|
|
5092
|
+
if (config.browserlist && !config.browserslist) throw new BrowserslistError(`\`browserlist\` key instead of \`browserslist\` in ${file}`);
|
|
5093
|
+
let list = config.browserslist;
|
|
5094
|
+
for(let i in Array.isArray(list) && (list = {
|
|
5095
|
+
defaults: list
|
|
5096
|
+
}), 'string' == typeof list && (list = parseConfig(list)), list)!function(section) {
|
|
5097
|
+
let FORMAT = 'Browserslist config should be a string or an array of strings with browser queries';
|
|
5098
|
+
if (Array.isArray(section)) {
|
|
5099
|
+
for(let i = 0; i < section.length; i++)if ('string' != typeof section[i]) throw new BrowserslistError(FORMAT);
|
|
5100
|
+
} else if ('string' != typeof section) throw new BrowserslistError(FORMAT);
|
|
5101
|
+
}(list[i]);
|
|
5102
|
+
return list;
|
|
5103
|
+
}
|
|
5104
|
+
let IS_SECTION = /^\s*\[(.+)]\s*$/;
|
|
5105
|
+
function parseConfig(string) {
|
|
5106
|
+
let result = {
|
|
5107
|
+
defaults: []
|
|
5108
|
+
}, sections = [
|
|
5109
|
+
'defaults'
|
|
5110
|
+
];
|
|
5111
|
+
return string.toString().replace(/#[^\n]*/g, '').split(/\n|,/).map((line)=>line.trim()).filter((line)=>'' !== line).forEach((line)=>{
|
|
5112
|
+
let matched = line.match(IS_SECTION);
|
|
5113
|
+
matched ? (sections = matched[1].trim().split(' ')).forEach((section)=>{
|
|
5114
|
+
if (result[section]) throw new BrowserslistError(`Duplicate section ${section} in Browserslist config`);
|
|
5115
|
+
result[section] = [];
|
|
5116
|
+
}) : sections.forEach((section)=>{
|
|
5117
|
+
result[section].push(line);
|
|
5118
|
+
});
|
|
5119
|
+
}), result;
|
|
5120
|
+
}
|
|
5121
|
+
function eachParent(file, callback) {
|
|
5122
|
+
let dir = isFile(file) ? node_path.dirname(file) : file, loc = node_path.resolve(dir);
|
|
5123
|
+
do {
|
|
5124
|
+
let result = callback(loc);
|
|
5125
|
+
if (void 0 !== result) return result;
|
|
5126
|
+
}while (loc !== (loc = node_path.dirname(loc)));
|
|
5127
|
+
}
|
|
5128
|
+
let configCache = {}, ES_VERSIONS_MAP = {
|
|
5129
|
+
chrome: [
|
|
5130
|
+
51,
|
|
5131
|
+
52,
|
|
5132
|
+
57,
|
|
5133
|
+
64,
|
|
5134
|
+
73,
|
|
5135
|
+
80,
|
|
5136
|
+
85,
|
|
5137
|
+
94,
|
|
5138
|
+
110,
|
|
5139
|
+
119
|
|
5140
|
+
],
|
|
5141
|
+
edge: [
|
|
5142
|
+
15,
|
|
5143
|
+
15,
|
|
5144
|
+
15,
|
|
5145
|
+
79,
|
|
5146
|
+
79,
|
|
5147
|
+
80,
|
|
5148
|
+
85,
|
|
5149
|
+
94,
|
|
5150
|
+
110,
|
|
5151
|
+
119
|
|
5152
|
+
],
|
|
5153
|
+
safari: [
|
|
5154
|
+
10,
|
|
5155
|
+
10.3,
|
|
5156
|
+
11,
|
|
5157
|
+
16.4,
|
|
5158
|
+
17,
|
|
5159
|
+
17,
|
|
5160
|
+
17,
|
|
5161
|
+
17,
|
|
5162
|
+
17,
|
|
5163
|
+
17.4
|
|
5164
|
+
],
|
|
5165
|
+
firefox: [
|
|
5166
|
+
54,
|
|
5167
|
+
54,
|
|
5168
|
+
54,
|
|
5169
|
+
78,
|
|
5170
|
+
78,
|
|
5171
|
+
80,
|
|
5172
|
+
80,
|
|
5173
|
+
93,
|
|
5174
|
+
115,
|
|
5175
|
+
145
|
|
5176
|
+
],
|
|
5177
|
+
opera: [
|
|
5178
|
+
38,
|
|
5179
|
+
39,
|
|
5180
|
+
44,
|
|
5181
|
+
51,
|
|
5182
|
+
60,
|
|
5183
|
+
67,
|
|
5184
|
+
71,
|
|
5185
|
+
80,
|
|
5186
|
+
96,
|
|
5187
|
+
105
|
|
5188
|
+
],
|
|
5189
|
+
samsung: [
|
|
5190
|
+
5,
|
|
5191
|
+
6.2,
|
|
5192
|
+
6.2,
|
|
5193
|
+
8.2,
|
|
5194
|
+
11.1,
|
|
5195
|
+
13,
|
|
5196
|
+
14,
|
|
5197
|
+
17,
|
|
5198
|
+
21,
|
|
5199
|
+
25
|
|
5200
|
+
]
|
|
5201
|
+
}, aliases = {
|
|
5202
|
+
ios_saf: 'safari',
|
|
5203
|
+
and_chr: 'chrome',
|
|
5204
|
+
and_ff: 'firefox'
|
|
5205
|
+
}, renameBrowser = (name)=>aliases[name] || name, browserslistTargetHandler_resolve = (browsers)=>{
|
|
4972
5206
|
let rawChecker = (versions)=>browsers.every((v)=>{
|
|
4973
5207
|
let [name, parsedVersion] = v.split(' ');
|
|
4974
5208
|
if (!name) return !1;
|
|
@@ -5400,10 +5634,32 @@ let DYNAMIC_INFO = Symbol('cleverMerge dynamic info'), mergeCache = new WeakMap(
|
|
|
5400
5634
|
}),
|
|
5401
5635
|
require: nodeProperty
|
|
5402
5636
|
};
|
|
5403
|
-
},
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5637
|
+
}, getBrowserslistTargetHandler = memoize(()=>browserslistTargetHandler_namespaceObject), hasBrowserslistConfig = (context)=>!!function(from) {
|
|
5638
|
+
let resolved, fromDir = isFile(from = node_path.resolve(from)) ? node_path.dirname(from) : from;
|
|
5639
|
+
if (fromDir in configCache) return configCache[fromDir];
|
|
5640
|
+
let configFile = eachParent(from, (dir)=>{
|
|
5641
|
+
let pkgBrowserslist, config = node_path.join(dir, 'browserslist'), pkg = node_path.join(dir, 'package.json'), rc = node_path.join(dir, '.browserslistrc');
|
|
5642
|
+
if (isFile(pkg)) try {
|
|
5643
|
+
pkgBrowserslist = parsePackage(pkg);
|
|
5644
|
+
} catch (e) {
|
|
5645
|
+
if (e instanceof BrowserslistError) throw e;
|
|
5646
|
+
console.warn(`[Browserslist] Could not parse ${pkg}. Ignoring it.`);
|
|
5647
|
+
}
|
|
5648
|
+
if (isFile(config) && pkgBrowserslist) throw new BrowserslistError(`${dir} contains both browserslist and package.json with browsers`);
|
|
5649
|
+
if (isFile(rc) && pkgBrowserslist) throw new BrowserslistError(`${dir} contains both .browserslistrc and package.json with browsers`);
|
|
5650
|
+
if (isFile(config) && isFile(rc)) throw new BrowserslistError(`${dir} contains both .browserslistrc and browserslist`);
|
|
5651
|
+
return isFile(config) ? config : isFile(rc) ? rc : pkgBrowserslist ? pkg : void 0;
|
|
5652
|
+
});
|
|
5653
|
+
configFile && (resolved = function(file) {
|
|
5654
|
+
if ('package.json' === node_path.basename(file)) return parsePackage(file);
|
|
5655
|
+
if (!isFile(file)) throw new BrowserslistError(`Can't read ${file} config`);
|
|
5656
|
+
return parseConfig(node_fs.readFileSync(file, 'utf-8'));
|
|
5657
|
+
}(configFile));
|
|
5658
|
+
let configDir = configFile && node_path.dirname(configFile);
|
|
5659
|
+
return eachParent(from, (dir)=>{
|
|
5660
|
+
if (resolved && (configCache[dir] = resolved), dir === configDir) return null;
|
|
5661
|
+
}), resolved;
|
|
5662
|
+
}(context), versionDependent = (major, minor)=>{
|
|
5407
5663
|
if (!major) return ()=>void 0;
|
|
5408
5664
|
let nMajor = +major, nMinor = minor ? +minor : 0;
|
|
5409
5665
|
return (vMajor, vMinor = 0)=>nMajor > vMajor || nMajor === vMajor && nMinor >= vMinor;
|
|
@@ -5419,7 +5675,35 @@ See https://github.com/browserslist/browserslist#queries for possible ways to pr
|
|
|
5419
5675
|
The recommended way is to add a 'browserslist' key to your package.json and list supported browsers (resp. node.js versions).
|
|
5420
5676
|
You can also more options via the 'target' option: 'browserslist' / 'browserslist:env' / 'browserslist:query' / 'browserslist:path-to-config' / 'browserslist:path-to-config:env'`);
|
|
5421
5677
|
if (Array.isArray(browsers) && 0 === browsers.length) throw Error('Rspack cannot parse the browserslist query. This may happen when the query contains version requirements that exceed the supported range in the browserslist-rs database. Check your browserslist configuration for invalid version numbers.');
|
|
5422
|
-
|
|
5678
|
+
let browserslistTargetHandler = getBrowserslistTargetHandler(), encodedTargets = {};
|
|
5679
|
+
for (let p of browsers){
|
|
5680
|
+
let [name, v] = p.split(' '), version = encodeVersion(v);
|
|
5681
|
+
null !== version && (!encodedTargets[name] || version < encodedTargets[name]) && (encodedTargets[name] = version);
|
|
5682
|
+
}
|
|
5683
|
+
let targets = Object.fromEntries(Object.entries(encodedTargets).map(([k, v])=>[
|
|
5684
|
+
k,
|
|
5685
|
+
decodeVersion(v)
|
|
5686
|
+
]));
|
|
5687
|
+
return {
|
|
5688
|
+
...browserslistTargetHandler.resolve(browsers),
|
|
5689
|
+
targets,
|
|
5690
|
+
esVersion: function(browsers) {
|
|
5691
|
+
let esVersion = 2024;
|
|
5692
|
+
for (let item of browsers){
|
|
5693
|
+
let pairs = item.split(' ');
|
|
5694
|
+
if (pairs.length < 2) continue;
|
|
5695
|
+
let browser = renameBrowser(pairs[0]), version = Number(pairs[1].split('-')[0]);
|
|
5696
|
+
if (Number.isNaN(version)) continue;
|
|
5697
|
+
if ('ie' === browser || 'android' === browser && version < 6) {
|
|
5698
|
+
esVersion = 5;
|
|
5699
|
+
break;
|
|
5700
|
+
}
|
|
5701
|
+
let versions = ES_VERSIONS_MAP[browser];
|
|
5702
|
+
versions && (version < versions[0] ? esVersion = Math.min(5, esVersion) : version < versions[1] ? esVersion = Math.min(2015, esVersion) : version < versions[2] ? esVersion = Math.min(2016, esVersion) : version < versions[3] ? esVersion = Math.min(2017, esVersion) : version < versions[4] ? esVersion = Math.min(2018, esVersion) : version < versions[5] ? esVersion = Math.min(2019, esVersion) : version < versions[6] ? esVersion = Math.min(2020, esVersion) : version < versions[7] ? esVersion = Math.min(2021, esVersion) : version < versions[8] ? esVersion = Math.min(2022, esVersion) : version < versions[9] && (esVersion = Math.min(2023, esVersion)));
|
|
5703
|
+
}
|
|
5704
|
+
return esVersion;
|
|
5705
|
+
}(browsers)
|
|
5706
|
+
};
|
|
5423
5707
|
}
|
|
5424
5708
|
],
|
|
5425
5709
|
[
|
|
@@ -5475,6 +5759,10 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5475
5759
|
web: !1,
|
|
5476
5760
|
webworker: !1,
|
|
5477
5761
|
browser: !1,
|
|
5762
|
+
targets: major ? {
|
|
5763
|
+
node: `${major}${minor ? `.${minor}` : ''}`
|
|
5764
|
+
} : {},
|
|
5765
|
+
esVersion: v(18) ? 2022 : v(16) ? 2021 : v(14) ? 2020 : v(12) ? 2019 : v(10) ? 2018 : v(8) ? 2017 : v(7) ? 2016 : v(6, 5) ? 2015 : 5,
|
|
5478
5766
|
require: !asyncFlag,
|
|
5479
5767
|
nodeBuiltins: !0,
|
|
5480
5768
|
nodePrefixForCoreModules: 15 > +major ? v(14, 18) : v(16),
|
|
@@ -5516,6 +5804,10 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5516
5804
|
electronMain: 'main' === context,
|
|
5517
5805
|
electronPreload: 'preload' === context,
|
|
5518
5806
|
electronRenderer: 'renderer' === context,
|
|
5807
|
+
targets: major ? {
|
|
5808
|
+
electron: `${major}${minor ? `.${minor}` : ''}`
|
|
5809
|
+
} : {},
|
|
5810
|
+
esVersion: v(23) ? 2022 : v(15) ? 2021 : v(12) ? 2020 : v(5) ? 2019 : v(3) ? 2018 : v(1, 8) ? 2017 : v(1, 5) ? 2016 : v(1, 4) ? 2015 : 5,
|
|
5519
5811
|
global: !0,
|
|
5520
5812
|
nodeBuiltins: !0,
|
|
5521
5813
|
nodePrefixForCoreModules: v(15),
|
|
@@ -5554,6 +5846,10 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5554
5846
|
webworker: null,
|
|
5555
5847
|
browser: !1,
|
|
5556
5848
|
electron: !1,
|
|
5849
|
+
targets: major ? {
|
|
5850
|
+
nwjs: `${major}${minor ? `.${minor}` : ''}`
|
|
5851
|
+
} : {},
|
|
5852
|
+
esVersion: v(0, 65) ? 2022 : v(0, 54) ? 2021 : v(0, 46) ? 2020 : v(0, 39) ? 2019 : v(0, 31) ? 2018 : v(0, 23) ? 2017 : v(0, 20) ? 2016 : v(0, 17) ? 2015 : 5,
|
|
5557
5853
|
global: !0,
|
|
5558
5854
|
nodeBuiltins: !0,
|
|
5559
5855
|
document: !1,
|
|
@@ -5583,7 +5879,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5583
5879
|
/^es(\d+)$/,
|
|
5584
5880
|
(version)=>{
|
|
5585
5881
|
let v = +version;
|
|
5586
|
-
return v < 1000 && (v += 2009), {
|
|
5882
|
+
return 5 < v && v < 1000 && (v += 2009), {
|
|
5883
|
+
esVersion: v > 2022 ? 2022 : v,
|
|
5587
5884
|
const: v >= 2015,
|
|
5588
5885
|
templateLiteral: v >= 2015,
|
|
5589
5886
|
optionalChaining: v >= 2020,
|
|
@@ -5619,6 +5916,24 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5619
5916
|
for (let tp of targetProperties)for (let key of Object.keys(tp))keys.add(key);
|
|
5620
5917
|
let result = {};
|
|
5621
5918
|
for (let key of keys){
|
|
5919
|
+
if ('esVersion' === key) {
|
|
5920
|
+
let minVersion;
|
|
5921
|
+
for (let tp of targetProperties)'number' == typeof tp.esVersion && (minVersion = void 0 === minVersion ? tp.esVersion : Math.min(minVersion, tp.esVersion));
|
|
5922
|
+
void 0 !== minVersion && (result[key] = minVersion);
|
|
5923
|
+
continue;
|
|
5924
|
+
}
|
|
5925
|
+
if ('targets' === key) {
|
|
5926
|
+
let merged = {};
|
|
5927
|
+
for (let tp of targetProperties)if (tp.targets) for (let [name, version] of Object.entries(tp.targets)){
|
|
5928
|
+
let v = encodeVersion(version);
|
|
5929
|
+
null !== v && (!merged[name] || v < merged[name]) && (merged[name] = v);
|
|
5930
|
+
}
|
|
5931
|
+
Object.keys(merged).length > 0 && (result[key] = Object.fromEntries(Object.entries(merged).map(([k, v])=>[
|
|
5932
|
+
k,
|
|
5933
|
+
decodeVersion(v)
|
|
5934
|
+
])));
|
|
5935
|
+
continue;
|
|
5936
|
+
}
|
|
5622
5937
|
let hasTrue = !1, hasFalse = !1;
|
|
5623
5938
|
for (let tp of targetProperties)switch(tp[key]){
|
|
5624
5939
|
case !0:
|
|
@@ -5636,19 +5951,17 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5636
5951
|
]);
|
|
5637
5952
|
return F(options, 'devtool', ()=>!!development && 'eval'), D(options, 'watch', !1), D(options, 'lazyCompilation', !1), D(options, 'bail', !1), F(options, 'cache', ()=>development), applyExperimentsDefaults(options.experiments), applyOptimizationDefaults(options.optimization, {
|
|
5638
5953
|
production,
|
|
5639
|
-
development
|
|
5640
|
-
css: options.experiments.css
|
|
5954
|
+
development
|
|
5641
5955
|
}), applySnapshotDefaults(options.snapshot, {
|
|
5642
5956
|
production
|
|
5643
5957
|
}), applyModuleDefaults(options.module, {
|
|
5644
5958
|
cache: !!options.cache,
|
|
5645
5959
|
asyncWebAssembly: options.experiments.asyncWebAssembly,
|
|
5646
|
-
css: options.experiments.css,
|
|
5647
5960
|
targetProperties,
|
|
5648
5961
|
mode: options.mode,
|
|
5649
5962
|
uniqueName: options.output.uniqueName,
|
|
5650
5963
|
deferImport: options.experiments.deferImport
|
|
5651
|
-
}), applyOutputDefaults(options
|
|
5964
|
+
}), applyOutputDefaults(options, {
|
|
5652
5965
|
context: options.context,
|
|
5653
5966
|
targetProperties,
|
|
5654
5967
|
isAffectedByBrowserslist: void 0 === target || 'string' == typeof target && target.startsWith('browserslist') || Array.isArray(target) && target.some((target)=>target.startsWith('browserslist')),
|
|
@@ -5656,7 +5969,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5656
5969
|
entry: options.entry
|
|
5657
5970
|
}), applyExternalsPresetsDefaults(options.externalsPresets, {
|
|
5658
5971
|
targetProperties,
|
|
5659
|
-
buildHttp: !!options.experiments.buildHttp
|
|
5972
|
+
buildHttp: !!options.experiments.buildHttp,
|
|
5973
|
+
outputModule: options.output.module
|
|
5660
5974
|
}), F(options, 'externalsType', ()=>options.output.library ? options.output.library.type : options.output.module ? 'module-import' : 'var'), applyNodeDefaults(options.node, {
|
|
5661
5975
|
targetProperties,
|
|
5662
5976
|
outputModule: options.output.module
|
|
@@ -5668,41 +5982,39 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5668
5982
|
}), options.resolve = cleverMerge(getResolveDefaults({
|
|
5669
5983
|
context: options.context,
|
|
5670
5984
|
targetProperties,
|
|
5671
|
-
mode: options.mode
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
platform: !1 === targetProperties ? targetProperties : {
|
|
5985
|
+
mode: options.mode
|
|
5986
|
+
}), options.resolve), options.resolveLoader = cleverMerge(getResolveLoaderDefaults(), options.resolveLoader), !1 === targetProperties ? targetProperties : {
|
|
5987
|
+
platform: {
|
|
5675
5988
|
web: targetProperties.web,
|
|
5676
5989
|
browser: targetProperties.browser,
|
|
5677
5990
|
webworker: targetProperties.webworker,
|
|
5678
5991
|
node: targetProperties.node,
|
|
5679
5992
|
nwjs: targetProperties.nwjs,
|
|
5680
5993
|
electron: targetProperties.electron
|
|
5681
|
-
}
|
|
5994
|
+
},
|
|
5995
|
+
esVersion: targetProperties.esVersion,
|
|
5996
|
+
targets: targetProperties.targets
|
|
5682
5997
|
};
|
|
5683
5998
|
}, applyExperimentsDefaults = (experiments)=>{
|
|
5684
|
-
D(experiments, 'futureDefaults', !1), D(experiments, 'asyncWebAssembly',
|
|
5999
|
+
D(experiments, 'futureDefaults', !1), D(experiments, 'asyncWebAssembly', !0), D(experiments, 'deferImport', !1), D(experiments, 'buildHttp', void 0), experiments.buildHttp && 'object' == typeof experiments.buildHttp && D(experiments.buildHttp, 'upgrade', !1), D(experiments, 'incremental', {}), 'object' == typeof experiments.incremental && (D(experiments.incremental, 'silent', !0), D(experiments.incremental, 'make', !0), D(experiments.incremental, 'inferAsyncModules', !0), D(experiments.incremental, 'providedExports', !0), D(experiments.incremental, 'dependenciesDiagnostics', !0), D(experiments.incremental, 'sideEffects', !0), D(experiments.incremental, 'buildChunkGraph', !1), D(experiments.incremental, 'moduleIds', !0), D(experiments.incremental, 'chunkIds', !0), D(experiments.incremental, 'modulesHashes', !0), D(experiments.incremental, 'modulesCodegen', !0), D(experiments.incremental, 'modulesRuntimeRequirements', !0), D(experiments.incremental, 'chunksRuntimeRequirements', !0), D(experiments.incremental, 'chunksHashes', !0), D(experiments.incremental, 'chunksRender', !0), D(experiments.incremental, 'emitAssets', !0)), D(experiments, 'useInputFileSystem', !1);
|
|
5685
6000
|
}, applySnapshotDefaults = (_snapshot, _env)=>{}, applyCssGeneratorOptionsDefaults = (generatorOptions, { targetProperties })=>{
|
|
5686
6001
|
D(generatorOptions, 'exportsOnly', !targetProperties || !1 === targetProperties.document), D(generatorOptions, 'esModule', !0);
|
|
5687
|
-
}, applyModuleDefaults = (module, { cache, asyncWebAssembly,
|
|
5688
|
-
|
|
5689
|
-
D(parserOptions, 'dynamicImportMode', 'lazy'), D(parserOptions, 'dynamicImportPrefetch', !1), D(parserOptions, 'dynamicImportPreload', !1), D(parserOptions, 'url', !0), D(parserOptions, 'exprContextCritical', !0), D(parserOptions, 'unknownContextCritical', !0), D(parserOptions, 'wrappedContextCritical', !1), D(parserOptions, 'wrappedContextRegExp', /.*/), D(parserOptions, 'strictExportPresence', !1), D(parserOptions, 'requireAsExpression', !
|
|
6002
|
+
}, applyModuleDefaults = (module, { cache, asyncWebAssembly, targetProperties, mode, uniqueName, deferImport })=>{
|
|
6003
|
+
assertNotNill(module.parser), assertNotNill(module.generator), cache ? D(module, 'unsafeCache', /[\\/]node_modules[\\/]/) : D(module, 'unsafeCache', !1), F(module.parser, "asset", ()=>({})), assertNotNill(module.parser.asset), F(module.parser.asset, 'dataUrlCondition', ()=>({})), 'object' == typeof module.parser.asset.dataUrlCondition && D(module.parser.asset.dataUrlCondition, 'maxSize', 8096), F(module.parser, "javascript", ()=>({})), assertNotNill(module.parser.javascript), ((parserOptions, { deferImport })=>{
|
|
6004
|
+
D(parserOptions, 'dynamicImportMode', 'lazy'), D(parserOptions, 'dynamicImportPrefetch', !1), D(parserOptions, 'dynamicImportPreload', !1), D(parserOptions, 'url', !0), D(parserOptions, 'exprContextCritical', !0), D(parserOptions, 'unknownContextCritical', !0), D(parserOptions, 'wrappedContextCritical', !1), D(parserOptions, 'wrappedContextRegExp', /.*/), D(parserOptions, 'strictExportPresence', !1), D(parserOptions, 'requireAsExpression', !1), D(parserOptions, 'requireAlias', !1), D(parserOptions, 'requireDynamic', !0), D(parserOptions, 'requireResolve', !0), D(parserOptions, 'commonjs', !0), D(parserOptions, 'importDynamic', !0), D(parserOptions, 'worker', [
|
|
5690
6005
|
'...'
|
|
5691
6006
|
]), D(parserOptions, 'importMeta', !0), D(parserOptions, 'typeReexportsPresence', 'no-tolerant'), D(parserOptions, 'jsx', !1), D(parserOptions, 'deferImport', deferImport);
|
|
5692
6007
|
})(module.parser.javascript, {
|
|
5693
6008
|
deferImport
|
|
5694
|
-
}), F(module.parser, "json", ()=>({})), assertNotNill(module.parser.json), D(module.parser.json, 'exportsDepth', 'development' === mode ? 1 : Number.MAX_SAFE_INTEGER), F(module.generator, 'json', ()=>({})), assertNotNill(module.generator.json), D(module.generator.json, 'JSONParse', !0), css) {
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
}), D(module.generator['css/module'], 'exportsConvention', 'as-is'), D(module.generator['css/module'], 'localIdentName', localIdentName);
|
|
5704
|
-
}
|
|
5705
|
-
A(module, 'defaultRules', ()=>{
|
|
6009
|
+
}), F(module.parser, "json", ()=>({})), assertNotNill(module.parser.json), D(module.parser.json, 'exportsDepth', 'development' === mode ? 1 : Number.MAX_SAFE_INTEGER), F(module.generator, 'json', ()=>({})), assertNotNill(module.generator.json), D(module.generator.json, 'JSONParse', !0), F(module.parser, 'css', ()=>({})), assertNotNill(module.parser.css), D(module.parser.css, 'namedExports', !0), D(module.parser.css, 'url', !0), F(module.parser, 'css/auto', ()=>({})), assertNotNill(module.parser['css/auto']), D(module.parser['css/auto'], 'namedExports', !0), D(module.parser['css/auto'], 'url', !0), F(module.parser, 'css/module', ()=>({})), assertNotNill(module.parser['css/module']), D(module.parser['css/module'], 'namedExports', !0), D(module.parser['css/module'], 'url', !0), F(module.generator, 'css', ()=>({})), assertNotNill(module.generator.css), applyCssGeneratorOptionsDefaults(module.generator.css, {
|
|
6010
|
+
targetProperties
|
|
6011
|
+
}), F(module.generator, 'css/auto', ()=>({})), assertNotNill(module.generator['css/auto']), applyCssGeneratorOptionsDefaults(module.generator['css/auto'], {
|
|
6012
|
+
targetProperties
|
|
6013
|
+
}), D(module.generator['css/auto'], 'exportsConvention', 'as-is');
|
|
6014
|
+
let localIdentName = 'development' === mode ? uniqueName && uniqueName.length > 0 ? '[uniqueName]-[id]-[local]' : '[id]-[local]' : '[fullhash]';
|
|
6015
|
+
D(module.generator['css/auto'], 'localIdentName', localIdentName), F(module.generator, 'css/module', ()=>({})), assertNotNill(module.generator['css/module']), applyCssGeneratorOptionsDefaults(module.generator['css/module'], {
|
|
6016
|
+
targetProperties
|
|
6017
|
+
}), D(module.generator['css/module'], 'exportsConvention', 'as-is'), D(module.generator['css/module'], 'localIdentName', localIdentName), A(module, 'defaultRules', ()=>{
|
|
5706
6018
|
let esm = {
|
|
5707
6019
|
type: "javascript/esm",
|
|
5708
6020
|
resolve: {
|
|
@@ -5781,25 +6093,6 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5781
6093
|
...wasm
|
|
5782
6094
|
});
|
|
5783
6095
|
}
|
|
5784
|
-
if (css) {
|
|
5785
|
-
let resolve = {
|
|
5786
|
-
fullySpecified: !0,
|
|
5787
|
-
preferRelative: !0
|
|
5788
|
-
};
|
|
5789
|
-
rules.push({
|
|
5790
|
-
test: /\.css$/i,
|
|
5791
|
-
type: 'css/auto',
|
|
5792
|
-
resolve
|
|
5793
|
-
}), rules.push({
|
|
5794
|
-
mimetype: 'text/css+module',
|
|
5795
|
-
type: 'css/module',
|
|
5796
|
-
resolve
|
|
5797
|
-
}), rules.push({
|
|
5798
|
-
mimetype: 'text/css',
|
|
5799
|
-
type: 'css',
|
|
5800
|
-
resolve
|
|
5801
|
-
});
|
|
5802
|
-
}
|
|
5803
6096
|
return rules.push({
|
|
5804
6097
|
dependency: 'url',
|
|
5805
6098
|
oneOf: [
|
|
@@ -5828,8 +6121,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5828
6121
|
type: 'asset/bytes'
|
|
5829
6122
|
}), rules;
|
|
5830
6123
|
});
|
|
5831
|
-
}, applyOutputDefaults = (
|
|
5832
|
-
let getLibraryName = (library)=>{
|
|
6124
|
+
}, applyOutputDefaults = (options, { context, outputModule, targetProperties: tp, isAffectedByBrowserslist, entry })=>{
|
|
6125
|
+
let { output } = options, getLibraryName = (library)=>{
|
|
5833
6126
|
let libraryName = 'object' == typeof library && library && !Array.isArray(library) ? library.name : library;
|
|
5834
6127
|
return Array.isArray(libraryName) ? libraryName.join('.') : 'object' == typeof libraryName ? getLibraryName(libraryName.root) : 'string' == typeof libraryName ? libraryName : '';
|
|
5835
6128
|
};
|
|
@@ -5848,7 +6141,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5848
6141
|
}
|
|
5849
6142
|
}), F(output, 'devtoolNamespace', ()=>output.uniqueName), F(output, 'module', ()=>!!outputModule);
|
|
5850
6143
|
let environment = output.environment, conditionallyOptimistic = (v, c)=>void 0 === v && c || v;
|
|
5851
|
-
F(environment, 'globalThis', ()=>tp
|
|
6144
|
+
F(environment, 'globalThis', ()=>tp && tp.globalThis), F(environment, 'bigIntLiteral', ()=>{
|
|
5852
6145
|
let v;
|
|
5853
6146
|
return tp && ((v = tp.bigIntLiteral) || void 0 === v);
|
|
5854
6147
|
}), F(environment, 'const', ()=>{
|
|
@@ -5875,10 +6168,10 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5875
6168
|
}), F(environment, 'nodePrefixForCoreModules', ()=>{
|
|
5876
6169
|
let v;
|
|
5877
6170
|
return tp && ((v = tp.nodePrefixForCoreModules) || void 0 === v);
|
|
5878
|
-
}), F(environment, 'importMetaDirnameAndFilename', ()=>tp
|
|
6171
|
+
}), F(environment, 'importMetaDirnameAndFilename', ()=>tp && tp.importMetaDirnameAndFilename), F(environment, 'templateLiteral', ()=>{
|
|
5879
6172
|
let v;
|
|
5880
6173
|
return tp && ((v = tp.templateLiteral) || void 0 === v);
|
|
5881
|
-
}), F(environment, 'dynamicImport', ()=>conditionallyOptimistic(tp
|
|
6174
|
+
}), F(environment, 'dynamicImport', ()=>tp && conditionallyOptimistic(tp.dynamicImport, output.module)), F(environment, 'dynamicImportInWorker', ()=>tp && conditionallyOptimistic(tp.dynamicImportInWorker, output.module)), F(environment, 'module', ()=>tp && conditionallyOptimistic(tp.module, output.module)), F(environment, 'document', ()=>{
|
|
5882
6175
|
let v;
|
|
5883
6176
|
return tp && ((v = tp.document) || void 0 === v);
|
|
5884
6177
|
}), D(output, 'filename', output.module ? '[name].mjs' : '[name].js'), F(output, 'iife', ()=>!output.module), F(output, 'chunkFilename', ()=>{
|
|
@@ -5896,7 +6189,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5896
6189
|
return 'function' != typeof chunkFilename ? chunkFilename.replace(/\.[mc]?js(\?|$)/, '.css$1') : '[id].css';
|
|
5897
6190
|
}), D(output, 'hotUpdateChunkFilename', `[id].[fullhash].hot-update.${output.module ? 'mjs' : 'js'}`), F(output, 'hotUpdateMainFilename', ()=>`[runtime].[fullhash].hot-update.${output.module ? 'json.mjs' : 'json'}`);
|
|
5898
6191
|
let uniqueNameId = Template.toIdentifier(output.uniqueName);
|
|
5899
|
-
F(output, 'hotUpdateGlobal', ()=>`
|
|
6192
|
+
F(output, 'hotUpdateGlobal', ()=>`rspackHotUpdate${uniqueNameId}`), F(output, 'chunkLoadingGlobal', ()=>`rspackChunk${uniqueNameId}`), D(output, 'assetModuleFilename', '[hash][ext][query]'), D(output, 'webassemblyModuleFilename', '[hash].module.wasm'), D(output, 'compareBeforeEmit', !0), F(output, 'path', ()=>node_path.join(process.cwd(), 'dist')), F(output, 'pathinfo', ()=>!1), D(output, 'publicPath', tp && (tp.document || tp.importScripts) ? 'auto' : ''), D(output, 'hashFunction', 'xxhash64'), D(output, 'hashDigest', 'hex'), D(output, 'hashDigestLength', 16), D(output, 'strictModuleErrorHandling', !1), output.library && F(output.library, 'type', ()=>output.module ? 'module' : 'var'), F(output, 'chunkFormat', ()=>{
|
|
5900
6193
|
if (tp) {
|
|
5901
6194
|
let helpMessage = isAffectedByBrowserslist ? "Make sure that your 'browserslist' includes only platforms that support these features or select an appropriate 'target' to allow selecting a chunk format by default. Alternatively specify the 'output.chunkFormat' directly." : "Select an appropriate 'target' to allow selecting one by default, or specify the 'output.chunkFormat' directly.";
|
|
5902
6195
|
if (output.module) {
|
|
@@ -5966,7 +6259,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5966
6259
|
let enabledLibraryTypes = [];
|
|
5967
6260
|
return output.library && enabledLibraryTypes.push(output.library.type), forEachEntry((desc)=>{
|
|
5968
6261
|
desc.library && enabledLibraryTypes.push(desc.library.type);
|
|
5969
|
-
}), enabledLibraryTypes;
|
|
6262
|
+
}), enabledLibraryTypes.includes('modern-module') && applyLimits(options), enabledLibraryTypes;
|
|
5970
6263
|
}), A(output, 'enabledChunkLoadingTypes', ()=>{
|
|
5971
6264
|
let enabledChunkLoadingTypes = new Set();
|
|
5972
6265
|
return output.chunkLoading && enabledChunkLoadingTypes.add(output.chunkLoading), output.workerChunkLoading && enabledChunkLoadingTypes.add(output.workerChunkLoading), forEachEntry((desc)=>{
|
|
@@ -5977,9 +6270,10 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5977
6270
|
return output.wasmLoading && enabledWasmLoadingTypes.add(output.wasmLoading), output.workerWasmLoading && enabledWasmLoadingTypes.add(output.workerWasmLoading), forEachEntry((desc)=>{
|
|
5978
6271
|
desc.wasmLoading && enabledWasmLoadingTypes.add(desc.wasmLoading);
|
|
5979
6272
|
}), Array.from(enabledWasmLoadingTypes);
|
|
5980
|
-
}), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.0-canary
|
|
5981
|
-
}, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp })=>{
|
|
5982
|
-
|
|
6273
|
+
}), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.0-canary.20260120"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !output.library));
|
|
6274
|
+
}, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp, outputModule })=>{
|
|
6275
|
+
let isUniversal = (key)=>!!(outputModule && targetProperties && null === targetProperties[key]);
|
|
6276
|
+
D(externalsPresets, 'web', !buildHttp && targetProperties && (targetProperties.web || isUniversal('node'))), D(externalsPresets, 'node', targetProperties && (targetProperties.node || isUniversal('node'))), D(externalsPresets, 'electron', targetProperties && targetProperties.electron || isUniversal('electron')), D(externalsPresets, 'electronMain', targetProperties && !!targetProperties.electron && (targetProperties.electronMain || isUniversal('electronMain'))), D(externalsPresets, 'electronPreload', targetProperties && !!targetProperties.electron && (targetProperties.electronPreload || isUniversal('electronPreload'))), D(externalsPresets, 'electronRenderer', targetProperties && !!targetProperties.electron && (targetProperties.electronRenderer || isUniversal('electronRenderer'))), D(externalsPresets, 'nwjs', targetProperties && (targetProperties.nwjs || isUniversal('nwjs')));
|
|
5983
6277
|
}, applyLoaderDefaults = (loader, { targetProperties, environment })=>{
|
|
5984
6278
|
F(loader, 'target', ()=>{
|
|
5985
6279
|
if (targetProperties) {
|
|
@@ -5990,23 +6284,20 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5990
6284
|
}
|
|
5991
6285
|
}), D(loader, 'environment', environment);
|
|
5992
6286
|
}, applyNodeDefaults = (node, { outputModule, targetProperties })=>{
|
|
5993
|
-
!1 !== node && (F(node, 'global', ()
|
|
6287
|
+
!1 !== node && (F(node, 'global', ()=>(!targetProperties || !targetProperties.global) && 'warn'), F(node, '__dirname', ()=>targetProperties && targetProperties.node ? outputModule ? 'node-module' : 'eval-only' : 'warn-mock'), F(node, '__filename', ()=>targetProperties && targetProperties.node ? outputModule ? 'node-module' : 'eval-only' : 'warn-mock'));
|
|
5994
6288
|
}, applyPerformanceDefaults = (performance, { production })=>{
|
|
5995
6289
|
!1 !== performance && (D(performance, 'maxAssetSize', 250000), D(performance, 'maxEntrypointSize', 250000), F(performance, 'hints', ()=>!!production && 'warning'));
|
|
5996
|
-
}, applyOptimizationDefaults = (optimization, { production, development
|
|
6290
|
+
}, applyOptimizationDefaults = (optimization, { production, development })=>{
|
|
5997
6291
|
D(optimization, 'removeAvailableModules', !0), D(optimization, 'removeEmptyChunks', !0), D(optimization, 'mergeDuplicateChunks', !0), F(optimization, 'moduleIds', ()=>production ? 'deterministic' : development ? 'named' : 'natural'), F(optimization, 'chunkIds', ()=>production ? 'deterministic' : development ? 'named' : 'natural'), F(optimization, 'sideEffects', ()=>!!production || 'flag'), D(optimization, 'mangleExports', production), D(optimization, 'inlineExports', production), D(optimization, 'providedExports', !0), D(optimization, 'usedExports', production), D(optimization, 'innerGraph', production), D(optimization, 'emitOnErrors', !production), D(optimization, 'runtimeChunk', !1), D(optimization, 'realContentHash', production), D(optimization, 'avoidEntryIife', !1), D(optimization, 'minimize', production), D(optimization, 'concatenateModules', production), A(optimization, 'minimizer', ()=>[
|
|
5998
6292
|
new SwcJsMinimizerRspackPlugin(),
|
|
5999
6293
|
new LightningCssMinimizerRspackPlugin()
|
|
6000
6294
|
]), F(optimization, 'nodeEnv', ()=>production ? 'production' : !!development && 'development');
|
|
6001
6295
|
let { splitChunks } = optimization;
|
|
6002
6296
|
if (splitChunks) {
|
|
6003
|
-
A(splitChunks, 'defaultSizeTypes', ()=>
|
|
6297
|
+
A(splitChunks, 'defaultSizeTypes', ()=>[
|
|
6004
6298
|
"javascript",
|
|
6005
6299
|
'css',
|
|
6006
6300
|
'unknown'
|
|
6007
|
-
] : [
|
|
6008
|
-
"javascript",
|
|
6009
|
-
'unknown'
|
|
6010
6301
|
]), D(splitChunks, 'hidePathInfo', production), D(splitChunks, 'chunks', 'async'), D(splitChunks, 'usedExports', !0 === optimization.usedExports), D(splitChunks, 'minChunks', 1), F(splitChunks, 'minSize', ()=>production ? 20000 : 10000), F(splitChunks, 'maxAsyncRequests', ()=>production ? 30 : 1 / 0), F(splitChunks, 'maxInitialRequests', ()=>production ? 30 : 1 / 0), D(splitChunks, 'automaticNameDelimiter', '-');
|
|
6011
6302
|
let { cacheGroups } = splitChunks;
|
|
6012
6303
|
cacheGroups && (F(cacheGroups, 'default', ()=>({
|
|
@@ -6040,7 +6331,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
6040
6331
|
mainFiles: [
|
|
6041
6332
|
'index'
|
|
6042
6333
|
]
|
|
6043
|
-
}), getResolveDefaults = ({ context, targetProperties, mode
|
|
6334
|
+
}), getResolveDefaults = ({ context, targetProperties, mode })=>{
|
|
6044
6335
|
let conditions = [
|
|
6045
6336
|
'webpack'
|
|
6046
6337
|
];
|
|
@@ -6049,7 +6340,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
6049
6340
|
'.js',
|
|
6050
6341
|
'.json',
|
|
6051
6342
|
'.wasm'
|
|
6052
|
-
], browserField = targetProperties
|
|
6343
|
+
], browserField = targetProperties && targetProperties.web && (!targetProperties.node || targetProperties.electron && targetProperties.electronRenderer), aliasFields = browserField ? [
|
|
6053
6344
|
'browser'
|
|
6054
6345
|
] : [], mainFields = browserField ? [
|
|
6055
6346
|
'browser',
|
|
@@ -6119,23 +6410,19 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
6119
6410
|
loader: cjsDeps(),
|
|
6120
6411
|
unknown: cjsDeps()
|
|
6121
6412
|
}
|
|
6122
|
-
};
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
preferRelative: !0
|
|
6136
|
-
};
|
|
6137
|
-
}
|
|
6138
|
-
return resolveOptions;
|
|
6413
|
+
}, styleConditions = [];
|
|
6414
|
+
return styleConditions.push('webpack'), styleConditions.push('development' === mode ? 'development' : 'production'), styleConditions.push('style'), resolveOptions.byDependency['css-import'] = {
|
|
6415
|
+
mainFiles: [],
|
|
6416
|
+
mainFields: [
|
|
6417
|
+
'style',
|
|
6418
|
+
'...'
|
|
6419
|
+
],
|
|
6420
|
+
conditionNames: styleConditions,
|
|
6421
|
+
extensions: [
|
|
6422
|
+
'.css'
|
|
6423
|
+
],
|
|
6424
|
+
preferRelative: !0
|
|
6425
|
+
}, resolveOptions;
|
|
6139
6426
|
}, D = (obj, prop, value)=>{
|
|
6140
6427
|
void 0 === obj[prop] && (obj[prop] = value);
|
|
6141
6428
|
}, F = (obj, prop, factory)=>{
|
|
@@ -7207,10 +7494,10 @@ class MultiStats {
|
|
|
7207
7494
|
hasWarnings() {
|
|
7208
7495
|
return this.stats.some((stat)=>stat.hasWarnings());
|
|
7209
7496
|
}
|
|
7210
|
-
#createChildOptions(options
|
|
7497
|
+
#createChildOptions(options, context) {
|
|
7211
7498
|
let { children: childrenOptions, ...baseOptions } = 'string' == typeof options || 'boolean' == typeof options ? {
|
|
7212
7499
|
preset: options
|
|
7213
|
-
} : options, children = this.stats.map((stat, idx)=>{
|
|
7500
|
+
} : options ?? {}, children = this.stats.map((stat, idx)=>{
|
|
7214
7501
|
let childOptions = Array.isArray(childrenOptions) ? childrenOptions[idx] : childrenOptions;
|
|
7215
7502
|
return stat.compilation.createStatsOptions({
|
|
7216
7503
|
...baseOptions,
|
|
@@ -7237,7 +7524,7 @@ class MultiStats {
|
|
|
7237
7524
|
obj.children = this.stats.map((stat, idx)=>{
|
|
7238
7525
|
let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
|
|
7239
7526
|
return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
|
|
7240
|
-
}), childOptions.version && (obj.rspackVersion = "2.0.0-canary
|
|
7527
|
+
}), childOptions.version && (obj.rspackVersion = "2.0.0-canary.20260120", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
|
|
7241
7528
|
let mapError = (j, obj)=>({
|
|
7242
7529
|
...obj,
|
|
7243
7530
|
compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
|
|
@@ -7644,7 +7931,7 @@ class NodeWatchFileSystem {
|
|
|
7644
7931
|
if ('number' != typeof startTime && startTime) throw Error("Invalid arguments: 'startTime'");
|
|
7645
7932
|
if ('object' != typeof options) throw Error("Invalid arguments: 'options'");
|
|
7646
7933
|
if ('function' != typeof callbackUndelayed && callbackUndelayed) throw Error("Invalid arguments: 'callbackUndelayed'");
|
|
7647
|
-
let oldWatcher = this.watcher, Watchpack = NodeWatchFileSystem_require('watchpack');
|
|
7934
|
+
let oldWatcher = this.watcher, Watchpack = NodeWatchFileSystem_require('../compiled/watchpack/index.js');
|
|
7648
7935
|
this.watcher = new Watchpack(options), callbackUndelayed && this.watcher?.once('change', callbackUndelayed);
|
|
7649
7936
|
let fetchTimeInfo = ()=>{
|
|
7650
7937
|
let fileTimeInfoEntries = new Map(), contextTimeInfoEntries = new Map();
|
|
@@ -8490,7 +8777,7 @@ let iterateConfig = (config, options, fn)=>{
|
|
|
8490
8777
|
object.hash = context.getStatsCompilation(compilation).hash;
|
|
8491
8778
|
},
|
|
8492
8779
|
version: (object)=>{
|
|
8493
|
-
object.version = "5.75.0", object.rspackVersion = "2.0.0-canary
|
|
8780
|
+
object.version = "5.75.0", object.rspackVersion = "2.0.0-canary.20260120";
|
|
8494
8781
|
},
|
|
8495
8782
|
env: (object, _compilation, _context, { _env })=>{
|
|
8496
8783
|
object.env = _env;
|
|
@@ -8793,6 +9080,7 @@ let applyDefaults = (options, defaults)=>{
|
|
|
8793
9080
|
entrypoints: !0,
|
|
8794
9081
|
chunkGroups: !0,
|
|
8795
9082
|
ids: !0,
|
|
9083
|
+
assets: !0,
|
|
8796
9084
|
modules: !1,
|
|
8797
9085
|
chunks: !0,
|
|
8798
9086
|
chunkRelations: !0,
|
|
@@ -8823,11 +9111,13 @@ let applyDefaults = (options, defaults)=>{
|
|
|
8823
9111
|
detailed: {
|
|
8824
9112
|
hash: !0,
|
|
8825
9113
|
builtAt: !0,
|
|
9114
|
+
assets: !0,
|
|
8826
9115
|
relatedAssets: !0,
|
|
8827
9116
|
entrypoints: !0,
|
|
8828
9117
|
chunkGroups: !0,
|
|
8829
9118
|
ids: !0,
|
|
8830
9119
|
chunks: !0,
|
|
9120
|
+
modules: !0,
|
|
8831
9121
|
chunkRelations: !0,
|
|
8832
9122
|
chunkModules: !1,
|
|
8833
9123
|
chunkOrigins: !0,
|
|
@@ -8889,26 +9179,26 @@ let applyDefaults = (options, defaults)=>{
|
|
|
8889
9179
|
none: {
|
|
8890
9180
|
all: !1
|
|
8891
9181
|
}
|
|
8892
|
-
}, NORMAL_ON = ({ all })=>!1 !== all, NORMAL_OFF = ({ all })=>!0 === all, ON_FOR_TO_STRING = ({ all }, { forToString })=>forToString ? !1 !== all : !0 === all, OFF_FOR_TO_STRING = ({ all }, { forToString })=>forToString ? !0 === all : !1 !== all,
|
|
9182
|
+
}, NORMAL_ON = ({ all })=>!1 !== all, NORMAL_OFF = ({ all })=>!0 === all, ON_FOR_TO_STRING = ({ all }, { forToString })=>forToString ? !1 !== all : !0 === all, OFF_FOR_TO_STRING = ({ all }, { forToString })=>forToString ? !0 === all : !1 !== all, DEFAULTS = {
|
|
8893
9183
|
performance: NORMAL_ON,
|
|
8894
9184
|
hash: OFF_FOR_TO_STRING,
|
|
8895
9185
|
env: NORMAL_OFF,
|
|
8896
9186
|
version: NORMAL_ON,
|
|
8897
9187
|
timings: NORMAL_ON,
|
|
8898
9188
|
builtAt: OFF_FOR_TO_STRING,
|
|
8899
|
-
assets:
|
|
8900
|
-
entrypoints:
|
|
8901
|
-
chunkGroups:
|
|
9189
|
+
assets: NORMAL_OFF,
|
|
9190
|
+
entrypoints: NORMAL_OFF,
|
|
9191
|
+
chunkGroups: NORMAL_OFF,
|
|
8902
9192
|
chunkGroupAuxiliary: OFF_FOR_TO_STRING,
|
|
8903
9193
|
chunkGroupChildren: OFF_FOR_TO_STRING,
|
|
8904
9194
|
chunkGroupMaxAssets: (_, { forToString })=>forToString ? 5 : 1 / 0,
|
|
8905
|
-
chunks:
|
|
9195
|
+
chunks: NORMAL_OFF,
|
|
8906
9196
|
chunkRelations: OFF_FOR_TO_STRING,
|
|
8907
9197
|
chunkModules: ({ all, modules })=>!1 !== all && (!0 === all || !modules),
|
|
8908
9198
|
dependentModules: OFF_FOR_TO_STRING,
|
|
8909
9199
|
chunkOrigins: OFF_FOR_TO_STRING,
|
|
8910
9200
|
ids: OFF_FOR_TO_STRING,
|
|
8911
|
-
modules:
|
|
9201
|
+
modules: NORMAL_OFF,
|
|
8912
9202
|
nestedModules: OFF_FOR_TO_STRING,
|
|
8913
9203
|
groupModulesByType: ON_FOR_TO_STRING,
|
|
8914
9204
|
groupModulesByCacheStatus: ON_FOR_TO_STRING,
|
|
@@ -8943,7 +9233,7 @@ let applyDefaults = (options, defaults)=>{
|
|
|
8943
9233
|
moduleTrace: NORMAL_ON,
|
|
8944
9234
|
errors: NORMAL_ON,
|
|
8945
9235
|
errorsCount: NORMAL_ON,
|
|
8946
|
-
errorDetails:
|
|
9236
|
+
errorDetails: ({ all }, { forToString })=>!1 !== all && (!0 === all || !forToString || 'auto'),
|
|
8947
9237
|
errorStack: OFF_FOR_TO_STRING,
|
|
8948
9238
|
warnings: NORMAL_ON,
|
|
8949
9239
|
warningsCount: NORMAL_ON,
|
|
@@ -9716,7 +10006,7 @@ class RspackOptionsApply {
|
|
|
9716
10006
|
if (!options.externalsType) throw Error('options.externalsType should have a value after `applyRspackOptionsDefaults`');
|
|
9717
10007
|
new ExternalsPlugin(options.externalsType, options.externals, !1).apply(compiler);
|
|
9718
10008
|
}
|
|
9719
|
-
if (options.externalsPresets.node && new NodeTargetPlugin().apply(compiler), options.externalsPresets.electronMain && new ElectronTargetPlugin('main').apply(compiler), options.externalsPresets.electronPreload && new ElectronTargetPlugin('preload').apply(compiler), options.externalsPresets.electronRenderer && new ElectronTargetPlugin('renderer').apply(compiler), !options.externalsPresets.electron || options.externalsPresets.electronMain || options.externalsPresets.electronPreload || options.externalsPresets.electronRenderer || new ElectronTargetPlugin().apply(compiler), options.externalsPresets.nwjs && new ExternalsPlugin('node-commonjs', 'nw.gui', !1).apply(compiler), (options.externalsPresets.web || options.externalsPresets.webAsync || options.externalsPresets.node
|
|
10009
|
+
if (options.externalsPresets.node && new NodeTargetPlugin().apply(compiler), options.externalsPresets.electronMain && new ElectronTargetPlugin('main').apply(compiler), options.externalsPresets.electronPreload && new ElectronTargetPlugin('preload').apply(compiler), options.externalsPresets.electronRenderer && new ElectronTargetPlugin('renderer').apply(compiler), !options.externalsPresets.electron || options.externalsPresets.electronMain || options.externalsPresets.electronPreload || options.externalsPresets.electronRenderer || new ElectronTargetPlugin().apply(compiler), options.externalsPresets.nwjs && new ExternalsPlugin('node-commonjs', 'nw.gui', !1).apply(compiler), (options.externalsPresets.web || options.externalsPresets.webAsync || options.externalsPresets.node) && new HttpExternalsRspackPlugin(!0, !!options.externalsPresets.webAsync).apply(compiler), new ChunkPrefetchPreloadPlugin().apply(compiler), options.output.pathinfo && new ModuleInfoHeaderPlugin('verbose' === options.output.pathinfo).apply(compiler), 'string' == typeof options.output.chunkFormat) switch(options.output.chunkFormat){
|
|
9720
10010
|
case 'array-push':
|
|
9721
10011
|
new ArrayPushCallbackChunkFormatPlugin().apply(compiler);
|
|
9722
10012
|
break;
|
|
@@ -9749,7 +10039,17 @@ class RspackOptionsApply {
|
|
|
9749
10039
|
moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
|
|
9750
10040
|
namespace: options.output.devtoolNamespace
|
|
9751
10041
|
}).apply(compiler);
|
|
9752
|
-
if (new JavascriptModulesPlugin().apply(compiler), new URLPlugin().apply(compiler), new JsonModulesPlugin().apply(compiler), new AssetModulesPlugin().apply(compiler), options.experiments.asyncWebAssembly && new AsyncWebAssemblyModulesPlugin().apply(compiler),
|
|
10042
|
+
if (new JavascriptModulesPlugin().apply(compiler), new URLPlugin().apply(compiler), new JsonModulesPlugin().apply(compiler), new AssetModulesPlugin().apply(compiler), options.experiments.asyncWebAssembly && new AsyncWebAssemblyModulesPlugin().apply(compiler), new CssModulesPlugin().apply(compiler), new lib_EntryOptionPlugin().apply(compiler), assertNotNill(options.context), compiler.hooks.entryOption.call(options.context, options.entry), new RuntimePlugin().apply(compiler), options.output.bundlerInfo && new BundlerInfoRspackPlugin(options.output.bundlerInfo).apply(compiler), new InferAsyncModulesPlugin().apply(compiler), new APIPlugin().apply(compiler), new DataUriPlugin().apply(compiler), new FileUriPlugin().apply(compiler), options.experiments.buildHttp && new HttpUriPlugin(options.experiments.buildHttp).apply(compiler), new EnsureChunkConditionsPlugin().apply(compiler), options.optimization.mergeDuplicateChunks && new MergeDuplicateChunksPlugin().apply(compiler), options.optimization.sideEffects && new SideEffectsFlagPlugin().apply(compiler), options.optimization.providedExports && new FlagDependencyExportsPlugin().apply(compiler), options.optimization.usedExports && new FlagDependencyUsagePlugin('global' === options.optimization.usedExports).apply(compiler), options.optimization.concatenateModules && new ModuleConcatenationPlugin().apply(compiler), options.optimization.inlineExports && new InlineExportsPlugin().apply(compiler), options.optimization.mangleExports && new MangleExportsPlugin('size' !== options.optimization.mangleExports).apply(compiler), options.output.enabledLibraryTypes && options.output.enabledLibraryTypes.length > 0) {
|
|
10043
|
+
let modernModuleCount = 0;
|
|
10044
|
+
for (let type of options.output.enabledLibraryTypes)'modern-module' === type && modernModuleCount++;
|
|
10045
|
+
if (options.output.library?.preserveModules && modernModuleCount > 0) throw Error('preserveModules only works for `modern-module` library type');
|
|
10046
|
+
if (modernModuleCount > 0) {
|
|
10047
|
+
if (modernModuleCount !== options.output.enabledLibraryTypes.length) throw Error('`modern-module` cannot used together with other library types');
|
|
10048
|
+
new EsmLibraryPlugin({
|
|
10049
|
+
preserveModules: options.output.library?.preserveModules
|
|
10050
|
+
}).apply(compiler);
|
|
10051
|
+
} else for (let type of options.output.enabledLibraryTypes)new EnableLibraryPlugin(type).apply(compiler);
|
|
10052
|
+
}
|
|
9753
10053
|
options.optimization.splitChunks && new SplitChunksPlugin(options.optimization.splitChunks).apply(compiler), options.optimization.removeEmptyChunks && new RemoveEmptyChunksPlugin().apply(compiler), options.optimization.realContentHash && new RealContentHashPlugin().apply(compiler);
|
|
9754
10054
|
let moduleIds = options.optimization.moduleIds;
|
|
9755
10055
|
if (moduleIds) switch(moduleIds){
|
|
@@ -9833,8 +10133,11 @@ function createCompiler(userOptions) {
|
|
|
9833
10133
|
if (new NodeEnvironmentPlugin({
|
|
9834
10134
|
infrastructureLogging: options.infrastructureLogging
|
|
9835
10135
|
}).apply(compiler), Array.isArray(options.plugins)) for (let plugin of options.plugins)'function' == typeof plugin ? plugin.call(compiler, compiler) : plugin && plugin.apply(compiler);
|
|
9836
|
-
let
|
|
9837
|
-
return
|
|
10136
|
+
let tp = applyRspackOptionsDefaults(compiler.options);
|
|
10137
|
+
return tp && (compiler.platform = tp.platform, compiler.target = {
|
|
10138
|
+
esVersion: tp.esVersion,
|
|
10139
|
+
targets: tp.targets
|
|
10140
|
+
}), compiler.hooks.environment.call(), compiler.hooks.afterEnvironment.call(), new RspackOptionsApply().process(compiler.options, compiler), compiler.hooks.initialize.call(), compiler;
|
|
9838
10141
|
}
|
|
9839
10142
|
function isMultiRspackOptions(o) {
|
|
9840
10143
|
return Array.isArray(o);
|
|
@@ -9878,9 +10181,8 @@ function rspack(options, callback) {
|
|
|
9878
10181
|
return process.nextTick(()=>callback(err)), null;
|
|
9879
10182
|
}
|
|
9880
10183
|
{
|
|
9881
|
-
var message;
|
|
9882
10184
|
let { compiler, watch } = create();
|
|
9883
|
-
return watch && (
|
|
10185
|
+
return watch && deprecate("A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback."), compiler;
|
|
9884
10186
|
}
|
|
9885
10187
|
}
|
|
9886
10188
|
class CodeGenerationResult {
|
|
@@ -10136,7 +10438,7 @@ class TraceHookPlugin {
|
|
|
10136
10438
|
});
|
|
10137
10439
|
}
|
|
10138
10440
|
}
|
|
10139
|
-
let CORE_VERSION = "2.0.0-canary
|
|
10441
|
+
let CORE_VERSION = "2.0.0-canary.20260120", VFILES_BY_COMPILER = new WeakMap();
|
|
10140
10442
|
class VirtualModulesPlugin {
|
|
10141
10443
|
#staticModules;
|
|
10142
10444
|
#compiler;
|
|
@@ -10355,6 +10657,7 @@ class Compiler {
|
|
|
10355
10657
|
cache;
|
|
10356
10658
|
compilerPath;
|
|
10357
10659
|
#platform;
|
|
10660
|
+
#target;
|
|
10358
10661
|
options;
|
|
10359
10662
|
unsafeFastDrop = !1;
|
|
10360
10663
|
__internal_browser_require;
|
|
@@ -10458,7 +10761,7 @@ class Compiler {
|
|
|
10458
10761
|
node: null,
|
|
10459
10762
|
nwjs: null,
|
|
10460
10763
|
electron: null
|
|
10461
|
-
}, this.__internal_browser_require = ()=>{
|
|
10764
|
+
}, this.#target = {}, this.__internal_browser_require = ()=>{
|
|
10462
10765
|
throw Error('Cannot execute user defined code in browser without `BrowserRequirePlugin`');
|
|
10463
10766
|
}, this.resolverFactory = new ResolverFactory(options.resolve.pnp ?? getPnpDefault(), options.resolve, options.resolveLoader), new JsLoaderRspackPlugin(this).apply(this), new ExecuteModulePlugin().apply(this), new TraceHookPlugin().apply(this);
|
|
10464
10767
|
}
|
|
@@ -10483,6 +10786,12 @@ class Compiler {
|
|
|
10483
10786
|
set platform(platform) {
|
|
10484
10787
|
this.#platform = platform;
|
|
10485
10788
|
}
|
|
10789
|
+
get target() {
|
|
10790
|
+
return this.#target;
|
|
10791
|
+
}
|
|
10792
|
+
set target(target) {
|
|
10793
|
+
this.#target = target;
|
|
10794
|
+
}
|
|
10486
10795
|
get __internal__builtinPlugins() {
|
|
10487
10796
|
return this.#builtinPlugins;
|
|
10488
10797
|
}
|
|
@@ -11913,7 +12222,7 @@ async function transform(source, options) {
|
|
|
11913
12222
|
let _options = JSON.stringify(options || {});
|
|
11914
12223
|
return binding_default().transform(source, _options);
|
|
11915
12224
|
}
|
|
11916
|
-
let exports_rspackVersion = "2.0.0-canary
|
|
12225
|
+
let exports_rspackVersion = "2.0.0-canary.20260120", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
|
|
11917
12226
|
getNormalizedRspackOptions: getNormalizedRspackOptions,
|
|
11918
12227
|
applyRspackOptionsDefaults: applyRspackOptionsDefaults,
|
|
11919
12228
|
getNormalizedWebpackOptions: getNormalizedRspackOptions,
|