@ohos-ports/rspack-core 2.2.9-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.
Files changed (68) hide show
  1. package/README.md +7 -7
  2. package/compiled/http-proxy-middleware/index.d.ts +12 -10
  3. package/compiled/http-proxy-middleware/package.json +1 -1
  4. package/compiled/tinypool/dist/index.js +5 -3
  5. package/compiled/watchpack/index.js +459 -60
  6. package/compiled/watchpack/package.json +1 -1
  7. package/compiled/watchpack/types/DirectoryWatcher.d.ts +24 -0
  8. package/compiled/watchpack/types/index.d.ts +1 -1
  9. package/compiled/watchpack/types/watchEventSource.d.ts +9 -0
  10. package/compiled/webpack-sources/index.d.ts +2 -0
  11. package/compiled/webpack-sources/index.js +207 -94
  12. package/compiled/webpack-sources/package.json +1 -1
  13. package/compiled/webpack-sources/types/RawSource.d.ts +0 -10
  14. package/compiled/webpack-sources/types/helpers/sourceMap.d.ts +47 -0
  15. package/compiled/webpack-sources/types/index.d.ts +1 -0
  16. package/dist/BuildInfo.d.ts +7 -0
  17. package/dist/Compilation.d.ts +3 -1
  18. package/dist/Compiler.d.ts +5 -6
  19. package/dist/ConcatenatedModule.d.ts +5 -1
  20. package/dist/ContextModule.d.ts +3 -1
  21. package/dist/ExternalModule.d.ts +7 -6
  22. package/dist/FileSystemInfo.d.ts +1 -0
  23. package/dist/Module.d.ts +12 -8
  24. package/dist/ModuleGraphConnection.d.ts +9 -3
  25. package/dist/NativeWatchFileSystem.d.ts +19 -7
  26. package/dist/NormalModule.d.ts +14 -6
  27. package/dist/RuntimeGlobals.d.ts +2 -1
  28. package/dist/RuntimeTemplate.d.ts +2 -0
  29. package/dist/Stats.d.ts +1 -1
  30. package/dist/builtin-loader/lightningcss/index.d.ts +5 -1
  31. package/dist/builtin-plugin/CompactHashedChunkIdsPlugin.d.ts +1 -0
  32. package/dist/builtin-plugin/CompactHashedModuleIdsPlugin.d.ts +1 -0
  33. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +5 -0
  34. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +3 -2
  35. package/dist/builtin-plugin/ImportedByDeferModulesPlugin.d.ts +9 -0
  36. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +1 -0
  37. package/dist/builtin-plugin/index.d.ts +1 -0
  38. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +2 -2
  39. package/dist/config/adapterRuleUse.d.ts +1 -0
  40. package/dist/config/normalization.d.ts +2 -2
  41. package/dist/config/target.d.ts +6 -0
  42. package/dist/config/types.d.ts +69 -36
  43. package/dist/cssExtractHmr.js +1 -1
  44. package/dist/cssExtractLoader.js +1 -1
  45. package/dist/exports.d.ts +5 -4
  46. package/dist/index.js +1577 -1151
  47. package/dist/loader-runner/codeFilter.d.ts +9 -0
  48. package/dist/loader-runner/dependencies.d.ts +1 -1
  49. package/dist/loader-runner/index.d.ts +2 -1
  50. package/dist/loader-runner/service.d.ts +0 -4
  51. package/dist/loader-runner/worker.d.ts +4 -1
  52. package/dist/node/NodeWatchFileSystem.d.ts +7 -4
  53. package/dist/sharing/IndependentSharedPlugin.d.ts +1 -2
  54. package/dist/sharing/utils.d.ts +1 -1
  55. package/dist/sources.d.ts +3 -0
  56. package/dist/stats/statsFactoryUtils.d.ts +7 -0
  57. package/dist/util/bindingHelpers.d.ts +2 -0
  58. package/dist/util/createModule.d.ts +3 -0
  59. package/dist/util/fs.d.ts +13 -7
  60. package/dist/util/resolveLayerExternals.d.ts +1 -0
  61. package/dist/util/source.d.ts +12 -3
  62. package/dist/util/symbols.d.ts +10 -0
  63. package/dist/util/watchTimeInfo.d.ts +5 -1
  64. package/dist/worker.js +327 -326
  65. package/hot/lazy-compilation-node.js +1 -1
  66. package/hot/lazy-compilation-web.js +1 -1
  67. package/package.json +4 -4
  68. package/dist/loader-runner/cache.d.ts +0 -27
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- let _computedKey, _computedKey1, _computedKey2, FileSystemDependencies_computedKey, FileSystemDependencies_computedKey1, FileSystemDependencies_computedKey2, Compilation_computedKey, Compilation_computedKey1, Compilation_computedKey2, 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.0/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
  },
@@ -269,8 +269,8 @@ moduleFactories.add({
269
269
  "./moduleFederationDefaultRuntime.js" (module) {
270
270
  module.exports = __rspack_createRequire_require("./moduleFederationDefaultRuntime.js");
271
271
  },
272
- "@rspack/binding" (module) {
273
- module.exports = __rspack_createRequire_require(process.env.RSPACK_BINDING || "@rspack/binding");
272
+ "@ohos-ports/rspack-binding" (module) {
273
+ module.exports = __rspack_createRequire_require(process.env.RSPACK_BINDING || "@ohos-ports/rspack-binding");
274
274
  },
275
275
  "node:crypto" (module) {
276
276
  module.exports = __rspack_createRequire_require("node:crypto");
@@ -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
  },
@@ -304,8 +307,8 @@ makeNamespaceObject(exports_namespaceObject), definePropertyGetters(exports_name
304
307
  CircularDependencyRspackPlugin: ()=>CircularDependencyRspackPlugin,
305
308
  Compilation: ()=>Compilation,
306
309
  Compiler: ()=>Compiler,
307
- ConcatenatedModule: ()=>binding_.ConcatenatedModule,
308
- ContextModule: ()=>binding_.ContextModule,
310
+ ConcatenatedModule: ()=>ConcatenatedModule,
311
+ ContextModule: ()=>ContextModule,
309
312
  ContextReplacementPlugin: ()=>ContextReplacementPlugin,
310
313
  CopyRspackPlugin: ()=>CopyRspackPlugin,
311
314
  CssExtractRspackPlugin: ()=>CssExtractRspackPlugin,
@@ -328,13 +331,13 @@ makeNamespaceObject(exports_namespaceObject), definePropertyGetters(exports_name
328
331
  LightningCssMinimizerRspackPlugin: ()=>LightningCssMinimizerRspackPlugin,
329
332
  LoaderOptionsPlugin: ()=>LoaderOptionsPlugin,
330
333
  LoaderTargetPlugin: ()=>LoaderTargetPlugin,
331
- Module: ()=>binding_.Module,
334
+ Module: ()=>Module_Module,
332
335
  ModuleFilenameHelpers: ()=>ModuleFilenameHelpers_namespaceObject,
333
336
  ModuleGraphConnection: ()=>ModuleGraphConnection,
334
337
  MultiCompiler: ()=>MultiCompiler,
335
338
  MultiStats: ()=>MultiStats,
336
339
  NoEmitOnErrorsPlugin: ()=>NoEmitOnErrorsPlugin,
337
- NormalModule: ()=>binding_.NormalModule,
340
+ NormalModule: ()=>NormalModule,
338
341
  NormalModuleReplacementPlugin: ()=>NormalModuleReplacementPlugin,
339
342
  ProgressPlugin: ()=>ProgressPlugin,
340
343
  ProvidePlugin: ()=>ProvidePlugin,
@@ -364,7 +367,7 @@ makeNamespaceObject(exports_namespaceObject), definePropertyGetters(exports_name
364
367
  optimize: ()=>optimize,
365
368
  rspackVersion: ()=>exports_rspackVersion,
366
369
  sharing: ()=>sharing,
367
- sources: ()=>index_js_namespaceObject,
370
+ sources: ()=>sources_namespaceObject,
368
371
  util: ()=>util,
369
372
  version: ()=>exports_version,
370
373
  wasm: ()=>exports_wasm,
@@ -372,6 +375,12 @@ makeNamespaceObject(exports_namespaceObject), definePropertyGetters(exports_name
372
375
  webworker: ()=>webworker
373
376
  });
374
377
  var ModuleFilenameHelpers_namespaceObject = {};
378
+ makeNamespaceObject(ModuleFilenameHelpers_namespaceObject), definePropertyGetters(ModuleFilenameHelpers_namespaceObject, {
379
+ asRegExp: ()=>asRegExp,
380
+ matchObject: ()=>matchObject,
381
+ matchPart: ()=>matchPart
382
+ });
383
+ var sources_namespaceObject = {};
375
384
  function _define_property(obj, key, value) {
376
385
  return key in obj ? Object.defineProperty(obj, key, {
377
386
  value: value,
@@ -380,10 +389,18 @@ function _define_property(obj, key, value) {
380
389
  writable: !0
381
390
  }) : obj[key] = value, obj;
382
391
  }
383
- makeNamespaceObject(ModuleFilenameHelpers_namespaceObject), definePropertyGetters(ModuleFilenameHelpers_namespaceObject, {
384
- asRegExp: ()=>asRegExp,
385
- matchObject: ()=>matchObject,
386
- matchPart: ()=>matchPart
392
+ makeNamespaceObject(sources_namespaceObject), definePropertyGetters(sources_namespaceObject, {
393
+ CachedSource: ()=>index_js_namespaceObject.CachedSource,
394
+ CompatSource: ()=>index_js_namespaceObject.CompatSource,
395
+ ConcatSource: ()=>RspackConcatSource,
396
+ OriginalSource: ()=>index_js_namespaceObject.OriginalSource,
397
+ PrefixSource: ()=>index_js_namespaceObject.PrefixSource,
398
+ RawSource: ()=>index_js_namespaceObject.RawSource,
399
+ ReplaceSource: ()=>RspackReplaceSource,
400
+ SizeOnlySource: ()=>index_js_namespaceObject.SizeOnlySource,
401
+ Source: ()=>index_js_namespaceObject.Source,
402
+ SourceMapSource: ()=>index_js_namespaceObject.SourceMapSource,
403
+ util: ()=>index_js_namespaceObject.util
387
404
  }), !function() {
388
405
  let { node, bun, deno } = process.versions;
389
406
  if (!node || bun || deno) return;
@@ -891,8 +908,8 @@ class MultiHook {
891
908
  _define_property(this, "hooks", void 0), _define_property(this, "name", void 0), this.hooks = hooks, this.name = name;
892
909
  }
893
910
  }
894
- let binding_ = rspackRequire("@rspack/binding");
895
- var binding__default = compatGetDefaultExport(binding_), AsyncDependenciesBlock = binding_.AsyncDependenciesBlock, ConcatenatedModule = binding_.ConcatenatedModule, ContextModule = binding_.ContextModule, Dependency = binding_.Dependency, EntryDependency = binding_.EntryDependency, Module = binding_.Module, NormalModule = binding_.NormalModule;
911
+ let binding_ = rspackRequire("@ohos-ports/rspack-binding");
912
+ var binding__default = compatGetDefaultExport(binding_), AsyncDependenciesBlock = binding_.AsyncDependenciesBlock, Dependency = binding_.Dependency, EntryDependency = binding_.EntryDependency;
896
913
  Object.defineProperty(binding_.Chunk.prototype, 'files', {
897
914
  enumerable: !0,
898
915
  configurable: !0,
@@ -945,10 +962,11 @@ Object.defineProperty(binding_.Chunk.prototype, 'files', {
945
962
  }
946
963
  });
947
964
  let cutOffLoaderExecution = (stack)=>((stack, flag)=>{
948
- let stacks = stack.split('\n');
949
- for(let i = 0; i < stacks.length; i++)stacks[i].includes(flag) && (stacks.length = i);
950
- return stacks.join('\n');
951
- })(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');
952
970
  class WebpackError_WebpackError extends Error {
953
971
  loc;
954
972
  file;
@@ -982,7 +1000,10 @@ let lib_WebpackError = WebpackError_WebpackError, LogType = Object.freeze({
982
1000
  cache: 'cache'
983
1001
  });
984
1002
  function getLogTypeBitFlag(type) {
985
- 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;
986
1007
  }
987
1008
  function getLogTypesBitFlag(types) {
988
1009
  return types.reduce((acc, cur)=>acc | getLogTypeBitFlag(cur), 0);
@@ -1240,10 +1261,11 @@ class Template {
1240
1261
  return Array.isArray(str) ? str.join('\n') : str;
1241
1262
  }
1242
1263
  static getModulesArrayBounds(modules) {
1264
+ if (0 === modules.length) return !1;
1243
1265
  let maxId = -1 / 0, minId = 1 / 0;
1244
1266
  for (let module of modules){
1245
1267
  let moduleId = module.id;
1246
- if ('number' != typeof moduleId) return !1;
1268
+ if ('number' != typeof moduleId || !Number.isInteger(moduleId) || moduleId < 0) return !1;
1247
1269
  maxId < moduleId && (maxId = moduleId), minId > moduleId && (minId = moduleId);
1248
1270
  }
1249
1271
  minId < 16 + `${minId}`.length && (minId = 0);
@@ -1346,6 +1368,9 @@ class RuntimeTemplate {
1346
1368
  supportsDestructuring() {
1347
1369
  return !!this.#environment.destructuring;
1348
1370
  }
1371
+ supportsSpread() {
1372
+ return !!this.#environment.spread;
1373
+ }
1349
1374
  supportsBigIntLiteral() {
1350
1375
  return !!this.#environment.bigIntLiteral;
1351
1376
  }
@@ -1358,6 +1383,9 @@ class RuntimeTemplate {
1358
1383
  supportTemplateLiteral() {
1359
1384
  return !!this.#environment.templateLiteral;
1360
1385
  }
1386
+ supportsTopLevelAwait() {
1387
+ return !!this.#environment.topLevelAwait;
1388
+ }
1361
1389
  supportNodePrefixForCoreModules() {
1362
1390
  return !!this.#environment.nodePrefixForCoreModules;
1363
1391
  }
@@ -1670,10 +1698,13 @@ class StatsFactory {
1670
1698
  _getAllLevelHooks(hookMap, cache, type) {
1671
1699
  let cacheEntry = cache.get(type);
1672
1700
  if (void 0 !== cacheEntry) return cacheEntry;
1673
- let hooks = [], typeParts = type.split('.');
1674
- for(let i = 0; i < typeParts.length; i++){
1675
- let hook = hookMap.get(typeParts.slice(i).join('.'));
1701
+ let hooks = [], index = 0;
1702
+ for(;;){
1703
+ let hook = hookMap.get(type.slice(index));
1676
1704
  hook && hooks.push(hook);
1705
+ let dot = type.indexOf('.', index);
1706
+ if (-1 === dot) break;
1707
+ index = dot + 1;
1677
1708
  }
1678
1709
  return cache.set(type, hooks), hooks;
1679
1710
  }
@@ -1848,10 +1879,13 @@ class StatsPrinter {
1848
1879
  void 0 === cache && (cache = new Map(), this._levelHookCache.set(hookMap, cache));
1849
1880
  let cacheEntry = cache.get(type);
1850
1881
  if (void 0 !== cacheEntry) return cacheEntry;
1851
- let hooks = [], typeParts = type.split('.');
1852
- for(let i = 0; i < typeParts.length; i++){
1853
- let hook = hookMap.get(typeParts.slice(i).join('.'));
1882
+ let hooks = [], index = 0;
1883
+ for(;;){
1884
+ let hook = hookMap.get(type.slice(index));
1854
1885
  hook && hooks.push(hook);
1886
+ let dot = type.indexOf('.', index);
1887
+ if (-1 === dot) break;
1888
+ index = dot + 1;
1855
1889
  }
1856
1890
  return cache.set(type, hooks), hooks;
1857
1891
  }
@@ -2031,7 +2065,29 @@ for (let name of [
2031
2065
  }
2032
2066
  });
2033
2067
  }
2034
- let index_js_namespaceObject = __rspack_createRequire_require("../compiled/webpack-sources/index.js"), sourceCacheSymbol = Symbol.for('rspack.originalSource'), sourceMapOverrides = new WeakMap();
2068
+ let index_js_namespaceObject = __rspack_createRequire_require("../compiled/webpack-sources/index.js"), sourceCacheSymbol = Symbol.for('rspack.originalSource'), nativeSources = new WeakMap(), toBindingSource = Symbol('rspack.toBindingSource'), sourceMapOverrides = new WeakMap();
2069
+ function toSourceGraph(source) {
2070
+ let native = nativeSources.get(source);
2071
+ return native ? {
2072
+ kind: 'native',
2073
+ handle: native
2074
+ } : source[toBindingSource]?.call(source) ?? serializeSource(source);
2075
+ }
2076
+ function serializeSource(source) {
2077
+ let content = source.source();
2078
+ if (Buffer.isBuffer(content)) return {
2079
+ kind: 'raw',
2080
+ content
2081
+ };
2082
+ let map = source.map?.({
2083
+ columns: !0
2084
+ });
2085
+ return {
2086
+ kind: 'raw',
2087
+ content,
2088
+ map: map ? JSON.stringify(map) : void 0
2089
+ };
2090
+ }
2035
2091
  function replaceSourceMap(source, value) {
2036
2092
  return !!Object.getOwnPropertyDescriptor(source, '_sourceMapAsString')?.configurable && (Object.defineProperty(source, '_sourceMapAsString', {
2037
2093
  value,
@@ -2062,41 +2118,56 @@ function clearSourceCache(options, visited) {
2062
2118
  maps: !1
2063
2119
  }), index_js_namespaceObject.SourceMapSource.prototype.clearCache.call(this, options, visited);
2064
2120
  }
2121
+ class RspackConcatSource extends index_js_namespaceObject.ConcatSource {
2122
+ [toBindingSource]() {
2123
+ return Object.getPrototypeOf(this) !== RspackConcatSource.prototype ? null : {
2124
+ kind: 'concat',
2125
+ children: this.getChildren().map(toSourceGraph)
2126
+ };
2127
+ }
2128
+ }
2129
+ class RspackReplaceSource extends index_js_namespaceObject.ReplaceSource {
2130
+ [toBindingSource]() {
2131
+ return Object.getPrototypeOf(this) !== RspackReplaceSource.prototype ? null : {
2132
+ kind: 'replace',
2133
+ original: toSourceGraph(this.original()),
2134
+ replacements: this.getReplacements(),
2135
+ fallback: ()=>serializeSource(this)
2136
+ };
2137
+ }
2138
+ }
2065
2139
  class SourceAdapter {
2066
- static fromBinding(cache) {
2067
- if (!cache.map) return new index_js_namespaceObject.RawSource(cache.source);
2068
- if ('string' == typeof cache.map) return new index_js_namespaceObject.SourceMapSource(cache.source, 'inmemory://from rust', cache.map);
2069
- let source = new index_js_namespaceObject.SourceMapSource(cache.source, 'inmemory://from rust');
2070
- return source._hasSourceMap = !0, Object.defineProperties(source, {
2071
- [sourceCacheSymbol]: {
2072
- value: cache,
2073
- configurable: !0
2074
- },
2075
- clearCache: {
2076
- value: clearSourceCache,
2077
- writable: !0,
2078
- configurable: !0
2079
- },
2080
- _sourceMapAsString: {
2081
- get: getSourceMap,
2082
- set: setSourceMap,
2083
- configurable: !0,
2084
- enumerable: !0
2085
- }
2086
- }), source;
2140
+ static fromBinding(cache, nativeSource) {
2141
+ let source;
2142
+ if (cache.map) if ('string' == typeof cache.map) source = new index_js_namespaceObject.SourceMapSource(cache.source, 'inmemory://from rust', cache.map);
2143
+ else {
2144
+ let sourceMapSource = new index_js_namespaceObject.SourceMapSource(cache.source, 'inmemory://from rust');
2145
+ sourceMapSource._hasSourceMap = !0, Object.defineProperties(sourceMapSource, {
2146
+ [sourceCacheSymbol]: {
2147
+ value: cache,
2148
+ configurable: !0
2149
+ },
2150
+ clearCache: {
2151
+ value: clearSourceCache,
2152
+ writable: !0,
2153
+ configurable: !0
2154
+ },
2155
+ _sourceMapAsString: {
2156
+ get: getSourceMap,
2157
+ set: setSourceMap,
2158
+ configurable: !0,
2159
+ enumerable: !0
2160
+ }
2161
+ }), source = sourceMapSource;
2162
+ }
2163
+ else source = new index_js_namespaceObject.RawSource(cache.source);
2164
+ return nativeSource && nativeSources.set(source, nativeSource), source;
2087
2165
  }
2088
2166
  static toBinding(source) {
2089
- let content = source.source();
2090
- if (Buffer.isBuffer(content)) return {
2091
- source: content,
2092
- map: void 0
2093
- };
2094
- let map = source.map?.({
2095
- columns: !0
2096
- });
2097
- return {
2098
- source: content,
2099
- map: map ? JSON.stringify(map) : void 0
2167
+ let graph = toSourceGraph(source);
2168
+ return 'raw' === graph.kind || 'native' === graph.kind ? graph : {
2169
+ kind: 'native',
2170
+ handle: binding__default().JsNativeSource.fromSource(graph)
2100
2171
  };
2101
2172
  }
2102
2173
  }
@@ -2235,7 +2306,7 @@ function createDiagnosticArray(adm) {
2235
2306
  reduce: (callbackfn, initialValue)=>adm.values().reduce(callbackfn, initialValue),
2236
2307
  reduceRight: (callbackfn, initialValue)=>adm.values().reduceRight(callbackfn, initialValue)
2237
2308
  }, proxy = new Proxy(array, {
2238
- 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)),
2239
2310
  set (target, name, value) {
2240
2311
  if ('length' === name) throw Error("The 'length' property is read-only and cannot be assigned a new value.");
2241
2312
  return 'symbol' == typeof name || Number.isNaN(Number.parseInt(name, 10)) ? target[name] = value : adm.set(Number.parseInt(name, 10), value), !0;
@@ -2349,6 +2420,7 @@ function createFileSystemDependencies(binding) {
2349
2420
  let wrapper = new FileSystemDependenciesWrapper(binding);
2350
2421
  return wrappers.set(binding, wrapper), wrapper;
2351
2422
  }
2423
+ let MODULE_BUILD_INFO_SYMBOL = Symbol.for('rspack.module.buildInfo'), COMPILATION_HOOKS_MAP_SYMBOL = Symbol.for('rspack.compilation.hooksMap'), BUILD_INFO_ASSETS_SYMBOL = Symbol.for('rspack.buildInfo.assets'), BUILD_INFO_FILE_DEPENDENCIES_SYMBOL = Symbol.for('rspack.buildInfo.fileDependencies'), BUILD_INFO_CONTEXT_DEPENDENCIES_SYMBOL = Symbol.for('rspack.buildInfo.contextDependencies'), BUILD_INFO_MISSING_DEPENDENCIES_SYMBOL = Symbol.for('rspack.buildInfo.missingDependencies'), BUILD_INFO_BUILD_DEPENDENCIES_SYMBOL = Symbol.for('rspack.buildInfo.buildDependencies'), COMMIT_CUSTOM_FIELDS_SYMBOL = Symbol.for('rspack.buildInfo.commitCustomFields'), CIRCULAR_CONNECTION_SYMBOL = Symbol.for('rspack.moduleGraphConnection.circularConnection'), TRANSITIVE_ONLY_SYMBOL = Symbol.for('rspack.moduleGraphConnection.transitiveOnly');
2352
2424
  function Compilation_to_property_key(arg) {
2353
2425
  var key = function(input, hint) {
2354
2426
  if ("object" !== Compilation_type_of(input) || null === input) return input;
@@ -2390,10 +2462,9 @@ let logEntryTraceDescriptor = Object.getOwnPropertyDescriptor({
2390
2462
  }, 'trace'), checkCompilation = (compilation)=>{
2391
2463
  if (!(compilation instanceof Compilation)) throw TypeError('The \'compilation\' argument must be an instance of Compilation. This usually occurs when multiple versions of "@rspack/core" are used, or when the code in "@rspack/core" is executed multiple times.');
2392
2464
  }, getOrCreateCompilationHooks = (compilation, key, createHooks)=>{
2393
- let compilationHooksMap = compilation[binding__default().COMPILATION_HOOKS_MAP_SYMBOL], hooks = compilationHooksMap.get(key);
2465
+ let compilationHooksMap = compilation[COMPILATION_HOOKS_MAP_SYMBOL], hooks = compilationHooksMap.get(key);
2394
2466
  return void 0 === hooks && (hooks = createHooks(), compilationHooksMap.set(key, hooks)), hooks;
2395
2467
  };
2396
- Compilation_computedKey = Compilation_to_property_key(binding__default().COMPILATION_HOOKS_MAP_SYMBOL);
2397
2468
  class Compilation {
2398
2469
  #inner;
2399
2470
  #shutdown;
@@ -2424,7 +2495,7 @@ class Compilation {
2424
2495
  #fileSystemDependencies;
2425
2496
  #addIncludeDispatcher;
2426
2497
  #addEntryDispatcher;
2427
- [Compilation_computedKey];
2498
+ [COMPILATION_HOOKS_MAP_SYMBOL];
2428
2499
  constructor(compiler, inner){
2429
2500
  var name, stage, getArgs;
2430
2501
  let errorMessage, getOptions;
@@ -2565,7 +2636,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2565
2636
  }
2566
2637
  return value;
2567
2638
  }
2568
- }), this.compiler = compiler, this.resolverFactory = compiler.resolverFactory, this.inputFileSystem = compiler.inputFileSystem, this.options = compiler.options, this.outputOptions = compiler.options.output, this.runtimeTemplate = new RuntimeTemplate(this, this.outputOptions), this.logging = new Map(), this.childrenCounters = {}, this.children = [], this.needAdditionalPass = !1, this.chunkGraph = inner.chunkGraph, this.moduleGraph = ModuleGraph.__from_binding(inner.moduleGraph), this.#addIncludeDispatcher = new AddEntryItemDispatcher(inner.addInclude.bind(inner)), this.#addEntryDispatcher = new AddEntryItemDispatcher(inner.addEntry.bind(inner)), this[binding__default().COMPILATION_HOOKS_MAP_SYMBOL] = new WeakMap();
2639
+ }), this.compiler = compiler, this.resolverFactory = compiler.resolverFactory, this.inputFileSystem = compiler.inputFileSystem, this.options = compiler.options, this.outputOptions = compiler.options.output, this.runtimeTemplate = new RuntimeTemplate(this, this.outputOptions), this.logging = new Map(), this.childrenCounters = {}, this.children = [], this.needAdditionalPass = !1, this.chunkGraph = inner.chunkGraph, this.moduleGraph = ModuleGraph.__from_binding(inner.moduleGraph), this.#addIncludeDispatcher = new AddEntryItemDispatcher(inner.addInclude.bind(inner)), this.#addEntryDispatcher = new AddEntryItemDispatcher(inner.addEntry.bind(inner)), this[COMPILATION_HOOKS_MAP_SYMBOL] = new WeakMap();
2569
2640
  }
2570
2641
  get hash() {
2571
2642
  return this.#inner.hash;
@@ -2638,7 +2709,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2638
2709
  }
2639
2710
  createStatsOptions(statsValue, context = {}) {
2640
2711
  let optionsOrPreset = statsValue;
2641
- 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 = {
2642
2715
  preset: optionsOrPreset
2643
2716
  }), 'object' == typeof optionsOrPreset && null !== optionsOrPreset) {
2644
2717
  let options = {};
@@ -2788,10 +2861,16 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2788
2861
  err ? doneWork(Array(moduleIdentifiers.length).fill([
2789
2862
  err,
2790
2863
  null
2791
- ])) : doneWork(modules.map((module)=>[
2864
+ ])) : doneWork(moduleIdentifiers.map((identifier, index)=>{
2865
+ let module = modules[index];
2866
+ return module ? [
2792
2867
  null,
2793
2868
  module
2794
- ]));
2869
+ ] : [
2870
+ Error(`Cannot rebuild module ${identifier}: it is no longer in the module graph.`),
2871
+ null
2872
+ ];
2873
+ }));
2795
2874
  });
2796
2875
  });
2797
2876
  rebuildModule(module, f) {
@@ -2816,7 +2895,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2816
2895
  }
2817
2896
  __internal__getAssetSource(filename) {
2818
2897
  let rawSource = this.#inner.getAssetSource(filename);
2819
- if (rawSource) return SourceAdapter.fromBinding(rawSource);
2898
+ if (rawSource) return SourceAdapter.fromBinding(rawSource, this.#inner.getAssetNativeSource(filename));
2820
2899
  }
2821
2900
  __internal__setAssetSource(filename, source) {
2822
2901
  this.#inner.setAssetSource(filename, SourceAdapter.toBinding(source));
@@ -2902,7 +2981,7 @@ class EntryData {
2902
2981
  this.dependencies = binding.dependencies, this.includeDependencies = binding.includeDependencies, this.options = binding.options;
2903
2982
  }
2904
2983
  }
2905
- Compilation_computedKey1 = Compilation_to_property_key(Symbol.iterator), Compilation_computedKey2 = Compilation_to_property_key(Symbol.toStringTag);
2984
+ Compilation_computedKey = Compilation_to_property_key(Symbol.iterator), Compilation_computedKey1 = Compilation_to_property_key(Symbol.toStringTag);
2906
2985
  class Entries {
2907
2986
  #data;
2908
2987
  constructor(data){
@@ -2929,10 +3008,10 @@ class Entries {
2929
3008
  values() {
2930
3009
  return this.#data.values().map(EntryData.__from_binding)[Symbol.iterator]();
2931
3010
  }
2932
- [Compilation_computedKey1]() {
3011
+ [Compilation_computedKey]() {
2933
3012
  return this.entries();
2934
3013
  }
2935
- [Compilation_computedKey2] = 'Map';
3014
+ [Compilation_computedKey1] = 'Map';
2936
3015
  has(key) {
2937
3016
  return this.#data.has(key);
2938
3017
  }
@@ -3185,10 +3264,16 @@ let DataUriPlugin = base_create(binding_.BuiltinPluginName.DataUriPlugin, ()=>{}
3185
3264
  return normalizeObject(define);
3186
3265
  };
3187
3266
  class DeterministicChunkIdsPlugin extends RspackBuiltinPlugin {
3267
+ options;
3188
3268
  name = binding_.BuiltinPluginName.DeterministicChunkIdsPlugin;
3189
3269
  affectedHooks = 'compilation';
3270
+ constructor(options = {}){
3271
+ super(), this.options = options;
3272
+ }
3190
3273
  raw() {
3191
- return createBuiltinPlugin(this.name, void 0);
3274
+ return createBuiltinPlugin(this.name, {
3275
+ ...this.options
3276
+ });
3192
3277
  }
3193
3278
  }
3194
3279
  class DeterministicModuleIdsPlugin extends RspackBuiltinPlugin {
@@ -3353,7 +3438,7 @@ function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler, enableNameBatch
3353
3438
  function getChunks(chunks) {
3354
3439
  return 'function' == typeof chunks ? (chunk)=>chunks(chunk) : chunks;
3355
3440
  }
3356
- let { name, chunks, defaultSizeTypes, cacheGroups = {}, fallbackCacheGroup, minSize, minSizeReduction, enforceSizeThreshold, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = sc;
3441
+ let { name, chunks, defaultSizeTypes, cacheGroups = {}, fallbackCacheGroup, minSize, minSizeReduction, minRemainingSize, enforceSizeThreshold, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = sc;
3357
3442
  return {
3358
3443
  ...getName(name),
3359
3444
  chunks: getChunks(chunks),
@@ -3362,7 +3447,7 @@ function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler, enableNameBatch
3362
3447
  'unknown'
3363
3448
  ],
3364
3449
  cacheGroups: Object.entries(cacheGroups).filter(([_key, group])=>!1 !== group).map(([key, group])=>{
3365
- let { test, name, chunks, minSize, minSizeReduction, enforceSizeThreshold, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = group;
3450
+ let { test, name, chunks, minSize, minSizeReduction, minRemainingSize, enforceSizeThreshold, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = group;
3366
3451
  return {
3367
3452
  key,
3368
3453
  test: 'function' == typeof test ? (ctx)=>{
@@ -3376,6 +3461,7 @@ function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler, enableNameBatch
3376
3461
  chunks: getChunks(chunks),
3377
3462
  minSize: JsSplitChunkSizes.__to_binding(minSize),
3378
3463
  minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
3464
+ minRemainingSize: JsSplitChunkSizes.__to_binding(minRemainingSize),
3379
3465
  enforceSizeThreshold: JsSplitChunkSizes.__to_binding(enforceSizeThreshold),
3380
3466
  maxSize: JsSplitChunkSizes.__to_binding(maxSize),
3381
3467
  maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
@@ -3389,6 +3475,7 @@ function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler, enableNameBatch
3389
3475
  },
3390
3476
  minSize: JsSplitChunkSizes.__to_binding(minSize),
3391
3477
  minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
3478
+ minRemainingSize: JsSplitChunkSizes.__to_binding(minRemainingSize),
3392
3479
  enforceSizeThreshold: JsSplitChunkSizes.__to_binding(enforceSizeThreshold),
3393
3480
  maxSize: JsSplitChunkSizes.__to_binding(maxSize),
3394
3481
  maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
@@ -3557,10 +3644,10 @@ function isStatsColorSupported() {
3557
3644
  }
3558
3645
  function encodeVersion(version) {
3559
3646
  let [major, minor = 0, patch = 0] = version.split('-')[0].split('.').map((v)=>parseInt(v, 10));
3560
- 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;
3561
3648
  }
3562
3649
  function decodeVersion(n) {
3563
- return `${n >> 16 & 0xff}.${n >> 8 & 0xff}.${0xff & n}`;
3650
+ return `${n >>> 16}.${n >> 8 & 0xff}.${0xff & n}`;
3564
3651
  }
3565
3652
  function encodeTargets(targets) {
3566
3653
  return Object.fromEntries(Object.entries(targets).map(([k, v])=>[
@@ -3652,6 +3739,9 @@ function toFeatures(featureOptions) {
3652
3739
  case 'logicalProperties':
3653
3740
  feature |= 524288;
3654
3741
  break;
3742
+ case 'lightDark':
3743
+ feature |= 1048576;
3744
+ break;
3655
3745
  case 'selectors':
3656
3746
  feature |= 31;
3657
3747
  break;
@@ -3659,7 +3749,7 @@ function toFeatures(featureOptions) {
3659
3749
  feature |= 448;
3660
3750
  break;
3661
3751
  case 'color':
3662
- feature |= 64512;
3752
+ feature |= 1113088;
3663
3753
  }
3664
3754
  return feature;
3665
3755
  }
@@ -3747,6 +3837,21 @@ function createRawModuleRuleUses(uses, path, options) {
3747
3837
  }(use.loader, use.options, options1);
3748
3838
  fingerprintOptions = temp, o = isNil(temp) ? void 0 : 'string' == typeof temp ? temp : JSON.stringify(temp, null, 2), isBuiltin = !0;
3749
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;
3750
3855
  return {
3751
3856
  loader: function(use, path, compiler, isBuiltin, normalizedOptions) {
3752
3857
  let obj = parseResource(use.loader), ident = use.ident;
@@ -3756,14 +3861,17 @@ function createRawModuleRuleUses(uses, path, options) {
3756
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;
3757
3862
  }(use, `${path1}[${index}]`, options1.compiler, isBuiltin, fingerprintOptions),
3758
3863
  options: o,
3759
- cache: use.cache ?? !1,
3760
- optionsCacheKey: use.cache ? JSON.stringify(fingerprintOptions) ?? '' : ''
3864
+ cache: void 0 !== optionsCacheKey,
3865
+ optionsCacheKey: optionsCacheKey ?? '',
3866
+ codeFilter: function(codeFilter, path) {
3867
+ if (void 0 !== codeFilter) {
3868
+ if ('string' == typeof codeFilter || codeFilter instanceof RegExp) return codeFilter;
3869
+ throw Error(`Expected a string or RegExp at \`${path}\`.`);
3870
+ }
3871
+ }(use.codeFilter, `${path1}[${index}].codeFilter`)
3761
3872
  };
3762
3873
  }) : [];
3763
3874
  }
3764
- function isUseSourceMap(devtool) {
3765
- return !!devtool && devtool.includes('source-map') && (devtool.includes('module') || !devtool.includes('cheap'));
3766
- }
3767
3875
  function getRawAlias(alias = {}) {
3768
3876
  return !('object' != typeof alias || null === alias || Array.isArray(alias)) && Object.entries(alias).map(([key, value])=>({
3769
3877
  path: key,
@@ -3829,6 +3937,7 @@ let getRawModuleRule = (rule, path, options, upperType)=>{
3829
3937
  compiler: options.compiler
3830
3938
  }) ?? [], `${path}.use`, options));
3831
3939
  let rawModuleRule = {
3940
+ as: rule.as,
3832
3941
  test: rule.test ? getRawRuleSetCondition(rule.test) : void 0,
3833
3942
  include: rule.include ? getRawRuleSetCondition(rule.include) : void 0,
3834
3943
  exclude: rule.exclude ? getRawRuleSetCondition(rule.exclude) : void 0,
@@ -3861,10 +3970,13 @@ let getRawModuleRule = (rule, path, options, upperType)=>{
3861
3970
  enforce: rule.enforce,
3862
3971
  extractSourceMap: rule.extractSourceMap
3863
3972
  };
3864
- 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)=>{
3865
- let { path, query, fragment } = parseResource(resourceQueryFragment);
3866
- 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));
3867
- })), 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;
3868
3980
  };
3869
3981
  function getRawRuleSetCondition(condition) {
3870
3982
  if ('string' == typeof condition) return {
@@ -3984,6 +4096,7 @@ function getRawJavascriptParserOptions(parser) {
3984
4096
  return importMeta;
3985
4097
  }(parser.importMeta),
3986
4098
  url: parser.url?.toString(),
4099
+ dynamicUrl: parser.dynamicUrl,
3987
4100
  exprContextCritical: parser.exprContextCritical,
3988
4101
  unknownContextCritical: parser.unknownContextCritical,
3989
4102
  wrappedContextCritical: parser.wrappedContextCritical,
@@ -4057,6 +4170,7 @@ function getRawGeneratorOptions(generator, type) {
4057
4170
  type: 'css',
4058
4171
  css: {
4059
4172
  exportsOnly: (options1 = generator).exportsOnly,
4173
+ runtimePublicPath: options1.runtimePublicPath,
4060
4174
  esModule: options1.esModule
4061
4175
  }
4062
4176
  };
@@ -4120,9 +4234,205 @@ function getRawCssAutoOrModuleGeneratorOptions(options) {
4120
4234
  localIdentHashSalt: options.localIdentHashSalt,
4121
4235
  exportsConvention: options.exportsConvention,
4122
4236
  exportsOnly: options.exportsOnly,
4237
+ runtimePublicPath: options.runtimePublicPath,
4123
4238
  esModule: options.esModule
4124
4239
  };
4125
4240
  }
4241
+ let DYNAMIC_INFO = Symbol('cleverMerge dynamic info'), mergeCache = new WeakMap(), DELETE = Symbol('DELETE'), cachedCleverMerge = (first, second)=>{
4242
+ if (void 0 === second) return first;
4243
+ if (void 0 === first || 'object' != typeof second || null === second) return second;
4244
+ if ('object' != typeof first || null === first) return first;
4245
+ let innerCache = mergeCache.get(first);
4246
+ void 0 === innerCache && (innerCache = new WeakMap(), mergeCache.set(first, innerCache));
4247
+ let prevMerge = innerCache.get(second);
4248
+ if (void 0 !== prevMerge) return prevMerge;
4249
+ let newMerge = _cleverMerge(first, second, !0);
4250
+ return innerCache.set(second, newMerge), newMerge;
4251
+ }, parseCache = new WeakMap(), cachedParseObject = (obj)=>{
4252
+ let entry = parseCache.get(obj);
4253
+ if (void 0 !== entry) return entry;
4254
+ let result = parseObject(obj);
4255
+ return parseCache.set(obj, result), result;
4256
+ }, parseObject = (obj)=>{
4257
+ let dynamicInfo, info = new Map(), getInfo = (p)=>{
4258
+ let entry = info.get(p);
4259
+ if (void 0 !== entry) return entry;
4260
+ let newEntry = {
4261
+ base: void 0,
4262
+ byProperty: void 0,
4263
+ byValues: new Map()
4264
+ };
4265
+ return info.set(p, newEntry), newEntry;
4266
+ };
4267
+ for (let key of Object.keys(obj))if (key.startsWith('by')) {
4268
+ let byObj = obj[key];
4269
+ if ('object' == typeof byObj) for (let byValue of Object.keys(byObj)){
4270
+ let obj = byObj[byValue];
4271
+ for (let key1 of Object.keys(obj)){
4272
+ let entry = getInfo(key1);
4273
+ if (void 0 === entry.byProperty) entry.byProperty = key;
4274
+ else if (entry.byProperty !== key) throw Error(`${key} and ${entry.byProperty} for a single property is not supported`);
4275
+ if (entry.byValues.set(byValue, obj[key1]), 'default' === byValue) for (let otherByValue of Object.keys(byObj))entry.byValues.has(otherByValue) || entry.byValues.set(otherByValue, void 0);
4276
+ }
4277
+ }
4278
+ else if ('function' == typeof byObj) if (void 0 === dynamicInfo) dynamicInfo = {
4279
+ byProperty: key,
4280
+ fn: byObj
4281
+ };
4282
+ else throw Error(`${key} and ${dynamicInfo.byProperty} when both are functions is not supported`);
4283
+ else getInfo(key).base = obj[key];
4284
+ } else getInfo(key).base = obj[key];
4285
+ return {
4286
+ static: info,
4287
+ dynamic: dynamicInfo
4288
+ };
4289
+ }, cleverMerge_serializeObject = (info, dynamicInfo)=>{
4290
+ let obj = {};
4291
+ for (let entry of info.values())if (void 0 !== entry.byProperty) {
4292
+ let byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
4293
+ for (let byValue of entry.byValues.keys())byObj[byValue] = byObj[byValue] || {};
4294
+ }
4295
+ for (let [key, entry] of info)if (void 0 !== entry.base && (obj[key] = entry.base), void 0 !== entry.byProperty) {
4296
+ let byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
4297
+ for (let byValue of Object.keys(byObj)){
4298
+ let value = getFromByValues(entry.byValues, byValue);
4299
+ void 0 !== value && (byObj[byValue][key] = value);
4300
+ }
4301
+ }
4302
+ return void 0 !== dynamicInfo && (obj[dynamicInfo.byProperty] = dynamicInfo.fn), obj;
4303
+ }, getValueType = (value)=>void 0 === value ? 0 : value === DELETE ? 4 : Array.isArray(value) ? -1 !== value.lastIndexOf('...') ? 2 : 1 : 'object' != typeof value || null === value || value.constructor && value.constructor !== Object ? 1 : 3, cleverMerge = (first, second)=>void 0 === second ? first : void 0 === first || 'object' != typeof second || null === second ? second : 'object' != typeof first || null === first ? first : _cleverMerge(first, second, !1), _cleverMerge = (first, second, internalCaching = !1)=>{
4304
+ let firstObject = internalCaching ? cachedParseObject(first) : parseObject(first), { static: firstInfo, dynamic: firstDynamicInfo } = firstObject, secondObj = second;
4305
+ if (void 0 !== firstDynamicInfo) {
4306
+ let { fn } = firstDynamicInfo, { byProperty } = firstDynamicInfo, fnInfo = fn[DYNAMIC_INFO];
4307
+ fnInfo && (secondObj = internalCaching ? cachedCleverMerge(fnInfo[1], second) : cleverMerge(fnInfo[1], second), fn = fnInfo[0]);
4308
+ let newFn = (...args)=>{
4309
+ let fnResult = fn(...args);
4310
+ return internalCaching ? cachedCleverMerge(fnResult, secondObj) : cleverMerge(fnResult, secondObj);
4311
+ };
4312
+ return newFn[DYNAMIC_INFO] = [
4313
+ fn,
4314
+ secondObj
4315
+ ], cleverMerge_serializeObject(firstObject.static, {
4316
+ byProperty,
4317
+ fn: newFn
4318
+ });
4319
+ }
4320
+ let { static: secondInfo, dynamic: secondDynamicInfo } = internalCaching ? cachedParseObject(second) : parseObject(second), resultInfo = new Map();
4321
+ for (let [key, firstEntry] of firstInfo){
4322
+ let secondEntry = secondInfo.get(key), entry = void 0 !== secondEntry ? mergeEntries(firstEntry, secondEntry, internalCaching) : firstEntry;
4323
+ resultInfo.set(key, entry);
4324
+ }
4325
+ for (let [key, secondEntry] of secondInfo)firstInfo.has(key) || resultInfo.set(key, secondEntry);
4326
+ return cleverMerge_serializeObject(resultInfo, secondDynamicInfo);
4327
+ }, mergeEntries = (firstEntry, secondEntry, internalCaching)=>{
4328
+ switch(getValueType(secondEntry.base)){
4329
+ case 1:
4330
+ case 4:
4331
+ return secondEntry;
4332
+ case 0:
4333
+ {
4334
+ if (!firstEntry.byProperty) return {
4335
+ base: firstEntry.base,
4336
+ byProperty: secondEntry.byProperty,
4337
+ byValues: secondEntry.byValues
4338
+ };
4339
+ if (firstEntry.byProperty !== secondEntry.byProperty) throw Error(`${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`);
4340
+ let newByValues = new Map(firstEntry.byValues);
4341
+ for (let [key, value] of secondEntry.byValues){
4342
+ let firstValue = getFromByValues(firstEntry.byValues, key);
4343
+ newByValues.set(key, mergeSingleValue(firstValue, value, internalCaching));
4344
+ }
4345
+ return {
4346
+ base: firstEntry.base,
4347
+ byProperty: firstEntry.byProperty,
4348
+ byValues: newByValues
4349
+ };
4350
+ }
4351
+ default:
4352
+ {
4353
+ let newBase;
4354
+ if (!firstEntry.byProperty) return {
4355
+ base: mergeSingleValue(firstEntry.base, secondEntry.base, internalCaching),
4356
+ byProperty: secondEntry.byProperty,
4357
+ byValues: secondEntry.byValues
4358
+ };
4359
+ let intermediateByValues = new Map(firstEntry.byValues);
4360
+ for (let [key, value] of intermediateByValues)intermediateByValues.set(key, mergeSingleValue(value, secondEntry.base, internalCaching));
4361
+ if (Array.from(firstEntry.byValues.values()).every((value)=>{
4362
+ let type = getValueType(value);
4363
+ return 1 === type || 4 === type;
4364
+ }) ? newBase = mergeSingleValue(firstEntry.base, secondEntry.base, internalCaching) : (newBase = firstEntry.base, intermediateByValues.has('default') || intermediateByValues.set('default', secondEntry.base)), !secondEntry.byProperty) return {
4365
+ base: newBase,
4366
+ byProperty: firstEntry.byProperty,
4367
+ byValues: intermediateByValues
4368
+ };
4369
+ if (firstEntry.byProperty !== secondEntry.byProperty) throw Error(`${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`);
4370
+ let newByValues = new Map(intermediateByValues);
4371
+ for (let [key, value] of secondEntry.byValues){
4372
+ let firstValue = getFromByValues(intermediateByValues, key);
4373
+ newByValues.set(key, mergeSingleValue(firstValue, value, internalCaching));
4374
+ }
4375
+ return {
4376
+ base: newBase,
4377
+ byProperty: firstEntry.byProperty,
4378
+ byValues: newByValues
4379
+ };
4380
+ }
4381
+ }
4382
+ }, getFromByValues = (byValues, key)=>'default' !== key && byValues.has(key) ? byValues.get(key) : byValues.get('default'), mergeSingleValue = (a, b, internalCaching)=>{
4383
+ let bType = getValueType(b), aType = getValueType(a);
4384
+ switch(bType){
4385
+ case 4:
4386
+ case 1:
4387
+ return b;
4388
+ case 3:
4389
+ return 3 !== aType ? b : internalCaching ? cachedCleverMerge(a, b) : cleverMerge(a, b);
4390
+ case 0:
4391
+ return a;
4392
+ case 2:
4393
+ switch(1 !== aType ? aType : Array.isArray(a) ? 2 : 3){
4394
+ case 0:
4395
+ return b;
4396
+ case 4:
4397
+ return b.filter((item)=>'...' !== item);
4398
+ case 2:
4399
+ {
4400
+ let newArray = [];
4401
+ for (let item of b)if ('...' === item) for (let item of a)newArray.push(item);
4402
+ else newArray.push(item);
4403
+ return newArray;
4404
+ }
4405
+ case 3:
4406
+ return b.map((item)=>'...' === item ? a : item);
4407
+ default:
4408
+ throw Error('Not implemented');
4409
+ }
4410
+ default:
4411
+ throw Error('Not implemented');
4412
+ }
4413
+ }, resolveLayerExternals = (item, layer)=>{
4414
+ if ('object' != typeof item || null === item || !('byLayer' in item)) return item;
4415
+ let { byLayer, ...remaining } = item;
4416
+ if (void 0 === byLayer) return remaining;
4417
+ if ('object' == typeof byLayer) {
4418
+ let key = String(layer);
4419
+ return Object.hasOwn(byLayer, key) ? mergeExternalObjects(remaining, byLayer[key]) : Object.hasOwn(byLayer, 'default') ? mergeExternalObjects(remaining, byLayer.default) : remaining;
4420
+ }
4421
+ return 'function' == typeof byLayer ? mergeExternalObjects(remaining, resolveLayerExternals(byLayer(layer), layer)) : item;
4422
+ };
4423
+ function mergeExternalObjects(base, overrides) {
4424
+ return 'object' != typeof overrides || null === overrides || overrides instanceof RegExp ? void 0 === overrides ? base : overrides : {
4425
+ ...base,
4426
+ ...Object.fromEntries(Object.entries(overrides).map(([request, value])=>[
4427
+ request,
4428
+ cachedCleverMerge({
4429
+ value: Object.hasOwn(base, request) ? base[request] : void 0
4430
+ }, {
4431
+ value
4432
+ }).value
4433
+ ]))
4434
+ };
4435
+ }
4126
4436
  class ExternalsPlugin extends RspackBuiltinPlugin {
4127
4437
  type;
4128
4438
  externals;
@@ -4201,18 +4511,47 @@ class ExternalsPlugin extends RspackBuiltinPlugin {
4201
4511
  });
4202
4512
  });
4203
4513
  }
4204
- if ('object' == typeof item) return Object.fromEntries(Object.entries(item).map(([k, v])=>[
4205
- k,
4206
- getRawExternalItemValue(v)
4207
- ]));
4514
+ if ('object' == typeof item) {
4515
+ let { byLayer } = item;
4516
+ if ('function' == typeof byLayer || byLayer && 'object' == typeof byLayer && Object.values(byLayer).some((branch)=>'object' != typeof branch || branch instanceof RegExp)) {
4517
+ let cache = new Map();
4518
+ return async (ctx)=>{
4519
+ let result, { request, contextInfo } = ctx.data(), layer = contextInfo.issuerLayer ?? null, raw = cache.get(layer);
4520
+ if (void 0 === raw && (raw = this.#getRawExternalItem(resolveLayerExternals(item, layer)), cache.set(layer, raw)), 'function' == typeof raw) return await raw(ctx);
4521
+ if ('string' == typeof raw) raw === request && (result = request);
4522
+ else if (raw instanceof RegExp) raw.lastIndex = 0, raw.test(request) && (result = request), raw.lastIndex = 0;
4523
+ else {
4524
+ let values = raw.byLayer?.[layer ?? 'null'] ?? raw.values;
4525
+ Object.hasOwn(values, request) && (result = values[request]);
4526
+ }
4527
+ return {
4528
+ result,
4529
+ externalType: void 0
4530
+ };
4531
+ };
4532
+ }
4533
+ return {
4534
+ values: getRawExternalObject(resolveLayerExternals(item, 'default')),
4535
+ byLayer: byLayer && Object.fromEntries(Object.keys(byLayer).map((layer)=>[
4536
+ layer,
4537
+ getRawExternalObject(resolveLayerExternals(item, layer))
4538
+ ]))
4539
+ };
4540
+ }
4208
4541
  throw TypeError(`Unexpected type of external item: ${typeof item}`);
4209
4542
  };
4210
4543
  }
4544
+ function getRawExternalObject(item) {
4545
+ return Object.fromEntries(Object.entries(item).map(([key, value])=>[
4546
+ key,
4547
+ getRawExternalItemValue(value)
4548
+ ]));
4549
+ }
4211
4550
  function getRawExternalItemValueFormFnResult(result) {
4212
4551
  return void 0 === result ? result : getRawExternalItemValue(result);
4213
4552
  }
4214
4553
  function getRawExternalItemValue(value) {
4215
- 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])=>[
4216
4555
  k,
4217
4556
  Array.isArray(v) ? v : [
4218
4557
  v
@@ -4250,19 +4589,22 @@ let HttpExternalsRspackPlugin = base_create(binding_.BuiltinPluginName.HttpExter
4250
4589
  return (...args)=>(cache || (cache = fn()), cache(...args));
4251
4590
  }, getHttp = memoize(()=>rspackRequire("node:http")), getHttps = memoize(()=>rspackRequire("node:https")), defaultHttpClientForNode = async (url, headers)=>{
4252
4591
  let { res, body } = await function(url, options) {
4253
- 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");
4254
4593
  return new Promise((resolve, reject)=>{
4255
4594
  send.get(url, options, (res)=>{
4256
- let contentEncoding = res.headers['content-encoding'], stream = res;
4257
- '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());
4258
4599
  let chunks = [];
4259
- stream.on('data', (chunk)=>{
4260
- chunks.push(chunk);
4261
- }), stream.on('end', ()=>{
4262
- let bodyBuffer = Buffer.concat(chunks);
4263
- 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({
4264
4606
  res,
4265
- body: bodyBuffer
4607
+ body: Buffer.concat(chunks)
4266
4608
  }) : reject(Error(`${url} request was terminated early`));
4267
4609
  });
4268
4610
  }).on('error', reject);
@@ -4443,7 +4785,7 @@ HtmlRspackPlugin.createHtmlTagObject = (tagName, attributes, innerHTML)=>({
4443
4785
  ])
4444
4786
  }, hooks_compilationHooksMap.set(compilation, hooks)), hooks;
4445
4787
  }, HtmlRspackPlugin.version = 5;
4446
- let IgnorePlugin = base_create(binding_.BuiltinPluginName.IgnorePlugin, (options)=>options), InferAsyncModulesPlugin = base_create(binding_.BuiltinPluginName.InferAsyncModulesPlugin, ()=>{}, 'compilation'), InlineExportsPlugin = base_create(binding_.BuiltinPluginName.InlineExportsPlugin, ()=>{}, 'compilation'), JavascriptModulesPlugin_compilationHooksMap = new WeakMap();
4788
+ let IgnorePlugin = base_create(binding_.BuiltinPluginName.IgnorePlugin, (options)=>options), InferAsyncModulesPlugin = base_create(binding_.BuiltinPluginName.InferAsyncModulesPlugin, ()=>{}, 'compilation'), ImportedByDeferModulesPlugin = base_create(binding_.BuiltinPluginName.ImportedByDeferModulesPlugin, ()=>{}, 'compilation'), InlineExportsPlugin = base_create(binding_.BuiltinPluginName.InlineExportsPlugin, ()=>{}, 'compilation'), JavascriptModulesPlugin_compilationHooksMap = new WeakMap();
4447
4789
  class JavascriptModulesPlugin extends RspackBuiltinPlugin {
4448
4790
  name = binding_.BuiltinPluginName.JavascriptModulesPlugin;
4449
4791
  affectedHooks = 'compilation';
@@ -4482,15 +4824,15 @@ Object.defineProperty(binding__default().KnownBuildInfo.prototype, node_util.ins
4482
4824
  enumerable: !0,
4483
4825
  configurable: !0,
4484
4826
  get () {
4485
- if (this[binding__default().BUILD_INFO_ASSETS_SYMBOL][$assets]) return this[binding__default().BUILD_INFO_ASSETS_SYMBOL][$assets];
4827
+ if (this[BUILD_INFO_ASSETS_SYMBOL][$assets]) return this[BUILD_INFO_ASSETS_SYMBOL][$assets];
4486
4828
  let assets = new Proxy(Object.create(null), {
4487
- ownKeys: ()=>this[binding__default().BUILD_INFO_ASSETS_SYMBOL].keys(),
4829
+ ownKeys: ()=>this[BUILD_INFO_ASSETS_SYMBOL].keys(),
4488
4830
  getOwnPropertyDescriptor: ()=>({
4489
4831
  enumerable: !0,
4490
4832
  configurable: !0
4491
4833
  })
4492
4834
  });
4493
- return Object.defineProperty(this[binding__default().BUILD_INFO_ASSETS_SYMBOL], $assets, {
4835
+ return Object.defineProperty(this[BUILD_INFO_ASSETS_SYMBOL], $assets, {
4494
4836
  enumerable: !1,
4495
4837
  configurable: !0,
4496
4838
  value: assets
@@ -4500,25 +4842,25 @@ Object.defineProperty(binding__default().KnownBuildInfo.prototype, node_util.ins
4500
4842
  enumerable: !0,
4501
4843
  configurable: !0,
4502
4844
  get () {
4503
- return new Set(this[binding__default().BUILD_INFO_FILE_DEPENDENCIES_SYMBOL]);
4845
+ return new Set(this[BUILD_INFO_FILE_DEPENDENCIES_SYMBOL]);
4504
4846
  }
4505
4847
  }), Object.defineProperty(binding__default().KnownBuildInfo.prototype, 'contextDependencies', {
4506
4848
  enumerable: !0,
4507
4849
  configurable: !0,
4508
4850
  get () {
4509
- return new Set(this[binding__default().BUILD_INFO_CONTEXT_DEPENDENCIES_SYMBOL]);
4851
+ return new Set(this[BUILD_INFO_CONTEXT_DEPENDENCIES_SYMBOL]);
4510
4852
  }
4511
4853
  }), Object.defineProperty(binding__default().KnownBuildInfo.prototype, 'missingDependencies', {
4512
4854
  enumerable: !0,
4513
4855
  configurable: !0,
4514
4856
  get () {
4515
- return new Set(this[binding__default().BUILD_INFO_MISSING_DEPENDENCIES_SYMBOL]);
4857
+ return new Set(this[BUILD_INFO_MISSING_DEPENDENCIES_SYMBOL]);
4516
4858
  }
4517
4859
  }), Object.defineProperty(binding__default().KnownBuildInfo.prototype, 'buildDependencies', {
4518
4860
  enumerable: !0,
4519
4861
  configurable: !0,
4520
4862
  get () {
4521
- return new Set(this[binding__default().BUILD_INFO_BUILD_DEPENDENCIES_SYMBOL]);
4863
+ return new Set(this[BUILD_INFO_BUILD_DEPENDENCIES_SYMBOL]);
4522
4864
  }
4523
4865
  });
4524
4866
  let knownBuildInfoFields = new Set([
@@ -4533,30 +4875,285 @@ let knownBuildInfoFields = new Set([
4533
4875
  for (let key of Object.keys(buildInfo))knownBuildInfoFields.has(key) || (custom[key] = buildInfo[key]);
4534
4876
  return custom;
4535
4877
  };
4536
- Object.defineProperty(binding__default().NormalModule.prototype, 'identifier', {
4537
- enumerable: !0,
4538
- configurable: !0,
4539
- value () {
4540
- return this[binding__default().MODULE_IDENTIFIER_SYMBOL];
4878
+ class ContextModuleFactoryBeforeResolveData {
4879
+ #inner;
4880
+ static __from_binding(binding) {
4881
+ return new ContextModuleFactoryBeforeResolveData(binding);
4541
4882
  }
4542
- }), Object.defineProperty(binding__default().NormalModule.prototype, 'originalSource', {
4543
- enumerable: !0,
4544
- configurable: !0,
4545
- value () {
4546
- let originalSource = this._originalSource();
4547
- return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
4883
+ static __to_binding(data) {
4884
+ return data.#inner;
4548
4885
  }
4549
- }), Object.defineProperty(binding__default().NormalModule.prototype, 'emitFile', {
4550
- enumerable: !0,
4551
- configurable: !0,
4552
- value (filename, source, assetInfo) {
4553
- return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
4886
+ constructor(binding){
4887
+ this.#inner = binding, Object.defineProperties(this, {
4888
+ context: {
4889
+ enumerable: !0,
4890
+ get: ()=>binding.context,
4891
+ set (val) {
4892
+ binding.context = val;
4893
+ }
4894
+ },
4895
+ request: {
4896
+ enumerable: !0,
4897
+ get: ()=>binding.request,
4898
+ set (val) {
4899
+ binding.request = val;
4900
+ }
4901
+ },
4902
+ regExp: {
4903
+ enumerable: !0,
4904
+ get: ()=>binding.regExp,
4905
+ set (val) {
4906
+ binding.regExp = val;
4907
+ }
4908
+ },
4909
+ recursive: {
4910
+ enumerable: !0,
4911
+ get: ()=>binding.recursive,
4912
+ set (val) {
4913
+ binding.recursive = val;
4914
+ }
4915
+ }
4916
+ });
4554
4917
  }
4555
- }), Object.defineProperty(binding__default().NormalModule, 'getCompilationHooks', {
4556
- enumerable: !0,
4557
- configurable: !0,
4558
- value (compilation) {
4559
- if (!(binding__default().COMPILATION_HOOKS_MAP_SYMBOL in compilation)) throw TypeError("The 'compilation' argument must be an instance of Compilation");
4918
+ }
4919
+ class ContextModuleFactoryAfterResolveData {
4920
+ #inner;
4921
+ static __from_binding(binding) {
4922
+ return new ContextModuleFactoryAfterResolveData(binding);
4923
+ }
4924
+ static __to_binding(data) {
4925
+ return data.#inner;
4926
+ }
4927
+ constructor(binding){
4928
+ this.#inner = binding, Object.defineProperties(this, {
4929
+ resource: {
4930
+ enumerable: !0,
4931
+ get: ()=>binding.resource,
4932
+ set (val) {
4933
+ binding.resource = val;
4934
+ }
4935
+ },
4936
+ context: {
4937
+ enumerable: !0,
4938
+ get: ()=>binding.context,
4939
+ set (val) {
4940
+ binding.context = val;
4941
+ }
4942
+ },
4943
+ request: {
4944
+ enumerable: !0,
4945
+ get: ()=>binding.request,
4946
+ set (val) {
4947
+ binding.request = val;
4948
+ }
4949
+ },
4950
+ regExp: {
4951
+ enumerable: !0,
4952
+ get: ()=>binding.regExp,
4953
+ set (val) {
4954
+ binding.regExp = val;
4955
+ }
4956
+ },
4957
+ recursive: {
4958
+ enumerable: !0,
4959
+ get: ()=>binding.recursive,
4960
+ set (val) {
4961
+ binding.recursive = val;
4962
+ }
4963
+ },
4964
+ dependencies: {
4965
+ enumerable: !0,
4966
+ get: ()=>binding.dependencies
4967
+ }
4968
+ });
4969
+ }
4970
+ }
4971
+ let Module_Module = class Module {
4972
+ static #properties = {
4973
+ type: {
4974
+ enumerable: !0,
4975
+ configurable: !0,
4976
+ get () {
4977
+ return null === this.#type && (this.#type = binding__default().moduleGetType(this)), this.#type;
4978
+ },
4979
+ set (value) {
4980
+ this.#type = value;
4981
+ }
4982
+ },
4983
+ context: {
4984
+ enumerable: !0,
4985
+ configurable: !0,
4986
+ get () {
4987
+ return binding__default().moduleGetContext(this);
4988
+ }
4989
+ },
4990
+ layer: {
4991
+ enumerable: !0,
4992
+ configurable: !0,
4993
+ get () {
4994
+ return binding__default().moduleGetLayer(this);
4995
+ }
4996
+ },
4997
+ useSourceMap: {
4998
+ enumerable: !0,
4999
+ configurable: !0,
5000
+ get () {
5001
+ return binding__default().moduleGetUseSourceMap(this);
5002
+ }
5003
+ },
5004
+ useSimpleSourceMap: {
5005
+ enumerable: !0,
5006
+ configurable: !0,
5007
+ get () {
5008
+ return binding__default().moduleGetUseSimpleSourceMap(this);
5009
+ }
5010
+ },
5011
+ factoryMeta: {
5012
+ enumerable: !0,
5013
+ configurable: !0,
5014
+ get () {
5015
+ return binding__default().moduleGetFactoryMeta(this);
5016
+ },
5017
+ set (value) {
5018
+ binding__default().moduleSetFactoryMeta(this, value);
5019
+ }
5020
+ },
5021
+ buildInfo: {
5022
+ enumerable: !0,
5023
+ configurable: !0,
5024
+ get () {
5025
+ return binding__default().moduleGetBuildInfo(this);
5026
+ },
5027
+ set (value) {
5028
+ binding__default().moduleSetBuildInfo(this, value);
5029
+ }
5030
+ }
5031
+ };
5032
+ #identifier;
5033
+ #type = null;
5034
+ constructor(){
5035
+ Object.defineProperties(this, Module.#properties), this.buildMeta = {};
5036
+ }
5037
+ identifier() {
5038
+ return this.#identifier ??= binding__default().moduleGetIdentifier(this);
5039
+ }
5040
+ get blocks() {
5041
+ return binding__default().moduleGetBlocks(this);
5042
+ }
5043
+ get dependencies() {
5044
+ return binding__default().moduleGetDependencies(this);
5045
+ }
5046
+ readableIdentifier() {
5047
+ return binding__default().moduleGetReadableIdentifier(this);
5048
+ }
5049
+ originalSource() {
5050
+ let source = binding__default().moduleGetOriginalSource(this);
5051
+ return source ? SourceAdapter.fromBinding(source) : null;
5052
+ }
5053
+ nameForCondition() {
5054
+ return binding__default().moduleGetNameForCondition(this);
5055
+ }
5056
+ size(ty) {
5057
+ return binding__default().moduleSize(this, ty);
5058
+ }
5059
+ libIdent(options) {
5060
+ return binding__default().moduleLibIdent(this, options);
5061
+ }
5062
+ emitFile(filename, source, assetInfo) {
5063
+ binding__default().moduleEmitFile(this, filename, SourceAdapter.toBinding(source), assetInfo);
5064
+ }
5065
+ };
5066
+ class NormalModule extends Module_Module {
5067
+ #resource = null;
5068
+ #request = null;
5069
+ #userRequest = null;
5070
+ #rawRequest = null;
5071
+ #resourceResolveData = null;
5072
+ #loaders = null;
5073
+ static #properties = {
5074
+ resource: {
5075
+ enumerable: !0,
5076
+ configurable: !0,
5077
+ get () {
5078
+ return null === this.#resource && (this.#resource = binding__default().normalModuleGetResource(this)), this.#resource;
5079
+ },
5080
+ set (value) {
5081
+ this.#resource = value;
5082
+ }
5083
+ },
5084
+ request: {
5085
+ enumerable: !0,
5086
+ configurable: !0,
5087
+ get () {
5088
+ return null === this.#request && (this.#request = binding__default().normalModuleGetRequest(this)), this.#request;
5089
+ },
5090
+ set (value) {
5091
+ this.#request = value;
5092
+ }
5093
+ },
5094
+ userRequest: {
5095
+ enumerable: !0,
5096
+ configurable: !0,
5097
+ get () {
5098
+ return null === this.#userRequest && (this.#userRequest = binding__default().normalModuleGetUserRequest(this)), this.#userRequest;
5099
+ },
5100
+ set (value) {
5101
+ this.#userRequest = value;
5102
+ }
5103
+ },
5104
+ rawRequest: {
5105
+ enumerable: !0,
5106
+ configurable: !0,
5107
+ get () {
5108
+ return null === this.#rawRequest && (this.#rawRequest = binding__default().normalModuleGetRawRequest(this)), this.#rawRequest;
5109
+ },
5110
+ set (value) {
5111
+ this.#rawRequest = value;
5112
+ }
5113
+ },
5114
+ resourceResolveData: {
5115
+ enumerable: !0,
5116
+ configurable: !0,
5117
+ get () {
5118
+ return null === this.#resourceResolveData && (this.#resourceResolveData = binding__default().normalModuleGetResourceResolveData(this)), this.#resourceResolveData;
5119
+ },
5120
+ set (value) {
5121
+ this.#resourceResolveData = value;
5122
+ }
5123
+ },
5124
+ loaders: {
5125
+ enumerable: !0,
5126
+ configurable: !0,
5127
+ get () {
5128
+ return null === this.#loaders && (this.#loaders = binding__default().normalModuleGetLoaders(this)), this.#loaders;
5129
+ },
5130
+ set (value) {
5131
+ this.#loaders = value;
5132
+ }
5133
+ },
5134
+ matchResource: {
5135
+ enumerable: !0,
5136
+ configurable: !0,
5137
+ get () {
5138
+ return binding__default().normalModuleGetMatchResource(this);
5139
+ },
5140
+ set (value) {
5141
+ binding__default().normalModuleSetMatchResource(this, value);
5142
+ }
5143
+ },
5144
+ error: {
5145
+ enumerable: !0,
5146
+ configurable: !0,
5147
+ get () {
5148
+ return binding__default().normalModuleGetError(this);
5149
+ }
5150
+ }
5151
+ };
5152
+ constructor(){
5153
+ super(), Object.defineProperties(this, NormalModule.#properties);
5154
+ }
5155
+ static getCompilationHooks(compilation) {
5156
+ if (!(COMPILATION_HOOKS_MAP_SYMBOL in compilation)) throw TypeError("The 'compilation' argument must be an instance of Compilation");
4560
5157
  return getOrCreateCompilationHooks(compilation, compilation, ()=>({
4561
5158
  loader: new SyncHook([
4562
5159
  'loaderContext',
@@ -4567,7 +5164,7 @@ Object.defineProperty(binding__default().NormalModule.prototype, 'identifier', {
4567
5164
  ]))
4568
5165
  }));
4569
5166
  }
4570
- });
5167
+ }
4571
5168
  class NonErrorEmittedError extends Error {
4572
5169
  constructor(error){
4573
5170
  super(), this.name = 'NonErrorEmittedError', this.message = `(Emitted value instead of an instance of Error) ${error}`;
@@ -4864,9 +5461,9 @@ let createHash_createHash = (algorithm)=>{
4864
5461
  let message = `Module ${type}${from ? ` (from ${from}):\n` : ': '}`;
4865
5462
  return err && 'object' == typeof err && err.message ? message += err.message : err && (message += err), message;
4866
5463
  }, getErrorDetails = (err)=>{
4867
- var stack, name, message, stack1, name1, message1;
4868
- let details, nextLine;
4869
- 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;
4870
5467
  };
4871
5468
  class ModuleError extends lib_WebpackError {
4872
5469
  error;
@@ -4880,47 +5477,9 @@ class ModuleWarning extends lib_WebpackError {
4880
5477
  super(ModuleError_createMessage(err, 'Warning', from)), this.name = 'ModuleWarning', this.error = err, this.details = getErrorDetails(err);
4881
5478
  }
4882
5479
  }
4883
- class LoaderCache {
4884
- #api;
4885
- #context;
4886
- #dependencies;
4887
- constructor(context, dependencies){
4888
- this.#context = context, this.#api = context.__internal__loaderCache, this.#dependencies = dependencies;
4889
- }
4890
- async get(loaderIndex, content, additionalData) {
4891
- let context = this.#context, loader = context.loaderItems[loaderIndex];
4892
- if (!context.cacheable || !loader || isNil(content) || !isNil(additionalData) || Object.keys(context.__internal__parseMeta).length > 0 || this.#dependencies.contextDependencies().length > 0 || this.#dependencies.missingDependencies().length > 0) return;
4893
- let hit = await this.#api.get(loaderIndex, content, this.#dependencies.existing);
4894
- return hit && (this.#dependencies.addDependencies(hit.addedDependencies), Object.assign(context.__internal__parseMeta, hit.parseMeta)), hit;
4895
- }
4896
- async store(loaderIndex, content, sourceMap, additionalData) {
4897
- let context = this.#context;
4898
- context.cacheable && isNil(additionalData) && await this.#api.store(loaderIndex, {
4899
- content: isNil(content) ? null : content,
4900
- sourceMap,
4901
- addedDependencies: this.#dependencies.added,
4902
- removedDependencies: this.#dependencies.removed,
4903
- parseMeta: {
4904
- ...context.__internal__parseMeta
4905
- }
4906
- });
4907
- }
4908
- async workerGet(loaderIndex, content, additionalData) {
4909
- let hit = await this.get(loaderIndex, content, additionalData);
4910
- return void 0 === hit ? {
4911
- type: 'disabled'
4912
- } : null === hit ? {
4913
- type: 'miss'
4914
- } : {
4915
- type: 'hit',
4916
- entry: hit
4917
- };
4918
- }
4919
- async workerStore(loaderIndex, content, sourceMap, additionalData) {
4920
- await this.store(loaderIndex, content, sourceMap, additionalData);
4921
- }
4922
- }
4923
- let DEPENDENCY_KEYS = [
5480
+ let codeFilter_decoder = new TextDecoder('utf-8', {
5481
+ fatal: !0
5482
+ }), DEPENDENCY_KEYS = [
4924
5483
  'fileDependencies',
4925
5484
  'contextDependencies',
4926
5485
  'missingDependencies',
@@ -4930,6 +5489,11 @@ let DEPENDENCY_KEYS = [
4930
5489
  contextDependencies: new Set(),
4931
5490
  missingDependencies: new Set(),
4932
5491
  buildDependencies: new Set()
5492
+ }), setsFrom = (dependencies)=>({
5493
+ fileDependencies: new Set(dependencies.fileDependencies),
5494
+ contextDependencies: new Set(dependencies.contextDependencies),
5495
+ missingDependencies: new Set(dependencies.missingDependencies),
5496
+ buildDependencies: new Set(dependencies.buildDependencies)
4933
5497
  }), arraysFrom = (sets)=>({
4934
5498
  fileDependencies: Array.from(sets.fileDependencies),
4935
5499
  contextDependencies: Array.from(sets.contextDependencies),
@@ -4938,16 +5502,14 @@ let DEPENDENCY_KEYS = [
4938
5502
  });
4939
5503
  class LoaderDependenciesState {
4940
5504
  existing;
4941
- #existingSets;
4942
- #addedSets = createSets();
4943
- #removedSets = createSets();
4944
- constructor(existing){
4945
- this.existing = existing, this.#existingSets = {
4946
- fileDependencies: new Set(existing.fileDependencies),
4947
- contextDependencies: new Set(existing.contextDependencies),
4948
- missingDependencies: new Set(existing.missingDependencies),
4949
- buildDependencies: new Set(existing.buildDependencies)
4950
- };
5505
+ #existingSets = {};
5506
+ #addedSets;
5507
+ #removedSets;
5508
+ constructor(existing, added, removed){
5509
+ this.existing = existing, this.#addedSets = added ? setsFrom(added) : createSets(), this.#removedSets = removed ? setsFrom(removed) : createSets();
5510
+ }
5511
+ #getExisting(key) {
5512
+ return this.#existingSets[key] ??= new Set(this.existing[key]);
4951
5513
  }
4952
5514
  get added() {
4953
5515
  return arraysFrom(this.#addedSets);
@@ -4962,13 +5524,12 @@ class LoaderDependenciesState {
4962
5524
  for (let key of DEPENDENCY_KEYS){
4963
5525
  let added = this.#addedSets[key], removed = this.#removedSets[key];
4964
5526
  if (0 === added.size && 0 === removed.size) continue;
4965
- let existing = this.#existingSets[key];
5527
+ let existing = this.#getExisting(key);
4966
5528
  for (let dependency of removed)existing.delete(dependency);
4967
5529
  for (let dependency of added)existing.add(dependency);
4968
5530
  let target = this.existing[key];
4969
5531
  for (let dependency of (target.length = 0, existing))target.push(dependency);
4970
5532
  }
4971
- this.resetChanges();
4972
5533
  }
4973
5534
  addDependencies(dependencies) {
4974
5535
  for (let key of DEPENDENCY_KEYS)for (let dependency of dependencies[key])this.add(key, dependency);
@@ -4998,30 +5559,20 @@ class LoaderDependenciesState {
4998
5559
  this.clear('fileDependencies'), this.clear('contextDependencies'), this.clear('missingDependencies');
4999
5560
  }
5000
5561
  add(key, dependency) {
5001
- this.#removedSets[key].delete(dependency), this.#addedSets[key].add(dependency);
5562
+ this.#addedSets[key].add(dependency);
5002
5563
  }
5003
5564
  get(key) {
5004
5565
  let removed = this.#removedSets[key], dependencies = new Set();
5005
- for (let dependency of this.#existingSets[key])removed.has(dependency) || dependencies.add(dependency);
5566
+ for (let dependency of this.#getExisting(key))removed.has(dependency) || dependencies.add(dependency);
5006
5567
  for (let dependency of this.#addedSets[key])dependencies.add(dependency);
5007
5568
  return Array.from(dependencies);
5008
5569
  }
5009
5570
  clear(key) {
5010
5571
  let removed = this.#removedSets[key];
5011
- for (let dependency of (removed.clear(), this.#existingSets[key]))removed.add(dependency);
5572
+ for (let dependency of this.#getExisting(key))removed.add(dependency);
5012
5573
  this.#addedSets[key].clear();
5013
5574
  }
5014
5575
  }
5015
- let ensureLoaderWorkerPool = async (workerOptions)=>service_pool || (service_pool = import("../compiled/tinypool/dist/index.js").then(({ Tinypool })=>{
5016
- let availableThreads = Math.max(__rspack_createRequire_require("node:os").cpus().length - 1, 1), maxWorkers = workerOptions?.maxWorkers ? Math.max(workerOptions.maxWorkers, 1) : void 0, maxWorkersFromEnv = parseInt(process.env.RSPACK_LOADER_WORKER_THREADS || '', 10);
5017
- return new Tinypool({
5018
- filename: node_path.resolve(import.meta.dirname, 'worker.js'),
5019
- useAtomics: !1,
5020
- maxThreads: maxWorkers || maxWorkersFromEnv || availableThreads,
5021
- minThreads: maxWorkers || maxWorkersFromEnv || availableThreads,
5022
- concurrentTasksPerWorker: 1
5023
- });
5024
- }));
5025
5576
  function serializeAggregateErrorMember(value) {
5026
5577
  return value instanceof Error ? {
5027
5578
  __internal__type: 'error',
@@ -5063,95 +5614,7 @@ function deserializeError(error) {
5063
5614
  let { __internal__isAggregateError, errors, ...properties } = error, shouldDeserializeAsAggregate = !0 === __internal__isAggregateError && Array.isArray(errors), deserializedError = shouldDeserializeAsAggregate ? AggregateError(errors.map(deserializeAggregateErrorMember), error.message) : Error(error.message);
5064
5615
  return Object.assign(deserializedError, properties), shouldDeserializeAsAggregate || void 0 === errors || (deserializedError.errors = errors), deserializedError;
5065
5616
  }
5066
- let service_run = async (loaderName, task, options, workerOptions)=>ensureLoaderWorkerPool(workerOptions).then((pool)=>{
5067
- let { port1: mainPort, port2: workerPort } = new MessageChannel(), { port1: mainSyncPort, port2: workerSyncPort } = new MessageChannel();
5068
- return new Promise((resolve, reject)=>{
5069
- let handleError = (error)=>{
5070
- mainPort.close(), mainSyncPort.close(), reject(error);
5071
- }, pendingRequests = new Map();
5072
- async function handleSyncRequest(message) {
5073
- let result, { sharedBuffer } = message, sharedBufferView = new Int32Array(sharedBuffer);
5074
- try {
5075
- if ("WaitForPendingRequest" === message.requestType) {
5076
- let pendingRequestId = message.data[0], isArray = Array.isArray(pendingRequestId), ids = isArray ? pendingRequestId : [
5077
- pendingRequestId
5078
- ];
5079
- result = await Promise.all(ids.map((id)=>{
5080
- let pendingRequest = pendingRequests.get(id);
5081
- if (!pendingRequest) throw Error(`Unknown pending request: ${id}`);
5082
- return pendingRequest;
5083
- })), isArray || (result = result[0]);
5084
- } else throw Error(`Unknown request type: ${message.requestType}`);
5085
- mainSyncPort.postMessage({
5086
- type: 'response',
5087
- id: message.id,
5088
- data: result
5089
- });
5090
- } catch (e) {
5091
- mainSyncPort.postMessage({
5092
- type: 'response-error',
5093
- id: message.id,
5094
- error: serializeError(e)
5095
- });
5096
- }
5097
- Atomics.add(sharedBufferView, 0, 1), Atomics.notify(sharedBufferView, 0, 1 / 0);
5098
- }
5099
- mainPort.on('message', (message)=>{
5100
- 'done' === message.type ? Promise.allSettled(pendingRequests.values()).then(()=>{
5101
- mainPort.close(), mainSyncPort.close(), resolve(message.data);
5102
- }) : 'done-error' === message.type ? Promise.allSettled(pendingRequests.values()).then(()=>{
5103
- mainPort.close(), mainSyncPort.close(), reject(deserializeError(message.error));
5104
- }) : 'request' === message.type ? pendingRequests.set(message.id, Promise.resolve().then(()=>options.handleIncomingRequest(message.requestType, ...message.data)).then((result)=>(mainPort.postMessage({
5105
- type: 'response',
5106
- id: message.id,
5107
- data: result
5108
- }), result)).catch((error)=>{
5109
- mainPort.postMessage({
5110
- type: 'response-error',
5111
- id: message.id,
5112
- error: serializeError(error)
5113
- });
5114
- })) : 'request-sync' === message.type && handleSyncRequest(message);
5115
- }), mainPort.on('messageerror', handleError);
5116
- let found = [];
5117
- for (let key of Object.keys(task)){
5118
- let uncloneable = function findUncloneablePath(value, path, depth) {
5119
- try {
5120
- structuredClone(value);
5121
- return;
5122
- } catch (e) {
5123
- if (depth > 0 && 'object' == typeof value && null !== value) for (let key of Object.keys(value)){
5124
- let deeper = findUncloneablePath(value[key], `${path}.${key}`, depth - 1);
5125
- if (deeper) return deeper;
5126
- }
5127
- return {
5128
- path,
5129
- reason: e.message
5130
- };
5131
- }
5132
- }(task[key], key, 6);
5133
- uncloneable && found.push(uncloneable);
5134
- }
5135
- if (found.length > 0) {
5136
- 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');
5137
- 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\`.`);
5138
- }
5139
- pool.run({
5140
- ...task,
5141
- workerData: {
5142
- workerPort,
5143
- workerSyncPort
5144
- }
5145
- }, {
5146
- ...options,
5147
- transferList: [
5148
- ...options?.transferList || [],
5149
- workerPort,
5150
- workerSyncPort
5151
- ]
5152
- }).catch(handleError);
5153
- });
5154
- }), LoaderLoadingError = class extends Error {
5617
+ let LoaderLoadingError = class extends Error {
5155
5618
  constructor(message){
5156
5619
  super(message), this.name = 'LoaderRunnerError', Error.captureStackTrace(this, this.constructor);
5157
5620
  }
@@ -5189,7 +5652,11 @@ function loadLoader(loader, compiler, callback) {
5189
5652
  function handleResult(loader, module, callback) {
5190
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();
5191
5654
  }
5192
- 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) {
5193
5660
  let isSync = !0, isDone = !1, isError = !1, reportedError = !1;
5194
5661
  context.async = function() {
5195
5662
  if (isDone) {
@@ -5212,7 +5679,7 @@ let utils_decoder = new TextDecoder(), utils_loadLoader = promisify(loadLoader),
5212
5679
  };
5213
5680
  context.callback = innerCallback;
5214
5681
  try {
5215
- let result = fn.apply(context, args);
5682
+ let result = LOADER_EXECUTION(fn, context, args);
5216
5683
  if (isSync) {
5217
5684
  if (isDone = !0, void 0 === result) return void callback(null, []);
5218
5685
  if (result && 'object' == typeof result && 'function' == typeof result.then) return void result.then((r)=>{
@@ -5230,7 +5697,7 @@ let utils_decoder = new TextDecoder(), utils_loadLoader = promisify(loadLoader),
5230
5697
  if (isDone) return void (e instanceof Error ? console.error(e.stack) : console.error(e));
5231
5698
  isDone = !0, reportedError = !0, callback(e, []);
5232
5699
  }
5233
- }), LOADER_PROCESS_NAME = 'Loader Analysis';
5700
+ }), LOADER_PROCESS_NAME = 'Loader Analysis', IS_WASM = !!process.env.WASM;
5234
5701
  class LoaderObject {
5235
5702
  request;
5236
5703
  path;
@@ -5273,8 +5740,28 @@ class LoaderObject {
5273
5740
  if (!value) throw Error('noPitch should be true');
5274
5741
  this.loaderItem.noPitch = !0;
5275
5742
  }
5276
- shouldYield() {
5277
- return this.request.startsWith(BUILTIN_LOADER_PREFIX);
5743
+ shouldSkipNormal(content, cache) {
5744
+ let codeFilter = this.loaderItem.codeFilter;
5745
+ if (!codeFilter || this.loaderItem.filterMatched) return !1;
5746
+ let matched = function(filter, content, cache) {
5747
+ let code = function(content, cache) {
5748
+ let text;
5749
+ if (cache.initialized && cache.content === content) return cache.text ?? null;
5750
+ if ('string' == typeof content) text = content;
5751
+ else if (content instanceof Uint8Array) try {
5752
+ text = codeFilter_decoder.decode(content);
5753
+ } catch {
5754
+ text = null;
5755
+ }
5756
+ else text = null;
5757
+ return cache.initialized = !0, cache.content = content, cache.text = text, text;
5758
+ }(content, cache);
5759
+ if (null !== code) {
5760
+ let matched;
5761
+ return 'string' == typeof filter ? code.includes(filter) : (filter.lastIndex = 0, matched = filter.test(code), filter.lastIndex = 0, matched);
5762
+ }
5763
+ }(codeFilter, content, cache);
5764
+ return !1 === matched || (matched && (this.loaderItem.filterMatched = !0), !1);
5278
5765
  }
5279
5766
  static __from_binding(loaderItem, compiler) {
5280
5767
  return new this(loaderItem, compiler);
@@ -5304,7 +5791,7 @@ function getCurrentLoader(loaderContext, index = loaderContext.loaderIndex) {
5304
5791
  }
5305
5792
  async function runLoaders(compiler, context) {
5306
5793
  var buildInfo;
5307
- let loaderState = context.loaderState, pitch = loaderState === binding_.JsLoaderState.Pitching, { resource } = context, traceData = JavaScriptTracer.isEnabled() ? {
5794
+ let loaderState = context.loaderState, loaderChainStart = context.loaderChainStart, loaderChainEnd = context.loaderChainEnd, pitch = loaderState === binding_.JsLoaderState.Pitching, { resource } = context, traceData = JavaScriptTracer.isEnabled() ? {
5308
5795
  uuid: JavaScriptTracer.uuid(),
5309
5796
  args: {
5310
5797
  is_pitch: pitch,
@@ -5322,7 +5809,7 @@ async function runLoaders(compiler, context) {
5322
5809
  if ('/' === path) return '/';
5323
5810
  let i = path.lastIndexOf('/'), j = path.lastIndexOf('\\'), i2 = path.indexOf('/'), j2 = path.indexOf('\\'), idx = i > j ? i : j, idx2 = i > j ? i2 : j2;
5324
5811
  return idx < 0 ? path : idx === idx2 ? path.slice(0, idx + 1) : path.slice(0, idx);
5325
- }(resourcePath) : null, dependencies = new LoaderDependenciesState(context.dependencies), loaderCache = context.__internal__loaderCache ? new LoaderCache(context, dependencies) : void 0, loaderContext = {};
5812
+ }(resourcePath) : null, dependencies = new LoaderDependenciesState(context.dependencies, context.addedDependencies, context.removedDependencies), loaderContext = {};
5326
5813
  loaderContext.loaders = context.loaderItems.map((item)=>LoaderObject.__from_binding(item, compiler)), loaderContext.hot = context.hot, loaderContext.context = contextDirectory, loaderContext.resourcePath = resourcePath, loaderContext.resourceQuery = resourceQuery, loaderContext.resourceFragment = resourceFragment, loaderContext.dependency = loaderContext.addDependency = function(file) {
5327
5814
  dependencies.addFile(file);
5328
5815
  }, loaderContext.addContextDependency = function(context) {
@@ -5407,7 +5894,7 @@ async function runLoaders(compiler, context) {
5407
5894
  let entry = loaderContext.loaders[loaderContext.loaderIndex];
5408
5895
  return entry.options && 'object' == typeof entry.options ? entry.options : entry.query;
5409
5896
  }
5410
- }), 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);
5411
5898
  let getResolveContext = ()=>({
5412
5899
  fileDependencies: {
5413
5900
  add: (d)=>{
@@ -5446,7 +5933,7 @@ async function runLoaders(compiler, context) {
5446
5933
  let error = new ModuleError(e, {
5447
5934
  from: stringifyLoaderObject(loaderContext.loaders[loaderContext.loaderIndex])
5448
5935
  });
5449
- error.module = loaderContext._module, compiler._lastCompilation.__internal__pushRspackDiagnostic({
5936
+ (context.__internal__diagnostics ??= []).push({
5450
5937
  error,
5451
5938
  severity: binding_.JsRspackSeverity.Error
5452
5939
  });
@@ -5455,17 +5942,15 @@ async function runLoaders(compiler, context) {
5455
5942
  let warning = new ModuleWarning(e, {
5456
5943
  from: stringifyLoaderObject(loaderContext.loaders[loaderContext.loaderIndex])
5457
5944
  });
5458
- warning.module = loaderContext._module, compiler._lastCompilation.__internal__pushRspackDiagnostic({
5945
+ (context.__internal__diagnostics ??= []).push({
5459
5946
  error: warning,
5460
5947
  severity: binding_.JsRspackSeverity.Warn
5461
5948
  });
5462
5949
  }, loaderContext.emitFile = function(name, content, sourceMap, assetInfo) {
5463
5950
  let source;
5464
- if (sourceMap) {
5465
- var devtool;
5466
- '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)));
5467
- } else source = new index_js_namespaceObject.RawSource(content);
5468
- 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);
5469
5954
  }, loaderContext.fs = compiler.inputFileSystem, loaderContext.experiments = {
5470
5955
  emitDiagnostic: (diagnostic)=>{
5471
5956
  let d = Object.assign({}, diagnostic, {
@@ -5506,9 +5991,9 @@ async function runLoaders(compiler, context) {
5506
5991
  context.__internal__parseMeta[key] = value;
5507
5992
  };
5508
5993
  let compilation = compiler._lastCompilation, step = 0;
5509
- for(; compilation;)if (binding_.NormalModule.getCompilationHooks(compilation).loader.call(loaderContext, loaderContext._module), compilation = compilation.compiler.parentCompilation, ++step > 1000) throw Error('Too many nested child compiler, exceeded max limitation 1000');
5994
+ for(; compilation;)if (NormalModule.getCompilationHooks(compilation).loader.call(loaderContext, loaderContext._module), compilation = compilation.compiler.parentCompilation, ++step > 1000) throw Error('Too many nested child compiler, exceeded max limitation 1000');
5510
5995
  dependencies.mergeChanges();
5511
- let enableParallelism = (currentLoaderObject)=>!(process.env.WASM && currentLoaderObject?.loaderItem.cache) && currentLoaderObject?.parallel, isomorphoicRun = async (fn, args)=>{
5996
+ let enableParallelism = (currentLoaderObject)=>!(IS_WASM && currentLoaderObject?.loaderItem.cache) && currentLoaderObject?.parallel, isomorphoicRun = async (fn, args)=>{
5512
5997
  let loaderName, result, currentLoaderObject = getCurrentLoader(loaderContext), parallelism = enableParallelism(currentLoaderObject);
5513
5998
  if ((traceData || parallelism) && (loaderName = function(loaderPath, cwd = '') {
5514
5999
  let res = loaderPath.replace(cwd, '');
@@ -5527,9 +6012,119 @@ async function runLoaders(compiler, context) {
5527
6012
  uuid: traceData.uuid,
5528
6013
  args: traceData.args
5529
6014
  }), parallelism) {
5530
- let normalModule, workerLoaderContext;
5531
- result = await service_run(loaderName, {
5532
- loaderContext: (normalModule = loaderContext._module instanceof binding_.NormalModule ? loaderContext._module : void 0, Object.assign(workerLoaderContext = {
6015
+ let normalModule, workerLoaderSpan, workerLoaderContext;
6016
+ result = await (async (loaderName, task, options, workerOptions)=>(async (workerOptions)=>service_pool || (service_pool = import("../compiled/tinypool/dist/index.js").then(({ Tinypool })=>{
6017
+ let availableThreads = Math.max(__rspack_createRequire_require("node:os").cpus().length - 1, 1), maxWorkers = workerOptions?.maxWorkers ? Math.max(workerOptions.maxWorkers, 1) : void 0, maxWorkersFromEnv = parseInt(process.env.RSPACK_LOADER_WORKER_THREADS || '', 10);
6018
+ return new Tinypool({
6019
+ filename: node_path.resolve(import.meta.dirname, 'worker.js'),
6020
+ useAtomics: !1,
6021
+ maxThreads: maxWorkers || maxWorkersFromEnv || availableThreads,
6022
+ minThreads: maxWorkers || maxWorkersFromEnv || availableThreads,
6023
+ concurrentTasksPerWorker: 1
6024
+ });
6025
+ })))(workerOptions).then((pool)=>{
6026
+ let { port1: mainPort, port2: workerPort } = new MessageChannel(), { port1: mainSyncPort, port2: workerSyncPort } = new MessageChannel();
6027
+ return new Promise((resolve, reject)=>{
6028
+ let handleError = (error)=>{
6029
+ mainPort.close(), mainSyncPort.close(), reject(error);
6030
+ }, pendingRequests = new Map();
6031
+ mainPort.on('message', (message)=>{
6032
+ 'done' === message.type ? Promise.allSettled(pendingRequests.values()).then(()=>{
6033
+ mainPort.close(), mainSyncPort.close(), resolve(message.data);
6034
+ }) : 'done-error' === message.type ? Promise.allSettled(pendingRequests.values()).then(()=>{
6035
+ mainPort.close(), mainSyncPort.close(), reject(deserializeError(message.error));
6036
+ }) : 'request' === message.type ? pendingRequests.set(message.id, Promise.resolve().then(()=>options.handleIncomingRequest(message.requestType, ...message.data)).then((result)=>(mainPort.postMessage({
6037
+ type: 'response',
6038
+ id: message.id,
6039
+ data: result
6040
+ }), result)).catch((error)=>{
6041
+ mainPort.postMessage({
6042
+ type: 'response-error',
6043
+ id: message.id,
6044
+ error: serializeError(error)
6045
+ });
6046
+ })) : 'request-sync' === message.type && async function(message) {
6047
+ let result, { sharedBuffer } = message, sharedBufferView = new Int32Array(sharedBuffer);
6048
+ try {
6049
+ if ("WaitForPendingRequest" === message.requestType) {
6050
+ let pendingRequestId = message.data[0], isArray = Array.isArray(pendingRequestId), ids = isArray ? pendingRequestId : [
6051
+ pendingRequestId
6052
+ ];
6053
+ result = await Promise.all(ids.map((id)=>{
6054
+ let pendingRequest = pendingRequests.get(id);
6055
+ if (!pendingRequest) throw Error(`Unknown pending request: ${id}`);
6056
+ return pendingRequest;
6057
+ })), isArray || (result = result[0]);
6058
+ } else throw Error(`Unknown request type: ${message.requestType}`);
6059
+ mainSyncPort.postMessage({
6060
+ type: 'response',
6061
+ id: message.id,
6062
+ data: result
6063
+ });
6064
+ } catch (e) {
6065
+ mainSyncPort.postMessage({
6066
+ type: 'response-error',
6067
+ id: message.id,
6068
+ error: serializeError(e)
6069
+ });
6070
+ }
6071
+ Atomics.add(sharedBufferView, 0, 1), Atomics.notify(sharedBufferView, 0, 1 / 0);
6072
+ }(message);
6073
+ }), mainPort.on('messageerror', handleError), pool.run({
6074
+ ...task,
6075
+ workerData: {
6076
+ workerPort,
6077
+ workerSyncPort
6078
+ }
6079
+ }, {
6080
+ ...options,
6081
+ transferList: [
6082
+ ...options?.transferList || [],
6083
+ workerPort,
6084
+ workerSyncPort
6085
+ ]
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
+ });
6117
+ });
6118
+ }))(loaderName, {
6119
+ loaderContext: (normalModule = loaderContext._module instanceof NormalModule ? loaderContext._module : void 0, workerLoaderSpan = (()=>{
6120
+ let start = loaderContext.loaderIndex, end = start + 1;
6121
+ if (loaderState === binding_.JsLoaderState.Pitching) for(; end < loaderChainEnd && loaderContext.loaders[end]?.parallel;)end++;
6122
+ else for(; start > loaderChainStart && loaderContext.loaders[start - 1]?.parallel;)start--;
6123
+ return {
6124
+ start,
6125
+ end
6126
+ };
6127
+ })(), Object.assign(workerLoaderContext = {
5533
6128
  version: loaderContext.version,
5534
6129
  hot: loaderContext.hot,
5535
6130
  context: loaderContext.context,
@@ -5541,9 +6136,11 @@ async function runLoaders(compiler, context) {
5541
6136
  sourceMap: loaderContext.sourceMap,
5542
6137
  rootContext: loaderContext.rootContext,
5543
6138
  loaderIndex: loaderContext.loaderIndex,
5544
- loaders: loaderContext.loaders.map((item)=>{
6139
+ loaderChainStart: workerLoaderSpan.start,
6140
+ loaderChainEnd: workerLoaderSpan.end,
6141
+ loaders: loaderContext.loaders.map((item, index)=>{
5545
6142
  let options = item.options;
5546
- return (!item.parallel || item.request.startsWith(BUILTIN_LOADER_PREFIX)) && (options = void 0), {
6143
+ return (!item.parallel || index < workerLoaderSpan.start || index >= workerLoaderSpan.end) && (options = void 0), {
5547
6144
  ...item,
5548
6145
  options,
5549
6146
  pitch: void 0,
@@ -5612,10 +6209,6 @@ async function runLoaders(compiler, context) {
5612
6209
  case "ClearDependencies":
5613
6210
  loaderContext.clearDependencies();
5614
6211
  break;
5615
- case "BeginDependencyChanges":
5616
- case "MergeDependencyChanges":
5617
- dependencies.mergeChanges();
5618
- break;
5619
6212
  case "Resolve":
5620
6213
  return new Promise((resolve, reject)=>{
5621
6214
  loaderContext.resolve(args[0], args[1], (err, result, resolveRequest)=>{
@@ -5677,7 +6270,7 @@ async function runLoaders(compiler, context) {
5677
6270
  let updates = args[0];
5678
6271
  loaderContext.loaders = loaderContext.loaders.map((item, index)=>{
5679
6272
  let update = updates[index];
5680
- return item.loaderItem.data = update.data, update.pitchExecuted && (item.pitchExecuted = !0), update.normalExecuted && (item.normalExecuted = !0), item;
6273
+ return item.loaderItem.data = update.data, update.pitchExecuted && (item.pitchExecuted = !0), update.normalExecuted && (item.normalExecuted = !0), update.filterMatched && (item.loaderItem.filterMatched = !0), item;
5681
6274
  });
5682
6275
  break;
5683
6276
  }
@@ -5690,16 +6283,6 @@ async function runLoaders(compiler, context) {
5690
6283
  })(buildInfo, pickCustomBuildInfoFields(args[0]));
5691
6284
  break;
5692
6285
  }
5693
- case "LoaderCacheGet":
5694
- {
5695
- let [loaderIndex, content, additionalData] = args;
5696
- return loaderCache?.workerGet(loaderIndex, content, additionalData);
5697
- }
5698
- case "LoaderCacheStore":
5699
- {
5700
- let [loaderIndex, content, sourceMap, additionalData] = args;
5701
- return loaderCache?.workerStore(loaderIndex, content, sourceMap, additionalData);
5702
- }
5703
6286
  case "CompilationGetPath":
5704
6287
  {
5705
6288
  let filename = args[0], data = args[1];
@@ -5744,9 +6327,8 @@ async function runLoaders(compiler, context) {
5744
6327
  try {
5745
6328
  switch(loaderState){
5746
6329
  case binding_.JsLoaderState.Pitching:
5747
- for(; loaderContext.loaderIndex < loaderContext.loaders.length;){
6330
+ for(; loaderContext.loaderIndex < loaderChainEnd;){
5748
6331
  let args, currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex], parallelism = enableParallelism(currentLoaderObject);
5749
- if (currentLoaderObject.shouldYield()) break;
5750
6332
  if (currentLoaderObject.pitchExecuted) {
5751
6333
  loaderContext.loaderIndex += 1;
5752
6334
  continue;
@@ -5774,21 +6356,21 @@ async function runLoaders(compiler, context) {
5774
6356
  break;
5775
6357
  case binding_.JsLoaderState.Normal:
5776
6358
  {
5777
- let sourceMap, content = context.content, rawSourceMap = context.sourceMap, sourceMapParsed = !1, additionalData = context.additionalData;
5778
- for(; loaderContext.loaderIndex >= 0;){
5779
- let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex], parallelism = enableParallelism(currentLoaderObject);
5780
- if (currentLoaderObject.shouldYield()) break;
6359
+ let sourceMap, content = context.content, rawSourceMap = context.sourceMap, sourceMapParsed = !1, additionalData = context.additionalData, codeFilterTextCache = {
6360
+ initialized: !1
6361
+ };
6362
+ for(; loaderContext.loaderIndex >= loaderChainStart;){
6363
+ let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
5781
6364
  if (currentLoaderObject.normalExecuted) {
5782
6365
  loaderContext.loaderIndex--;
5783
6366
  continue;
5784
6367
  }
5785
- dependencies.resetChanges();
6368
+ if (currentLoaderObject.shouldSkipNormal(content, codeFilterTextCache)) {
6369
+ currentLoaderObject.normalExecuted = !0, loaderContext.loaderIndex--;
6370
+ continue;
6371
+ }
6372
+ let parallelism = enableParallelism(currentLoaderObject);
5786
6373
  try {
5787
- let cached = !parallelism && currentLoaderObject.loaderItem.cache && loaderCache ? await loaderCache.get(loaderContext.loaderIndex, content, additionalData) : void 0;
5788
- if (cached) {
5789
- currentLoaderObject.normalExecuted = !0, content = cached.content, sourceMap = JsSourceMap.__from_binding(cached.sourceMap), sourceMapParsed = !0, loaderContext.loaderIndex--;
5790
- continue;
5791
- }
5792
6374
  await utils_loadLoader(currentLoaderObject, compiler);
5793
6375
  let fn = currentLoaderObject.normal;
5794
6376
  if (parallelism && fn || (currentLoaderObject.normalExecuted = !0), !fn) continue;
@@ -5796,7 +6378,7 @@ async function runLoaders(compiler, context) {
5796
6378
  content,
5797
6379
  sourceMap,
5798
6380
  additionalData
5799
- ]), null === cached && await loaderCache?.store(loaderContext.loaderIndex, content, JsSourceMap.__to_binding(sourceMap), additionalData);
6381
+ ]), codeFilterTextCache.initialized = !1, codeFilterTextCache.content = void 0, codeFilterTextCache.text = void 0;
5800
6382
  } finally{
5801
6383
  dependencies.mergeChanges();
5802
6384
  }
@@ -5818,7 +6400,7 @@ async function runLoaders(compiler, context) {
5818
6400
  name: 'run_js_loaders',
5819
6401
  uuid: traceData.uuid,
5820
6402
  args: traceData.args
5821
- }), compiler.options?.cache && Object.keys(buildInfo = context._module.buildInfo).some((key)=>!knownBuildInfoFields.has(key)) && buildInfo[binding__default().COMMIT_CUSTOM_FIELDS_SYMBOL](), context;
6403
+ }), compiler.options?.cache && Object.hasOwn(context._module, MODULE_BUILD_INFO_SYMBOL) && Object.keys(buildInfo = context._module.buildInfo).some((key)=>!knownBuildInfoFields.has(key)) && buildInfo[COMMIT_CUSTOM_FIELDS_SYMBOL](), context.addedDependencies = dependencies.added, context.removedDependencies = dependencies.removed, context;
5822
6404
  }
5823
6405
  let JsLoaderRspackPlugin = base_create(binding_.BuiltinPluginName.JsLoaderRspackPlugin, (compiler)=>runLoaders.bind(null, compiler), 'thisCompilation'), JsonModulesPlugin = base_create(binding_.BuiltinPluginName.JsonModulesPlugin, ()=>{}, 'compilation'), LibManifestPlugin = base_create(binding_.BuiltinPluginName.LibManifestPlugin, (options)=>{
5824
6406
  let { context, entryOnly, format, name, path, type } = options;
@@ -5848,7 +6430,8 @@ let JsLoaderRspackPlugin = base_create(binding_.BuiltinPluginName.JsLoaderRspack
5848
6430
  exclude: exclude ? toFeatures(exclude) : void 0,
5849
6431
  targets,
5850
6432
  drafts: drafts ? {
5851
- customMedia: drafts.customMedia ?? !1
6433
+ customMedia: drafts.customMedia ?? !1,
6434
+ scrollNavigationControls: drafts.scrollNavigationControls ?? !1
5852
6435
  } : void 0,
5853
6436
  nonStandard: nonStandard ? {
5854
6437
  deepSelectorCombinator: nonStandard.deepSelectorCombinator ?? !1
@@ -5856,13 +6439,13 @@ let JsLoaderRspackPlugin = base_create(binding_.BuiltinPluginName.JsLoaderRspack
5856
6439
  pseudoClasses
5857
6440
  }
5858
6441
  };
5859
- }), LimitChunkCountPlugin = base_create(binding_.BuiltinPluginName.LimitChunkCountPlugin, (options)=>options), BuiltinLazyCompilationPlugin = base_create(binding_.BuiltinPluginName.LazyCompilationPlugin, (takeNewlyActiveModules, entries, imports, client, reservedExternals, test)=>({
6442
+ }), LimitChunkCountPlugin = base_create(binding_.BuiltinPluginName.LimitChunkCountPlugin, (options)=>options), BuiltinLazyCompilationPlugin = base_create(binding_.BuiltinPluginName.LazyCompilationPlugin, (takeNewlyActiveModules, entries, imports, client, collectReservedExternals, test)=>({
5860
6443
  imports,
5861
6444
  entries,
5862
6445
  test,
5863
6446
  client,
5864
6447
  takeNewlyActiveModules,
5865
- reservedExternals
6448
+ collectReservedExternals
5866
6449
  }), 'thisCompilation'), middleware_require = createRequire(import.meta.url), LAZY_COMPILATION_PREFIX = '/_rspack/lazy/trigger', noop = (_req, _res, next)=>{
5867
6450
  'function' == typeof next && next();
5868
6451
  }, lazyCompilationMiddleware = (compiler)=>{
@@ -5894,23 +6477,27 @@ let JsLoaderRspackPlugin = base_create(binding_.BuiltinPluginName.JsLoaderRspack
5894
6477
  return applyPlugin(compiler, options, newlyActiveModules), lazyCompilationMiddlewareInternal(compiler, newlyActiveModules, options.prefix || LAZY_COMPILATION_PREFIX);
5895
6478
  };
5896
6479
  function applyPlugin(compiler, options, newlyActiveModules) {
6480
+ let externals = compiler.options.externals;
5897
6481
  new BuiltinLazyCompilationPlugin(()=>{
5898
6482
  let res = new Set(newlyActiveModules);
5899
6483
  return newlyActiveModules.clear(), res;
5900
6484
  }, options.entries ?? !0, options.imports ?? !0, `${options.client || middleware_require.resolve(`../hot/lazy-compilation-${compiler.options.externalsPresets.node ? 'node' : 'web'}.js`)}?${encodeURIComponent((({ serverUrl, prefix })=>{
5901
6485
  let lazyCompilationPrefix = prefix || LAZY_COMPILATION_PREFIX;
5902
6486
  return serverUrl ? serverUrl + (serverUrl.endsWith('/') ? lazyCompilationPrefix.slice(1) : lazyCompilationPrefix) : lazyCompilationPrefix;
5903
- })(options))}`, function(externals) {
5904
- let requests = new Set(), visit = (item)=>{
5905
- if ('string' == typeof item) return void requests.add(item);
5906
- if (item && 'object' == typeof item && !(item instanceof RegExp)) for (let [request, value] of Object.entries(item))!1 !== value && requests.add(request);
5907
- };
5908
- if (Array.isArray(externals)) for (let item of externals)visit(item);
5909
- else void 0 !== externals && visit(externals);
5910
- return [
5911
- ...requests
5912
- ];
5913
- }(compiler.options.externals), options.test).apply(compiler);
6487
+ })(options))}`, (layer)=>(function(externals, layer) {
6488
+ let requests = new Set(), visit = (item)=>{
6489
+ if ('string' == typeof item) return void requests.add(item);
6490
+ if (!item || 'object' != typeof item || item instanceof RegExp) return;
6491
+ let resolved = resolveLayerExternals(item, layer);
6492
+ if ('string' == typeof resolved) return void requests.add(resolved);
6493
+ if (resolved && 'object' == typeof resolved && !(resolved instanceof RegExp)) for (let [request, value] of Object.entries(resolved))!1 !== value && requests.add(request);
6494
+ };
6495
+ if (Array.isArray(externals)) for (let item of externals)visit(item);
6496
+ else void 0 !== externals && visit(externals);
6497
+ return [
6498
+ ...requests
6499
+ ];
6500
+ })(externals, layer ?? null), options.test).apply(compiler);
5914
6501
  }
5915
6502
  let lazyCompilationMiddlewareInternal = (compiler, newlyActiveModules, lazyCompilationPrefix)=>{
5916
6503
  let logger = compiler.getInfrastructureLogger('LazyCompilation');
@@ -6183,6 +6770,7 @@ let SizeLimitsPlugin = base_create(binding_.BuiltinPluginName.SizeLimitsPlugin,
6183
6770
  return options.htmlPlugin === NATIVE_HTML_PLUGIN ? htmlPlugin = 'Native' : 'string' == typeof options.htmlPlugin && (htmlPlugin = 'JavaScript'), {
6184
6771
  hashFuncNames: options.hashFuncNames,
6185
6772
  htmlPlugin,
6773
+ hashLoading: options.hashLoading,
6186
6774
  integrityCallback: options.integrityCallback
6187
6775
  };
6188
6776
  });
@@ -6196,7 +6784,8 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
6196
6784
  'sha384'
6197
6785
  ],
6198
6786
  htmlPlugin: options.htmlPlugin ?? NATIVE_HTML_PLUGIN,
6199
- enabled: options.enabled ?? 'auto'
6787
+ enabled: options.enabled ?? 'auto',
6788
+ hashLoading: options.hashLoading ?? 'eager'
6200
6789
  };
6201
6790
  super({
6202
6791
  ...finalOptions,
@@ -6213,8 +6802,8 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
6213
6802
  }
6214
6803
  getIntegrityChecksumForAsset(src) {
6215
6804
  if (this.integrities.has(src)) return this.integrities.get(src);
6216
- let normalizedSrc = normalizePath(src), normalizedKey = Array.from(this.integrities.keys()).find((assetKey)=>normalizePath(assetKey) === normalizedSrc);
6217
- 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;
6218
6807
  }
6219
6808
  handleHwpPluginArgs({ assets }) {
6220
6809
  let publicPath = assets.publicPath, jsIntegrity = [];
@@ -6251,8 +6840,8 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
6251
6840
  if (!publicPath || '/' === publicPath || './' === publicPath) return;
6252
6841
  let protocolRelativePublicPath = publicPath.replace(HTTP_PROTOCOL_REGEX, ''), protocolRelativeTagSrc = tagSrc.replace(HTTP_PROTOCOL_REGEX, '');
6253
6842
  if (!protocolRelativeTagSrc.startsWith(protocolRelativePublicPath)) return;
6254
- let tagSrcWithScheme = `http:${protocolRelativeTagSrc}`;
6255
- 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));
6256
6845
  } else src = relative(publicPath, decodeURIComponent(tagSrc));
6257
6846
  tag.attributes.integrity = this.getIntegrityChecksumForAsset(src) || function(hashFuncNames, source) {
6258
6847
  let { createHash } = rspackRequire("node:crypto");
@@ -6267,7 +6856,7 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
6267
6856
  if (contenthash) {
6268
6857
  let shaHashes = (Array.isArray(contenthash) ? contenthash : [
6269
6858
  contenthash
6270
- ]).filter((hash)=>String(hash).match(/^sha[0-9]+-/));
6859
+ ]).filter((hash)=>/^sha[0-9]+-/.test(String(hash)));
6271
6860
  shaHashes.length > 0 && (object.integrity = shaHashes.join(' '));
6272
6861
  }
6273
6862
  });
@@ -6298,10 +6887,11 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
6298
6887
  }
6299
6888
  }
6300
6889
  function normalizePath(path) {
6301
- return path.replace(/\?.*$/, '').split(sep).join('/');
6890
+ let withoutQuery = path.replace(/\?.*$/, '');
6891
+ return '/' === sep ? withoutQuery : withoutQuery.replaceAll(sep, '/');
6302
6892
  }
6303
6893
  let SwcJsMinimizerRspackPlugin = base_create(binding_.BuiltinPluginName.SwcJsMinimizerRspackPlugin, function(options) {
6304
- 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 = {
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 = {
6305
6895
  comments: !1,
6306
6896
  ...options?.minimizerOptions?.format
6307
6897
  };
@@ -6378,17 +6968,63 @@ class WorkerPlugin extends RspackBuiltinPlugin {
6378
6968
  class ContextModuleFactory {
6379
6969
  hooks;
6380
6970
  constructor(){
6381
- this.hooks = {
6382
- beforeResolve: new AsyncSeriesWaterfallHook([
6383
- 'resolveData'
6384
- ]),
6385
- afterResolve: new AsyncSeriesWaterfallHook([
6386
- 'resolveData'
6387
- ])
6388
- };
6971
+ this.hooks = {
6972
+ beforeResolve: new AsyncSeriesWaterfallHook([
6973
+ 'resolveData'
6974
+ ]),
6975
+ afterResolve: new AsyncSeriesWaterfallHook([
6976
+ 'resolveData'
6977
+ ])
6978
+ };
6979
+ }
6980
+ }
6981
+ class ConcatenatedModule extends Module_Module {
6982
+ get rootModule() {
6983
+ return binding__default().concatenatedModuleGetRootModule(this);
6984
+ }
6985
+ get modules() {
6986
+ return binding__default().concatenatedModuleGetModules(this);
6987
+ }
6988
+ }
6989
+ class ContextModule extends Module_Module {
6990
+ }
6991
+ class ExternalModule extends Module_Module {
6992
+ #userRequest = null;
6993
+ static #properties = {
6994
+ userRequest: {
6995
+ enumerable: !0,
6996
+ configurable: !0,
6997
+ get () {
6998
+ return null === this.#userRequest && (this.#userRequest = binding__default().externalModuleGetUserRequest(this)), this.#userRequest;
6999
+ },
7000
+ set (value) {
7001
+ this.#userRequest = value;
7002
+ }
7003
+ }
7004
+ };
7005
+ constructor(){
7006
+ super(), Object.defineProperties(this, ExternalModule.#properties);
7007
+ }
7008
+ static getCompilationHooks(compilation) {
7009
+ if (!(COMPILATION_HOOKS_MAP_SYMBOL in compilation)) throw TypeError("The 'compilation' argument must be an instance of Compilation");
7010
+ return getOrCreateCompilationHooks(compilation, binding__default(), ()=>({
7011
+ chunkCondition: new SyncBailHook([
7012
+ 'chunk',
7013
+ 'compilation'
7014
+ ])
7015
+ }));
6389
7016
  }
6390
7017
  }
6391
- let bindingHelpers = {
7018
+ let MODULE_CLASSES = {
7019
+ [binding_.ModuleKind.Module]: Module_Module,
7020
+ [binding_.ModuleKind.Normal]: NormalModule,
7021
+ [binding_.ModuleKind.Concatenated]: ConcatenatedModule,
7022
+ [binding_.ModuleKind.Context]: ContextModule,
7023
+ [binding_.ModuleKind.External]: ExternalModule
7024
+ }, bindingHelpers = {
7025
+ createModule: function(kind) {
7026
+ return new MODULE_CLASSES[kind]();
7027
+ },
6392
7028
  applyIndexedArrayUpdates: function(source, target, commands) {
6393
7029
  let mode = commands[0], length = commands[1];
6394
7030
  if (0 === mode) {
@@ -6406,179 +7042,6 @@ let bindingHelpers = {
6406
7042
  function assertNotNill(value) {
6407
7043
  if (null == value) throw Error(`${value} should not be undefined or null`);
6408
7044
  }
6409
- let DYNAMIC_INFO = Symbol('cleverMerge dynamic info'), mergeCache = new WeakMap(), DELETE = Symbol('DELETE'), cachedCleverMerge = (first, second)=>{
6410
- if (void 0 === second) return first;
6411
- if (void 0 === first || 'object' != typeof second || null === second) return second;
6412
- if ('object' != typeof first || null === first) return first;
6413
- let innerCache = mergeCache.get(first);
6414
- void 0 === innerCache && (innerCache = new WeakMap(), mergeCache.set(first, innerCache));
6415
- let prevMerge = innerCache.get(second);
6416
- if (void 0 !== prevMerge) return prevMerge;
6417
- let newMerge = _cleverMerge(first, second, !0);
6418
- return innerCache.set(second, newMerge), newMerge;
6419
- }, parseCache = new WeakMap(), cachedParseObject = (obj)=>{
6420
- let entry = parseCache.get(obj);
6421
- if (void 0 !== entry) return entry;
6422
- let result = parseObject(obj);
6423
- return parseCache.set(obj, result), result;
6424
- }, parseObject = (obj)=>{
6425
- let dynamicInfo, info = new Map(), getInfo = (p)=>{
6426
- let entry = info.get(p);
6427
- if (void 0 !== entry) return entry;
6428
- let newEntry = {
6429
- base: void 0,
6430
- byProperty: void 0,
6431
- byValues: new Map()
6432
- };
6433
- return info.set(p, newEntry), newEntry;
6434
- };
6435
- for (let key of Object.keys(obj))if (key.startsWith('by')) {
6436
- let byObj = obj[key];
6437
- if ('object' == typeof byObj) for (let byValue of Object.keys(byObj)){
6438
- let obj = byObj[byValue];
6439
- for (let key1 of Object.keys(obj)){
6440
- let entry = getInfo(key1);
6441
- if (void 0 === entry.byProperty) entry.byProperty = key;
6442
- else if (entry.byProperty !== key) throw Error(`${key} and ${entry.byProperty} for a single property is not supported`);
6443
- if (entry.byValues.set(byValue, obj[key1]), 'default' === byValue) for (let otherByValue of Object.keys(byObj))entry.byValues.has(otherByValue) || entry.byValues.set(otherByValue, void 0);
6444
- }
6445
- }
6446
- else if ('function' == typeof byObj) if (void 0 === dynamicInfo) dynamicInfo = {
6447
- byProperty: key,
6448
- fn: byObj
6449
- };
6450
- else throw Error(`${key} and ${dynamicInfo.byProperty} when both are functions is not supported`);
6451
- else getInfo(key).base = obj[key];
6452
- } else getInfo(key).base = obj[key];
6453
- return {
6454
- static: info,
6455
- dynamic: dynamicInfo
6456
- };
6457
- }, cleverMerge_serializeObject = (info, dynamicInfo)=>{
6458
- let obj = {};
6459
- for (let entry of info.values())if (void 0 !== entry.byProperty) {
6460
- let byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
6461
- for (let byValue of entry.byValues.keys())byObj[byValue] = byObj[byValue] || {};
6462
- }
6463
- for (let [key, entry] of info)if (void 0 !== entry.base && (obj[key] = entry.base), void 0 !== entry.byProperty) {
6464
- let byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
6465
- for (let byValue of Object.keys(byObj)){
6466
- let value = getFromByValues(entry.byValues, byValue);
6467
- void 0 !== value && (byObj[byValue][key] = value);
6468
- }
6469
- }
6470
- return void 0 !== dynamicInfo && (obj[dynamicInfo.byProperty] = dynamicInfo.fn), obj;
6471
- }, getValueType = (value)=>void 0 === value ? 0 : value === DELETE ? 4 : Array.isArray(value) ? -1 !== value.lastIndexOf('...') ? 2 : 1 : 'object' != typeof value || null === value || value.constructor && value.constructor !== Object ? 1 : 3, cleverMerge = (first, second)=>void 0 === second ? first : void 0 === first || 'object' != typeof second || null === second ? second : 'object' != typeof first || null === first ? first : _cleverMerge(first, second, !1), _cleverMerge = (first, second, internalCaching = !1)=>{
6472
- let firstObject = internalCaching ? cachedParseObject(first) : parseObject(first), { static: firstInfo, dynamic: firstDynamicInfo } = firstObject, secondObj = second;
6473
- if (void 0 !== firstDynamicInfo) {
6474
- let { fn } = firstDynamicInfo, { byProperty } = firstDynamicInfo, fnInfo = fn[DYNAMIC_INFO];
6475
- fnInfo && (secondObj = internalCaching ? cachedCleverMerge(fnInfo[1], second) : cleverMerge(fnInfo[1], second), fn = fnInfo[0]);
6476
- let newFn = (...args)=>{
6477
- let fnResult = fn(...args);
6478
- return internalCaching ? cachedCleverMerge(fnResult, secondObj) : cleverMerge(fnResult, secondObj);
6479
- };
6480
- return newFn[DYNAMIC_INFO] = [
6481
- fn,
6482
- secondObj
6483
- ], cleverMerge_serializeObject(firstObject.static, {
6484
- byProperty,
6485
- fn: newFn
6486
- });
6487
- }
6488
- let { static: secondInfo, dynamic: secondDynamicInfo } = internalCaching ? cachedParseObject(second) : parseObject(second), resultInfo = new Map();
6489
- for (let [key, firstEntry] of firstInfo){
6490
- let secondEntry = secondInfo.get(key), entry = void 0 !== secondEntry ? mergeEntries(firstEntry, secondEntry, internalCaching) : firstEntry;
6491
- resultInfo.set(key, entry);
6492
- }
6493
- for (let [key, secondEntry] of secondInfo)firstInfo.has(key) || resultInfo.set(key, secondEntry);
6494
- return cleverMerge_serializeObject(resultInfo, secondDynamicInfo);
6495
- }, mergeEntries = (firstEntry, secondEntry, internalCaching)=>{
6496
- switch(getValueType(secondEntry.base)){
6497
- case 1:
6498
- case 4:
6499
- return secondEntry;
6500
- case 0:
6501
- {
6502
- if (!firstEntry.byProperty) return {
6503
- base: firstEntry.base,
6504
- byProperty: secondEntry.byProperty,
6505
- byValues: secondEntry.byValues
6506
- };
6507
- if (firstEntry.byProperty !== secondEntry.byProperty) throw Error(`${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`);
6508
- let newByValues = new Map(firstEntry.byValues);
6509
- for (let [key, value] of secondEntry.byValues){
6510
- let firstValue = getFromByValues(firstEntry.byValues, key);
6511
- newByValues.set(key, mergeSingleValue(firstValue, value, internalCaching));
6512
- }
6513
- return {
6514
- base: firstEntry.base,
6515
- byProperty: firstEntry.byProperty,
6516
- byValues: newByValues
6517
- };
6518
- }
6519
- default:
6520
- {
6521
- let newBase;
6522
- if (!firstEntry.byProperty) return {
6523
- base: mergeSingleValue(firstEntry.base, secondEntry.base, internalCaching),
6524
- byProperty: secondEntry.byProperty,
6525
- byValues: secondEntry.byValues
6526
- };
6527
- let intermediateByValues = new Map(firstEntry.byValues);
6528
- for (let [key, value] of intermediateByValues)intermediateByValues.set(key, mergeSingleValue(value, secondEntry.base, internalCaching));
6529
- if (Array.from(firstEntry.byValues.values()).every((value)=>{
6530
- let type = getValueType(value);
6531
- return 1 === type || 4 === type;
6532
- }) ? newBase = mergeSingleValue(firstEntry.base, secondEntry.base, internalCaching) : (newBase = firstEntry.base, intermediateByValues.has('default') || intermediateByValues.set('default', secondEntry.base)), !secondEntry.byProperty) return {
6533
- base: newBase,
6534
- byProperty: firstEntry.byProperty,
6535
- byValues: intermediateByValues
6536
- };
6537
- if (firstEntry.byProperty !== secondEntry.byProperty) throw Error(`${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`);
6538
- let newByValues = new Map(intermediateByValues);
6539
- for (let [key, value] of secondEntry.byValues){
6540
- let firstValue = getFromByValues(intermediateByValues, key);
6541
- newByValues.set(key, mergeSingleValue(firstValue, value, internalCaching));
6542
- }
6543
- return {
6544
- base: newBase,
6545
- byProperty: firstEntry.byProperty,
6546
- byValues: newByValues
6547
- };
6548
- }
6549
- }
6550
- }, getFromByValues = (byValues, key)=>'default' !== key && byValues.has(key) ? byValues.get(key) : byValues.get('default'), mergeSingleValue = (a, b, internalCaching)=>{
6551
- let bType = getValueType(b), aType = getValueType(a);
6552
- switch(bType){
6553
- case 4:
6554
- case 1:
6555
- return b;
6556
- case 3:
6557
- return 3 !== aType ? b : internalCaching ? cachedCleverMerge(a, b) : cleverMerge(a, b);
6558
- case 0:
6559
- return a;
6560
- case 2:
6561
- switch(1 !== aType ? aType : Array.isArray(a) ? 2 : 3){
6562
- case 0:
6563
- return b;
6564
- case 4:
6565
- return b.filter((item)=>'...' !== item);
6566
- case 2:
6567
- {
6568
- let newArray = [];
6569
- for (let item of b)if ('...' === item) for (let item of a)newArray.push(item);
6570
- else newArray.push(item);
6571
- return newArray;
6572
- }
6573
- case 3:
6574
- return b.map((item)=>'...' === item ? a : item);
6575
- default:
6576
- throw Error('Not implemented');
6577
- }
6578
- default:
6579
- throw Error('Not implemented');
6580
- }
6581
- };
6582
7045
  class BrowserslistError extends Error {
6583
7046
  constructor(message){
6584
7047
  var key, value;
@@ -6593,8 +7056,14 @@ class BrowserslistError extends Error {
6593
7056
  let isFileCache = {};
6594
7057
  function isFile(file) {
6595
7058
  if (file in isFileCache) return isFileCache[file];
6596
- let result = node_fs.existsSync(file) && node_fs.statSync(file).isFile();
6597
- return isFileCache[file] = result, result;
7059
+ try {
7060
+ let result = node_fs.existsSync(file) && node_fs.statSync(file).isFile();
7061
+ return isFileCache[file] = result, result;
7062
+ } catch (error) {
7063
+ let { code } = error;
7064
+ if ('ENOENT' === code || 'EACCES' === code || 'ERR_ACCESS_DENIED' === code) return !1;
7065
+ throw error;
7066
+ }
6598
7067
  }
6599
7068
  function parsePackage(file) {
6600
7069
  let config = JSON.parse(node_fs.readFileSync(file).toString().replace(/^\uFEFF/m, ''));
@@ -6607,7 +7076,7 @@ function parsePackage(file) {
6607
7076
  if (Array.isArray(section)) {
6608
7077
  for(let i = 0; i < section.length; i++)if ('string' != typeof section[i]) throw new BrowserslistError(FORMAT);
6609
7078
  } else if ('string' != typeof section) throw new BrowserslistError(FORMAT);
6610
- }(list[i]);
7079
+ }(list[i]), 'string' == typeof list[i] && (list[i] = parseConfig(list[i]).defaults);
6611
7080
  return list;
6612
7081
  }
6613
7082
  let IS_SECTION = /^\s*\[(.+)]\s*$/;
@@ -7094,6 +7563,59 @@ let configCache = {}, ES_VERSIONS_MAP = {
7094
7563
  ],
7095
7564
  node: 14
7096
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
+ }),
7097
7619
  logicalAssignment: rawChecker({
7098
7620
  chrome: 85,
7099
7621
  and_chr: 85,
@@ -7174,6 +7696,23 @@ let configCache = {}, ES_VERSIONS_MAP = {
7174
7696
  6
7175
7697
  ]
7176
7698
  }),
7699
+ topLevelAwait: rawChecker({
7700
+ chrome: 89,
7701
+ and_chr: 89,
7702
+ edge: 89,
7703
+ firefox: 89,
7704
+ and_ff: 89,
7705
+ opera: 75,
7706
+ op_mob: 63,
7707
+ safari: 15,
7708
+ ios_saf: 15,
7709
+ samsung: 15,
7710
+ android: 89,
7711
+ node: [
7712
+ 14,
7713
+ 8
7714
+ ]
7715
+ }),
7177
7716
  browser: browserProperty,
7178
7717
  electron: !1,
7179
7718
  node: nodeProperty,
@@ -7343,10 +7882,13 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7343
7882
  computedProperty: v(4),
7344
7883
  templateLiteral: v(4),
7345
7884
  optionalChaining: v(14),
7885
+ spread: v(8, 3),
7886
+ symbol: v(6),
7346
7887
  logicalAssignment: v(15),
7347
7888
  methodShorthand: v(4),
7348
7889
  arrowFunction: v(6),
7349
7890
  asyncFunction: v(7, 6),
7891
+ topLevelAwait: v(14, 8),
7350
7892
  forOf: v(5),
7351
7893
  destructuring: v(6),
7352
7894
  bigIntLiteral: v(10, 4),
@@ -7390,10 +7932,13 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7390
7932
  computedProperty: v(1, 1),
7391
7933
  templateLiteral: v(1, 1),
7392
7934
  optionalChaining: v(8),
7935
+ spread: v(2),
7936
+ symbol: v(0, 37),
7393
7937
  logicalAssignment: v(10),
7394
7938
  methodShorthand: v(1, 1),
7395
7939
  arrowFunction: v(1, 1),
7396
7940
  asyncFunction: v(1, 7),
7941
+ topLevelAwait: v(12),
7397
7942
  forOf: v(0, 36),
7398
7943
  destructuring: v(1, 1),
7399
7944
  bigIntLiteral: v(4),
@@ -7432,9 +7977,12 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7432
7977
  computedProperty: v(0, 15),
7433
7978
  templateLiteral: v(0, 13),
7434
7979
  optionalChaining: v(0, 44),
7980
+ spread: v(0, 23),
7981
+ symbol: v(0, 13),
7435
7982
  methodShorthand: v(0, 15),
7436
7983
  arrowFunction: v(0, 15),
7437
7984
  asyncFunction: v(0, 21),
7985
+ topLevelAwait: v(0, 52),
7438
7986
  forOf: v(0, 13),
7439
7987
  destructuring: v(0, 15),
7440
7988
  bigIntLiteral: v(0, 32),
@@ -7451,11 +7999,13 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7451
7999
  (version)=>{
7452
8000
  let v = +version;
7453
8001
  return 5 < v && v < 1000 && (v += 2009), {
7454
- esVersion: v > 2022 ? 2022 : v,
8002
+ esVersion: v > 2024 ? 2024 : v,
7455
8003
  const: v >= 2015,
7456
8004
  computedProperty: v >= 2015,
7457
8005
  templateLiteral: v >= 2015,
7458
8006
  optionalChaining: v >= 2020,
8007
+ spread: v >= 2018,
8008
+ symbol: v >= 2015,
7459
8009
  logicalAssignment: v >= 2021,
7460
8010
  methodShorthand: v >= 2015,
7461
8011
  arrowFunction: v >= 2015,
@@ -7463,6 +8013,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7463
8013
  destructuring: v >= 2015,
7464
8014
  module: v >= 2015,
7465
8015
  asyncFunction: v >= 2017,
8016
+ topLevelAwait: v >= 2022,
7466
8017
  globalThis: v >= 2020,
7467
8018
  bigIntLiteral: v >= 2020,
7468
8019
  dynamicImport: v >= 2020,
@@ -7513,7 +8064,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7513
8064
  (hasTrue || hasFalse) && (result[key] = hasFalse && hasTrue ? null : hasTrue);
7514
8065
  }
7515
8066
  return result;
7516
- })(targets.map((t)=>getTargetProperties(t, context))), ERROR_PREFIX = 'Invalid Rspack configuration:', applyRspackOptionsDefaults = (options, compilerIndex)=>{
8067
+ })(targets.map((t)=>getTargetProperties(t, context))), applyRspackOptionsDefaults = (options, compilerIndex)=>{
7517
8068
  F(options, 'context', ()=>process.cwd()), F(options, 'target', ()=>hasBrowserslistConfig(options.context) ? 'browserslist' : 'web');
7518
8069
  let { mode, target } = options;
7519
8070
  if (isNil(target)) throw Error('target should not be nil after defaults');
@@ -7521,7 +8072,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7521
8072
  if ('function' != typeof options.entry) for (let key of Object.keys(options.entry))F(options.entry[key], 'import', ()=>[
7522
8073
  './src'
7523
8074
  ]);
7524
- if (F(options, 'devtool', ()=>!!development && 'cheap-module-source-map'), D(options, 'watch', !1), D(options, 'lazyCompilation', !1), D(options, 'bail', !1), F(options, 'cache', ()=>!!development && {
8075
+ return F(options, 'devtool', ()=>!!development && 'cheap-module-source-map'), D(options, 'watch', !1), D(options, 'lazyCompilation', !1), D(options, 'bail', !1), F(options, 'cache', ()=>!!development && {
7525
8076
  type: 'memory'
7526
8077
  }), applyCacheDefaults(options.cache, {
7527
8078
  context: options.context,
@@ -7530,10 +8081,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7530
8081
  compilerIndex
7531
8082
  }), applyIncrementalDefaults(options), applyExperimentsDefaults(options.experiments, {
7532
8083
  production
7533
- }), options.cache && 'filesystem' === options.cache.type && !options.experiments.newCache) throw Error(`${ERROR_PREFIX} "cache.type: 'filesystem'" requires "experiments.newCache" to be enabled.`);
7534
- return applySnapshotDefaults(options.snapshot, {
7535
- production,
7536
- newCache: !!options.experiments.newCache
8084
+ }), applySnapshotDefaults(options.snapshot, {
8085
+ production
7537
8086
  }), applyOptimizationDefaults(options.optimization, {
7538
8087
  production,
7539
8088
  development
@@ -7580,7 +8129,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7580
8129
  targets: targetProperties.targets
7581
8130
  };
7582
8131
  }, applyCacheDefaults = (cache, { context, name, mode, compilerIndex })=>{
7583
- if (!1 !== cache) switch(('persistent' === cache.type || 'filesystem' === cache.type) && (F(cache, 'name', ()=>{
8132
+ if (!1 !== cache) switch('persistent' === cache.type && (F(cache, 'name', ()=>{
7584
8133
  let cacheName = name ? `${name}-${mode}` : mode;
7585
8134
  return void 0 !== compilerIndex && compilerIndex > 0 ? `${cacheName}-${compilerIndex}` : cacheName;
7586
8135
  }), D(cache, 'version', ''), D(cache, 'maxMemoryGenerations', 'development' === mode ? 5 : 1 / 0), D(cache, 'readonly', !1)), cache.type){
@@ -7588,14 +8137,9 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7588
8137
  break;
7589
8138
  case 'persistent':
7590
8139
  D(cache.storage, 'type', 'filesystem'), F(cache.storage, 'directory', ()=>node_path.resolve(context, 'node_modules/.cache/rspack')), F(cache.storage, 'location', ()=>node_path.resolve(cache.storage.directory, cache.name)), D(cache, 'maxAge', 604800), F(cache, 'buildDependencies', ()=>[]), D(cache, 'portable', !1);
7591
- break;
7592
- case 'filesystem':
7593
- F(cache, 'cacheDirectory', ()=>node_path.resolve(context, 'node_modules/.cache/rspack')), F(cache, 'cacheLocation', ()=>node_path.resolve(cache.cacheDirectory, cache.name)), F(cache, 'buildDependencies', ()=>({})), D(cache, 'idleTimeout', 60000), D(cache, 'idleTimeoutForInitialStore', 5000), D(cache, 'idleTimeoutAfterLargeChanges', 1000);
7594
8140
  }
7595
- }, applySnapshotDefaults = (snapshot, { production, newCache })=>{
7596
- F(snapshot, 'immutablePaths', ()=>[]), F(snapshot, 'unmanagedPaths', ()=>[]), F(snapshot, 'managedPaths', ()=>newCache ? [
7597
- /^(.+?[\\/]node_modules[\\/])/
7598
- ] : [
8141
+ }, applySnapshotDefaults = (snapshot, { production })=>{
8142
+ F(snapshot, 'immutablePaths', ()=>[]), F(snapshot, 'unmanagedPaths', ()=>[]), F(snapshot, 'managedPaths', ()=>[
7599
8143
  /[\\/]node_modules[\\/][^.]/
7600
8144
  ]), F(snapshot, 'resolveBuildDependencies', ()=>({
7601
8145
  timestamp: !0,
@@ -7630,7 +8174,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7630
8174
  applyCssModuleParserOptionsDefaults(parserOptions), D(parserOptions, 'pure', !1);
7631
8175
  }, applyModuleDefaults = (module, { asyncWebAssembly, targetProperties, mode, uniqueName, deferImport, sourceImport, outputModule, hashFunction, hashSalt })=>{
7632
8176
  assertNotNill(module.parser), assertNotNill(module.generator), 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, sourceImport, outputModule })=>{
7633
- 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, 'strictThisContextOnImports', !1), D(parserOptions, 'wrappedContextRegExp', /.*/), D(parserOptions, 'exportsPresence', 'error'), D(parserOptions, 'requireAsExpression', !0), D(parserOptions, 'requireAlias', !1), D(parserOptions, 'requireDynamic', !0), D(parserOptions, 'requireResolve', !0), D(parserOptions, 'commonjs', !0), D(parserOptions, 'importDynamic', !0), D(parserOptions, 'worker', [
8177
+ D(parserOptions, 'dynamicImportMode', 'lazy'), D(parserOptions, 'dynamicImportPrefetch', !1), D(parserOptions, 'dynamicImportPreload', !1), D(parserOptions, 'url', !0), D(parserOptions, 'dynamicUrl', !0), D(parserOptions, 'exprContextCritical', !0), D(parserOptions, 'unknownContextCritical', !0), D(parserOptions, 'wrappedContextCritical', !1), D(parserOptions, 'strictThisContextOnImports', !1), D(parserOptions, 'wrappedContextRegExp', /.*/), D(parserOptions, 'exportsPresence', 'error'), D(parserOptions, 'requireAsExpression', !0), D(parserOptions, 'requireAlias', !1), D(parserOptions, 'requireDynamic', !0), D(parserOptions, 'requireResolve', !0), D(parserOptions, 'commonjs', !0), D(parserOptions, 'importDynamic', !0), D(parserOptions, 'worker', [
7634
8178
  '...'
7635
8179
  ]), D(parserOptions, 'importMeta', !outputModule || 'preserve-unknown'), D(parserOptions, 'typeReexportsPresence', 'no-tolerant'), D(parserOptions, 'jsx', !1), D(parserOptions, 'deferImport', deferImport), D(parserOptions, 'sourceImport', sourceImport), D(parserOptions, 'importMetaResolve', !1), D(parserOptions, 'createRequire', !1);
7636
8180
  })(module.parser.javascript, {
@@ -7824,12 +8368,21 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7824
8368
  }), F(environment, 'optionalChaining', ()=>{
7825
8369
  let v;
7826
8370
  return tp && ((v = tp.optionalChaining) || void 0 === v);
7827
- }), 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', ()=>{
7828
8378
  let v;
7829
8379
  return tp && ((v = tp.nodePrefixForCoreModules) || void 0 === v);
7830
8380
  }), F(environment, 'importMetaDirnameAndFilename', ()=>tp && tp.importMetaDirnameAndFilename), F(environment, 'templateLiteral', ()=>{
7831
8381
  let v;
7832
8382
  return tp && ((v = tp.templateLiteral) || void 0 === v);
8383
+ }), F(environment, 'topLevelAwait', ()=>{
8384
+ let v;
8385
+ return tp && ((v = tp.topLevelAwait) || void 0 === v);
7833
8386
  }), 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', ()=>{
7834
8387
  let v;
7835
8388
  return tp && ((v = tp.document) || void 0 === v);
@@ -7849,7 +8402,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7849
8402
  }), D(output, 'hotUpdateChunkFilename', `[id].[fullhash].hot-update.${output.module ? 'mjs' : 'js'}`), F(output, 'hotUpdateMainFilename', ()=>`[runtime].[fullhash].hot-update.${output.module ? 'json.mjs' : 'json'}`);
7850
8403
  let uniqueNameId = Template.toIdentifier(output.uniqueName);
7851
8404
  if (F(output, 'hotUpdateGlobal', ()=>`rspackHotUpdate${uniqueNameId}`), F(output, 'chunkLoadingGlobal', ()=>`rspackChunk${uniqueNameId}`), D(output, 'assetModuleFilename', '[hash][ext][query]'), D(output, 'webassemblyModuleFilename', '[hash].module.wasm'), D(output, 'wasmStreamingFallback', !0), D(output, 'compareBeforeEmit', !0), output.path && !node_path.isAbsolute(output.path)) {
7852
- if (!context) throw Error(`${ERROR_PREFIX} "context" must be a non-empty absolute path when "output.path" is relative, get "${context ?? ''}".`);
8405
+ if (!context) throw Error(`Invalid Rspack configuration: "context" must be a non-empty absolute path when "output.path" is relative, get "${context ?? ''}".`);
7853
8406
  output.path = node_path.resolve(context, output.path);
7854
8407
  }
7855
8408
  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), F(output, 'chunkFormat', ()=>{
@@ -7924,7 +8477,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7924
8477
  return output.wasmLoading && enabledWasmLoadingTypes.add(output.wasmLoading), output.workerWasmLoading && enabledWasmLoadingTypes.add(output.workerWasmLoading), forEachEntry((desc)=>{
7925
8478
  desc.wasmLoading && enabledWasmLoadingTypes.add(desc.wasmLoading);
7926
8479
  }), Array.from(enabledWasmLoadingTypes);
7927
- }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.2.9"), 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));
7928
8481
  }, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp, outputModule })=>{
7929
8482
  let isUniversal = (key)=>!!(outputModule && targetProperties && null === targetProperties[key]);
7930
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')));
@@ -7961,7 +8514,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7961
8514
  "javascript",
7962
8515
  'css',
7963
8516
  'unknown'
7964
- ]), 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, 'enforceSizeThreshold', ()=>production ? 50000 : 30000), F(splitChunks, 'maxAsyncRequests', ()=>production ? 30 : 1 / 0), F(splitChunks, 'maxInitialRequests', ()=>production ? 30 : 1 / 0), D(splitChunks, 'automaticNameDelimiter', '-');
8517
+ ]), 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, 'minRemainingSize', ()=>development ? 0 : void 0), F(splitChunks, 'enforceSizeThreshold', ()=>production ? 50000 : 30000), F(splitChunks, 'maxAsyncRequests', ()=>production ? 30 : 1 / 0), F(splitChunks, 'maxInitialRequests', ()=>production ? 30 : 1 / 0), D(splitChunks, 'automaticNameDelimiter', '-');
7965
8518
  let { cacheGroups } = splitChunks;
7966
8519
  cacheGroups && (F(cacheGroups, 'default', ()=>({
7967
8520
  idHint: '',
@@ -8112,7 +8665,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
8112
8665
  let rule = ignore instanceof RegExp ? {
8113
8666
  message: ignore
8114
8667
  } : ignore;
8115
- 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));
8116
8669
  });
8117
8670
  })(config.ignoreWarnings),
8118
8671
  name: config.name,
@@ -8230,33 +8783,13 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
8230
8783
  if (!1 === cache) return !1;
8231
8784
  if (!0 === cache) return {
8232
8785
  type: 'memory'
8233
- };
8234
- switch('persistent' === cache.type && config.experiments?.newCache && (cache = convertPersistentCacheOptions(cache)), cache.type){
8235
- case void 0:
8236
- case 'memory':
8237
- return {
8238
- type: 'memory'
8239
- };
8240
- case 'filesystem':
8241
- {
8242
- let context = config.context || process.cwd();
8243
- return {
8244
- type: 'filesystem',
8245
- name: cache.name,
8246
- version: cache.version,
8247
- readonly: cache.readonly,
8248
- maxMemoryGenerations: cache.maxMemoryGenerations,
8249
- idleTimeout: cache.idleTimeout,
8250
- idleTimeoutForInitialStore: cache.idleTimeoutForInitialStore,
8251
- idleTimeoutAfterLargeChanges: cache.idleTimeoutAfterLargeChanges,
8252
- cacheDirectory: optionalNestedConfig(cache.cacheDirectory, (directory)=>node_path.resolve(context, directory)),
8253
- cacheLocation: optionalNestedConfig(cache.cacheLocation, (location)=>node_path.resolve(context, location)),
8254
- buildDependencies: Object.fromEntries(Object.entries(cache.buildDependencies || {}).map(([key, deps])=>[
8255
- key,
8256
- deps.map((dependency)=>node_path.resolve(context, dependency))
8257
- ]))
8258
- };
8259
- }
8786
+ };
8787
+ switch(cache.type){
8788
+ case void 0:
8789
+ case 'memory':
8790
+ return {
8791
+ type: 'memory'
8792
+ };
8260
8793
  case 'persistent':
8261
8794
  {
8262
8795
  let hasMaxVersions = Object.hasOwn(cache, 'maxVersions');
@@ -8415,18 +8948,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
8415
8948
  module: optionalNestedConfig(snapshot.module, cloneObject),
8416
8949
  contextModule: optionalNestedConfig(snapshot.contextModule, cloneObject),
8417
8950
  resolve: optionalNestedConfig(snapshot.resolve, cloneObject)
8418
- })), convertPersistentCacheOptions = (cache)=>({
8419
- type: 'filesystem',
8420
- name: cache.name,
8421
- version: cache.version,
8422
- readonly: cache.readonly,
8423
- maxMemoryGenerations: cache.maxMemoryGenerations,
8424
- buildDependencies: void 0 === cache.buildDependencies ? void 0 : {
8425
- config: cache.buildDependencies
8426
- },
8427
- cacheDirectory: cache.storage?.directory,
8428
- cacheLocation: cache.storage?.location
8429
- }), nestedConfig = (value, fn)=>fn(void 0 === value ? {} : value), optionalNestedConfig = (value, fn)=>void 0 === value ? void 0 : fn(value), nestedArray = (value, fn)=>fn(Array.isArray(value) ? value : []), optionalNestedArray = (value, fn)=>Array.isArray(value) ? fn(value) : void 0, cloneObject = (value)=>({
8951
+ })), nestedConfig = (value, fn)=>fn(void 0 === value ? {} : value), optionalNestedConfig = (value, fn)=>void 0 === value ? void 0 : fn(value), nestedArray = (value, fn)=>fn(Array.isArray(value) ? value : []), optionalNestedArray = (value, fn)=>Array.isArray(value) ? fn(value) : void 0, cloneObject = (value)=>({
8430
8952
  ...value
8431
8953
  }), keyedNestedConfig = (value, fn, customKeys)=>{
8432
8954
  let result = void 0 === value ? {} : Object.keys(value).reduce((obj, key)=>(obj[key] = (customKeys && key in customKeys ? customKeys[key] : fn)(value[key]), obj), {});
@@ -8441,12 +8963,10 @@ function __from_binding_runtime_globals(runtimeRequirements, compilerRuntimeGlob
8441
8963
  function __to_binding_runtime_globals(runtimeRequirements, compilerRuntimeGlobals) {
8442
8964
  let res = {
8443
8965
  value: []
8444
- }, reversedCompilerRuntimeGlobals = Object.fromEntries(Object.entries(compilerRuntimeGlobals).map(([key, value])=>[
8445
- value,
8446
- key
8447
- ]));
8448
- for (let flag of Array.from(runtimeRequirements)){
8449
- 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);
8450
8970
  'string' == typeof item ? res.value.push(item) : res.value.push(flag);
8451
8971
  }
8452
8972
  return res;
@@ -8486,171 +9006,177 @@ function renderRuntimeVariables(variable, compilerOptions) {
8486
9006
  return '__webpack_exec__';
8487
9007
  }
8488
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
+ }
8489
9177
  function createCompilerRuntimeGlobals(compilerOptions) {
8490
9178
  let res = {};
8491
- for (let key of Object.keys(RuntimeGlobals_RuntimeGlobals))res[key] = function(runtimeGlobals, _compilerOptions) {
8492
- 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);
8493
- switch(runtimeGlobals){
8494
- case 0:
8495
- return usesRuntimeContext ? `${context_name}.r` : require_name;
8496
- case 1:
8497
- return usesRuntimeContext ? context_name : `${require_name}.*`;
8498
- case 2:
8499
- return exports_name;
8500
- case 3:
8501
- return "top-level-this-exports";
8502
- case 4:
8503
- return "return-exports-from-runtime";
8504
- case 5:
8505
- return "module";
8506
- case 6:
8507
- return "module.id";
8508
- case 7:
8509
- return "module.loaded";
8510
- case 8:
8511
- return `${scope_name}.p`;
8512
- case 9:
8513
- return `${scope_name}.s`;
8514
- case 10:
8515
- return `${scope_name}.c`;
8516
- case 77:
8517
- return `${scope_name}.zD`;
8518
- case 11:
8519
- return `${scope_name}.m`;
8520
- case 12:
8521
- return `${scope_name}.m (add only)`;
8522
- case 13:
8523
- return `${scope_name}.e`;
8524
- case 14:
8525
- return `${scope_name}.f`;
8526
- case 15:
8527
- return `${scope_name}.f (include entries)`;
8528
- case 16:
8529
- return `${scope_name}.E`;
8530
- case 17:
8531
- return `${scope_name}.F`;
8532
- case 18:
8533
- return `${scope_name}.G`;
8534
- case 19:
8535
- return `${scope_name}.H`;
8536
- case 20:
8537
- return `${scope_name}.d`;
8538
- case 21:
8539
- return usesRuntimeContext ? `${context_name}.N` : `${require_name}.r`;
8540
- case 22:
8541
- return `${scope_name}.t`;
8542
- case 23:
8543
- return `${scope_name}.n`;
8544
- case 24:
8545
- return `${scope_name}.hmd`;
8546
- case 25:
8547
- return `${scope_name}.nmd`;
8548
- case 26:
8549
- return `${scope_name}.h`;
8550
- case 27:
8551
- return `${scope_name}.w`;
8552
- case 28:
8553
- return `${scope_name}.v`;
8554
- case 29:
8555
- return `${scope_name}.vs`;
8556
- case 30:
8557
- return `${scope_name}.oe`;
8558
- case 31:
8559
- return `${scope_name}.nc`;
8560
- case 32:
8561
- return `${scope_name}.l`;
8562
- case 33:
8563
- return `${scope_name}.ts`;
8564
- case 34:
8565
- return `${scope_name}.tu`;
8566
- case 35:
8567
- return `${scope_name}.tt`;
8568
- case 36:
8569
- return "has fetch priority";
8570
- case 37:
8571
- return `${scope_name}.cn`;
8572
- case 38:
8573
- return `${scope_name}.j`;
8574
- case 39:
8575
- return `${scope_name}.u`;
8576
- case 40:
8577
- return `${scope_name}.k`;
8578
- case 41:
8579
- return `${scope_name}.rv`;
8580
- case 42:
8581
- return "has css modules";
8582
- case 43:
8583
- return `${scope_name}.ruid`;
8584
- case 44:
8585
- return `${scope_name}.hu`;
8586
- case 45:
8587
- return `${scope_name}.hk`;
8588
- case 46:
8589
- return `${scope_name}.x`;
8590
- case 47:
8591
- return `${scope_name}.x (no default handler)`;
8592
- case 48:
8593
- return `${scope_name}.x (only after)`;
8594
- case 49:
8595
- return `${scope_name}.x (only before)`;
8596
- case 50:
8597
- return "global chunk callback";
8598
- case 51:
8599
- return `${scope_name}.X`;
8600
- case 52:
8601
- return `${scope_name}.x (chunk dependencies)`;
8602
- case 53:
8603
- return `${scope_name}.O`;
8604
- case 54:
8605
- return `${scope_name}.C`;
8606
- case 55:
8607
- return `${scope_name}.i`;
8608
- case 56:
8609
- return `${scope_name}.g`;
8610
- case 57:
8611
- return `${scope_name}.S`;
8612
- case 58:
8613
- return `${scope_name}.I`;
8614
- case 59:
8615
- return `${scope_name}.R`;
8616
- case 60:
8617
- return `${scope_name}.hmrF`;
8618
- case 61:
8619
- return `${scope_name}.hmrM`;
8620
- case 62:
8621
- return `${scope_name}.hmrC`;
8622
- case 63:
8623
- return `${scope_name}.hmrD`;
8624
- case 64:
8625
- return `${scope_name}.hmrI`;
8626
- case 65:
8627
- return `${scope_name}.hmrS`;
8628
- case 66:
8629
- return `${scope_name}.amdD`;
8630
- case 67:
8631
- return `${scope_name}.amdO`;
8632
- case 68:
8633
- return `${scope_name}.System`;
8634
- case 69:
8635
- return `${scope_name}.o`;
8636
- case 70:
8637
- return `${scope_name}.y`;
8638
- case 71:
8639
- return `${scope_name}.b`;
8640
- case 72:
8641
- return `${scope_name}.U`;
8642
- case 73:
8643
- return `${scope_name}.a`;
8644
- case 74:
8645
- return `${scope_name}.aE`;
8646
- case 75:
8647
- return `${scope_name}.z`;
8648
- case 76:
8649
- return `${scope_name}.zS`;
8650
- default:
8651
- return '';
8652
- }
8653
- }(RuntimeGlobals_RuntimeGlobals[key], compilerOptions);
9179
+ for (let key of Object.keys(RuntimeGlobals_RuntimeGlobals))res[key] = renderRuntimeGlobals(RuntimeGlobals_RuntimeGlobals[key], compilerOptions);
8654
9180
  return res;
8655
9181
  }
8656
9182
  let DefaultRuntimeGlobals = createCompilerRuntimeGlobals();
@@ -8944,7 +9470,7 @@ class Cache {
8944
9470
  endIdle: new AsyncParallelHook([]),
8945
9471
  shutdown: new AsyncParallelHook([])
8946
9472
  };
8947
- let { JsCache } = rspackRequire("@rspack/binding");
9473
+ let { JsCache } = rspackRequire("@ohos-ports/rspack-binding");
8948
9474
  this.#binding = new JsCache();
8949
9475
  }
8950
9476
  static __to_binding(cache) {
@@ -9228,8 +9754,9 @@ class MultiStats {
9228
9754
  let { children: childrenOptions, ...baseOptions } = 'string' == typeof options || 'boolean' == typeof options ? {
9229
9755
  preset: options
9230
9756
  } : options ?? {}, children = this.stats.map((stat, idx)=>{
9757
+ if ('boolean' == typeof options) return stat.compilation.createStatsOptions(options, context);
9231
9758
  let childOptions = Array.isArray(childrenOptions) ? childrenOptions[idx] : childrenOptions;
9232
- return stat.compilation.createStatsOptions({
9759
+ return 'boolean' == typeof childOptions ? stat.compilation.createStatsOptions(childOptions, context) : stat.compilation.createStatsOptions({
9233
9760
  ...baseOptions,
9234
9761
  ...'string' == typeof childOptions ? {
9235
9762
  preset: childOptions
@@ -9244,7 +9771,7 @@ class MultiStats {
9244
9771
  warnings: children.every((o)=>o.warnings),
9245
9772
  children,
9246
9773
  context: '',
9247
- version: ''
9774
+ version: children.every((o)=>o.version)
9248
9775
  };
9249
9776
  }
9250
9777
  toJson(options) {
@@ -9254,7 +9781,7 @@ class MultiStats {
9254
9781
  obj.children = this.stats.map((stat, idx)=>{
9255
9782
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
9256
9783
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
9257
- }), childOptions.version && (obj.rspackVersion = "2.2.9", 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(''));
9258
9785
  let mapError = (j, obj)=>({
9259
9786
  ...obj,
9260
9787
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -9376,8 +9903,8 @@ let util_ArrayQueue = class {
9376
9903
  }
9377
9904
  }
9378
9905
  *[ArrayQueue_computedKey]() {
9379
- yield* this._list;
9380
9906
  for(let i = this._listReversed.length - 1; i >= 0; i--)yield this._listReversed[i];
9907
+ yield* this._list;
9381
9908
  }
9382
9909
  };
9383
9910
  class MultiCompiler {
@@ -9389,7 +9916,7 @@ class MultiCompiler {
9389
9916
  watching;
9390
9917
  constructor(compilers, options){
9391
9918
  let normalizedCompilers;
9392
- normalizedCompilers = Array.isArray(compilers) ? compilers : Object.entries(compilers).map(([name, compiler])=>(compiler.name = name, compiler)), this.hooks = {
9919
+ normalizedCompilers = Array.isArray(compilers) ? compilers : Object.entries(compilers).map(([name, compiler])=>(compiler.name = name, compiler.compilerPath = name, compiler)), this.hooks = {
9393
9920
  done: new SyncHook([
9394
9921
  'stats'
9395
9922
  ]),
@@ -9426,7 +9953,7 @@ class MultiCompiler {
9426
9953
  }
9427
9954
  get outputPath() {
9428
9955
  let commonPath = this.compilers[0].outputPath;
9429
- 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(/[/\\][^/\\]*$/, '');
9430
9957
  return commonPath || '/' !== this.compilers[0].outputPath[0] ? commonPath : '/';
9431
9958
  }
9432
9959
  get inputFileSystem() {
@@ -9588,17 +10115,37 @@ let filterToFunction = (item)=>{
9588
10115
  log: 2,
9589
10116
  true: 2,
9590
10117
  verbose: 1
9591
- };
10118
+ }, internalCallbacks = new WeakSet(), consumeWatcherInfo = Symbol('consumeWatcherInfo'), EXISTENCE_ONLY_TIME_ENTRY = Object.freeze({}), memoizeTimeInfoEntries = (snapshot, key)=>memoize(()=>(({ entries: rows, missing })=>{
10119
+ let entries = new Map();
10120
+ for (let row of rows)if (row.existenceOnly) entries.set(row.path, EXISTENCE_ONLY_TIME_ENTRY);
10121
+ else {
10122
+ let entry = {
10123
+ safeTime: row.safeTime
10124
+ };
10125
+ null != row.timestamp && (entry.timestamp = row.timestamp), null != row.accuracy && (entry.accuracy = row.accuracy), entries.set(row.path, entry);
10126
+ }
10127
+ for (let path of missing)entries.set(path, null);
10128
+ return entries;
10129
+ })(snapshot[key]));
9592
10130
  class NativeWatcherShim extends EventEmitter {
9593
- #trigger;
9594
- constructor(trigger){
9595
- super(), this.#trigger = trigger;
10131
+ #fileSystem;
10132
+ constructor(fileSystem){
10133
+ super(), this.#fileSystem = fileSystem;
9596
10134
  }
9597
10135
  _onChange(item, _mtime, file, _type) {
9598
- this.#trigger('change', file ?? item);
10136
+ this.#fileSystem.triggerEvent('change', file ?? item);
9599
10137
  }
9600
10138
  _onRemove(item, file, _type) {
9601
- this.#trigger('remove', file ?? item);
10139
+ this.#fileSystem.triggerEvent('remove', file ?? item);
10140
+ }
10141
+ getTimes() {
10142
+ return this.#fileSystem.getTimes();
10143
+ }
10144
+ getTimeInfoEntries() {
10145
+ return this.#fileSystem.getTimeInfoEntries();
10146
+ }
10147
+ collectTimeInfoEntries(fileTimestamps, directoryTimestamps) {
10148
+ this.#fileSystem.collectTimeInfoEntries(fileTimestamps, directoryTimestamps);
9602
10149
  }
9603
10150
  }
9604
10151
  class NativeWatchFileSystem {
@@ -9619,8 +10166,8 @@ class NativeWatchFileSystem {
9619
10166
  if ('function' != typeof callback) throw Error("Invalid arguments: 'callback'");
9620
10167
  if ('object' != typeof options) throw Error("Invalid arguments: 'options'");
9621
10168
  if ('function' != typeof callbackUndelayed && callbackUndelayed) throw Error("Invalid arguments: 'callbackUndelayed'");
9622
- let nativeWatcher = this.getNativeWatcher(options), watcher = new NativeWatcherShim((kind, path)=>this.#inner?.triggerEvent(kind, path));
9623
- return this.#watcher = watcher, nativeWatcher.watch(this.formatWatchDependencies(files), this.formatWatchDependencies(directories), this.formatWatchDependencies(missing), BigInt(startTime), (err, result)=>{
10169
+ let nativeWatcher = this.getNativeWatcher(options), watcher = new NativeWatcherShim(this);
10170
+ this.#watcher = watcher, nativeWatcher.watch(this.formatWatchDependencies(files), this.formatWatchDependencies(directories), this.formatWatchDependencies(missing), BigInt(startTime), (err, result)=>{
9624
10171
  if (err) return void callback(err, new Map(), new Map(), new Set(), new Set());
9625
10172
  nativeWatcher.pause();
9626
10173
  let changedFiles = result.changedFiles, removedFiles = result.removedFiles;
@@ -9630,13 +10177,35 @@ class NativeWatchFileSystem {
9630
10177
  for (let item of removedFiles)fs.purge?.(item);
9631
10178
  }
9632
10179
  let changes = new Set(changedFiles), removals = new Set(removedFiles);
9633
- this.#events.emit('aggregated', changes, removals), watcher.emit('aggregated', changes, removals), callback(err, new Map(), new Map(), changes, removals);
10180
+ if (this.#events.emit('aggregated', changes, removals), watcher.emit('aggregated', changes, removals), internalCallbacks.has(callback)) return void callback(null, void 0, void 0, changes, removals);
10181
+ let { fileTimeInfoEntries, contextTimeInfoEntries } = this.#fetchTimeInfo(nativeWatcher);
10182
+ callback(err, fileTimeInfoEntries, contextTimeInfoEntries, changes, removals);
9634
10183
  }, (event)=>{
9635
10184
  if ('change' === event.kind) {
9636
- let mtime = Date.now();
9637
- callbackUndelayed(event.path, mtime), this.#events.emit('change', event.path, mtime), watcher.emit('change', event.path, mtime);
9638
- } else this.#events.emit('remove', event.path), watcher.emit('remove', event.path);
9639
- }), this.#isFirstWatch = !1, {
10185
+ let changeTime = Date.now(), mtime = null === event.mtime ? null : changeTime;
10186
+ callbackUndelayed(event.path, changeTime), this.#events.emit('change', event.path, mtime), watcher.emit('change', event.path, mtime);
10187
+ } else callbackUndelayed(event.path, Date.now()), this.#events.emit('remove', event.path), watcher.emit('remove', event.path);
10188
+ }), this.#isFirstWatch = !1;
10189
+ let info = ({ changedFiles, removedFiles })=>{
10190
+ let changes = new Set(changedFiles), removals = new Set(removedFiles);
10191
+ if (this.#inputFileSystem?.purge) {
10192
+ let fs = this.#inputFileSystem;
10193
+ for (let item of removals)fs.purge?.(item);
10194
+ for (let item of changes)fs.purge?.(item);
10195
+ }
10196
+ let timeInfo = this.#fetchTimeInfo(nativeWatcher);
10197
+ return {
10198
+ changes,
10199
+ removals,
10200
+ get fileTimeInfoEntries () {
10201
+ return timeInfo.fileTimeInfoEntries;
10202
+ },
10203
+ get contextTimeInfoEntries () {
10204
+ return timeInfo.contextTimeInfoEntries;
10205
+ }
10206
+ };
10207
+ };
10208
+ return {
9640
10209
  close: ()=>{
9641
10210
  this.#inner === nativeWatcher && (this.#inner = void 0, this.#isFirstWatch = !0), nativeWatcher.close().catch((err)=>{
9642
10211
  console.error('Error closing native watcher:', err);
@@ -9645,14 +10214,41 @@ class NativeWatchFileSystem {
9645
10214
  pause: ()=>{
9646
10215
  nativeWatcher.pause();
9647
10216
  },
9648
- getInfo: ()=>({
9649
- changes: new Set(),
9650
- removals: new Set(),
9651
- fileTimeInfoEntries: new Map(),
9652
- contextTimeInfoEntries: new Map()
9653
- })
10217
+ getInfo: ()=>info(nativeWatcher.peekAggregated()),
10218
+ [consumeWatcherInfo]: ()=>info(nativeWatcher.getAggregated())
9654
10219
  };
9655
10220
  }
10221
+ #fetchTimeInfo(nativeWatcher) {
10222
+ let snapshot = nativeWatcher.collectTimeInfoEntries(), files = memoizeTimeInfoEntries(snapshot, 'fileTimestamps'), directories = memoizeTimeInfoEntries(snapshot, 'directoryTimestamps');
10223
+ return {
10224
+ get fileTimeInfoEntries () {
10225
+ return files();
10226
+ },
10227
+ get contextTimeInfoEntries () {
10228
+ return directories();
10229
+ }
10230
+ };
10231
+ }
10232
+ getTimes() {
10233
+ let times = Object.create(null);
10234
+ if (!this.#inner) return times;
10235
+ let { fileTimestamps, directoryTimestamps } = this.#inner.collectTimeInfoEntries();
10236
+ for (let row of fileTimestamps.entries)row.existenceOnly || (times[row.path] = Math.max(row.safeTime, row.timestamp ?? row.safeTime));
10237
+ for (let path of fileTimestamps.missing)times[path] = null;
10238
+ for (let row of directoryTimestamps.entries)times[row.path] = row.safeTime ?? null;
10239
+ for (let path of directoryTimestamps.missing)times[path] = null;
10240
+ return times;
10241
+ }
10242
+ getTimeInfoEntries() {
10243
+ let entries = new Map();
10244
+ return this.collectTimeInfoEntries(entries, entries), entries;
10245
+ }
10246
+ collectTimeInfoEntries(fileTimestamps, directoryTimestamps) {
10247
+ if (!this.#inner) return;
10248
+ let { fileTimeInfoEntries, contextTimeInfoEntries } = this.#fetchTimeInfo(this.#inner);
10249
+ for (let [path, entry] of fileTimeInfoEntries)null === entry && fileTimestamps.has(path) || fileTimestamps.set(path, entry);
10250
+ for (let [path, entry] of contextTimeInfoEntries)(null === entry || entry === EXISTENCE_ONLY_TIME_ENTRY) && directoryTimestamps.has(path) || directoryTimestamps.set(path, entry);
10251
+ }
9656
10252
  getNativeWatcher(options) {
9657
10253
  if (this.#inner) return this.#inner;
9658
10254
  let nativeWatcherOptions = {
@@ -9691,7 +10287,7 @@ class NativeWatchFileSystem {
9691
10287
  ];
9692
10288
  }
9693
10289
  }
9694
- let internalCallbacks = new WeakSet();
10290
+ let isExistenceOnlyEntry = (entry)=>'object' == typeof entry && null !== entry && !('safeTime' in entry);
9695
10291
  class NodeWatchFileSystem {
9696
10292
  inputFileSystem;
9697
10293
  watcherOptions;
@@ -9781,6 +10377,19 @@ class NodeWatchFileSystem {
9781
10377
  }
9782
10378
  };
9783
10379
  }
10380
+ getTimes() {
10381
+ return this.watcher?.getTimes() ?? {};
10382
+ }
10383
+ getTimeInfoEntries() {
10384
+ let entries = new Map(), watcher = this.watcher;
10385
+ if (!watcher) return entries;
10386
+ let contextEntries = new Map();
10387
+ for (let [path, entry] of (watcher.collectTimeInfoEntries(entries, contextEntries), contextEntries))(null === entry || isExistenceOnlyEntry(entry)) && entries.has(path) || entries.set(path, entry);
10388
+ return entries;
10389
+ }
10390
+ collectTimeInfoEntries(fileTimestamps, directoryTimestamps) {
10391
+ this.watcher?.collectTimeInfoEntries(fileTimestamps, directoryTimestamps);
10392
+ }
9784
10393
  on(event, listener) {
9785
10394
  return this.#events.on(event, listener), this;
9786
10395
  }
@@ -9816,8 +10425,8 @@ let arraySum = (array)=>{
9816
10425
  let str = `${a}`, length = lengths[i];
9817
10426
  return str.length === length ? str : length > 5 ? `...${str.slice(-length + 3)}` : length > 0 ? str.slice(-length) : '';
9818
10427
  });
9819
- };
9820
- var CachedInputFileSystem_default = compatGetDefaultExport(rspackRequire("../../node_modules/.pnpm/enhanced-resolve@5.26.0/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);
9821
10430
  class NodeEnvironmentPlugin {
9822
10431
  options;
9823
10432
  constructor(options){
@@ -10137,12 +10746,13 @@ let iterateConfig = (config, options, fn)=>{
10137
10746
  for(; i < errors.length; i++){
10138
10747
  let error = errors[i];
10139
10748
  if ('string' != typeof error && error.details) {
10140
- if ((fullLength += error.details.split('\n').length) > max) {
10749
+ let splitted = error.details.split('\n');
10750
+ if ((fullLength += splitted.length) > max) {
10141
10751
  result = i > 0 ? errors.slice(0, i) : [];
10142
10752
  let overLimit = fullLength - max + 1, error = errors[i++];
10143
10753
  for(result.push({
10144
10754
  ...error,
10145
- details: error.details.split('\n').slice(0, -overLimit).join('\n'),
10755
+ details: splitted.slice(0, -overLimit).join('\n'),
10146
10756
  filteredDetails: overLimit
10147
10757
  }), filtered = errors.length - i; i < errors.length; i++){
10148
10758
  let error = errors[i];
@@ -10352,7 +10962,7 @@ let iterateConfig = (config, options, fn)=>{
10352
10962
  }), (groupModulesByPath || groupModulesByExtension) && groupConfigs.push({
10353
10963
  getKeys: (module)=>{
10354
10964
  if (!module.name) return;
10355
- 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);
10356
10966
  if (dataUrl) return [
10357
10967
  dataUrl[0]
10358
10968
  ];
@@ -10581,8 +11191,12 @@ let iterateConfig = (config, options, fn)=>{
10581
11191
  hash: (object, compilation, context)=>{
10582
11192
  object.hash = context.getStatsCompilation(compilation).hash;
10583
11193
  },
11194
+ cacheInfo: (object, compilation, context)=>{
11195
+ let { cacheInfo } = context.getStatsCompilation(compilation);
11196
+ cacheInfo && (object.cacheInfo = Object.fromEntries(Object.entries(cacheInfo).sort(([a], [b])=>a.localeCompare(b))));
11197
+ },
10584
11198
  version: (object)=>{
10585
- object.version = "5.75.0", object.rspackVersion = "2.2.9";
11199
+ object.version = "5.75.0", object.rspackVersion = "2.3.4";
10586
11200
  },
10587
11201
  env: (object, _compilation, _context, { _env })=>{
10588
11202
  object.env = _env;
@@ -10654,7 +11268,7 @@ let iterateConfig = (config, options, fn)=>{
10654
11268
  },
10655
11269
  errors: (object, compilation, context, options, factory)=>{
10656
11270
  let { type, cachedGetErrors } = context, rawErrors = cachedGetErrors(compilation), factorizedErrors = factory.create(`${type}.errors`, cachedGetErrors(compilation), context), filtered = 0;
10657
- 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)) {
10658
11272
  object.errors = factorizedErrors, filtered && (object.filteredErrorDetailsCount = filtered);
10659
11273
  return;
10660
11274
  }
@@ -10666,7 +11280,7 @@ let iterateConfig = (config, options, fn)=>{
10666
11280
  },
10667
11281
  warnings: (object, compilation, context, options, factory)=>{
10668
11282
  let { type, cachedGetWarnings } = context, rawWarnings = factory.create(`${type}.warnings`, cachedGetWarnings(compilation), context), filtered = 0;
10669
- 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)) {
10670
11284
  object.warnings = rawWarnings, filtered && (object.filteredWarningDetailsCount = filtered);
10671
11285
  return;
10672
11286
  }
@@ -10983,6 +11597,7 @@ let applyDefaults = (options, defaults)=>{
10983
11597
  }, 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 = {
10984
11598
  performance: NORMAL_ON,
10985
11599
  hash: OFF_FOR_TO_STRING,
11600
+ cacheInfo: NORMAL_OFF,
10986
11601
  env: NORMAL_OFF,
10987
11602
  version: NORMAL_ON,
10988
11603
  timings: NORMAL_ON,
@@ -11121,7 +11736,7 @@ let DefaultStatsPrinterPlugin_plural = (n, singular, plural)=>1 === n ? singular
11121
11736
  'compilation.namedChunkGroups': (namedChunkGroups, context, printer)=>{
11122
11737
  if (!Array.isArray(namedChunkGroups)) {
11123
11738
  let { compilation: { entrypoints } } = context, chunkGroups = Object.values(namedChunkGroups);
11124
- 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, {
11125
11740
  ...context,
11126
11741
  chunkGroupKind: 'Chunk Group'
11127
11742
  });
@@ -11548,7 +12163,12 @@ let DefaultStatsPrinterPlugin_plural = (n, singular, plural)=>1 === n ? singular
11548
12163
  'compilation.children': (items)=>DefaultStatsPrinterPlugin_indent(itemsJoinMoreSpacing(items), ' '),
11549
12164
  'moduleTraceItem.dependencies': itemsJoinOneLine,
11550
12165
  'loggingEntry.children': (items)=>DefaultStatsPrinterPlugin_indent(items.filter(Boolean).join('\n'), ' ', !1)
11551
- }, 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)=>{
11552
12172
  let rem = str.replace(/\n([^\n])/g, `\n${prefix}$1`);
11553
12173
  return noPrefixInFirstLine ? rem : ('\n' === str[0] ? '' : prefix) + rem;
11554
12174
  }, joinExplicitNewLine = (items, indenter)=>{
@@ -11683,15 +12303,15 @@ let DefaultStatsPrinterPlugin_plural = (n, singular, plural)=>1 === n ? singular
11683
12303
  formatFlag: (flag)=>`[${flag}]`,
11684
12304
  formatLayer: (layer)=>`(in ${layer})`,
11685
12305
  formatSize: (size)=>{
11686
- if ('number' != typeof size || Number.isNaN(size)) return 'unknown size';
12306
+ if ('number' != typeof size || !Number.isFinite(size)) return 'unknown size';
11687
12307
  if (size <= 0) return '0 bytes';
11688
- let index = Math.floor(Math.log(size) / Math.log(1024));
11689
- return `${+(size / 1024 ** index).toPrecision(3)} ${[
12308
+ let abbreviations = [
11690
12309
  'bytes',
11691
12310
  'KiB',
11692
12311
  'MiB',
11693
12312
  'GiB'
11694
- ][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]}`;
11695
12315
  },
11696
12316
  formatDateTime: (dateTime, { bold })=>{
11697
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())}`;
@@ -11829,10 +12449,12 @@ class RspackOptionsApply {
11829
12449
  if (runtimeChunk && new RuntimeChunkPlugin(runtimeChunk).apply(compiler), options.optimization.emitOnErrors || new NoEmitOnErrorsPlugin().apply(compiler), options.devtool) if (options.devtool.includes('source-map')) {
11830
12450
  let hidden = options.devtool.includes('hidden'), inline = options.devtool.includes('inline'), evalWrapped = options.devtool.includes('eval'), cheap = options.devtool.includes('cheap'), moduleMaps = options.devtool.includes('module'), noSources = options.devtool.includes('nosources'), debugIds = options.devtool.includes('debugids');
11831
12451
  new (evalWrapped ? EvalSourceMapDevToolPlugin : SourceMapDevToolPlugin)({
11832
- filename: inline ? null : options.output.sourceMapFilename,
12452
+ ...evalWrapped ? {} : {
12453
+ filename: inline ? null : options.output.sourceMapFilename,
12454
+ fallbackModuleFilenameTemplate: options.output.devtoolFallbackModuleFilenameTemplate,
12455
+ append: !hidden && void 0
12456
+ },
11833
12457
  moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
11834
- fallbackModuleFilenameTemplate: options.output.devtoolFallbackModuleFilenameTemplate,
11835
- append: !hidden && void 0,
11836
12458
  module: !!moduleMaps || !cheap,
11837
12459
  test: evalWrapped ? void 0 : /\.((c|m)?js|css)($|\?)/i,
11838
12460
  columns: !cheap,
@@ -11844,7 +12466,7 @@ class RspackOptionsApply {
11844
12466
  moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
11845
12467
  namespace: options.output.devtoolNamespace
11846
12468
  }).apply(compiler);
11847
- 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(options.experiments.pureFunctions && !0 === options.optimization.sideEffects).apply(compiler), options.optimization.providedExports && new FlagDependencyExportsPlugin().apply(compiler), 'production' === options.mode && new CircularModulesInfoPlugin().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);
12469
+ 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), options.experiments.deferImport && new ImportedByDeferModulesPlugin().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(options.experiments.pureFunctions && !0 === options.optimization.sideEffects).apply(compiler), options.optimization.providedExports && new FlagDependencyExportsPlugin().apply(compiler), 'production' === options.mode && new CircularModulesInfoPlugin().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);
11848
12470
  let enableLibSplitChunks = !1;
11849
12471
  if (options.output.enabledLibraryTypes && options.output.enabledLibraryTypes.length > 0) {
11850
12472
  let hasModernModule = options.output.enabledLibraryTypes.includes('modern-module'), hasNonModernModule = options.output.enabledLibraryTypes.some((t)=>'modern-module' !== t);
@@ -11922,7 +12544,19 @@ function validateRspackConfig(config) {
11922
12544
  let library = output?.library;
11923
12545
  if (!('object' == typeof library && 'type' in library && 'umd' === library.type) || void 0 !== externalsType && 'umd' !== externalsType) return;
11924
12546
  let checkExternalItem = (externalItem)=>{
11925
- if ('object' == typeof externalItem && null !== externalItem) for (let value of Object.values(externalItem))checkExternalItemValue(value);
12547
+ if ('object' == typeof externalItem && null !== externalItem) {
12548
+ let { byLayer } = externalItem;
12549
+ if ('function' != typeof byLayer) {
12550
+ if (byLayer && 'object' == typeof byLayer) {
12551
+ for (let layer of [
12552
+ 'default',
12553
+ ...Object.keys(byLayer)
12554
+ ])checkExternalItem(resolveLayerExternals(externalItem, layer));
12555
+ return;
12556
+ }
12557
+ for (let [request, value] of Object.entries(externalItem))'byLayer' !== request && checkExternalItemValue(value);
12558
+ }
12559
+ }
11926
12560
  }, checkExternalItemValue = (value)=>{
11927
12561
  if (value && 'object' == typeof value && [
11928
12562
  'root',
@@ -12003,148 +12637,6 @@ class CodeGenerationResult {
12003
12637
  return this.#inner.sources[sourceType];
12004
12638
  }
12005
12639
  }
12006
- class ContextModuleFactoryBeforeResolveData {
12007
- #inner;
12008
- static __from_binding(binding) {
12009
- return new ContextModuleFactoryBeforeResolveData(binding);
12010
- }
12011
- static __to_binding(data) {
12012
- return data.#inner;
12013
- }
12014
- constructor(binding){
12015
- this.#inner = binding, Object.defineProperties(this, {
12016
- context: {
12017
- enumerable: !0,
12018
- get: ()=>binding.context,
12019
- set (val) {
12020
- binding.context = val;
12021
- }
12022
- },
12023
- request: {
12024
- enumerable: !0,
12025
- get: ()=>binding.request,
12026
- set (val) {
12027
- binding.request = val;
12028
- }
12029
- },
12030
- regExp: {
12031
- enumerable: !0,
12032
- get: ()=>binding.regExp,
12033
- set (val) {
12034
- binding.regExp = val;
12035
- }
12036
- },
12037
- recursive: {
12038
- enumerable: !0,
12039
- get: ()=>binding.recursive,
12040
- set (val) {
12041
- binding.recursive = val;
12042
- }
12043
- }
12044
- });
12045
- }
12046
- }
12047
- class ContextModuleFactoryAfterResolveData {
12048
- #inner;
12049
- static __from_binding(binding) {
12050
- return new ContextModuleFactoryAfterResolveData(binding);
12051
- }
12052
- static __to_binding(data) {
12053
- return data.#inner;
12054
- }
12055
- constructor(binding){
12056
- this.#inner = binding, Object.defineProperties(this, {
12057
- resource: {
12058
- enumerable: !0,
12059
- get: ()=>binding.resource,
12060
- set (val) {
12061
- binding.resource = val;
12062
- }
12063
- },
12064
- context: {
12065
- enumerable: !0,
12066
- get: ()=>binding.context,
12067
- set (val) {
12068
- binding.context = val;
12069
- }
12070
- },
12071
- request: {
12072
- enumerable: !0,
12073
- get: ()=>binding.request,
12074
- set (val) {
12075
- binding.request = val;
12076
- }
12077
- },
12078
- regExp: {
12079
- enumerable: !0,
12080
- get: ()=>binding.regExp,
12081
- set (val) {
12082
- binding.regExp = val;
12083
- }
12084
- },
12085
- recursive: {
12086
- enumerable: !0,
12087
- get: ()=>binding.recursive,
12088
- set (val) {
12089
- binding.recursive = val;
12090
- }
12091
- },
12092
- dependencies: {
12093
- enumerable: !0,
12094
- get: ()=>binding.dependencies
12095
- }
12096
- });
12097
- }
12098
- }
12099
- Object.defineProperty(binding__default().Module.prototype, 'identifier', {
12100
- enumerable: !0,
12101
- configurable: !0,
12102
- value () {
12103
- return this[binding__default().MODULE_IDENTIFIER_SYMBOL];
12104
- }
12105
- }), Object.defineProperty(binding__default().Module.prototype, 'originalSource', {
12106
- enumerable: !0,
12107
- configurable: !0,
12108
- value () {
12109
- let originalSource = this._originalSource();
12110
- return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
12111
- }
12112
- }), Object.defineProperty(binding__default().Module.prototype, 'emitFile', {
12113
- enumerable: !0,
12114
- configurable: !0,
12115
- value (filename, source, assetInfo) {
12116
- return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
12117
- }
12118
- }), Object.defineProperty(binding__default().ExternalModule.prototype, 'identifier', {
12119
- enumerable: !0,
12120
- configurable: !0,
12121
- value () {
12122
- return this[binding__default().MODULE_IDENTIFIER_SYMBOL];
12123
- }
12124
- }), Object.defineProperty(binding__default().ExternalModule.prototype, 'originalSource', {
12125
- enumerable: !0,
12126
- configurable: !0,
12127
- value () {
12128
- let originalSource = this._originalSource();
12129
- return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
12130
- }
12131
- }), Object.defineProperty(binding__default().ExternalModule.prototype, 'emitFile', {
12132
- enumerable: !0,
12133
- configurable: !0,
12134
- value (filename, source, assetInfo) {
12135
- return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
12136
- }
12137
- });
12138
- let ExternalModule = binding__default().ExternalModule;
12139
- ExternalModule.getCompilationHooks = (compilation)=>{
12140
- if (!(binding__default().COMPILATION_HOOKS_MAP_SYMBOL in compilation)) throw TypeError("The 'compilation' argument must be an instance of Compilation");
12141
- return getOrCreateCompilationHooks(compilation, ExternalModule, ()=>({
12142
- chunkCondition: new SyncBailHook([
12143
- 'chunk',
12144
- 'compilation'
12145
- ])
12146
- }));
12147
- };
12148
12640
  let traceHookPlugin_PLUGIN_NAME = 'TraceHookPlugin', PLUGIN_PROCESS_NAME = 'Plugin Analysis', makeInterceptorFor = (compilerName, tracer)=>(hookName)=>({
12149
12641
  register: (tapInfo)=>{
12150
12642
  let { name, type, fn: internalFn } = tapInfo, newFn = name === traceHookPlugin_PLUGIN_NAME ? internalFn : makeNewTraceTapFn(compilerName, hookName, tracer, {
@@ -12276,7 +12768,7 @@ class TraceHookPlugin {
12276
12768
  });
12277
12769
  }
12278
12770
  }
12279
- let CORE_VERSION = "2.2.9", VFILES_BY_COMPILER = new WeakMap();
12771
+ let CORE_VERSION = "2.3.4", VFILES_BY_COMPILER = new WeakMap();
12280
12772
  class VirtualModulesPlugin {
12281
12773
  #staticModules;
12282
12774
  #compiler;
@@ -12391,7 +12883,7 @@ class Watching {
12391
12883
  #go(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles) {
12392
12884
  if (this.#initial = !1, void 0 === this.startTime && (this.startTime = Date.now()), this.running = !0, this.watcher ? (this.pausedWatcher = this.watcher, this.lastWatcherStartTime = Date.now(), this.watcher.pause(), this.watcher = void 0) : this.lastWatcherStartTime || (this.lastWatcherStartTime = Date.now()), fileTimeInfoEntries && contextTimeInfoEntries && changedFiles && removedFiles) this.#mergeWithCollected(changedFiles, removedFiles), this.compiler.fileTimestamps = fileTimeInfoEntries, this.compiler.contextTimestamps = contextTimeInfoEntries;
12393
12885
  else if (this.pausedWatcher) {
12394
- let { changes, removals, fileTimeInfoEntries, contextTimeInfoEntries } = this.pausedWatcher.getInfo();
12886
+ let watcher = this.pausedWatcher, { changes, removals, fileTimeInfoEntries, contextTimeInfoEntries } = watcher[consumeWatcherInfo]?.() ?? watcher.getInfo();
12395
12887
  this.#mergeWithCollected(changes, removals), this.compiler.fileTimestamps = fileTimeInfoEntries, this.compiler.contextTimestamps = contextTimeInfoEntries;
12396
12888
  }
12397
12889
  this.compiler.modifiedFiles = this.#collectedChangedFiles, this.compiler.removedFiles = this.#collectedRemovedFiles, this.#collectedChangedFiles = void 0, this.#collectedRemovedFiles = void 0;
@@ -12642,7 +13134,7 @@ class Compiler {
12642
13134
  }, exports_namespaceObject, {
12643
13135
  RuntimeGlobals: createCompilerRuntimeGlobals(options)
12644
13136
  });
12645
- compilerRspack.rspack = compilerRspack, compilerRspack.webpack = compilerRspack, this.webpack = compilerRspack, this.rspack = compilerRspack, this.root = this, this.outputPath = '', this.inputFileSystem = null, this.intermediateFileSystem = null, this.outputFileSystem = null, this.watchFileSystem = null, this.records = {}, this.options = options, this.context = context, this.cache = new Cache(), this.compilerPath = '', this.running = !1, this.idle = !1, this.watchMode = !1, this.#platform = {
13137
+ compilerRspack.rspack = compilerRspack, compilerRspack.webpack = compilerRspack, this.webpack = compilerRspack, this.rspack = compilerRspack, this.root = this, this.outputPath = '', this.inputFileSystem = null, this.intermediateFileSystem = null, this.outputFileSystem = null, this.watchFileSystem = null, this.records = {}, this.options = options, this.context = context, this.cache = new Cache(), this.compilerPath = options.name || '', this.running = !1, this.idle = !1, this.watchMode = !1, this.#platform = {
12646
13138
  web: null,
12647
13139
  browser: null,
12648
13140
  webworker: null,
@@ -12692,7 +13184,7 @@ class Compiler {
12692
13184
  return this.#ruleSet;
12693
13185
  }
12694
13186
  getCache(name) {
12695
- return new lib_CacheFacade(this.cache, `${this.compilerPath}${name}`, this.options.output.hashFunction);
13187
+ return new lib_CacheFacade(this.cache, `${this.compilerPath}|${name}`, this.options.output.hashFunction);
12696
13188
  }
12697
13189
  #logInfrastructure(name, type, args) {
12698
13190
  void 0 === this.hooks.infrastructureLog.call(name, type, args) && this.infrastructureLogger?.(name, type, args);
@@ -12793,7 +13285,11 @@ class Compiler {
12793
13285
  };
12794
13286
  applyRspackOptionsDefaults(options);
12795
13287
  let childCompiler = new Compiler(this.context, options);
12796
- childCompiler.name = compilerName, childCompiler.outputPath = this.outputPath, childCompiler.inputFileSystem = this.inputFileSystem, childCompiler.outputFileSystem = null, childCompiler.modifiedFiles = this.modifiedFiles, childCompiler.removedFiles = this.removedFiles, childCompiler.fileTimestamps = this.fileTimestamps, childCompiler.contextTimestamps = this.contextTimestamps, childCompiler.fsStartTime = this.fsStartTime, childCompiler.cache = this.cache, childCompiler.compilerPath = `${this.compilerPath}${compilerName}|${compilerIndex}|`;
13288
+ childCompiler.name = compilerName, childCompiler.outputPath = this.outputPath, childCompiler.inputFileSystem = this.inputFileSystem, childCompiler.outputFileSystem = null, childCompiler.modifiedFiles = this.modifiedFiles, childCompiler.removedFiles = this.removedFiles, childCompiler.fileTimestamps = this.fileTimestamps, childCompiler.contextTimestamps = this.contextTimestamps, childCompiler.fsStartTime = this.fsStartTime, childCompiler.cache = this.cache, childCompiler.compilerPath = [
13289
+ this.compilerPath,
13290
+ compilerName,
13291
+ compilerIndex
13292
+ ].join('|');
12797
13293
  let relativeCompilerName = makePathsRelative(this.context, compilerName, this.root);
12798
13294
  if (this.records[relativeCompilerName] || (this.records[relativeCompilerName] = []), this.records[relativeCompilerName][compilerIndex] ? childCompiler.records = this.records[relativeCompilerName][compilerIndex] : this.records[relativeCompilerName].push(childCompiler.records = {}), childCompiler.parentCompilation = compilation, childCompiler.root = this.root, Array.isArray(plugins)) for (let plugin of plugins)plugin && plugin.apply(childCompiler);
12799
13295
  for(let hookName in childCompiler.#builtinPlugins = [
@@ -12821,7 +13317,7 @@ class Compiler {
12821
13317
  close ? close.then(()=>callback(error), (closeError)=>callback(error || closeError)) : callback(error);
12822
13318
  };
12823
13319
  this.hooks.shutdown.callAsync((err)=>{
12824
- if (err) return instanceCallback(err);
13320
+ if (err || this.isChild()) return instanceCallback(err);
12825
13321
  this.cache.shutdown(instanceCallback);
12826
13322
  });
12827
13323
  }
@@ -12861,22 +13357,22 @@ class Compiler {
12861
13357
  return this.#compilationParams = params, params;
12862
13358
  }
12863
13359
  #getInstance(callback) {
12864
- var output, snapshot;
12865
- let coreVersion, expectedCoreVersion, statsOptions, strategy, mode, experiments, cache, error = CORE_VERSION === binding__default().EXPECTED_RSPACK_CORE_VERSION || CORE_VERSION.includes('canary') ? null : Error((coreVersion = CORE_VERSION, expectedCoreVersion = binding__default().EXPECTED_RSPACK_CORE_VERSION, process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
13360
+ var output, cache, snapshot;
13361
+ let coreVersion, expectedCoreVersion, statsOptions, strategy, mode, experiments, cache1, error = CORE_VERSION === binding__default().EXPECTED_RSPACK_CORE_VERSION || CORE_VERSION.includes('canary') ? null : Error((coreVersion = CORE_VERSION, expectedCoreVersion = binding__default().EXPECTED_RSPACK_CORE_VERSION, process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
12866
13362
 
12867
13363
  Help:
12868
13364
  Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
12869
13365
  The expected version of @rspack/core to the current binding is ${expectedCoreVersion}.
12870
- ` : `Unmatched version @rspack/core@${coreVersion} and @rspack/binding@${expectedCoreVersion}.
13366
+ ` : `Unmatched version @rspack/core@${coreVersion} and @ohos-ports/rspack-binding@${expectedCoreVersion}.
12871
13367
 
12872
13368
  Help:
12873
- Please ensure the version of @rspack/binding and @rspack/core is the same.
13369
+ Please ensure the version of @ohos-ports/rspack-binding and @rspack/core is the same.
12874
13370
  The expected version of @rspack/core to the current binding is ${expectedCoreVersion}.
12875
13371
  `));
12876
13372
  if (error) return callback(error);
12877
13373
  if (this.#instance) return callback(null, this.#instance);
12878
13374
  let { options } = this;
12879
- this.#rawOptions = (mode = options.mode, experiments = options.experiments, cache = options.cache, {
13375
+ this.#rawOptions = (mode = options.mode, experiments = options.experiments, cache1 = options.cache, {
12880
13376
  name: options.name,
12881
13377
  mode,
12882
13378
  context: options.context,
@@ -12900,7 +13396,10 @@ Help:
12900
13396
  module: !!environment.module,
12901
13397
  optionalChaining: !!environment.optionalChaining,
12902
13398
  logicalAssignment: !!environment.logicalAssignment,
13399
+ spread: !!environment.spread,
13400
+ symbol: !!environment.symbol,
12903
13401
  templateLiteral: !!environment.templateLiteral,
13402
+ topLevelAwait: !!environment.topLevelAwait,
12904
13403
  importMetaDirnameAndFilename: !!environment.importMetaDirnameAndFilename
12905
13404
  };
12906
13405
  }(output.environment)
@@ -12946,53 +13445,31 @@ Help:
12946
13445
  return delete obj.preset, obj;
12947
13446
  }(options.stats)).colors ? isStatsColorSupported() : !!statsOptions.colors
12948
13447
  },
12949
- cache: function(cache) {
12950
- if (!1 === cache) return !1;
12951
- if ('memory' === cache.type) return {
12952
- type: cache.type
12953
- };
12954
- let toRawMemoryGenerations = (value)=>{
13448
+ cache: !1 !== (cache = cache1) && ('memory' === cache.type ? {
13449
+ type: cache.type
13450
+ } : {
13451
+ type: cache.type,
13452
+ buildDependencies: cache.buildDependencies,
13453
+ version: cache.version,
13454
+ maxAge: ((name, value)=>{
13455
+ if (1 / 0 === value) return 0;
13456
+ if (!Number.isSafeInteger(value) || value < 1 || value > 0xffffffff) throw Error(`Invalid Rspack configuration: "${name}" must be a positive integer (1..4294967295) or Infinity, get \`${value}\`.`);
13457
+ return value;
13458
+ })('cache.maxAge', cache.maxAge),
13459
+ maxMemoryGenerations: ((value)=>{
12955
13460
  if (1 / 0 !== value) {
12956
13461
  if (!Number.isSafeInteger(value) || value < 0 || value > 0xffffffff) throw Error(`Invalid Rspack configuration: "cache.maxMemoryGenerations" must be a non-negative integer (0..4294967295) or Infinity, get \`${value}\`.`);
12957
13462
  return value;
12958
13463
  }
12959
- };
12960
- if ('filesystem' === cache.type) {
12961
- let toRawTimeout = (name, value)=>{
12962
- if (!Number.isSafeInteger(value) || value < 0) throw Error(`Invalid Rspack configuration: "${name}" must be a non-negative safe integer in milliseconds, get \`${value}\`.`);
12963
- return value;
12964
- };
12965
- return {
12966
- type: cache.type,
12967
- buildDependencies: Object.values(cache.buildDependencies).flat(),
12968
- cacheDirectory: cache.cacheDirectory,
12969
- cacheLocation: cache.cacheLocation,
12970
- version: cache.version,
12971
- readonly: cache.readonly,
12972
- maxMemoryGenerations: toRawMemoryGenerations(cache.maxMemoryGenerations),
12973
- idleTimeout: toRawTimeout('cache.idleTimeout', cache.idleTimeout),
12974
- idleTimeoutForInitialStore: toRawTimeout('cache.idleTimeoutForInitialStore', cache.idleTimeoutForInitialStore),
12975
- idleTimeoutAfterLargeChanges: toRawTimeout('cache.idleTimeoutAfterLargeChanges', cache.idleTimeoutAfterLargeChanges)
12976
- };
12977
- }
12978
- return {
12979
- type: cache.type,
12980
- buildDependencies: cache.buildDependencies,
12981
- version: cache.version,
12982
- maxAge: ((name, value)=>{
12983
- if (1 / 0 === value) return 0;
12984
- if (!Number.isSafeInteger(value) || value < 1 || value > 0xffffffff) throw Error(`Invalid Rspack configuration: "${name}" must be a positive integer (1..4294967295) or Infinity, get \`${value}\`.`);
12985
- return value;
12986
- })('cache.maxAge', cache.maxAge),
12987
- maxMemoryGenerations: toRawMemoryGenerations(cache.maxMemoryGenerations),
12988
- storage: {
12989
- type: cache.storage.type,
12990
- directory: cache.storage.location
12991
- },
12992
- portable: cache.portable,
12993
- readonly: cache.readonly
12994
- };
12995
- }(cache),
13464
+ })(cache.maxMemoryGenerations),
13465
+ storage: {
13466
+ type: cache.storage.type,
13467
+ directory: cache.storage.directory,
13468
+ location: cache.storage.location
13469
+ },
13470
+ portable: cache.portable,
13471
+ readonly: cache.readonly
13472
+ }),
12996
13473
  snapshot: (snapshot = options.snapshot, strategy = (value)=>({
12997
13474
  hash: value?.hash ?? !1,
12998
13475
  timestamp: value?.timestamp ?? !1
@@ -13022,7 +13499,7 @@ Help:
13022
13499
  bail: options.bail,
13023
13500
  __references: {}
13024
13501
  }), this.#rawOptions.__references = Object.fromEntries(this.#ruleSet.builtinReferences.entries()), this.#rawOptions.__virtual_files = VirtualModulesPlugin.__internal__take_virtual_files(this);
13025
- let instanceBinding = rspackRequire("@rspack/binding");
13502
+ let instanceBinding = rspackRequire("@ohos-ports/rspack-binding");
13026
13503
  this.#registers = this.#createHooksRegisters();
13027
13504
  let inputFileSystem = this.inputFileSystem && ThreadsafeInputNodeFS.needsBinding(options.experiments.useInputFileSystem) ? ThreadsafeInputNodeFS.__to_binding(this.inputFileSystem) : void 0, compilerRef = new WeakRef(this);
13028
13505
  try {
@@ -13173,13 +13650,10 @@ Help:
13173
13650
  }
13174
13651
  })[module.constructorName](), compilation = getCompiler().__internal__get_compilation();
13175
13652
  runtimeModule.attach(compilation, chunk, compilation.chunkGraph);
13176
- let originSource = module.source?.source;
13177
- queried.call(runtimeModule, chunk);
13178
- let newSource = module.source?.source;
13179
- if (newSource && newSource !== originSource) {
13180
- if (getCompiler().options.experiments?.runtimeMode === 'rspack') throw Error('Compilation.hooks.runtimeModule source modifications are not supported when experiments.runtimeMode is "rspack".');
13181
- return module;
13182
- }
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;
13183
13657
  };
13184
13658
  }),
13185
13659
  registerCompilationBuildModuleTaps: createTap(binding__default().RegisterJsTapKind.CompilationBuildModule, function() {
@@ -13241,9 +13715,8 @@ Help:
13241
13715
  [renderRuntimeVariables(0, getCompiler().options)]: moduleRequireFn,
13242
13716
  [renderRuntimeVariables(1, getCompiler().options)]: runtimeContext
13243
13717
  }), 'Compilation.hooks.executeModule'), moduleObject.loaded = !0, moduleObject.exports;
13244
- }, moduleCache = moduleRequireFn[RuntimeGlobals.moduleCache.replace(`${RuntimeGlobals.require}.`, '')] = {}, interceptModuleExecution = moduleRequireFn[RuntimeGlobals.interceptModuleExecution.replace(`${RuntimeGlobals.require}.`, '')] = [];
13245
- for (let runtimeModule of (moduleRequireFn.r = moduleRequireFn, runtimeContext.r = moduleRequireFn, runtimeModules))moduleRequireFn(runtimeModule);
13246
- 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);
13247
13720
  let executeResult = moduleRequireFn(entry);
13248
13721
  getCompiler().__internal__get_module_execution_results_map().set(id, executeResult);
13249
13722
  } catch (e) {
@@ -13606,7 +14079,7 @@ Help:
13606
14079
  #updateNonSkippableRegisters() {
13607
14080
  let kinds = [];
13608
14081
  for (let { getHook, getHookMap, registerKind } of Object.values(this.#registers))(getHook ?? getHookMap)().isUsed() && kinds.push(registerKind);
13609
- 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)=>{
13610
14083
  instance.setNonSkippableRegisters(kinds), this.#nonSkippableRegisters = kinds;
13611
14084
  });
13612
14085
  }
@@ -13682,53 +14155,14 @@ Help:
13682
14155
  return this.#moduleExecutionResultsMap;
13683
14156
  }
13684
14157
  }
13685
- Object.defineProperty(binding__default().ConcatenatedModule.prototype, 'identifier', {
13686
- enumerable: !0,
13687
- configurable: !0,
13688
- value () {
13689
- return this[binding__default().MODULE_IDENTIFIER_SYMBOL];
13690
- }
13691
- }), Object.defineProperty(binding__default().ConcatenatedModule.prototype, 'originalSource', {
13692
- enumerable: !0,
13693
- configurable: !0,
13694
- value () {
13695
- let originalSource = this._originalSource();
13696
- return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
13697
- }
13698
- }), Object.defineProperty(binding__default().ConcatenatedModule.prototype, 'emitFile', {
13699
- enumerable: !0,
13700
- configurable: !0,
13701
- value (filename, source, assetInfo) {
13702
- return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
13703
- }
13704
- }), Object.defineProperty(binding__default().ContextModule.prototype, 'identifier', {
13705
- enumerable: !0,
13706
- configurable: !0,
13707
- value () {
13708
- return this[binding__default().MODULE_IDENTIFIER_SYMBOL];
13709
- }
13710
- }), Object.defineProperty(binding__default().ContextModule.prototype, 'originalSource', {
13711
- enumerable: !0,
13712
- configurable: !0,
13713
- value () {
13714
- let originalSource = this._originalSource();
13715
- return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
13716
- }
13717
- }), Object.defineProperty(binding__default().ContextModule.prototype, 'emitFile', {
13718
- enumerable: !0,
13719
- configurable: !0,
13720
- value (filename, source, assetInfo) {
13721
- return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
13722
- }
13723
- });
13724
14158
  let ModuleGraphConnection = binding_.ModuleGraphConnection;
13725
14159
  Object.defineProperties(ModuleGraphConnection, {
13726
14160
  TRANSITIVE_ONLY: {
13727
- value: binding__default().TRANSITIVE_ONLY_SYMBOL,
14161
+ value: TRANSITIVE_ONLY_SYMBOL,
13728
14162
  enumerable: !0
13729
14163
  },
13730
14164
  CIRCULAR_CONNECTION: {
13731
- value: binding__default().CIRCULAR_CONNECTION_SYMBOL,
14165
+ value: CIRCULAR_CONNECTION_SYMBOL,
13732
14166
  enumerable: !0
13733
14167
  }
13734
14168
  });
@@ -13832,7 +14266,7 @@ class LoaderOptionsPlugin {
13832
14266
  apply(compiler) {
13833
14267
  let options = this.options;
13834
14268
  compiler.hooks.compilation.tap('LoaderOptionsPlugin', (compilation)=>{
13835
- binding_.NormalModule.getCompilationHooks(compilation).loader.tap('LoaderOptionsPlugin', (context)=>{
14269
+ NormalModule.getCompilationHooks(compilation).loader.tap('LoaderOptionsPlugin', (context)=>{
13836
14270
  let resource = context.resourcePath;
13837
14271
  if (resource && matchObject(options, resource)) for (let key of Object.keys(options))'include' !== key && 'exclude' !== key && 'test' !== key && (context[key] = options[key]);
13838
14272
  });
@@ -13846,7 +14280,7 @@ class LoaderTargetPlugin {
13846
14280
  }
13847
14281
  apply(compiler) {
13848
14282
  compiler.hooks.compilation.tap('LoaderTargetPlugin', (compilation)=>{
13849
- binding_.NormalModule.getCompilationHooks(compilation).loader.tap('LoaderTargetPlugin', (loaderContext)=>{
14283
+ NormalModule.getCompilationHooks(compilation).loader.tap('LoaderTargetPlugin', (loaderContext)=>{
13850
14284
  loaderContext.target = this.target;
13851
14285
  });
13852
14286
  });
@@ -13884,9 +14318,9 @@ let VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
13884
14318
  function isRequiredVersion(str) {
13885
14319
  return VERSION_PATTERN_REGEXP.test(str);
13886
14320
  }
13887
- let encodeName = function(name, prefix = '', withExt = !1) {
13888
- return `${prefix}${name.replace(/@/g, 'scope_').replace(/-/g, '_').replace(/\//g, '__').replace(/\./g, '')}${withExt ? '.js' : ''}`;
13889
- };
14321
+ function encodeName(...parts) {
14322
+ return `mf_${createHash_createHash('xxhash64').update(JSON.stringify(parts), 'utf8').digest('hex')}`;
14323
+ }
13890
14324
  function normalizeConsumeShareOptions(consumes, shareScope) {
13891
14325
  return parseOptions(consumes, (item, key)=>{
13892
14326
  if (Array.isArray(item)) throw Error('Unexpected array in options');
@@ -13984,7 +14418,10 @@ class ProvideSharedPlugin extends RspackBuiltinPlugin {
13984
14418
  }
13985
14419
  }
13986
14420
  function validateShareScope(shareScope, enhanced, pluginName) {
13987
- if (Array.isArray(shareScope) && shareScope.length > 1 && !enhanced) throw Error(`[${pluginName}] shareScope as an array with multiple entries requires enhanced=true, got: ${JSON.stringify(shareScope)}`);
14421
+ if (Array.isArray(shareScope)) {
14422
+ if (0 === shareScope.length) throw Error(`[${pluginName}] shareScope array must contain at least one entry`);
14423
+ if (shareScope.length > 1 && !enhanced) throw Error(`[${pluginName}] shareScope as an array with multiple entries requires enhanced=true, got: ${JSON.stringify(shareScope)}`);
14424
+ }
13988
14425
  }
13989
14426
  function normalizeSharedOptions(shared) {
13990
14427
  return parseOptions(shared, (item, key)=>{
@@ -14058,9 +14495,9 @@ function getFileName(manifestOptions) {
14058
14495
  statsFileName: STATS_FILE_NAME,
14059
14496
  manifestFileName: MANIFEST_FILE_NAME
14060
14497
  };
14061
- 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;
14062
14499
  return {
14063
- statsFileName: join(filePath, fileName ? manifestFileName.replace(JSON_EXT, `-stats${JSON_EXT}`) : STATS_FILE_NAME).replace(/\\/g, '/'),
14500
+ statsFileName: join(filePath, statsFileName).replace(/\\/g, '/'),
14064
14501
  manifestFileName: join(filePath, manifestFileName).replace(/\\/g, '/')
14065
14502
  };
14066
14503
  }
@@ -14146,7 +14583,7 @@ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
14146
14583
  exposes,
14147
14584
  shared,
14148
14585
  buildInfo: (isDev = 'development' === compiler.options.mode, mfConfig1 = this.rawOpts, pkg = function(root) {
14149
- 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');
14150
14587
  try {
14151
14588
  let content = readFileSync(pkgPath, 'utf-8'), parsed = function(input, guard) {
14152
14589
  try {
@@ -14219,7 +14656,7 @@ class SharedContainerPlugin extends RspackBuiltinPlugin {
14219
14656
  constructor(options){
14220
14657
  super();
14221
14658
  let { shareName, library, request, independentShareFileName, mfName } = options, version = options.version || '0.0.0';
14222
- this._globalName = encodeName(`${mfName}_${shareName}_${version}`);
14659
+ this._globalName = encodeName(mfName, shareName, version);
14223
14660
  let fileName = independentShareFileName || `${version}/share-entry.js`;
14224
14661
  this._shareName = shareName, this._options = {
14225
14662
  name: shareName,
@@ -14316,8 +14753,8 @@ class VirtualEntryPlugin {
14316
14753
  chunk?.files.forEach((f)=>{
14317
14754
  compilation.deleteAsset(f);
14318
14755
  });
14319
- } catch (_e) {
14320
- console.error('Failed to remove virtual entry file!');
14756
+ } catch (error) {
14757
+ compiler.getInfrastructureLogger('VirtualEntryPlugin').error('Failed to remove virtual entry file!', error);
14321
14758
  }
14322
14759
  });
14323
14760
  });
@@ -14365,8 +14802,8 @@ class IndependentSharedPlugin {
14365
14802
  name: 'IndependentSharedPlugin',
14366
14803
  stage: 102
14367
14804
  }, async ()=>{
14368
- let shareRequestsMap = collectSharedEntryPlugin.getData();
14369
- 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);
14370
14807
  }), manifest && compiler.hooks.compilation.tap('IndependentSharedPlugin', (compilation)=>{
14371
14808
  compilation.hooks.processAssets.tap({
14372
14809
  name: 'injectBuildAssets',
@@ -14387,53 +14824,35 @@ class IndependentSharedPlugin {
14387
14824
  });
14388
14825
  });
14389
14826
  }
14390
- prepareBuildAssets(shareRequestsMap) {
14391
- let { sharedOptions, outputDir, mfName, treeShaking, library } = this, buildAssets = {};
14392
- sharedOptions.forEach(([shareName, shareConfig])=>{
14393
- if (!shareConfig.treeShaking || !1 === shareConfig.import) return;
14394
- let sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
14395
- getShareRequests(shareRequestsMap, shareName).forEach(([request, version])=>{
14396
- 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({
14397
14834
  mfName: `${mfName}_${treeShaking ? 't' : 'f'}`,
14398
14835
  library,
14399
14836
  shareName,
14400
14837
  version,
14401
14838
  request,
14402
- independentShareFileName: sharedConfig?.treeShaking?.filename
14403
- }).getData();
14404
- 'string' == typeof shareFileName && (buildAssets[shareName] ||= [], buildAssets[shareName].push([
14405
- join(resolveOutputDir(outputDir, shareName), shareFileName),
14839
+ independentShareFileName: shareConfig.treeShaking.filename
14840
+ }), [shareFileName, globalName, sharedVersion] = plugin.getData();
14841
+ (buildAssets[shareName] ||= []).push([
14842
+ join(outputDir, shareFileName),
14406
14843
  sharedVersion,
14407
14844
  globalName
14408
- ]));
14409
- });
14410
- }), this.buildAssets = buildAssets;
14411
- }
14412
- async createIndependentCompilers(parentCompiler, shareRequestsMap) {
14413
- let { sharedOptions } = this;
14414
- console.log('Start building shared fallback resources ...'), await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
14415
- if (!shareConfig.treeShaking || !1 === shareConfig.import) return;
14416
- let shareRequests = getShareRequests(shareRequestsMap, shareName);
14417
- await Promise.all(shareRequests.map(async ([request, version])=>{
14418
- let sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
14419
- await this.createIndependentCompiler(parentCompiler, {
14420
- shareRequestsMap,
14421
- currentShare: {
14422
- shareName,
14423
- version,
14424
- request,
14425
- independentShareFileName: sharedConfig?.treeShaking?.filename
14426
- }
14845
+ ]), builds.push({
14846
+ shareName,
14847
+ outputDir,
14848
+ plugin
14427
14849
  });
14428
- }));
14429
- })), console.log('All shared fallback have been compiled successfully!');
14850
+ }
14851
+ }
14852
+ return this.buildAssets = buildAssets, builds;
14430
14853
  }
14431
- async createIndependentCompiler(parentCompiler, extraOptions) {
14432
- 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({
14433
- mfName: `${mfName}_${treeShaking ? 't' : 'f'}`,
14434
- library,
14435
- ...extraOptions.currentShare
14436
- });
14854
+ async createIndependentCompiler(parentCompiler, logger, { shareName, outputDir, plugin: sharedContainerPlugin }) {
14855
+ let { plugins, sharedOptions, treeShaking, treeShakingSharedExcludePlugins } = this, parentConfig = parentCompiler.options, finalPlugins = [], rspack = parentCompiler.rspack;
14437
14856
  (parentConfig.plugins || []).forEach((plugin)=>{
14438
14857
  void 0 !== plugin && 'string' != typeof plugin && ((plugin, excludedPlugins = [])=>{
14439
14858
  if (!plugin) return !0;
@@ -14454,8 +14873,8 @@ class IndependentSharedPlugin {
14454
14873
  })(plugin, treeShakingSharedExcludePlugins) && finalPlugins.push(plugin);
14455
14874
  }), plugins.forEach((plugin)=>{
14456
14875
  finalPlugins.push(plugin);
14457
- }), finalPlugins.push(extraPlugin), finalPlugins.push(new ConsumeSharedPlugin({
14458
- 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])=>({
14459
14878
  [key]: {
14460
14879
  import: !1,
14461
14880
  shareKey: options.shareKey || key,
@@ -14469,8 +14888,11 @@ class IndependentSharedPlugin {
14469
14888
  })),
14470
14889
  enhanced: !0
14471
14890
  })), treeShaking && finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectTreeShakingUsedExports)), finalPlugins.push(new VirtualEntryPlugin(sharedOptions, !1));
14472
- let fullOutputDir = external_node_path_resolve(parentCompiler.outputPath, outputDirWithShareName), compilerConfig = {
14891
+ let fullOutputDir = external_node_path_resolve(parentCompiler.outputPath, outputDir), compilerConfig = {
14473
14892
  ...parentConfig,
14893
+ cache: {
14894
+ type: 'memory'
14895
+ },
14474
14896
  name: parentConfig.name || 'mf-shared-compiler',
14475
14897
  module: {
14476
14898
  ...parentConfig.module,
@@ -14502,16 +14924,20 @@ class IndependentSharedPlugin {
14502
14924
  }
14503
14925
  }, compiler = rspack.rspack(compilerConfig);
14504
14926
  compiler.inputFileSystem = parentCompiler.inputFileSystem, compiler.outputFileSystem = parentCompiler.outputFileSystem, compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
14505
- let { currentShare } = extraOptions;
14506
- return new Promise((resolve, reject)=>{
14507
- compiler.run((err, stats)=>{
14508
- if (err || stats?.hasErrors()) {
14509
- console.error(`${currentShare.shareName} Compile failed:`, err || stats.toJson().errors.map((e)=>e.message).join('\n')), reject(err || Error(`${currentShare.shareName} Compile failed`));
14510
- return;
14511
- }
14512
- console.log(`${currentShare.shareName} Compile success`), resolve(extraPlugin.getData());
14513
- });
14927
+ let [error, stats] = await new Promise((resolve)=>{
14928
+ compiler.run((error, stats)=>resolve([
14929
+ error,
14930
+ stats
14931
+ ]));
14514
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`);
14515
14941
  }
14516
14942
  }
14517
14943
  let TreeShakingSharedPlugin_require = createRequire(import.meta.url);
@@ -14662,11 +15088,12 @@ class ContainerPlugin extends RspackBuiltinPlugin {
14662
15088
  name = binding_.BuiltinPluginName.ContainerPlugin;
14663
15089
  _options;
14664
15090
  constructor(options){
15091
+ var shareScope;
14665
15092
  if (super(), 'string' != typeof options.name) throw Error('[ContainerPlugin] name must be a string.');
14666
- let shareScope = options.shareScope || 'default', enhanced = options.enhanced ?? !1;
14667
- validateShareScope(shareScope, enhanced, 'ContainerPlugin'), this._options = {
15093
+ let enhanced = options.enhanced ?? !1, shareScope1 = (shareScope = options.shareScope, shareScope ? (validateShareScope(shareScope, enhanced, 'ContainerPlugin'), !enhanced && Array.isArray(shareScope) ? shareScope[0] : shareScope) : 'default');
15094
+ this._options = {
14668
15095
  name: options.name,
14669
- shareScope,
15096
+ shareScope: shareScope1,
14670
15097
  library: options.library || {
14671
15098
  type: 'global',
14672
15099
  name: options.name
@@ -14752,15 +15179,7 @@ class ContainerReferencePlugin extends RspackBuiltinPlugin {
14752
15179
  return createBuiltinPlugin(this.name, rawOptions);
14753
15180
  }
14754
15181
  }
14755
- async function minify(source, options) {
14756
- let _options = JSON.stringify(options || {});
14757
- return binding__default().minify(source, _options);
14758
- }
14759
- async function transform(source, options) {
14760
- let _options = JSON.stringify(options || {});
14761
- return binding__default().transform(source, _options);
14762
- }
14763
- let exports_rspackVersion = "2.2.9", 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 = {
14764
15183
  getNormalizedRspackOptions: getNormalizedRspackOptions,
14765
15184
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
14766
15185
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -14795,6 +15214,7 @@ let exports_rspackVersion = "2.2.9", exports_version = "5.75.0", exports_Webpack
14795
15214
  CompactHashedModuleIdsPlugin: CompactHashedModuleIdsPlugin,
14796
15215
  CompatHashedChunkIdsPlugin: CompactHashedChunkIdsPlugin,
14797
15216
  CompatHashedModuleIdsPlugin: CompactHashedModuleIdsPlugin,
15217
+ DeterministicChunkIdsPlugin: DeterministicChunkIdsPlugin,
14798
15218
  DeterministicModuleIdsPlugin: DeterministicModuleIdsPlugin,
14799
15219
  HashedModuleIdsPlugin: HashedModuleIdsPlugin
14800
15220
  }, exports_library = {
@@ -14957,8 +15377,14 @@ let exports_rspackVersion = "2.2.9", exports_version = "5.75.0", exports_Webpack
14957
15377
  RstestPlugin: RstestPlugin,
14958
15378
  RslibPlugin: RslibPlugin,
14959
15379
  swc: {
14960
- minify: minify,
14961
- transform: transform,
15380
+ minify: async function(source, options) {
15381
+ let _options = JSON.stringify(options || {});
15382
+ return binding__default().minify(source, _options);
15383
+ },
15384
+ transform: async function(source, options) {
15385
+ let _options = JSON.stringify(options || {});
15386
+ return binding__default().transform(source, _options);
15387
+ },
14962
15388
  minifySync: function(source, options) {
14963
15389
  let _options = JSON.stringify(options || {});
14964
15390
  return binding__default().minifySync(source, _options);
@@ -15026,4 +15452,4 @@ let exports_rspackVersion = "2.2.9", exports_version = "5.75.0", exports_Webpack
15026
15452
  src_fn.rspack = src_fn, src_fn.webpack = src_fn;
15027
15453
  let src_rspack = src_fn;
15028
15454
  export default src_rspack;
15029
- export { AsyncDependenciesBlock, BannerPlugin, CaseSensitivePlugin, CircularCheckRspackPlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ConcatenatedModule, ContextModule, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefaultRuntimeGlobals as RuntimeGlobals, DefinePlugin, Dependency, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, EntryDependency, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalModule, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, Module, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, ModuleGraphConnection, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModule, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply, RuntimeModule, RuntimePlugin, RuntimeTemplate, SourceMapDevToolPlugin, Stats, SubresourceIntegrityPlugin, SwcJsMinimizerRspackPlugin, Template, ValidationError, container, electron, exports_WebpackError as WebpackError, exports_config as config, exports_experiments as experiments, exports_ids as ids, exports_library as library, exports_node as node, exports_rspackVersion as rspackVersion, exports_version as version, exports_wasm as wasm, index_js_namespaceObject as sources, javascript, lazyCompilationMiddleware, lib_EntryOptionPlugin as EntryOptionPlugin, optimize, sharing, src_rspack as "module.exports", src_rspack as rspack, statsFactoryUtils_StatsErrorCode as StatsErrorCode, util, web, webworker };
15455
+ export { AsyncDependenciesBlock, BannerPlugin, CaseSensitivePlugin, CircularCheckRspackPlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ConcatenatedModule, ContextModule, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefaultRuntimeGlobals as RuntimeGlobals, DefinePlugin, Dependency, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, EntryDependency, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalModule, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, ModuleGraphConnection, Module_Module as Module, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModule, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply, RuntimeModule, RuntimePlugin, RuntimeTemplate, SourceMapDevToolPlugin, Stats, SubresourceIntegrityPlugin, SwcJsMinimizerRspackPlugin, Template, ValidationError, container, electron, exports_WebpackError as WebpackError, exports_config as config, exports_experiments as experiments, exports_ids as ids, exports_library as library, exports_node as node, exports_rspackVersion as rspackVersion, exports_version as version, exports_wasm as wasm, javascript, lazyCompilationMiddleware, lib_EntryOptionPlugin as EntryOptionPlugin, optimize, sharing, sources_namespaceObject as sources, src_rspack as "module.exports", src_rspack as rspack, statsFactoryUtils_StatsErrorCode as StatsErrorCode, util, web, webworker };