@ohos-ports/rspack-core 2.2.9-beta.0 → 2.3.2-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 (52) hide show
  1. package/README.md +5 -6
  2. package/compiled/http-proxy-middleware/index.d.ts +10 -10
  3. package/compiled/http-proxy-middleware/package.json +1 -1
  4. package/compiled/watchpack/index.js +276 -49
  5. package/compiled/watchpack/package.json +1 -1
  6. package/compiled/watchpack/types/DirectoryWatcher.d.ts +24 -0
  7. package/compiled/watchpack/types/index.d.ts +1 -1
  8. package/compiled/watchpack/types/watchEventSource.d.ts +9 -0
  9. package/dist/BuildInfo.d.ts +7 -0
  10. package/dist/Compilation.d.ts +3 -1
  11. package/dist/Compiler.d.ts +5 -6
  12. package/dist/ConcatenatedModule.d.ts +5 -1
  13. package/dist/ContextModule.d.ts +3 -1
  14. package/dist/ExternalModule.d.ts +7 -6
  15. package/dist/FileSystemInfo.d.ts +1 -0
  16. package/dist/Module.d.ts +12 -8
  17. package/dist/ModuleGraphConnection.d.ts +9 -3
  18. package/dist/NativeWatchFileSystem.d.ts +19 -7
  19. package/dist/NormalModule.d.ts +14 -6
  20. package/dist/RuntimeTemplate.d.ts +1 -0
  21. package/dist/Stats.d.ts +1 -1
  22. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +3 -2
  23. package/dist/builtin-plugin/ImportedByDeferModulesPlugin.d.ts +9 -0
  24. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +1 -0
  25. package/dist/builtin-plugin/index.d.ts +1 -0
  26. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +2 -2
  27. package/dist/config/normalization.d.ts +2 -2
  28. package/dist/config/target.d.ts +2 -0
  29. package/dist/config/types.d.ts +57 -35
  30. package/dist/cssExtractHmr.js +1 -1
  31. package/dist/exports.d.ts +3 -3
  32. package/dist/index.js +1140 -842
  33. package/dist/loader-runner/codeFilter.d.ts +9 -0
  34. package/dist/loader-runner/dependencies.d.ts +1 -1
  35. package/dist/loader-runner/index.d.ts +2 -1
  36. package/dist/loader-runner/service.d.ts +0 -4
  37. package/dist/loader-runner/worker.d.ts +4 -1
  38. package/dist/node/NodeWatchFileSystem.d.ts +7 -4
  39. package/dist/sources.d.ts +3 -0
  40. package/dist/stats/statsFactoryUtils.d.ts +7 -0
  41. package/dist/util/bindingHelpers.d.ts +2 -0
  42. package/dist/util/createModule.d.ts +3 -0
  43. package/dist/util/fs.d.ts +13 -7
  44. package/dist/util/resolveLayerExternals.d.ts +1 -0
  45. package/dist/util/source.d.ts +12 -3
  46. package/dist/util/symbols.d.ts +10 -0
  47. package/dist/util/watchTimeInfo.d.ts +5 -1
  48. package/dist/worker.js +323 -325
  49. package/hot/lazy-compilation-node.js +1 -1
  50. package/hot/lazy-compilation-web.js +1 -1
  51. package/package.json +3 -3
  52. 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 _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.26.1/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;){
@@ -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");
@@ -304,8 +304,8 @@ makeNamespaceObject(exports_namespaceObject), definePropertyGetters(exports_name
304
304
  CircularDependencyRspackPlugin: ()=>CircularDependencyRspackPlugin,
305
305
  Compilation: ()=>Compilation,
306
306
  Compiler: ()=>Compiler,
307
- ConcatenatedModule: ()=>binding_.ConcatenatedModule,
308
- ContextModule: ()=>binding_.ContextModule,
307
+ ConcatenatedModule: ()=>ConcatenatedModule,
308
+ ContextModule: ()=>ContextModule,
309
309
  ContextReplacementPlugin: ()=>ContextReplacementPlugin,
310
310
  CopyRspackPlugin: ()=>CopyRspackPlugin,
311
311
  CssExtractRspackPlugin: ()=>CssExtractRspackPlugin,
@@ -328,13 +328,13 @@ makeNamespaceObject(exports_namespaceObject), definePropertyGetters(exports_name
328
328
  LightningCssMinimizerRspackPlugin: ()=>LightningCssMinimizerRspackPlugin,
329
329
  LoaderOptionsPlugin: ()=>LoaderOptionsPlugin,
330
330
  LoaderTargetPlugin: ()=>LoaderTargetPlugin,
331
- Module: ()=>binding_.Module,
331
+ Module: ()=>Module_Module,
332
332
  ModuleFilenameHelpers: ()=>ModuleFilenameHelpers_namespaceObject,
333
333
  ModuleGraphConnection: ()=>ModuleGraphConnection,
334
334
  MultiCompiler: ()=>MultiCompiler,
335
335
  MultiStats: ()=>MultiStats,
336
336
  NoEmitOnErrorsPlugin: ()=>NoEmitOnErrorsPlugin,
337
- NormalModule: ()=>binding_.NormalModule,
337
+ NormalModule: ()=>NormalModule,
338
338
  NormalModuleReplacementPlugin: ()=>NormalModuleReplacementPlugin,
339
339
  ProgressPlugin: ()=>ProgressPlugin,
340
340
  ProvidePlugin: ()=>ProvidePlugin,
@@ -364,7 +364,7 @@ makeNamespaceObject(exports_namespaceObject), definePropertyGetters(exports_name
364
364
  optimize: ()=>optimize,
365
365
  rspackVersion: ()=>exports_rspackVersion,
366
366
  sharing: ()=>sharing,
367
- sources: ()=>index_js_namespaceObject,
367
+ sources: ()=>sources_namespaceObject,
368
368
  util: ()=>util,
369
369
  version: ()=>exports_version,
370
370
  wasm: ()=>exports_wasm,
@@ -372,6 +372,12 @@ makeNamespaceObject(exports_namespaceObject), definePropertyGetters(exports_name
372
372
  webworker: ()=>webworker
373
373
  });
374
374
  var ModuleFilenameHelpers_namespaceObject = {};
375
+ makeNamespaceObject(ModuleFilenameHelpers_namespaceObject), definePropertyGetters(ModuleFilenameHelpers_namespaceObject, {
376
+ asRegExp: ()=>asRegExp,
377
+ matchObject: ()=>matchObject,
378
+ matchPart: ()=>matchPart
379
+ });
380
+ var sources_namespaceObject = {};
375
381
  function _define_property(obj, key, value) {
376
382
  return key in obj ? Object.defineProperty(obj, key, {
377
383
  value: value,
@@ -380,10 +386,18 @@ function _define_property(obj, key, value) {
380
386
  writable: !0
381
387
  }) : obj[key] = value, obj;
382
388
  }
383
- makeNamespaceObject(ModuleFilenameHelpers_namespaceObject), definePropertyGetters(ModuleFilenameHelpers_namespaceObject, {
384
- asRegExp: ()=>asRegExp,
385
- matchObject: ()=>matchObject,
386
- matchPart: ()=>matchPart
389
+ makeNamespaceObject(sources_namespaceObject), definePropertyGetters(sources_namespaceObject, {
390
+ CachedSource: ()=>index_js_namespaceObject.CachedSource,
391
+ CompatSource: ()=>index_js_namespaceObject.CompatSource,
392
+ ConcatSource: ()=>RspackConcatSource,
393
+ OriginalSource: ()=>index_js_namespaceObject.OriginalSource,
394
+ PrefixSource: ()=>index_js_namespaceObject.PrefixSource,
395
+ RawSource: ()=>index_js_namespaceObject.RawSource,
396
+ ReplaceSource: ()=>RspackReplaceSource,
397
+ SizeOnlySource: ()=>index_js_namespaceObject.SizeOnlySource,
398
+ Source: ()=>index_js_namespaceObject.Source,
399
+ SourceMapSource: ()=>index_js_namespaceObject.SourceMapSource,
400
+ util: ()=>index_js_namespaceObject.util
387
401
  }), !function() {
388
402
  let { node, bun, deno } = process.versions;
389
403
  if (!node || bun || deno) return;
@@ -891,8 +905,8 @@ class MultiHook {
891
905
  _define_property(this, "hooks", void 0), _define_property(this, "name", void 0), this.hooks = hooks, this.name = name;
892
906
  }
893
907
  }
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;
908
+ let binding_ = rspackRequire("@ohos-ports/rspack-binding");
909
+ var binding__default = compatGetDefaultExport(binding_), AsyncDependenciesBlock = binding_.AsyncDependenciesBlock, Dependency = binding_.Dependency, EntryDependency = binding_.EntryDependency;
896
910
  Object.defineProperty(binding_.Chunk.prototype, 'files', {
897
911
  enumerable: !0,
898
912
  configurable: !0,
@@ -1358,6 +1372,9 @@ class RuntimeTemplate {
1358
1372
  supportTemplateLiteral() {
1359
1373
  return !!this.#environment.templateLiteral;
1360
1374
  }
1375
+ supportsTopLevelAwait() {
1376
+ return !!this.#environment.topLevelAwait;
1377
+ }
1361
1378
  supportNodePrefixForCoreModules() {
1362
1379
  return !!this.#environment.nodePrefixForCoreModules;
1363
1380
  }
@@ -2031,7 +2048,29 @@ for (let name of [
2031
2048
  }
2032
2049
  });
2033
2050
  }
2034
- let index_js_namespaceObject = __rspack_createRequire_require("../compiled/webpack-sources/index.js"), sourceCacheSymbol = Symbol.for('rspack.originalSource'), sourceMapOverrides = new WeakMap();
2051
+ 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();
2052
+ function toSourceGraph(source) {
2053
+ let native = nativeSources.get(source);
2054
+ return native ? {
2055
+ kind: 'native',
2056
+ handle: native
2057
+ } : source[toBindingSource]?.call(source) ?? serializeSource(source);
2058
+ }
2059
+ function serializeSource(source) {
2060
+ let content = source.source();
2061
+ if (Buffer.isBuffer(content)) return {
2062
+ kind: 'raw',
2063
+ content
2064
+ };
2065
+ let map = source.map?.({
2066
+ columns: !0
2067
+ });
2068
+ return {
2069
+ kind: 'raw',
2070
+ content,
2071
+ map: map ? JSON.stringify(map) : void 0
2072
+ };
2073
+ }
2035
2074
  function replaceSourceMap(source, value) {
2036
2075
  return !!Object.getOwnPropertyDescriptor(source, '_sourceMapAsString')?.configurable && (Object.defineProperty(source, '_sourceMapAsString', {
2037
2076
  value,
@@ -2062,41 +2101,56 @@ function clearSourceCache(options, visited) {
2062
2101
  maps: !1
2063
2102
  }), index_js_namespaceObject.SourceMapSource.prototype.clearCache.call(this, options, visited);
2064
2103
  }
2104
+ class RspackConcatSource extends index_js_namespaceObject.ConcatSource {
2105
+ [toBindingSource]() {
2106
+ return Object.getPrototypeOf(this) !== RspackConcatSource.prototype ? null : {
2107
+ kind: 'concat',
2108
+ children: this.getChildren().map(toSourceGraph)
2109
+ };
2110
+ }
2111
+ }
2112
+ class RspackReplaceSource extends index_js_namespaceObject.ReplaceSource {
2113
+ [toBindingSource]() {
2114
+ return Object.getPrototypeOf(this) !== RspackReplaceSource.prototype ? null : {
2115
+ kind: 'replace',
2116
+ original: toSourceGraph(this.original()),
2117
+ replacements: this.getReplacements(),
2118
+ fallback: ()=>serializeSource(this)
2119
+ };
2120
+ }
2121
+ }
2065
2122
  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;
2123
+ static fromBinding(cache, nativeSource) {
2124
+ let source;
2125
+ if (cache.map) if ('string' == typeof cache.map) source = new index_js_namespaceObject.SourceMapSource(cache.source, 'inmemory://from rust', cache.map);
2126
+ else {
2127
+ let sourceMapSource = new index_js_namespaceObject.SourceMapSource(cache.source, 'inmemory://from rust');
2128
+ sourceMapSource._hasSourceMap = !0, Object.defineProperties(sourceMapSource, {
2129
+ [sourceCacheSymbol]: {
2130
+ value: cache,
2131
+ configurable: !0
2132
+ },
2133
+ clearCache: {
2134
+ value: clearSourceCache,
2135
+ writable: !0,
2136
+ configurable: !0
2137
+ },
2138
+ _sourceMapAsString: {
2139
+ get: getSourceMap,
2140
+ set: setSourceMap,
2141
+ configurable: !0,
2142
+ enumerable: !0
2143
+ }
2144
+ }), source = sourceMapSource;
2145
+ }
2146
+ else source = new index_js_namespaceObject.RawSource(cache.source);
2147
+ return nativeSource && nativeSources.set(source, nativeSource), source;
2087
2148
  }
2088
2149
  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
2150
+ let graph = toSourceGraph(source);
2151
+ return 'raw' === graph.kind || 'native' === graph.kind ? graph : {
2152
+ kind: 'native',
2153
+ handle: binding__default().JsNativeSource.fromSource(graph)
2100
2154
  };
2101
2155
  }
2102
2156
  }
@@ -2349,6 +2403,7 @@ function createFileSystemDependencies(binding) {
2349
2403
  let wrapper = new FileSystemDependenciesWrapper(binding);
2350
2404
  return wrappers.set(binding, wrapper), wrapper;
2351
2405
  }
2406
+ 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
2407
  function Compilation_to_property_key(arg) {
2353
2408
  var key = function(input, hint) {
2354
2409
  if ("object" !== Compilation_type_of(input) || null === input) return input;
@@ -2390,10 +2445,9 @@ let logEntryTraceDescriptor = Object.getOwnPropertyDescriptor({
2390
2445
  }, 'trace'), checkCompilation = (compilation)=>{
2391
2446
  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
2447
  }, getOrCreateCompilationHooks = (compilation, key, createHooks)=>{
2393
- let compilationHooksMap = compilation[binding__default().COMPILATION_HOOKS_MAP_SYMBOL], hooks = compilationHooksMap.get(key);
2448
+ let compilationHooksMap = compilation[COMPILATION_HOOKS_MAP_SYMBOL], hooks = compilationHooksMap.get(key);
2394
2449
  return void 0 === hooks && (hooks = createHooks(), compilationHooksMap.set(key, hooks)), hooks;
2395
2450
  };
2396
- Compilation_computedKey = Compilation_to_property_key(binding__default().COMPILATION_HOOKS_MAP_SYMBOL);
2397
2451
  class Compilation {
2398
2452
  #inner;
2399
2453
  #shutdown;
@@ -2424,7 +2478,7 @@ class Compilation {
2424
2478
  #fileSystemDependencies;
2425
2479
  #addIncludeDispatcher;
2426
2480
  #addEntryDispatcher;
2427
- [Compilation_computedKey];
2481
+ [COMPILATION_HOOKS_MAP_SYMBOL];
2428
2482
  constructor(compiler, inner){
2429
2483
  var name, stage, getArgs;
2430
2484
  let errorMessage, getOptions;
@@ -2565,7 +2619,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2565
2619
  }
2566
2620
  return value;
2567
2621
  }
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();
2622
+ }), 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
2623
  }
2570
2624
  get hash() {
2571
2625
  return this.#inner.hash;
@@ -2816,7 +2870,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2816
2870
  }
2817
2871
  __internal__getAssetSource(filename) {
2818
2872
  let rawSource = this.#inner.getAssetSource(filename);
2819
- if (rawSource) return SourceAdapter.fromBinding(rawSource);
2873
+ if (rawSource) return SourceAdapter.fromBinding(rawSource, this.#inner.getAssetNativeSource(filename));
2820
2874
  }
2821
2875
  __internal__setAssetSource(filename, source) {
2822
2876
  this.#inner.setAssetSource(filename, SourceAdapter.toBinding(source));
@@ -2902,7 +2956,7 @@ class EntryData {
2902
2956
  this.dependencies = binding.dependencies, this.includeDependencies = binding.includeDependencies, this.options = binding.options;
2903
2957
  }
2904
2958
  }
2905
- Compilation_computedKey1 = Compilation_to_property_key(Symbol.iterator), Compilation_computedKey2 = Compilation_to_property_key(Symbol.toStringTag);
2959
+ Compilation_computedKey = Compilation_to_property_key(Symbol.iterator), Compilation_computedKey1 = Compilation_to_property_key(Symbol.toStringTag);
2906
2960
  class Entries {
2907
2961
  #data;
2908
2962
  constructor(data){
@@ -2929,10 +2983,10 @@ class Entries {
2929
2983
  values() {
2930
2984
  return this.#data.values().map(EntryData.__from_binding)[Symbol.iterator]();
2931
2985
  }
2932
- [Compilation_computedKey1]() {
2986
+ [Compilation_computedKey]() {
2933
2987
  return this.entries();
2934
2988
  }
2935
- [Compilation_computedKey2] = 'Map';
2989
+ [Compilation_computedKey1] = 'Map';
2936
2990
  has(key) {
2937
2991
  return this.#data.has(key);
2938
2992
  }
@@ -3353,7 +3407,7 @@ function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler, enableNameBatch
3353
3407
  function getChunks(chunks) {
3354
3408
  return 'function' == typeof chunks ? (chunk)=>chunks(chunk) : chunks;
3355
3409
  }
3356
- let { name, chunks, defaultSizeTypes, cacheGroups = {}, fallbackCacheGroup, minSize, minSizeReduction, enforceSizeThreshold, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = sc;
3410
+ let { name, chunks, defaultSizeTypes, cacheGroups = {}, fallbackCacheGroup, minSize, minSizeReduction, minRemainingSize, enforceSizeThreshold, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = sc;
3357
3411
  return {
3358
3412
  ...getName(name),
3359
3413
  chunks: getChunks(chunks),
@@ -3362,7 +3416,7 @@ function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler, enableNameBatch
3362
3416
  'unknown'
3363
3417
  ],
3364
3418
  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;
3419
+ let { test, name, chunks, minSize, minSizeReduction, minRemainingSize, enforceSizeThreshold, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = group;
3366
3420
  return {
3367
3421
  key,
3368
3422
  test: 'function' == typeof test ? (ctx)=>{
@@ -3376,6 +3430,7 @@ function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler, enableNameBatch
3376
3430
  chunks: getChunks(chunks),
3377
3431
  minSize: JsSplitChunkSizes.__to_binding(minSize),
3378
3432
  minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
3433
+ minRemainingSize: JsSplitChunkSizes.__to_binding(minRemainingSize),
3379
3434
  enforceSizeThreshold: JsSplitChunkSizes.__to_binding(enforceSizeThreshold),
3380
3435
  maxSize: JsSplitChunkSizes.__to_binding(maxSize),
3381
3436
  maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
@@ -3389,6 +3444,7 @@ function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler, enableNameBatch
3389
3444
  },
3390
3445
  minSize: JsSplitChunkSizes.__to_binding(minSize),
3391
3446
  minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
3447
+ minRemainingSize: JsSplitChunkSizes.__to_binding(minRemainingSize),
3392
3448
  enforceSizeThreshold: JsSplitChunkSizes.__to_binding(enforceSizeThreshold),
3393
3449
  maxSize: JsSplitChunkSizes.__to_binding(maxSize),
3394
3450
  maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
@@ -3757,7 +3813,13 @@ function createRawModuleRuleUses(uses, path, options) {
3757
3813
  }(use, `${path1}[${index}]`, options1.compiler, isBuiltin, fingerprintOptions),
3758
3814
  options: o,
3759
3815
  cache: use.cache ?? !1,
3760
- optionsCacheKey: use.cache ? JSON.stringify(fingerprintOptions) ?? '' : ''
3816
+ optionsCacheKey: use.cache ? JSON.stringify(fingerprintOptions) ?? '' : '',
3817
+ codeFilter: function(codeFilter, path) {
3818
+ if (void 0 !== codeFilter) {
3819
+ if ('string' == typeof codeFilter || codeFilter instanceof RegExp) return codeFilter;
3820
+ throw Error(`Expected a string or RegExp at \`${path}\`.`);
3821
+ }
3822
+ }(use.codeFilter, `${path1}[${index}].codeFilter`)
3761
3823
  };
3762
3824
  }) : [];
3763
3825
  }
@@ -3829,6 +3891,7 @@ let getRawModuleRule = (rule, path, options, upperType)=>{
3829
3891
  compiler: options.compiler
3830
3892
  }) ?? [], `${path}.use`, options));
3831
3893
  let rawModuleRule = {
3894
+ as: rule.as,
3832
3895
  test: rule.test ? getRawRuleSetCondition(rule.test) : void 0,
3833
3896
  include: rule.include ? getRawRuleSetCondition(rule.include) : void 0,
3834
3897
  exclude: rule.exclude ? getRawRuleSetCondition(rule.exclude) : void 0,
@@ -3984,6 +4047,7 @@ function getRawJavascriptParserOptions(parser) {
3984
4047
  return importMeta;
3985
4048
  }(parser.importMeta),
3986
4049
  url: parser.url?.toString(),
4050
+ dynamicUrl: parser.dynamicUrl,
3987
4051
  exprContextCritical: parser.exprContextCritical,
3988
4052
  unknownContextCritical: parser.unknownContextCritical,
3989
4053
  wrappedContextCritical: parser.wrappedContextCritical,
@@ -4057,6 +4121,7 @@ function getRawGeneratorOptions(generator, type) {
4057
4121
  type: 'css',
4058
4122
  css: {
4059
4123
  exportsOnly: (options1 = generator).exportsOnly,
4124
+ runtimePublicPath: options1.runtimePublicPath,
4060
4125
  esModule: options1.esModule
4061
4126
  }
4062
4127
  };
@@ -4120,9 +4185,205 @@ function getRawCssAutoOrModuleGeneratorOptions(options) {
4120
4185
  localIdentHashSalt: options.localIdentHashSalt,
4121
4186
  exportsConvention: options.exportsConvention,
4122
4187
  exportsOnly: options.exportsOnly,
4188
+ runtimePublicPath: options.runtimePublicPath,
4123
4189
  esModule: options.esModule
4124
4190
  };
4125
4191
  }
4192
+ let DYNAMIC_INFO = Symbol('cleverMerge dynamic info'), mergeCache = new WeakMap(), DELETE = Symbol('DELETE'), cachedCleverMerge = (first, second)=>{
4193
+ if (void 0 === second) return first;
4194
+ if (void 0 === first || 'object' != typeof second || null === second) return second;
4195
+ if ('object' != typeof first || null === first) return first;
4196
+ let innerCache = mergeCache.get(first);
4197
+ void 0 === innerCache && (innerCache = new WeakMap(), mergeCache.set(first, innerCache));
4198
+ let prevMerge = innerCache.get(second);
4199
+ if (void 0 !== prevMerge) return prevMerge;
4200
+ let newMerge = _cleverMerge(first, second, !0);
4201
+ return innerCache.set(second, newMerge), newMerge;
4202
+ }, parseCache = new WeakMap(), cachedParseObject = (obj)=>{
4203
+ let entry = parseCache.get(obj);
4204
+ if (void 0 !== entry) return entry;
4205
+ let result = parseObject(obj);
4206
+ return parseCache.set(obj, result), result;
4207
+ }, parseObject = (obj)=>{
4208
+ let dynamicInfo, info = new Map(), getInfo = (p)=>{
4209
+ let entry = info.get(p);
4210
+ if (void 0 !== entry) return entry;
4211
+ let newEntry = {
4212
+ base: void 0,
4213
+ byProperty: void 0,
4214
+ byValues: new Map()
4215
+ };
4216
+ return info.set(p, newEntry), newEntry;
4217
+ };
4218
+ for (let key of Object.keys(obj))if (key.startsWith('by')) {
4219
+ let byObj = obj[key];
4220
+ if ('object' == typeof byObj) for (let byValue of Object.keys(byObj)){
4221
+ let obj = byObj[byValue];
4222
+ for (let key1 of Object.keys(obj)){
4223
+ let entry = getInfo(key1);
4224
+ if (void 0 === entry.byProperty) entry.byProperty = key;
4225
+ else if (entry.byProperty !== key) throw Error(`${key} and ${entry.byProperty} for a single property is not supported`);
4226
+ 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);
4227
+ }
4228
+ }
4229
+ else if ('function' == typeof byObj) if (void 0 === dynamicInfo) dynamicInfo = {
4230
+ byProperty: key,
4231
+ fn: byObj
4232
+ };
4233
+ else throw Error(`${key} and ${dynamicInfo.byProperty} when both are functions is not supported`);
4234
+ else getInfo(key).base = obj[key];
4235
+ } else getInfo(key).base = obj[key];
4236
+ return {
4237
+ static: info,
4238
+ dynamic: dynamicInfo
4239
+ };
4240
+ }, cleverMerge_serializeObject = (info, dynamicInfo)=>{
4241
+ let obj = {};
4242
+ for (let entry of info.values())if (void 0 !== entry.byProperty) {
4243
+ let byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
4244
+ for (let byValue of entry.byValues.keys())byObj[byValue] = byObj[byValue] || {};
4245
+ }
4246
+ for (let [key, entry] of info)if (void 0 !== entry.base && (obj[key] = entry.base), void 0 !== entry.byProperty) {
4247
+ let byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
4248
+ for (let byValue of Object.keys(byObj)){
4249
+ let value = getFromByValues(entry.byValues, byValue);
4250
+ void 0 !== value && (byObj[byValue][key] = value);
4251
+ }
4252
+ }
4253
+ return void 0 !== dynamicInfo && (obj[dynamicInfo.byProperty] = dynamicInfo.fn), obj;
4254
+ }, 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)=>{
4255
+ let firstObject = internalCaching ? cachedParseObject(first) : parseObject(first), { static: firstInfo, dynamic: firstDynamicInfo } = firstObject, secondObj = second;
4256
+ if (void 0 !== firstDynamicInfo) {
4257
+ let { fn } = firstDynamicInfo, { byProperty } = firstDynamicInfo, fnInfo = fn[DYNAMIC_INFO];
4258
+ fnInfo && (secondObj = internalCaching ? cachedCleverMerge(fnInfo[1], second) : cleverMerge(fnInfo[1], second), fn = fnInfo[0]);
4259
+ let newFn = (...args)=>{
4260
+ let fnResult = fn(...args);
4261
+ return internalCaching ? cachedCleverMerge(fnResult, secondObj) : cleverMerge(fnResult, secondObj);
4262
+ };
4263
+ return newFn[DYNAMIC_INFO] = [
4264
+ fn,
4265
+ secondObj
4266
+ ], cleverMerge_serializeObject(firstObject.static, {
4267
+ byProperty,
4268
+ fn: newFn
4269
+ });
4270
+ }
4271
+ let { static: secondInfo, dynamic: secondDynamicInfo } = internalCaching ? cachedParseObject(second) : parseObject(second), resultInfo = new Map();
4272
+ for (let [key, firstEntry] of firstInfo){
4273
+ let secondEntry = secondInfo.get(key), entry = void 0 !== secondEntry ? mergeEntries(firstEntry, secondEntry, internalCaching) : firstEntry;
4274
+ resultInfo.set(key, entry);
4275
+ }
4276
+ for (let [key, secondEntry] of secondInfo)firstInfo.has(key) || resultInfo.set(key, secondEntry);
4277
+ return cleverMerge_serializeObject(resultInfo, secondDynamicInfo);
4278
+ }, mergeEntries = (firstEntry, secondEntry, internalCaching)=>{
4279
+ switch(getValueType(secondEntry.base)){
4280
+ case 1:
4281
+ case 4:
4282
+ return secondEntry;
4283
+ case 0:
4284
+ {
4285
+ if (!firstEntry.byProperty) return {
4286
+ base: firstEntry.base,
4287
+ byProperty: secondEntry.byProperty,
4288
+ byValues: secondEntry.byValues
4289
+ };
4290
+ if (firstEntry.byProperty !== secondEntry.byProperty) throw Error(`${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`);
4291
+ let newByValues = new Map(firstEntry.byValues);
4292
+ for (let [key, value] of secondEntry.byValues){
4293
+ let firstValue = getFromByValues(firstEntry.byValues, key);
4294
+ newByValues.set(key, mergeSingleValue(firstValue, value, internalCaching));
4295
+ }
4296
+ return {
4297
+ base: firstEntry.base,
4298
+ byProperty: firstEntry.byProperty,
4299
+ byValues: newByValues
4300
+ };
4301
+ }
4302
+ default:
4303
+ {
4304
+ let newBase;
4305
+ if (!firstEntry.byProperty) return {
4306
+ base: mergeSingleValue(firstEntry.base, secondEntry.base, internalCaching),
4307
+ byProperty: secondEntry.byProperty,
4308
+ byValues: secondEntry.byValues
4309
+ };
4310
+ let intermediateByValues = new Map(firstEntry.byValues);
4311
+ for (let [key, value] of intermediateByValues)intermediateByValues.set(key, mergeSingleValue(value, secondEntry.base, internalCaching));
4312
+ if (Array.from(firstEntry.byValues.values()).every((value)=>{
4313
+ let type = getValueType(value);
4314
+ return 1 === type || 4 === type;
4315
+ }) ? newBase = mergeSingleValue(firstEntry.base, secondEntry.base, internalCaching) : (newBase = firstEntry.base, intermediateByValues.has('default') || intermediateByValues.set('default', secondEntry.base)), !secondEntry.byProperty) return {
4316
+ base: newBase,
4317
+ byProperty: firstEntry.byProperty,
4318
+ byValues: intermediateByValues
4319
+ };
4320
+ if (firstEntry.byProperty !== secondEntry.byProperty) throw Error(`${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`);
4321
+ let newByValues = new Map(intermediateByValues);
4322
+ for (let [key, value] of secondEntry.byValues){
4323
+ let firstValue = getFromByValues(intermediateByValues, key);
4324
+ newByValues.set(key, mergeSingleValue(firstValue, value, internalCaching));
4325
+ }
4326
+ return {
4327
+ base: newBase,
4328
+ byProperty: firstEntry.byProperty,
4329
+ byValues: newByValues
4330
+ };
4331
+ }
4332
+ }
4333
+ }, getFromByValues = (byValues, key)=>'default' !== key && byValues.has(key) ? byValues.get(key) : byValues.get('default'), mergeSingleValue = (a, b, internalCaching)=>{
4334
+ let bType = getValueType(b), aType = getValueType(a);
4335
+ switch(bType){
4336
+ case 4:
4337
+ case 1:
4338
+ return b;
4339
+ case 3:
4340
+ return 3 !== aType ? b : internalCaching ? cachedCleverMerge(a, b) : cleverMerge(a, b);
4341
+ case 0:
4342
+ return a;
4343
+ case 2:
4344
+ switch(1 !== aType ? aType : Array.isArray(a) ? 2 : 3){
4345
+ case 0:
4346
+ return b;
4347
+ case 4:
4348
+ return b.filter((item)=>'...' !== item);
4349
+ case 2:
4350
+ {
4351
+ let newArray = [];
4352
+ for (let item of b)if ('...' === item) for (let item of a)newArray.push(item);
4353
+ else newArray.push(item);
4354
+ return newArray;
4355
+ }
4356
+ case 3:
4357
+ return b.map((item)=>'...' === item ? a : item);
4358
+ default:
4359
+ throw Error('Not implemented');
4360
+ }
4361
+ default:
4362
+ throw Error('Not implemented');
4363
+ }
4364
+ }, resolveLayerExternals = (item, layer)=>{
4365
+ if ('object' != typeof item || null === item || !('byLayer' in item)) return item;
4366
+ let { byLayer, ...remaining } = item;
4367
+ if (void 0 === byLayer) return remaining;
4368
+ if ('object' == typeof byLayer) {
4369
+ let key = String(layer);
4370
+ return Object.hasOwn(byLayer, key) ? mergeExternalObjects(remaining, byLayer[key]) : Object.hasOwn(byLayer, 'default') ? mergeExternalObjects(remaining, byLayer.default) : remaining;
4371
+ }
4372
+ return 'function' == typeof byLayer ? mergeExternalObjects(remaining, resolveLayerExternals(byLayer(layer), layer)) : item;
4373
+ };
4374
+ function mergeExternalObjects(base, overrides) {
4375
+ return 'object' != typeof overrides || null === overrides || overrides instanceof RegExp ? void 0 === overrides ? base : overrides : {
4376
+ ...base,
4377
+ ...Object.fromEntries(Object.entries(overrides).map(([request, value])=>[
4378
+ request,
4379
+ cachedCleverMerge({
4380
+ value: Object.hasOwn(base, request) ? base[request] : void 0
4381
+ }, {
4382
+ value
4383
+ }).value
4384
+ ]))
4385
+ };
4386
+ }
4126
4387
  class ExternalsPlugin extends RspackBuiltinPlugin {
4127
4388
  type;
4128
4389
  externals;
@@ -4201,13 +4462,42 @@ class ExternalsPlugin extends RspackBuiltinPlugin {
4201
4462
  });
4202
4463
  });
4203
4464
  }
4204
- if ('object' == typeof item) return Object.fromEntries(Object.entries(item).map(([k, v])=>[
4205
- k,
4206
- getRawExternalItemValue(v)
4207
- ]));
4465
+ if ('object' == typeof item) {
4466
+ let { byLayer } = item;
4467
+ if ('function' == typeof byLayer || byLayer && 'object' == typeof byLayer && Object.values(byLayer).some((branch)=>'object' != typeof branch || branch instanceof RegExp)) {
4468
+ let cache = new Map();
4469
+ return async (ctx)=>{
4470
+ let result, { request, contextInfo } = ctx.data(), layer = contextInfo.issuerLayer ?? null, raw = cache.get(layer);
4471
+ if (void 0 === raw && (raw = this.#getRawExternalItem(resolveLayerExternals(item, layer)), cache.set(layer, raw)), 'function' == typeof raw) return await raw(ctx);
4472
+ if ('string' == typeof raw) raw === request && (result = request);
4473
+ else if (raw instanceof RegExp) raw.lastIndex = 0, raw.test(request) && (result = request), raw.lastIndex = 0;
4474
+ else {
4475
+ let values = raw.byLayer?.[layer ?? 'null'] ?? raw.values;
4476
+ Object.hasOwn(values, request) && (result = values[request]);
4477
+ }
4478
+ return {
4479
+ result,
4480
+ externalType: void 0
4481
+ };
4482
+ };
4483
+ }
4484
+ return {
4485
+ values: getRawExternalObject(resolveLayerExternals(item, 'default')),
4486
+ byLayer: byLayer && Object.fromEntries(Object.keys(byLayer).map((layer)=>[
4487
+ layer,
4488
+ getRawExternalObject(resolveLayerExternals(item, layer))
4489
+ ]))
4490
+ };
4491
+ }
4208
4492
  throw TypeError(`Unexpected type of external item: ${typeof item}`);
4209
4493
  };
4210
4494
  }
4495
+ function getRawExternalObject(item) {
4496
+ return Object.fromEntries(Object.entries(item).map(([key, value])=>[
4497
+ key,
4498
+ getRawExternalItemValue(value)
4499
+ ]));
4500
+ }
4211
4501
  function getRawExternalItemValueFormFnResult(result) {
4212
4502
  return void 0 === result ? result : getRawExternalItemValue(result);
4213
4503
  }
@@ -4443,7 +4733,7 @@ HtmlRspackPlugin.createHtmlTagObject = (tagName, attributes, innerHTML)=>({
4443
4733
  ])
4444
4734
  }, hooks_compilationHooksMap.set(compilation, hooks)), hooks;
4445
4735
  }, 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();
4736
+ 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
4737
  class JavascriptModulesPlugin extends RspackBuiltinPlugin {
4448
4738
  name = binding_.BuiltinPluginName.JavascriptModulesPlugin;
4449
4739
  affectedHooks = 'compilation';
@@ -4482,15 +4772,15 @@ Object.defineProperty(binding__default().KnownBuildInfo.prototype, node_util.ins
4482
4772
  enumerable: !0,
4483
4773
  configurable: !0,
4484
4774
  get () {
4485
- if (this[binding__default().BUILD_INFO_ASSETS_SYMBOL][$assets]) return this[binding__default().BUILD_INFO_ASSETS_SYMBOL][$assets];
4775
+ if (this[BUILD_INFO_ASSETS_SYMBOL][$assets]) return this[BUILD_INFO_ASSETS_SYMBOL][$assets];
4486
4776
  let assets = new Proxy(Object.create(null), {
4487
- ownKeys: ()=>this[binding__default().BUILD_INFO_ASSETS_SYMBOL].keys(),
4777
+ ownKeys: ()=>this[BUILD_INFO_ASSETS_SYMBOL].keys(),
4488
4778
  getOwnPropertyDescriptor: ()=>({
4489
4779
  enumerable: !0,
4490
4780
  configurable: !0
4491
4781
  })
4492
4782
  });
4493
- return Object.defineProperty(this[binding__default().BUILD_INFO_ASSETS_SYMBOL], $assets, {
4783
+ return Object.defineProperty(this[BUILD_INFO_ASSETS_SYMBOL], $assets, {
4494
4784
  enumerable: !1,
4495
4785
  configurable: !0,
4496
4786
  value: assets
@@ -4500,25 +4790,25 @@ Object.defineProperty(binding__default().KnownBuildInfo.prototype, node_util.ins
4500
4790
  enumerable: !0,
4501
4791
  configurable: !0,
4502
4792
  get () {
4503
- return new Set(this[binding__default().BUILD_INFO_FILE_DEPENDENCIES_SYMBOL]);
4793
+ return new Set(this[BUILD_INFO_FILE_DEPENDENCIES_SYMBOL]);
4504
4794
  }
4505
4795
  }), Object.defineProperty(binding__default().KnownBuildInfo.prototype, 'contextDependencies', {
4506
4796
  enumerable: !0,
4507
4797
  configurable: !0,
4508
4798
  get () {
4509
- return new Set(this[binding__default().BUILD_INFO_CONTEXT_DEPENDENCIES_SYMBOL]);
4799
+ return new Set(this[BUILD_INFO_CONTEXT_DEPENDENCIES_SYMBOL]);
4510
4800
  }
4511
4801
  }), Object.defineProperty(binding__default().KnownBuildInfo.prototype, 'missingDependencies', {
4512
4802
  enumerable: !0,
4513
4803
  configurable: !0,
4514
4804
  get () {
4515
- return new Set(this[binding__default().BUILD_INFO_MISSING_DEPENDENCIES_SYMBOL]);
4805
+ return new Set(this[BUILD_INFO_MISSING_DEPENDENCIES_SYMBOL]);
4516
4806
  }
4517
4807
  }), Object.defineProperty(binding__default().KnownBuildInfo.prototype, 'buildDependencies', {
4518
4808
  enumerable: !0,
4519
4809
  configurable: !0,
4520
4810
  get () {
4521
- return new Set(this[binding__default().BUILD_INFO_BUILD_DEPENDENCIES_SYMBOL]);
4811
+ return new Set(this[BUILD_INFO_BUILD_DEPENDENCIES_SYMBOL]);
4522
4812
  }
4523
4813
  });
4524
4814
  let knownBuildInfoFields = new Set([
@@ -4533,41 +4823,296 @@ let knownBuildInfoFields = new Set([
4533
4823
  for (let key of Object.keys(buildInfo))knownBuildInfoFields.has(key) || (custom[key] = buildInfo[key]);
4534
4824
  return custom;
4535
4825
  };
4536
- Object.defineProperty(binding__default().NormalModule.prototype, 'identifier', {
4537
- enumerable: !0,
4538
- configurable: !0,
4539
- value () {
4540
- return this[binding__default().MODULE_IDENTIFIER_SYMBOL];
4541
- }
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;
4826
+ class ContextModuleFactoryBeforeResolveData {
4827
+ #inner;
4828
+ static __from_binding(binding) {
4829
+ return new ContextModuleFactoryBeforeResolveData(binding);
4548
4830
  }
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);
4831
+ static __to_binding(data) {
4832
+ return data.#inner;
4554
4833
  }
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");
4560
- return getOrCreateCompilationHooks(compilation, compilation, ()=>({
4561
- loader: new SyncHook([
4562
- 'loaderContext',
4563
- 'module'
4564
- ]),
4565
- readResource: new HookMap(()=>new AsyncSeriesBailHook([
4566
- 'loaderContext'
4567
- ]))
4568
- }));
4834
+ constructor(binding){
4835
+ this.#inner = binding, Object.defineProperties(this, {
4836
+ context: {
4837
+ enumerable: !0,
4838
+ get: ()=>binding.context,
4839
+ set (val) {
4840
+ binding.context = val;
4841
+ }
4842
+ },
4843
+ request: {
4844
+ enumerable: !0,
4845
+ get: ()=>binding.request,
4846
+ set (val) {
4847
+ binding.request = val;
4848
+ }
4849
+ },
4850
+ regExp: {
4851
+ enumerable: !0,
4852
+ get: ()=>binding.regExp,
4853
+ set (val) {
4854
+ binding.regExp = val;
4855
+ }
4856
+ },
4857
+ recursive: {
4858
+ enumerable: !0,
4859
+ get: ()=>binding.recursive,
4860
+ set (val) {
4861
+ binding.recursive = val;
4862
+ }
4863
+ }
4864
+ });
4569
4865
  }
4570
- });
4866
+ }
4867
+ class ContextModuleFactoryAfterResolveData {
4868
+ #inner;
4869
+ static __from_binding(binding) {
4870
+ return new ContextModuleFactoryAfterResolveData(binding);
4871
+ }
4872
+ static __to_binding(data) {
4873
+ return data.#inner;
4874
+ }
4875
+ constructor(binding){
4876
+ this.#inner = binding, Object.defineProperties(this, {
4877
+ resource: {
4878
+ enumerable: !0,
4879
+ get: ()=>binding.resource,
4880
+ set (val) {
4881
+ binding.resource = val;
4882
+ }
4883
+ },
4884
+ context: {
4885
+ enumerable: !0,
4886
+ get: ()=>binding.context,
4887
+ set (val) {
4888
+ binding.context = val;
4889
+ }
4890
+ },
4891
+ request: {
4892
+ enumerable: !0,
4893
+ get: ()=>binding.request,
4894
+ set (val) {
4895
+ binding.request = val;
4896
+ }
4897
+ },
4898
+ regExp: {
4899
+ enumerable: !0,
4900
+ get: ()=>binding.regExp,
4901
+ set (val) {
4902
+ binding.regExp = val;
4903
+ }
4904
+ },
4905
+ recursive: {
4906
+ enumerable: !0,
4907
+ get: ()=>binding.recursive,
4908
+ set (val) {
4909
+ binding.recursive = val;
4910
+ }
4911
+ },
4912
+ dependencies: {
4913
+ enumerable: !0,
4914
+ get: ()=>binding.dependencies
4915
+ }
4916
+ });
4917
+ }
4918
+ }
4919
+ let Module_Module = class Module {
4920
+ static #properties = {
4921
+ type: {
4922
+ enumerable: !0,
4923
+ configurable: !0,
4924
+ get () {
4925
+ return null === this.#type && (this.#type = binding__default().moduleGetType(this)), this.#type;
4926
+ },
4927
+ set (value) {
4928
+ this.#type = value;
4929
+ }
4930
+ },
4931
+ context: {
4932
+ enumerable: !0,
4933
+ configurable: !0,
4934
+ get () {
4935
+ return binding__default().moduleGetContext(this);
4936
+ }
4937
+ },
4938
+ layer: {
4939
+ enumerable: !0,
4940
+ configurable: !0,
4941
+ get () {
4942
+ return binding__default().moduleGetLayer(this);
4943
+ }
4944
+ },
4945
+ useSourceMap: {
4946
+ enumerable: !0,
4947
+ configurable: !0,
4948
+ get () {
4949
+ return binding__default().moduleGetUseSourceMap(this);
4950
+ }
4951
+ },
4952
+ useSimpleSourceMap: {
4953
+ enumerable: !0,
4954
+ configurable: !0,
4955
+ get () {
4956
+ return binding__default().moduleGetUseSimpleSourceMap(this);
4957
+ }
4958
+ },
4959
+ factoryMeta: {
4960
+ enumerable: !0,
4961
+ configurable: !0,
4962
+ get () {
4963
+ return binding__default().moduleGetFactoryMeta(this);
4964
+ },
4965
+ set (value) {
4966
+ binding__default().moduleSetFactoryMeta(this, value);
4967
+ }
4968
+ },
4969
+ buildInfo: {
4970
+ enumerable: !0,
4971
+ configurable: !0,
4972
+ get () {
4973
+ return binding__default().moduleGetBuildInfo(this);
4974
+ },
4975
+ set (value) {
4976
+ binding__default().moduleSetBuildInfo(this, value);
4977
+ }
4978
+ }
4979
+ };
4980
+ #identifier;
4981
+ #type = null;
4982
+ constructor(){
4983
+ Object.defineProperties(this, Module.#properties), this.buildMeta = {};
4984
+ }
4985
+ identifier() {
4986
+ return this.#identifier ??= binding__default().moduleGetIdentifier(this);
4987
+ }
4988
+ get blocks() {
4989
+ return binding__default().moduleGetBlocks(this);
4990
+ }
4991
+ get dependencies() {
4992
+ return binding__default().moduleGetDependencies(this);
4993
+ }
4994
+ readableIdentifier() {
4995
+ return binding__default().moduleGetReadableIdentifier(this);
4996
+ }
4997
+ originalSource() {
4998
+ let source = binding__default().moduleGetOriginalSource(this);
4999
+ return source ? SourceAdapter.fromBinding(source) : null;
5000
+ }
5001
+ nameForCondition() {
5002
+ return binding__default().moduleGetNameForCondition(this);
5003
+ }
5004
+ size(ty) {
5005
+ return binding__default().moduleSize(this, ty);
5006
+ }
5007
+ libIdent(options) {
5008
+ return binding__default().moduleLibIdent(this, options);
5009
+ }
5010
+ emitFile(filename, source, assetInfo) {
5011
+ binding__default().moduleEmitFile(this, filename, SourceAdapter.toBinding(source), assetInfo);
5012
+ }
5013
+ };
5014
+ class NormalModule extends Module_Module {
5015
+ #resource = null;
5016
+ #request = null;
5017
+ #userRequest = null;
5018
+ #rawRequest = null;
5019
+ #resourceResolveData = null;
5020
+ #loaders = null;
5021
+ static #properties = {
5022
+ resource: {
5023
+ enumerable: !0,
5024
+ configurable: !0,
5025
+ get () {
5026
+ return null === this.#resource && (this.#resource = binding__default().normalModuleGetResource(this)), this.#resource;
5027
+ },
5028
+ set (value) {
5029
+ this.#resource = value;
5030
+ }
5031
+ },
5032
+ request: {
5033
+ enumerable: !0,
5034
+ configurable: !0,
5035
+ get () {
5036
+ return null === this.#request && (this.#request = binding__default().normalModuleGetRequest(this)), this.#request;
5037
+ },
5038
+ set (value) {
5039
+ this.#request = value;
5040
+ }
5041
+ },
5042
+ userRequest: {
5043
+ enumerable: !0,
5044
+ configurable: !0,
5045
+ get () {
5046
+ return null === this.#userRequest && (this.#userRequest = binding__default().normalModuleGetUserRequest(this)), this.#userRequest;
5047
+ },
5048
+ set (value) {
5049
+ this.#userRequest = value;
5050
+ }
5051
+ },
5052
+ rawRequest: {
5053
+ enumerable: !0,
5054
+ configurable: !0,
5055
+ get () {
5056
+ return null === this.#rawRequest && (this.#rawRequest = binding__default().normalModuleGetRawRequest(this)), this.#rawRequest;
5057
+ },
5058
+ set (value) {
5059
+ this.#rawRequest = value;
5060
+ }
5061
+ },
5062
+ resourceResolveData: {
5063
+ enumerable: !0,
5064
+ configurable: !0,
5065
+ get () {
5066
+ return null === this.#resourceResolveData && (this.#resourceResolveData = binding__default().normalModuleGetResourceResolveData(this)), this.#resourceResolveData;
5067
+ },
5068
+ set (value) {
5069
+ this.#resourceResolveData = value;
5070
+ }
5071
+ },
5072
+ loaders: {
5073
+ enumerable: !0,
5074
+ configurable: !0,
5075
+ get () {
5076
+ return null === this.#loaders && (this.#loaders = binding__default().normalModuleGetLoaders(this)), this.#loaders;
5077
+ },
5078
+ set (value) {
5079
+ this.#loaders = value;
5080
+ }
5081
+ },
5082
+ matchResource: {
5083
+ enumerable: !0,
5084
+ configurable: !0,
5085
+ get () {
5086
+ return binding__default().normalModuleGetMatchResource(this);
5087
+ },
5088
+ set (value) {
5089
+ binding__default().normalModuleSetMatchResource(this, value);
5090
+ }
5091
+ },
5092
+ error: {
5093
+ enumerable: !0,
5094
+ configurable: !0,
5095
+ get () {
5096
+ return binding__default().normalModuleGetError(this);
5097
+ }
5098
+ }
5099
+ };
5100
+ constructor(){
5101
+ super(), Object.defineProperties(this, NormalModule.#properties);
5102
+ }
5103
+ static getCompilationHooks(compilation) {
5104
+ if (!(COMPILATION_HOOKS_MAP_SYMBOL in compilation)) throw TypeError("The 'compilation' argument must be an instance of Compilation");
5105
+ return getOrCreateCompilationHooks(compilation, compilation, ()=>({
5106
+ loader: new SyncHook([
5107
+ 'loaderContext',
5108
+ 'module'
5109
+ ]),
5110
+ readResource: new HookMap(()=>new AsyncSeriesBailHook([
5111
+ 'loaderContext'
5112
+ ]))
5113
+ }));
5114
+ }
5115
+ }
4571
5116
  class NonErrorEmittedError extends Error {
4572
5117
  constructor(error){
4573
5118
  super(), this.name = 'NonErrorEmittedError', this.message = `(Emitted value instead of an instance of Error) ${error}`;
@@ -4880,47 +5425,9 @@ class ModuleWarning extends lib_WebpackError {
4880
5425
  super(ModuleError_createMessage(err, 'Warning', from)), this.name = 'ModuleWarning', this.error = err, this.details = getErrorDetails(err);
4881
5426
  }
4882
5427
  }
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 = [
5428
+ let codeFilter_decoder = new TextDecoder('utf-8', {
5429
+ fatal: !0
5430
+ }), DEPENDENCY_KEYS = [
4924
5431
  'fileDependencies',
4925
5432
  'contextDependencies',
4926
5433
  'missingDependencies',
@@ -4930,6 +5437,11 @@ let DEPENDENCY_KEYS = [
4930
5437
  contextDependencies: new Set(),
4931
5438
  missingDependencies: new Set(),
4932
5439
  buildDependencies: new Set()
5440
+ }), setsFrom = (dependencies)=>({
5441
+ fileDependencies: new Set(dependencies.fileDependencies),
5442
+ contextDependencies: new Set(dependencies.contextDependencies),
5443
+ missingDependencies: new Set(dependencies.missingDependencies),
5444
+ buildDependencies: new Set(dependencies.buildDependencies)
4933
5445
  }), arraysFrom = (sets)=>({
4934
5446
  fileDependencies: Array.from(sets.fileDependencies),
4935
5447
  contextDependencies: Array.from(sets.contextDependencies),
@@ -4938,16 +5450,14 @@ let DEPENDENCY_KEYS = [
4938
5450
  });
4939
5451
  class LoaderDependenciesState {
4940
5452
  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
- };
5453
+ #existingSets = {};
5454
+ #addedSets;
5455
+ #removedSets;
5456
+ constructor(existing, added, removed){
5457
+ this.existing = existing, this.#addedSets = added ? setsFrom(added) : createSets(), this.#removedSets = removed ? setsFrom(removed) : createSets();
5458
+ }
5459
+ #getExisting(key) {
5460
+ return this.#existingSets[key] ??= new Set(this.existing[key]);
4951
5461
  }
4952
5462
  get added() {
4953
5463
  return arraysFrom(this.#addedSets);
@@ -4962,13 +5472,12 @@ class LoaderDependenciesState {
4962
5472
  for (let key of DEPENDENCY_KEYS){
4963
5473
  let added = this.#addedSets[key], removed = this.#removedSets[key];
4964
5474
  if (0 === added.size && 0 === removed.size) continue;
4965
- let existing = this.#existingSets[key];
5475
+ let existing = this.#getExisting(key);
4966
5476
  for (let dependency of removed)existing.delete(dependency);
4967
5477
  for (let dependency of added)existing.add(dependency);
4968
5478
  let target = this.existing[key];
4969
5479
  for (let dependency of (target.length = 0, existing))target.push(dependency);
4970
5480
  }
4971
- this.resetChanges();
4972
5481
  }
4973
5482
  addDependencies(dependencies) {
4974
5483
  for (let key of DEPENDENCY_KEYS)for (let dependency of dependencies[key])this.add(key, dependency);
@@ -4998,30 +5507,20 @@ class LoaderDependenciesState {
4998
5507
  this.clear('fileDependencies'), this.clear('contextDependencies'), this.clear('missingDependencies');
4999
5508
  }
5000
5509
  add(key, dependency) {
5001
- this.#removedSets[key].delete(dependency), this.#addedSets[key].add(dependency);
5510
+ this.#addedSets[key].add(dependency);
5002
5511
  }
5003
5512
  get(key) {
5004
5513
  let removed = this.#removedSets[key], dependencies = new Set();
5005
- for (let dependency of this.#existingSets[key])removed.has(dependency) || dependencies.add(dependency);
5514
+ for (let dependency of this.#getExisting(key))removed.has(dependency) || dependencies.add(dependency);
5006
5515
  for (let dependency of this.#addedSets[key])dependencies.add(dependency);
5007
5516
  return Array.from(dependencies);
5008
5517
  }
5009
5518
  clear(key) {
5010
5519
  let removed = this.#removedSets[key];
5011
- for (let dependency of (removed.clear(), this.#existingSets[key]))removed.add(dependency);
5520
+ for (let dependency of this.#getExisting(key))removed.add(dependency);
5012
5521
  this.#addedSets[key].clear();
5013
5522
  }
5014
5523
  }
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
5524
  function serializeAggregateErrorMember(value) {
5026
5525
  return value instanceof Error ? {
5027
5526
  __internal__type: 'error',
@@ -5063,95 +5562,7 @@ function deserializeError(error) {
5063
5562
  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
5563
  return Object.assign(deserializedError, properties), shouldDeserializeAsAggregate || void 0 === errors || (deserializedError.errors = errors), deserializedError;
5065
5564
  }
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 {
5565
+ let LoaderLoadingError = class extends Error {
5155
5566
  constructor(message){
5156
5567
  super(message), this.name = 'LoaderRunnerError', Error.captureStackTrace(this, this.constructor);
5157
5568
  }
@@ -5230,7 +5641,7 @@ let utils_decoder = new TextDecoder(), utils_loadLoader = promisify(loadLoader),
5230
5641
  if (isDone) return void (e instanceof Error ? console.error(e.stack) : console.error(e));
5231
5642
  isDone = !0, reportedError = !0, callback(e, []);
5232
5643
  }
5233
- }), LOADER_PROCESS_NAME = 'Loader Analysis';
5644
+ }), LOADER_PROCESS_NAME = 'Loader Analysis', IS_WASM = !!process.env.WASM;
5234
5645
  class LoaderObject {
5235
5646
  request;
5236
5647
  path;
@@ -5273,8 +5684,28 @@ class LoaderObject {
5273
5684
  if (!value) throw Error('noPitch should be true');
5274
5685
  this.loaderItem.noPitch = !0;
5275
5686
  }
5276
- shouldYield() {
5277
- return this.request.startsWith(BUILTIN_LOADER_PREFIX);
5687
+ shouldSkipNormal(content, cache) {
5688
+ let codeFilter = this.loaderItem.codeFilter;
5689
+ if (!codeFilter || this.loaderItem.filterMatched) return !1;
5690
+ let matched = function(filter, content, cache) {
5691
+ let code = function(content, cache) {
5692
+ let text;
5693
+ if (cache.initialized && cache.content === content) return cache.text ?? null;
5694
+ if ('string' == typeof content) text = content;
5695
+ else if (content instanceof Uint8Array) try {
5696
+ text = codeFilter_decoder.decode(content);
5697
+ } catch {
5698
+ text = null;
5699
+ }
5700
+ else text = null;
5701
+ return cache.initialized = !0, cache.content = content, cache.text = text, text;
5702
+ }(content, cache);
5703
+ if (null !== code) {
5704
+ let matched;
5705
+ return 'string' == typeof filter ? code.includes(filter) : (filter.lastIndex = 0, matched = filter.test(code), filter.lastIndex = 0, matched);
5706
+ }
5707
+ }(codeFilter, content, cache);
5708
+ return !1 === matched || (matched && (this.loaderItem.filterMatched = !0), !1);
5278
5709
  }
5279
5710
  static __from_binding(loaderItem, compiler) {
5280
5711
  return new this(loaderItem, compiler);
@@ -5304,7 +5735,7 @@ function getCurrentLoader(loaderContext, index = loaderContext.loaderIndex) {
5304
5735
  }
5305
5736
  async function runLoaders(compiler, context) {
5306
5737
  var buildInfo;
5307
- let loaderState = context.loaderState, pitch = loaderState === binding_.JsLoaderState.Pitching, { resource } = context, traceData = JavaScriptTracer.isEnabled() ? {
5738
+ let loaderState = context.loaderState, loaderChainStart = context.loaderChainStart, loaderChainEnd = context.loaderChainEnd, pitch = loaderState === binding_.JsLoaderState.Pitching, { resource } = context, traceData = JavaScriptTracer.isEnabled() ? {
5308
5739
  uuid: JavaScriptTracer.uuid(),
5309
5740
  args: {
5310
5741
  is_pitch: pitch,
@@ -5322,7 +5753,7 @@ async function runLoaders(compiler, context) {
5322
5753
  if ('/' === path) return '/';
5323
5754
  let i = path.lastIndexOf('/'), j = path.lastIndexOf('\\'), i2 = path.indexOf('/'), j2 = path.indexOf('\\'), idx = i > j ? i : j, idx2 = i > j ? i2 : j2;
5324
5755
  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 = {};
5756
+ }(resourcePath) : null, dependencies = new LoaderDependenciesState(context.dependencies, context.addedDependencies, context.removedDependencies), loaderContext = {};
5326
5757
  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
5758
  dependencies.addFile(file);
5328
5759
  }, loaderContext.addContextDependency = function(context) {
@@ -5446,7 +5877,7 @@ async function runLoaders(compiler, context) {
5446
5877
  let error = new ModuleError(e, {
5447
5878
  from: stringifyLoaderObject(loaderContext.loaders[loaderContext.loaderIndex])
5448
5879
  });
5449
- error.module = loaderContext._module, compiler._lastCompilation.__internal__pushRspackDiagnostic({
5880
+ (context.__internal__diagnostics ??= []).push({
5450
5881
  error,
5451
5882
  severity: binding_.JsRspackSeverity.Error
5452
5883
  });
@@ -5455,7 +5886,7 @@ async function runLoaders(compiler, context) {
5455
5886
  let warning = new ModuleWarning(e, {
5456
5887
  from: stringifyLoaderObject(loaderContext.loaders[loaderContext.loaderIndex])
5457
5888
  });
5458
- warning.module = loaderContext._module, compiler._lastCompilation.__internal__pushRspackDiagnostic({
5889
+ (context.__internal__diagnostics ??= []).push({
5459
5890
  error: warning,
5460
5891
  severity: binding_.JsRspackSeverity.Warn
5461
5892
  });
@@ -5506,9 +5937,9 @@ async function runLoaders(compiler, context) {
5506
5937
  context.__internal__parseMeta[key] = value;
5507
5938
  };
5508
5939
  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');
5940
+ 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
5941
  dependencies.mergeChanges();
5511
- let enableParallelism = (currentLoaderObject)=>!(process.env.WASM && currentLoaderObject?.loaderItem.cache) && currentLoaderObject?.parallel, isomorphoicRun = async (fn, args)=>{
5942
+ let enableParallelism = (currentLoaderObject)=>!(IS_WASM && currentLoaderObject?.loaderItem.cache) && currentLoaderObject?.parallel, isomorphoicRun = async (fn, args)=>{
5512
5943
  let loaderName, result, currentLoaderObject = getCurrentLoader(loaderContext), parallelism = enableParallelism(currentLoaderObject);
5513
5944
  if ((traceData || parallelism) && (loaderName = function(loaderPath, cwd = '') {
5514
5945
  let res = loaderPath.replace(cwd, '');
@@ -5527,9 +5958,113 @@ async function runLoaders(compiler, context) {
5527
5958
  uuid: traceData.uuid,
5528
5959
  args: traceData.args
5529
5960
  }), 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 = {
5961
+ let normalModule, workerLoaderSpan, workerLoaderContext;
5962
+ result = await (async (loaderName, task, options, workerOptions)=>(async (workerOptions)=>service_pool || (service_pool = import("../compiled/tinypool/dist/index.js").then(({ Tinypool })=>{
5963
+ 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);
5964
+ return new Tinypool({
5965
+ filename: node_path.resolve(import.meta.dirname, 'worker.js'),
5966
+ useAtomics: !1,
5967
+ maxThreads: maxWorkers || maxWorkersFromEnv || availableThreads,
5968
+ minThreads: maxWorkers || maxWorkersFromEnv || availableThreads,
5969
+ concurrentTasksPerWorker: 1
5970
+ });
5971
+ })))(workerOptions).then((pool)=>{
5972
+ let { port1: mainPort, port2: workerPort } = new MessageChannel(), { port1: mainSyncPort, port2: workerSyncPort } = new MessageChannel();
5973
+ return new Promise((resolve, reject)=>{
5974
+ let handleError = (error)=>{
5975
+ mainPort.close(), mainSyncPort.close(), reject(error);
5976
+ }, pendingRequests = new Map();
5977
+ mainPort.on('message', (message)=>{
5978
+ 'done' === message.type ? Promise.allSettled(pendingRequests.values()).then(()=>{
5979
+ mainPort.close(), mainSyncPort.close(), resolve(message.data);
5980
+ }) : 'done-error' === message.type ? Promise.allSettled(pendingRequests.values()).then(()=>{
5981
+ mainPort.close(), mainSyncPort.close(), reject(deserializeError(message.error));
5982
+ }) : 'request' === message.type ? pendingRequests.set(message.id, Promise.resolve().then(()=>options.handleIncomingRequest(message.requestType, ...message.data)).then((result)=>(mainPort.postMessage({
5983
+ type: 'response',
5984
+ id: message.id,
5985
+ data: result
5986
+ }), result)).catch((error)=>{
5987
+ mainPort.postMessage({
5988
+ type: 'response-error',
5989
+ id: message.id,
5990
+ error: serializeError(error)
5991
+ });
5992
+ })) : 'request-sync' === message.type && async function(message) {
5993
+ let result, { sharedBuffer } = message, sharedBufferView = new Int32Array(sharedBuffer);
5994
+ try {
5995
+ if ("WaitForPendingRequest" === message.requestType) {
5996
+ let pendingRequestId = message.data[0], isArray = Array.isArray(pendingRequestId), ids = isArray ? pendingRequestId : [
5997
+ pendingRequestId
5998
+ ];
5999
+ result = await Promise.all(ids.map((id)=>{
6000
+ let pendingRequest = pendingRequests.get(id);
6001
+ if (!pendingRequest) throw Error(`Unknown pending request: ${id}`);
6002
+ return pendingRequest;
6003
+ })), isArray || (result = result[0]);
6004
+ } else throw Error(`Unknown request type: ${message.requestType}`);
6005
+ mainSyncPort.postMessage({
6006
+ type: 'response',
6007
+ id: message.id,
6008
+ data: result
6009
+ });
6010
+ } catch (e) {
6011
+ mainSyncPort.postMessage({
6012
+ type: 'response-error',
6013
+ id: message.id,
6014
+ error: serializeError(e)
6015
+ });
6016
+ }
6017
+ Atomics.add(sharedBufferView, 0, 1), Atomics.notify(sharedBufferView, 0, 1 / 0);
6018
+ }(message);
6019
+ }), mainPort.on('messageerror', handleError);
6020
+ let found = [];
6021
+ for (let key of Object.keys(task)){
6022
+ let uncloneable = function findUncloneablePath(value, path, depth) {
6023
+ try {
6024
+ structuredClone(value);
6025
+ return;
6026
+ } catch (e) {
6027
+ if (depth > 0 && 'object' == typeof value && null !== value) for (let key of Object.keys(value)){
6028
+ let deeper = findUncloneablePath(value[key], `${path}.${key}`, depth - 1);
6029
+ if (deeper) return deeper;
6030
+ }
6031
+ return {
6032
+ path,
6033
+ reason: e.message
6034
+ };
6035
+ }
6036
+ }(task[key], key, 6);
6037
+ uncloneable && found.push(uncloneable);
6038
+ }
6039
+ if (found.length > 0) {
6040
+ let details = found.map((item)=>` ${item.path.replace(/^loaderContext\._module\.buildInfo/, 'module.buildInfo').replace(/^loaderContext\.loaders\.\d+\.options/, 'options').replace(/^loaderContext\.?/, '')}: ${item.reason}`).join('\n');
6041
+ throw Error(`${loaderName} cannot run with \`parallel: true\`. A parallel loader runs in a worker thread and receives its loader context through a structured clone, so the loader options and the custom \`module.buildInfo\` fields the module already carries all have to be cloneable:\n${details}\nEither remove \`parallel\` from this loader, or keep the value above out of the loader options and \`module.buildInfo\`.`);
6042
+ }
6043
+ pool.run({
6044
+ ...task,
6045
+ workerData: {
6046
+ workerPort,
6047
+ workerSyncPort
6048
+ }
6049
+ }, {
6050
+ ...options,
6051
+ transferList: [
6052
+ ...options?.transferList || [],
6053
+ workerPort,
6054
+ workerSyncPort
6055
+ ]
6056
+ }).catch(handleError);
6057
+ });
6058
+ }))(loaderName, {
6059
+ loaderContext: (normalModule = loaderContext._module instanceof NormalModule ? loaderContext._module : void 0, workerLoaderSpan = (()=>{
6060
+ let start = loaderContext.loaderIndex, end = start + 1;
6061
+ if (loaderState === binding_.JsLoaderState.Pitching) for(; end < loaderChainEnd && loaderContext.loaders[end]?.parallel;)end++;
6062
+ else for(; start > loaderChainStart && loaderContext.loaders[start - 1]?.parallel;)start--;
6063
+ return {
6064
+ start,
6065
+ end
6066
+ };
6067
+ })(), Object.assign(workerLoaderContext = {
5533
6068
  version: loaderContext.version,
5534
6069
  hot: loaderContext.hot,
5535
6070
  context: loaderContext.context,
@@ -5541,9 +6076,11 @@ async function runLoaders(compiler, context) {
5541
6076
  sourceMap: loaderContext.sourceMap,
5542
6077
  rootContext: loaderContext.rootContext,
5543
6078
  loaderIndex: loaderContext.loaderIndex,
5544
- loaders: loaderContext.loaders.map((item)=>{
6079
+ loaderChainStart: workerLoaderSpan.start,
6080
+ loaderChainEnd: workerLoaderSpan.end,
6081
+ loaders: loaderContext.loaders.map((item, index)=>{
5545
6082
  let options = item.options;
5546
- return (!item.parallel || item.request.startsWith(BUILTIN_LOADER_PREFIX)) && (options = void 0), {
6083
+ return (!item.parallel || index < workerLoaderSpan.start || index >= workerLoaderSpan.end) && (options = void 0), {
5547
6084
  ...item,
5548
6085
  options,
5549
6086
  pitch: void 0,
@@ -5612,10 +6149,6 @@ async function runLoaders(compiler, context) {
5612
6149
  case "ClearDependencies":
5613
6150
  loaderContext.clearDependencies();
5614
6151
  break;
5615
- case "BeginDependencyChanges":
5616
- case "MergeDependencyChanges":
5617
- dependencies.mergeChanges();
5618
- break;
5619
6152
  case "Resolve":
5620
6153
  return new Promise((resolve, reject)=>{
5621
6154
  loaderContext.resolve(args[0], args[1], (err, result, resolveRequest)=>{
@@ -5677,7 +6210,7 @@ async function runLoaders(compiler, context) {
5677
6210
  let updates = args[0];
5678
6211
  loaderContext.loaders = loaderContext.loaders.map((item, index)=>{
5679
6212
  let update = updates[index];
5680
- return item.loaderItem.data = update.data, update.pitchExecuted && (item.pitchExecuted = !0), update.normalExecuted && (item.normalExecuted = !0), item;
6213
+ return item.loaderItem.data = update.data, update.pitchExecuted && (item.pitchExecuted = !0), update.normalExecuted && (item.normalExecuted = !0), update.filterMatched && (item.loaderItem.filterMatched = !0), item;
5681
6214
  });
5682
6215
  break;
5683
6216
  }
@@ -5690,16 +6223,6 @@ async function runLoaders(compiler, context) {
5690
6223
  })(buildInfo, pickCustomBuildInfoFields(args[0]));
5691
6224
  break;
5692
6225
  }
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
6226
  case "CompilationGetPath":
5704
6227
  {
5705
6228
  let filename = args[0], data = args[1];
@@ -5744,9 +6267,8 @@ async function runLoaders(compiler, context) {
5744
6267
  try {
5745
6268
  switch(loaderState){
5746
6269
  case binding_.JsLoaderState.Pitching:
5747
- for(; loaderContext.loaderIndex < loaderContext.loaders.length;){
6270
+ for(; loaderContext.loaderIndex < loaderChainEnd;){
5748
6271
  let args, currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex], parallelism = enableParallelism(currentLoaderObject);
5749
- if (currentLoaderObject.shouldYield()) break;
5750
6272
  if (currentLoaderObject.pitchExecuted) {
5751
6273
  loaderContext.loaderIndex += 1;
5752
6274
  continue;
@@ -5774,21 +6296,21 @@ async function runLoaders(compiler, context) {
5774
6296
  break;
5775
6297
  case binding_.JsLoaderState.Normal:
5776
6298
  {
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;
6299
+ let sourceMap, content = context.content, rawSourceMap = context.sourceMap, sourceMapParsed = !1, additionalData = context.additionalData, codeFilterTextCache = {
6300
+ initialized: !1
6301
+ };
6302
+ for(; loaderContext.loaderIndex >= loaderChainStart;){
6303
+ let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
5781
6304
  if (currentLoaderObject.normalExecuted) {
5782
6305
  loaderContext.loaderIndex--;
5783
6306
  continue;
5784
6307
  }
5785
- dependencies.resetChanges();
6308
+ if (currentLoaderObject.shouldSkipNormal(content, codeFilterTextCache)) {
6309
+ currentLoaderObject.normalExecuted = !0, loaderContext.loaderIndex--;
6310
+ continue;
6311
+ }
6312
+ let parallelism = enableParallelism(currentLoaderObject);
5786
6313
  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
6314
  await utils_loadLoader(currentLoaderObject, compiler);
5793
6315
  let fn = currentLoaderObject.normal;
5794
6316
  if (parallelism && fn || (currentLoaderObject.normalExecuted = !0), !fn) continue;
@@ -5796,7 +6318,7 @@ async function runLoaders(compiler, context) {
5796
6318
  content,
5797
6319
  sourceMap,
5798
6320
  additionalData
5799
- ]), null === cached && await loaderCache?.store(loaderContext.loaderIndex, content, JsSourceMap.__to_binding(sourceMap), additionalData);
6321
+ ]), codeFilterTextCache.initialized = !1, codeFilterTextCache.content = void 0, codeFilterTextCache.text = void 0;
5800
6322
  } finally{
5801
6323
  dependencies.mergeChanges();
5802
6324
  }
@@ -5818,7 +6340,7 @@ async function runLoaders(compiler, context) {
5818
6340
  name: 'run_js_loaders',
5819
6341
  uuid: traceData.uuid,
5820
6342
  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;
6343
+ }), 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
6344
  }
5823
6345
  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
6346
  let { context, entryOnly, format, name, path, type } = options;
@@ -5856,13 +6378,13 @@ let JsLoaderRspackPlugin = base_create(binding_.BuiltinPluginName.JsLoaderRspack
5856
6378
  pseudoClasses
5857
6379
  }
5858
6380
  };
5859
- }), LimitChunkCountPlugin = base_create(binding_.BuiltinPluginName.LimitChunkCountPlugin, (options)=>options), BuiltinLazyCompilationPlugin = base_create(binding_.BuiltinPluginName.LazyCompilationPlugin, (takeNewlyActiveModules, entries, imports, client, reservedExternals, test)=>({
6381
+ }), LimitChunkCountPlugin = base_create(binding_.BuiltinPluginName.LimitChunkCountPlugin, (options)=>options), BuiltinLazyCompilationPlugin = base_create(binding_.BuiltinPluginName.LazyCompilationPlugin, (takeNewlyActiveModules, entries, imports, client, collectReservedExternals, test)=>({
5860
6382
  imports,
5861
6383
  entries,
5862
6384
  test,
5863
6385
  client,
5864
6386
  takeNewlyActiveModules,
5865
- reservedExternals
6387
+ collectReservedExternals
5866
6388
  }), 'thisCompilation'), middleware_require = createRequire(import.meta.url), LAZY_COMPILATION_PREFIX = '/_rspack/lazy/trigger', noop = (_req, _res, next)=>{
5867
6389
  'function' == typeof next && next();
5868
6390
  }, lazyCompilationMiddleware = (compiler)=>{
@@ -5894,23 +6416,27 @@ let JsLoaderRspackPlugin = base_create(binding_.BuiltinPluginName.JsLoaderRspack
5894
6416
  return applyPlugin(compiler, options, newlyActiveModules), lazyCompilationMiddlewareInternal(compiler, newlyActiveModules, options.prefix || LAZY_COMPILATION_PREFIX);
5895
6417
  };
5896
6418
  function applyPlugin(compiler, options, newlyActiveModules) {
6419
+ let externals = compiler.options.externals;
5897
6420
  new BuiltinLazyCompilationPlugin(()=>{
5898
6421
  let res = new Set(newlyActiveModules);
5899
6422
  return newlyActiveModules.clear(), res;
5900
6423
  }, 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
6424
  let lazyCompilationPrefix = prefix || LAZY_COMPILATION_PREFIX;
5902
6425
  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);
6426
+ })(options))}`, (layer)=>(function(externals, layer) {
6427
+ let requests = new Set(), visit = (item)=>{
6428
+ if ('string' == typeof item) return void requests.add(item);
6429
+ if (!item || 'object' != typeof item || item instanceof RegExp) return;
6430
+ let resolved = resolveLayerExternals(item, layer);
6431
+ if ('string' == typeof resolved) return void requests.add(resolved);
6432
+ if (resolved && 'object' == typeof resolved && !(resolved instanceof RegExp)) for (let [request, value] of Object.entries(resolved))!1 !== value && requests.add(request);
6433
+ };
6434
+ if (Array.isArray(externals)) for (let item of externals)visit(item);
6435
+ else void 0 !== externals && visit(externals);
6436
+ return [
6437
+ ...requests
6438
+ ];
6439
+ })(externals, layer ?? null), options.test).apply(compiler);
5914
6440
  }
5915
6441
  let lazyCompilationMiddlewareInternal = (compiler, newlyActiveModules, lazyCompilationPrefix)=>{
5916
6442
  let logger = compiler.getInfrastructureLogger('LazyCompilation');
@@ -6183,6 +6709,7 @@ let SizeLimitsPlugin = base_create(binding_.BuiltinPluginName.SizeLimitsPlugin,
6183
6709
  return options.htmlPlugin === NATIVE_HTML_PLUGIN ? htmlPlugin = 'Native' : 'string' == typeof options.htmlPlugin && (htmlPlugin = 'JavaScript'), {
6184
6710
  hashFuncNames: options.hashFuncNames,
6185
6711
  htmlPlugin,
6712
+ hashLoading: options.hashLoading,
6186
6713
  integrityCallback: options.integrityCallback
6187
6714
  };
6188
6715
  });
@@ -6196,7 +6723,8 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
6196
6723
  'sha384'
6197
6724
  ],
6198
6725
  htmlPlugin: options.htmlPlugin ?? NATIVE_HTML_PLUGIN,
6199
- enabled: options.enabled ?? 'auto'
6726
+ enabled: options.enabled ?? 'auto',
6727
+ hashLoading: options.hashLoading ?? 'eager'
6200
6728
  };
6201
6729
  super({
6202
6730
  ...finalOptions,
@@ -6301,7 +6829,7 @@ function normalizePath(path) {
6301
6829
  return path.replace(/\?.*$/, '').split(sep).join('/');
6302
6830
  }
6303
6831
  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 = {
6832
+ 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
6833
  comments: !1,
6306
6834
  ...options?.minimizerOptions?.format
6307
6835
  };
@@ -6388,197 +6916,70 @@ class ContextModuleFactory {
6388
6916
  };
6389
6917
  }
6390
6918
  }
6391
- let bindingHelpers = {
6392
- applyIndexedArrayUpdates: function(source, target, commands) {
6393
- let mode = commands[0], length = commands[1];
6394
- if (0 === mode) {
6395
- target.length = length;
6396
- for(let i = 0, cursor = 2; cursor < commands.length; i++, cursor++)target[i] = source[commands[cursor]];
6397
- } else for(let cursor = 2; cursor < commands.length; cursor += 2)target[commands[cursor]] = source[commands[cursor + 1]];
6398
- target.length = length;
6399
- },
6400
- swapRemoveArrayElements: function(array, removedIndices) {
6401
- let length = array.length;
6402
- for (let index of removedIndices)index !== --length && (array[index] = array[length]);
6403
- array.length = length;
6404
- }
6405
- };
6406
- function assertNotNill(value) {
6407
- if (null == value) throw Error(`${value} should not be undefined or null`);
6408
- }
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);
6919
+ class ConcatenatedModule extends Module_Module {
6920
+ get rootModule() {
6921
+ return binding__default().concatenatedModuleGetRootModule(this);
6492
6922
  }
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
- }
6923
+ get modules() {
6924
+ return binding__default().concatenatedModuleGetModules(this);
6549
6925
  }
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');
6926
+ }
6927
+ class ContextModule extends Module_Module {
6928
+ }
6929
+ class ExternalModule extends Module_Module {
6930
+ #userRequest = null;
6931
+ static #properties = {
6932
+ userRequest: {
6933
+ enumerable: !0,
6934
+ configurable: !0,
6935
+ get () {
6936
+ return null === this.#userRequest && (this.#userRequest = binding__default().externalModuleGetUserRequest(this)), this.#userRequest;
6937
+ },
6938
+ set (value) {
6939
+ this.#userRequest = value;
6577
6940
  }
6578
- default:
6579
- throw Error('Not implemented');
6941
+ }
6942
+ };
6943
+ constructor(){
6944
+ super(), Object.defineProperties(this, ExternalModule.#properties);
6945
+ }
6946
+ static getCompilationHooks(compilation) {
6947
+ if (!(COMPILATION_HOOKS_MAP_SYMBOL in compilation)) throw TypeError("The 'compilation' argument must be an instance of Compilation");
6948
+ return getOrCreateCompilationHooks(compilation, binding__default(), ()=>({
6949
+ chunkCondition: new SyncBailHook([
6950
+ 'chunk',
6951
+ 'compilation'
6952
+ ])
6953
+ }));
6954
+ }
6955
+ }
6956
+ let MODULE_CLASSES = {
6957
+ [binding_.ModuleKind.Module]: Module_Module,
6958
+ [binding_.ModuleKind.Normal]: NormalModule,
6959
+ [binding_.ModuleKind.Concatenated]: ConcatenatedModule,
6960
+ [binding_.ModuleKind.Context]: ContextModule,
6961
+ [binding_.ModuleKind.External]: ExternalModule
6962
+ }, bindingHelpers = {
6963
+ createModule: function(kind) {
6964
+ return new MODULE_CLASSES[kind]();
6965
+ },
6966
+ applyIndexedArrayUpdates: function(source, target, commands) {
6967
+ let mode = commands[0], length = commands[1];
6968
+ if (0 === mode) {
6969
+ target.length = length;
6970
+ for(let i = 0, cursor = 2; cursor < commands.length; i++, cursor++)target[i] = source[commands[cursor]];
6971
+ } else for(let cursor = 2; cursor < commands.length; cursor += 2)target[commands[cursor]] = source[commands[cursor + 1]];
6972
+ target.length = length;
6973
+ },
6974
+ swapRemoveArrayElements: function(array, removedIndices) {
6975
+ let length = array.length;
6976
+ for (let index of removedIndices)index !== --length && (array[index] = array[length]);
6977
+ array.length = length;
6580
6978
  }
6581
6979
  };
6980
+ function assertNotNill(value) {
6981
+ if (null == value) throw Error(`${value} should not be undefined or null`);
6982
+ }
6582
6983
  class BrowserslistError extends Error {
6583
6984
  constructor(message){
6584
6985
  var key, value;
@@ -6593,8 +6994,14 @@ class BrowserslistError extends Error {
6593
6994
  let isFileCache = {};
6594
6995
  function isFile(file) {
6595
6996
  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;
6997
+ try {
6998
+ let result = node_fs.existsSync(file) && node_fs.statSync(file).isFile();
6999
+ return isFileCache[file] = result, result;
7000
+ } catch (error) {
7001
+ let { code } = error;
7002
+ if ('ENOENT' === code || 'EACCES' === code || 'ERR_ACCESS_DENIED' === code) return !1;
7003
+ throw error;
7004
+ }
6598
7005
  }
6599
7006
  function parsePackage(file) {
6600
7007
  let config = JSON.parse(node_fs.readFileSync(file).toString().replace(/^\uFEFF/m, ''));
@@ -6607,7 +7014,7 @@ function parsePackage(file) {
6607
7014
  if (Array.isArray(section)) {
6608
7015
  for(let i = 0; i < section.length; i++)if ('string' != typeof section[i]) throw new BrowserslistError(FORMAT);
6609
7016
  } else if ('string' != typeof section) throw new BrowserslistError(FORMAT);
6610
- }(list[i]);
7017
+ }(list[i]), 'string' == typeof list[i] && (list[i] = parseConfig(list[i]).defaults);
6611
7018
  return list;
6612
7019
  }
6613
7020
  let IS_SECTION = /^\s*\[(.+)]\s*$/;
@@ -7174,6 +7581,23 @@ let configCache = {}, ES_VERSIONS_MAP = {
7174
7581
  6
7175
7582
  ]
7176
7583
  }),
7584
+ topLevelAwait: rawChecker({
7585
+ chrome: 89,
7586
+ and_chr: 89,
7587
+ edge: 89,
7588
+ firefox: 89,
7589
+ and_ff: 89,
7590
+ opera: 75,
7591
+ op_mob: 63,
7592
+ safari: 15,
7593
+ ios_saf: 15,
7594
+ samsung: 15,
7595
+ android: 89,
7596
+ node: [
7597
+ 14,
7598
+ 8
7599
+ ]
7600
+ }),
7177
7601
  browser: browserProperty,
7178
7602
  electron: !1,
7179
7603
  node: nodeProperty,
@@ -7347,6 +7771,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7347
7771
  methodShorthand: v(4),
7348
7772
  arrowFunction: v(6),
7349
7773
  asyncFunction: v(7, 6),
7774
+ topLevelAwait: v(14, 8),
7350
7775
  forOf: v(5),
7351
7776
  destructuring: v(6),
7352
7777
  bigIntLiteral: v(10, 4),
@@ -7394,6 +7819,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7394
7819
  methodShorthand: v(1, 1),
7395
7820
  arrowFunction: v(1, 1),
7396
7821
  asyncFunction: v(1, 7),
7822
+ topLevelAwait: v(12),
7397
7823
  forOf: v(0, 36),
7398
7824
  destructuring: v(1, 1),
7399
7825
  bigIntLiteral: v(4),
@@ -7435,6 +7861,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7435
7861
  methodShorthand: v(0, 15),
7436
7862
  arrowFunction: v(0, 15),
7437
7863
  asyncFunction: v(0, 21),
7864
+ topLevelAwait: v(0, 52),
7438
7865
  forOf: v(0, 13),
7439
7866
  destructuring: v(0, 15),
7440
7867
  bigIntLiteral: v(0, 32),
@@ -7451,7 +7878,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7451
7878
  (version)=>{
7452
7879
  let v = +version;
7453
7880
  return 5 < v && v < 1000 && (v += 2009), {
7454
- esVersion: v > 2022 ? 2022 : v,
7881
+ esVersion: v > 2024 ? 2024 : v,
7455
7882
  const: v >= 2015,
7456
7883
  computedProperty: v >= 2015,
7457
7884
  templateLiteral: v >= 2015,
@@ -7463,6 +7890,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7463
7890
  destructuring: v >= 2015,
7464
7891
  module: v >= 2015,
7465
7892
  asyncFunction: v >= 2017,
7893
+ topLevelAwait: v >= 2022,
7466
7894
  globalThis: v >= 2020,
7467
7895
  bigIntLiteral: v >= 2020,
7468
7896
  dynamicImport: v >= 2020,
@@ -7513,7 +7941,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7513
7941
  (hasTrue || hasFalse) && (result[key] = hasFalse && hasTrue ? null : hasTrue);
7514
7942
  }
7515
7943
  return result;
7516
- })(targets.map((t)=>getTargetProperties(t, context))), ERROR_PREFIX = 'Invalid Rspack configuration:', applyRspackOptionsDefaults = (options, compilerIndex)=>{
7944
+ })(targets.map((t)=>getTargetProperties(t, context))), applyRspackOptionsDefaults = (options, compilerIndex)=>{
7517
7945
  F(options, 'context', ()=>process.cwd()), F(options, 'target', ()=>hasBrowserslistConfig(options.context) ? 'browserslist' : 'web');
7518
7946
  let { mode, target } = options;
7519
7947
  if (isNil(target)) throw Error('target should not be nil after defaults');
@@ -7521,7 +7949,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7521
7949
  if ('function' != typeof options.entry) for (let key of Object.keys(options.entry))F(options.entry[key], 'import', ()=>[
7522
7950
  './src'
7523
7951
  ]);
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 && {
7952
+ 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
7953
  type: 'memory'
7526
7954
  }), applyCacheDefaults(options.cache, {
7527
7955
  context: options.context,
@@ -7530,10 +7958,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7530
7958
  compilerIndex
7531
7959
  }), applyIncrementalDefaults(options), applyExperimentsDefaults(options.experiments, {
7532
7960
  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
7961
+ }), applySnapshotDefaults(options.snapshot, {
7962
+ production
7537
7963
  }), applyOptimizationDefaults(options.optimization, {
7538
7964
  production,
7539
7965
  development
@@ -7580,7 +8006,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7580
8006
  targets: targetProperties.targets
7581
8007
  };
7582
8008
  }, applyCacheDefaults = (cache, { context, name, mode, compilerIndex })=>{
7583
- if (!1 !== cache) switch(('persistent' === cache.type || 'filesystem' === cache.type) && (F(cache, 'name', ()=>{
8009
+ if (!1 !== cache) switch('persistent' === cache.type && (F(cache, 'name', ()=>{
7584
8010
  let cacheName = name ? `${name}-${mode}` : mode;
7585
8011
  return void 0 !== compilerIndex && compilerIndex > 0 ? `${cacheName}-${compilerIndex}` : cacheName;
7586
8012
  }), D(cache, 'version', ''), D(cache, 'maxMemoryGenerations', 'development' === mode ? 5 : 1 / 0), D(cache, 'readonly', !1)), cache.type){
@@ -7588,14 +8014,9 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7588
8014
  break;
7589
8015
  case 'persistent':
7590
8016
  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
8017
  }
7595
- }, applySnapshotDefaults = (snapshot, { production, newCache })=>{
7596
- F(snapshot, 'immutablePaths', ()=>[]), F(snapshot, 'unmanagedPaths', ()=>[]), F(snapshot, 'managedPaths', ()=>newCache ? [
7597
- /^(.+?[\\/]node_modules[\\/])/
7598
- ] : [
8018
+ }, applySnapshotDefaults = (snapshot, { production })=>{
8019
+ F(snapshot, 'immutablePaths', ()=>[]), F(snapshot, 'unmanagedPaths', ()=>[]), F(snapshot, 'managedPaths', ()=>[
7599
8020
  /[\\/]node_modules[\\/][^.]/
7600
8021
  ]), F(snapshot, 'resolveBuildDependencies', ()=>({
7601
8022
  timestamp: !0,
@@ -7630,7 +8051,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7630
8051
  applyCssModuleParserOptionsDefaults(parserOptions), D(parserOptions, 'pure', !1);
7631
8052
  }, applyModuleDefaults = (module, { asyncWebAssembly, targetProperties, mode, uniqueName, deferImport, sourceImport, outputModule, hashFunction, hashSalt })=>{
7632
8053
  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', [
8054
+ 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
8055
  '...'
7635
8056
  ]), 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
8057
  })(module.parser.javascript, {
@@ -7830,6 +8251,9 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7830
8251
  }), F(environment, 'importMetaDirnameAndFilename', ()=>tp && tp.importMetaDirnameAndFilename), F(environment, 'templateLiteral', ()=>{
7831
8252
  let v;
7832
8253
  return tp && ((v = tp.templateLiteral) || void 0 === v);
8254
+ }), F(environment, 'topLevelAwait', ()=>{
8255
+ let v;
8256
+ return tp && ((v = tp.topLevelAwait) || void 0 === v);
7833
8257
  }), 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
8258
  let v;
7835
8259
  return tp && ((v = tp.document) || void 0 === v);
@@ -7849,7 +8273,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7849
8273
  }), D(output, 'hotUpdateChunkFilename', `[id].[fullhash].hot-update.${output.module ? 'mjs' : 'js'}`), F(output, 'hotUpdateMainFilename', ()=>`[runtime].[fullhash].hot-update.${output.module ? 'json.mjs' : 'json'}`);
7850
8274
  let uniqueNameId = Template.toIdentifier(output.uniqueName);
7851
8275
  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 ?? ''}".`);
8276
+ if (!context) throw Error(`Invalid Rspack configuration: "context" must be a non-empty absolute path when "output.path" is relative, get "${context ?? ''}".`);
7853
8277
  output.path = node_path.resolve(context, output.path);
7854
8278
  }
7855
8279
  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 +8348,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7924
8348
  return output.wasmLoading && enabledWasmLoadingTypes.add(output.wasmLoading), output.workerWasmLoading && enabledWasmLoadingTypes.add(output.workerWasmLoading), forEachEntry((desc)=>{
7925
8349
  desc.wasmLoading && enabledWasmLoadingTypes.add(desc.wasmLoading);
7926
8350
  }), 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));
8351
+ }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.3.2"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !1));
7928
8352
  }, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp, outputModule })=>{
7929
8353
  let isUniversal = (key)=>!!(outputModule && targetProperties && null === targetProperties[key]);
7930
8354
  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 +8385,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7961
8385
  "javascript",
7962
8386
  'css',
7963
8387
  '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', '-');
8388
+ ]), 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
8389
  let { cacheGroups } = splitChunks;
7966
8390
  cacheGroups && (F(cacheGroups, 'default', ()=>({
7967
8391
  idHint: '',
@@ -8231,32 +8655,12 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
8231
8655
  if (!0 === cache) return {
8232
8656
  type: 'memory'
8233
8657
  };
8234
- switch('persistent' === cache.type && config.experiments?.newCache && (cache = convertPersistentCacheOptions(cache)), cache.type){
8658
+ switch(cache.type){
8235
8659
  case void 0:
8236
8660
  case 'memory':
8237
8661
  return {
8238
8662
  type: 'memory'
8239
8663
  };
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
- }
8260
8664
  case 'persistent':
8261
8665
  {
8262
8666
  let hasMaxVersions = Object.hasOwn(cache, 'maxVersions');
@@ -8415,18 +8819,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
8415
8819
  module: optionalNestedConfig(snapshot.module, cloneObject),
8416
8820
  contextModule: optionalNestedConfig(snapshot.contextModule, cloneObject),
8417
8821
  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)=>({
8822
+ })), 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
8823
  ...value
8431
8824
  }), keyedNestedConfig = (value, fn, customKeys)=>{
8432
8825
  let result = void 0 === value ? {} : Object.keys(value).reduce((obj, key)=>(obj[key] = (customKeys && key in customKeys ? customKeys[key] : fn)(value[key]), obj), {});
@@ -8944,7 +9337,7 @@ class Cache {
8944
9337
  endIdle: new AsyncParallelHook([]),
8945
9338
  shutdown: new AsyncParallelHook([])
8946
9339
  };
8947
- let { JsCache } = rspackRequire("@rspack/binding");
9340
+ let { JsCache } = rspackRequire("@ohos-ports/rspack-binding");
8948
9341
  this.#binding = new JsCache();
8949
9342
  }
8950
9343
  static __to_binding(cache) {
@@ -9254,7 +9647,7 @@ class MultiStats {
9254
9647
  obj.children = this.stats.map((stat, idx)=>{
9255
9648
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
9256
9649
  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(''));
9650
+ }), childOptions.version && (obj.rspackVersion = "2.3.2", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
9258
9651
  let mapError = (j, obj)=>({
9259
9652
  ...obj,
9260
9653
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -9389,7 +9782,7 @@ class MultiCompiler {
9389
9782
  watching;
9390
9783
  constructor(compilers, options){
9391
9784
  let normalizedCompilers;
9392
- normalizedCompilers = Array.isArray(compilers) ? compilers : Object.entries(compilers).map(([name, compiler])=>(compiler.name = name, compiler)), this.hooks = {
9785
+ normalizedCompilers = Array.isArray(compilers) ? compilers : Object.entries(compilers).map(([name, compiler])=>(compiler.name = name, compiler.compilerPath = name, compiler)), this.hooks = {
9393
9786
  done: new SyncHook([
9394
9787
  'stats'
9395
9788
  ]),
@@ -9588,17 +9981,37 @@ let filterToFunction = (item)=>{
9588
9981
  log: 2,
9589
9982
  true: 2,
9590
9983
  verbose: 1
9591
- };
9984
+ }, internalCallbacks = new WeakSet(), consumeWatcherInfo = Symbol('consumeWatcherInfo'), EXISTENCE_ONLY_TIME_ENTRY = Object.freeze({}), memoizeTimeInfoEntries = (snapshot, key)=>memoize(()=>(({ entries: rows, missing })=>{
9985
+ let entries = new Map();
9986
+ for (let row of rows)if (row.existenceOnly) entries.set(row.path, EXISTENCE_ONLY_TIME_ENTRY);
9987
+ else {
9988
+ let entry = {
9989
+ safeTime: row.safeTime
9990
+ };
9991
+ null != row.timestamp && (entry.timestamp = row.timestamp), null != row.accuracy && (entry.accuracy = row.accuracy), entries.set(row.path, entry);
9992
+ }
9993
+ for (let path of missing)entries.set(path, null);
9994
+ return entries;
9995
+ })(snapshot[key]));
9592
9996
  class NativeWatcherShim extends EventEmitter {
9593
- #trigger;
9594
- constructor(trigger){
9595
- super(), this.#trigger = trigger;
9997
+ #fileSystem;
9998
+ constructor(fileSystem){
9999
+ super(), this.#fileSystem = fileSystem;
9596
10000
  }
9597
10001
  _onChange(item, _mtime, file, _type) {
9598
- this.#trigger('change', file ?? item);
10002
+ this.#fileSystem.triggerEvent('change', file ?? item);
9599
10003
  }
9600
10004
  _onRemove(item, file, _type) {
9601
- this.#trigger('remove', file ?? item);
10005
+ this.#fileSystem.triggerEvent('remove', file ?? item);
10006
+ }
10007
+ getTimes() {
10008
+ return this.#fileSystem.getTimes();
10009
+ }
10010
+ getTimeInfoEntries() {
10011
+ return this.#fileSystem.getTimeInfoEntries();
10012
+ }
10013
+ collectTimeInfoEntries(fileTimestamps, directoryTimestamps) {
10014
+ this.#fileSystem.collectTimeInfoEntries(fileTimestamps, directoryTimestamps);
9602
10015
  }
9603
10016
  }
9604
10017
  class NativeWatchFileSystem {
@@ -9619,8 +10032,8 @@ class NativeWatchFileSystem {
9619
10032
  if ('function' != typeof callback) throw Error("Invalid arguments: 'callback'");
9620
10033
  if ('object' != typeof options) throw Error("Invalid arguments: 'options'");
9621
10034
  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)=>{
10035
+ let nativeWatcher = this.getNativeWatcher(options), watcher = new NativeWatcherShim(this);
10036
+ this.#watcher = watcher, nativeWatcher.watch(this.formatWatchDependencies(files), this.formatWatchDependencies(directories), this.formatWatchDependencies(missing), BigInt(startTime), (err, result)=>{
9624
10037
  if (err) return void callback(err, new Map(), new Map(), new Set(), new Set());
9625
10038
  nativeWatcher.pause();
9626
10039
  let changedFiles = result.changedFiles, removedFiles = result.removedFiles;
@@ -9630,13 +10043,35 @@ class NativeWatchFileSystem {
9630
10043
  for (let item of removedFiles)fs.purge?.(item);
9631
10044
  }
9632
10045
  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);
10046
+ 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);
10047
+ let { fileTimeInfoEntries, contextTimeInfoEntries } = this.#fetchTimeInfo(nativeWatcher);
10048
+ callback(err, fileTimeInfoEntries, contextTimeInfoEntries, changes, removals);
9634
10049
  }, (event)=>{
9635
10050
  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, {
10051
+ let changeTime = Date.now(), mtime = null === event.mtime ? null : changeTime;
10052
+ callbackUndelayed(event.path, changeTime), this.#events.emit('change', event.path, mtime), watcher.emit('change', event.path, mtime);
10053
+ } else callbackUndelayed(event.path, Date.now()), this.#events.emit('remove', event.path), watcher.emit('remove', event.path);
10054
+ }), this.#isFirstWatch = !1;
10055
+ let info = ({ changedFiles, removedFiles })=>{
10056
+ let changes = new Set(changedFiles), removals = new Set(removedFiles);
10057
+ if (this.#inputFileSystem?.purge) {
10058
+ let fs = this.#inputFileSystem;
10059
+ for (let item of removals)fs.purge?.(item);
10060
+ for (let item of changes)fs.purge?.(item);
10061
+ }
10062
+ let timeInfo = this.#fetchTimeInfo(nativeWatcher);
10063
+ return {
10064
+ changes,
10065
+ removals,
10066
+ get fileTimeInfoEntries () {
10067
+ return timeInfo.fileTimeInfoEntries;
10068
+ },
10069
+ get contextTimeInfoEntries () {
10070
+ return timeInfo.contextTimeInfoEntries;
10071
+ }
10072
+ };
10073
+ };
10074
+ return {
9640
10075
  close: ()=>{
9641
10076
  this.#inner === nativeWatcher && (this.#inner = void 0, this.#isFirstWatch = !0), nativeWatcher.close().catch((err)=>{
9642
10077
  console.error('Error closing native watcher:', err);
@@ -9645,14 +10080,41 @@ class NativeWatchFileSystem {
9645
10080
  pause: ()=>{
9646
10081
  nativeWatcher.pause();
9647
10082
  },
9648
- getInfo: ()=>({
9649
- changes: new Set(),
9650
- removals: new Set(),
9651
- fileTimeInfoEntries: new Map(),
9652
- contextTimeInfoEntries: new Map()
9653
- })
10083
+ getInfo: ()=>info(nativeWatcher.peekAggregated()),
10084
+ [consumeWatcherInfo]: ()=>info(nativeWatcher.getAggregated())
10085
+ };
10086
+ }
10087
+ #fetchTimeInfo(nativeWatcher) {
10088
+ let snapshot = nativeWatcher.collectTimeInfoEntries(), files = memoizeTimeInfoEntries(snapshot, 'fileTimestamps'), directories = memoizeTimeInfoEntries(snapshot, 'directoryTimestamps');
10089
+ return {
10090
+ get fileTimeInfoEntries () {
10091
+ return files();
10092
+ },
10093
+ get contextTimeInfoEntries () {
10094
+ return directories();
10095
+ }
9654
10096
  };
9655
10097
  }
10098
+ getTimes() {
10099
+ let times = Object.create(null);
10100
+ if (!this.#inner) return times;
10101
+ let { fileTimestamps, directoryTimestamps } = this.#inner.collectTimeInfoEntries();
10102
+ for (let row of fileTimestamps.entries)row.existenceOnly || (times[row.path] = Math.max(row.safeTime, row.timestamp ?? row.safeTime));
10103
+ for (let path of fileTimestamps.missing)times[path] = null;
10104
+ for (let row of directoryTimestamps.entries)times[row.path] = row.safeTime ?? null;
10105
+ for (let path of directoryTimestamps.missing)times[path] = null;
10106
+ return times;
10107
+ }
10108
+ getTimeInfoEntries() {
10109
+ let entries = new Map();
10110
+ return this.collectTimeInfoEntries(entries, entries), entries;
10111
+ }
10112
+ collectTimeInfoEntries(fileTimestamps, directoryTimestamps) {
10113
+ if (!this.#inner) return;
10114
+ let { fileTimeInfoEntries, contextTimeInfoEntries } = this.#fetchTimeInfo(this.#inner);
10115
+ for (let [path, entry] of fileTimeInfoEntries)null === entry && fileTimestamps.has(path) || fileTimestamps.set(path, entry);
10116
+ for (let [path, entry] of contextTimeInfoEntries)(null === entry || entry === EXISTENCE_ONLY_TIME_ENTRY) && directoryTimestamps.has(path) || directoryTimestamps.set(path, entry);
10117
+ }
9656
10118
  getNativeWatcher(options) {
9657
10119
  if (this.#inner) return this.#inner;
9658
10120
  let nativeWatcherOptions = {
@@ -9691,7 +10153,7 @@ class NativeWatchFileSystem {
9691
10153
  ];
9692
10154
  }
9693
10155
  }
9694
- let internalCallbacks = new WeakSet();
10156
+ let isExistenceOnlyEntry = (entry)=>'object' == typeof entry && null !== entry && !('safeTime' in entry);
9695
10157
  class NodeWatchFileSystem {
9696
10158
  inputFileSystem;
9697
10159
  watcherOptions;
@@ -9781,6 +10243,19 @@ class NodeWatchFileSystem {
9781
10243
  }
9782
10244
  };
9783
10245
  }
10246
+ getTimes() {
10247
+ return this.watcher?.getTimes() ?? {};
10248
+ }
10249
+ getTimeInfoEntries() {
10250
+ let entries = new Map(), watcher = this.watcher;
10251
+ if (!watcher) return entries;
10252
+ let contextEntries = new Map();
10253
+ for (let [path, entry] of (watcher.collectTimeInfoEntries(entries, contextEntries), contextEntries))(null === entry || isExistenceOnlyEntry(entry)) && entries.has(path) || entries.set(path, entry);
10254
+ return entries;
10255
+ }
10256
+ collectTimeInfoEntries(fileTimestamps, directoryTimestamps) {
10257
+ this.watcher?.collectTimeInfoEntries(fileTimestamps, directoryTimestamps);
10258
+ }
9784
10259
  on(event, listener) {
9785
10260
  return this.#events.on(event, listener), this;
9786
10261
  }
@@ -9817,7 +10292,7 @@ let arraySum = (array)=>{
9817
10292
  return str.length === length ? str : length > 5 ? `...${str.slice(-length + 3)}` : length > 0 ? str.slice(-length) : '';
9818
10293
  });
9819
10294
  };
9820
- var CachedInputFileSystem_default = compatGetDefaultExport(rspackRequire("../../node_modules/.pnpm/enhanced-resolve@5.26.0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js"));
10295
+ var CachedInputFileSystem_default = compatGetDefaultExport(rspackRequire("../../node_modules/.pnpm/enhanced-resolve@5.26.1/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js"));
9821
10296
  class NodeEnvironmentPlugin {
9822
10297
  options;
9823
10298
  constructor(options){
@@ -10581,8 +11056,12 @@ let iterateConfig = (config, options, fn)=>{
10581
11056
  hash: (object, compilation, context)=>{
10582
11057
  object.hash = context.getStatsCompilation(compilation).hash;
10583
11058
  },
11059
+ cacheInfo: (object, compilation, context)=>{
11060
+ let { cacheInfo } = context.getStatsCompilation(compilation);
11061
+ cacheInfo && (object.cacheInfo = Object.fromEntries(Object.entries(cacheInfo).sort(([a], [b])=>a.localeCompare(b))));
11062
+ },
10584
11063
  version: (object)=>{
10585
- object.version = "5.75.0", object.rspackVersion = "2.2.9";
11064
+ object.version = "5.75.0", object.rspackVersion = "2.3.2";
10586
11065
  },
10587
11066
  env: (object, _compilation, _context, { _env })=>{
10588
11067
  object.env = _env;
@@ -10983,6 +11462,7 @@ let applyDefaults = (options, defaults)=>{
10983
11462
  }, 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
11463
  performance: NORMAL_ON,
10985
11464
  hash: OFF_FOR_TO_STRING,
11465
+ cacheInfo: NORMAL_OFF,
10986
11466
  env: NORMAL_OFF,
10987
11467
  version: NORMAL_ON,
10988
11468
  timings: NORMAL_ON,
@@ -11829,10 +12309,12 @@ class RspackOptionsApply {
11829
12309
  if (runtimeChunk && new RuntimeChunkPlugin(runtimeChunk).apply(compiler), options.optimization.emitOnErrors || new NoEmitOnErrorsPlugin().apply(compiler), options.devtool) if (options.devtool.includes('source-map')) {
11830
12310
  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
12311
  new (evalWrapped ? EvalSourceMapDevToolPlugin : SourceMapDevToolPlugin)({
11832
- filename: inline ? null : options.output.sourceMapFilename,
12312
+ ...evalWrapped ? {} : {
12313
+ filename: inline ? null : options.output.sourceMapFilename,
12314
+ fallbackModuleFilenameTemplate: options.output.devtoolFallbackModuleFilenameTemplate,
12315
+ append: !hidden && void 0
12316
+ },
11833
12317
  moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
11834
- fallbackModuleFilenameTemplate: options.output.devtoolFallbackModuleFilenameTemplate,
11835
- append: !hidden && void 0,
11836
12318
  module: !!moduleMaps || !cheap,
11837
12319
  test: evalWrapped ? void 0 : /\.((c|m)?js|css)($|\?)/i,
11838
12320
  columns: !cheap,
@@ -11844,7 +12326,7 @@ class RspackOptionsApply {
11844
12326
  moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
11845
12327
  namespace: options.output.devtoolNamespace
11846
12328
  }).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);
12329
+ 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
12330
  let enableLibSplitChunks = !1;
11849
12331
  if (options.output.enabledLibraryTypes && options.output.enabledLibraryTypes.length > 0) {
11850
12332
  let hasModernModule = options.output.enabledLibraryTypes.includes('modern-module'), hasNonModernModule = options.output.enabledLibraryTypes.some((t)=>'modern-module' !== t);
@@ -11922,7 +12404,19 @@ function validateRspackConfig(config) {
11922
12404
  let library = output?.library;
11923
12405
  if (!('object' == typeof library && 'type' in library && 'umd' === library.type) || void 0 !== externalsType && 'umd' !== externalsType) return;
11924
12406
  let checkExternalItem = (externalItem)=>{
11925
- if ('object' == typeof externalItem && null !== externalItem) for (let value of Object.values(externalItem))checkExternalItemValue(value);
12407
+ if ('object' == typeof externalItem && null !== externalItem) {
12408
+ let { byLayer } = externalItem;
12409
+ if ('function' != typeof byLayer) {
12410
+ if (byLayer && 'object' == typeof byLayer) {
12411
+ for (let layer of [
12412
+ 'default',
12413
+ ...Object.keys(byLayer)
12414
+ ])checkExternalItem(resolveLayerExternals(externalItem, layer));
12415
+ return;
12416
+ }
12417
+ for (let [request, value] of Object.entries(externalItem))'byLayer' !== request && checkExternalItemValue(value);
12418
+ }
12419
+ }
11926
12420
  }, checkExternalItemValue = (value)=>{
11927
12421
  if (value && 'object' == typeof value && [
11928
12422
  'root',
@@ -12003,148 +12497,6 @@ class CodeGenerationResult {
12003
12497
  return this.#inner.sources[sourceType];
12004
12498
  }
12005
12499
  }
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
12500
  let traceHookPlugin_PLUGIN_NAME = 'TraceHookPlugin', PLUGIN_PROCESS_NAME = 'Plugin Analysis', makeInterceptorFor = (compilerName, tracer)=>(hookName)=>({
12149
12501
  register: (tapInfo)=>{
12150
12502
  let { name, type, fn: internalFn } = tapInfo, newFn = name === traceHookPlugin_PLUGIN_NAME ? internalFn : makeNewTraceTapFn(compilerName, hookName, tracer, {
@@ -12276,7 +12628,7 @@ class TraceHookPlugin {
12276
12628
  });
12277
12629
  }
12278
12630
  }
12279
- let CORE_VERSION = "2.2.9", VFILES_BY_COMPILER = new WeakMap();
12631
+ let CORE_VERSION = "2.3.2", VFILES_BY_COMPILER = new WeakMap();
12280
12632
  class VirtualModulesPlugin {
12281
12633
  #staticModules;
12282
12634
  #compiler;
@@ -12391,7 +12743,7 @@ class Watching {
12391
12743
  #go(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles) {
12392
12744
  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
12745
  else if (this.pausedWatcher) {
12394
- let { changes, removals, fileTimeInfoEntries, contextTimeInfoEntries } = this.pausedWatcher.getInfo();
12746
+ let watcher = this.pausedWatcher, { changes, removals, fileTimeInfoEntries, contextTimeInfoEntries } = watcher[consumeWatcherInfo]?.() ?? watcher.getInfo();
12395
12747
  this.#mergeWithCollected(changes, removals), this.compiler.fileTimestamps = fileTimeInfoEntries, this.compiler.contextTimestamps = contextTimeInfoEntries;
12396
12748
  }
12397
12749
  this.compiler.modifiedFiles = this.#collectedChangedFiles, this.compiler.removedFiles = this.#collectedRemovedFiles, this.#collectedChangedFiles = void 0, this.#collectedRemovedFiles = void 0;
@@ -12642,7 +12994,7 @@ class Compiler {
12642
12994
  }, exports_namespaceObject, {
12643
12995
  RuntimeGlobals: createCompilerRuntimeGlobals(options)
12644
12996
  });
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 = {
12997
+ 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
12998
  web: null,
12647
12999
  browser: null,
12648
13000
  webworker: null,
@@ -12692,7 +13044,7 @@ class Compiler {
12692
13044
  return this.#ruleSet;
12693
13045
  }
12694
13046
  getCache(name) {
12695
- return new lib_CacheFacade(this.cache, `${this.compilerPath}${name}`, this.options.output.hashFunction);
13047
+ return new lib_CacheFacade(this.cache, `${this.compilerPath}|${name}`, this.options.output.hashFunction);
12696
13048
  }
12697
13049
  #logInfrastructure(name, type, args) {
12698
13050
  void 0 === this.hooks.infrastructureLog.call(name, type, args) && this.infrastructureLogger?.(name, type, args);
@@ -12793,7 +13145,11 @@ class Compiler {
12793
13145
  };
12794
13146
  applyRspackOptionsDefaults(options);
12795
13147
  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}|`;
13148
+ 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 = [
13149
+ this.compilerPath,
13150
+ compilerName,
13151
+ compilerIndex
13152
+ ].join('|');
12797
13153
  let relativeCompilerName = makePathsRelative(this.context, compilerName, this.root);
12798
13154
  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
13155
  for(let hookName in childCompiler.#builtinPlugins = [
@@ -12861,22 +13217,22 @@ class Compiler {
12861
13217
  return this.#compilationParams = params, params;
12862
13218
  }
12863
13219
  #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.
13220
+ var output, cache, snapshot;
13221
+ 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
13222
 
12867
13223
  Help:
12868
13224
  Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
12869
13225
  The expected version of @rspack/core to the current binding is ${expectedCoreVersion}.
12870
- ` : `Unmatched version @rspack/core@${coreVersion} and @rspack/binding@${expectedCoreVersion}.
13226
+ ` : `Unmatched version @rspack/core@${coreVersion} and @ohos-ports/rspack-binding@${expectedCoreVersion}.
12871
13227
 
12872
13228
  Help:
12873
- Please ensure the version of @rspack/binding and @rspack/core is the same.
13229
+ Please ensure the version of @ohos-ports/rspack-binding and @rspack/core is the same.
12874
13230
  The expected version of @rspack/core to the current binding is ${expectedCoreVersion}.
12875
13231
  `));
12876
13232
  if (error) return callback(error);
12877
13233
  if (this.#instance) return callback(null, this.#instance);
12878
13234
  let { options } = this;
12879
- this.#rawOptions = (mode = options.mode, experiments = options.experiments, cache = options.cache, {
13235
+ this.#rawOptions = (mode = options.mode, experiments = options.experiments, cache1 = options.cache, {
12880
13236
  name: options.name,
12881
13237
  mode,
12882
13238
  context: options.context,
@@ -12901,6 +13257,7 @@ Help:
12901
13257
  optionalChaining: !!environment.optionalChaining,
12902
13258
  logicalAssignment: !!environment.logicalAssignment,
12903
13259
  templateLiteral: !!environment.templateLiteral,
13260
+ topLevelAwait: !!environment.topLevelAwait,
12904
13261
  importMetaDirnameAndFilename: !!environment.importMetaDirnameAndFilename
12905
13262
  };
12906
13263
  }(output.environment)
@@ -12946,53 +13303,31 @@ Help:
12946
13303
  return delete obj.preset, obj;
12947
13304
  }(options.stats)).colors ? isStatsColorSupported() : !!statsOptions.colors
12948
13305
  },
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)=>{
13306
+ cache: !1 !== (cache = cache1) && ('memory' === cache.type ? {
13307
+ type: cache.type
13308
+ } : {
13309
+ type: cache.type,
13310
+ buildDependencies: cache.buildDependencies,
13311
+ version: cache.version,
13312
+ maxAge: ((name, value)=>{
13313
+ if (1 / 0 === value) return 0;
13314
+ 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}\`.`);
13315
+ return value;
13316
+ })('cache.maxAge', cache.maxAge),
13317
+ maxMemoryGenerations: ((value)=>{
12955
13318
  if (1 / 0 !== value) {
12956
13319
  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
13320
  return value;
12958
13321
  }
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),
13322
+ })(cache.maxMemoryGenerations),
13323
+ storage: {
13324
+ type: cache.storage.type,
13325
+ directory: cache.storage.directory,
13326
+ location: cache.storage.location
13327
+ },
13328
+ portable: cache.portable,
13329
+ readonly: cache.readonly
13330
+ }),
12996
13331
  snapshot: (snapshot = options.snapshot, strategy = (value)=>({
12997
13332
  hash: value?.hash ?? !1,
12998
13333
  timestamp: value?.timestamp ?? !1
@@ -13022,7 +13357,7 @@ Help:
13022
13357
  bail: options.bail,
13023
13358
  __references: {}
13024
13359
  }), 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");
13360
+ let instanceBinding = rspackRequire("@ohos-ports/rspack-binding");
13026
13361
  this.#registers = this.#createHooksRegisters();
13027
13362
  let inputFileSystem = this.inputFileSystem && ThreadsafeInputNodeFS.needsBinding(options.experiments.useInputFileSystem) ? ThreadsafeInputNodeFS.__to_binding(this.inputFileSystem) : void 0, compilerRef = new WeakRef(this);
13028
13363
  try {
@@ -13682,53 +14017,14 @@ Help:
13682
14017
  return this.#moduleExecutionResultsMap;
13683
14018
  }
13684
14019
  }
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
14020
  let ModuleGraphConnection = binding_.ModuleGraphConnection;
13725
14021
  Object.defineProperties(ModuleGraphConnection, {
13726
14022
  TRANSITIVE_ONLY: {
13727
- value: binding__default().TRANSITIVE_ONLY_SYMBOL,
14023
+ value: TRANSITIVE_ONLY_SYMBOL,
13728
14024
  enumerable: !0
13729
14025
  },
13730
14026
  CIRCULAR_CONNECTION: {
13731
- value: binding__default().CIRCULAR_CONNECTION_SYMBOL,
14027
+ value: CIRCULAR_CONNECTION_SYMBOL,
13732
14028
  enumerable: !0
13733
14029
  }
13734
14030
  });
@@ -13832,7 +14128,7 @@ class LoaderOptionsPlugin {
13832
14128
  apply(compiler) {
13833
14129
  let options = this.options;
13834
14130
  compiler.hooks.compilation.tap('LoaderOptionsPlugin', (compilation)=>{
13835
- binding_.NormalModule.getCompilationHooks(compilation).loader.tap('LoaderOptionsPlugin', (context)=>{
14131
+ NormalModule.getCompilationHooks(compilation).loader.tap('LoaderOptionsPlugin', (context)=>{
13836
14132
  let resource = context.resourcePath;
13837
14133
  if (resource && matchObject(options, resource)) for (let key of Object.keys(options))'include' !== key && 'exclude' !== key && 'test' !== key && (context[key] = options[key]);
13838
14134
  });
@@ -13846,7 +14142,7 @@ class LoaderTargetPlugin {
13846
14142
  }
13847
14143
  apply(compiler) {
13848
14144
  compiler.hooks.compilation.tap('LoaderTargetPlugin', (compilation)=>{
13849
- binding_.NormalModule.getCompilationHooks(compilation).loader.tap('LoaderTargetPlugin', (loaderContext)=>{
14145
+ NormalModule.getCompilationHooks(compilation).loader.tap('LoaderTargetPlugin', (loaderContext)=>{
13850
14146
  loaderContext.target = this.target;
13851
14147
  });
13852
14148
  });
@@ -13984,7 +14280,10 @@ class ProvideSharedPlugin extends RspackBuiltinPlugin {
13984
14280
  }
13985
14281
  }
13986
14282
  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)}`);
14283
+ if (Array.isArray(shareScope)) {
14284
+ if (0 === shareScope.length) throw Error(`[${pluginName}] shareScope array must contain at least one entry`);
14285
+ if (shareScope.length > 1 && !enhanced) throw Error(`[${pluginName}] shareScope as an array with multiple entries requires enhanced=true, got: ${JSON.stringify(shareScope)}`);
14286
+ }
13988
14287
  }
13989
14288
  function normalizeSharedOptions(shared) {
13990
14289
  return parseOptions(shared, (item, key)=>{
@@ -14662,11 +14961,12 @@ class ContainerPlugin extends RspackBuiltinPlugin {
14662
14961
  name = binding_.BuiltinPluginName.ContainerPlugin;
14663
14962
  _options;
14664
14963
  constructor(options){
14964
+ var shareScope;
14665
14965
  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 = {
14966
+ let enhanced = options.enhanced ?? !1, shareScope1 = (shareScope = options.shareScope, shareScope ? (validateShareScope(shareScope, enhanced, 'ContainerPlugin'), !enhanced && Array.isArray(shareScope) ? shareScope[0] : shareScope) : 'default');
14967
+ this._options = {
14668
14968
  name: options.name,
14669
- shareScope,
14969
+ shareScope: shareScope1,
14670
14970
  library: options.library || {
14671
14971
  type: 'global',
14672
14972
  name: options.name
@@ -14752,15 +15052,7 @@ class ContainerReferencePlugin extends RspackBuiltinPlugin {
14752
15052
  return createBuiltinPlugin(this.name, rawOptions);
14753
15053
  }
14754
15054
  }
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 = {
15055
+ let exports_rspackVersion = "2.3.2", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
14764
15056
  getNormalizedRspackOptions: getNormalizedRspackOptions,
14765
15057
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
14766
15058
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -14957,8 +15249,14 @@ let exports_rspackVersion = "2.2.9", exports_version = "5.75.0", exports_Webpack
14957
15249
  RstestPlugin: RstestPlugin,
14958
15250
  RslibPlugin: RslibPlugin,
14959
15251
  swc: {
14960
- minify: minify,
14961
- transform: transform,
15252
+ minify: async function(source, options) {
15253
+ let _options = JSON.stringify(options || {});
15254
+ return binding__default().minify(source, _options);
15255
+ },
15256
+ transform: async function(source, options) {
15257
+ let _options = JSON.stringify(options || {});
15258
+ return binding__default().transform(source, _options);
15259
+ },
14962
15260
  minifySync: function(source, options) {
14963
15261
  let _options = JSON.stringify(options || {});
14964
15262
  return binding__default().minifySync(source, _options);
@@ -15026,4 +15324,4 @@ let exports_rspackVersion = "2.2.9", exports_version = "5.75.0", exports_Webpack
15026
15324
  src_fn.rspack = src_fn, src_fn.webpack = src_fn;
15027
15325
  let src_rspack = src_fn;
15028
15326
  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 };
15327
+ 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 };