@ohos-ports/rspack-core 2.3.2-beta.0 → 2.3.4-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- let _computedKey, _computedKey1, _computedKey2, FileSystemDependencies_computedKey, FileSystemDependencies_computedKey1, FileSystemDependencies_computedKey2, Compilation_computedKey, Compilation_computedKey1, createMd4, createXxhash64, service_pool, loadLoader_url, ArrayQueue_computedKey;
1
+ let logTypeBitFlags, _computedKey, _computedKey1, _computedKey2, FileSystemDependencies_computedKey, FileSystemDependencies_computedKey1, FileSystemDependencies_computedKey2, Compilation_computedKey, Compilation_computedKey1, createMd4, createXxhash64, service_pool, loadLoader_url, ArrayQueue_computedKey;
2
2
  import { rspackRequire, moduleFactories, definePropertyGetters, makeNamespaceObject, compatGetDefaultExport } from "./l~0.js";
3
3
  import node_util, { inspect, promisify } from "node:util";
4
4
  import { createRequire, createRequire as __rspack_createRequire } from "node:module";
@@ -10,7 +10,7 @@ import { EventEmitter } from "node:events";
10
10
  let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
11
11
  import * as __rspack_external_node_util_ac04460e from "node:util";
12
12
  moduleFactories.add({
13
- "../../node_modules/.pnpm/enhanced-resolve@5.26.1/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js" (module) {
13
+ "../../node_modules/.pnpm/enhanced-resolve@5.27.0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js" (module) {
14
14
  let firstCallback, firstResult, { nextTick } = __rspack_createRequire_require("process"), dirname = (path)=>{
15
15
  let idx = path.length - 1;
16
16
  for(; idx >= 0;){
@@ -259,7 +259,7 @@ moduleFactories.add({
259
259
  this.realpathSync = realpathSync;
260
260
  }
261
261
  purge(what, options) {
262
- this._statBackend.purge(what, options), this._lstatBackend.purge(what, options), null != options && !0 === options.exact ? this._readdirBackend.purge(what, options) : this._readdirBackend.purgeParent(what), this._readFileBackend.purge(what, options), this._readlinkBackend.purge(what, options), this._readJsonBackend.purge(what, options), this._realpathBackend.purge(what, options);
262
+ this._statBackend.purge(what, options), this._lstatBackend.purge(what, options), null != options && !0 === options.exact ? !0 === options.readdirPrefix ? this._readdirBackend.purge(what) : this._readdirBackend.purge(what, options) : this._readdirBackend.purgeParent(what), this._readFileBackend.purge(what, options), this._readlinkBackend.purge(what, options), this._readJsonBackend.purge(what, options), this._realpathBackend.purge(what, options);
263
263
  }
264
264
  };
265
265
  },
@@ -281,6 +281,9 @@ moduleFactories.add({
281
281
  "node:https" (module) {
282
282
  module.exports = __rspack_createRequire_require("node:https");
283
283
  },
284
+ "node:stream" (module) {
285
+ module.exports = __rspack_createRequire_require("node:stream");
286
+ },
284
287
  "node:url" (module) {
285
288
  module.exports = __rspack_createRequire_require("node:url");
286
289
  },
@@ -959,10 +962,11 @@ Object.defineProperty(binding_.Chunk.prototype, 'files', {
959
962
  }
960
963
  });
961
964
  let cutOffLoaderExecution = (stack)=>((stack, flag)=>{
962
- let stacks = stack.split('\n');
963
- for(let i = 0; i < stacks.length; i++)stacks[i].includes(flag) && (stacks.length = i);
964
- return stacks.join('\n');
965
- })(stack, 'LOADER_EXECUTION');
965
+ let flagIndex = stack.indexOf(flag);
966
+ if (-1 === flagIndex) return stack;
967
+ let lineStart = stack.lastIndexOf('\n', flagIndex);
968
+ return -1 === lineStart ? '' : stack.slice(0, lineStart);
969
+ })(stack, 'at LOADER_EXECUTION');
966
970
  class WebpackError_WebpackError extends Error {
967
971
  loc;
968
972
  file;
@@ -996,7 +1000,10 @@ let lib_WebpackError = WebpackError_WebpackError, LogType = Object.freeze({
996
1000
  cache: 'cache'
997
1001
  });
998
1002
  function getLogTypeBitFlag(type) {
999
- return 1 << Object.values(LogType).indexOf(type);
1003
+ return logTypeBitFlags || (logTypeBitFlags = new Map(Object.values(LogType).map((type, index)=>[
1004
+ type,
1005
+ 1 << index
1006
+ ]))), logTypeBitFlags.get(type) ?? -2147483648;
1000
1007
  }
1001
1008
  function getLogTypesBitFlag(types) {
1002
1009
  return types.reduce((acc, cur)=>acc | getLogTypeBitFlag(cur), 0);
@@ -1254,10 +1261,11 @@ class Template {
1254
1261
  return Array.isArray(str) ? str.join('\n') : str;
1255
1262
  }
1256
1263
  static getModulesArrayBounds(modules) {
1264
+ if (0 === modules.length) return !1;
1257
1265
  let maxId = -1 / 0, minId = 1 / 0;
1258
1266
  for (let module of modules){
1259
1267
  let moduleId = module.id;
1260
- if ('number' != typeof moduleId) return !1;
1268
+ if ('number' != typeof moduleId || !Number.isInteger(moduleId) || moduleId < 0) return !1;
1261
1269
  maxId < moduleId && (maxId = moduleId), minId > moduleId && (minId = moduleId);
1262
1270
  }
1263
1271
  minId < 16 + `${minId}`.length && (minId = 0);
@@ -1360,6 +1368,9 @@ class RuntimeTemplate {
1360
1368
  supportsDestructuring() {
1361
1369
  return !!this.#environment.destructuring;
1362
1370
  }
1371
+ supportsSpread() {
1372
+ return !!this.#environment.spread;
1373
+ }
1363
1374
  supportsBigIntLiteral() {
1364
1375
  return !!this.#environment.bigIntLiteral;
1365
1376
  }
@@ -1687,10 +1698,13 @@ class StatsFactory {
1687
1698
  _getAllLevelHooks(hookMap, cache, type) {
1688
1699
  let cacheEntry = cache.get(type);
1689
1700
  if (void 0 !== cacheEntry) return cacheEntry;
1690
- let hooks = [], typeParts = type.split('.');
1691
- for(let i = 0; i < typeParts.length; i++){
1692
- let hook = hookMap.get(typeParts.slice(i).join('.'));
1701
+ let hooks = [], index = 0;
1702
+ for(;;){
1703
+ let hook = hookMap.get(type.slice(index));
1693
1704
  hook && hooks.push(hook);
1705
+ let dot = type.indexOf('.', index);
1706
+ if (-1 === dot) break;
1707
+ index = dot + 1;
1694
1708
  }
1695
1709
  return cache.set(type, hooks), hooks;
1696
1710
  }
@@ -1865,10 +1879,13 @@ class StatsPrinter {
1865
1879
  void 0 === cache && (cache = new Map(), this._levelHookCache.set(hookMap, cache));
1866
1880
  let cacheEntry = cache.get(type);
1867
1881
  if (void 0 !== cacheEntry) return cacheEntry;
1868
- let hooks = [], typeParts = type.split('.');
1869
- for(let i = 0; i < typeParts.length; i++){
1870
- let hook = hookMap.get(typeParts.slice(i).join('.'));
1882
+ let hooks = [], index = 0;
1883
+ for(;;){
1884
+ let hook = hookMap.get(type.slice(index));
1871
1885
  hook && hooks.push(hook);
1886
+ let dot = type.indexOf('.', index);
1887
+ if (-1 === dot) break;
1888
+ index = dot + 1;
1872
1889
  }
1873
1890
  return cache.set(type, hooks), hooks;
1874
1891
  }
@@ -2289,7 +2306,7 @@ function createDiagnosticArray(adm) {
2289
2306
  reduce: (callbackfn, initialValue)=>adm.values().reduce(callbackfn, initialValue),
2290
2307
  reduceRight: (callbackfn, initialValue)=>adm.values().reduceRight(callbackfn, initialValue)
2291
2308
  }, proxy = new Proxy(array, {
2292
- get: (target, name)=>'length' === name ? adm.length : 'string' != typeof name || Number.isNaN(Number.parseInt(name, 10)) ? Object.prototype.hasOwnProperty.call(arrayExtensions, name) ? arrayExtensions[name] : target[name] : adm.get(Number.parseInt(name, 10)),
2309
+ get: (target, name)=>'length' === name ? adm.length : 'string' != typeof name || Number.isNaN(Number.parseInt(name, 10)) ? Object.hasOwn(arrayExtensions, name) ? arrayExtensions[name] : target[name] : adm.get(Number.parseInt(name, 10)),
2293
2310
  set (target, name, value) {
2294
2311
  if ('length' === name) throw Error("The 'length' property is read-only and cannot be assigned a new value.");
2295
2312
  return 'symbol' == typeof name || Number.isNaN(Number.parseInt(name, 10)) ? target[name] = value : adm.set(Number.parseInt(name, 10), value), !0;
@@ -2692,7 +2709,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2692
2709
  }
2693
2710
  createStatsOptions(statsValue, context = {}) {
2694
2711
  let optionsOrPreset = statsValue;
2695
- if (('boolean' == typeof optionsOrPreset || 'string' == typeof optionsOrPreset) && (optionsOrPreset = {
2712
+ if ('boolean' == typeof optionsOrPreset ? optionsOrPreset = {
2713
+ preset: !1 === optionsOrPreset ? 'none' : 'normal'
2714
+ } : 'string' == typeof optionsOrPreset && (optionsOrPreset = {
2696
2715
  preset: optionsOrPreset
2697
2716
  }), 'object' == typeof optionsOrPreset && null !== optionsOrPreset) {
2698
2717
  let options = {};
@@ -2842,10 +2861,16 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2842
2861
  err ? doneWork(Array(moduleIdentifiers.length).fill([
2843
2862
  err,
2844
2863
  null
2845
- ])) : doneWork(modules.map((module)=>[
2864
+ ])) : doneWork(moduleIdentifiers.map((identifier, index)=>{
2865
+ let module = modules[index];
2866
+ return module ? [
2846
2867
  null,
2847
2868
  module
2848
- ]));
2869
+ ] : [
2870
+ Error(`Cannot rebuild module ${identifier}: it is no longer in the module graph.`),
2871
+ null
2872
+ ];
2873
+ }));
2849
2874
  });
2850
2875
  });
2851
2876
  rebuildModule(module, f) {
@@ -3239,10 +3264,16 @@ let DataUriPlugin = base_create(binding_.BuiltinPluginName.DataUriPlugin, ()=>{}
3239
3264
  return normalizeObject(define);
3240
3265
  };
3241
3266
  class DeterministicChunkIdsPlugin extends RspackBuiltinPlugin {
3267
+ options;
3242
3268
  name = binding_.BuiltinPluginName.DeterministicChunkIdsPlugin;
3243
3269
  affectedHooks = 'compilation';
3270
+ constructor(options = {}){
3271
+ super(), this.options = options;
3272
+ }
3244
3273
  raw() {
3245
- return createBuiltinPlugin(this.name, void 0);
3274
+ return createBuiltinPlugin(this.name, {
3275
+ ...this.options
3276
+ });
3246
3277
  }
3247
3278
  }
3248
3279
  class DeterministicModuleIdsPlugin extends RspackBuiltinPlugin {
@@ -3613,10 +3644,10 @@ function isStatsColorSupported() {
3613
3644
  }
3614
3645
  function encodeVersion(version) {
3615
3646
  let [major, minor = 0, patch = 0] = version.split('-')[0].split('.').map((v)=>parseInt(v, 10));
3616
- return Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch) ? null : major << 16 | minor << 8 | patch;
3647
+ return Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch) || major < 0 || major > 0xffff || minor < 0 || patch < 0 ? null : (major << 16 | Math.min(minor, 0xff) << 8 | Math.min(patch, 0xff)) >>> 0;
3617
3648
  }
3618
3649
  function decodeVersion(n) {
3619
- return `${n >> 16 & 0xff}.${n >> 8 & 0xff}.${0xff & n}`;
3650
+ return `${n >>> 16}.${n >> 8 & 0xff}.${0xff & n}`;
3620
3651
  }
3621
3652
  function encodeTargets(targets) {
3622
3653
  return Object.fromEntries(Object.entries(targets).map(([k, v])=>[
@@ -3708,6 +3739,9 @@ function toFeatures(featureOptions) {
3708
3739
  case 'logicalProperties':
3709
3740
  feature |= 524288;
3710
3741
  break;
3742
+ case 'lightDark':
3743
+ feature |= 1048576;
3744
+ break;
3711
3745
  case 'selectors':
3712
3746
  feature |= 31;
3713
3747
  break;
@@ -3715,7 +3749,7 @@ function toFeatures(featureOptions) {
3715
3749
  feature |= 448;
3716
3750
  break;
3717
3751
  case 'color':
3718
- feature |= 64512;
3752
+ feature |= 1113088;
3719
3753
  }
3720
3754
  return feature;
3721
3755
  }
@@ -3803,6 +3837,21 @@ function createRawModuleRuleUses(uses, path, options) {
3803
3837
  }(use.loader, use.options, options1);
3804
3838
  fingerprintOptions = temp, o = isNil(temp) ? void 0 : 'string' == typeof temp ? temp : JSON.stringify(temp, null, 2), isBuiltin = !0;
3805
3839
  }
3840
+ let optionsCacheKey = use.cache ? function(options) {
3841
+ try {
3842
+ return JSON.stringify(options, function(key, value) {
3843
+ let original = this[key];
3844
+ if ('function' == typeof original || 'function' == typeof value || 'symbol' == typeof value || 'number' == typeof value && (!Number.isFinite(value) || Object.is(value, -0)) || void 0 === value && this === options || !Object.is(original, value)) throw TypeError('Loader options are not JSON serializable');
3845
+ if (null !== value && 'object' == typeof value && !Array.isArray(value)) {
3846
+ let prototype = Object.getPrototypeOf(value);
3847
+ if (prototype !== Object.prototype && null !== prototype) throw TypeError('Loader options are not JSON serializable');
3848
+ }
3849
+ return value;
3850
+ }) ?? '';
3851
+ } catch {
3852
+ return;
3853
+ }
3854
+ }(fingerprintOptions) : void 0;
3806
3855
  return {
3807
3856
  loader: function(use, path, compiler, isBuiltin, normalizedOptions) {
3808
3857
  let obj = parseResource(use.loader), ident = use.ident;
@@ -3812,8 +3861,8 @@ function createRawModuleRuleUses(uses, path, options) {
3812
3861
  return use.options && 'object' == typeof use.options && (ident || (ident = '[[missing ident]]'), compiler.__internal__ruleSet.references.set(ident, use.options), compiler.__internal__ruleSet.references.set(`${ident}$$parallelism`, parallelism), isBuiltin && compiler.__internal__ruleSet.builtinReferences.set(ident, normalizedOptions)), obj.path + obj.query + obj.fragment;
3813
3862
  }(use, `${path1}[${index}]`, options1.compiler, isBuiltin, fingerprintOptions),
3814
3863
  options: o,
3815
- cache: use.cache ?? !1,
3816
- optionsCacheKey: use.cache ? JSON.stringify(fingerprintOptions) ?? '' : '',
3864
+ cache: void 0 !== optionsCacheKey,
3865
+ optionsCacheKey: optionsCacheKey ?? '',
3817
3866
  codeFilter: function(codeFilter, path) {
3818
3867
  if (void 0 !== codeFilter) {
3819
3868
  if ('string' == typeof codeFilter || codeFilter instanceof RegExp) return codeFilter;
@@ -3823,9 +3872,6 @@ function createRawModuleRuleUses(uses, path, options) {
3823
3872
  };
3824
3873
  }) : [];
3825
3874
  }
3826
- function isUseSourceMap(devtool) {
3827
- return !!devtool && devtool.includes('source-map') && (devtool.includes('module') || !devtool.includes('cheap'));
3828
- }
3829
3875
  function getRawAlias(alias = {}) {
3830
3876
  return !('object' != typeof alias || null === alias || Array.isArray(alias)) && Object.entries(alias).map(([key, value])=>({
3831
3877
  path: key,
@@ -3924,10 +3970,13 @@ let getRawModuleRule = (rule, path, options, upperType)=>{
3924
3970
  enforce: rule.enforce,
3925
3971
  extractSourceMap: rule.extractSourceMap
3926
3972
  };
3927
- return ('function' == typeof rule.test || 'function' == typeof rule.resource || 'function' == typeof rule.resourceQuery || 'function' == typeof rule.resourceFragment) && (delete rawModuleRule.test, delete rawModuleRule.resource, delete rawModuleRule.resourceQuery, delete rawModuleRule.resourceFragment, rawModuleRule.rspackResource = getRawRuleSetCondition((resourceQueryFragment)=>{
3928
- let { path, query, fragment } = parseResource(resourceQueryFragment);
3929
- return (!rule.test || !!tryMatch(path, rule.test)) && (!rule.resource || !!tryMatch(path, rule.resource)) && (!rule.resourceQuery || !!tryMatch(query, rule.resourceQuery)) && (!rule.resourceFragment || !!tryMatch(fragment, rule.resourceFragment));
3930
- })), rawModuleRule;
3973
+ return ('function' == typeof rule.test || 'function' == typeof rule.resource || 'function' == typeof rule.resourceQuery || 'function' == typeof rule.resourceFragment) && (delete rawModuleRule.test, delete rawModuleRule.resource, delete rawModuleRule.resourceQuery, delete rawModuleRule.resourceFragment, rawModuleRule.rspackResource = {
3974
+ type: binding_.RawRuleSetConditionType.func,
3975
+ func: (resource)=>{
3976
+ let { path, query, fragment } = 'string' == typeof resource ? parseResource(resource) : resource;
3977
+ return (!rule.test || !!tryMatch(path, rule.test)) && (!rule.resource || !!tryMatch(path, rule.resource)) && (!rule.resourceQuery || !!tryMatch(query, rule.resourceQuery)) && (!rule.resourceFragment || !!tryMatch(fragment, rule.resourceFragment));
3978
+ }
3979
+ }), rawModuleRule;
3931
3980
  };
3932
3981
  function getRawRuleSetCondition(condition) {
3933
3982
  if ('string' == typeof condition) return {
@@ -4502,7 +4551,7 @@ function getRawExternalItemValueFormFnResult(result) {
4502
4551
  return void 0 === result ? result : getRawExternalItemValue(result);
4503
4552
  }
4504
4553
  function getRawExternalItemValue(value) {
4505
- return value && 'object' == typeof value && !Array.isArray(value) ? Object.fromEntries(Object.entries(value).map(([k, v])=>[
4554
+ return value && 'object' == typeof value && !Array.isArray(value) ? Object.fromEntries(Object.entries(value).filter(([, v])=>void 0 !== v).map(([k, v])=>[
4506
4555
  k,
4507
4556
  Array.isArray(v) ? v : [
4508
4557
  v
@@ -4540,19 +4589,22 @@ let HttpExternalsRspackPlugin = base_create(binding_.BuiltinPluginName.HttpExter
4540
4589
  return (...args)=>(cache || (cache = fn()), cache(...args));
4541
4590
  }, getHttp = memoize(()=>rspackRequire("node:http")), getHttps = memoize(()=>rspackRequire("node:https")), defaultHttpClientForNode = async (url, headers)=>{
4542
4591
  let { res, body } = await function(url, options) {
4543
- let send = 'https:' === new URL(url).protocol ? getHttps() : getHttp(), { createBrotliDecompress, createGunzip, createInflate } = rspackRequire("node:zlib");
4592
+ let send = 'https:' === new URL(url).protocol ? getHttps() : getHttp(), { createBrotliDecompress, createGunzip, createInflate } = rspackRequire("node:zlib"), { pipeline, Writable } = rspackRequire("node:stream");
4544
4593
  return new Promise((resolve, reject)=>{
4545
4594
  send.get(url, options, (res)=>{
4546
- let contentEncoding = res.headers['content-encoding'], stream = res;
4547
- 'gzip' === contentEncoding ? stream = stream.pipe(createGunzip()) : 'br' === contentEncoding ? stream = stream.pipe(createBrotliDecompress()) : 'deflate' === contentEncoding && (stream = stream.pipe(createInflate()));
4595
+ let contentEncoding = res.headers['content-encoding'], streams = [
4596
+ res
4597
+ ];
4598
+ 'gzip' === contentEncoding ? streams.push(createGunzip()) : 'br' === contentEncoding ? streams.push(createBrotliDecompress()) : 'deflate' === contentEncoding && streams.push(createInflate());
4548
4599
  let chunks = [];
4549
- stream.on('data', (chunk)=>{
4550
- chunks.push(chunk);
4551
- }), stream.on('end', ()=>{
4552
- let bodyBuffer = Buffer.concat(chunks);
4553
- res.complete ? resolve({
4600
+ streams.push(new Writable({
4601
+ write (chunk, _encoding, callback) {
4602
+ chunks.push(chunk), callback();
4603
+ }
4604
+ })), pipeline(streams, (error)=>{
4605
+ error ? reject(error) : res.complete ? resolve({
4554
4606
  res,
4555
- body: bodyBuffer
4607
+ body: Buffer.concat(chunks)
4556
4608
  }) : reject(Error(`${url} request was terminated early`));
4557
4609
  });
4558
4610
  }).on('error', reject);
@@ -5409,9 +5461,9 @@ let createHash_createHash = (algorithm)=>{
5409
5461
  let message = `Module ${type}${from ? ` (from ${from}):\n` : ': '}`;
5410
5462
  return err && 'object' == typeof err && err.message ? message += err.message : err && (message += err), message;
5411
5463
  }, getErrorDetails = (err)=>{
5412
- var stack, name, message, stack1, name1, message1;
5413
- let details, nextLine;
5414
- return err && 'object' == typeof err && err.stack ? (stack = err.stack, name = err.name, message = err.message, cutOffLoaderExecution(stack), stack1 = stack, name1 = name, message1 = message, details = -1 === (nextLine = stack1.indexOf('\n')) ? stack1 === message1 ? '' : stack1 : stack1.slice(0, nextLine) === `${name1}: ${message1}` ? stack1.slice(nextLine + 1) : stack1) : void 0;
5464
+ var stack, name, message;
5465
+ let stack1, name1, message1, nextLine;
5466
+ return err && 'object' == typeof err && err.stack ? (stack1 = err.stack, name1 = err.name, message1 = err.message, stack = cutOffLoaderExecution(stack1), name = name1, message = message1, -1 === (nextLine = stack.indexOf('\n')) ? stack === message ? '' : stack : stack.slice(0, nextLine) === `${name}: ${message}` ? stack.slice(nextLine + 1) : stack) : void 0;
5415
5467
  };
5416
5468
  class ModuleError extends lib_WebpackError {
5417
5469
  error;
@@ -5600,7 +5652,11 @@ function loadLoader(loader, compiler, callback) {
5600
5652
  function handleResult(loader, module, callback) {
5601
5653
  return 'function' != typeof module && 'object' != typeof module ? callback(new LoaderLoadingError(`Module '${loader.path}' is not a loader (export function or es6 module)`)) : (loader.normal = 'function' == typeof module ? module : module.default, loader.pitch = module.pitch, loader.raw = module.raw, loader.pitch || (loader.noPitch = !0), 'function' != typeof loader.normal && 'function' != typeof loader.pitch) ? callback(new LoaderLoadingError(`Module '${loader.path}' is not a loader (must have normal or pitch function)`)) : void callback();
5602
5654
  }
5603
- let utils_decoder = new TextDecoder(), utils_loadLoader = promisify(loadLoader), utils_runSyncOrAsync = promisify(function(fn, context, args, callback) {
5655
+ let utils_decoder = new TextDecoder(), utils_loadLoader = promisify(loadLoader);
5656
+ function LOADER_EXECUTION(fn, context, args) {
5657
+ return fn.apply(context, args);
5658
+ }
5659
+ let utils_runSyncOrAsync = promisify(function(fn, context, args, callback) {
5604
5660
  let isSync = !0, isDone = !1, isError = !1, reportedError = !1;
5605
5661
  context.async = function() {
5606
5662
  if (isDone) {
@@ -5623,7 +5679,7 @@ let utils_decoder = new TextDecoder(), utils_loadLoader = promisify(loadLoader),
5623
5679
  };
5624
5680
  context.callback = innerCallback;
5625
5681
  try {
5626
- let result = fn.apply(context, args);
5682
+ let result = LOADER_EXECUTION(fn, context, args);
5627
5683
  if (isSync) {
5628
5684
  if (isDone = !0, void 0 === result) return void callback(null, []);
5629
5685
  if (result && 'object' == typeof result && 'function' == typeof result.then) return void result.then((r)=>{
@@ -5838,7 +5894,7 @@ async function runLoaders(compiler, context) {
5838
5894
  let entry = loaderContext.loaders[loaderContext.loaderIndex];
5839
5895
  return entry.options && 'object' == typeof entry.options ? entry.options : entry.query;
5840
5896
  }
5841
- }), loaderContext.version = 2, loaderContext.sourceMap = compiler.options.devtool ? isUseSourceMap(compiler.options.devtool) : context._module.useSourceMap ?? !1, loaderContext.mode = compiler.options.mode, Object.assign(loaderContext, compiler.options.loader);
5897
+ }), loaderContext.version = 2, loaderContext.sourceMap = context._module.useSourceMap, loaderContext.mode = compiler.options.mode, Object.assign(loaderContext, compiler.options.loader);
5842
5898
  let getResolveContext = ()=>({
5843
5899
  fileDependencies: {
5844
5900
  add: (d)=>{
@@ -5892,11 +5948,9 @@ async function runLoaders(compiler, context) {
5892
5948
  });
5893
5949
  }, loaderContext.emitFile = function(name, content, sourceMap, assetInfo) {
5894
5950
  let source;
5895
- if (sourceMap) {
5896
- var devtool;
5897
- 'string' == typeof sourceMap && (loaderContext.sourceMap || compiler.options.devtool && (devtool = compiler.options.devtool) && devtool.includes('source-map') && !isUseSourceMap(devtool)) && (source = new index_js_namespaceObject.OriginalSource(content, makePathsRelative(contextDirectory, sourceMap, compiler))), loaderContext.sourceMap && (source = new index_js_namespaceObject.SourceMapSource(content, name, makePathsRelative(contextDirectory, sourceMap, compiler)));
5898
- } else source = new index_js_namespaceObject.RawSource(content);
5899
- loaderContext._module.emitFile(name, source, assetInfo);
5951
+ sourceMap ? ('string' == typeof sourceMap && (loaderContext.sourceMap || compiler.options.devtool && function(devtool) {
5952
+ return !!devtool && devtool.includes('source-map') && !(devtool && devtool.includes('source-map') && (devtool.includes('module') || !devtool.includes('cheap')));
5953
+ }(compiler.options.devtool)) && (source = new index_js_namespaceObject.OriginalSource(content, makePathsRelative(contextDirectory, sourceMap, compiler))), loaderContext.sourceMap && (source = new index_js_namespaceObject.SourceMapSource(content, name, makePathsRelative(contextDirectory, sourceMap, compiler)))) : source = new index_js_namespaceObject.RawSource(content), loaderContext._module.emitFile(name, source, assetInfo);
5900
5954
  }, loaderContext.fs = compiler.inputFileSystem, loaderContext.experiments = {
5901
5955
  emitDiagnostic: (diagnostic)=>{
5902
5956
  let d = Object.assign({}, diagnostic, {
@@ -6016,31 +6070,7 @@ async function runLoaders(compiler, context) {
6016
6070
  }
6017
6071
  Atomics.add(sharedBufferView, 0, 1), Atomics.notify(sharedBufferView, 0, 1 / 0);
6018
6072
  }(message);
6019
- }), mainPort.on('messageerror', handleError);
6020
- let found = [];
6021
- for (let key of Object.keys(task)){
6022
- let uncloneable = function findUncloneablePath(value, path, depth) {
6023
- try {
6024
- structuredClone(value);
6025
- return;
6026
- } catch (e) {
6027
- if (depth > 0 && 'object' == typeof value && null !== value) for (let key of Object.keys(value)){
6028
- let deeper = findUncloneablePath(value[key], `${path}.${key}`, depth - 1);
6029
- if (deeper) return deeper;
6030
- }
6031
- return {
6032
- path,
6033
- reason: e.message
6034
- };
6035
- }
6036
- }(task[key], key, 6);
6037
- uncloneable && found.push(uncloneable);
6038
- }
6039
- if (found.length > 0) {
6040
- let details = found.map((item)=>` ${item.path.replace(/^loaderContext\._module\.buildInfo/, 'module.buildInfo').replace(/^loaderContext\.loaders\.\d+\.options/, 'options').replace(/^loaderContext\.?/, '')}: ${item.reason}`).join('\n');
6041
- throw Error(`${loaderName} cannot run with \`parallel: true\`. A parallel loader runs in a worker thread and receives its loader context through a structured clone, so the loader options and the custom \`module.buildInfo\` fields the module already carries all have to be cloneable:\n${details}\nEither remove \`parallel\` from this loader, or keep the value above out of the loader options and \`module.buildInfo\`.`);
6042
- }
6043
- pool.run({
6073
+ }), mainPort.on('messageerror', handleError), pool.run({
6044
6074
  ...task,
6045
6075
  workerData: {
6046
6076
  workerPort,
@@ -6053,7 +6083,37 @@ async function runLoaders(compiler, context) {
6053
6083
  workerPort,
6054
6084
  workerSyncPort
6055
6085
  ]
6056
- }).catch(handleError);
6086
+ }).catch((error)=>{
6087
+ if (error?.name === 'DataCloneError') try {
6088
+ let found = [];
6089
+ for (let key of Object.keys(task)){
6090
+ let uncloneable = function findUncloneablePath(value, path, depth) {
6091
+ try {
6092
+ structuredClone(value);
6093
+ return;
6094
+ } catch (e) {
6095
+ if (depth > 0 && 'object' == typeof value && null !== value) for (let key of Object.keys(value)){
6096
+ let deeper = findUncloneablePath(value[key], `${path}.${key}`, depth - 1);
6097
+ if (deeper) return deeper;
6098
+ }
6099
+ return {
6100
+ path,
6101
+ reason: e.message
6102
+ };
6103
+ }
6104
+ }(task[key], key, 6);
6105
+ uncloneable && found.push(uncloneable);
6106
+ }
6107
+ if (found.length > 0) {
6108
+ let details = found.map((item)=>` ${item.path.replace(/^loaderContext\._module\.buildInfo/, 'module.buildInfo').replace(/^loaderContext\.loaders\.\d+\.options/, 'options').replace(/^loaderContext\.?/, '')}: ${item.reason}`).join('\n');
6109
+ throw Error(`${loaderName} cannot run with \`parallel: true\`. A parallel loader runs in a worker thread and receives its loader context through a structured clone, so the loader options and the custom \`module.buildInfo\` fields the module already carries all have to be cloneable:\n${details}\nEither remove \`parallel\` from this loader, or keep the value above out of the loader options and \`module.buildInfo\`.`);
6110
+ }
6111
+ } catch (cloneError) {
6112
+ handleError(cloneError);
6113
+ return;
6114
+ }
6115
+ handleError(error);
6116
+ });
6057
6117
  });
6058
6118
  }))(loaderName, {
6059
6119
  loaderContext: (normalModule = loaderContext._module instanceof NormalModule ? loaderContext._module : void 0, workerLoaderSpan = (()=>{
@@ -6370,7 +6430,8 @@ let JsLoaderRspackPlugin = base_create(binding_.BuiltinPluginName.JsLoaderRspack
6370
6430
  exclude: exclude ? toFeatures(exclude) : void 0,
6371
6431
  targets,
6372
6432
  drafts: drafts ? {
6373
- customMedia: drafts.customMedia ?? !1
6433
+ customMedia: drafts.customMedia ?? !1,
6434
+ scrollNavigationControls: drafts.scrollNavigationControls ?? !1
6374
6435
  } : void 0,
6375
6436
  nonStandard: nonStandard ? {
6376
6437
  deepSelectorCombinator: nonStandard.deepSelectorCombinator ?? !1
@@ -6741,8 +6802,8 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
6741
6802
  }
6742
6803
  getIntegrityChecksumForAsset(src) {
6743
6804
  if (this.integrities.has(src)) return this.integrities.get(src);
6744
- let normalizedSrc = normalizePath(src), normalizedKey = Array.from(this.integrities.keys()).find((assetKey)=>normalizePath(assetKey) === normalizedSrc);
6745
- return normalizedKey ? this.integrities.get(normalizedKey) : void 0;
6805
+ let normalizedSrc = normalizePath(src);
6806
+ for (let assetKey of this.integrities.keys())if (normalizePath(assetKey) === normalizedSrc) return assetKey ? this.integrities.get(assetKey) : void 0;
6746
6807
  }
6747
6808
  handleHwpPluginArgs({ assets }) {
6748
6809
  let publicPath = assets.publicPath, jsIntegrity = [];
@@ -6779,8 +6840,8 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
6779
6840
  if (!publicPath || '/' === publicPath || './' === publicPath) return;
6780
6841
  let protocolRelativePublicPath = publicPath.replace(HTTP_PROTOCOL_REGEX, ''), protocolRelativeTagSrc = tagSrc.replace(HTTP_PROTOCOL_REGEX, '');
6781
6842
  if (!protocolRelativeTagSrc.startsWith(protocolRelativePublicPath)) return;
6782
- let tagSrcWithScheme = `http:${protocolRelativeTagSrc}`;
6783
- src = relative(protocolRelativePublicPath.startsWith('//') ? `http:${protocolRelativePublicPath}` : protocolRelativePublicPath, decodeURIComponent(tagSrcWithScheme));
6843
+ let tagSrcWithScheme = `http:${protocolRelativeTagSrc}`, publicPathWithScheme = protocolRelativePublicPath.startsWith('//') ? `http:${protocolRelativePublicPath}` : protocolRelativePublicPath;
6844
+ src = relative(publicPathWithScheme, decodeURIComponent(tagSrcWithScheme));
6784
6845
  } else src = relative(publicPath, decodeURIComponent(tagSrc));
6785
6846
  tag.attributes.integrity = this.getIntegrityChecksumForAsset(src) || function(hashFuncNames, source) {
6786
6847
  let { createHash } = rspackRequire("node:crypto");
@@ -6795,7 +6856,7 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
6795
6856
  if (contenthash) {
6796
6857
  let shaHashes = (Array.isArray(contenthash) ? contenthash : [
6797
6858
  contenthash
6798
- ]).filter((hash)=>String(hash).match(/^sha[0-9]+-/));
6859
+ ]).filter((hash)=>/^sha[0-9]+-/.test(String(hash)));
6799
6860
  shaHashes.length > 0 && (object.integrity = shaHashes.join(' '));
6800
6861
  }
6801
6862
  });
@@ -6826,7 +6887,8 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
6826
6887
  }
6827
6888
  }
6828
6889
  function normalizePath(path) {
6829
- return path.replace(/\?.*$/, '').split(sep).join('/');
6890
+ let withoutQuery = path.replace(/\?.*$/, '');
6891
+ return '/' === sep ? withoutQuery : withoutQuery.replaceAll(sep, '/');
6830
6892
  }
6831
6893
  let SwcJsMinimizerRspackPlugin = base_create(binding_.BuiltinPluginName.SwcJsMinimizerRspackPlugin, function(options) {
6832
6894
  let compress = options?.minimizerOptions?.compress ?? !0, mangle = options?.minimizerOptions?.mangle ?? !0, ecma = options?.minimizerOptions?.ecma ?? (this.target?.esVersion && this.target.esVersion > 2024 ? 2024 : this.target.esVersion) ?? 5, format = {
@@ -7501,6 +7563,59 @@ let configCache = {}, ES_VERSIONS_MAP = {
7501
7563
  ],
7502
7564
  node: 14
7503
7565
  }),
7566
+ spread: rawChecker({
7567
+ chrome: 60,
7568
+ and_chr: 60,
7569
+ edge: 79,
7570
+ firefox: 55,
7571
+ and_ff: 55,
7572
+ opera: 47,
7573
+ op_mob: 44,
7574
+ safari: [
7575
+ 11,
7576
+ 1
7577
+ ],
7578
+ ios_saf: [
7579
+ 11,
7580
+ 3
7581
+ ],
7582
+ samsung: [
7583
+ 8,
7584
+ 2
7585
+ ],
7586
+ android: 60,
7587
+ and_qq: [
7588
+ 13,
7589
+ 1
7590
+ ],
7591
+ and_uc: [
7592
+ 15,
7593
+ 5
7594
+ ],
7595
+ kaios: [
7596
+ 3,
7597
+ 0
7598
+ ],
7599
+ node: [
7600
+ 8,
7601
+ 3
7602
+ ]
7603
+ }),
7604
+ symbol: rawChecker({
7605
+ chrome: 49,
7606
+ and_chr: 49,
7607
+ edge: 15,
7608
+ firefox: 51,
7609
+ and_ff: 51,
7610
+ opera: 36,
7611
+ op_mob: 36,
7612
+ safari: 10,
7613
+ ios_saf: 10,
7614
+ samsung: 5,
7615
+ android: 49,
7616
+ kaios: 3,
7617
+ node: 6
7618
+ }),
7504
7619
  logicalAssignment: rawChecker({
7505
7620
  chrome: 85,
7506
7621
  and_chr: 85,
@@ -7767,6 +7882,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7767
7882
  computedProperty: v(4),
7768
7883
  templateLiteral: v(4),
7769
7884
  optionalChaining: v(14),
7885
+ spread: v(8, 3),
7886
+ symbol: v(6),
7770
7887
  logicalAssignment: v(15),
7771
7888
  methodShorthand: v(4),
7772
7889
  arrowFunction: v(6),
@@ -7815,6 +7932,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7815
7932
  computedProperty: v(1, 1),
7816
7933
  templateLiteral: v(1, 1),
7817
7934
  optionalChaining: v(8),
7935
+ spread: v(2),
7936
+ symbol: v(0, 37),
7818
7937
  logicalAssignment: v(10),
7819
7938
  methodShorthand: v(1, 1),
7820
7939
  arrowFunction: v(1, 1),
@@ -7858,6 +7977,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7858
7977
  computedProperty: v(0, 15),
7859
7978
  templateLiteral: v(0, 13),
7860
7979
  optionalChaining: v(0, 44),
7980
+ spread: v(0, 23),
7981
+ symbol: v(0, 13),
7861
7982
  methodShorthand: v(0, 15),
7862
7983
  arrowFunction: v(0, 15),
7863
7984
  asyncFunction: v(0, 21),
@@ -7883,6 +8004,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7883
8004
  computedProperty: v >= 2015,
7884
8005
  templateLiteral: v >= 2015,
7885
8006
  optionalChaining: v >= 2020,
8007
+ spread: v >= 2018,
8008
+ symbol: v >= 2015,
7886
8009
  logicalAssignment: v >= 2021,
7887
8010
  methodShorthand: v >= 2015,
7888
8011
  arrowFunction: v >= 2015,
@@ -8245,7 +8368,13 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
8245
8368
  }), F(environment, 'optionalChaining', ()=>{
8246
8369
  let v;
8247
8370
  return tp && ((v = tp.optionalChaining) || void 0 === v);
8248
- }), F(environment, 'logicalAssignment', ()=>tp && !0 === tp.logicalAssignment), F(environment, 'nodePrefixForCoreModules', ()=>{
8371
+ }), F(environment, 'logicalAssignment', ()=>tp && !0 === tp.logicalAssignment), F(environment, 'spread', ()=>{
8372
+ let v;
8373
+ return tp && ((v = tp.spread) || void 0 === v);
8374
+ }), F(environment, 'symbol', ()=>{
8375
+ let v;
8376
+ return tp && ((v = tp.symbol) || void 0 === v);
8377
+ }), F(environment, 'nodePrefixForCoreModules', ()=>{
8249
8378
  let v;
8250
8379
  return tp && ((v = tp.nodePrefixForCoreModules) || void 0 === v);
8251
8380
  }), F(environment, 'importMetaDirnameAndFilename', ()=>tp && tp.importMetaDirnameAndFilename), F(environment, 'templateLiteral', ()=>{
@@ -8348,7 +8477,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
8348
8477
  return output.wasmLoading && enabledWasmLoadingTypes.add(output.wasmLoading), output.workerWasmLoading && enabledWasmLoadingTypes.add(output.workerWasmLoading), forEachEntry((desc)=>{
8349
8478
  desc.wasmLoading && enabledWasmLoadingTypes.add(desc.wasmLoading);
8350
8479
  }), Array.from(enabledWasmLoadingTypes);
8351
- }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.3.2"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !1));
8480
+ }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.3.4"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !1));
8352
8481
  }, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp, outputModule })=>{
8353
8482
  let isUniversal = (key)=>!!(outputModule && targetProperties && null === targetProperties[key]);
8354
8483
  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')));
@@ -8536,7 +8665,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
8536
8665
  let rule = ignore instanceof RegExp ? {
8537
8666
  message: ignore
8538
8667
  } : ignore;
8539
- return (warning)=>(!!rule.message || !!rule.module || !!rule.file) && (!rule.message || !!rule.message.test(warning.message)) && (!rule.module || !!warning.module && !!rule.module.test(warning.module.readableIdentifier())) && (!rule.file || !!warning.file && !!rule.file.test(warning.file));
8668
+ return (warning)=>(!!rule.message || !!rule.module || !!rule.file) && (!rule.message || -1 !== warning.message.search(rule.message)) && (!rule.module || !!warning.module && -1 !== warning.module.readableIdentifier().search(rule.module)) && (!rule.file || !!warning.file && -1 !== warning.file.search(rule.file));
8540
8669
  });
8541
8670
  })(config.ignoreWarnings),
8542
8671
  name: config.name,
@@ -8834,12 +8963,10 @@ function __from_binding_runtime_globals(runtimeRequirements, compilerRuntimeGlob
8834
8963
  function __to_binding_runtime_globals(runtimeRequirements, compilerRuntimeGlobals) {
8835
8964
  let res = {
8836
8965
  value: []
8837
- }, reversedCompilerRuntimeGlobals = Object.fromEntries(Object.entries(compilerRuntimeGlobals).map(([key, value])=>[
8838
- value,
8839
- key
8840
- ]));
8841
- for (let flag of Array.from(runtimeRequirements)){
8842
- let item = reversedCompilerRuntimeGlobals[flag];
8966
+ }, reversedCompilerRuntimeGlobals = new Map();
8967
+ for (let [key, value] of Object.entries(compilerRuntimeGlobals))reversedCompilerRuntimeGlobals.set(value, key);
8968
+ for (let flag of runtimeRequirements){
8969
+ let item = reversedCompilerRuntimeGlobals.get(flag);
8843
8970
  'string' == typeof item ? res.value.push(item) : res.value.push(flag);
8844
8971
  }
8845
8972
  return res;
@@ -8879,171 +9006,177 @@ function renderRuntimeVariables(variable, compilerOptions) {
8879
9006
  return '__webpack_exec__';
8880
9007
  }
8881
9008
  }
9009
+ function renderRuntimeGlobals(runtimeGlobals, _compilerOptions) {
9010
+ let require_name = renderRuntimeVariables(0, _compilerOptions), context_name = renderRuntimeVariables(1, _compilerOptions), usesRuntimeContext = _compilerOptions?.experiments.runtimeMode === 'rspack', scope_name = usesRuntimeContext ? context_name : require_name, exports_name = renderRuntimeVariables(5, _compilerOptions);
9011
+ switch(runtimeGlobals){
9012
+ case 0:
9013
+ return usesRuntimeContext ? `${context_name}.r` : require_name;
9014
+ case 1:
9015
+ return usesRuntimeContext ? context_name : `${require_name}.*`;
9016
+ case 2:
9017
+ return exports_name;
9018
+ case 3:
9019
+ return "top-level-this-exports";
9020
+ case 4:
9021
+ return "return-exports-from-runtime";
9022
+ case 5:
9023
+ return "module";
9024
+ case 6:
9025
+ return "module.id";
9026
+ case 7:
9027
+ return "module.loaded";
9028
+ case 8:
9029
+ return `${scope_name}.p`;
9030
+ case 9:
9031
+ return `${scope_name}.s`;
9032
+ case 10:
9033
+ return `${scope_name}.c`;
9034
+ case 77:
9035
+ return `${scope_name}.zD`;
9036
+ case 11:
9037
+ return `${scope_name}.m`;
9038
+ case 12:
9039
+ return `${scope_name}.m (add only)`;
9040
+ case 13:
9041
+ return `${scope_name}.e`;
9042
+ case 14:
9043
+ return `${scope_name}.f`;
9044
+ case 15:
9045
+ return `${scope_name}.f (include entries)`;
9046
+ case 16:
9047
+ return `${scope_name}.E`;
9048
+ case 17:
9049
+ return `${scope_name}.F`;
9050
+ case 18:
9051
+ return `${scope_name}.G`;
9052
+ case 19:
9053
+ return `${scope_name}.H`;
9054
+ case 20:
9055
+ return `${scope_name}.d`;
9056
+ case 21:
9057
+ return usesRuntimeContext ? `${context_name}.N` : `${require_name}.r`;
9058
+ case 22:
9059
+ return `${scope_name}.t`;
9060
+ case 23:
9061
+ return `${scope_name}.n`;
9062
+ case 24:
9063
+ return `${scope_name}.hmd`;
9064
+ case 25:
9065
+ return `${scope_name}.nmd`;
9066
+ case 26:
9067
+ return `${scope_name}.h`;
9068
+ case 27:
9069
+ return `${scope_name}.w`;
9070
+ case 28:
9071
+ return `${scope_name}.v`;
9072
+ case 29:
9073
+ return `${scope_name}.vs`;
9074
+ case 30:
9075
+ return `${scope_name}.oe`;
9076
+ case 31:
9077
+ return `${scope_name}.nc`;
9078
+ case 32:
9079
+ return `${scope_name}.l`;
9080
+ case 33:
9081
+ return `${scope_name}.ts`;
9082
+ case 34:
9083
+ return `${scope_name}.tu`;
9084
+ case 35:
9085
+ return `${scope_name}.tt`;
9086
+ case 36:
9087
+ return "has fetch priority";
9088
+ case 37:
9089
+ return `${scope_name}.cn`;
9090
+ case 38:
9091
+ return `${scope_name}.j`;
9092
+ case 39:
9093
+ return `${scope_name}.u`;
9094
+ case 40:
9095
+ return `${scope_name}.k`;
9096
+ case 41:
9097
+ return `${scope_name}.rv`;
9098
+ case 42:
9099
+ return "has css modules";
9100
+ case 43:
9101
+ return `${scope_name}.ruid`;
9102
+ case 44:
9103
+ return `${scope_name}.hu`;
9104
+ case 45:
9105
+ return `${scope_name}.hk`;
9106
+ case 46:
9107
+ return `${scope_name}.x`;
9108
+ case 47:
9109
+ return `${scope_name}.x (no default handler)`;
9110
+ case 48:
9111
+ return `${scope_name}.x (only after)`;
9112
+ case 49:
9113
+ return `${scope_name}.x (only before)`;
9114
+ case 50:
9115
+ return "global chunk callback";
9116
+ case 51:
9117
+ return `${scope_name}.X`;
9118
+ case 52:
9119
+ return `${scope_name}.x (chunk dependencies)`;
9120
+ case 53:
9121
+ return `${scope_name}.O`;
9122
+ case 54:
9123
+ return `${scope_name}.C`;
9124
+ case 55:
9125
+ return `${scope_name}.i`;
9126
+ case 56:
9127
+ return `${scope_name}.g`;
9128
+ case 57:
9129
+ return `${scope_name}.S`;
9130
+ case 58:
9131
+ return `${scope_name}.I`;
9132
+ case 59:
9133
+ return `${scope_name}.R`;
9134
+ case 60:
9135
+ return `${scope_name}.hmrF`;
9136
+ case 61:
9137
+ return `${scope_name}.hmrM`;
9138
+ case 62:
9139
+ return `${scope_name}.hmrC`;
9140
+ case 63:
9141
+ return `${scope_name}.hmrD`;
9142
+ case 64:
9143
+ return `${scope_name}.hmrI`;
9144
+ case 65:
9145
+ return `${scope_name}.hmrS`;
9146
+ case 66:
9147
+ return `${scope_name}.amdD`;
9148
+ case 67:
9149
+ return `${scope_name}.amdO`;
9150
+ case 68:
9151
+ return `${scope_name}.System`;
9152
+ case 69:
9153
+ return `${scope_name}.o`;
9154
+ case 70:
9155
+ return `${scope_name}.y`;
9156
+ case 71:
9157
+ return `${scope_name}.b`;
9158
+ case 72:
9159
+ return `${scope_name}.U`;
9160
+ case 73:
9161
+ return `${scope_name}.a`;
9162
+ case 74:
9163
+ return `${scope_name}.aE`;
9164
+ case 75:
9165
+ return `${scope_name}.z`;
9166
+ case 76:
9167
+ return `${scope_name}.zS`;
9168
+ default:
9169
+ return '';
9170
+ }
9171
+ }
9172
+ function renderRuntimeGlobalProperty(runtimeGlobal, compilerOptions) {
9173
+ let rendered = renderRuntimeGlobals(runtimeGlobal, compilerOptions), scope = renderRuntimeVariables(+(compilerOptions?.experiments.runtimeMode === 'rspack'), compilerOptions), prefix = `${scope}.`;
9174
+ if (!rendered.startsWith(prefix)) throw Error(`Runtime global "${RuntimeGlobals_RuntimeGlobals[runtimeGlobal]}" is not a property of "${scope}".`);
9175
+ return rendered.slice(prefix.length);
9176
+ }
8882
9177
  function createCompilerRuntimeGlobals(compilerOptions) {
8883
9178
  let res = {};
8884
- for (let key of Object.keys(RuntimeGlobals_RuntimeGlobals))res[key] = function(runtimeGlobals, _compilerOptions) {
8885
- let require_name = renderRuntimeVariables(0, _compilerOptions), context_name = renderRuntimeVariables(1, _compilerOptions), usesRuntimeContext = _compilerOptions?.experiments.runtimeMode === 'rspack', scope_name = usesRuntimeContext ? context_name : require_name, exports_name = renderRuntimeVariables(5, _compilerOptions);
8886
- switch(runtimeGlobals){
8887
- case 0:
8888
- return usesRuntimeContext ? `${context_name}.r` : require_name;
8889
- case 1:
8890
- return usesRuntimeContext ? context_name : `${require_name}.*`;
8891
- case 2:
8892
- return exports_name;
8893
- case 3:
8894
- return "top-level-this-exports";
8895
- case 4:
8896
- return "return-exports-from-runtime";
8897
- case 5:
8898
- return "module";
8899
- case 6:
8900
- return "module.id";
8901
- case 7:
8902
- return "module.loaded";
8903
- case 8:
8904
- return `${scope_name}.p`;
8905
- case 9:
8906
- return `${scope_name}.s`;
8907
- case 10:
8908
- return `${scope_name}.c`;
8909
- case 77:
8910
- return `${scope_name}.zD`;
8911
- case 11:
8912
- return `${scope_name}.m`;
8913
- case 12:
8914
- return `${scope_name}.m (add only)`;
8915
- case 13:
8916
- return `${scope_name}.e`;
8917
- case 14:
8918
- return `${scope_name}.f`;
8919
- case 15:
8920
- return `${scope_name}.f (include entries)`;
8921
- case 16:
8922
- return `${scope_name}.E`;
8923
- case 17:
8924
- return `${scope_name}.F`;
8925
- case 18:
8926
- return `${scope_name}.G`;
8927
- case 19:
8928
- return `${scope_name}.H`;
8929
- case 20:
8930
- return `${scope_name}.d`;
8931
- case 21:
8932
- return usesRuntimeContext ? `${context_name}.N` : `${require_name}.r`;
8933
- case 22:
8934
- return `${scope_name}.t`;
8935
- case 23:
8936
- return `${scope_name}.n`;
8937
- case 24:
8938
- return `${scope_name}.hmd`;
8939
- case 25:
8940
- return `${scope_name}.nmd`;
8941
- case 26:
8942
- return `${scope_name}.h`;
8943
- case 27:
8944
- return `${scope_name}.w`;
8945
- case 28:
8946
- return `${scope_name}.v`;
8947
- case 29:
8948
- return `${scope_name}.vs`;
8949
- case 30:
8950
- return `${scope_name}.oe`;
8951
- case 31:
8952
- return `${scope_name}.nc`;
8953
- case 32:
8954
- return `${scope_name}.l`;
8955
- case 33:
8956
- return `${scope_name}.ts`;
8957
- case 34:
8958
- return `${scope_name}.tu`;
8959
- case 35:
8960
- return `${scope_name}.tt`;
8961
- case 36:
8962
- return "has fetch priority";
8963
- case 37:
8964
- return `${scope_name}.cn`;
8965
- case 38:
8966
- return `${scope_name}.j`;
8967
- case 39:
8968
- return `${scope_name}.u`;
8969
- case 40:
8970
- return `${scope_name}.k`;
8971
- case 41:
8972
- return `${scope_name}.rv`;
8973
- case 42:
8974
- return "has css modules";
8975
- case 43:
8976
- return `${scope_name}.ruid`;
8977
- case 44:
8978
- return `${scope_name}.hu`;
8979
- case 45:
8980
- return `${scope_name}.hk`;
8981
- case 46:
8982
- return `${scope_name}.x`;
8983
- case 47:
8984
- return `${scope_name}.x (no default handler)`;
8985
- case 48:
8986
- return `${scope_name}.x (only after)`;
8987
- case 49:
8988
- return `${scope_name}.x (only before)`;
8989
- case 50:
8990
- return "global chunk callback";
8991
- case 51:
8992
- return `${scope_name}.X`;
8993
- case 52:
8994
- return `${scope_name}.x (chunk dependencies)`;
8995
- case 53:
8996
- return `${scope_name}.O`;
8997
- case 54:
8998
- return `${scope_name}.C`;
8999
- case 55:
9000
- return `${scope_name}.i`;
9001
- case 56:
9002
- return `${scope_name}.g`;
9003
- case 57:
9004
- return `${scope_name}.S`;
9005
- case 58:
9006
- return `${scope_name}.I`;
9007
- case 59:
9008
- return `${scope_name}.R`;
9009
- case 60:
9010
- return `${scope_name}.hmrF`;
9011
- case 61:
9012
- return `${scope_name}.hmrM`;
9013
- case 62:
9014
- return `${scope_name}.hmrC`;
9015
- case 63:
9016
- return `${scope_name}.hmrD`;
9017
- case 64:
9018
- return `${scope_name}.hmrI`;
9019
- case 65:
9020
- return `${scope_name}.hmrS`;
9021
- case 66:
9022
- return `${scope_name}.amdD`;
9023
- case 67:
9024
- return `${scope_name}.amdO`;
9025
- case 68:
9026
- return `${scope_name}.System`;
9027
- case 69:
9028
- return `${scope_name}.o`;
9029
- case 70:
9030
- return `${scope_name}.y`;
9031
- case 71:
9032
- return `${scope_name}.b`;
9033
- case 72:
9034
- return `${scope_name}.U`;
9035
- case 73:
9036
- return `${scope_name}.a`;
9037
- case 74:
9038
- return `${scope_name}.aE`;
9039
- case 75:
9040
- return `${scope_name}.z`;
9041
- case 76:
9042
- return `${scope_name}.zS`;
9043
- default:
9044
- return '';
9045
- }
9046
- }(RuntimeGlobals_RuntimeGlobals[key], compilerOptions);
9179
+ for (let key of Object.keys(RuntimeGlobals_RuntimeGlobals))res[key] = renderRuntimeGlobals(RuntimeGlobals_RuntimeGlobals[key], compilerOptions);
9047
9180
  return res;
9048
9181
  }
9049
9182
  let DefaultRuntimeGlobals = createCompilerRuntimeGlobals();
@@ -9621,8 +9754,9 @@ class MultiStats {
9621
9754
  let { children: childrenOptions, ...baseOptions } = 'string' == typeof options || 'boolean' == typeof options ? {
9622
9755
  preset: options
9623
9756
  } : options ?? {}, children = this.stats.map((stat, idx)=>{
9757
+ if ('boolean' == typeof options) return stat.compilation.createStatsOptions(options, context);
9624
9758
  let childOptions = Array.isArray(childrenOptions) ? childrenOptions[idx] : childrenOptions;
9625
- return stat.compilation.createStatsOptions({
9759
+ return 'boolean' == typeof childOptions ? stat.compilation.createStatsOptions(childOptions, context) : stat.compilation.createStatsOptions({
9626
9760
  ...baseOptions,
9627
9761
  ...'string' == typeof childOptions ? {
9628
9762
  preset: childOptions
@@ -9637,7 +9771,7 @@ class MultiStats {
9637
9771
  warnings: children.every((o)=>o.warnings),
9638
9772
  children,
9639
9773
  context: '',
9640
- version: ''
9774
+ version: children.every((o)=>o.version)
9641
9775
  };
9642
9776
  }
9643
9777
  toJson(options) {
@@ -9647,7 +9781,7 @@ class MultiStats {
9647
9781
  obj.children = this.stats.map((stat, idx)=>{
9648
9782
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
9649
9783
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
9650
- }), childOptions.version && (obj.rspackVersion = "2.3.2", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
9784
+ }), childOptions.version && (obj.rspackVersion = "2.3.4", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
9651
9785
  let mapError = (j, obj)=>({
9652
9786
  ...obj,
9653
9787
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -9769,8 +9903,8 @@ let util_ArrayQueue = class {
9769
9903
  }
9770
9904
  }
9771
9905
  *[ArrayQueue_computedKey]() {
9772
- yield* this._list;
9773
9906
  for(let i = this._listReversed.length - 1; i >= 0; i--)yield this._listReversed[i];
9907
+ yield* this._list;
9774
9908
  }
9775
9909
  };
9776
9910
  class MultiCompiler {
@@ -9819,7 +9953,7 @@ class MultiCompiler {
9819
9953
  }
9820
9954
  get outputPath() {
9821
9955
  let commonPath = this.compilers[0].outputPath;
9822
- for (let compiler of this.compilers)for(; 0 !== compiler.outputPath.indexOf(commonPath) && /[/\\]/.test(commonPath);)commonPath = commonPath.replace(/[/\\][^/\\]*$/, '');
9956
+ for (let compiler of this.compilers)for(; !compiler.outputPath.startsWith(commonPath) && /[/\\]/.test(commonPath);)commonPath = commonPath.replace(/[/\\][^/\\]*$/, '');
9823
9957
  return commonPath || '/' !== this.compilers[0].outputPath[0] ? commonPath : '/';
9824
9958
  }
9825
9959
  get inputFileSystem() {
@@ -10291,8 +10425,8 @@ let arraySum = (array)=>{
10291
10425
  let str = `${a}`, length = lengths[i];
10292
10426
  return str.length === length ? str : length > 5 ? `...${str.slice(-length + 3)}` : length > 0 ? str.slice(-length) : '';
10293
10427
  });
10294
- };
10295
- var CachedInputFileSystem_default = compatGetDefaultExport(rspackRequire("../../node_modules/.pnpm/enhanced-resolve@5.26.1/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js"));
10428
+ }, CachedInputFileSystem = rspackRequire("../../node_modules/.pnpm/enhanced-resolve@5.27.0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js");
10429
+ var CachedInputFileSystem_default = compatGetDefaultExport(CachedInputFileSystem);
10296
10430
  class NodeEnvironmentPlugin {
10297
10431
  options;
10298
10432
  constructor(options){
@@ -10612,12 +10746,13 @@ let iterateConfig = (config, options, fn)=>{
10612
10746
  for(; i < errors.length; i++){
10613
10747
  let error = errors[i];
10614
10748
  if ('string' != typeof error && error.details) {
10615
- if ((fullLength += error.details.split('\n').length) > max) {
10749
+ let splitted = error.details.split('\n');
10750
+ if ((fullLength += splitted.length) > max) {
10616
10751
  result = i > 0 ? errors.slice(0, i) : [];
10617
10752
  let overLimit = fullLength - max + 1, error = errors[i++];
10618
10753
  for(result.push({
10619
10754
  ...error,
10620
- details: error.details.split('\n').slice(0, -overLimit).join('\n'),
10755
+ details: splitted.slice(0, -overLimit).join('\n'),
10621
10756
  filteredDetails: overLimit
10622
10757
  }), filtered = errors.length - i; i < errors.length; i++){
10623
10758
  let error = errors[i];
@@ -10827,7 +10962,7 @@ let iterateConfig = (config, options, fn)=>{
10827
10962
  }), (groupModulesByPath || groupModulesByExtension) && groupConfigs.push({
10828
10963
  getKeys: (module)=>{
10829
10964
  if (!module.name) return;
10830
- let resource = parseResource(module.name.split('!').pop()).path, dataUrl = /^data:[^,;]+/.exec(resource);
10965
+ let resource = parseResource(module.name.slice(module.name.lastIndexOf('!') + 1)).path, dataUrl = /^data:[^,;]+/.exec(resource);
10831
10966
  if (dataUrl) return [
10832
10967
  dataUrl[0]
10833
10968
  ];
@@ -11061,7 +11196,7 @@ let iterateConfig = (config, options, fn)=>{
11061
11196
  cacheInfo && (object.cacheInfo = Object.fromEntries(Object.entries(cacheInfo).sort(([a], [b])=>a.localeCompare(b))));
11062
11197
  },
11063
11198
  version: (object)=>{
11064
- object.version = "5.75.0", object.rspackVersion = "2.3.2";
11199
+ object.version = "5.75.0", object.rspackVersion = "2.3.4";
11065
11200
  },
11066
11201
  env: (object, _compilation, _context, { _env })=>{
11067
11202
  object.env = _env;
@@ -11133,7 +11268,7 @@ let iterateConfig = (config, options, fn)=>{
11133
11268
  },
11134
11269
  errors: (object, compilation, context, options, factory)=>{
11135
11270
  let { type, cachedGetErrors } = context, rawErrors = cachedGetErrors(compilation), factorizedErrors = factory.create(`${type}.errors`, cachedGetErrors(compilation), context), filtered = 0;
11136
- if ('auto' === options.errorDetails && rawErrors.length >= 3 && (filtered = rawErrors.map((e)=>'string' != typeof e && e.details).filter(Boolean).length), !0 === options.errorDetails || !Number.isFinite(options.errorsSpace)) {
11271
+ if ('auto' === options.errorDetails && rawErrors.length >= 3 && (filtered = rawErrors.reduce((count, e)=>count + ('string' != typeof e && e.details ? 1 : 0), 0)), !0 === options.errorDetails || !Number.isFinite(options.errorsSpace)) {
11137
11272
  object.errors = factorizedErrors, filtered && (object.filteredErrorDetailsCount = filtered);
11138
11273
  return;
11139
11274
  }
@@ -11145,7 +11280,7 @@ let iterateConfig = (config, options, fn)=>{
11145
11280
  },
11146
11281
  warnings: (object, compilation, context, options, factory)=>{
11147
11282
  let { type, cachedGetWarnings } = context, rawWarnings = factory.create(`${type}.warnings`, cachedGetWarnings(compilation), context), filtered = 0;
11148
- if ('auto' === options.errorDetails && (filtered = cachedGetWarnings(compilation).map((e)=>'string' != typeof e && e.details).filter(Boolean).length), !0 === options.errorDetails || !Number.isFinite(options.warningsSpace)) {
11283
+ if ('auto' === options.errorDetails && (filtered = cachedGetWarnings(compilation).reduce((count, e)=>count + ('string' != typeof e && e.details ? 1 : 0), 0)), !0 === options.errorDetails || !Number.isFinite(options.warningsSpace)) {
11149
11284
  object.warnings = rawWarnings, filtered && (object.filteredWarningDetailsCount = filtered);
11150
11285
  return;
11151
11286
  }
@@ -11601,7 +11736,7 @@ let DefaultStatsPrinterPlugin_plural = (n, singular, plural)=>1 === n ? singular
11601
11736
  'compilation.namedChunkGroups': (namedChunkGroups, context, printer)=>{
11602
11737
  if (!Array.isArray(namedChunkGroups)) {
11603
11738
  let { compilation: { entrypoints } } = context, chunkGroups = Object.values(namedChunkGroups);
11604
- return entrypoints && (chunkGroups = chunkGroups.filter((group)=>!Object.prototype.hasOwnProperty.call(entrypoints, group.name))), printer.print(context.type, chunkGroups, {
11739
+ return entrypoints && (chunkGroups = chunkGroups.filter((group)=>!Object.hasOwn(entrypoints, group.name))), printer.print(context.type, chunkGroups, {
11605
11740
  ...context,
11606
11741
  chunkGroupKind: 'Chunk Group'
11607
11742
  });
@@ -12028,7 +12163,12 @@ let DefaultStatsPrinterPlugin_plural = (n, singular, plural)=>1 === n ? singular
12028
12163
  'compilation.children': (items)=>DefaultStatsPrinterPlugin_indent(itemsJoinMoreSpacing(items), ' '),
12029
12164
  'moduleTraceItem.dependencies': itemsJoinOneLine,
12030
12165
  'loggingEntry.children': (items)=>DefaultStatsPrinterPlugin_indent(items.filter(Boolean).join('\n'), ' ', !1)
12031
- }, joinOneLine = (items)=>items.map((item)=>item.content).filter(Boolean).join(' '), DefaultStatsPrinterPlugin_indent = (str, prefix, noPrefixInFirstLine)=>{
12166
+ }, joinOneLine = (items)=>{
12167
+ let contents = [];
12168
+ return items.forEach(({ content })=>{
12169
+ content && contents.push(content);
12170
+ }), contents.join(' ');
12171
+ }, DefaultStatsPrinterPlugin_indent = (str, prefix, noPrefixInFirstLine)=>{
12032
12172
  let rem = str.replace(/\n([^\n])/g, `\n${prefix}$1`);
12033
12173
  return noPrefixInFirstLine ? rem : ('\n' === str[0] ? '' : prefix) + rem;
12034
12174
  }, joinExplicitNewLine = (items, indenter)=>{
@@ -12163,15 +12303,15 @@ let DefaultStatsPrinterPlugin_plural = (n, singular, plural)=>1 === n ? singular
12163
12303
  formatFlag: (flag)=>`[${flag}]`,
12164
12304
  formatLayer: (layer)=>`(in ${layer})`,
12165
12305
  formatSize: (size)=>{
12166
- if ('number' != typeof size || Number.isNaN(size)) return 'unknown size';
12306
+ if ('number' != typeof size || !Number.isFinite(size)) return 'unknown size';
12167
12307
  if (size <= 0) return '0 bytes';
12168
- let index = Math.floor(Math.log(size) / Math.log(1024));
12169
- return `${+(size / 1024 ** index).toPrecision(3)} ${[
12308
+ let abbreviations = [
12170
12309
  'bytes',
12171
12310
  'KiB',
12172
12311
  'MiB',
12173
12312
  'GiB'
12174
- ][index]}`;
12313
+ ], index = Math.min(Math.max(Math.floor(Math.log(size) / Math.log(1024)), 0), abbreviations.length - 1);
12314
+ return `${+(size / 1024 ** index).toPrecision(3)} ${abbreviations[index]}`;
12175
12315
  },
12176
12316
  formatDateTime: (dateTime, { bold })=>{
12177
12317
  let d = new Date(dateTime), date = `${d.getFullYear()}-${twoDigit(d.getMonth() + 1)}-${twoDigit(d.getDate())}`, time = `${twoDigit(d.getHours())}:${twoDigit(d.getMinutes())}:${twoDigit(d.getSeconds())}`;
@@ -12628,7 +12768,7 @@ class TraceHookPlugin {
12628
12768
  });
12629
12769
  }
12630
12770
  }
12631
- let CORE_VERSION = "2.3.2", VFILES_BY_COMPILER = new WeakMap();
12771
+ let CORE_VERSION = "2.3.4", VFILES_BY_COMPILER = new WeakMap();
12632
12772
  class VirtualModulesPlugin {
12633
12773
  #staticModules;
12634
12774
  #compiler;
@@ -13177,7 +13317,7 @@ class Compiler {
13177
13317
  close ? close.then(()=>callback(error), (closeError)=>callback(error || closeError)) : callback(error);
13178
13318
  };
13179
13319
  this.hooks.shutdown.callAsync((err)=>{
13180
- if (err) return instanceCallback(err);
13320
+ if (err || this.isChild()) return instanceCallback(err);
13181
13321
  this.cache.shutdown(instanceCallback);
13182
13322
  });
13183
13323
  }
@@ -13256,6 +13396,8 @@ Help:
13256
13396
  module: !!environment.module,
13257
13397
  optionalChaining: !!environment.optionalChaining,
13258
13398
  logicalAssignment: !!environment.logicalAssignment,
13399
+ spread: !!environment.spread,
13400
+ symbol: !!environment.symbol,
13259
13401
  templateLiteral: !!environment.templateLiteral,
13260
13402
  topLevelAwait: !!environment.topLevelAwait,
13261
13403
  importMetaDirnameAndFilename: !!environment.importMetaDirnameAndFilename
@@ -13508,13 +13650,10 @@ Help:
13508
13650
  }
13509
13651
  })[module.constructorName](), compilation = getCompiler().__internal__get_compilation();
13510
13652
  runtimeModule.attach(compilation, chunk, compilation.chunkGraph);
13511
- let originSource = module.source?.source;
13512
- queried.call(runtimeModule, chunk);
13513
- let newSource = module.source?.source;
13514
- if (newSource && newSource !== originSource) {
13515
- if (getCompiler().options.experiments?.runtimeMode === 'rspack') throw Error('Compilation.hooks.runtimeModule source modifications are not supported when experiments.runtimeMode is "rspack".');
13516
- return module;
13517
- }
13653
+ let original = module.source?.source, rspackMode = 'rspack' === compilation.options.experiments.runtimeMode, generate = runtimeModule.generate;
13654
+ queried.call(runtimeModule, chunk), rspackMode && module.source && generate !== runtimeModule.generate && (module.source.source = runtimeModule.generate());
13655
+ let updated = module.source?.source;
13656
+ if (updated !== original && (rspackMode ? void 0 !== updated && updated.toString() !== original?.toString() : updated)) return module;
13518
13657
  };
13519
13658
  }),
13520
13659
  registerCompilationBuildModuleTaps: createTap(binding__default().RegisterJsTapKind.CompilationBuildModule, function() {
@@ -13576,9 +13715,8 @@ Help:
13576
13715
  [renderRuntimeVariables(0, getCompiler().options)]: moduleRequireFn,
13577
13716
  [renderRuntimeVariables(1, getCompiler().options)]: runtimeContext
13578
13717
  }), 'Compilation.hooks.executeModule'), moduleObject.loaded = !0, moduleObject.exports;
13579
- }, moduleCache = moduleRequireFn[RuntimeGlobals.moduleCache.replace(`${RuntimeGlobals.require}.`, '')] = {}, interceptModuleExecution = moduleRequireFn[RuntimeGlobals.interceptModuleExecution.replace(`${RuntimeGlobals.require}.`, '')] = [];
13580
- for (let runtimeModule of (moduleRequireFn.r = moduleRequireFn, runtimeContext.r = moduleRequireFn, runtimeModules))moduleRequireFn(runtimeModule);
13581
- for (let key of Reflect.ownKeys(moduleRequireFn))runtimeContext[key] = moduleRequireFn[key];
13718
+ }, moduleCache = {}, interceptModuleExecution = [], compilerOptions = getCompiler().options, isRspackRuntimeMode = 'rspack' === compilerOptions.experiments.runtimeMode, runtimeScope = isRspackRuntimeMode ? runtimeContext : moduleRequireFn;
13719
+ for (let runtimeModule of (runtimeScope[renderRuntimeGlobalProperty(10, compilerOptions)] = moduleCache, runtimeScope[renderRuntimeGlobalProperty(55, compilerOptions)] = interceptModuleExecution, isRspackRuntimeMode && (runtimeContext[renderRuntimeGlobalProperty(0, compilerOptions)] = moduleRequireFn), runtimeModules))moduleRequireFn(runtimeModule);
13582
13720
  let executeResult = moduleRequireFn(entry);
13583
13721
  getCompiler().__internal__get_module_execution_results_map().set(id, executeResult);
13584
13722
  } catch (e) {
@@ -13941,7 +14079,7 @@ Help:
13941
14079
  #updateNonSkippableRegisters() {
13942
14080
  let kinds = [];
13943
14081
  for (let { getHook, getHookMap, registerKind } of Object.values(this.#registers))(getHook ?? getHookMap)().isUsed() && kinds.push(registerKind);
13944
- this.#nonSkippableRegisters.join() !== kinds.join() && this.#getInstance((_error, instance)=>{
14082
+ (this.#nonSkippableRegisters.length !== kinds.length || this.#nonSkippableRegisters.some((kind, index)=>kind !== kinds[index])) && this.#getInstance((_error, instance)=>{
13945
14083
  instance.setNonSkippableRegisters(kinds), this.#nonSkippableRegisters = kinds;
13946
14084
  });
13947
14085
  }
@@ -14180,9 +14318,9 @@ let VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
14180
14318
  function isRequiredVersion(str) {
14181
14319
  return VERSION_PATTERN_REGEXP.test(str);
14182
14320
  }
14183
- let encodeName = function(name, prefix = '', withExt = !1) {
14184
- return `${prefix}${name.replace(/@/g, 'scope_').replace(/-/g, '_').replace(/\//g, '__').replace(/\./g, '')}${withExt ? '.js' : ''}`;
14185
- };
14321
+ function encodeName(...parts) {
14322
+ return `mf_${createHash_createHash('xxhash64').update(JSON.stringify(parts), 'utf8').digest('hex')}`;
14323
+ }
14186
14324
  function normalizeConsumeShareOptions(consumes, shareScope) {
14187
14325
  return parseOptions(consumes, (item, key)=>{
14188
14326
  if (Array.isArray(item)) throw Error('Unexpected array in options');
@@ -14357,9 +14495,9 @@ function getFileName(manifestOptions) {
14357
14495
  statsFileName: STATS_FILE_NAME,
14358
14496
  manifestFileName: MANIFEST_FILE_NAME
14359
14497
  };
14360
- let filePath = 'boolean' == typeof manifestOptions ? '' : manifestOptions.filePath || '', fileName = 'boolean' == typeof manifestOptions ? '' : manifestOptions.fileName || '', manifestFileName = fileName ? fileName.endsWith(JSON_EXT) ? fileName : `${fileName}${JSON_EXT}` : MANIFEST_FILE_NAME;
14498
+ let filePath = 'boolean' == typeof manifestOptions ? '' : manifestOptions.filePath || '', fileName = 'boolean' == typeof manifestOptions ? '' : manifestOptions.fileName || '', manifestFileName = fileName ? fileName.endsWith(JSON_EXT) ? fileName : `${fileName}${JSON_EXT}` : MANIFEST_FILE_NAME, statsFileName = fileName ? manifestFileName.replace(JSON_EXT, `-stats${JSON_EXT}`) : STATS_FILE_NAME;
14361
14499
  return {
14362
- statsFileName: join(filePath, fileName ? manifestFileName.replace(JSON_EXT, `-stats${JSON_EXT}`) : STATS_FILE_NAME).replace(/\\/g, '/'),
14500
+ statsFileName: join(filePath, statsFileName).replace(/\\/g, '/'),
14363
14501
  manifestFileName: join(filePath, manifestFileName).replace(/\\/g, '/')
14364
14502
  };
14365
14503
  }
@@ -14445,7 +14583,7 @@ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
14445
14583
  exposes,
14446
14584
  shared,
14447
14585
  buildInfo: (isDev = 'development' === compiler.options.mode, mfConfig1 = this.rawOpts, pkg = function(root) {
14448
- let pkgPath = join(root ? external_node_path_resolve(root) : process.cwd(), 'package.json');
14586
+ let base = root ? external_node_path_resolve(root) : process.cwd(), pkgPath = join(base, 'package.json');
14449
14587
  try {
14450
14588
  let content = readFileSync(pkgPath, 'utf-8'), parsed = function(input, guard) {
14451
14589
  try {
@@ -14518,7 +14656,7 @@ class SharedContainerPlugin extends RspackBuiltinPlugin {
14518
14656
  constructor(options){
14519
14657
  super();
14520
14658
  let { shareName, library, request, independentShareFileName, mfName } = options, version = options.version || '0.0.0';
14521
- this._globalName = encodeName(`${mfName}_${shareName}_${version}`);
14659
+ this._globalName = encodeName(mfName, shareName, version);
14522
14660
  let fileName = independentShareFileName || `${version}/share-entry.js`;
14523
14661
  this._shareName = shareName, this._options = {
14524
14662
  name: shareName,
@@ -14615,8 +14753,8 @@ class VirtualEntryPlugin {
14615
14753
  chunk?.files.forEach((f)=>{
14616
14754
  compilation.deleteAsset(f);
14617
14755
  });
14618
- } catch (_e) {
14619
- console.error('Failed to remove virtual entry file!');
14756
+ } catch (error) {
14757
+ compiler.getInfrastructureLogger('VirtualEntryPlugin').error('Failed to remove virtual entry file!', error);
14620
14758
  }
14621
14759
  });
14622
14760
  });
@@ -14664,8 +14802,8 @@ class IndependentSharedPlugin {
14664
14802
  name: 'IndependentSharedPlugin',
14665
14803
  stage: 102
14666
14804
  }, async ()=>{
14667
- let shareRequestsMap = collectSharedEntryPlugin.getData();
14668
- this.prepareBuildAssets(shareRequestsMap), await this.createIndependentCompilers(compiler, shareRequestsMap), this.onBuildAssets?.(this.buildAssets);
14805
+ let builds = this.prepareFallbackBuilds(collectSharedEntryPlugin.getData()), logger = compiler.getInfrastructureLogger(this.name);
14806
+ logger.log('Start building shared fallback resources ...'), await Promise.all(builds.map((build)=>this.createIndependentCompiler(compiler, logger, build))), logger.log('All shared fallback have been compiled successfully!'), this.onBuildAssets?.(this.buildAssets);
14669
14807
  }), manifest && compiler.hooks.compilation.tap('IndependentSharedPlugin', (compilation)=>{
14670
14808
  compilation.hooks.processAssets.tap({
14671
14809
  name: 'injectBuildAssets',
@@ -14686,53 +14824,35 @@ class IndependentSharedPlugin {
14686
14824
  });
14687
14825
  });
14688
14826
  }
14689
- prepareBuildAssets(shareRequestsMap) {
14690
- let { sharedOptions, outputDir, mfName, treeShaking, library } = this, buildAssets = {};
14691
- sharedOptions.forEach(([shareName, shareConfig])=>{
14692
- if (!shareConfig.treeShaking || !1 === shareConfig.import) return;
14693
- let sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
14694
- getShareRequests(shareRequestsMap, shareName).forEach(([request, version])=>{
14695
- let [shareFileName, globalName, sharedVersion] = new SharedContainerPlugin({
14827
+ prepareFallbackBuilds(shareRequestsMap) {
14828
+ let { sharedOptions, mfName, treeShaking, library } = this, buildAssets = {}, builds = [];
14829
+ for (let [key, shareConfig] of sharedOptions){
14830
+ if (!shareConfig.treeShaking || !1 === shareConfig.import) continue;
14831
+ let shareName = shareConfig.shareKey || key, outputDir = resolveOutputDir(this.outputDir, shareName);
14832
+ for (let [request, version] of getShareRequests(shareRequestsMap, shareName)){
14833
+ let plugin = new SharedContainerPlugin({
14696
14834
  mfName: `${mfName}_${treeShaking ? 't' : 'f'}`,
14697
14835
  library,
14698
14836
  shareName,
14699
14837
  version,
14700
14838
  request,
14701
- independentShareFileName: sharedConfig?.treeShaking?.filename
14702
- }).getData();
14703
- 'string' == typeof shareFileName && (buildAssets[shareName] ||= [], buildAssets[shareName].push([
14704
- join(resolveOutputDir(outputDir, shareName), shareFileName),
14839
+ independentShareFileName: shareConfig.treeShaking.filename
14840
+ }), [shareFileName, globalName, sharedVersion] = plugin.getData();
14841
+ (buildAssets[shareName] ||= []).push([
14842
+ join(outputDir, shareFileName),
14705
14843
  sharedVersion,
14706
14844
  globalName
14707
- ]));
14708
- });
14709
- }), this.buildAssets = buildAssets;
14710
- }
14711
- async createIndependentCompilers(parentCompiler, shareRequestsMap) {
14712
- let { sharedOptions } = this;
14713
- console.log('Start building shared fallback resources ...'), await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
14714
- if (!shareConfig.treeShaking || !1 === shareConfig.import) return;
14715
- let shareRequests = getShareRequests(shareRequestsMap, shareName);
14716
- await Promise.all(shareRequests.map(async ([request, version])=>{
14717
- let sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
14718
- await this.createIndependentCompiler(parentCompiler, {
14719
- shareRequestsMap,
14720
- currentShare: {
14721
- shareName,
14722
- version,
14723
- request,
14724
- independentShareFileName: sharedConfig?.treeShaking?.filename
14725
- }
14845
+ ]), builds.push({
14846
+ shareName,
14847
+ outputDir,
14848
+ plugin
14726
14849
  });
14727
- }));
14728
- })), console.log('All shared fallback have been compiled successfully!');
14850
+ }
14851
+ }
14852
+ return this.buildAssets = buildAssets, builds;
14729
14853
  }
14730
- async createIndependentCompiler(parentCompiler, extraOptions) {
14731
- let { mfName, plugins, outputDir, sharedOptions, treeShaking, library, treeShakingSharedExcludePlugins } = this, outputDirWithShareName = resolveOutputDir(outputDir, extraOptions.currentShare.shareName), parentConfig = parentCompiler.options, finalPlugins = [], rspack = parentCompiler.rspack, extraPlugin = new SharedContainerPlugin({
14732
- mfName: `${mfName}_${treeShaking ? 't' : 'f'}`,
14733
- library,
14734
- ...extraOptions.currentShare
14735
- });
14854
+ async createIndependentCompiler(parentCompiler, logger, { shareName, outputDir, plugin: sharedContainerPlugin }) {
14855
+ let { plugins, sharedOptions, treeShaking, treeShakingSharedExcludePlugins } = this, parentConfig = parentCompiler.options, finalPlugins = [], rspack = parentCompiler.rspack;
14736
14856
  (parentConfig.plugins || []).forEach((plugin)=>{
14737
14857
  void 0 !== plugin && 'string' != typeof plugin && ((plugin, excludedPlugins = [])=>{
14738
14858
  if (!plugin) return !0;
@@ -14753,8 +14873,8 @@ class IndependentSharedPlugin {
14753
14873
  })(plugin, treeShakingSharedExcludePlugins) && finalPlugins.push(plugin);
14754
14874
  }), plugins.forEach((plugin)=>{
14755
14875
  finalPlugins.push(plugin);
14756
- }), finalPlugins.push(extraPlugin), finalPlugins.push(new ConsumeSharedPlugin({
14757
- consumes: sharedOptions.filter(([key, options])=>extraOptions.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
14876
+ }), finalPlugins.push(sharedContainerPlugin), finalPlugins.push(new ConsumeSharedPlugin({
14877
+ consumes: sharedOptions.filter(([key, options])=>shareName !== (options.shareKey || key)).map(([key, options])=>({
14758
14878
  [key]: {
14759
14879
  import: !1,
14760
14880
  shareKey: options.shareKey || key,
@@ -14768,8 +14888,11 @@ class IndependentSharedPlugin {
14768
14888
  })),
14769
14889
  enhanced: !0
14770
14890
  })), treeShaking && finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectTreeShakingUsedExports)), finalPlugins.push(new VirtualEntryPlugin(sharedOptions, !1));
14771
- let fullOutputDir = external_node_path_resolve(parentCompiler.outputPath, outputDirWithShareName), compilerConfig = {
14891
+ let fullOutputDir = external_node_path_resolve(parentCompiler.outputPath, outputDir), compilerConfig = {
14772
14892
  ...parentConfig,
14893
+ cache: {
14894
+ type: 'memory'
14895
+ },
14773
14896
  name: parentConfig.name || 'mf-shared-compiler',
14774
14897
  module: {
14775
14898
  ...parentConfig.module,
@@ -14801,16 +14924,20 @@ class IndependentSharedPlugin {
14801
14924
  }
14802
14925
  }, compiler = rspack.rspack(compilerConfig);
14803
14926
  compiler.inputFileSystem = parentCompiler.inputFileSystem, compiler.outputFileSystem = parentCompiler.outputFileSystem, compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
14804
- let { currentShare } = extraOptions;
14805
- return new Promise((resolve, reject)=>{
14806
- compiler.run((err, stats)=>{
14807
- if (err || stats?.hasErrors()) {
14808
- console.error(`${currentShare.shareName} Compile failed:`, err || stats.toJson().errors.map((e)=>e.message).join('\n')), reject(err || Error(`${currentShare.shareName} Compile failed`));
14809
- return;
14810
- }
14811
- console.log(`${currentShare.shareName} Compile success`), resolve(extraPlugin.getData());
14812
- });
14927
+ let [error, stats] = await new Promise((resolve)=>{
14928
+ compiler.run((error, stats)=>resolve([
14929
+ error,
14930
+ stats
14931
+ ]));
14813
14932
  });
14933
+ if (error || stats?.hasErrors()) {
14934
+ let message = `${shareName} Compile failed`;
14935
+ throw logger.error(`${message}:`, error || stats?.toString({
14936
+ all: !1,
14937
+ errors: !0
14938
+ })), error || Error(message);
14939
+ }
14940
+ logger.log(`${shareName} Compile success`);
14814
14941
  }
14815
14942
  }
14816
14943
  let TreeShakingSharedPlugin_require = createRequire(import.meta.url);
@@ -15052,7 +15179,7 @@ class ContainerReferencePlugin extends RspackBuiltinPlugin {
15052
15179
  return createBuiltinPlugin(this.name, rawOptions);
15053
15180
  }
15054
15181
  }
15055
- let exports_rspackVersion = "2.3.2", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
15182
+ let exports_rspackVersion = "2.3.4", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
15056
15183
  getNormalizedRspackOptions: getNormalizedRspackOptions,
15057
15184
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
15058
15185
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -15087,6 +15214,7 @@ let exports_rspackVersion = "2.3.2", exports_version = "5.75.0", exports_Webpack
15087
15214
  CompactHashedModuleIdsPlugin: CompactHashedModuleIdsPlugin,
15088
15215
  CompatHashedChunkIdsPlugin: CompactHashedChunkIdsPlugin,
15089
15216
  CompatHashedModuleIdsPlugin: CompactHashedModuleIdsPlugin,
15217
+ DeterministicChunkIdsPlugin: DeterministicChunkIdsPlugin,
15090
15218
  DeterministicModuleIdsPlugin: DeterministicModuleIdsPlugin,
15091
15219
  HashedModuleIdsPlugin: HashedModuleIdsPlugin
15092
15220
  }, exports_library = {