@rspack-debug/core 2.0.0-canary.20260120 → 2.0.0-rc.2

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 (95) hide show
  1. package/README.md +1 -1
  2. package/compiled/@rspack/lite-tapable/dist/index.d.ts +175 -0
  3. package/compiled/@rspack/lite-tapable/license +22 -0
  4. package/compiled/@rspack/lite-tapable/package.json +1 -0
  5. package/compiled/@swc/types/index.d.ts +15 -9
  6. package/compiled/@swc/types/package.json +1 -1
  7. package/compiled/connect-next/index.d.ts +56 -0
  8. package/compiled/connect-next/license +26 -0
  9. package/compiled/connect-next/package.json +1 -0
  10. package/compiled/http-proxy-middleware/index.d.ts +544 -0
  11. package/compiled/http-proxy-middleware/license +22 -0
  12. package/compiled/http-proxy-middleware/package.json +1 -0
  13. package/compiled/open/index.d.ts +161 -0
  14. package/compiled/open/package.json +1 -0
  15. package/compiled/watchpack/index.d.ts +2 -0
  16. package/compiled/webpack-sources/index.js +188 -131
  17. package/compiled/webpack-sources/package.json +1 -1
  18. package/compiled/webpack-sources/types.d.ts +6 -3
  19. package/dist/BuildInfo.d.ts +1 -1
  20. package/dist/Compilation.d.ts +5 -2
  21. package/dist/Compiler.d.ts +4 -3
  22. package/dist/ContextModuleFactory.d.ts +1 -1
  23. package/dist/FileSystem.d.ts +1 -1
  24. package/dist/Module.d.ts +1 -1
  25. package/dist/ModuleGraph.d.ts +3 -1
  26. package/dist/ModuleGraphConnection.d.ts +10 -0
  27. package/dist/MultiCompiler.d.ts +1 -1
  28. package/dist/MultiWatching.d.ts +1 -1
  29. package/dist/NativeWatchFileSystem.d.ts +1 -1
  30. package/dist/NormalModule.d.ts +1 -2
  31. package/dist/NormalModuleFactory.d.ts +1 -1
  32. package/dist/RuntimeGlobals.d.ts +1 -1
  33. package/dist/Watching.d.ts +1 -1
  34. package/dist/builtin-loader/swc/pluginImport.d.ts +1 -1
  35. package/dist/builtin-loader/swc/types.d.ts +37 -2
  36. package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +4 -2
  37. package/dist/builtin-plugin/EsmNodeTargetPlugin.d.ts +9 -0
  38. package/dist/builtin-plugin/HashedModuleIdsPlugin.d.ts +10 -0
  39. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
  40. package/dist/builtin-plugin/ProgressPlugin.d.ts +5 -4
  41. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +3 -3
  42. package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
  43. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +9 -9
  44. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +2 -1
  45. package/dist/builtin-plugin/WorkerPlugin.d.ts +1 -0
  46. package/dist/builtin-plugin/html-plugin/hooks.d.ts +1 -1
  47. package/dist/builtin-plugin/index.d.ts +3 -0
  48. package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +3 -3
  49. package/dist/builtin-plugin/rsc/Coordinator.d.ts +8 -0
  50. package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +13 -0
  51. package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +39 -0
  52. package/dist/builtin-plugin/rsc/index.d.ts +24 -0
  53. package/dist/checkNodeVersion.d.ts +1 -0
  54. package/dist/config/adapterRuleUse.d.ts +1 -1
  55. package/dist/config/devServer.d.ts +102 -237
  56. package/dist/config/normalization.d.ts +4 -4
  57. package/dist/config/types.d.ts +184 -71
  58. package/dist/container/ContainerPlugin.d.ts +3 -2
  59. package/dist/container/ContainerReferencePlugin.d.ts +4 -3
  60. package/dist/container/ModuleFederationManifestPlugin.d.ts +10 -3
  61. package/dist/container/ModuleFederationPlugin.d.ts +20 -1
  62. package/dist/container/ModuleFederationPluginV1.d.ts +2 -2
  63. package/dist/container/ModuleFederationRuntimePlugin.d.ts +4 -0
  64. package/dist/exports.d.ts +17 -8
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.js +1751 -636
  67. package/dist/lib/Cache.d.ts +1 -1
  68. package/dist/lib/HookWebpackError.d.ts +1 -1
  69. package/dist/moduleFederationDefaultRuntime.js +1 -1
  70. package/dist/node/NodeWatchFileSystem.d.ts +1 -1
  71. package/dist/rspack.d.ts +1 -1
  72. package/dist/sharing/CollectSharedEntryPlugin.d.ts +22 -0
  73. package/dist/sharing/ConsumeSharedPlugin.d.ts +16 -3
  74. package/dist/sharing/IndependentSharedPlugin.d.ts +35 -0
  75. package/dist/sharing/ProvideSharedPlugin.d.ts +22 -2
  76. package/dist/sharing/SharePlugin.d.ts +43 -5
  77. package/dist/sharing/SharedContainerPlugin.d.ts +23 -0
  78. package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +14 -0
  79. package/dist/sharing/TreeShakingSharedPlugin.d.ts +16 -0
  80. package/dist/sharing/utils.d.ts +1 -0
  81. package/dist/stats/StatsFactory.d.ts +1 -1
  82. package/dist/stats/StatsPrinter.d.ts +1 -1
  83. package/dist/swc.d.ts +2 -2
  84. package/dist/taps/types.d.ts +1 -1
  85. package/dist/util/createHash.d.ts +1 -1
  86. package/dist/util/source.d.ts +1 -1
  87. package/dist/util/supportsColor.d.ts +6 -0
  88. package/dist/worker.js +21 -20
  89. package/hot/dev-server.js +1 -1
  90. package/hot/emitter.js +0 -2
  91. package/hot/log.js +0 -2
  92. package/hot/only-dev-server.js +1 -1
  93. package/module.d.ts +4 -2
  94. package/package.json +20 -22
  95. package/dist/rslib-runtime.js +0 -29
package/dist/index.js CHANGED
@@ -1,15 +1,40 @@
1
- let createMd4, createXxhash64, service_pool, loadLoader_url;
2
- import * as __rspack_external_process from "process";
3
- import { createRequire as __rspack_createRequire, createRequire } from "node:module";
4
- let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
5
- import { __webpack_require__ } from "./rslib-runtime.js";
6
- import { AsyncParallelHook, AsyncSeriesBailHook, AsyncSeriesHook, AsyncSeriesWaterfallHook, HookMap, MultiHook, SyncBailHook, SyncHook, SyncWaterfallHook, maxStage, minStage, safeStage } from "@rspack/lite-tapable";
7
- import node_util, { format as external_node_util_format, inspect, promisify } from "node:util";
1
+ let _computedKey, _computedKey1, _computedKey2, createMd4, createXxhash64, service_pool, loadLoader_url, ArrayQueue_computedKey;
2
+ import node_util, { inspect, promisify } from "node:util";
3
+ import { createRequire, createRequire as __rspack_createRequire } from "node:module";
8
4
  import node_path, { isAbsolute, join, relative, resolve as external_node_path_resolve, sep } from "node:path";
9
5
  import node_querystring from "node:querystring";
10
6
  import node_fs, { readFileSync } from "node:fs";
11
- __webpack_require__.add({
12
- "../../node_modules/.pnpm/enhanced-resolve@5.18.4/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js" (module, __unused_rspack_exports, __webpack_require__) {
7
+ let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
8
+ import * as __rspack_external_node_util_1b29d436 from "node:util";
9
+ var RuntimeGlobals, key, StatsErrorCode, __webpack_modules__ = {}, __webpack_module_cache__ = {};
10
+ function __webpack_require__(moduleId) {
11
+ var cachedModule = __webpack_module_cache__[moduleId];
12
+ if (void 0 !== cachedModule) return cachedModule.exports;
13
+ var module = __webpack_module_cache__[moduleId] = {
14
+ exports: {}
15
+ };
16
+ return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
17
+ }
18
+ __webpack_require__.m = __webpack_modules__, __webpack_require__.n = (module)=>{
19
+ var getter = module && module.__esModule ? ()=>module.default : ()=>module;
20
+ return __webpack_require__.d(getter, {
21
+ a: getter
22
+ }), getter;
23
+ }, __webpack_require__.d = (exports, definition)=>{
24
+ for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key) && Object.defineProperty(exports, key, {
25
+ enumerable: !0,
26
+ get: definition[key]
27
+ });
28
+ }, __webpack_require__.add = function(modules) {
29
+ Object.assign(__webpack_require__.m, modules);
30
+ }, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports)=>{
31
+ "u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
32
+ value: 'Module'
33
+ }), Object.defineProperty(exports, '__esModule', {
34
+ value: !0
35
+ });
36
+ }, __webpack_require__.add({
37
+ "../../node_modules/.pnpm/enhanced-resolve@5.20.1/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js" (module, __unused_rspack_exports, __webpack_require__) {
13
38
  let { nextTick } = __webpack_require__("process"), dirname = (path)=>{
14
39
  let idx = path.length - 1;
15
40
  for(; idx >= 0;){
@@ -215,10 +240,10 @@ __webpack_require__.add({
215
240
  };
216
241
  },
217
242
  process (module) {
218
- module.exports = __rspack_external_process;
243
+ module.exports = __rspack_createRequire_require("process");
219
244
  }
220
245
  });
221
- var RuntimeGlobals, StatsErrorCode, _computedKey, _computedKey1, _computedKey2, ArrayQueue_computedKey, browserslistTargetHandler_namespaceObject = {};
246
+ var browserslistTargetHandler_namespaceObject = {};
222
247
  __webpack_require__.r(browserslistTargetHandler_namespaceObject), __webpack_require__.d(browserslistTargetHandler_namespaceObject, {
223
248
  resolve: ()=>browserslistTargetHandler_resolve
224
249
  });
@@ -256,6 +281,7 @@ __webpack_require__.r(exports_namespaceObject), __webpack_require__.d(exports_na
256
281
  LoaderTargetPlugin: ()=>LoaderTargetPlugin,
257
282
  Module: ()=>binding_namespaceObject.Module,
258
283
  ModuleFilenameHelpers: ()=>ModuleFilenameHelpers_namespaceObject,
284
+ ModuleGraphConnection: ()=>ModuleGraphConnection,
259
285
  MultiCompiler: ()=>MultiCompiler,
260
286
  MultiStats: ()=>MultiStats,
261
287
  NoEmitOnErrorsPlugin: ()=>NoEmitOnErrorsPlugin,
@@ -280,6 +306,7 @@ __webpack_require__.r(exports_namespaceObject), __webpack_require__.d(exports_na
280
306
  container: ()=>container,
281
307
  electron: ()=>electron,
282
308
  experiments: ()=>exports_experiments,
309
+ ids: ()=>exports_ids,
283
310
  javascript: ()=>javascript,
284
311
  lazyCompilationMiddleware: ()=>lazyCompilationMiddleware,
285
312
  library: ()=>exports_library,
@@ -299,15 +326,493 @@ __webpack_require__.r(ModuleFilenameHelpers_namespaceObject), __webpack_require_
299
326
  asRegExp: ()=>asRegExp,
300
327
  matchObject: ()=>matchObject,
301
328
  matchPart: ()=>matchPart
302
- });
329
+ }), !function() {
330
+ let { node, bun, deno } = process.versions;
331
+ if (!node || bun || deno) return;
332
+ let [majorStr, minorStr] = node.split('.'), major = parseInt(majorStr, 10), minor = parseInt(minorStr || '0', 10);
333
+ 20 === major && minor >= 19 || 22 === major && minor >= 12 || major > 22 || console.error(`Unsupported Node.js version "${node}". Rspack requires Node.js 20.19+ or 22.12+. Please upgrade your Node.js version.\n`);
334
+ }();
303
335
  let binding_namespaceObject = __rspack_createRequire_require(process.env.RSPACK_BINDING ? process.env.RSPACK_BINDING : "@rspack/binding");
304
336
  var binding_default = __webpack_require__.n(binding_namespaceObject);
337
+ function _define_property(obj, key, value) {
338
+ return key in obj ? Object.defineProperty(obj, key, {
339
+ value: value,
340
+ enumerable: !0,
341
+ configurable: !0,
342
+ writable: !0
343
+ }) : obj[key] = value, obj;
344
+ }
345
+ class HookBase {
346
+ intercept(interceptor) {
347
+ if (this.interceptors.push(Object.assign({}, interceptor)), interceptor.register) for(let i = 0; i < this.taps.length; i++)this.taps[i] = interceptor.register(this.taps[i]);
348
+ }
349
+ _runRegisterInterceptors(options) {
350
+ return this.interceptors.reduce((options, interceptor)=>interceptor.register?.(options) ?? options, options);
351
+ }
352
+ _runCallInterceptors(...args) {
353
+ for (let interceptor of this.interceptors)interceptor.call && interceptor.call(...args);
354
+ }
355
+ _runErrorInterceptors(e) {
356
+ for (let interceptor of this.interceptors)interceptor.error && interceptor.error(e);
357
+ }
358
+ _runTapInterceptors(tap) {
359
+ for (let interceptor of this.interceptors)interceptor.tap && interceptor.tap(tap);
360
+ }
361
+ _runDoneInterceptors() {
362
+ for (let interceptor of this.interceptors)interceptor.done && interceptor.done();
363
+ }
364
+ _runResultInterceptors(r) {
365
+ for (let interceptor of this.interceptors)interceptor.result && interceptor.result(r);
366
+ }
367
+ withOptions(options) {
368
+ let mergeOptions = (opt)=>Object.assign({}, options, 'string' == typeof opt ? {
369
+ name: opt
370
+ } : opt);
371
+ return {
372
+ name: this.name,
373
+ tap: (opt, fn)=>this.tap(mergeOptions(opt), fn),
374
+ tapAsync: (opt, fn)=>this.tapAsync(mergeOptions(opt), fn),
375
+ tapPromise: (opt, fn)=>this.tapPromise(mergeOptions(opt), fn),
376
+ intercept: (interceptor)=>this.intercept(interceptor),
377
+ isUsed: ()=>this.isUsed(),
378
+ withOptions: (opt)=>this.withOptions(mergeOptions(opt)),
379
+ queryStageRange: (stageRange)=>this.queryStageRange(stageRange)
380
+ };
381
+ }
382
+ isUsed() {
383
+ return this.taps.length > 0 || this.interceptors.length > 0;
384
+ }
385
+ queryStageRange(stageRange) {
386
+ return new QueriedHook(stageRange, this);
387
+ }
388
+ callAsyncStageRange(queried) {
389
+ throw Error('Hook should implement there own _callAsyncStageRange');
390
+ }
391
+ callAsync(...args) {
392
+ return this.callAsyncStageRange(this.queryStageRange(allStageRange), ...args);
393
+ }
394
+ promiseStageRange(queried, ...args) {
395
+ return new Promise((resolve, reject)=>{
396
+ this.callAsyncStageRange(queried, ...args, (e, r)=>e ? reject(e) : resolve(r));
397
+ });
398
+ }
399
+ promise(...args) {
400
+ return this.promiseStageRange(this.queryStageRange(allStageRange), ...args);
401
+ }
402
+ tap(options, fn) {
403
+ this._tap('sync', options, fn);
404
+ }
405
+ tapAsync(options, fn) {
406
+ this._tap('async', options, fn);
407
+ }
408
+ tapPromise(options, fn) {
409
+ this._tap('promise', options, fn);
410
+ }
411
+ _tap(type, options, fn) {
412
+ let normalizedOptions = options;
413
+ if ('string' == typeof options) normalizedOptions = {
414
+ name: options.trim()
415
+ };
416
+ else if ('object' != typeof options || null === options) throw Error('Invalid tap options');
417
+ if ('string' != typeof normalizedOptions.name || '' === normalizedOptions.name) throw Error('Missing name for tap');
418
+ this._insert(this._runRegisterInterceptors(Object.assign({
419
+ type,
420
+ fn
421
+ }, normalizedOptions)));
422
+ }
423
+ _insert(item) {
424
+ let before;
425
+ 'string' == typeof item.before ? before = new Set([
426
+ item.before
427
+ ]) : Array.isArray(item.before) && (before = new Set(item.before));
428
+ let stage = 0;
429
+ 'number' == typeof item.stage && (stage = item.stage);
430
+ let i = this.taps.length;
431
+ for(; i > 0;){
432
+ i--;
433
+ let x = this.taps[i];
434
+ this.taps[i + 1] = x;
435
+ let xStage = x.stage || 0;
436
+ if (before) {
437
+ if (before.has(x.name)) {
438
+ before.delete(x.name);
439
+ continue;
440
+ }
441
+ if (before.size > 0) continue;
442
+ }
443
+ if (!(xStage > stage)) {
444
+ i++;
445
+ break;
446
+ }
447
+ }
448
+ this.taps[i] = item;
449
+ }
450
+ _prepareArgs(args) {
451
+ let len = this.args.length;
452
+ return args.length < len ? (args.length = len, args.fill(void 0, args.length, len)) : (args.length > len && (args.length = len), args);
453
+ }
454
+ constructor(args = [], name){
455
+ _define_property(this, "args", void 0), _define_property(this, "name", void 0), _define_property(this, "taps", void 0), _define_property(this, "interceptors", void 0), this.args = args, this.name = name, this.taps = [], this.interceptors = [];
456
+ }
457
+ }
458
+ let minStage = -1 / 0, maxStage = 1 / 0, allStageRange = [
459
+ minStage,
460
+ 1 / 0
461
+ ], i32MAX = 2147483648 - 1, safeStage = (stage)=>stage < -2147483648 ? -2147483648 : stage > i32MAX ? i32MAX : stage;
462
+ class QueriedHook {
463
+ isUsed() {
464
+ return !!(this.tapsInRange.length > 0 || this.stageRange[0] === minStage && this.hook.interceptors.some((i)=>i.call) || this.stageRange[1] === maxStage && this.hook.interceptors.some((i)=>i.done));
465
+ }
466
+ call(...args) {
467
+ if ('function' != typeof this.hook.callStageRange) throw Error('hook is not a SyncHook, call methods only exists on SyncHook');
468
+ return this.hook.callStageRange(this, ...args);
469
+ }
470
+ callAsync(...args) {
471
+ return this.hook.callAsyncStageRange(this, ...args);
472
+ }
473
+ promise(...args) {
474
+ return this.hook.promiseStageRange(this, ...args);
475
+ }
476
+ constructor(stageRange, hook){
477
+ _define_property(this, "stageRange", void 0), _define_property(this, "hook", void 0), _define_property(this, "tapsInRange", void 0);
478
+ let tapsInRange = [], [from, to] = stageRange;
479
+ for (let tap of hook.taps){
480
+ let stage = tap.stage ?? 0;
481
+ from <= stage && stage < to ? tapsInRange.push(tap) : to === maxStage && stage === maxStage && tapsInRange.push(tap);
482
+ }
483
+ this.stageRange = stageRange, this.hook = hook, this.tapsInRange = tapsInRange;
484
+ }
485
+ }
486
+ class SyncHook extends HookBase {
487
+ callAsyncStageRange(queried, ...args) {
488
+ let { stageRange: [from, to], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
489
+ for (let tap of (from === minStage && this._runCallInterceptors(...args2), tapsInRange)){
490
+ this._runTapInterceptors(tap);
491
+ try {
492
+ tap.fn(...args2);
493
+ } catch (e) {
494
+ return this._runErrorInterceptors(e), cb(e);
495
+ }
496
+ }
497
+ to === maxStage && (this._runDoneInterceptors(), cb(null));
498
+ }
499
+ call(...args) {
500
+ return this.callStageRange(this.queryStageRange(allStageRange), ...args);
501
+ }
502
+ callStageRange(queried, ...args) {
503
+ let result, error;
504
+ if (this.callAsyncStageRange(queried, ...args, (e, r)=>{
505
+ error = e, result = r;
506
+ }), error) throw error;
507
+ return result;
508
+ }
509
+ tapAsync() {
510
+ throw Error('tapAsync is not supported on a SyncHook');
511
+ }
512
+ tapPromise() {
513
+ throw Error('tapPromise is not supported on a SyncHook');
514
+ }
515
+ }
516
+ class SyncBailHook extends HookBase {
517
+ callAsyncStageRange(queried, ...args) {
518
+ let { stageRange: [from, to], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
519
+ for (let tap of (from === minStage && this._runCallInterceptors(...args2), tapsInRange)){
520
+ let r;
521
+ this._runTapInterceptors(tap);
522
+ try {
523
+ r = tap.fn(...args2);
524
+ } catch (e) {
525
+ return this._runErrorInterceptors(e), cb(e);
526
+ }
527
+ if (void 0 !== r) return this._runResultInterceptors(r), cb(null, r);
528
+ }
529
+ to === maxStage && (this._runDoneInterceptors(), cb(null));
530
+ }
531
+ call(...args) {
532
+ return this.callStageRange(this.queryStageRange(allStageRange), ...args);
533
+ }
534
+ callStageRange(queried, ...args) {
535
+ let result, error;
536
+ if (this.callAsyncStageRange(queried, ...args, (e, r)=>{
537
+ error = e, result = r;
538
+ }), error) throw error;
539
+ return result;
540
+ }
541
+ tapAsync() {
542
+ throw Error('tapAsync is not supported on a SyncBailHook');
543
+ }
544
+ tapPromise() {
545
+ throw Error('tapPromise is not supported on a SyncBailHook');
546
+ }
547
+ }
548
+ class SyncWaterfallHook extends HookBase {
549
+ callAsyncStageRange(queried, ...args) {
550
+ let { stageRange: [from, to], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
551
+ for (let tap of (from === minStage && this._runCallInterceptors(...args2), tapsInRange)){
552
+ this._runTapInterceptors(tap);
553
+ try {
554
+ let r = tap.fn(...args2);
555
+ void 0 !== r && (args2[0] = r);
556
+ } catch (e) {
557
+ return this._runErrorInterceptors(e), cb(e);
558
+ }
559
+ }
560
+ to === maxStage && (this._runDoneInterceptors(), cb(null, args2[0]));
561
+ }
562
+ call(...args) {
563
+ return this.callStageRange(this.queryStageRange(allStageRange), ...args);
564
+ }
565
+ callStageRange(queried, ...args) {
566
+ let result, error;
567
+ if (this.callAsyncStageRange(queried, ...args, (e, r)=>{
568
+ error = e, result = r;
569
+ }), error) throw error;
570
+ return result;
571
+ }
572
+ tapAsync() {
573
+ throw Error('tapAsync is not supported on a SyncWaterfallHook');
574
+ }
575
+ tapPromise() {
576
+ throw Error('tapPromise is not supported on a SyncWaterfallHook');
577
+ }
578
+ constructor(args = [], name){
579
+ if (args.length < 1) throw Error('Waterfall hooks must have at least one argument');
580
+ super(args, name);
581
+ }
582
+ }
583
+ class AsyncParallelHook extends HookBase {
584
+ callAsyncStageRange(queried, ...args) {
585
+ let { stageRange: [from], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
586
+ from === minStage && this._runCallInterceptors(...args2);
587
+ let done = ()=>{
588
+ this._runDoneInterceptors(), cb(null);
589
+ }, error = (e)=>{
590
+ this._runErrorInterceptors(e), cb(e);
591
+ };
592
+ if (0 === tapsInRange.length) return done();
593
+ let counter = tapsInRange.length;
594
+ for (let tap of tapsInRange){
595
+ if (this._runTapInterceptors(tap), 'promise' === tap.type) {
596
+ let promise = tap.fn(...args2);
597
+ if (!promise || !promise.then) throw Error(`Tap function (tapPromise) did not return promise (returned ${promise})`);
598
+ promise.then(()=>{
599
+ 0 == (counter -= 1) && done();
600
+ }, (e)=>{
601
+ counter = 0, error(e);
602
+ });
603
+ } else if ('async' === tap.type) tap.fn(...args2, (e)=>{
604
+ e ? (counter = 0, error(e)) : 0 == (counter -= 1) && done();
605
+ });
606
+ else {
607
+ let hasError = !1;
608
+ try {
609
+ tap.fn(...args2);
610
+ } catch (e) {
611
+ hasError = !0, counter = 0, error(e);
612
+ }
613
+ hasError || 0 != --counter || done();
614
+ }
615
+ if (counter <= 0) return;
616
+ }
617
+ }
618
+ }
619
+ class AsyncSeriesHook extends HookBase {
620
+ callAsyncStageRange(queried, ...args) {
621
+ let { stageRange: [from], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
622
+ from === minStage && this._runCallInterceptors(...args2);
623
+ let done = ()=>{
624
+ this._runDoneInterceptors(), cb(null);
625
+ }, error = (e)=>{
626
+ this._runErrorInterceptors(e), cb(e);
627
+ };
628
+ if (0 === tapsInRange.length) return done();
629
+ let index = 0, next = ()=>{
630
+ let tap = tapsInRange[index];
631
+ if (this._runTapInterceptors(tap), 'promise' === tap.type) {
632
+ let promise = tap.fn(...args2);
633
+ if (!promise || !promise.then) throw Error(`Tap function (tapPromise) did not return promise (returned ${promise})`);
634
+ promise.then(()=>{
635
+ (index += 1) === tapsInRange.length ? done() : next();
636
+ }, (e)=>{
637
+ index = tapsInRange.length, error(e);
638
+ });
639
+ } else if ('async' === tap.type) tap.fn(...args2, (e)=>{
640
+ e ? (index = tapsInRange.length, error(e)) : (index += 1) === tapsInRange.length ? done() : next();
641
+ });
642
+ else {
643
+ let hasError = !1;
644
+ try {
645
+ tap.fn(...args2);
646
+ } catch (e) {
647
+ hasError = !0, index = tapsInRange.length, error(e);
648
+ }
649
+ hasError || ((index += 1) === tapsInRange.length ? done() : next());
650
+ }
651
+ if (index === tapsInRange.length) return;
652
+ };
653
+ next();
654
+ }
655
+ }
656
+ class AsyncSeriesBailHook extends HookBase {
657
+ callAsyncStageRange(queried, ...args) {
658
+ let { stageRange: [from], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
659
+ from === minStage && this._runCallInterceptors(...args2);
660
+ let done = ()=>{
661
+ this._runDoneInterceptors(), cb(null);
662
+ }, error = (e)=>{
663
+ this._runErrorInterceptors(e), cb(e);
664
+ }, result = (r)=>{
665
+ this._runResultInterceptors(r), cb(null, r);
666
+ };
667
+ if (0 === tapsInRange.length) return done();
668
+ let index = 0, next = ()=>{
669
+ let tap = tapsInRange[index];
670
+ if (this._runTapInterceptors(tap), 'promise' === tap.type) {
671
+ let promise = tap.fn(...args2);
672
+ if (!promise || !promise.then) throw Error(`Tap function (tapPromise) did not return promise (returned ${promise})`);
673
+ promise.then((r)=>{
674
+ index += 1, void 0 !== r ? result(r) : index === tapsInRange.length ? done() : next();
675
+ }, (e)=>{
676
+ index = tapsInRange.length, error(e);
677
+ });
678
+ } else if ('async' === tap.type) tap.fn(...args2, (e, r)=>{
679
+ e ? (index = tapsInRange.length, error(e)) : (index += 1, void 0 !== r ? result(r) : index === tapsInRange.length ? done() : next());
680
+ });
681
+ else {
682
+ let r, hasError = !1;
683
+ try {
684
+ r = tap.fn(...args2);
685
+ } catch (e) {
686
+ hasError = !0, index = tapsInRange.length, error(e);
687
+ }
688
+ hasError || (index += 1, void 0 !== r ? result(r) : index === tapsInRange.length ? done() : next());
689
+ }
690
+ if (index === tapsInRange.length) return;
691
+ };
692
+ next();
693
+ }
694
+ }
695
+ class AsyncSeriesWaterfallHook extends HookBase {
696
+ callAsyncStageRange(queried, ...args) {
697
+ let { stageRange: [from], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
698
+ from === minStage && this._runCallInterceptors(...args2);
699
+ let result = (r)=>{
700
+ this._runResultInterceptors(r), cb(null, r);
701
+ }, error = (e)=>{
702
+ this._runErrorInterceptors(e), cb(e);
703
+ };
704
+ if (0 === tapsInRange.length) return result(args2[0]);
705
+ let index = 0, next = ()=>{
706
+ let tap = tapsInRange[index];
707
+ if (this._runTapInterceptors(tap), 'promise' === tap.type) {
708
+ let promise = tap.fn(...args2);
709
+ if (!promise || !promise.then) throw Error(`Tap function (tapPromise) did not return promise (returned ${promise})`);
710
+ promise.then((r)=>{
711
+ index += 1, void 0 !== r && (args2[0] = r), index === tapsInRange.length ? result(args2[0]) : next();
712
+ }, (e)=>{
713
+ index = tapsInRange.length, error(e);
714
+ });
715
+ } else if ('async' === tap.type) tap.fn(...args2, (e, r)=>{
716
+ e ? (index = tapsInRange.length, error(e)) : (index += 1, void 0 !== r && (args2[0] = r), index === tapsInRange.length ? result(args2[0]) : next());
717
+ });
718
+ else {
719
+ let hasError = !1;
720
+ try {
721
+ let r = tap.fn(...args2);
722
+ void 0 !== r && (args2[0] = r);
723
+ } catch (e) {
724
+ hasError = !0, index = tapsInRange.length, error(e);
725
+ }
726
+ hasError || ((index += 1) === tapsInRange.length ? result(args2[0]) : next());
727
+ }
728
+ if (index === tapsInRange.length) return;
729
+ };
730
+ next();
731
+ }
732
+ constructor(args = [], name){
733
+ if (args.length < 1) throw Error('Waterfall hooks must have at least one argument');
734
+ super(args, name);
735
+ }
736
+ }
737
+ let defaultFactory = (key, hook)=>hook;
738
+ class HookMap {
739
+ get(key) {
740
+ return this._map.get(key);
741
+ }
742
+ for(key) {
743
+ let hook = this.get(key);
744
+ if (void 0 !== hook) return hook;
745
+ let newHook = this._factory(key), interceptors = this._interceptors;
746
+ for(let i = 0; i < interceptors.length; i++){
747
+ let factory = interceptors[i].factory;
748
+ factory && (newHook = factory(key, newHook));
749
+ }
750
+ return this._map.set(key, newHook), newHook;
751
+ }
752
+ intercept(interceptor) {
753
+ this._interceptors.push(Object.assign({
754
+ factory: defaultFactory
755
+ }, interceptor));
756
+ }
757
+ isUsed() {
758
+ for (let key of this._map.keys()){
759
+ let hook = this.get(key);
760
+ if (hook?.isUsed()) return !0;
761
+ }
762
+ return !1;
763
+ }
764
+ queryStageRange(stageRange) {
765
+ return new QueriedHookMap(stageRange, this);
766
+ }
767
+ constructor(factory, name){
768
+ _define_property(this, "_map", new Map()), _define_property(this, "_factory", void 0), _define_property(this, "name", void 0), _define_property(this, "_interceptors", void 0), this.name = name, this._factory = factory, this._interceptors = [];
769
+ }
770
+ }
771
+ class QueriedHookMap {
772
+ get(key) {
773
+ return this.hookMap.get(key)?.queryStageRange(this.stageRange);
774
+ }
775
+ for(key) {
776
+ return this.hookMap.for(key).queryStageRange(this.stageRange);
777
+ }
778
+ isUsed() {
779
+ for (let key of this.hookMap._map.keys())if (this.get(key)?.isUsed()) return !0;
780
+ return !1;
781
+ }
782
+ constructor(stageRange, hookMap){
783
+ _define_property(this, "stageRange", void 0), _define_property(this, "hookMap", void 0), this.stageRange = stageRange, this.hookMap = hookMap;
784
+ }
785
+ }
786
+ class MultiHook {
787
+ tap(options, fn) {
788
+ for (let hook of this.hooks)hook.tap(options, fn);
789
+ }
790
+ tapAsync(options, fn) {
791
+ for (let hook of this.hooks)hook.tapAsync(options, fn);
792
+ }
793
+ tapPromise(options, fn) {
794
+ for (let hook of this.hooks)hook.tapPromise(options, fn);
795
+ }
796
+ isUsed() {
797
+ for (let hook of this.hooks)if (hook.isUsed()) return !0;
798
+ return !1;
799
+ }
800
+ intercept(interceptor) {
801
+ for (let hook of this.hooks)hook.intercept(interceptor);
802
+ }
803
+ withOptions(options) {
804
+ return new MultiHook(this.hooks.map((h)=>h.withOptions(options)), this.name);
805
+ }
806
+ constructor(hooks, name){
807
+ _define_property(this, "hooks", void 0), _define_property(this, "name", void 0), this.hooks = hooks, this.name = name;
808
+ }
809
+ }
305
810
  let cutOffLoaderExecution = (stack)=>((stack, flag)=>{
306
811
  let stacks = stack.split('\n');
307
812
  for(let i = 0; i < stacks.length; i++)stacks[i].includes(flag) && (stacks.length = i);
308
813
  return stacks.join('\n');
309
814
  })(stack, 'LOADER_EXECUTION');
310
- class WebpackError extends Error {
815
+ class WebpackError_WebpackError extends Error {
311
816
  loc;
312
817
  file;
313
818
  chunk;
@@ -315,14 +820,14 @@ class WebpackError extends Error {
315
820
  details;
316
821
  hideStack;
317
822
  }
318
- Object.defineProperty(WebpackError.prototype, inspect.custom, {
823
+ Object.defineProperty(WebpackError_WebpackError.prototype, inspect.custom, {
319
824
  value: function() {
320
825
  return this.stack + (this.details ? `\n${this.details}` : '');
321
826
  },
322
827
  enumerable: !1,
323
828
  configurable: !0
324
829
  });
325
- let lib_WebpackError = WebpackError, LogType = Object.freeze({
830
+ let lib_WebpackError = WebpackError_WebpackError, LogType = Object.freeze({
326
831
  error: 'error',
327
832
  warn: 'warn',
328
833
  info: 'info',
@@ -340,7 +845,7 @@ let lib_WebpackError = WebpackError, LogType = Object.freeze({
340
845
  cache: 'cache'
341
846
  });
342
847
  function getLogTypeBitFlag(type) {
343
- return 1 << Object.values(LogType).findIndex((i)=>i === type);
848
+ return 1 << Object.values(LogType).indexOf(type);
344
849
  }
345
850
  function getLogTypesBitFlag(types) {
346
851
  return types.reduce((acc, cur)=>acc | getLogTypeBitFlag(cur), 0);
@@ -478,6 +983,9 @@ class ModuleGraph {
478
983
  getResolvedModule(dependency) {
479
984
  return this.#inner.getResolvedModule(dependency);
480
985
  }
986
+ getUsedExports(module, runtime) {
987
+ return this.#inner.getUsedExports(module, runtime);
988
+ }
481
989
  getParentModule(dependency) {
482
990
  return this.#inner.getParentModule(dependency);
483
991
  }
@@ -598,6 +1106,17 @@ class Stats {
598
1106
  compilation: this.compilation,
599
1107
  getStatsCompilation: (compilation)=>{
600
1108
  if (statsCompilationMap.has(compilation)) return statsCompilationMap.get(compilation);
1109
+ if (this.compilation !== this.compilation.compiler._lastCompilation) return {
1110
+ assets: [],
1111
+ assetsByChunkName: [],
1112
+ chunks: [],
1113
+ entrypoints: [],
1114
+ errors: [],
1115
+ hash: 'XXXX',
1116
+ modules: [],
1117
+ namedChunkGroups: [],
1118
+ warnings: []
1119
+ };
601
1120
  let innerStats = this.#getInnerByCompilation(compilation);
602
1121
  options.warnings = !1;
603
1122
  let innerStatsCompilation = innerStats.toJson(options);
@@ -613,6 +1132,17 @@ class Stats {
613
1132
  compilation: this.compilation,
614
1133
  getStatsCompilation: (compilation)=>{
615
1134
  if (statsCompilationMap.has(compilation)) return statsCompilationMap.get(compilation);
1135
+ if (this.compilation !== this.compilation.compiler._lastCompilation) return {
1136
+ assets: [],
1137
+ assetsByChunkName: [],
1138
+ chunks: [],
1139
+ entrypoints: [],
1140
+ errors: [],
1141
+ hash: 'XXXX',
1142
+ modules: [],
1143
+ namedChunkGroups: [],
1144
+ warnings: []
1145
+ };
616
1146
  let innerStatsCompilation = this.#getInnerByCompilation(compilation).toJson(options);
617
1147
  return statsCompilationMap.set(compilation, innerStatsCompilation), innerStatsCompilation;
618
1148
  },
@@ -1055,15 +1585,15 @@ class MergeCaller {
1055
1585
  return this.callArgs;
1056
1586
  }
1057
1587
  push(...data) {
1058
- 0 === this.callArgs.length && queueMicrotask(this.finalCall), this.callArgs.push(...data);
1588
+ 0 === this.callArgs.length && queueMicrotask(this.finalCall);
1589
+ for(let i = 0; i < data.length; i++)this.callArgs.push(data[i]);
1059
1590
  }
1060
1591
  }
1061
1592
  function createFakeCompilationDependencies(getDeps, addDeps) {
1062
1593
  let addDepsCaller = new MergeCaller(addDeps), deletedDeps = new Set(), hasDep = (dep)=>!deletedDeps.has(dep) && (addDepsCaller.pendingData().includes(dep) || getDeps().includes(dep)), getAllDeps = ()=>{
1063
- let deps = new Set([
1064
- ...getDeps(),
1065
- ...addDepsCaller.pendingData()
1066
- ]);
1594
+ let deps = new Set();
1595
+ for (let dep of getDeps())deps.add(dep);
1596
+ for (let dep of addDepsCaller.pendingData())deps.add(dep);
1067
1597
  for (let deleted of deletedDeps)deps.delete(deleted);
1068
1598
  return deps;
1069
1599
  };
@@ -1076,8 +1606,7 @@ function createFakeCompilationDependencies(getDeps, addDeps) {
1076
1606
  deletedDeps.delete(dep), addDepsCaller.push(dep);
1077
1607
  },
1078
1608
  addAll: (deps)=>{
1079
- for (let dep of deps)deletedDeps.delete(dep);
1080
- addDepsCaller.push(...deps);
1609
+ for (let dep of deps)deletedDeps.delete(dep), addDepsCaller.push(dep);
1081
1610
  },
1082
1611
  delete: (dep)=>{
1083
1612
  let hadDep = hasDep(dep);
@@ -1295,18 +1824,34 @@ function createDiagnosticArray(adm) {
1295
1824
  reduce: (callbackfn, initialValue)=>adm.values().reduce(callbackfn, initialValue),
1296
1825
  reduceRight: (callbackfn, initialValue)=>adm.values().reduceRight(callbackfn, initialValue)
1297
1826
  }, proxy = new Proxy(array, {
1298
- get: (target, name)=>'length' === name ? adm.length : 'string' != typeof name || Number.isNaN(Number.parseInt(name)) ? Object.prototype.hasOwnProperty.call(arrayExtensions, name) ? arrayExtensions[name] : target[name] : adm.get(Number.parseInt(name)),
1827
+ get: (target, name)=>'length' === name ? adm.length : 'string' != typeof name || Number.isNaN(Number.parseInt(name, 10)) ? Object.prototype.hasOwnProperty.call(arrayExtensions, name) ? arrayExtensions[name] : target[name] : adm.get(Number.parseInt(name, 10)),
1299
1828
  set (target, name, value) {
1300
1829
  if ('length' === name) throw Error("The 'length' property is read-only and cannot be assigned a new value.");
1301
- return 'symbol' == typeof name || Number.isNaN(Number.parseInt(name)) ? target[name] = value : adm.set(Number.parseInt(name), value), !0;
1830
+ return 'symbol' == typeof name || Number.isNaN(Number.parseInt(name, 10)) ? target[name] = value : adm.set(Number.parseInt(name, 10), value), !0;
1302
1831
  }
1303
1832
  });
1304
1833
  return adm[$proxy] = proxy, proxy;
1305
1834
  }
1835
+ function _to_property_key(arg) {
1836
+ var key = function(input, hint) {
1837
+ if ("object" !== _type_of(input) || null === input) return input;
1838
+ var prim = input[Symbol.toPrimitive];
1839
+ if (void 0 !== prim) {
1840
+ var res = prim.call(input, hint || "default");
1841
+ if ("object" !== _type_of(res)) return res;
1842
+ throw TypeError("@@toPrimitive must return a primitive value.");
1843
+ }
1844
+ return ("string" === hint ? String : Number)(input);
1845
+ }(arg, "string");
1846
+ return "symbol" === _type_of(key) ? key : String(key);
1847
+ }
1848
+ function _type_of(obj) {
1849
+ return obj && "u" > typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
1850
+ }
1306
1851
  let checkCompilation = (compilation)=>{
1307
1852
  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.');
1308
1853
  };
1309
- _computedKey = binding_default().COMPILATION_HOOKS_MAP_SYMBOL;
1854
+ _computedKey = _to_property_key(binding_default().COMPILATION_HOOKS_MAP_SYMBOL);
1310
1855
  class Compilation {
1311
1856
  #inner;
1312
1857
  #shutdown;
@@ -1395,6 +1940,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1395
1940
  'chunks',
1396
1941
  'modules'
1397
1942
  ]),
1943
+ beforeModuleIds: new SyncHook([
1944
+ 'modules'
1945
+ ]),
1398
1946
  finishModules: new AsyncSeriesHook([
1399
1947
  'modules'
1400
1948
  ]),
@@ -1453,7 +2001,18 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1453
2001
  seal: new SyncHook([]),
1454
2002
  afterSeal: new AsyncSeriesHook([]),
1455
2003
  needAdditionalPass: new SyncBailHook([])
1456
- }, this.compiler = compiler, this.resolverFactory = compiler.resolverFactory, this.inputFileSystem = compiler.inputFileSystem, this.options = compiler.options, this.outputOptions = compiler.options.output, 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();
2004
+ };
2005
+ let availableHooks = Object.keys(this.hooks);
2006
+ this.hooks = new Proxy(this.hooks, {
2007
+ get (target, prop, receiver) {
2008
+ let value = Reflect.get(target, prop, receiver);
2009
+ if (void 0 === value && 'string' == typeof prop) {
2010
+ let hooksList = availableHooks.join(', ');
2011
+ throw Error(`Compilation.hooks.${prop} is not supported in rspack. This typically happens when using webpack plugins that rely on webpack-specific hooks. Consider using an rspack-compatible alternative or removing the incompatible plugin.\n\nAvailable compilation hooks: ${hooksList}`);
2012
+ }
2013
+ return value;
2014
+ }
2015
+ }), this.compiler = compiler, this.resolverFactory = compiler.resolverFactory, this.inputFileSystem = compiler.inputFileSystem, this.options = compiler.options, this.outputOptions = compiler.options.output, 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();
1457
2016
  }
1458
2017
  get hash() {
1459
2018
  return this.#inner.hash;
@@ -1808,7 +2367,7 @@ class EntryData {
1808
2367
  this.dependencies = binding.dependencies, this.includeDependencies = binding.includeDependencies, this.options = binding.options;
1809
2368
  }
1810
2369
  }
1811
- _computedKey1 = Symbol.iterator, _computedKey2 = Symbol.toStringTag;
2370
+ _computedKey1 = _to_property_key(Symbol.iterator), _computedKey2 = _to_property_key(Symbol.toStringTag);
1812
2371
  class Entries {
1813
2372
  #data;
1814
2373
  constructor(data){
@@ -1848,6 +2407,12 @@ class Entries {
1848
2407
  delete(key) {
1849
2408
  return this.#data.delete(key);
1850
2409
  }
2410
+ getOrInsert(key, defaultValue) {
2411
+ return this.has(key) || this.set(key, defaultValue), this.get(key);
2412
+ }
2413
+ getOrInsertComputed(key, callback) {
2414
+ return this.has(key) || this.set(key, callback(key)), this.get(key);
2415
+ }
1851
2416
  get(key) {
1852
2417
  let binding = this.#data.get(key);
1853
2418
  return binding ? EntryData.__from_binding(binding) : void 0;
@@ -1911,7 +2476,7 @@ let INTERNAL_PLUGIN_NAMES = Object.keys(binding_default().BuiltinPluginName), AP
1911
2476
  }), BundlerInfoRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName.BundlerInfoRspackPlugin, (options)=>({
1912
2477
  version: options.version || 'unknown',
1913
2478
  bundler: options.bundler || 'rspack',
1914
- force: options.force ?? !0
2479
+ force: options.force ?? !1
1915
2480
  })), CaseSensitivePlugin = base_create(binding_namespaceObject.BuiltinPluginName.CaseSensitivePlugin, ()=>{}, 'compilation'), ChunkPrefetchPreloadPlugin = base_create(binding_namespaceObject.BuiltinPluginName.ChunkPrefetchPreloadPlugin, ()=>{});
1916
2481
  class CircularDependencyRspackPlugin extends RspackBuiltinPlugin {
1917
2482
  name = binding_namespaceObject.BuiltinPluginName.CircularDependencyRspackPlugin;
@@ -2141,6 +2706,77 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
2141
2706
  }
2142
2707
  }
2143
2708
  }
2709
+ class JsSplitChunkSizes {
2710
+ static __to_binding(sizes) {
2711
+ return 'number' == typeof sizes ? sizes : sizes && 'object' == typeof sizes ? {
2712
+ sizes: sizes
2713
+ } : sizes;
2714
+ }
2715
+ }
2716
+ class SplitChunksPlugin extends RspackBuiltinPlugin {
2717
+ options;
2718
+ name = binding_namespaceObject.BuiltinPluginName.SplitChunksPlugin;
2719
+ affectedHooks = 'thisCompilation';
2720
+ constructor(options){
2721
+ super(), this.options = options;
2722
+ }
2723
+ raw(compiler) {
2724
+ let rawOptions = SplitChunksPlugin_toRawSplitChunksOptions(this.options, compiler);
2725
+ if (void 0 === rawOptions) throw Error('rawOptions should not be undefined');
2726
+ return createBuiltinPlugin(this.name, rawOptions);
2727
+ }
2728
+ }
2729
+ function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler) {
2730
+ if (!sc) return;
2731
+ function getName(name) {
2732
+ return 'function' == typeof name ? (ctx)=>void 0 === ctx.module ? name(void 0) : name(ctx.module, getChunks(ctx.chunks), ctx.cacheGroupKey) : name;
2733
+ }
2734
+ function getChunks(chunks) {
2735
+ return 'function' == typeof chunks ? (chunk)=>chunks(chunk) : chunks;
2736
+ }
2737
+ let { name, chunks, defaultSizeTypes, cacheGroups = {}, fallbackCacheGroup, minSize, minSizeReduction, enforceSizeThreshold, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = sc;
2738
+ return {
2739
+ name: getName(name),
2740
+ chunks: getChunks(chunks),
2741
+ defaultSizeTypes: defaultSizeTypes || [
2742
+ "javascript",
2743
+ 'unknown'
2744
+ ],
2745
+ cacheGroups: Object.entries(cacheGroups).filter(([_key, group])=>!1 !== group).map(([key, group])=>{
2746
+ let { test, name, chunks, minSize, minSizeReduction, enforceSizeThreshold, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = group;
2747
+ return {
2748
+ key,
2749
+ test: 'function' == typeof test ? (ctx)=>{
2750
+ let info = {
2751
+ moduleGraph: compiler._lastCompilation.moduleGraph,
2752
+ chunkGraph: compiler._lastCompilation.chunkGraph
2753
+ };
2754
+ return test(ctx.module, info);
2755
+ } : test,
2756
+ name: getName(name),
2757
+ chunks: getChunks(chunks),
2758
+ minSize: JsSplitChunkSizes.__to_binding(minSize),
2759
+ minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
2760
+ enforceSizeThreshold: JsSplitChunkSizes.__to_binding(enforceSizeThreshold),
2761
+ maxSize: JsSplitChunkSizes.__to_binding(maxSize),
2762
+ maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
2763
+ maxInitialSize: JsSplitChunkSizes.__to_binding(maxInitialSize),
2764
+ ...passThrough
2765
+ };
2766
+ }),
2767
+ fallbackCacheGroup: {
2768
+ chunks: getChunks(chunks),
2769
+ ...fallbackCacheGroup
2770
+ },
2771
+ minSize: JsSplitChunkSizes.__to_binding(minSize),
2772
+ minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
2773
+ enforceSizeThreshold: JsSplitChunkSizes.__to_binding(enforceSizeThreshold),
2774
+ maxSize: JsSplitChunkSizes.__to_binding(maxSize),
2775
+ maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
2776
+ maxInitialSize: JsSplitChunkSizes.__to_binding(maxInitialSize),
2777
+ ...passThrough
2778
+ };
2779
+ }
2144
2780
  let EnableLibraryPlugin_enabledTypes = new WeakMap(), EnableLibraryPlugin_getEnabledTypes = (compiler)=>{
2145
2781
  let set = EnableLibraryPlugin_enabledTypes.get(compiler);
2146
2782
  return void 0 === set && (set = new Set(), EnableLibraryPlugin_enabledTypes.set(compiler, set)), set;
@@ -2159,33 +2795,15 @@ class EnableLibraryPlugin extends RspackBuiltinPlugin {
2159
2795
  }
2160
2796
  raw(compiler) {
2161
2797
  let type = this.type, enabled = EnableLibraryPlugin_getEnabledTypes(compiler);
2162
- if (!enabled.has(type)) return enabled.add(type), createBuiltinPlugin(this.name, type);
2163
- }
2164
- }
2165
- let EnableWasmLoadingPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EnableWasmLoadingPlugin, (type)=>type), EnsureChunkConditionsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EnsureChunkConditionsPlugin, ()=>{}), RemoveDuplicateModulesPlugin = base_create(binding_namespaceObject.BuiltinPluginName.RemoveDuplicateModulesPlugin, ()=>({}));
2166
- function applyLimits(options) {
2167
- options.optimization.concatenateModules = !1, options.optimization.removeEmptyChunks = !1, options.output.chunkFormat = !1, options.output.module = !0, options.output.chunkLoading && 'import' !== options.output.chunkLoading && (options.output.chunkLoading = 'import'), void 0 === options.output.chunkLoading && (options.output.chunkLoading = 'import');
2168
- let { splitChunks } = options.optimization;
2169
- void 0 === splitChunks && (splitChunks = options.optimization.splitChunks = {}), !1 !== splitChunks && (splitChunks.chunks = 'all', splitChunks.minSize = 0, splitChunks.maxAsyncRequests = 1 / 0, splitChunks.maxInitialRequests = 1 / 0, splitChunks.cacheGroups ??= {}, splitChunks.cacheGroups.default = !1, splitChunks.cacheGroups.defaultVendors = !1);
2170
- }
2171
- class EsmLibraryPlugin {
2172
- static PLUGIN_NAME = 'EsmLibraryPlugin';
2173
- options;
2174
- constructor(options){
2175
- this.options = options;
2176
- }
2177
- apply(compiler) {
2178
- var config;
2179
- let err;
2180
- if (applyLimits(compiler.options), new RemoveDuplicateModulesPlugin().apply(compiler), err = (config = compiler.options).optimization.concatenateModules ? 'You should disable `config.optimization.concatenateModules`' : !1 !== config.output.chunkFormat ? (console.log(config.output.chunkFormat), 'You should disable default chunkFormat by `config.output.chunkFormat = false`') : void 0) throw new lib_WebpackError(`Conflicted config for ${EsmLibraryPlugin.PLUGIN_NAME}: ${err}`);
2181
- compiler.__internal__registerBuiltinPlugin({
2182
- name: binding_namespaceObject.BuiltinPluginName.EsmLibraryPlugin,
2183
- options: {
2184
- preserveModules: this.options?.preserveModules
2185
- }
2798
+ if (!enabled.has(type)) return enabled.add(type), createBuiltinPlugin(this.name, {
2799
+ libraryType: type,
2800
+ preserveModules: compiler.options.output.library?.preserveModules,
2801
+ splitChunks: SplitChunksPlugin_toRawSplitChunksOptions(compiler.options.optimization.splitChunks ?? !1, compiler)
2186
2802
  });
2187
2803
  }
2188
2804
  }
2805
+ let EnableWasmLoadingPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EnableWasmLoadingPlugin, (type)=>type), EnsureChunkConditionsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EnsureChunkConditionsPlugin, ()=>{}), RemoveDuplicateModulesPlugin_RemoveDuplicateModulesPlugin = base_create(binding_namespaceObject.BuiltinPluginName.RemoveDuplicateModulesPlugin, ()=>({}));
2806
+ base_create(binding_namespaceObject.BuiltinPluginName.EsmNodeTargetPlugin, ()=>void 0);
2189
2807
  let EvalDevToolModulePlugin = base_create(binding_namespaceObject.BuiltinPluginName.EvalDevToolModulePlugin, (options)=>options, 'compilation'), EvalSourceMapDevToolPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EvalSourceMapDevToolPlugin, (options)=>options, 'compilation');
2190
2808
  function isNil(value) {
2191
2809
  return null == value;
@@ -2205,11 +2823,7 @@ function stringifyLoaderObject(o) {
2205
2823
  let unsupported = (name, issue)=>{
2206
2824
  let s = `${name} is not supported by Rspack.`;
2207
2825
  throw issue && (s += ` Refer to issue ${issue} for more information.`), Error(s);
2208
- }, warnedMessages = new Set();
2209
- function deprecate(message) {
2210
- warnedMessages.has(message) || (warnedMessages.add(message), console.warn(`[Rspack Deprecation] ${message}`));
2211
- }
2212
- let WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>'' === relativePath ? './.' : '..' === relativePath ? '../.' : relativePath.startsWith('../') ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
2826
+ }, warnedMessages = new Set(), WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>'' === relativePath ? './.' : '..' === relativePath ? '../.' : relativePath.startsWith('../') ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
2213
2827
  if ('/' === maybeAbsolutePath[0]) {
2214
2828
  if (maybeAbsolutePath.length > 1 && '/' === maybeAbsolutePath[maybeAbsolutePath.length - 1]) return maybeAbsolutePath;
2215
2829
  let querySplitPos = maybeAbsolutePath.indexOf('?'), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
@@ -2290,6 +2904,11 @@ let WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])
2290
2904
  query: match[2] ? match[2].replace(/\u200b(.)/g, '$1') : ''
2291
2905
  };
2292
2906
  });
2907
+ function isStatsColorSupported() {
2908
+ if ("u" < typeof process) return !1;
2909
+ let env = process.env ?? {}, argv = process.argv ?? [];
2910
+ return !('NO_COLOR' in env || argv.includes('--no-color')) && ('FORCE_COLOR' in env || argv.includes('--color') || 'win32' === process.platform || process.stdout?.isTTY && 'dumb' !== env.TERM || 'CI' in env);
2911
+ }
2293
2912
  function encodeVersion(version) {
2294
2913
  let [major, minor = 0, patch = 0] = version.split('-')[0].split('.').map((v)=>parseInt(v, 10));
2295
2914
  return Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch) ? null : major << 16 | minor << 8 | patch;
@@ -2398,11 +3017,24 @@ function toFeatures(featureOptions) {
2398
3017
  }
2399
3018
  return feature;
2400
3019
  }
2401
- function resolveCollectTypeScriptInfo(options) {
2402
- return {
2403
- typeExports: options.typeExports,
2404
- exportedEnum: !0 === options.exportedEnum ? 'all' : !1 === options.exportedEnum || void 0 === options.exportedEnum ? 'none' : 'const-only'
2405
- };
3020
+ function resolvePluginImport(pluginImport) {
3021
+ if (pluginImport) return pluginImport.map((config)=>{
3022
+ let rawConfig = {
3023
+ ...config,
3024
+ style: {}
3025
+ };
3026
+ if ('boolean' == typeof config.style) rawConfig.style.bool = config.style;
3027
+ else if ('string' == typeof config.style) {
3028
+ let isTpl = config.style.includes('{{');
3029
+ rawConfig.style[isTpl ? 'custom' : 'css'] = config.style;
3030
+ } else {
3031
+ var val;
3032
+ val = config.style, '[object Object]' === Object.prototype.toString.call(val) && (rawConfig.style = config.style);
3033
+ }
3034
+ return config.styleLibraryDirectory && (rawConfig.style = {
3035
+ styleLibraryDirectory: config.styleLibraryDirectory
3036
+ }), rawConfig;
3037
+ });
2406
3038
  }
2407
3039
  let $assets = Symbol('assets');
2408
3040
  Object.defineProperty(binding_default().KnownBuildInfo.prototype, node_util.inspect.custom, {
@@ -2487,8 +3119,7 @@ Object.defineProperty(binding_default().NormalModule.prototype, 'identifier', {
2487
3119
  value (filename, source, assetInfo) {
2488
3120
  return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
2489
3121
  }
2490
- });
2491
- Object.defineProperty(binding_default().NormalModule, 'getCompilationHooks', {
3122
+ }), Object.defineProperty(binding_default().NormalModule, 'getCompilationHooks', {
2492
3123
  enumerable: !0,
2493
3124
  configurable: !0,
2494
3125
  value (compilation) {
@@ -2499,40 +3130,6 @@ Object.defineProperty(binding_default().NormalModule, 'getCompilationHooks', {
2499
3130
  'loaderContext',
2500
3131
  'module'
2501
3132
  ]),
2502
- readResourceForScheme: new HookMap((scheme)=>{
2503
- let fakeHook, message, code, hook = hooks.readResource.for(scheme);
2504
- return fakeHook = {
2505
- tap: (options, fn)=>hook.tap(options, (loaderContext)=>fn(loaderContext.resource)),
2506
- tapAsync: (options, fn)=>hook.tapAsync(options, (loaderContext, callback)=>fn(loaderContext.resource, callback)),
2507
- tapPromise: (options, fn)=>hook.tapPromise(options, (loaderContext)=>fn(loaderContext.resource))
2508
- }, Object.freeze(Object.assign(message && code ? ((obj, message, code)=>{
2509
- let newObj = {}, descriptors = Object.getOwnPropertyDescriptors(obj);
2510
- for (let name of Object.keys(descriptors)){
2511
- let descriptor = descriptors[name];
2512
- if ('function' == typeof descriptor.value) Object.defineProperty(newObj, name, {
2513
- ...descriptor,
2514
- value: node_util.deprecate(descriptor.value, message, code)
2515
- });
2516
- else if (descriptor.get || descriptor.set) Object.defineProperty(newObj, name, {
2517
- ...descriptor,
2518
- get: descriptor.get && node_util.deprecate(descriptor.get, message, code),
2519
- set: descriptor.set && node_util.deprecate(descriptor.set, message, code)
2520
- });
2521
- else {
2522
- let value = descriptor.value;
2523
- Object.defineProperty(newObj, name, {
2524
- configurable: descriptor.configurable,
2525
- enumerable: descriptor.enumerable,
2526
- get: node_util.deprecate(()=>value, message, code),
2527
- set: descriptor.writable ? node_util.deprecate((v)=>value = v, message, code) : void 0
2528
- });
2529
- }
2530
- }
2531
- return newObj;
2532
- })(fakeHook, message, code) : fakeHook, {
2533
- _fakeHook: !0
2534
- }));
2535
- }),
2536
3133
  readResource: new HookMap(()=>new AsyncSeriesBailHook([
2537
3134
  'loaderContext'
2538
3135
  ]))
@@ -2787,20 +3384,6 @@ class BulkUpdateDecorator extends Hash {
2787
3384
  return void 0 !== digestCache && 'string' == typeof result && digestCache.set(buffer, result), result;
2788
3385
  }
2789
3386
  }
2790
- class DebugHash extends Hash {
2791
- string;
2792
- constructor(){
2793
- super(), this.string = '';
2794
- }
2795
- update(data) {
2796
- let normalizedData;
2797
- return (normalizedData = Buffer.isBuffer(data) ? data.toString('utf-8') : data).startsWith('debug-digest-') && (normalizedData = Buffer.from(normalizedData.slice(13), 'hex').toString()), this.string += `[${normalizedData}](${Error().stack?.split('\n', 3)[2]})\n`, this;
2798
- }
2799
- digest(encoding) {
2800
- let result = `debug-digest-${Buffer.from(this.string).toString('hex')}`;
2801
- return encoding ? result : Buffer.from(result);
2802
- }
2803
- }
2804
3387
  class WasmHashAdapter extends Hash {
2805
3388
  wasmHash;
2806
3389
  constructor(wasmHash){
@@ -2816,8 +3399,6 @@ class WasmHashAdapter extends Hash {
2816
3399
  let createHash_createHash = (algorithm)=>{
2817
3400
  if ('function' == typeof algorithm) return new BulkUpdateDecorator(()=>new algorithm());
2818
3401
  switch(algorithm){
2819
- case 'debug':
2820
- return new DebugHash();
2821
3402
  case 'xxhash64':
2822
3403
  return new WasmHashAdapter((()=>{
2823
3404
  if (!createXxhash64) {
@@ -3623,6 +4204,7 @@ function createRawModuleRuleUses(uses, path, options) {
3623
4204
  if (identifier.startsWith(`${BUILTIN_LOADER_PREFIX}swc-loader`)) return ((o, composeOptions)=>{
3624
4205
  let options = o ?? {};
3625
4206
  if ('object' == typeof options) {
4207
+ var options1;
3626
4208
  if (options.jsc ??= {}, options.jsc.experimental ??= {}, options.jsc.experimental.disableAllLints ??= !0, options.env?.targets === void 0 && options.jsc?.target === void 0) {
3627
4209
  if (composeOptions.compiler.target?.targets) options.env ??= {}, options.env.targets ??= function(targets) {
3628
4210
  let REMAP = {
@@ -3649,27 +4231,12 @@ function createRawModuleRuleUses(uses, path, options) {
3649
4231
  options.jsc.target ??= esVersion >= 2015 ? `es${esVersion}` : 'es5';
3650
4232
  }
3651
4233
  }
3652
- options.collectTypeScriptInfo && (options.collectTypeScriptInfo = resolveCollectTypeScriptInfo(options.collectTypeScriptInfo));
4234
+ options.collectTypeScriptInfo && (options.collectTypeScriptInfo = {
4235
+ typeExports: (options1 = options.collectTypeScriptInfo).typeExports,
4236
+ exportedEnum: !0 === options1.exportedEnum ? 'all' : !1 === options1.exportedEnum || void 0 === options1.exportedEnum ? 'none' : 'const-only'
4237
+ }), options.transformImport && (options.transformImport = resolvePluginImport(options.transformImport));
3653
4238
  let { rspackExperiments } = options;
3654
- rspackExperiments && ((rspackExperiments.import || rspackExperiments.pluginImport) && (rspackExperiments.import = function(pluginImport) {
3655
- if (pluginImport) return pluginImport.map((config)=>{
3656
- let rawConfig = {
3657
- ...config,
3658
- style: {}
3659
- };
3660
- if ('boolean' == typeof config.style) rawConfig.style.bool = config.style;
3661
- else if ('string' == typeof config.style) {
3662
- let isTpl = config.style.includes('{{');
3663
- rawConfig.style[isTpl ? 'custom' : 'css'] = config.style;
3664
- } else {
3665
- var val;
3666
- val = config.style, '[object Object]' === Object.prototype.toString.call(val) && (rawConfig.style = config.style);
3667
- }
3668
- return config.styleLibraryDirectory && (rawConfig.style = {
3669
- styleLibraryDirectory: config.styleLibraryDirectory
3670
- }), rawConfig;
3671
- });
3672
- }(rspackExperiments.import || rspackExperiments.pluginImport)), rspackExperiments.collectTypeScriptInfo && (deprecate('`rspackExperiments.collectTypeScriptInfo` is deprecated and will be removed in Rspack v2.0. Use top-level `collectTypeScriptInfo` instead.'), options.collectTypeScriptInfo || (options.collectTypeScriptInfo = resolveCollectTypeScriptInfo(rspackExperiments.collectTypeScriptInfo)), delete rspackExperiments.collectTypeScriptInfo));
4239
+ rspackExperiments && (rspackExperiments.import || rspackExperiments.pluginImport) && (rspackExperiments.import = resolvePluginImport(rspackExperiments.import || rspackExperiments.pluginImport));
3673
4240
  }
3674
4241
  return options;
3675
4242
  })(o, options);
@@ -3752,19 +4319,16 @@ function tryMatch(payload, condition) {
3752
4319
  return !1;
3753
4320
  }
3754
4321
  let getRawModuleRule = (rule, path, options, upperType)=>{
3755
- let funcUse;
3756
- if (rule.loader && (rule.use = [
4322
+ let funcUse, normalizedUse = rule.loader ? [
3757
4323
  {
3758
4324
  loader: rule.loader,
3759
4325
  options: rule.options
3760
4326
  }
3761
- ]), 'function' == typeof rule.use) {
3762
- let use = rule.use;
3763
- funcUse = (rawContext)=>createRawModuleRuleUses(use({
3764
- ...rawContext,
3765
- compiler: options.compiler
3766
- }) ?? [], `${path}.use`, options);
3767
- }
4327
+ ] : rule.use;
4328
+ 'function' == typeof normalizedUse && (funcUse = (rawContext)=>createRawModuleRuleUses(normalizedUse({
4329
+ ...rawContext,
4330
+ compiler: options.compiler
4331
+ }) ?? [], `${path}.use`, options));
3768
4332
  let rawModuleRule = {
3769
4333
  test: rule.test ? getRawRuleSetCondition(rule.test) : void 0,
3770
4334
  include: rule.include ? getRawRuleSetCondition(rule.include) : void 0,
@@ -3786,7 +4350,7 @@ let getRawModuleRule = (rule, path, options, upperType)=>{
3786
4350
  scheme: rule.scheme ? getRawRuleSetCondition(rule.scheme) : void 0,
3787
4351
  mimetype: rule.mimetype ? getRawRuleSetCondition(rule.mimetype) : void 0,
3788
4352
  sideEffects: rule.sideEffects,
3789
- use: 'function' == typeof rule.use ? funcUse : createRawModuleRuleUses(rule.use ?? [], `${path}.use`, options),
4353
+ use: 'function' == typeof normalizedUse ? funcUse : createRawModuleRuleUses(normalizedUse ?? [], `${path}.use`, options),
3790
4354
  type: rule.type,
3791
4355
  layer: rule.layer,
3792
4356
  parser: rule.parser ? getRawParserOptions(rule.parser, rule.type ?? upperType) : void 0,
@@ -3897,16 +4461,16 @@ function getRawJavascriptParserOptions(parser) {
3897
4461
  dynamicImportPreload: parser.dynamicImportPreload?.toString(),
3898
4462
  dynamicImportPrefetch: parser.dynamicImportPrefetch?.toString(),
3899
4463
  dynamicImportFetchPriority: parser.dynamicImportFetchPriority,
3900
- importMeta: parser.importMeta,
4464
+ importMeta: 'boolean' == typeof parser.importMeta ? String(parser.importMeta) : parser.importMeta,
3901
4465
  url: parser.url?.toString(),
3902
4466
  exprContextCritical: parser.exprContextCritical,
3903
4467
  unknownContextCritical: parser.unknownContextCritical,
3904
4468
  wrappedContextCritical: parser.wrappedContextCritical,
4469
+ strictThisContextOnImports: parser.strictThisContextOnImports,
3905
4470
  wrappedContextRegExp: parser.wrappedContextRegExp,
3906
4471
  exportsPresence: !1 === parser.exportsPresence ? 'false' : parser.exportsPresence,
3907
4472
  importExportsPresence: !1 === parser.importExportsPresence ? 'false' : parser.importExportsPresence,
3908
4473
  reexportExportsPresence: !1 === parser.reexportExportsPresence ? 'false' : parser.reexportExportsPresence,
3909
- strictExportPresence: parser.strictExportPresence,
3910
4474
  worker: 'boolean' == typeof parser.worker ? parser.worker ? [
3911
4475
  '...'
3912
4476
  ] : [] : parser.worker,
@@ -3920,13 +4484,16 @@ function getRawJavascriptParserOptions(parser) {
3920
4484
  commonjsMagicComments: parser.commonjsMagicComments,
3921
4485
  typeReexportsPresence: parser.typeReexportsPresence,
3922
4486
  jsx: parser.jsx,
3923
- deferImport: parser.deferImport
4487
+ deferImport: parser.deferImport,
4488
+ importMetaResolve: parser.importMetaResolve,
4489
+ pureFunctions: parser.pureFunctions
3924
4490
  };
3925
4491
  }
3926
4492
  function getRawCssParserOptions(parser) {
3927
4493
  return {
3928
4494
  namedExports: parser.namedExports,
3929
- url: parser.url
4495
+ url: parser.url,
4496
+ resolveImport: parser.resolveImport
3930
4497
  };
3931
4498
  }
3932
4499
  function getRawGeneratorOptions(generator, type) {
@@ -4117,6 +4684,9 @@ class FlagDependencyUsagePlugin extends RspackBuiltinPlugin {
4117
4684
  return createBuiltinPlugin(this.name, this.global);
4118
4685
  }
4119
4686
  }
4687
+ let HashedModuleIdsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.HashedModuleIdsPlugin, (options)=>({
4688
+ ...options
4689
+ }), 'compilation');
4120
4690
  class HotModuleReplacementPlugin extends RspackBuiltinPlugin {
4121
4691
  name = binding_namespaceObject.BuiltinPluginName.HotModuleReplacementPlugin;
4122
4692
  raw(compiler) {
@@ -4380,7 +4950,7 @@ let JsLoaderRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName
4380
4950
  test,
4381
4951
  client,
4382
4952
  currentActiveModules
4383
- }), 'thisCompilation'), middleware_require = createRequire(import.meta.url), LAZY_COMPILATION_PREFIX = '/lazy-compilation-using-', noop = (_req, _res, next)=>{
4953
+ }), 'thisCompilation'), middleware_require = createRequire(import.meta.url), LAZY_COMPILATION_PREFIX = '/_rspack/lazy/trigger', noop = (_req, _res, next)=>{
4384
4954
  'function' == typeof next && next();
4385
4955
  }, lazyCompilationMiddleware = (compiler)=>{
4386
4956
  if (compiler instanceof MultiCompiler) {
@@ -4450,7 +5020,7 @@ let lazyCompilationMiddlewareInternal = (compiler, activeModules, lazyCompilatio
4450
5020
  });
4451
5021
  }(req);
4452
5022
  } catch (err) {
4453
- logger.error('Failed to parse request body: ' + err), res.writeHead(400), res.end('Bad Request');
5023
+ logger.error(`Failed to parse request body: ${err}`), res.writeHead(400), res.end('Bad Request');
4454
5024
  return;
4455
5025
  }
4456
5026
  let moduleActivated = [];
@@ -4501,8 +5071,8 @@ let NodeTargetPlugin = base_create(binding_namespaceObject.BuiltinPluginName.Nod
4501
5071
  })), OccurrenceChunkIdsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.OccurrenceChunkIdsPlugin, (options)=>({
4502
5072
  ...options
4503
5073
  }), 'compilation'), ProgressPlugin = base_create(binding_namespaceObject.BuiltinPluginName.ProgressPlugin, (progress = {})=>'function' == typeof progress ? {
4504
- handler: (percentage, msg, items)=>{
4505
- progress(percentage, msg, ...items);
5074
+ handler: (percentage, msg, info)=>{
5075
+ progress(percentage, msg, info);
4506
5076
  }
4507
5077
  } : progress), ProvidePlugin = base_create(binding_namespaceObject.BuiltinPluginName.ProvidePlugin, (provide)=>Object.fromEntries(Object.entries(provide).map(([key, value])=>('string' == typeof value && (value = [
4508
5078
  value
@@ -4563,82 +5133,88 @@ RuntimePlugin.getCompilationHooks = (compilation)=>{
4563
5133
  ])
4564
5134
  }, RuntimePlugin_compilationHooksMap.set(compilation, hooks)), hooks;
4565
5135
  };
4566
- let SideEffectsFlagPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SideEffectsFlagPlugin, ()=>{}, 'compilation'), SizeLimitsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SizeLimitsPlugin, (options)=>{
4567
- let hints = !1 === options.hints ? void 0 : options.hints;
4568
- return {
4569
- ...options,
4570
- hints
4571
- };
4572
- }), SourceMapDevToolPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SourceMapDevToolPlugin, (options)=>options, 'compilation');
4573
- class JsSplitChunkSizes {
4574
- static __to_binding(sizes) {
4575
- return 'number' == typeof sizes ? sizes : sizes && 'object' == typeof sizes ? {
4576
- sizes: sizes
4577
- } : sizes;
5136
+ let Coordinator_PLUGIN_NAME = 'RscPlugin', GET_OR_INIT_BINDING = Symbol('GET_OR_INIT_BINDING');
5137
+ class Coordinator {
5138
+ #serverCompiler;
5139
+ #clientCompiler;
5140
+ #clientLastCompilation;
5141
+ #isProxyingClientWatching = !1;
5142
+ #binding;
5143
+ constructor(){
5144
+ Object.defineProperty(this, GET_OR_INIT_BINDING, {
5145
+ enumerable: !1,
5146
+ configurable: !1,
5147
+ writable: !1,
5148
+ value: ()=>(this.#binding || (this.#binding = new binding_namespaceObject.JsCoordinator(()=>{
5149
+ if (!this.#serverCompiler) throw Error("[RscPlugin] Coordinator.getOrInitBinding() called before the server compiler was attached. Call coordinator.applyServerCompiler(serverCompiler) first.");
5150
+ return this.#serverCompiler[GET_COMPILER_ID]();
5151
+ })), this.#binding)
5152
+ });
5153
+ }
5154
+ applyServerCompiler(serverCompiler) {
5155
+ this.#serverCompiler = serverCompiler, serverCompiler.hooks.done.tap(Coordinator_PLUGIN_NAME, (stats)=>{
5156
+ this.#isProxyingClientWatching = !0, this.#clientLastCompilation && (stats.compilation.fileDependencies.addAll(this.#clientLastCompilation.fileDependencies), stats.compilation.contextDependencies.addAll(this.#clientLastCompilation.contextDependencies), stats.compilation.missingDependencies.addAll(this.#clientLastCompilation.missingDependencies));
5157
+ }), serverCompiler.hooks.watchRun.tap(Coordinator_PLUGIN_NAME, ()=>{
5158
+ this.#isProxyingClientWatching && this.#clientCompiler.watching.invalidateWithChangesAndRemovals(new Set(this.#serverCompiler.modifiedFiles), new Set(this.#serverCompiler.removedFiles));
5159
+ });
5160
+ }
5161
+ applyClientCompiler(clientCompiler) {
5162
+ this.#clientCompiler = clientCompiler;
5163
+ let originalWatch = clientCompiler.watch;
5164
+ clientCompiler.watch = function(watchOptions, handler) {
5165
+ return watchOptions.ignored = ()=>!0, originalWatch.call(this, watchOptions, handler);
5166
+ }, clientCompiler.hooks.done.tap(Coordinator_PLUGIN_NAME, (stats)=>{
5167
+ this.#clientLastCompilation = stats.compilation;
5168
+ });
4578
5169
  }
4579
5170
  }
4580
- class SplitChunksPlugin extends RspackBuiltinPlugin {
4581
- options;
4582
- name = binding_namespaceObject.BuiltinPluginName.SplitChunksPlugin;
4583
- affectedHooks = 'thisCompilation';
5171
+ class RscClientPlugin extends RspackBuiltinPlugin {
5172
+ name = 'RscClientPlugin';
5173
+ #options;
4584
5174
  constructor(options){
4585
- super(), this.options = options;
5175
+ super(), this.#options = options;
4586
5176
  }
4587
5177
  raw(compiler) {
4588
- let rawOptions = function(sc, compiler) {
4589
- if (!sc) return;
4590
- function getName(name) {
4591
- return 'function' == typeof name ? (ctx)=>void 0 === ctx.module ? name(void 0) : name(ctx.module, getChunks(ctx.chunks), ctx.cacheGroupKey) : name;
4592
- }
4593
- function getChunks(chunks) {
4594
- return 'function' == typeof chunks ? (chunk)=>chunks(chunk) : chunks;
4595
- }
4596
- let { name, chunks, defaultSizeTypes, cacheGroups = {}, fallbackCacheGroup, minSize, minSizeReduction, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = sc;
4597
- return {
4598
- name: getName(name),
4599
- chunks: getChunks(chunks),
4600
- defaultSizeTypes: defaultSizeTypes || [
4601
- "javascript",
4602
- 'unknown'
4603
- ],
4604
- cacheGroups: Object.entries(cacheGroups).filter(([_key, group])=>!1 !== group).map(([key, group])=>{
4605
- let { test, name, chunks, minSize, minSizeReduction, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = group;
4606
- return {
4607
- key,
4608
- test: 'function' == typeof test ? (ctx)=>{
4609
- let info = {
4610
- moduleGraph: compiler._lastCompilation.moduleGraph,
4611
- chunkGraph: compiler._lastCompilation.chunkGraph
4612
- };
4613
- return test(ctx.module, info);
4614
- } : test,
4615
- name: getName(name),
4616
- chunks: getChunks(chunks),
4617
- minSize: JsSplitChunkSizes.__to_binding(minSize),
4618
- minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
4619
- maxSize: JsSplitChunkSizes.__to_binding(maxSize),
4620
- maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
4621
- maxInitialSize: JsSplitChunkSizes.__to_binding(maxInitialSize),
4622
- ...passThrough
4623
- };
4624
- }),
4625
- fallbackCacheGroup: {
4626
- chunks: getChunks(chunks),
4627
- ...fallbackCacheGroup
4628
- },
4629
- minSize: JsSplitChunkSizes.__to_binding(minSize),
4630
- minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
4631
- maxSize: JsSplitChunkSizes.__to_binding(maxSize),
4632
- maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
4633
- maxInitialSize: JsSplitChunkSizes.__to_binding(maxInitialSize),
4634
- ...passThrough
4635
- };
4636
- }(this.options, compiler);
4637
- if (void 0 === rawOptions) throw Error('rawOptions should not be undefined');
4638
- return createBuiltinPlugin(this.name, rawOptions);
5178
+ return this.#options.coordinator.applyClientCompiler(compiler), createBuiltinPlugin(this.name, {
5179
+ coordinator: this.#options.coordinator[GET_OR_INIT_BINDING]()
5180
+ });
5181
+ }
5182
+ }
5183
+ class RscServerPlugin extends RspackBuiltinPlugin {
5184
+ name = 'RscServerPlugin';
5185
+ #options;
5186
+ constructor(options){
5187
+ super(), this.#options = options;
5188
+ }
5189
+ raw(compiler) {
5190
+ let onManifest;
5191
+ this.#options.coordinator.applyServerCompiler(compiler);
5192
+ let { coordinator, onServerComponentChanges } = this.#options;
5193
+ return this.#options.onManifest && (onManifest = (json)=>Promise.resolve(this.#options.onManifest(JSON.parse(json)))), createBuiltinPlugin(this.name, {
5194
+ coordinator: coordinator[GET_OR_INIT_BINDING](),
5195
+ onServerComponentChanges,
5196
+ onManifest
5197
+ });
5198
+ }
5199
+ }
5200
+ class SideEffectsFlagPlugin extends RspackBuiltinPlugin {
5201
+ analyzeSideEffectsFree;
5202
+ name = binding_namespaceObject.BuiltinPluginName.SideEffectsFlagPlugin;
5203
+ affectedHooks = 'compilation';
5204
+ constructor(analyzeSideEffectsFree = !1){
5205
+ super(), this.analyzeSideEffectsFree = analyzeSideEffectsFree;
5206
+ }
5207
+ raw() {
5208
+ return createBuiltinPlugin(this.name, this.analyzeSideEffectsFree);
4639
5209
  }
4640
5210
  }
4641
- let SubresourceIntegrityPlugin_require = createRequire(import.meta.url), SubresourceIntegrityPlugin_PLUGIN_NAME = 'SubresourceIntegrityPlugin', NATIVE_HTML_PLUGIN = 'HtmlRspackPlugin', HTTP_PROTOCOL_REGEX = /^https?:/, NativeSubresourceIntegrityPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SubresourceIntegrityPlugin, function(options) {
5211
+ let SizeLimitsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SizeLimitsPlugin, (options)=>{
5212
+ let hints = !1 === options.hints ? void 0 : options.hints;
5213
+ return {
5214
+ ...options,
5215
+ hints
5216
+ };
5217
+ }), SourceMapDevToolPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SourceMapDevToolPlugin, (options)=>options, 'compilation'), SubresourceIntegrityPlugin_require = createRequire(import.meta.url), SubresourceIntegrityPlugin_PLUGIN_NAME = 'SubresourceIntegrityPlugin', NATIVE_HTML_PLUGIN = 'HtmlRspackPlugin', HTTP_PROTOCOL_REGEX = /^https?:/, NativeSubresourceIntegrityPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SubresourceIntegrityPlugin, function(options) {
4642
5218
  let htmlPlugin = 'Disabled';
4643
5219
  return options.htmlPlugin === NATIVE_HTML_PLUGIN ? htmlPlugin = 'Native' : 'string' == typeof options.htmlPlugin && (htmlPlugin = 'JavaScript'), {
4644
5220
  hashFuncNames: options.hashFuncNames,
@@ -4708,13 +5284,11 @@ class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
4708
5284
  }
4709
5285
  let src = '';
4710
5286
  if (isUrlSrc) {
4711
- if (!publicPath) return;
5287
+ if (!publicPath || '/' === publicPath || './' === publicPath) return;
4712
5288
  let protocolRelativePublicPath = publicPath.replace(HTTP_PROTOCOL_REGEX, ''), protocolRelativeTagSrc = tagSrc.replace(HTTP_PROTOCOL_REGEX, '');
4713
5289
  if (!protocolRelativeTagSrc.startsWith(protocolRelativePublicPath)) return;
4714
- {
4715
- let tagSrcWithScheme = `http:${protocolRelativeTagSrc}`;
4716
- src = relative(protocolRelativePublicPath.startsWith('//') ? `http:${protocolRelativePublicPath}` : protocolRelativePublicPath, decodeURIComponent(tagSrcWithScheme));
4717
- }
5290
+ let tagSrcWithScheme = `http:${protocolRelativeTagSrc}`;
5291
+ src = relative(protocolRelativePublicPath.startsWith('//') ? `http:${protocolRelativePublicPath}` : protocolRelativePublicPath, decodeURIComponent(tagSrcWithScheme));
4718
5292
  } else src = relative(publicPath, decodeURIComponent(tagSrc));
4719
5293
  tag.attributes.integrity = this.getIntegrityChecksumForAsset(src) || function(hashFuncNames, source) {
4720
5294
  let { createHash } = SubresourceIntegrityPlugin_require('node:crypto');
@@ -4778,23 +5352,37 @@ let SwcJsMinimizerRspackPlugin = base_create(binding_namespaceObject.BuiltinPlug
4778
5352
  exclude: options?.exclude,
4779
5353
  extractComments: function(extractComments) {
4780
5354
  let type, conditionStr = (condition)=>{
4781
- if (void 0 === condition || !0 === condition) return '@preserve|@lic|@cc_on|^\\**!';
5355
+ if (void 0 === condition || !0 === condition) return {
5356
+ source: '@preserve|@lic|@cc_on|^\\**!',
5357
+ flags: ''
5358
+ };
4782
5359
  if (!1 === condition) throw Error('unreachable');
4783
- return condition.source;
5360
+ return {
5361
+ source: condition.source,
5362
+ flags: condition.flags
5363
+ };
4784
5364
  };
4785
5365
  if ('boolean' == typeof extractComments) {
4786
5366
  if (!extractComments) return;
5367
+ let { source, flags } = conditionStr(extractComments);
4787
5368
  return {
4788
- condition: conditionStr(extractComments)
5369
+ condition: source,
5370
+ conditionFlags: flags
5371
+ };
5372
+ }
5373
+ if (extractComments instanceof RegExp) {
5374
+ let { source, flags } = conditionStr(extractComments);
5375
+ return {
5376
+ condition: source,
5377
+ conditionFlags: flags
4789
5378
  };
4790
5379
  }
4791
- if (extractComments instanceof RegExp) return {
4792
- condition: extractComments.source
4793
- };
4794
5380
  if (type = typeof extractComments, null != extractComments && ('object' === type || 'function' === type)) {
4795
5381
  if (!1 === extractComments.condition) return;
5382
+ let { source, flags } = conditionStr(extractComments.condition);
4796
5383
  return {
4797
- condition: conditionStr(extractComments.condition),
5384
+ condition: source,
5385
+ conditionFlags: flags,
4798
5386
  banner: extractComments.banner
4799
5387
  };
4800
5388
  }
@@ -4821,6 +5409,7 @@ class WorkerPlugin extends RspackBuiltinPlugin {
4821
5409
  module;
4822
5410
  workerPublicPath;
4823
5411
  name = binding_namespaceObject.BuiltinPluginName.WorkerPlugin;
5412
+ affectedHooks = 'compilation';
4824
5413
  constructor(chunkLoading, wasmLoading, module, workerPublicPath){
4825
5414
  super(), this.chunkLoading = chunkLoading, this.wasmLoading = wasmLoading, this.module = module, this.workerPublicPath = workerPublicPath;
4826
5415
  }
@@ -4841,7 +5430,7 @@ class ContextModuleFactory {
4841
5430
  };
4842
5431
  }
4843
5432
  }
4844
- let FUNCTION_CONTENT_REGEX = /^function\s?\(\)\s?\{\r?\n?|\r?\n?\}$/g, INDENT_MULTILINE_REGEX = /^\t/gm, LINE_SEPARATOR_REGEX = /\r?\n/g, IDENTIFIER_NAME_REPLACE_REGEX = /^([^a-zA-Z$_])/, IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX = /[^a-zA-Z0-9$]+/g, COMMENT_END_REGEX = /\*\//g, PATH_NAME_NORMALIZE_REPLACE_REGEX = /[^a-zA-Z0-9_!§$()=\-^°]+/g, MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g;
5433
+ let FUNCTION_CONTENT_REGEX = /^function(?:\s+[\w$]+)?\s?\(\)\s?\{\r?\n?|\r?\n?\}$/g, INDENT_MULTILINE_REGEX = /^\t/gm, LINE_SEPARATOR_REGEX = /\r?\n/g, IDENTIFIER_NAME_REPLACE_REGEX = /^([^a-zA-Z$_])/, IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX = /[^a-zA-Z0-9$]+/g, COMMENT_END_REGEX = /\*\//g, PATH_NAME_NORMALIZE_REPLACE_REGEX = /[^a-zA-Z0-9_!§$()=\-^°]+/g, MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g;
4845
5434
  class Template {
4846
5435
  static getFunctionContent(fn) {
4847
5436
  return fn.toString().replace(FUNCTION_CONTENT_REGEX, '').replace(INDENT_MULTILINE_REGEX, '').replace(LINE_SEPARATOR_REGEX, '\n');
@@ -4962,7 +5551,7 @@ let DYNAMIC_INFO = Symbol('cleverMerge dynamic info'), mergeCache = new WeakMap(
4962
5551
  }, 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)=>{
4963
5552
  let firstObject = internalCaching ? cachedParseObject(first) : parseObject(first), { static: firstInfo, dynamic: firstDynamicInfo } = firstObject, secondObj = second;
4964
5553
  if (void 0 !== firstDynamicInfo) {
4965
- let { byProperty, fn } = firstDynamicInfo, fnInfo = fn[DYNAMIC_INFO];
5554
+ let { fn } = firstDynamicInfo, { byProperty } = firstDynamicInfo, fnInfo = fn[DYNAMIC_INFO];
4966
5555
  fnInfo && (secondObj = internalCaching ? cachedCleverMerge(fnInfo[1], second) : cleverMerge(fnInfo[1], second), fn = fnInfo[0]);
4967
5556
  let newFn = (...args)=>{
4968
5557
  let fnResult = fn(...args);
@@ -5949,23 +6538,22 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
5949
6538
  if ('function' != typeof options.entry) for (let key of Object.keys(options.entry))F(options.entry[key], 'import', ()=>[
5950
6539
  './src'
5951
6540
  ]);
5952
- return F(options, 'devtool', ()=>!!development && 'eval'), D(options, 'watch', !1), D(options, 'lazyCompilation', !1), D(options, 'bail', !1), F(options, 'cache', ()=>development), applyExperimentsDefaults(options.experiments), applyOptimizationDefaults(options.optimization, {
6541
+ 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), applyIncrementalDefaults(options), applyExperimentsDefaults(options.experiments), applyOptimizationDefaults(options.optimization, {
5953
6542
  production,
5954
6543
  development
5955
6544
  }), applySnapshotDefaults(options.snapshot, {
5956
6545
  production
5957
6546
  }), applyModuleDefaults(options.module, {
5958
- cache: !!options.cache,
5959
6547
  asyncWebAssembly: options.experiments.asyncWebAssembly,
5960
6548
  targetProperties,
5961
6549
  mode: options.mode,
5962
6550
  uniqueName: options.output.uniqueName,
5963
- deferImport: options.experiments.deferImport
6551
+ deferImport: options.experiments.deferImport,
6552
+ outputModule: options.output.module
5964
6553
  }), applyOutputDefaults(options, {
5965
6554
  context: options.context,
5966
6555
  targetProperties,
5967
6556
  isAffectedByBrowserslist: void 0 === target || 'string' == typeof target && target.startsWith('browserslist') || Array.isArray(target) && target.some((target)=>target.startsWith('browserslist')),
5968
- outputModule: options.experiments.outputModule,
5969
6557
  entry: options.entry
5970
6558
  }), applyExternalsPresetsDefaults(options.externalsPresets, {
5971
6559
  targetProperties,
@@ -5980,7 +6568,6 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
5980
6568
  }), F(options, 'performance', ()=>!!production && !!targetProperties && (!!targetProperties.browser || null === targetProperties.browser) && {}), applyPerformanceDefaults(options.performance, {
5981
6569
  production
5982
6570
  }), options.resolve = cleverMerge(getResolveDefaults({
5983
- context: options.context,
5984
6571
  targetProperties,
5985
6572
  mode: options.mode
5986
6573
  }), options.resolve), options.resolveLoader = cleverMerge(getResolveLoaderDefaults(), options.resolveLoader), !1 === targetProperties ? targetProperties : {
@@ -5996,16 +6583,19 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
5996
6583
  targets: targetProperties.targets
5997
6584
  };
5998
6585
  }, applyExperimentsDefaults = (experiments)=>{
5999
- D(experiments, 'futureDefaults', !1), D(experiments, 'asyncWebAssembly', !0), D(experiments, 'deferImport', !1), D(experiments, 'buildHttp', void 0), experiments.buildHttp && 'object' == typeof experiments.buildHttp && D(experiments.buildHttp, 'upgrade', !1), D(experiments, 'incremental', {}), 'object' == typeof experiments.incremental && (D(experiments.incremental, 'silent', !0), D(experiments.incremental, 'make', !0), D(experiments.incremental, 'inferAsyncModules', !0), D(experiments.incremental, 'providedExports', !0), D(experiments.incremental, 'dependenciesDiagnostics', !0), D(experiments.incremental, 'sideEffects', !0), D(experiments.incremental, 'buildChunkGraph', !1), D(experiments.incremental, 'moduleIds', !0), D(experiments.incremental, 'chunkIds', !0), D(experiments.incremental, 'modulesHashes', !0), D(experiments.incremental, 'modulesCodegen', !0), D(experiments.incremental, 'modulesRuntimeRequirements', !0), D(experiments.incremental, 'chunksRuntimeRequirements', !0), D(experiments.incremental, 'chunksHashes', !0), D(experiments.incremental, 'chunksRender', !0), D(experiments.incremental, 'emitAssets', !0)), D(experiments, 'useInputFileSystem', !1);
6586
+ D(experiments, 'futureDefaults', !1), D(experiments, 'asyncWebAssembly', !0), D(experiments, 'deferImport', !1), D(experiments, 'buildHttp', void 0), experiments.buildHttp && 'object' == typeof experiments.buildHttp && D(experiments.buildHttp, 'upgrade', !1), D(experiments, 'useInputFileSystem', !1), D(experiments, 'pureFunctions', !1);
6587
+ }, applyIncrementalDefaults = (options)=>{
6588
+ D(options, 'incremental', {}), 'object' == typeof options.incremental && (D(options.incremental, 'silent', !0), D(options.incremental, 'buildModuleGraph', !0), D(options.incremental, 'finishModules', !0), D(options.incremental, 'optimizeDependencies', !0), D(options.incremental, 'buildChunkGraph', !0), D(options.incremental, 'optimizeChunkModules', !0), D(options.incremental, 'moduleIds', !0), D(options.incremental, 'chunkIds', !0), D(options.incremental, 'modulesHashes', !0), D(options.incremental, 'modulesCodegen', !0), D(options.incremental, 'modulesRuntimeRequirements', !0), D(options.incremental, 'chunksRuntimeRequirements', !0), D(options.incremental, 'chunksHashes', !0), D(options.incremental, 'chunkAsset', !0), D(options.incremental, 'emitAssets', !0));
6000
6589
  }, applySnapshotDefaults = (_snapshot, _env)=>{}, applyCssGeneratorOptionsDefaults = (generatorOptions, { targetProperties })=>{
6001
6590
  D(generatorOptions, 'exportsOnly', !targetProperties || !1 === targetProperties.document), D(generatorOptions, 'esModule', !0);
6002
- }, applyModuleDefaults = (module, { cache, asyncWebAssembly, targetProperties, mode, uniqueName, deferImport })=>{
6003
- assertNotNill(module.parser), assertNotNill(module.generator), cache ? D(module, 'unsafeCache', /[\\/]node_modules[\\/]/) : D(module, 'unsafeCache', !1), F(module.parser, "asset", ()=>({})), assertNotNill(module.parser.asset), F(module.parser.asset, 'dataUrlCondition', ()=>({})), 'object' == typeof module.parser.asset.dataUrlCondition && D(module.parser.asset.dataUrlCondition, 'maxSize', 8096), F(module.parser, "javascript", ()=>({})), assertNotNill(module.parser.javascript), ((parserOptions, { deferImport })=>{
6004
- D(parserOptions, 'dynamicImportMode', 'lazy'), D(parserOptions, 'dynamicImportPrefetch', !1), D(parserOptions, 'dynamicImportPreload', !1), D(parserOptions, 'url', !0), D(parserOptions, 'exprContextCritical', !0), D(parserOptions, 'unknownContextCritical', !0), D(parserOptions, 'wrappedContextCritical', !1), D(parserOptions, 'wrappedContextRegExp', /.*/), D(parserOptions, 'strictExportPresence', !1), D(parserOptions, 'requireAsExpression', !1), D(parserOptions, 'requireAlias', !1), D(parserOptions, 'requireDynamic', !0), D(parserOptions, 'requireResolve', !0), D(parserOptions, 'commonjs', !0), D(parserOptions, 'importDynamic', !0), D(parserOptions, 'worker', [
6591
+ }, applyModuleDefaults = (module, { asyncWebAssembly, targetProperties, mode, uniqueName, deferImport, outputModule })=>{
6592
+ 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, outputModule })=>{
6593
+ 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', [
6005
6594
  '...'
6006
- ]), D(parserOptions, 'importMeta', !0), D(parserOptions, 'typeReexportsPresence', 'no-tolerant'), D(parserOptions, 'jsx', !1), D(parserOptions, 'deferImport', deferImport);
6595
+ ]), D(parserOptions, 'importMeta', !outputModule || 'preserve-unknown'), D(parserOptions, 'typeReexportsPresence', 'no-tolerant'), D(parserOptions, 'jsx', !1), D(parserOptions, 'deferImport', deferImport), D(parserOptions, 'importMetaResolve', !1);
6007
6596
  })(module.parser.javascript, {
6008
- deferImport
6597
+ deferImport,
6598
+ outputModule
6009
6599
  }), F(module.parser, "json", ()=>({})), assertNotNill(module.parser.json), D(module.parser.json, 'exportsDepth', 'development' === mode ? 1 : Number.MAX_SAFE_INTEGER), F(module.generator, 'json', ()=>({})), assertNotNill(module.generator.json), D(module.generator.json, 'JSONParse', !0), F(module.parser, 'css', ()=>({})), assertNotNill(module.parser.css), D(module.parser.css, 'namedExports', !0), D(module.parser.css, 'url', !0), F(module.parser, 'css/auto', ()=>({})), assertNotNill(module.parser['css/auto']), D(module.parser['css/auto'], 'namedExports', !0), D(module.parser['css/auto'], 'url', !0), F(module.parser, 'css/module', ()=>({})), assertNotNill(module.parser['css/module']), D(module.parser['css/module'], 'namedExports', !0), D(module.parser['css/module'], 'url', !0), F(module.generator, 'css', ()=>({})), assertNotNill(module.generator.css), applyCssGeneratorOptionsDefaults(module.generator.css, {
6010
6600
  targetProperties
6011
6601
  }), F(module.generator, 'css/auto', ()=>({})), assertNotNill(module.generator['css/auto']), applyCssGeneratorOptionsDefaults(module.generator['css/auto'], {
@@ -6032,7 +6622,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6032
6622
  type: "javascript/auto"
6033
6623
  },
6034
6624
  {
6035
- test: /\.json$/i,
6625
+ test: /\.json$/,
6036
6626
  type: 'json'
6037
6627
  },
6038
6628
  {
@@ -6040,22 +6630,22 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6040
6630
  type: 'json'
6041
6631
  },
6042
6632
  {
6043
- test: /\.mjs$/i,
6633
+ test: /\.mjs$/,
6044
6634
  ...esm
6045
6635
  },
6046
6636
  {
6047
- test: /\.js$/i,
6637
+ test: /\.js$/,
6048
6638
  descriptionData: {
6049
6639
  type: 'module'
6050
6640
  },
6051
6641
  ...esm
6052
6642
  },
6053
6643
  {
6054
- test: /\.cjs$/i,
6644
+ test: /\.cjs$/,
6055
6645
  ...commonjs
6056
6646
  },
6057
6647
  {
6058
- test: /\.js$/i,
6648
+ test: /\.js$/,
6059
6649
  descriptionData: {
6060
6650
  type: 'commonjs'
6061
6651
  },
@@ -6086,7 +6676,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6086
6676
  ]
6087
6677
  };
6088
6678
  rules.push({
6089
- test: /\.wasm$/i,
6679
+ test: /\.wasm$/,
6090
6680
  ...wasm
6091
6681
  }), rules.push({
6092
6682
  mimetype: 'application/wasm',
@@ -6121,7 +6711,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6121
6711
  type: 'asset/bytes'
6122
6712
  }), rules;
6123
6713
  });
6124
- }, applyOutputDefaults = (options, { context, outputModule, targetProperties: tp, isAffectedByBrowserslist, entry })=>{
6714
+ }, applyOutputDefaults = (options, { context, targetProperties: tp, isAffectedByBrowserslist, entry })=>{
6125
6715
  let { output } = options, getLibraryName = (library)=>{
6126
6716
  let libraryName = 'object' == typeof library && library && !Array.isArray(library) ? library.name : library;
6127
6717
  return Array.isArray(libraryName) ? libraryName.join('.') : 'object' == typeof libraryName ? getLibraryName(libraryName.root) : 'string' == typeof libraryName ? libraryName : '';
@@ -6139,7 +6729,23 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6139
6729
  if ('ENOENT' !== err.code) throw err.message += `\nwhile determining default 'output.uniqueName' from 'name' in ${pkgPath}`, err;
6140
6730
  return '';
6141
6731
  }
6142
- }), F(output, 'devtoolNamespace', ()=>output.uniqueName), F(output, 'module', ()=>!!outputModule);
6732
+ }), F(output, 'devtoolNamespace', ()=>output.uniqueName), output.library && F(output.library, 'type', ()=>output.module ? 'modern-module' : 'var');
6733
+ let forEachEntry = (fn)=>{
6734
+ if ('function' != typeof entry) for (let name of Object.keys(entry))fn(entry[name]);
6735
+ };
6736
+ A(output, 'enabledLibraryTypes', ()=>{
6737
+ let enabledLibraryTypes = [];
6738
+ return output.library && enabledLibraryTypes.push(output.library.type), forEachEntry((desc)=>{
6739
+ desc.library && enabledLibraryTypes.push(desc.library.type);
6740
+ }), enabledLibraryTypes.includes('modern-module') && function(options) {
6741
+ options.optimization.concatenateModules = !1, options.optimization.removeEmptyChunks = !1, options.output.chunkFormat = !1, options.output.module = !0, options.output.chunkLoading && 'import' !== options.output.chunkLoading && (options.output.chunkLoading = 'import'), void 0 === options.output.chunkLoading && (options.output.chunkLoading = 'import');
6742
+ let { splitChunks } = options.optimization;
6743
+ void 0 === splitChunks && (splitChunks = options.optimization.splitChunks = {}), !1 !== splitChunks && (splitChunks.chunks = 'all', splitChunks.minSize = 0, splitChunks.maxAsyncRequests = 1 / 0, splitChunks.maxInitialRequests = 1 / 0, splitChunks.cacheGroups ??= {}, splitChunks.cacheGroups.default = !1, splitChunks.cacheGroups.defaultVendors = !1);
6744
+ }(options), enabledLibraryTypes;
6745
+ }), D(output, 'module', [
6746
+ 'modern-module',
6747
+ 'module'
6748
+ ].some((ty)=>output.enabledLibraryTypes.includes(ty)));
6143
6749
  let environment = output.environment, conditionallyOptimistic = (v, c)=>void 0 === v && c || v;
6144
6750
  F(environment, 'globalThis', ()=>tp && tp.globalThis), F(environment, 'bigIntLiteral', ()=>{
6145
6751
  let v;
@@ -6189,7 +6795,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6189
6795
  return 'function' != typeof chunkFilename ? chunkFilename.replace(/\.[mc]?js(\?|$)/, '.css$1') : '[id].css';
6190
6796
  }), D(output, 'hotUpdateChunkFilename', `[id].[fullhash].hot-update.${output.module ? 'mjs' : 'js'}`), F(output, 'hotUpdateMainFilename', ()=>`[runtime].[fullhash].hot-update.${output.module ? 'json.mjs' : 'json'}`);
6191
6797
  let uniqueNameId = Template.toIdentifier(output.uniqueName);
6192
- F(output, 'hotUpdateGlobal', ()=>`rspackHotUpdate${uniqueNameId}`), F(output, 'chunkLoadingGlobal', ()=>`rspackChunk${uniqueNameId}`), D(output, 'assetModuleFilename', '[hash][ext][query]'), D(output, 'webassemblyModuleFilename', '[hash].module.wasm'), D(output, 'compareBeforeEmit', !0), F(output, 'path', ()=>node_path.join(process.cwd(), 'dist')), F(output, 'pathinfo', ()=>!1), D(output, 'publicPath', tp && (tp.document || tp.importScripts) ? 'auto' : ''), D(output, 'hashFunction', 'xxhash64'), D(output, 'hashDigest', 'hex'), D(output, 'hashDigestLength', 16), D(output, 'strictModuleErrorHandling', !1), output.library && F(output.library, 'type', ()=>output.module ? 'module' : 'var'), F(output, 'chunkFormat', ()=>{
6798
+ F(output, 'hotUpdateGlobal', ()=>`rspackHotUpdate${uniqueNameId}`), F(output, 'chunkLoadingGlobal', ()=>`rspackChunk${uniqueNameId}`), D(output, 'assetModuleFilename', '[hash][ext][query]'), D(output, 'webassemblyModuleFilename', '[hash].module.wasm'), D(output, 'compareBeforeEmit', !0), F(output, 'path', ()=>node_path.join(process.cwd(), 'dist')), F(output, 'pathinfo', ()=>!1), D(output, 'publicPath', tp && (tp.document || tp.importScripts) ? 'auto' : ''), D(output, 'hashFunction', 'xxhash64'), D(output, 'hashDigest', 'hex'), D(output, 'hashDigestLength', 16), D(output, 'strictModuleErrorHandling', !1), F(output, 'chunkFormat', ()=>{
6193
6799
  if (tp) {
6194
6800
  let helpMessage = isAffectedByBrowserslist ? "Make sure that your 'browserslist' includes only platforms that support these features or select an appropriate 'target' to allow selecting a chunk format by default. Alternatively specify the 'output.chunkFormat' directly." : "Select an appropriate 'target' to allow selecting one by default, or specify the 'output.chunkFormat' directly.";
6195
6801
  if (output.module) {
@@ -6251,16 +6857,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6251
6857
  return 'self';
6252
6858
  }), D(output, 'importFunctionName', 'import'), D(output, 'importMetaName', 'import.meta'), F(output, 'clean', ()=>!!output.clean), D(output, 'crossOriginLoading', !1), D(output, 'workerPublicPath', ''), D(output, 'sourceMapFilename', '[file].map[query]'), F(output, "scriptType", ()=>!!output.module && 'module'), D(output, 'chunkLoadTimeout', 120000);
6253
6859
  let { trustedTypes } = output;
6254
- trustedTypes && (F(trustedTypes, 'policyName', ()=>output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, '_') || 'webpack'), D(trustedTypes, 'onPolicyCreationFailure', 'stop'));
6255
- let forEachEntry = (fn)=>{
6256
- if ('function' != typeof entry) for (let name of Object.keys(entry))fn(entry[name]);
6257
- };
6258
- A(output, 'enabledLibraryTypes', ()=>{
6259
- let enabledLibraryTypes = [];
6260
- return output.library && enabledLibraryTypes.push(output.library.type), forEachEntry((desc)=>{
6261
- desc.library && enabledLibraryTypes.push(desc.library.type);
6262
- }), enabledLibraryTypes.includes('modern-module') && applyLimits(options), enabledLibraryTypes;
6263
- }), A(output, 'enabledChunkLoadingTypes', ()=>{
6860
+ trustedTypes && (F(trustedTypes, 'policyName', ()=>output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, '_') || 'rspack'), D(trustedTypes, 'onPolicyCreationFailure', 'stop')), A(output, 'enabledChunkLoadingTypes', ()=>{
6264
6861
  let enabledChunkLoadingTypes = new Set();
6265
6862
  return output.chunkLoading && enabledChunkLoadingTypes.add(output.chunkLoading), output.workerChunkLoading && enabledChunkLoadingTypes.add(output.workerChunkLoading), forEachEntry((desc)=>{
6266
6863
  desc.chunkLoading && enabledChunkLoadingTypes.add(desc.chunkLoading);
@@ -6270,7 +6867,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6270
6867
  return output.wasmLoading && enabledWasmLoadingTypes.add(output.wasmLoading), output.workerWasmLoading && enabledWasmLoadingTypes.add(output.workerWasmLoading), forEachEntry((desc)=>{
6271
6868
  desc.wasmLoading && enabledWasmLoadingTypes.add(desc.wasmLoading);
6272
6869
  }), Array.from(enabledWasmLoadingTypes);
6273
- }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.0-canary.20260120"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !output.library));
6870
+ }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.0-rc.2"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !1));
6274
6871
  }, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp, outputModule })=>{
6275
6872
  let isUniversal = (key)=>!!(outputModule && targetProperties && null === targetProperties[key]);
6276
6873
  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')));
@@ -6288,7 +6885,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6288
6885
  }, applyPerformanceDefaults = (performance, { production })=>{
6289
6886
  !1 !== performance && (D(performance, 'maxAssetSize', 250000), D(performance, 'maxEntrypointSize', 250000), F(performance, 'hints', ()=>!!production && 'warning'));
6290
6887
  }, applyOptimizationDefaults = (optimization, { production, development })=>{
6291
- D(optimization, 'removeAvailableModules', !0), D(optimization, 'removeEmptyChunks', !0), D(optimization, 'mergeDuplicateChunks', !0), F(optimization, 'moduleIds', ()=>production ? 'deterministic' : development ? 'named' : 'natural'), F(optimization, 'chunkIds', ()=>production ? 'deterministic' : development ? 'named' : 'natural'), F(optimization, 'sideEffects', ()=>!!production || 'flag'), D(optimization, 'mangleExports', production), D(optimization, 'inlineExports', production), D(optimization, 'providedExports', !0), D(optimization, 'usedExports', production), D(optimization, 'innerGraph', production), D(optimization, 'emitOnErrors', !production), D(optimization, 'runtimeChunk', !1), D(optimization, 'realContentHash', production), D(optimization, 'avoidEntryIife', !1), D(optimization, 'minimize', production), D(optimization, 'concatenateModules', production), A(optimization, 'minimizer', ()=>[
6888
+ D(optimization, 'removeEmptyChunks', !0), D(optimization, 'mergeDuplicateChunks', !0), F(optimization, 'moduleIds', ()=>production ? 'deterministic' : development ? 'named' : 'natural'), F(optimization, 'chunkIds', ()=>production ? 'deterministic' : development ? 'named' : 'natural'), F(optimization, 'sideEffects', ()=>!!production || 'flag'), D(optimization, 'mangleExports', production), D(optimization, 'inlineExports', production), D(optimization, 'providedExports', !0), D(optimization, 'usedExports', production), D(optimization, 'innerGraph', production), D(optimization, 'emitOnErrors', !production), D(optimization, 'runtimeChunk', !1), D(optimization, 'realContentHash', production), D(optimization, 'avoidEntryIife', !1), D(optimization, 'minimize', production), D(optimization, 'concatenateModules', production), A(optimization, 'minimizer', ()=>[
6292
6889
  new SwcJsMinimizerRspackPlugin(),
6293
6890
  new LightningCssMinimizerRspackPlugin()
6294
6891
  ]), F(optimization, 'nodeEnv', ()=>production ? 'production' : !!development && 'development');
@@ -6298,7 +6895,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6298
6895
  "javascript",
6299
6896
  'css',
6300
6897
  'unknown'
6301
- ]), D(splitChunks, 'hidePathInfo', production), D(splitChunks, 'chunks', 'async'), D(splitChunks, 'usedExports', !0 === optimization.usedExports), D(splitChunks, 'minChunks', 1), F(splitChunks, 'minSize', ()=>production ? 20000 : 10000), F(splitChunks, 'maxAsyncRequests', ()=>production ? 30 : 1 / 0), F(splitChunks, 'maxInitialRequests', ()=>production ? 30 : 1 / 0), D(splitChunks, 'automaticNameDelimiter', '-');
6898
+ ]), 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', '-');
6302
6899
  let { cacheGroups } = splitChunks;
6303
6900
  cacheGroups && (F(cacheGroups, 'default', ()=>({
6304
6901
  idHint: '',
@@ -6308,7 +6905,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6308
6905
  })), F(cacheGroups, 'defaultVendors', ()=>({
6309
6906
  idHint: 'vendors',
6310
6907
  reuseExistingChunk: !0,
6311
- test: /[\\/]node_modules[\\/]/i,
6908
+ test: /[\\/]node_modules[\\/]/,
6312
6909
  priority: -10
6313
6910
  })));
6314
6911
  }
@@ -6331,15 +6928,14 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6331
6928
  mainFiles: [
6332
6929
  'index'
6333
6930
  ]
6334
- }), getResolveDefaults = ({ context, targetProperties, mode })=>{
6931
+ }), getResolveDefaults = ({ targetProperties, mode })=>{
6335
6932
  let conditions = [
6336
6933
  'webpack'
6337
6934
  ];
6338
6935
  conditions.push('development' === mode ? 'development' : 'production'), targetProperties && (targetProperties.webworker && conditions.push('worker'), targetProperties.node && conditions.push('node'), targetProperties.web && conditions.push('browser'), targetProperties.electron && conditions.push('electron'), targetProperties.nwjs && conditions.push('nwjs'));
6339
6936
  let jsExtensions = [
6340
6937
  '.js',
6341
- '.json',
6342
- '.wasm'
6938
+ '.json'
6343
6939
  ], browserField = targetProperties && targetProperties.web && (!targetProperties.node || targetProperties.electron && targetProperties.electronRenderer), aliasFields = browserField ? [
6344
6940
  'browser'
6345
6941
  ] : [], mainFields = browserField ? [
@@ -6385,9 +6981,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6385
6981
  exportsFields: [
6386
6982
  'exports'
6387
6983
  ],
6388
- roots: [
6389
- context
6390
- ],
6984
+ roots: [],
6391
6985
  mainFields: [
6392
6986
  'main'
6393
6987
  ],
@@ -6410,14 +7004,17 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6410
7004
  loader: cjsDeps(),
6411
7005
  unknown: cjsDeps()
6412
7006
  }
6413
- }, styleConditions = [];
6414
- return styleConditions.push('webpack'), styleConditions.push('development' === mode ? 'development' : 'production'), styleConditions.push('style'), resolveOptions.byDependency['css-import'] = {
7007
+ };
7008
+ return resolveOptions.byDependency['css-import'] = {
6415
7009
  mainFiles: [],
6416
7010
  mainFields: [
6417
7011
  'style',
6418
7012
  '...'
6419
7013
  ],
6420
- conditionNames: styleConditions,
7014
+ conditionNames: [
7015
+ 'development' === mode ? 'development' : 'production',
7016
+ 'style'
7017
+ ],
6421
7018
  extensions: [
6422
7019
  '.css'
6423
7020
  ],
@@ -6551,8 +7148,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6551
7148
  ]),
6552
7149
  rules: nestedArray(module.rules, (r)=>[
6553
7150
  ...r
6554
- ]),
6555
- unsafeCache: module.unsafeCache
7151
+ ])
6556
7152
  })),
6557
7153
  target: config.target,
6558
7154
  externals: config.externals,
@@ -6588,7 +7184,9 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6588
7184
  storage: {
6589
7185
  type: 'filesystem',
6590
7186
  directory: node_path.resolve(config.context || process.cwd(), cache.storage?.directory || 'node_modules/.cache/rspack')
6591
- }
7187
+ },
7188
+ portable: cache.portable,
7189
+ readonly: cache.readonly
6592
7190
  };
6593
7191
  }),
6594
7192
  stats: nestedConfig(config.stats, (stats)=>!1 === stats ? {
@@ -6619,7 +7217,6 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6619
7217
  ]),
6620
7218
  experiments: nestedConfig(config.experiments, (experiments)=>({
6621
7219
  ...experiments,
6622
- incremental: optionalNestedConfig(experiments.incremental, (options)=>getNormalizedIncrementalOptions(options)),
6623
7220
  buildHttp: experiments.buildHttp,
6624
7221
  useInputFileSystem: experiments.useInputFileSystem
6625
7222
  })),
@@ -6628,7 +7225,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6628
7225
  devServer: config.devServer,
6629
7226
  amd: config.amd,
6630
7227
  bail: config.bail,
6631
- lazyCompilation: optionalNestedConfig(config.lazyCompilation, (options)=>!0 === options ? {} : options)
7228
+ lazyCompilation: optionalNestedConfig(config.lazyCompilation, (options)=>!0 === options ? {} : options),
7229
+ incremental: optionalNestedConfig(config.incremental, (options)=>getNormalizedIncrementalOptions(options))
6632
7230
  };
6633
7231
  }, getNormalizedEntryStatic = (entry)=>{
6634
7232
  if ('string' == typeof entry) return {
@@ -6685,12 +7283,11 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6685
7283
  }
6686
7284
  }, getNormalizedIncrementalOptions = (incremental)=>!1 !== incremental && 'none' !== incremental && ('safe' === incremental ? {
6687
7285
  silent: !0,
6688
- make: !0,
6689
- inferAsyncModules: !1,
6690
- providedExports: !1,
6691
- dependenciesDiagnostics: !1,
6692
- sideEffects: !1,
6693
- buildChunkGraph: !1,
7286
+ buildModuleGraph: !0,
7287
+ finishModules: !1,
7288
+ optimizeDependencies: !1,
7289
+ buildChunkGraph: !0,
7290
+ optimizeChunkModules: !1,
6694
7291
  moduleIds: !1,
6695
7292
  chunkIds: !1,
6696
7293
  modulesHashes: !1,
@@ -6698,7 +7295,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6698
7295
  modulesRuntimeRequirements: !1,
6699
7296
  chunksRuntimeRequirements: !1,
6700
7297
  chunksHashes: !1,
6701
- chunksRender: !1,
7298
+ chunkAsset: !1,
6702
7299
  emitAssets: !0
6703
7300
  } : !0 === incremental || 'advance-silent' === incremental ? {} : 'advance' === incremental ? {
6704
7301
  silent: !1
@@ -7524,7 +8121,7 @@ class MultiStats {
7524
8121
  obj.children = this.stats.map((stat, idx)=>{
7525
8122
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
7526
8123
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
7527
- }), childOptions.version && (obj.rspackVersion = "2.0.0-canary.20260120", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
8124
+ }), childOptions.version && (obj.rspackVersion = "2.0.0-rc.2", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
7528
8125
  let mapError = (j, obj)=>({
7529
8126
  ...obj,
7530
8127
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -7599,7 +8196,19 @@ let asyncLib_each = function(collection, iterator, originalCallback) {
7599
8196
  for (let watching of this.watchings)watching.resume();
7600
8197
  }
7601
8198
  };
7602
- ArrayQueue_computedKey = Symbol.iterator;
8199
+ function ArrayQueue_type_of(obj) {
8200
+ return obj && "u" > typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
8201
+ }
8202
+ key = function(input, hint) {
8203
+ if ("object" !== ArrayQueue_type_of(input) || null === input) return input;
8204
+ var prim = input[Symbol.toPrimitive];
8205
+ if (void 0 !== prim) {
8206
+ var res = prim.call(input, hint || "default");
8207
+ if ("object" !== ArrayQueue_type_of(res)) return res;
8208
+ throw TypeError("@@toPrimitive must return a primitive value.");
8209
+ }
8210
+ return ("string" === hint ? String : Number)(input);
8211
+ }(Symbol.iterator, "string"), ArrayQueue_computedKey = "symbol" === ArrayQueue_type_of(key) ? key : String(key);
7603
8212
  let util_ArrayQueue = class {
7604
8213
  _list;
7605
8214
  _listReversed;
@@ -8021,7 +8630,7 @@ let arraySum = (array)=>{
8021
8630
  let str = `${a}`, length = lengths[i];
8022
8631
  return str.length === length ? str : length > 5 ? `...${str.slice(-length + 3)}` : length > 0 ? str.slice(-length) : '';
8023
8632
  });
8024
- }, CachedInputFileSystem = __webpack_require__("../../node_modules/.pnpm/enhanced-resolve@5.18.4/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js");
8633
+ }, CachedInputFileSystem = __webpack_require__("../../node_modules/.pnpm/enhanced-resolve@5.20.1/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js");
8025
8634
  var CachedInputFileSystem_default = __webpack_require__.n(CachedInputFileSystem);
8026
8635
  class NodeEnvironmentPlugin {
8027
8636
  options;
@@ -8123,7 +8732,7 @@ class NodeEnvironmentPlugin {
8123
8732
  if ('' === str) return str;
8124
8733
  let prefixWithIndent = currentIndent + prefix;
8125
8734
  return colors ? prefixWithIndent + colorPrefix + str.replace(/\n/g, `${colorSuffix}\n${prefix}${colorPrefix}`) + colorSuffix : prefixWithIndent + str.replace(/\n/g, `\n${prefix}`);
8126
- })(external_node_util_format(...args), prefix, colorPrefix, colorSuffix);
8735
+ })(__rspack_external_node_util_1b29d436.format(...args), prefix, colorPrefix, colorSuffix);
8127
8736
  stream.write(`${str}\n`), writeStatusMessage();
8128
8737
  }, writeGroupMessage = writeColored('<-> ', '\u001b[1m\u001b[36m', '\u001b[39m\u001b[22m'), writeGroupCollapsedMessage = writeColored('<+> ', '\u001b[1m\u001b[36m', '\u001b[39m\u001b[22m');
8129
8738
  return {
@@ -8680,15 +9289,21 @@ let iterateConfig = (config, options, fn)=>{
8680
9289
  if (context.makePathsRelative || (context.makePathsRelative = makePathsRelative.bindContextCache(compilation.compiler.context, compilation.compiler.root)), !context.cachedGetErrors) {
8681
9290
  let map = new WeakMap();
8682
9291
  context.cachedGetErrors = (compilation)=>{
8683
- var errors;
8684
- return map.get(compilation) || (errors = statsCompilation.errors, map.set(compilation, errors), errors);
9292
+ if (compilation.compiler._lastCompilation !== compilation) return [];
9293
+ let cache = map.get(compilation);
9294
+ if (cache) return cache;
9295
+ let errors = statsCompilation.errors;
9296
+ return map.set(compilation, errors), errors;
8685
9297
  };
8686
9298
  }
8687
9299
  if (!context.cachedGetWarnings) {
8688
9300
  let map = new WeakMap();
8689
9301
  context.cachedGetWarnings = (compilation)=>{
8690
- var warnings;
8691
- return map.get(compilation) || (warnings = compilation.__internal_getInner().createStatsWarnings(compilation.getWarnings(), !!options.colors), map.set(compilation, warnings), warnings);
9302
+ if (compilation.compiler._lastCompilation !== compilation) return [];
9303
+ let cache = map.get(compilation);
9304
+ if (cache) return cache;
9305
+ let warnings = compilation.__internal_getInner().createStatsWarnings(compilation.getWarnings(), !!options.colors);
9306
+ return map.set(compilation, warnings), warnings;
8692
9307
  };
8693
9308
  }
8694
9309
  compilation.name && (object.name = compilation.name);
@@ -8756,7 +9371,7 @@ let iterateConfig = (config, options, fn)=>{
8756
9371
  let [label, first, second] = entry.args;
8757
9372
  'number' == typeof first && 'number' == typeof second && (message = `${label}: ${1000 * first + second / 1000000} ms`);
8758
9373
  }
8759
- message || (message = entry.args?.length ? external_node_util_format(entry.args[0], ...entry.args.slice(1)) : '');
9374
+ message || (message = entry.args?.length ? __rspack_external_node_util_1b29d436.format(entry.args[0], ...entry.args.slice(1)) : '');
8760
9375
  let newEntry = {
8761
9376
  type,
8762
9377
  message: message || '',
@@ -8777,7 +9392,7 @@ let iterateConfig = (config, options, fn)=>{
8777
9392
  object.hash = context.getStatsCompilation(compilation).hash;
8778
9393
  },
8779
9394
  version: (object)=>{
8780
- object.version = "5.75.0", object.rspackVersion = "2.0.0-canary.20260120";
9395
+ object.version = "5.75.0", object.rspackVersion = "2.0.0-rc.2";
8781
9396
  },
8782
9397
  env: (object, _compilation, _context, { _env })=>{
8783
9398
  object.env = _env;
@@ -9249,7 +9864,7 @@ let applyDefaults = (options, defaults)=>{
9249
9864
  chunksSort: ()=>!1,
9250
9865
  assetsSort: ()=>'!size',
9251
9866
  outputPath: OFF_FOR_TO_STRING,
9252
- colors: ()=>!1
9867
+ colors: ()=>isStatsColorSupported()
9253
9868
  }, normalizeFilter = (item)=>{
9254
9869
  if ('string' == typeof item) {
9255
9870
  let regExp = RegExp(`[\\\\/]${item.replace(/[-[\]{}()*+?.\\^$|]/g, '\\$&')}([\\\\/]|$|!|\\?)`);
@@ -10039,18 +10654,13 @@ class RspackOptionsApply {
10039
10654
  moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
10040
10655
  namespace: options.output.devtoolNamespace
10041
10656
  }).apply(compiler);
10042
- if (new JavascriptModulesPlugin().apply(compiler), new URLPlugin().apply(compiler), new JsonModulesPlugin().apply(compiler), new AssetModulesPlugin().apply(compiler), options.experiments.asyncWebAssembly && new AsyncWebAssemblyModulesPlugin().apply(compiler), new CssModulesPlugin().apply(compiler), new lib_EntryOptionPlugin().apply(compiler), assertNotNill(options.context), compiler.hooks.entryOption.call(options.context, options.entry), new RuntimePlugin().apply(compiler), options.output.bundlerInfo && new BundlerInfoRspackPlugin(options.output.bundlerInfo).apply(compiler), new InferAsyncModulesPlugin().apply(compiler), new APIPlugin().apply(compiler), new DataUriPlugin().apply(compiler), new FileUriPlugin().apply(compiler), options.experiments.buildHttp && new HttpUriPlugin(options.experiments.buildHttp).apply(compiler), new EnsureChunkConditionsPlugin().apply(compiler), options.optimization.mergeDuplicateChunks && new MergeDuplicateChunksPlugin().apply(compiler), options.optimization.sideEffects && new SideEffectsFlagPlugin().apply(compiler), options.optimization.providedExports && new FlagDependencyExportsPlugin().apply(compiler), options.optimization.usedExports && new FlagDependencyUsagePlugin('global' === options.optimization.usedExports).apply(compiler), options.optimization.concatenateModules && new ModuleConcatenationPlugin().apply(compiler), options.optimization.inlineExports && new InlineExportsPlugin().apply(compiler), options.optimization.mangleExports && new MangleExportsPlugin('size' !== options.optimization.mangleExports).apply(compiler), options.output.enabledLibraryTypes && options.output.enabledLibraryTypes.length > 0) {
10043
- let modernModuleCount = 0;
10044
- for (let type of options.output.enabledLibraryTypes)'modern-module' === type && modernModuleCount++;
10045
- if (options.output.library?.preserveModules && modernModuleCount > 0) throw Error('preserveModules only works for `modern-module` library type');
10046
- if (modernModuleCount > 0) {
10047
- if (modernModuleCount !== options.output.enabledLibraryTypes.length) throw Error('`modern-module` cannot used together with other library types');
10048
- new EsmLibraryPlugin({
10049
- preserveModules: options.output.library?.preserveModules
10050
- }).apply(compiler);
10051
- } else for (let type of options.output.enabledLibraryTypes)new EnableLibraryPlugin(type).apply(compiler);
10657
+ 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).apply(compiler), options.optimization.providedExports && new FlagDependencyExportsPlugin().apply(compiler), options.optimization.usedExports && new FlagDependencyUsagePlugin('global' === options.optimization.usedExports).apply(compiler), options.optimization.concatenateModules && new ModuleConcatenationPlugin().apply(compiler), options.optimization.inlineExports && new InlineExportsPlugin().apply(compiler), options.optimization.mangleExports && new MangleExportsPlugin('size' !== options.optimization.mangleExports).apply(compiler);
10658
+ let enableLibSplitChunks = !1;
10659
+ if (options.output.enabledLibraryTypes && options.output.enabledLibraryTypes.length > 0) {
10660
+ let hasModernModule = options.output.enabledLibraryTypes.includes('modern-module'), hasNonModernModule = options.output.enabledLibraryTypes.some((t)=>'modern-module' !== t);
10661
+ for (let type of (options.output.library?.preserveModules && !hasModernModule && compiler.getInfrastructureLogger('rspack.RspackOptionsApply').warn('`preserveModules` only works for `modern-module` library type and will be ignored for other library types.'), hasModernModule && hasNonModernModule && compiler.getInfrastructureLogger('rspack.RspackOptionsApply').warn('`modern-module` is used together with other library types. ESM format has impact on chunkLoading and chunkFormat, which may not be compatible with other library types.'), options.output.enabledLibraryTypes))'modern-module' === type && (enableLibSplitChunks = !0), new EnableLibraryPlugin(type).apply(compiler);
10052
10662
  }
10053
- options.optimization.splitChunks && new SplitChunksPlugin(options.optimization.splitChunks).apply(compiler), options.optimization.removeEmptyChunks && new RemoveEmptyChunksPlugin().apply(compiler), options.optimization.realContentHash && new RealContentHashPlugin().apply(compiler);
10663
+ !enableLibSplitChunks && options.optimization.splitChunks && new SplitChunksPlugin(options.optimization.splitChunks).apply(compiler), options.optimization.removeEmptyChunks && new RemoveEmptyChunksPlugin().apply(compiler), options.optimization.realContentHash && new RealContentHashPlugin().apply(compiler);
10054
10664
  let moduleIds = options.optimization.moduleIds;
10055
10665
  if (moduleIds) switch(moduleIds){
10056
10666
  case 'named':
@@ -10062,6 +10672,9 @@ class RspackOptionsApply {
10062
10672
  case 'deterministic':
10063
10673
  new DeterministicModuleIdsPlugin().apply(compiler);
10064
10674
  break;
10675
+ case 'hashed':
10676
+ new HashedModuleIdsPlugin().apply(compiler);
10677
+ break;
10065
10678
  default:
10066
10679
  throw Error(`moduleIds: ${moduleIds} is not implemented`);
10067
10680
  }
@@ -10142,7 +10755,7 @@ function createCompiler(userOptions) {
10142
10755
  function isMultiRspackOptions(o) {
10143
10756
  return Array.isArray(o);
10144
10757
  }
10145
- function rspack(options, callback) {
10758
+ function rspack_rspack(options, callback) {
10146
10759
  try {
10147
10760
  if (isMultiRspackOptions(options)) for (let option of options)validateRspackConfig(option);
10148
10761
  else validateRspackConfig(options);
@@ -10181,8 +10794,9 @@ function rspack(options, callback) {
10181
10794
  return process.nextTick(()=>callback(err)), null;
10182
10795
  }
10183
10796
  {
10797
+ var message;
10184
10798
  let { compiler, watch } = create();
10185
- return watch && deprecate("A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback."), compiler;
10799
+ return watch && (message = "A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.", warnedMessages.has(message) || (warnedMessages.add(message), console.warn(`[Rspack Deprecation] ${message}`))), compiler;
10186
10800
  }
10187
10801
  }
10188
10802
  class CodeGenerationResult {
@@ -10438,7 +11052,7 @@ class TraceHookPlugin {
10438
11052
  });
10439
11053
  }
10440
11054
  }
10441
- let CORE_VERSION = "2.0.0-canary.20260120", VFILES_BY_COMPILER = new WeakMap();
11055
+ let CORE_VERSION = "2.0.0-rc.2", VFILES_BY_COMPILER = new WeakMap();
10442
11056
  class VirtualModulesPlugin {
10443
11057
  #staticModules;
10444
11058
  #compiler;
@@ -10583,22 +11197,23 @@ class Watching {
10583
11197
  let startTime = this.startTime;
10584
11198
  this.startTime = void 0, compilation.startTime = startTime, compilation.endTime = Date.now();
10585
11199
  let cbs = this.callbacks;
10586
- this.callbacks = [];
10587
- let fileDependencies = new Set([
10588
- ...compilation.fileDependencies
10589
- ]);
10590
- fileDependencies.added = new Set(compilation.__internal__addedFileDependencies), fileDependencies.removed = new Set(compilation.__internal__removedFileDependencies);
10591
- let contextDependencies = new Set([
10592
- ...compilation.contextDependencies
10593
- ]);
10594
- contextDependencies.added = new Set(compilation.__internal__addedContextDependencies), contextDependencies.removed = new Set(compilation.__internal__removedContextDependencies);
10595
- let missingDependencies = new Set([
10596
- ...compilation.missingDependencies
10597
- ]);
10598
- missingDependencies.added = new Set(compilation.__internal__addedMissingDependencies), missingDependencies.removed = new Set(compilation.__internal__removedMissingDependencies), this.compiler.hooks.done.callAsync(stats, (err)=>{
11200
+ this.callbacks = [], this.compiler.hooks.done.callAsync(stats, (err)=>{
10599
11201
  if (err) return handleError(err, cbs);
10600
11202
  for (let cb of (this.handler(null, stats), process.nextTick(()=>{
10601
- this.#closed || this.watch(fileDependencies, contextDependencies, missingDependencies);
11203
+ if (!this.#closed) {
11204
+ let fileDependencies = new Set([
11205
+ ...compilation.fileDependencies
11206
+ ]);
11207
+ fileDependencies.added = new Set(compilation.__internal__addedFileDependencies), fileDependencies.removed = new Set(compilation.__internal__removedFileDependencies);
11208
+ let contextDependencies = new Set([
11209
+ ...compilation.contextDependencies
11210
+ ]);
11211
+ contextDependencies.added = new Set(compilation.__internal__addedContextDependencies), contextDependencies.removed = new Set(compilation.__internal__removedContextDependencies);
11212
+ let missingDependencies = new Set([
11213
+ ...compilation.missingDependencies
11214
+ ]);
11215
+ missingDependencies.added = new Set(compilation.__internal__addedMissingDependencies), missingDependencies.removed = new Set(compilation.__internal__removedMissingDependencies), this.watch(fileDependencies, contextDependencies, missingDependencies);
11216
+ }
10602
11217
  }), cbs))cb(null);
10603
11218
  this.compiler.hooks.afterDone.call(stats);
10604
11219
  });
@@ -10618,7 +11233,7 @@ class Watching {
10618
11233
  this.suspended && (this.suspended = !1, this.#invalidate());
10619
11234
  }
10620
11235
  }
10621
- let Compiler_require = createRequire(import.meta.url);
11236
+ let Compiler_require = createRequire(import.meta.url), GET_COMPILER_ID = Symbol('getCompilerId');
10622
11237
  class Compiler {
10623
11238
  #instance;
10624
11239
  #initial;
@@ -10749,8 +11364,19 @@ class Compiler {
10749
11364
  ]),
10750
11365
  additionalPass: new AsyncSeriesHook([])
10751
11366
  };
11367
+ let availableCompilerHooks = Object.keys(this.hooks);
11368
+ this.hooks = new Proxy(this.hooks, {
11369
+ get (target, prop, receiver) {
11370
+ let value = Reflect.get(target, prop, receiver);
11371
+ if (void 0 === value && 'string' == typeof prop) {
11372
+ let hooksList = availableCompilerHooks.join(', ');
11373
+ throw Error(`Compiler.hooks.${prop} is not supported in rspack. This typically happens when using webpack plugins that rely on webpack-specific hooks. Consider using an rspack-compatible alternative or removing the incompatible plugin.\n\nAvailable compiler hooks: ${hooksList}`);
11374
+ }
11375
+ return value;
11376
+ }
11377
+ });
10752
11378
  let compilerRspack = Object.assign(function(...params) {
10753
- return rspack(...params);
11379
+ return rspack_rspack(...params);
10754
11380
  }, exports_namespaceObject, {
10755
11381
  RuntimeGlobals: createCompilerRuntimeGlobals(options)
10756
11382
  });
@@ -10763,7 +11389,12 @@ class Compiler {
10763
11389
  electron: null
10764
11390
  }, this.#target = {}, this.__internal_browser_require = ()=>{
10765
11391
  throw Error('Cannot execute user defined code in browser without `BrowserRequirePlugin`');
10766
- }, this.resolverFactory = new ResolverFactory(options.resolve.pnp ?? getPnpDefault(), options.resolve, options.resolveLoader), new JsLoaderRspackPlugin(this).apply(this), new ExecuteModulePlugin().apply(this), new TraceHookPlugin().apply(this);
11392
+ }, this.resolverFactory = new ResolverFactory(options.resolve.pnp ?? getPnpDefault(), options.resolve, options.resolveLoader), new JsLoaderRspackPlugin(this).apply(this), new ExecuteModulePlugin().apply(this), 'on' === JavaScriptTracer.state && new TraceHookPlugin().apply(this), Object.defineProperty(this, GET_COMPILER_ID, {
11393
+ writable: !1,
11394
+ configurable: !1,
11395
+ enumerable: !1,
11396
+ value: ()=>this.#instance.getCompilerId()
11397
+ });
10767
11398
  }
10768
11399
  get recordsInputPath() {
10769
11400
  return unsupported('Compiler.recordsInputPath');
@@ -10922,7 +11553,8 @@ class Compiler {
10922
11553
  }) : this.hooks.shutdown.callAsync((err)=>{
10923
11554
  if (err) return callback(err);
10924
11555
  this.cache.shutdown(()=>{
10925
- this.#instance?.close(), callback();
11556
+ let closePromise = this.#instance?.close();
11557
+ closePromise ? closePromise.then(()=>callback(), callback) : callback();
10926
11558
  });
10927
11559
  });
10928
11560
  }
@@ -10963,7 +11595,7 @@ class Compiler {
10963
11595
  }
10964
11596
  #getInstance(callback) {
10965
11597
  var output;
10966
- let coreVersion, expectedCoreVersion, mode, experiments, 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.
11598
+ let coreVersion, expectedCoreVersion, statsOptions, mode, experiments, 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.
10967
11599
 
10968
11600
  Help:
10969
11601
  Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
@@ -11024,8 +11656,7 @@ Help:
11024
11656
  k,
11025
11657
  getRawGeneratorOptions(v, k)
11026
11658
  ]).filter(([_, v])=>void 0 !== v)),
11027
- noParse: module.noParse,
11028
- unsafeCache: module.unsafeCache
11659
+ noParse: module.noParse
11029
11660
  };
11030
11661
  }(options.module, {
11031
11662
  compiler: this,
@@ -11035,7 +11666,7 @@ Help:
11035
11666
  }),
11036
11667
  optimization: options.optimization,
11037
11668
  stats: {
11038
- colors: !!function(options) {
11669
+ colors: void 0 === (statsOptions = function(options) {
11039
11670
  if ('boolean' == typeof options || 'string' == typeof options) return presetToOptions(options);
11040
11671
  if (!options) return {};
11041
11672
  let obj = {
@@ -11043,10 +11674,11 @@ Help:
11043
11674
  ...options
11044
11675
  };
11045
11676
  return delete obj.preset, obj;
11046
- }(options.stats).colors
11677
+ }(options.stats)).colors ? isStatsColorSupported() : !!statsOptions.colors
11047
11678
  },
11048
11679
  cache: options.cache || !1,
11049
11680
  experiments,
11681
+ incremental: options.incremental,
11050
11682
  node: function(node) {
11051
11683
  if (!1 !== node) {
11052
11684
  if (isNil(node.__dirname) || isNil(node.global) || isNil(node.__filename)) throw Error('node.__dirname, node.global, node.__filename should not be nil');
@@ -11306,6 +11938,26 @@ Help:
11306
11938
  return queried.promise(getCompiler().__internal__get_compilation().chunks, getCompiler().__internal__get_compilation().modules);
11307
11939
  };
11308
11940
  }),
11941
+ registerCompilationBeforeModuleIdsTaps: createTap(binding_default().RegisterJsTapKind.CompilationBeforeModuleIds, function() {
11942
+ return getCompiler().__internal__get_compilation().hooks.beforeModuleIds;
11943
+ }, function(queried) {
11944
+ return function(arg) {
11945
+ let compilation = getCompiler().__internal__get_compilation(), assignments = new Map(), modulesByIdentifier = new Map();
11946
+ for (let module of compilation.modules)modulesByIdentifier.set(module.identifier(), module);
11947
+ let proxiedModules = arg.modules.map((m)=>new Proxy(modulesByIdentifier.get(m.identifier), {
11948
+ get (target, prop) {
11949
+ if ('id' === prop) return assignments.get(m.identifier) ?? null;
11950
+ if ('identifier' === prop) return m.identifier;
11951
+ let value = Reflect.get(target, prop);
11952
+ return 'function' == typeof value ? value.bind(target) : value;
11953
+ },
11954
+ set: (_target, prop, value)=>'id' === prop && ('string' == typeof value || 'number' == typeof value) && (assignments.set(m.identifier, value), !0)
11955
+ }));
11956
+ return queried.call(proxiedModules), {
11957
+ assignments: Object.fromEntries(assignments.entries())
11958
+ };
11959
+ };
11960
+ }),
11309
11961
  registerCompilationChunkHashTaps: createTap(binding_default().RegisterJsTapKind.CompilationChunkHash, function() {
11310
11962
  return getCompiler().__internal__get_compilation().hooks.chunkHash;
11311
11963
  }, function(queried) {
@@ -11728,6 +12380,17 @@ Object.defineProperty(binding_default().ConcatenatedModule.prototype, 'identifie
11728
12380
  return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
11729
12381
  }
11730
12382
  });
12383
+ let ModuleGraphConnection = binding_namespaceObject.ModuleGraphConnection;
12384
+ Object.defineProperties(ModuleGraphConnection, {
12385
+ TRANSITIVE_ONLY: {
12386
+ value: binding_default().TRANSITIVE_ONLY_SYMBOL,
12387
+ enumerable: !0
12388
+ },
12389
+ CIRCULAR_CONNECTION: {
12390
+ value: binding_default().CIRCULAR_CONNECTION_SYMBOL,
12391
+ enumerable: !0
12392
+ }
12393
+ });
11731
12394
  let asRegExp = (test)=>'string' == typeof test ? RegExp(`^${test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')}`) : test, matchPart = (str, test)=>!test || (Array.isArray(test) ? test.map(asRegExp).some((regExp)=>regExp.test(str)) : asRegExp(test).test(str)), matchObject = (obj, str)=>!(obj.test && !matchPart(str, obj.test) || obj.include && !matchPart(str, obj.include) || obj.exclude && matchPart(str, obj.exclude)), FlagAllModulesAsUsedPlugin = base_create(binding_namespaceObject.BuiltinPluginName.FlagAllModulesAsUsedPlugin, (explanation)=>({
11732
12395
  explanation
11733
12396
  }));
@@ -11848,68 +12511,7 @@ class LoaderTargetPlugin {
11848
12511
  });
11849
12512
  }
11850
12513
  }
11851
- let VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
11852
- function isRequiredVersion(str) {
11853
- return VERSION_PATTERN_REGEXP.test(str);
11854
- }
11855
- let MANIFEST_FILE_NAME = 'mf-manifest.json', STATS_FILE_NAME = 'mf-stats.json', JSON_EXT = '.json';
11856
- function isPlainObject(value) {
11857
- return !!value && 'object' == typeof value && !Array.isArray(value);
11858
- }
11859
- class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
11860
- name = binding_namespaceObject.BuiltinPluginName.ModuleFederationManifestPlugin;
11861
- opts;
11862
- constructor(opts){
11863
- super(), this.opts = opts;
11864
- }
11865
- raw(compiler) {
11866
- var isDev;
11867
- let pkg, buildVersion, { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts, { statsFileName, manifestFileName } = function(manifestOptions) {
11868
- if (!manifestOptions) return {
11869
- statsFileName: STATS_FILE_NAME,
11870
- manifestFileName: MANIFEST_FILE_NAME
11871
- };
11872
- let filePath = 'boolean' == typeof manifestOptions ? '' : manifestOptions.filePath || '', fileName = 'boolean' == typeof manifestOptions ? '' : manifestOptions.fileName || '', manifestFileName = fileName ? fileName.endsWith(JSON_EXT) ? fileName : `${fileName}${JSON_EXT}` : MANIFEST_FILE_NAME;
11873
- return {
11874
- statsFileName: join(filePath, fileName ? manifestFileName.replace(JSON_EXT, `-stats${JSON_EXT}`) : STATS_FILE_NAME),
11875
- manifestFileName: join(filePath, manifestFileName)
11876
- };
11877
- }(this.opts), rawOptions = {
11878
- name: this.opts.name,
11879
- globalName: this.opts.globalName,
11880
- fileName,
11881
- filePath,
11882
- manifestFileName,
11883
- statsFileName,
11884
- disableAssetsAnalyze,
11885
- remoteAliasMap,
11886
- exposes,
11887
- shared,
11888
- buildInfo: (isDev = 'development' === compiler.options.mode, pkg = function(root) {
11889
- let pkgPath = join(root ? external_node_path_resolve(root) : process.cwd(), 'package.json');
11890
- try {
11891
- let content = readFileSync(pkgPath, 'utf-8'), parsed = function(input, guard) {
11892
- try {
11893
- let parsed = JSON.parse(input);
11894
- if (guard(parsed)) return parsed;
11895
- } catch {}
11896
- }(content, isPlainObject);
11897
- if (parsed) {
11898
- let filtered = {};
11899
- for (let [key, value] of Object.entries(parsed))'string' == typeof value && (filtered[key] = value);
11900
- if (Object.keys(filtered).length > 0) return filtered;
11901
- }
11902
- } catch {}
11903
- return {};
11904
- }(compiler.context || process.cwd()), buildVersion = isDev ? 'local' : pkg?.version, {
11905
- buildVersion: process.env.MF_BUILD_VERSION || buildVersion || 'UNKNOWN',
11906
- buildName: process.env.MF_BUILD_NAME || pkg?.name || 'UNKNOWN'
11907
- })
11908
- };
11909
- return createBuiltinPlugin(this.name, rawOptions);
11910
- }
11911
- }
11912
- let ModuleFederationRuntimePlugin = base_create(binding_namespaceObject.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options), parseOptions = (options, normalizeSimple, normalizeOptions)=>{
12514
+ let parseOptions = (options, normalizeSimple, normalizeOptions)=>{
11913
12515
  let items = [];
11914
12516
  var fn = (key, value)=>{
11915
12517
  items.push([
@@ -11926,63 +12528,7 @@ let ModuleFederationRuntimePlugin = base_create(binding_namespaceObject.BuiltinP
11926
12528
  else if ('object' == typeof options) object(options);
11927
12529
  else throw Error('Unexpected options format');
11928
12530
  return items;
11929
- }, ModuleFederationPlugin_require = createRequire(import.meta.url);
11930
- function getRemoteInfos(options) {
11931
- if (!options.remotes) return {};
11932
- let remoteType = options.remoteType || (options.library ? options.library.type : "script"), remotes = parseOptions(options.remotes, (item)=>({
11933
- external: Array.isArray(item) ? item : [
11934
- item
11935
- ],
11936
- shareScope: options.shareScope || 'default'
11937
- }), (item)=>({
11938
- external: Array.isArray(item.external) ? item.external : [
11939
- item.external
11940
- ],
11941
- shareScope: item.shareScope || options.shareScope || 'default'
11942
- })), remoteInfos = {};
11943
- for (let [key, config] of remotes)for (let external of config.external){
11944
- let [externalType, externalRequest] = function(external) {
11945
- let result = function(external) {
11946
- if (/^[a-z0-9-]+ /.test(external)) {
11947
- let idx = external.indexOf(' ');
11948
- return [
11949
- external.slice(0, idx),
11950
- external.slice(idx + 1)
11951
- ];
11952
- }
11953
- return null;
11954
- }(external);
11955
- return null === result ? [
11956
- remoteType,
11957
- external
11958
- ] : result;
11959
- }(external);
11960
- if (remoteInfos[key] ??= [], "script" === externalType) {
11961
- let [url, global] = function(urlAndGlobal) {
11962
- let index = urlAndGlobal.indexOf('@');
11963
- return index <= 0 || index === urlAndGlobal.length - 1 ? null : [
11964
- urlAndGlobal.substring(index + 1),
11965
- urlAndGlobal.substring(0, index)
11966
- ];
11967
- }(externalRequest);
11968
- remoteInfos[key].push({
11969
- alias: key,
11970
- name: global,
11971
- entry: url,
11972
- externalType,
11973
- shareScope: config.shareScope
11974
- });
11975
- } else remoteInfos[key].push({
11976
- alias: key,
11977
- name: void 0,
11978
- entry: void 0,
11979
- externalType,
11980
- shareScope: config.shareScope
11981
- });
11982
- }
11983
- return remoteInfos;
11984
- }
11985
- let compilerSet = new WeakSet();
12531
+ }, compilerSet = new WeakSet();
11986
12532
  class ShareRuntimePlugin extends RspackBuiltinPlugin {
11987
12533
  enhanced;
11988
12534
  name = binding_namespaceObject.BuiltinPluginName.ShareRuntimePlugin;
@@ -11993,42 +12539,55 @@ class ShareRuntimePlugin extends RspackBuiltinPlugin {
11993
12539
  if (!compilerSet.has(compiler)) return compilerSet.add(compiler), createBuiltinPlugin(this.name, this.enhanced);
11994
12540
  }
11995
12541
  }
12542
+ let VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
12543
+ function isRequiredVersion(str) {
12544
+ return VERSION_PATTERN_REGEXP.test(str);
12545
+ }
12546
+ let encodeName = function(name, prefix = '', withExt = !1) {
12547
+ return `${prefix}${name.replace(/@/g, 'scope_').replace(/-/g, '_').replace(/\//g, '__').replace(/\./g, '')}${withExt ? '.js' : ''}`;
12548
+ };
12549
+ function normalizeConsumeShareOptions(consumes, shareScope) {
12550
+ return parseOptions(consumes, (item, key)=>{
12551
+ if (Array.isArray(item)) throw Error('Unexpected array in options');
12552
+ return item !== key && isRequiredVersion(item) ? {
12553
+ import: key,
12554
+ shareScope: shareScope || 'default',
12555
+ shareKey: key,
12556
+ requiredVersion: item,
12557
+ strictVersion: !0,
12558
+ packageName: void 0,
12559
+ singleton: !1,
12560
+ eager: !1,
12561
+ treeShakingMode: void 0
12562
+ } : {
12563
+ import: key,
12564
+ shareScope: shareScope || 'default',
12565
+ shareKey: key,
12566
+ requiredVersion: void 0,
12567
+ packageName: void 0,
12568
+ strictVersion: !1,
12569
+ singleton: !1,
12570
+ eager: !1,
12571
+ treeShakingMode: void 0
12572
+ };
12573
+ }, (item, key)=>({
12574
+ import: !1 === item.import ? void 0 : item.import || key,
12575
+ shareScope: item.shareScope || shareScope || 'default',
12576
+ shareKey: item.shareKey || key,
12577
+ requiredVersion: item.requiredVersion,
12578
+ strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : !1 !== item.import && !item.singleton,
12579
+ packageName: item.packageName,
12580
+ singleton: !!item.singleton,
12581
+ eager: !!item.eager,
12582
+ treeShakingMode: item.treeShakingMode
12583
+ }));
12584
+ }
11996
12585
  class ConsumeSharedPlugin extends RspackBuiltinPlugin {
11997
12586
  name = binding_namespaceObject.BuiltinPluginName.ConsumeSharedPlugin;
11998
12587
  _options;
11999
12588
  constructor(options){
12000
12589
  super(), this._options = {
12001
- consumes: parseOptions(options.consumes, (item, key)=>{
12002
- if (Array.isArray(item)) throw Error('Unexpected array in options');
12003
- return item !== key && isRequiredVersion(item) ? {
12004
- import: key,
12005
- shareScope: options.shareScope || 'default',
12006
- shareKey: key,
12007
- requiredVersion: item,
12008
- strictVersion: !0,
12009
- packageName: void 0,
12010
- singleton: !1,
12011
- eager: !1
12012
- } : {
12013
- import: key,
12014
- shareScope: options.shareScope || 'default',
12015
- shareKey: key,
12016
- requiredVersion: void 0,
12017
- packageName: void 0,
12018
- strictVersion: !1,
12019
- singleton: !1,
12020
- eager: !1
12021
- };
12022
- }, (item, key)=>({
12023
- import: !1 === item.import ? void 0 : item.import || key,
12024
- shareScope: item.shareScope || options.shareScope || 'default',
12025
- shareKey: item.shareKey || key,
12026
- requiredVersion: item.requiredVersion,
12027
- strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : !1 !== item.import && !item.singleton,
12028
- packageName: item.packageName,
12029
- singleton: !!item.singleton,
12030
- eager: !!item.eager
12031
- })),
12590
+ consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
12032
12591
  enhanced: options.enhanced ?? !1
12033
12592
  };
12034
12593
  }
@@ -12049,28 +12608,30 @@ class ProvideSharedPlugin extends RspackBuiltinPlugin {
12049
12608
  _provides;
12050
12609
  _enhanced;
12051
12610
  constructor(options){
12052
- super(), this._provides = parseOptions(options.provides, (item)=>{
12611
+ var options1, shareScope, enhanced;
12612
+ super(), this._provides = (options1 = options.provides, shareScope = options.shareScope, enhanced = options.enhanced, parseOptions(options1, (item)=>{
12053
12613
  if (Array.isArray(item)) throw Error('Unexpected array of provides');
12054
12614
  return {
12055
12615
  shareKey: item,
12056
12616
  version: void 0,
12057
- shareScope: options.shareScope || 'default',
12617
+ shareScope: shareScope || 'default',
12058
12618
  eager: !1
12059
12619
  };
12060
12620
  }, (item)=>{
12061
12621
  let raw = {
12062
12622
  shareKey: item.shareKey,
12063
12623
  version: item.version,
12064
- shareScope: item.shareScope || options.shareScope || 'default',
12624
+ shareScope: item.shareScope || shareScope || 'default',
12065
12625
  eager: !!item.eager
12066
12626
  };
12067
- return options.enhanced ? {
12627
+ return enhanced ? {
12068
12628
  ...raw,
12069
12629
  singleton: item.singleton,
12070
12630
  requiredVersion: item.requiredVersion,
12071
- strictVersion: item.strictVersion
12631
+ strictVersion: item.strictVersion,
12632
+ treeShakingMode: item.treeShakingMode
12072
12633
  } : raw;
12073
- }), this._enhanced = options.enhanced;
12634
+ })), this._enhanced = options.enhanced;
12074
12635
  }
12075
12636
  raw(compiler) {
12076
12637
  new ShareRuntimePlugin(this._enhanced ?? !1).apply(compiler);
@@ -12081,32 +12642,43 @@ class ProvideSharedPlugin extends RspackBuiltinPlugin {
12081
12642
  return createBuiltinPlugin(this.name, rawOptions);
12082
12643
  }
12083
12644
  }
12645
+ function validateShareScope(shareScope, enhanced, pluginName) {
12646
+ 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)}`);
12647
+ }
12648
+ function normalizeSharedOptions(shared) {
12649
+ return parseOptions(shared, (item, key)=>{
12650
+ if ('string' != typeof item) throw Error('Unexpected array in shared');
12651
+ return item !== key && isRequiredVersion(item) ? {
12652
+ import: key,
12653
+ requiredVersion: item
12654
+ } : {
12655
+ import: item
12656
+ };
12657
+ }, (item)=>item);
12658
+ }
12659
+ function createConsumeShareOptions(normalizedSharedOptions) {
12660
+ return normalizedSharedOptions.map(([key, options])=>({
12661
+ [key]: {
12662
+ import: options.import,
12663
+ shareKey: options.shareKey || key,
12664
+ shareScope: options.shareScope,
12665
+ requiredVersion: options.requiredVersion,
12666
+ strictVersion: options.strictVersion,
12667
+ singleton: options.singleton,
12668
+ packageName: options.packageName,
12669
+ eager: options.eager,
12670
+ treeShakingMode: options.treeShaking?.mode
12671
+ }
12672
+ }));
12673
+ }
12084
12674
  class SharePlugin {
12085
12675
  _shareScope;
12086
12676
  _consumes;
12087
12677
  _provides;
12088
12678
  _enhanced;
12679
+ _sharedOptions;
12089
12680
  constructor(options){
12090
- let sharedOptions = parseOptions(options.shared, (item, key)=>{
12091
- if ('string' != typeof item) throw Error('Unexpected array in shared');
12092
- return item !== key && isRequiredVersion(item) ? {
12093
- import: key,
12094
- requiredVersion: item
12095
- } : {
12096
- import: item
12097
- };
12098
- }, (item)=>item), consumes = sharedOptions.map(([key, options])=>({
12099
- [key]: {
12100
- import: options.import,
12101
- shareKey: options.shareKey || key,
12102
- shareScope: options.shareScope,
12103
- requiredVersion: options.requiredVersion,
12104
- strictVersion: options.strictVersion,
12105
- singleton: options.singleton,
12106
- packageName: options.packageName,
12107
- eager: options.eager
12108
- }
12109
- })), provides = sharedOptions.filter(([, options])=>!1 !== options.import).map(([key, options])=>({
12681
+ let sharedOptions = normalizeSharedOptions(options.shared), consumes = createConsumeShareOptions(sharedOptions), provides = sharedOptions.filter(([, options])=>!1 !== options.import).map(([key, options])=>({
12110
12682
  [options.import || key]: {
12111
12683
  shareKey: options.shareKey || key,
12112
12684
  shareScope: options.shareScope,
@@ -12114,10 +12686,11 @@ class SharePlugin {
12114
12686
  eager: options.eager,
12115
12687
  singleton: options.singleton,
12116
12688
  requiredVersion: options.requiredVersion,
12117
- strictVersion: options.strictVersion
12689
+ strictVersion: options.strictVersion,
12690
+ treeShakingMode: options.treeShaking?.mode
12118
12691
  }
12119
12692
  }));
12120
- this._shareScope = options.shareScope, this._consumes = consumes, this._provides = provides, this._enhanced = options.enhanced ?? !1;
12693
+ this._shareScope = options.shareScope, this._consumes = consumes, this._provides = provides, this._enhanced = options.enhanced ?? !1, this._sharedOptions = sharedOptions;
12121
12694
  }
12122
12695
  apply(compiler) {
12123
12696
  new ConsumeSharedPlugin({
@@ -12131,15 +12704,566 @@ class SharePlugin {
12131
12704
  }).apply(compiler);
12132
12705
  }
12133
12706
  }
12707
+ let MANIFEST_FILE_NAME = 'mf-manifest.json', STATS_FILE_NAME = 'mf-stats.json', JSON_EXT = '.json';
12708
+ function isPlainObject(value) {
12709
+ return !!value && 'object' == typeof value && !Array.isArray(value);
12710
+ }
12711
+ function getFileName(manifestOptions) {
12712
+ if (!manifestOptions) return {
12713
+ statsFileName: '',
12714
+ manifestFileName: ''
12715
+ };
12716
+ if ('boolean' == typeof manifestOptions) return {
12717
+ statsFileName: STATS_FILE_NAME,
12718
+ manifestFileName: MANIFEST_FILE_NAME
12719
+ };
12720
+ let filePath = 'boolean' == typeof manifestOptions ? '' : manifestOptions.filePath || '', fileName = 'boolean' == typeof manifestOptions ? '' : manifestOptions.fileName || '', manifestFileName = fileName ? fileName.endsWith(JSON_EXT) ? fileName : `${fileName}${JSON_EXT}` : MANIFEST_FILE_NAME;
12721
+ return {
12722
+ statsFileName: join(filePath, fileName ? manifestFileName.replace(JSON_EXT, `-stats${JSON_EXT}`) : STATS_FILE_NAME),
12723
+ manifestFileName: join(filePath, manifestFileName)
12724
+ };
12725
+ }
12726
+ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
12727
+ name = binding_namespaceObject.BuiltinPluginName.ModuleFederationManifestPlugin;
12728
+ rawOpts;
12729
+ constructor(opts){
12730
+ super(), this.rawOpts = opts;
12731
+ }
12732
+ raw(compiler) {
12733
+ var mfConfig, isDev, mfConfig1;
12734
+ let manifestOptions, containerName, globalName, remoteAliasMap, manifestExposes, manifestShared, pkg, buildVersion, statsBuildInfo, opts = (manifestOptions = !0 === (mfConfig = this.rawOpts).manifest ? {} : {
12735
+ ...mfConfig.manifest
12736
+ }, containerName = mfConfig.name, globalName = function(library) {
12737
+ if (!library) return;
12738
+ let libName = library.name;
12739
+ if (libName) {
12740
+ if ('string' == typeof libName) return libName;
12741
+ if (Array.isArray(libName)) return libName[0];
12742
+ if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
12743
+ }
12744
+ }(mfConfig.library) ?? containerName, remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
12745
+ if (cur[1].length > 1) return sum;
12746
+ let { entry, alias, name } = cur[1][0];
12747
+ return entry && name && (sum[alias] = {
12748
+ name,
12749
+ entry
12750
+ }), sum;
12751
+ }, {}), manifestExposes = function(exposes) {
12752
+ if (!exposes) return;
12753
+ let result = parseOptions(exposes, (value)=>({
12754
+ import: Array.isArray(value) ? value : [
12755
+ value
12756
+ ],
12757
+ name: void 0
12758
+ }), (value)=>({
12759
+ import: Array.isArray(value.import) ? value.import : [
12760
+ value.import
12761
+ ],
12762
+ name: value.name ?? void 0
12763
+ })).map(([exposeKey, info])=>{
12764
+ let exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
12765
+ return {
12766
+ path: exposeKey,
12767
+ name: exposeName
12768
+ };
12769
+ });
12770
+ return result.length > 0 ? result : void 0;
12771
+ }(mfConfig.exposes), void 0 === manifestOptions.exposes && manifestExposes && (manifestOptions.exposes = manifestExposes), manifestShared = function(shared) {
12772
+ if (!shared) return;
12773
+ let result = parseOptions(shared, (item, key)=>{
12774
+ if ('string' != typeof item) throw Error('Unexpected array in shared');
12775
+ return item !== key && isRequiredVersion(item) ? {
12776
+ import: key,
12777
+ requiredVersion: item
12778
+ } : {
12779
+ import: item
12780
+ };
12781
+ }, (item)=>item).map(([key, config])=>{
12782
+ let name = config.shareKey || key;
12783
+ return {
12784
+ name,
12785
+ version: 'string' == typeof config.version ? config.version : void 0,
12786
+ requiredVersion: 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0,
12787
+ singleton: config.singleton
12788
+ };
12789
+ });
12790
+ return result.length > 0 ? result : void 0;
12791
+ }(mfConfig.shared), void 0 === manifestOptions.shared && manifestShared && (manifestOptions.shared = manifestShared), {
12792
+ ...manifestOptions,
12793
+ remoteAliasMap,
12794
+ globalName,
12795
+ name: containerName
12796
+ }), { fileName, filePath, disableAssetsAnalyze, remoteAliasMap: remoteAliasMap1, exposes, shared } = opts, { statsFileName, manifestFileName } = getFileName(opts), rawOptions = {
12797
+ name: opts.name,
12798
+ globalName: opts.globalName,
12799
+ fileName,
12800
+ filePath,
12801
+ manifestFileName,
12802
+ statsFileName,
12803
+ disableAssetsAnalyze,
12804
+ remoteAliasMap: remoteAliasMap1,
12805
+ exposes,
12806
+ shared,
12807
+ buildInfo: (isDev = 'development' === compiler.options.mode, mfConfig1 = this.rawOpts, pkg = function(root) {
12808
+ let pkgPath = join(root ? external_node_path_resolve(root) : process.cwd(), 'package.json');
12809
+ try {
12810
+ let content = readFileSync(pkgPath, 'utf-8'), parsed = function(input, guard) {
12811
+ try {
12812
+ let parsed = JSON.parse(input);
12813
+ if (guard(parsed)) return parsed;
12814
+ } catch {}
12815
+ }(content, isPlainObject);
12816
+ if (parsed) {
12817
+ let filtered = {};
12818
+ for (let [key, value] of Object.entries(parsed))'string' == typeof value && (filtered[key] = value);
12819
+ if (Object.keys(filtered).length > 0) return filtered;
12820
+ }
12821
+ } catch {}
12822
+ return {};
12823
+ }(compiler.options.context || process.cwd()), buildVersion = isDev ? 'local' : pkg?.version, statsBuildInfo = {
12824
+ buildVersion: process.env.MF_BUILD_VERSION || buildVersion || 'UNKNOWN',
12825
+ buildName: process.env.MF_BUILD_NAME || pkg?.name || 'UNKNOWN'
12826
+ }, Object.values(normalizeSharedOptions(mfConfig1.shared || {})).some((config)=>config[1].treeShaking) && (statsBuildInfo.target = Array.isArray(compiler.options.target) ? compiler.options.target : [], statsBuildInfo.plugins = mfConfig1.treeShakingSharedPlugins || [], statsBuildInfo.excludePlugins = mfConfig1.treeShakingSharedExcludePlugins || []), statsBuildInfo)
12827
+ };
12828
+ return createBuiltinPlugin(this.name, rawOptions);
12829
+ }
12830
+ }
12831
+ let SHARE_ENTRY_ASSET = 'collect-shared-entries.json';
12832
+ class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
12833
+ name = binding_namespaceObject.BuiltinPluginName.CollectSharedEntryPlugin;
12834
+ sharedOptions;
12835
+ _collectedEntries;
12836
+ constructor(options){
12837
+ super();
12838
+ let { sharedOptions } = options;
12839
+ this.sharedOptions = sharedOptions, this._collectedEntries = {};
12840
+ }
12841
+ getData() {
12842
+ return this._collectedEntries;
12843
+ }
12844
+ getFilename() {
12845
+ return SHARE_ENTRY_ASSET;
12846
+ }
12847
+ apply(compiler) {
12848
+ super.apply(compiler), compiler.hooks.thisCompilation.tap('Collect shared entry', (compilation)=>{
12849
+ compilation.hooks.processAssets.tap({
12850
+ name: 'CollectSharedEntry',
12851
+ stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
12852
+ }, ()=>{
12853
+ compilation.getAssets().forEach((asset)=>{
12854
+ asset.name === SHARE_ENTRY_ASSET && (this._collectedEntries = JSON.parse(asset.source.source().toString())), compilation.deleteAsset(asset.name);
12855
+ });
12856
+ });
12857
+ });
12858
+ }
12859
+ raw() {
12860
+ let rawOptions = {
12861
+ consumes: normalizeConsumeShareOptions(createConsumeShareOptions(this.sharedOptions)).map(([key, v])=>({
12862
+ key,
12863
+ ...v
12864
+ })),
12865
+ filename: this.getFilename()
12866
+ };
12867
+ return createBuiltinPlugin(this.name, rawOptions);
12868
+ }
12869
+ }
12870
+ function assert(condition, msg) {
12871
+ if (!condition) throw Error(msg);
12872
+ }
12873
+ class SharedContainerPlugin extends RspackBuiltinPlugin {
12874
+ name = binding_namespaceObject.BuiltinPluginName.SharedContainerPlugin;
12875
+ filename = '';
12876
+ _options;
12877
+ _shareName;
12878
+ _globalName;
12879
+ constructor(options){
12880
+ super();
12881
+ let { shareName, library, request, independentShareFileName, mfName } = options, version = options.version || '0.0.0';
12882
+ this._globalName = encodeName(`${mfName}_${shareName}_${version}`);
12883
+ let fileName = independentShareFileName || `${version}/share-entry.js`;
12884
+ this._shareName = shareName, this._options = {
12885
+ name: shareName,
12886
+ request: request,
12887
+ library: (library ? {
12888
+ ...library,
12889
+ name: this._globalName
12890
+ } : void 0) || {
12891
+ type: 'global',
12892
+ name: this._globalName
12893
+ },
12894
+ version,
12895
+ fileName
12896
+ };
12897
+ }
12898
+ getData() {
12899
+ return [
12900
+ this._options.fileName,
12901
+ this._globalName,
12902
+ this._options.version
12903
+ ];
12904
+ }
12905
+ raw(compiler) {
12906
+ let { library } = this._options;
12907
+ return compiler.options.output.enabledLibraryTypes.includes(library.type) || compiler.options.output.enabledLibraryTypes.push(library.type), createBuiltinPlugin(this.name, this._options);
12908
+ }
12909
+ apply(compiler) {
12910
+ super.apply(compiler);
12911
+ let shareName = this._shareName;
12912
+ compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
12913
+ compilation.hooks.processAssets.tap({
12914
+ name: 'getShareContainerFile'
12915
+ }, ()=>{
12916
+ assert(compilation.entrypoints.get(shareName), `Can not get shared ${shareName} entryPoint!`);
12917
+ let remoteEntryNameChunk = compilation.namedChunks.get(shareName);
12918
+ assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
12919
+ let files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes('.hot-update') && !f.endsWith('.css'));
12920
+ assert(files.length > 0, `no files found for shared ${shareName} chunk`), assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(',')}`), this.filename = files[0];
12921
+ });
12922
+ });
12923
+ }
12924
+ }
12925
+ class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
12926
+ name = binding_namespaceObject.BuiltinPluginName.SharedUsedExportsOptimizerPlugin;
12927
+ sharedOptions;
12928
+ injectTreeShakingUsedExports;
12929
+ manifestOptions;
12930
+ constructor(sharedOptions, injectTreeShakingUsedExports, manifestOptions){
12931
+ super(), this.sharedOptions = sharedOptions, this.injectTreeShakingUsedExports = injectTreeShakingUsedExports ?? !0, this.manifestOptions = manifestOptions ?? {};
12932
+ }
12933
+ buildOptions() {
12934
+ let shared = this.sharedOptions.map(([shareKey, config])=>({
12935
+ shareKey,
12936
+ treeShaking: !!config.treeShaking,
12937
+ usedExports: config.treeShaking?.usedExports
12938
+ })), { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
12939
+ return {
12940
+ shared,
12941
+ injectTreeShakingUsedExports: this.injectTreeShakingUsedExports,
12942
+ manifestFileName,
12943
+ statsFileName
12944
+ };
12945
+ }
12946
+ raw() {
12947
+ if (this.sharedOptions.length) return createBuiltinPlugin(this.name, this.buildOptions());
12948
+ }
12949
+ }
12950
+ let VIRTUAL_ENTRY = './virtual-entry.js', VIRTUAL_ENTRY_NAME = 'virtual-entry';
12951
+ class VirtualEntryPlugin {
12952
+ sharedOptions;
12953
+ collectShared = !1;
12954
+ constructor(sharedOptions, collectShared){
12955
+ this.sharedOptions = sharedOptions, this.collectShared = collectShared;
12956
+ }
12957
+ createEntry() {
12958
+ let { sharedOptions, collectShared } = this;
12959
+ return sharedOptions.reduce((acc, cur, index)=>acc + `import shared_${index} from '${cur[0]}';\n` + (collectShared ? `console.log(shared_${index});\n` : ''), '');
12960
+ }
12961
+ static entry() {
12962
+ return {
12963
+ [VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
12964
+ };
12965
+ }
12966
+ apply(compiler) {
12967
+ new compiler.rspack.experiments.VirtualModulesPlugin({
12968
+ [VIRTUAL_ENTRY]: this.createEntry()
12969
+ }).apply(compiler), compiler.hooks.thisCompilation.tap('RemoveVirtualEntryAsset', (compilation)=>{
12970
+ compilation.hooks.processAssets.tap({
12971
+ name: 'RemoveVirtualEntryAsset',
12972
+ stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
12973
+ }, ()=>{
12974
+ try {
12975
+ let chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
12976
+ chunk?.files.forEach((f)=>{
12977
+ compilation.deleteAsset(f);
12978
+ });
12979
+ } catch (_e) {
12980
+ console.error('Failed to remove virtual entry file!');
12981
+ }
12982
+ });
12983
+ });
12984
+ }
12985
+ }
12986
+ let resolveOutputDir = (outputDir, shareName)=>shareName ? join(outputDir, encodeName(shareName)) : outputDir;
12987
+ class IndependentSharedPlugin {
12988
+ mfName;
12989
+ shared;
12990
+ library;
12991
+ sharedOptions;
12992
+ outputDir;
12993
+ plugins;
12994
+ treeShaking;
12995
+ manifest;
12996
+ buildAssets = {};
12997
+ injectTreeShakingUsedExports;
12998
+ treeShakingSharedExcludePlugins;
12999
+ name = 'IndependentSharedPlugin';
13000
+ constructor(options){
13001
+ let { outputDir, plugins, treeShaking, shared, name, manifest, injectTreeShakingUsedExports, library, treeShakingSharedExcludePlugins } = options;
13002
+ this.shared = shared, this.mfName = name, this.outputDir = outputDir || 'independent-packages', this.plugins = plugins || [], this.treeShaking = treeShaking, this.manifest = manifest, this.injectTreeShakingUsedExports = injectTreeShakingUsedExports ?? !0, this.library = library, this.treeShakingSharedExcludePlugins = treeShakingSharedExcludePlugins || [], this.sharedOptions = parseOptions(shared, (item, key)=>{
13003
+ if ('string' != typeof item) throw Error(`Unexpected array in shared configuration for key "${key}"`);
13004
+ return item !== key && isRequiredVersion(item) ? {
13005
+ import: key,
13006
+ requiredVersion: item
13007
+ } : {
13008
+ import: item
13009
+ };
13010
+ }, (item)=>item);
13011
+ }
13012
+ apply(compiler) {
13013
+ let { manifest } = this, runCount = 0;
13014
+ compiler.hooks.beforeRun.tapPromise('IndependentSharedPlugin', async ()=>{
13015
+ !runCount && (await this.createIndependentCompilers(compiler), runCount++);
13016
+ }), compiler.hooks.watchRun.tapPromise('IndependentSharedPlugin', async ()=>{
13017
+ !runCount && (await this.createIndependentCompilers(compiler), runCount++);
13018
+ }), manifest && compiler.hooks.compilation.tap('IndependentSharedPlugin', (compilation)=>{
13019
+ compilation.hooks.processAssets.tap({
13020
+ name: 'injectBuildAssets',
13021
+ stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
13022
+ }, ()=>{
13023
+ let { statsFileName, manifestFileName } = getFileName(manifest), injectBuildAssetsIntoStatsOrManifest = (filename)=>{
13024
+ let stats = compilation.getAsset(filename);
13025
+ if (!stats) return;
13026
+ let statsContent = JSON.parse(stats.source.source().toString()), { shared } = statsContent;
13027
+ Object.entries(this.buildAssets).forEach(([key, item])=>{
13028
+ let targetShared = shared.find((s)=>s.name === key);
13029
+ targetShared && item.forEach(([entry, version, globalName])=>{
13030
+ version === targetShared.version && (targetShared.fallback = entry, targetShared.fallbackName = globalName);
13031
+ });
13032
+ }), compilation.updateAsset(filename, new compiler.rspack.sources.RawSource(JSON.stringify(statsContent)));
13033
+ };
13034
+ injectBuildAssetsIntoStatsOrManifest(statsFileName), injectBuildAssetsIntoStatsOrManifest(manifestFileName);
13035
+ });
13036
+ });
13037
+ }
13038
+ async createIndependentCompilers(parentCompiler) {
13039
+ let { sharedOptions, buildAssets, outputDir } = this;
13040
+ console.log('Start building shared fallback resources ...');
13041
+ let shareRequestsMap = await this.createIndependentCompiler(parentCompiler);
13042
+ await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
13043
+ if (!shareConfig.treeShaking || !1 === shareConfig.import) return;
13044
+ let shareRequests = shareRequestsMap[shareName].requests;
13045
+ await Promise.all(shareRequests.map(async ([request, version])=>{
13046
+ let sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1], [shareFileName, globalName, sharedVersion] = await this.createIndependentCompiler(parentCompiler, {
13047
+ shareRequestsMap,
13048
+ currentShare: {
13049
+ shareName,
13050
+ version,
13051
+ request,
13052
+ independentShareFileName: sharedConfig?.treeShaking?.filename
13053
+ }
13054
+ });
13055
+ 'string' == typeof shareFileName && (buildAssets[shareName] ||= [], buildAssets[shareName].push([
13056
+ join(resolveOutputDir(outputDir, shareName), shareFileName),
13057
+ sharedVersion,
13058
+ globalName
13059
+ ]));
13060
+ }));
13061
+ })), console.log('All shared fallback have been compiled successfully!');
13062
+ }
13063
+ async createIndependentCompiler(parentCompiler, extraOptions) {
13064
+ let extraPlugin, { mfName, plugins, outputDir, sharedOptions, treeShaking, library, treeShakingSharedExcludePlugins } = this, outputDirWithShareName = resolveOutputDir(outputDir, extraOptions?.currentShare?.shareName || ''), parentConfig = parentCompiler.options, finalPlugins = [], rspack = parentCompiler.rspack;
13065
+ extraPlugin = extraOptions ? new SharedContainerPlugin({
13066
+ mfName: `${mfName}_${treeShaking ? 't' : 'f'}`,
13067
+ library,
13068
+ ...extraOptions.currentShare
13069
+ }) : new CollectSharedEntryPlugin({
13070
+ sharedOptions,
13071
+ shareScope: 'default'
13072
+ }), (parentConfig.plugins || []).forEach((plugin)=>{
13073
+ void 0 !== plugin && 'string' != typeof plugin && ((plugin, excludedPlugins = [])=>{
13074
+ if (!plugin) return !0;
13075
+ let pluginName = plugin.name || plugin.constructor?.name;
13076
+ return !pluginName || ![
13077
+ 'TreeShakingSharedPlugin',
13078
+ 'IndependentSharedPlugin',
13079
+ 'ModuleFederationPlugin',
13080
+ 'SharedUsedExportsOptimizerPlugin',
13081
+ 'HtmlWebpackPlugin',
13082
+ 'HtmlRspackPlugin',
13083
+ 'RsbuildHtmlPlugin',
13084
+ ...excludedPlugins
13085
+ ].includes(pluginName);
13086
+ })(plugin, treeShakingSharedExcludePlugins) && finalPlugins.push(plugin);
13087
+ }), plugins.forEach((plugin)=>{
13088
+ finalPlugins.push(plugin);
13089
+ }), finalPlugins.push(extraPlugin), finalPlugins.push(new ConsumeSharedPlugin({
13090
+ consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
13091
+ [key]: {
13092
+ import: !extraOptions && options.import,
13093
+ shareKey: options.shareKey || key,
13094
+ shareScope: options.shareScope,
13095
+ requiredVersion: options.requiredVersion,
13096
+ strictVersion: options.strictVersion,
13097
+ singleton: options.singleton,
13098
+ packageName: options.packageName,
13099
+ eager: options.eager
13100
+ }
13101
+ })),
13102
+ enhanced: !0
13103
+ })), treeShaking && finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectTreeShakingUsedExports)), finalPlugins.push(new VirtualEntryPlugin(sharedOptions, !extraOptions));
13104
+ let fullOutputDir = external_node_path_resolve(parentCompiler.outputPath, outputDirWithShareName), compilerConfig = {
13105
+ ...parentConfig,
13106
+ module: {
13107
+ ...parentConfig.module,
13108
+ rules: [
13109
+ {
13110
+ test: /virtual-entry\.js$/,
13111
+ type: "javascript/auto",
13112
+ resolve: {
13113
+ fullySpecified: !1
13114
+ },
13115
+ use: {
13116
+ loader: 'builtin:swc-loader'
13117
+ }
13118
+ },
13119
+ ...parentConfig.module?.rules || []
13120
+ ]
13121
+ },
13122
+ mode: parentConfig.mode || 'development',
13123
+ entry: VirtualEntryPlugin.entry,
13124
+ output: {
13125
+ path: fullOutputDir,
13126
+ clean: !0,
13127
+ publicPath: parentConfig.output?.publicPath || 'auto'
13128
+ },
13129
+ plugins: finalPlugins,
13130
+ optimization: {
13131
+ ...parentConfig.optimization,
13132
+ splitChunks: !1
13133
+ }
13134
+ }, compiler = rspack.rspack(compilerConfig);
13135
+ compiler.inputFileSystem = parentCompiler.inputFileSystem, compiler.outputFileSystem = parentCompiler.outputFileSystem, compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
13136
+ let { currentShare } = extraOptions || {};
13137
+ return new Promise((resolve, reject)=>{
13138
+ compiler.run((err, stats)=>{
13139
+ if (err || stats?.hasErrors()) {
13140
+ let target = currentShare ? currentShare.shareName : 'Collect deps';
13141
+ console.error(`${target} Compile failed:`, err || stats.toJson().errors.map((e)=>e.message).join('\n')), reject(err || Error(`${target} Compile failed`));
13142
+ return;
13143
+ }
13144
+ currentShare && console.log(`${currentShare.shareName} Compile success`), resolve(extraPlugin.getData());
13145
+ });
13146
+ });
13147
+ }
13148
+ }
13149
+ let TreeShakingSharedPlugin_require = createRequire(import.meta.url);
13150
+ class TreeShakingSharedPlugin {
13151
+ mfConfig;
13152
+ outputDir;
13153
+ secondary;
13154
+ _independentSharePlugin;
13155
+ name = 'TreeShakingSharedPlugin';
13156
+ constructor(options){
13157
+ let { mfConfig, secondary } = options;
13158
+ this.mfConfig = mfConfig, this.outputDir = mfConfig.treeShakingSharedDir || 'independent-packages', this.secondary = !!secondary;
13159
+ }
13160
+ apply(compiler) {
13161
+ let { mfConfig, outputDir, secondary } = this, { name, shared, library, treeShakingSharedPlugins } = mfConfig;
13162
+ if (!shared) return;
13163
+ let sharedOptions = normalizeSharedOptions(shared);
13164
+ sharedOptions.length && sharedOptions.some(([_, config])=>config.treeShaking && !1 !== config.import) && (secondary || new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectTreeShakingUsedExports, mfConfig.manifest).apply(compiler), this._independentSharePlugin = new IndependentSharedPlugin({
13165
+ name: name,
13166
+ shared: shared,
13167
+ outputDir,
13168
+ plugins: treeShakingSharedPlugins?.map((p)=>new (TreeShakingSharedPlugin_require(p))()) || [],
13169
+ treeShaking: secondary,
13170
+ library,
13171
+ manifest: mfConfig.manifest,
13172
+ treeShakingSharedExcludePlugins: mfConfig.treeShakingSharedExcludePlugins
13173
+ }), this._independentSharePlugin.apply(compiler));
13174
+ }
13175
+ get buildAssets() {
13176
+ return this._independentSharePlugin?.buildAssets || {};
13177
+ }
13178
+ }
13179
+ let ModuleFederationRuntimePlugin = base_create(binding_namespaceObject.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options), ModuleFederationPlugin_require = createRequire(import.meta.url);
13180
+ function getRemoteInfos(options) {
13181
+ if (!options.remotes) return {};
13182
+ let remoteType = options.remoteType || (options.library ? options.library.type : "script"), remotes = parseOptions(options.remotes, (item)=>({
13183
+ external: Array.isArray(item) ? item : [
13184
+ item
13185
+ ],
13186
+ shareScope: options.shareScope ?? 'default'
13187
+ }), (item)=>({
13188
+ external: Array.isArray(item.external) ? item.external : [
13189
+ item.external
13190
+ ],
13191
+ shareScope: item.shareScope || options.shareScope || 'default'
13192
+ })), remoteInfos = {};
13193
+ for (let [key, config] of remotes)for (let external of config.external){
13194
+ let [externalType, externalRequest] = function(external) {
13195
+ let result = function(external) {
13196
+ if (/^[a-z0-9-]+ /.test(external)) {
13197
+ let idx = external.indexOf(' ');
13198
+ return [
13199
+ external.slice(0, idx),
13200
+ external.slice(idx + 1)
13201
+ ];
13202
+ }
13203
+ return null;
13204
+ }(external);
13205
+ return null === result ? [
13206
+ remoteType,
13207
+ external
13208
+ ] : result;
13209
+ }(external);
13210
+ if (remoteInfos[key] ??= [], "script" === externalType) {
13211
+ let [url, global] = function(urlAndGlobal) {
13212
+ let index = urlAndGlobal.indexOf('@');
13213
+ return index <= 0 || index === urlAndGlobal.length - 1 ? null : [
13214
+ urlAndGlobal.substring(index + 1),
13215
+ urlAndGlobal.substring(0, index)
13216
+ ];
13217
+ }(externalRequest);
13218
+ remoteInfos[key].push({
13219
+ alias: key,
13220
+ name: global,
13221
+ entry: url,
13222
+ externalType,
13223
+ shareScope: config.shareScope
13224
+ });
13225
+ } else remoteInfos[key].push({
13226
+ alias: key,
13227
+ name: void 0,
13228
+ entry: void 0,
13229
+ externalType,
13230
+ shareScope: config.shareScope
13231
+ });
13232
+ }
13233
+ return remoteInfos;
13234
+ }
13235
+ function getDefaultEntryRuntime(paths, options, compiler, treeShakingShareFallbacks) {
13236
+ let runtimePlugins = options.runtimePlugins ?? [], remoteInfos = getRemoteInfos(options), runtimePluginImports = [], runtimePluginVars = [], libraryType = options.library?.type || 'var';
13237
+ for(let i = 0; i < runtimePlugins.length; i++){
13238
+ let runtimePluginVar = `__module_federation_runtime_plugin_${i}__`, pluginSpec = runtimePlugins[i], pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec, pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
13239
+ runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
13240
+ let paramsCode = void 0 === pluginParams ? 'undefined' : JSON.stringify(pluginParams);
13241
+ runtimePluginVars.push(`{ plugin: ${runtimePluginVar}, params: ${paramsCode} }`);
13242
+ }
13243
+ let content = [
13244
+ `import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
13245
+ ...runtimePluginImports,
13246
+ `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(', ')}].filter(({ plugin }) => plugin).map(({ plugin, params }) => plugin(params))`,
13247
+ `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
13248
+ `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
13249
+ `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? 'version-first')}`,
13250
+ `const __module_federation_share_fallbacks__ = ${JSON.stringify(treeShakingShareFallbacks)}`,
13251
+ `const __module_federation_library_type__ = ${JSON.stringify(libraryType)}`,
13252
+ compiler.rspack.Template.getFunctionContent(ModuleFederationPlugin_require('./moduleFederationDefaultRuntime.js').default)
13253
+ ].join(';');
13254
+ return `@module-federation/runtime/rspack.js!=!data:text/javascript,${encodeURIComponent(content)}`;
13255
+ }
12134
13256
  class ContainerPlugin extends RspackBuiltinPlugin {
12135
13257
  name = binding_namespaceObject.BuiltinPluginName.ContainerPlugin;
12136
13258
  _options;
12137
13259
  constructor(options){
12138
- super(), this._options = {
13260
+ super();
13261
+ let shareScope = options.shareScope || 'default', enhanced = options.enhanced ?? !1;
13262
+ validateShareScope(shareScope, enhanced, 'ContainerPlugin'), this._options = {
12139
13263
  name: options.name,
12140
- shareScope: options.shareScope || 'default',
13264
+ shareScope,
12141
13265
  library: options.library || {
12142
- type: 'var',
13266
+ type: 'global',
12143
13267
  name: options.name
12144
13268
  },
12145
13269
  runtime: options.runtime,
@@ -12155,7 +13279,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
12155
13279
  ],
12156
13280
  name: item.name || void 0
12157
13281
  })),
12158
- enhanced: options.enhanced ?? !1
13282
+ enhanced
12159
13283
  };
12160
13284
  }
12161
13285
  raw(compiler) {
@@ -12180,29 +13304,38 @@ class ContainerReferencePlugin extends RspackBuiltinPlugin {
12180
13304
  name = binding_namespaceObject.BuiltinPluginName.ContainerReferencePlugin;
12181
13305
  _options;
12182
13306
  constructor(options){
12183
- super(), this._options = {
13307
+ super();
13308
+ let enhanced = options.enhanced ?? !1;
13309
+ options.shareScope && validateShareScope(options.shareScope, enhanced, 'ContainerReferencePlugin');
13310
+ let remotes = parseOptions(options.remotes, (item)=>({
13311
+ external: Array.isArray(item) ? item : [
13312
+ item
13313
+ ],
13314
+ shareScope: options.shareScope || 'default'
13315
+ }), (item)=>({
13316
+ external: Array.isArray(item.external) ? item.external : [
13317
+ item.external
13318
+ ],
13319
+ shareScope: item.shareScope || options.shareScope || 'default'
13320
+ }));
13321
+ for (let [, config] of remotes)validateShareScope(config.shareScope, enhanced, 'ContainerReferencePlugin');
13322
+ this._options = {
12184
13323
  remoteType: options.remoteType,
12185
- remotes: parseOptions(options.remotes, (item)=>({
12186
- external: Array.isArray(item) ? item : [
12187
- item
12188
- ],
12189
- shareScope: options.shareScope || 'default'
12190
- }), (item)=>({
12191
- external: Array.isArray(item.external) ? item.external : [
12192
- item.external
12193
- ],
12194
- shareScope: item.shareScope || options.shareScope || 'default'
12195
- })),
12196
- enhanced: options.enhanced ?? !1
13324
+ remotes,
13325
+ enhanced
12197
13326
  };
12198
13327
  }
12199
13328
  raw(compiler) {
12200
- let { remoteType, remotes } = this._options, remoteExternals = {};
13329
+ let { remoteType, remotes } = this._options, remoteExternals = {}, importExternals = {};
12201
13330
  for (let [key, config] of remotes){
12202
13331
  let i = 0;
12203
- for (let external of config.external)!external.startsWith('internal ') && (remoteExternals[`webpack/container/reference/${key}${i ? `/fallback-${i}` : ''}`] = external, i++);
13332
+ for (let external of config.external){
13333
+ if (external.startsWith('internal ')) continue;
13334
+ let request = `webpack/container/reference/${key}${i ? `/fallback-${i}` : ''}`;
13335
+ ('module' === remoteType || 'module-import' === remoteType) && external.startsWith('.') ? importExternals[request] = external : remoteExternals[request] = external, i++;
13336
+ }
12204
13337
  }
12205
- new ExternalsPlugin(remoteType, remoteExternals, !0).apply(compiler), new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
13338
+ new ExternalsPlugin(remoteType, remoteExternals, !0).apply(compiler), Object.keys(importExternals).length > 0 && new ExternalsPlugin('import', importExternals, !0).apply(compiler), new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
12206
13339
  let rawOptions = {
12207
13340
  remoteType: this._options.remoteType,
12208
13341
  remotes: this._options.remotes.map(([key, r])=>({
@@ -12222,7 +13355,7 @@ async function transform(source, options) {
12222
13355
  let _options = JSON.stringify(options || {});
12223
13356
  return binding_default().transform(source, _options);
12224
13357
  }
12225
- let exports_rspackVersion = "2.0.0-canary.20260120", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
13358
+ let exports_rspackVersion = "2.0.0-rc.2", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
12226
13359
  getNormalizedRspackOptions: getNormalizedRspackOptions,
12227
13360
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
12228
13361
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -12247,6 +13380,8 @@ let exports_rspackVersion = "2.0.0-canary.20260120", exports_version = "5.75.0",
12247
13380
  NodeEnvironmentPlugin: NodeEnvironmentPlugin
12248
13381
  }, electron = {
12249
13382
  ElectronTargetPlugin: ElectronTargetPlugin
13383
+ }, exports_ids = {
13384
+ HashedModuleIdsPlugin: HashedModuleIdsPlugin
12250
13385
  }, exports_library = {
12251
13386
  EnableLibraryPlugin: EnableLibraryPlugin
12252
13387
  }, exports_wasm = {
@@ -12265,10 +13400,12 @@ let exports_rspackVersion = "2.0.0-canary.20260120", exports_version = "5.75.0",
12265
13400
  ContainerReferencePlugin: ContainerReferencePlugin,
12266
13401
  ModuleFederationPlugin: class {
12267
13402
  _options;
13403
+ _treeShakingSharedPlugin;
12268
13404
  constructor(_options){
12269
13405
  this._options = _options;
12270
13406
  }
12271
13407
  apply(compiler) {
13408
+ var options;
12272
13409
  let { webpack } = compiler, paths = function(options, compiler) {
12273
13410
  let runtimeToolsPath;
12274
13411
  if (options.implementation) runtimeToolsPath = options.implementation;
@@ -12297,101 +13434,55 @@ let exports_rspackVersion = "2.0.0-canary.20260120", exports_version = "5.75.0",
12297
13434
  runtime: runtimePath
12298
13435
  };
12299
13436
  }(this._options, compiler);
12300
- if (compiler.options.resolve.alias = {
13437
+ compiler.options.resolve.alias = {
12301
13438
  '@module-federation/runtime-tools': paths.runtimeTools,
12302
13439
  '@module-federation/runtime': paths.runtime,
12303
13440
  ...compiler.options.resolve.alias
12304
- }, new ModuleFederationRuntimePlugin({
12305
- entryRuntime: function(paths, options, compiler) {
12306
- let runtimePlugins = options.runtimePlugins ?? [], remoteInfos = getRemoteInfos(options), runtimePluginImports = [], runtimePluginVars = [];
12307
- for(let i = 0; i < runtimePlugins.length; i++){
12308
- let runtimePluginVar = `__module_federation_runtime_plugin_${i}__`, pluginSpec = runtimePlugins[i], pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec, pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
12309
- runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
12310
- let paramsCode = void 0 === pluginParams ? 'undefined' : JSON.stringify(pluginParams);
12311
- runtimePluginVars.push(`${runtimePluginVar}(${paramsCode})`);
12312
- }
12313
- let content = [
12314
- `import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
12315
- ...runtimePluginImports,
12316
- `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(', ')}]`,
12317
- `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
12318
- `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
12319
- `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? 'version-first')}`,
12320
- compiler.webpack.Template.getFunctionContent(ModuleFederationPlugin_require('./moduleFederationDefaultRuntime.js').default)
12321
- ].join(';');
12322
- return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
12323
- }(paths, this._options, compiler)
12324
- }).apply(compiler), new webpack.container.ModuleFederationPluginV1({
12325
- ...this._options,
13441
+ }, ((options = this._options).shared ? parseOptions(options.shared, (item, key)=>{
13442
+ if ('string' != typeof item) throw Error('Unexpected array in shared');
13443
+ return item !== key && isRequiredVersion(item) ? {
13444
+ import: key,
13445
+ requiredVersion: item
13446
+ } : {
13447
+ import: item
13448
+ };
13449
+ }, (item)=>item) : []).filter(([, config])=>config.treeShaking).length > 0 && (this._treeShakingSharedPlugin = new TreeShakingSharedPlugin({
13450
+ mfConfig: this._options,
13451
+ secondary: !1
13452
+ }), this._treeShakingSharedPlugin.apply(compiler));
13453
+ let runtimeExperiments = {
13454
+ asyncStartup: this._options.experiments?.asyncStartup ?? !1
13455
+ }, runtimePluginApplied = !1;
13456
+ compiler.hooks.beforeRun.tap({
13457
+ name: 'ModuleFederationPlugin',
13458
+ stage: 100
13459
+ }, ()=>{
13460
+ runtimePluginApplied || (runtimePluginApplied = !0, new ModuleFederationRuntimePlugin({
13461
+ entryRuntime: getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakingSharedPlugin?.buildAssets),
13462
+ experiments: runtimeExperiments
13463
+ }).apply(compiler));
13464
+ }), compiler.hooks.watchRun.tap({
13465
+ name: 'ModuleFederationPlugin',
13466
+ stage: 100
13467
+ }, ()=>{
13468
+ runtimePluginApplied || (runtimePluginApplied = !0, new ModuleFederationRuntimePlugin({
13469
+ entryRuntime: getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakingSharedPlugin?.buildAssets || {}),
13470
+ experiments: runtimeExperiments
13471
+ }).apply(compiler));
13472
+ });
13473
+ let v1Options = {
13474
+ name: this._options.name,
13475
+ exposes: this._options.exposes,
13476
+ filename: this._options.filename,
13477
+ library: this._options.library,
13478
+ remoteType: this._options.remoteType,
13479
+ remotes: this._options.remotes,
13480
+ runtime: this._options.runtime,
13481
+ shareScope: this._options.shareScope,
13482
+ shared: this._options.shared,
12326
13483
  enhanced: !0
12327
- }).apply(compiler), this._options.manifest) {
12328
- let manifestOptions = !0 === this._options.manifest ? {} : {
12329
- ...this._options.manifest
12330
- }, containerName = manifestOptions.name ?? this._options.name, globalName = manifestOptions.globalName ?? function(library) {
12331
- if (!library) return;
12332
- let libName = library.name;
12333
- if (libName) {
12334
- if ('string' == typeof libName) return libName;
12335
- if (Array.isArray(libName)) return libName[0];
12336
- if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
12337
- }
12338
- }(this._options.library) ?? containerName, remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
12339
- if (cur[1].length > 1) return sum;
12340
- let { entry, alias, name } = cur[1][0];
12341
- return entry && name && (sum[alias] = {
12342
- name,
12343
- entry
12344
- }), sum;
12345
- }, {}), manifestExposes = function(exposes) {
12346
- if (!exposes) return;
12347
- let result = parseOptions(exposes, (value)=>({
12348
- import: Array.isArray(value) ? value : [
12349
- value
12350
- ],
12351
- name: void 0
12352
- }), (value)=>({
12353
- import: Array.isArray(value.import) ? value.import : [
12354
- value.import
12355
- ],
12356
- name: value.name ?? void 0
12357
- })).map(([exposeKey, info])=>{
12358
- let exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
12359
- return {
12360
- path: exposeKey,
12361
- name: exposeName
12362
- };
12363
- });
12364
- return result.length > 0 ? result : void 0;
12365
- }(this._options.exposes);
12366
- void 0 === manifestOptions.exposes && manifestExposes && (manifestOptions.exposes = manifestExposes);
12367
- let manifestShared = function(shared) {
12368
- if (!shared) return;
12369
- let result = parseOptions(shared, (item, key)=>{
12370
- if ('string' != typeof item) throw Error('Unexpected array in shared');
12371
- return item !== key && isRequiredVersion(item) ? {
12372
- import: key,
12373
- requiredVersion: item
12374
- } : {
12375
- import: item
12376
- };
12377
- }, (item)=>item).map(([key, config])=>{
12378
- let name = config.shareKey || key;
12379
- return {
12380
- name,
12381
- version: 'string' == typeof config.version ? config.version : void 0,
12382
- requiredVersion: 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0,
12383
- singleton: config.singleton
12384
- };
12385
- });
12386
- return result.length > 0 ? result : void 0;
12387
- }(this._options.shared);
12388
- void 0 === manifestOptions.shared && manifestShared && (manifestOptions.shared = manifestShared), new ModuleFederationManifestPlugin({
12389
- ...manifestOptions,
12390
- name: containerName,
12391
- globalName,
12392
- remoteAliasMap
12393
- }).apply(compiler);
12394
- }
13484
+ };
13485
+ new webpack.container.ModuleFederationPluginV1(v1Options).apply(compiler), this._options.manifest && new ModuleFederationManifestPlugin(this._options).apply(compiler);
12395
13486
  }
12396
13487
  },
12397
13488
  ModuleFederationPluginV1: class {
@@ -12428,6 +13519,7 @@ let exports_rspackVersion = "2.0.0-canary.20260120", exports_version = "5.75.0",
12428
13519
  }
12429
13520
  }, sharing = {
12430
13521
  ProvideSharedPlugin: ProvideSharedPlugin,
13522
+ TreeShakingSharedPlugin: TreeShakingSharedPlugin,
12431
13523
  ConsumeSharedPlugin: ConsumeSharedPlugin,
12432
13524
  SharePlugin: SharePlugin
12433
13525
  }, exports_experiments = {
@@ -12439,8 +13531,7 @@ let exports_rspackVersion = "2.0.0-canary.20260120", exports_version = "5.75.0",
12439
13531
  await JavaScriptTracer.cleanupJavaScriptTrace(), (0, binding_namespaceObject.syncTraceEvent)(JavaScriptTracer.events), (0, binding_namespaceObject.cleanupGlobalTrace)();
12440
13532
  }
12441
13533
  },
12442
- RemoveDuplicateModulesPlugin: RemoveDuplicateModulesPlugin,
12443
- EsmLibraryPlugin: EsmLibraryPlugin,
13534
+ RemoveDuplicateModulesPlugin: RemoveDuplicateModulesPlugin_RemoveDuplicateModulesPlugin,
12444
13535
  RsdoctorPlugin: RsdoctorPluginImpl,
12445
13536
  RstestPlugin: RstestPlugin,
12446
13537
  RslibPlugin: RslibPlugin,
@@ -12467,12 +13558,36 @@ let exports_rspackVersion = "2.0.0-canary.20260120", exports_version = "5.75.0",
12467
13558
  if (INTERNAL_PLUGIN_NAMES.includes(name)) throw Error(`Cannot register native plugin with name '${name}', it conflicts with internal plugin names.`);
12468
13559
  return base_create(name, resolve, affectedHooks);
12469
13560
  },
12470
- VirtualModulesPlugin: VirtualModulesPlugin
12471
- }, src_fn = Object.assign(rspack, exports_namespaceObject);
13561
+ VirtualModulesPlugin: VirtualModulesPlugin,
13562
+ rsc: {
13563
+ createPlugins: ()=>{
13564
+ let coordinator = new Coordinator();
13565
+ return {
13566
+ ServerPlugin: class extends RscServerPlugin {
13567
+ constructor(options = {}){
13568
+ super({
13569
+ coordinator,
13570
+ ...options
13571
+ });
13572
+ }
13573
+ },
13574
+ ClientPlugin: class extends RscClientPlugin {
13575
+ constructor(){
13576
+ super({
13577
+ coordinator
13578
+ });
13579
+ }
13580
+ }
13581
+ };
13582
+ },
13583
+ Layers: {
13584
+ rsc: 'react-server-components',
13585
+ ssr: 'server-side-rendering'
13586
+ }
13587
+ }
13588
+ }, src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
12472
13589
  src_fn.rspack = src_fn, src_fn.webpack = src_fn;
12473
13590
  let src_rspack_0 = src_fn;
12474
13591
  var AsyncDependenciesBlock = binding_namespaceObject.AsyncDependenciesBlock, ConcatenatedModule = binding_namespaceObject.ConcatenatedModule, ContextModule = binding_namespaceObject.ContextModule, Dependency = binding_namespaceObject.Dependency, EntryDependency = binding_namespaceObject.EntryDependency, ExternalModule = binding_namespaceObject.ExternalModule, Module = binding_namespaceObject.Module, NormalModule = binding_namespaceObject.NormalModule;
12475
13592
  export default src_rspack_0;
12476
- export { AsyncDependenciesBlock, BannerPlugin, CaseSensitivePlugin, 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, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModule, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, SubresourceIntegrityPlugin, SwcJsMinimizerRspackPlugin, Template, ValidationError, container, electron, exports_WebpackError as WebpackError, exports_config as config, exports_experiments as experiments, 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_0 as rspack, statsFactoryUtils_StatsErrorCode as StatsErrorCode, util, web, webworker };
12477
-
12478
- export { src_rspack_0 as 'module.exports' }
13593
+ export { AsyncDependenciesBlock, BannerPlugin, CaseSensitivePlugin, 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, 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_0 as "module.exports", src_rspack_0 as rspack, statsFactoryUtils_StatsErrorCode as StatsErrorCode, util, web, webworker };