@rspack-debug/core 2.0.0-beta.6 → 2.0.0-beta.8

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.
@@ -433,6 +433,8 @@ export declare class Entries implements Map<string, EntryData> {
433
433
  has(key: string): boolean;
434
434
  set(key: string, value: EntryData): this;
435
435
  delete(key: string): boolean;
436
+ getOrInsert(key: string, defaultValue: EntryData): EntryData;
437
+ getOrInsertComputed(key: string, callback: (key: string) => EntryData): EntryData;
436
438
  get(key: string): EntryData | undefined;
437
439
  keys(): ReturnType<Map<string, EntryData>['keys']>;
438
440
  }
@@ -15,11 +15,19 @@ export type SwcLoaderOptions = Config & {
15
15
  * providing better TypeScript development experience and smaller output bundle size.
16
16
  */
17
17
  collectTypeScriptInfo?: CollectTypeScriptInfoOptions;
18
+ /**
19
+ * Ported from [babel-plugin-import](https://github.com/umijs/babel-plugin-import),
20
+ * used to transform imports for modular component libraries.
21
+ */
22
+ transformImport?: PluginImportOptions;
18
23
  /**
19
24
  * Experimental features provided by Rspack.
20
25
  * @experimental
21
26
  */
22
27
  rspackExperiments?: {
28
+ /**
29
+ * @deprecated Use top-level `transformImport` instead.
30
+ */
23
31
  import?: PluginImportOptions;
24
32
  /**
25
33
  * Enable React Server Components support.
@@ -0,0 +1,9 @@
1
+ export declare const EsmNodeTargetPlugin: {
2
+ new (): {
3
+ name: string;
4
+ _args: [];
5
+ affectedHooks: keyof import("../index.js").CompilerHooks | undefined;
6
+ raw(compiler: import("../index.js").Compiler): import("@rspack/binding").BuiltinPlugin;
7
+ apply(compiler: import("../index.js").Compiler): void;
8
+ };
9
+ };
@@ -1,10 +1,10 @@
1
- import { type JsRsdoctorAsset, type JsRsdoctorAssetPatch, type JsRsdoctorChunk, type JsRsdoctorChunkAssets, type JsRsdoctorChunkGraph, type JsRsdoctorChunkModules, type JsRsdoctorDependency, type JsRsdoctorEntrypoint, type JsRsdoctorEntrypointAssets, type JsRsdoctorExportInfo, type JsRsdoctorModule, type JsRsdoctorModuleGraph, type JsRsdoctorModuleGraphModule, type JsRsdoctorModuleIdsPatch, type JsRsdoctorModuleOriginalSource, type JsRsdoctorModuleSourcesPatch, type JsRsdoctorSideEffect, type JsRsdoctorSourcePosition, type JsRsdoctorSourceRange, type JsRsdoctorStatement, type JsRsdoctorVariable } from '@rspack/binding';
1
+ import { type JsRsdoctorAsset, type JsRsdoctorAssetPatch, type JsRsdoctorChunk, type JsRsdoctorChunkAssets, type JsRsdoctorChunkGraph, type JsRsdoctorChunkModules, type JsRsdoctorConnectionsOnlyImport, type JsRsdoctorConnectionsOnlyImportConnection, type JsRsdoctorDependency, type JsRsdoctorEntrypoint, type JsRsdoctorEntrypointAssets, type JsRsdoctorExportInfo, type JsRsdoctorModule, type JsRsdoctorModuleGraph, type JsRsdoctorModuleGraphModule, type JsRsdoctorModuleIdsPatch, type JsRsdoctorModuleOriginalSource, type JsRsdoctorModuleSourcesPatch, type JsRsdoctorSideEffect, type JsRsdoctorSourcePosition, type JsRsdoctorSourceRange, type JsRsdoctorStatement, type JsRsdoctorVariable } from '@rspack/binding';
2
2
  import * as liteTapable from '../../compiled/@rspack/lite-tapable/dist';
3
3
  import { type Compilation } from '../Compilation.js';
4
4
  import type { Compiler } from '../Compiler.js';
5
5
  import type { CreatePartialRegisters } from '../taps/types.js';
6
6
  export declare namespace RsdoctorPluginData {
7
- export type { JsRsdoctorAsset as RsdoctorAsset, JsRsdoctorChunkGraph as RsdoctorChunkGraph, JsRsdoctorModuleGraph as RsdoctorModuleGraph, JsRsdoctorChunk as RsdoctorChunk, JsRsdoctorModule as RsdoctorModule, JsRsdoctorSideEffect as RsdoctorSideEffect, JsRsdoctorExportInfo as RsdoctorExportInfo, JsRsdoctorVariable as RsdoctorVariable, JsRsdoctorDependency as RsdoctorDependency, JsRsdoctorEntrypoint as RsdoctorEntrypoint, JsRsdoctorStatement as RsdoctorStatement, JsRsdoctorSourceRange as RsdoctorSourceRange, JsRsdoctorSourcePosition as RsdoctorSourcePosition, JsRsdoctorModuleGraphModule as RsdoctorModuleGraphModule, JsRsdoctorModuleIdsPatch as RsdoctorModuleIdsPatch, JsRsdoctorModuleOriginalSource as RsdoctorModuleOriginalSource, JsRsdoctorAssetPatch as RsdoctorAssetPatch, JsRsdoctorChunkAssets as RsdoctorChunkAssets, JsRsdoctorEntrypointAssets as RsdoctorEntrypointAssets, JsRsdoctorChunkModules as RsdoctorChunkModules, JsRsdoctorModuleSourcesPatch as RsdoctorModuleSourcesPatch, };
7
+ export type { JsRsdoctorAsset as RsdoctorAsset, JsRsdoctorChunkGraph as RsdoctorChunkGraph, JsRsdoctorModuleGraph as RsdoctorModuleGraph, JsRsdoctorChunk as RsdoctorChunk, JsRsdoctorModule as RsdoctorModule, JsRsdoctorSideEffect as RsdoctorSideEffect, JsRsdoctorExportInfo as RsdoctorExportInfo, JsRsdoctorVariable as RsdoctorVariable, JsRsdoctorConnectionsOnlyImport as RsdoctorConnectionsOnlyImport, JsRsdoctorConnectionsOnlyImportConnection as RsdoctorConnectionsOnlyImportConnection, JsRsdoctorDependency as RsdoctorDependency, JsRsdoctorEntrypoint as RsdoctorEntrypoint, JsRsdoctorStatement as RsdoctorStatement, JsRsdoctorSourceRange as RsdoctorSourceRange, JsRsdoctorSourcePosition as RsdoctorSourcePosition, JsRsdoctorModuleGraphModule as RsdoctorModuleGraphModule, JsRsdoctorModuleIdsPatch as RsdoctorModuleIdsPatch, JsRsdoctorModuleOriginalSource as RsdoctorModuleOriginalSource, JsRsdoctorAssetPatch as RsdoctorAssetPatch, JsRsdoctorChunkAssets as RsdoctorChunkAssets, JsRsdoctorEntrypointAssets as RsdoctorEntrypointAssets, JsRsdoctorChunkModules as RsdoctorChunkModules, JsRsdoctorModuleSourcesPatch as RsdoctorModuleSourcesPatch, };
8
8
  }
9
9
  export type RsdoctorPluginOptions = {
10
10
  moduleGraphFeatures?: boolean | ('graph' | 'ids' | 'sources')[];
@@ -8,6 +8,7 @@ export declare class WorkerPlugin extends RspackBuiltinPlugin {
8
8
  private module;
9
9
  private workerPublicPath;
10
10
  name: BuiltinPluginName;
11
+ affectedHooks: "compilation";
11
12
  constructor(chunkLoading: ChunkLoading, wasmLoading: WasmLoading, module: OutputModule, workerPublicPath: WorkerPublicPath);
12
13
  raw(compiler: Compiler): BuiltinPlugin;
13
14
  }
@@ -28,6 +28,7 @@ export * from './EnableWasmLoadingPlugin.js';
28
28
  export * from './EnsureChunkConditionsPlugin.js';
29
29
  export * from './EntryPlugin.js';
30
30
  export * from './EsmLibraryPlugin.js';
31
+ export * from './EsmNodeTargetPlugin.js';
31
32
  export * from './EvalDevToolModulePlugin.js';
32
33
  export * from './EvalSourceMapDevToolPlugin.js';
33
34
  export * from './ExternalsPlugin.js';
@@ -2,9 +2,34 @@ import type binding from '@rspack/binding';
2
2
  import type { Compiler } from '../../index.js';
3
3
  import { RspackBuiltinPlugin } from '../base.js';
4
4
  import { type Coordinator } from './Coordinator.js';
5
+ /** Manifest export entry (server/client actions, module refs). */
6
+ export interface RscManifestExport {
7
+ id: string;
8
+ name: string;
9
+ chunks: string[];
10
+ async?: boolean;
11
+ }
12
+ /** Map of export name to manifest export. */
13
+ export type RscManifestNode = Record<string, RscManifestExport>;
14
+ /** Module loading config (prefix, crossOrigin). */
15
+ export interface RscModuleLoading {
16
+ prefix: string;
17
+ crossOrigin?: 'use-credentials' | '';
18
+ }
19
+ export interface RscManifestPerEntry {
20
+ serverManifest: Record<string, RscManifestExport>;
21
+ clientManifest: Record<string, RscManifestExport>;
22
+ serverConsumerModuleMap: Record<string, RscManifestNode>;
23
+ moduleLoading: RscModuleLoading;
24
+ entryCssFiles: Record<string, string[]>;
25
+ entryJsFiles: string[];
26
+ }
27
+ /** Full RSC manifest (all entries) passed to onManifest. Map from entry name to per-entry manifest. */
28
+ export type RscManifest = Record<string, RscManifestPerEntry>;
5
29
  export type RscServerPluginOptions = {
6
30
  coordinator: Coordinator;
7
31
  onServerComponentChanges?: () => Promise<void>;
32
+ onManifest?: (manifest: RscManifest) => void | Promise<void>;
8
33
  };
9
34
  export declare class RscServerPlugin extends RspackBuiltinPlugin {
10
35
  #private;
@@ -10,7 +10,7 @@
10
10
  import type { ReadStream } from 'node:fs';
11
11
  import type { IncomingMessage, ServerResponse } from 'node:http';
12
12
  import type { ServerOptions } from 'node:https';
13
- import type { Server as ConnectApplication } from '../../compiled/connect-next';
13
+ import type { Server as ConnectApplication, NextFunction } from '../../compiled/connect-next';
14
14
  import type { Filter as ProxyFilter, Options as ProxyOptions } from '../../compiled/http-proxy-middleware';
15
15
  import type { Options as OpenOptions } from '../../compiled/open';
16
16
  import type { Compiler, Configuration, LiteralUnion, MultiCompiler, MultiStats, Stats, Watching } from '../index.js';
@@ -18,12 +18,14 @@ type Logger = ReturnType<Compiler['getInfrastructureLogger']>;
18
18
  type MultiWatching = MultiCompiler['watch'];
19
19
  export type DevServerHost = LiteralUnion<'local-ip' | 'local-ipv4' | 'local-ipv6', string>;
20
20
  type BasicServer = import('node:net').Server | import('node:tls').Server;
21
- export type DevServerOpenOptions = OpenOptions;
21
+ export type DevServerOpenOptions = OpenOptions & {
22
+ target?: string | string[];
23
+ };
22
24
  type ResponseData = {
23
25
  data: Buffer | ReadStream;
24
26
  byteLength: number;
25
27
  };
26
- type ModifyResponseData<RequestInternal extends IncomingMessage = IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = (req: RequestInternal, res: ResponseInternal, data: Buffer | ReadStream, byteLength: number) => ResponseData;
28
+ type ModifyResponseData<Req extends IncomingMessage = IncomingMessage, Res extends ServerResponse = ServerResponse> = (req: Req, res: Res, data: Buffer | ReadStream, byteLength: number) => ResponseData;
27
29
  export type DevServerHeaders = {
28
30
  key: string;
29
31
  value: string;
@@ -51,7 +53,7 @@ type HistoryApiFallbackOptions = {
51
53
  readonly rewrites?: readonly Rewrite[];
52
54
  readonly verbose?: boolean;
53
55
  };
54
- type DevMiddlewareOptions<RequestInternal extends IncomingMessage = IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = {
56
+ type DevMiddlewareOptions<Req extends IncomingMessage = IncomingMessage, Res extends ServerResponse = ServerResponse> = {
55
57
  mimeTypes?: {
56
58
  [key: string]: string;
57
59
  };
@@ -64,7 +66,7 @@ type DevMiddlewareOptions<RequestInternal extends IncomingMessage = IncomingMess
64
66
  serverSideRender?: boolean;
65
67
  outputFileSystem?: OutputFileSystem;
66
68
  index?: string | boolean;
67
- modifyResponseData?: ModifyResponseData<RequestInternal, ResponseInternal>;
69
+ modifyResponseData?: ModifyResponseData<Req, Res>;
68
70
  etag?: 'strong' | 'weak';
69
71
  lastModified?: boolean;
70
72
  cacheControl?: string | number | boolean | {
@@ -77,9 +79,6 @@ type BasicApplication = any;
77
79
  type ChokidarWatchOptions = {
78
80
  [key: string]: any;
79
81
  };
80
- type ServeIndexOptions = {
81
- [key: string]: any;
82
- };
83
82
  type ServeStaticOptions = {
84
83
  [key: string]: any;
85
84
  };
@@ -87,20 +86,14 @@ type WatchFiles = {
87
86
  paths: string | string[];
88
87
  options?: ChokidarWatchOptions & {
89
88
  aggregateTimeout?: number;
90
- ignored?: ChokidarWatchOptions['ignored'];
91
89
  poll?: number | boolean;
92
90
  };
93
91
  };
94
92
  export type DevServerStaticItem = {
95
93
  directory?: string;
96
94
  publicPath?: string | string[];
97
- serveIndex?: boolean | ServeIndexOptions;
98
95
  staticOptions?: ServeStaticOptions;
99
- watch?: boolean | (ChokidarWatchOptions & {
100
- aggregateTimeout?: number;
101
- ignored?: ChokidarWatchOptions['ignored'];
102
- poll?: number | boolean;
103
- });
96
+ watch?: boolean | NonNullable<WatchFiles['options']>;
104
97
  };
105
98
  export type DevServerStatic = string | boolean | DevServerStaticItem | (string | DevServerStaticItem)[];
106
99
  type ServerType<A extends BasicApplication, S extends BasicServer> = LiteralUnion<'http' | 'https' | 'http2', string> | ((arg0: ServerOptions, arg1: A) => S);
@@ -112,7 +105,6 @@ type WebSocketServerConfiguration = {
112
105
  type?: string | Function;
113
106
  options?: Record<string, any>;
114
107
  };
115
- type NextFunction = (err?: any) => void;
116
108
  export type DevServerProxyConfigArrayItem = {
117
109
  /**
118
110
  * Alias for `pathFilter` in `http-proxy-middleware` options.
@@ -122,7 +114,7 @@ export type DevServerProxyConfigArrayItem = {
122
114
  } & ProxyOptions;
123
115
  export type DevServerProxyConfigArray = (DevServerProxyConfigArrayItem | ((req?: IncomingMessage, res?: ServerResponse, next?: NextFunction) => DevServerProxyConfigArrayItem))[];
124
116
  type Callback = (stats?: Stats | MultiStats) => any;
125
- type DevMiddlewareContext<_RequestInternal extends IncomingMessage = IncomingMessage, _ResponseInternal extends ServerResponse = ServerResponse> = {
117
+ type DevMiddlewareContext = {
126
118
  state: boolean;
127
119
  stats: Stats | MultiStats | undefined;
128
120
  callbacks: Callback[];
@@ -132,13 +124,14 @@ type DevMiddlewareContext<_RequestInternal extends IncomingMessage = IncomingMes
132
124
  logger: Logger;
133
125
  outputFileSystem: OutputFileSystem;
134
126
  };
135
- export type DevServerMiddlewareHandler<RequestInternal extends IncomingMessage = IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = (req: RequestInternal, res: ResponseInternal, next: NextFunction) => void | Promise<void>;
136
- type DevServerMiddlewareObject<RequestInternal extends IncomingMessage = IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = {
127
+ export type DevServerMiddlewareHandler<Req extends IncomingMessage = IncomingMessage, Res extends ServerResponse = ServerResponse> = (req: Req, res: Res, next: NextFunction) => void | Promise<void>;
128
+ export type DevServerMiddlewareErrorHandler<Req extends IncomingMessage = IncomingMessage, Res extends ServerResponse = ServerResponse> = (error: any, req: Req, res: Res, next: NextFunction) => void | Promise<void>;
129
+ export type DevServerMiddlewareObject<Req extends IncomingMessage = IncomingMessage, Res extends ServerResponse = ServerResponse> = {
137
130
  name?: string;
138
131
  path?: string;
139
- middleware: DevServerMiddlewareHandler<RequestInternal, ResponseInternal>;
132
+ middleware: DevServerMiddlewareHandler<Req, Res> | DevServerMiddlewareErrorHandler<Req, Res>;
140
133
  };
141
- export type DevServerMiddleware = DevServerMiddlewareObject | DevServerMiddlewareHandler;
134
+ export type DevServerMiddleware = DevServerMiddlewareObject | DevServerMiddlewareHandler | DevServerMiddlewareErrorHandler;
142
135
  type OverlayMessageOptions = boolean | ((error: Error) => void);
143
136
  export type DevServerWebSocketURL = {
144
137
  hostname?: string;
@@ -176,7 +169,7 @@ export type DevServerOptions<A extends BasicApplication = ConnectApplication, S
176
169
  app?: () => Promise<A>;
177
170
  webSocketServer?: boolean | LiteralUnion<'ws', string> | WebSocketServerConfiguration;
178
171
  proxy?: DevServerProxyConfigArray;
179
- open?: string | boolean | OpenOptions | (string | OpenOptions)[];
172
+ open?: string | boolean | DevServerOpenOptions | (string | DevServerOpenOptions)[];
180
173
  setupExitSignals?: boolean;
181
174
  client?: boolean | DevServerClient;
182
175
  headers?: DevServerHeaders | ((req: IncomingMessage, res: ServerResponse, context: DevMiddlewareContext | undefined) => DevServerHeaders);
@@ -592,7 +592,6 @@ export type ResolveOptions = {
592
592
  restrictions?: string[];
593
593
  /**
594
594
  * A list of directories where server-relative URLs (beginning with '/') are resolved.
595
- * It defaults to the context configuration option.
596
595
  * On systems other than Windows, these requests are initially resolved as an absolute path.
597
596
  * @default []
598
597
  */
@@ -601,8 +600,6 @@ export type ResolveOptions = {
601
600
  byDependency?: Record<string, ResolveOptions>;
602
601
  /** enable Yarn PnP */
603
602
  pnp?: boolean;
604
- /** Path to PnP manifest file */
605
- pnpManifest?: string | false;
606
603
  };
607
604
  /** Used to configure the Rspack module resolution */
608
605
  export type Resolve = ResolveOptions;
@@ -1934,8 +1931,6 @@ export type Optimization = {
1934
1931
  * @default false
1935
1932
  */
1936
1933
  runtimeChunk?: OptimizationRuntimeChunk;
1937
- /** Detect and remove modules from chunks these modules are already included in all parents. */
1938
- removeAvailableModules?: boolean;
1939
1934
  /**
1940
1935
  * Remove empty chunks generated in the compilation.
1941
1936
  * @default true
@@ -2232,7 +2227,7 @@ export type WatchOptions = {
2232
2227
  * Options for dev server
2233
2228
  * */
2234
2229
  export type DevServer = DevServerOptions;
2235
- export type { DevServerClient, DevServerHeaders, DevServerHost, DevServerMiddleware, DevServerMiddlewareHandler, DevServerOpenOptions, DevServerProxyConfigArray, DevServerProxyConfigArrayItem, DevServerStatic, DevServerStaticItem, DevServerWebSocketURL, } from './devServer.js';
2230
+ export type { DevServerClient, DevServerHeaders, DevServerHost, DevServerMiddleware, DevServerMiddlewareHandler, DevServerMiddlewareObject, DevServerOpenOptions, DevServerProxyConfigArray, DevServerProxyConfigArrayItem, DevServerStatic, DevServerStaticItem, DevServerWebSocketURL, } from './devServer.js';
2236
2231
  /**
2237
2232
  * Ignore specific warnings.
2238
2233
  */
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import node_path, { isAbsolute, join, relative, resolve as external_node_path_re
8
8
  import node_querystring from "node:querystring";
9
9
  import node_fs, { readFileSync } from "node:fs";
10
10
  __webpack_require__.add({
11
- "../../node_modules/.pnpm/enhanced-resolve@5.19.0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js" (module, __unused_rspack_exports, __webpack_require__) {
11
+ "../../node_modules/.pnpm/enhanced-resolve@5.20.1/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js" (module, __unused_rspack_exports, __webpack_require__) {
12
12
  let { nextTick } = __webpack_require__("process"), dirname = (path)=>{
13
13
  let idx = path.length - 1;
14
14
  for(; idx >= 0;){
@@ -784,7 +784,7 @@ let cutOffLoaderExecution = (stack)=>((stack, flag)=>{
784
784
  for(let i = 0; i < stacks.length; i++)stacks[i].includes(flag) && (stacks.length = i);
785
785
  return stacks.join('\n');
786
786
  })(stack, 'LOADER_EXECUTION');
787
- class WebpackError extends Error {
787
+ class WebpackError_WebpackError extends Error {
788
788
  loc;
789
789
  file;
790
790
  chunk;
@@ -792,14 +792,14 @@ class WebpackError extends Error {
792
792
  details;
793
793
  hideStack;
794
794
  }
795
- Object.defineProperty(WebpackError.prototype, inspect.custom, {
795
+ Object.defineProperty(WebpackError_WebpackError.prototype, inspect.custom, {
796
796
  value: function() {
797
797
  return this.stack + (this.details ? `\n${this.details}` : '');
798
798
  },
799
799
  enumerable: !1,
800
800
  configurable: !0
801
801
  });
802
- let lib_WebpackError = WebpackError, LogType = Object.freeze({
802
+ let lib_WebpackError = WebpackError_WebpackError, LogType = Object.freeze({
803
803
  error: 'error',
804
804
  warn: 'warn',
805
805
  info: 'info',
@@ -1554,7 +1554,8 @@ class MergeCaller {
1554
1554
  return this.callArgs;
1555
1555
  }
1556
1556
  push(...data) {
1557
- 0 === this.callArgs.length && queueMicrotask(this.finalCall), this.callArgs.push(...data);
1557
+ 0 === this.callArgs.length && queueMicrotask(this.finalCall);
1558
+ for(let i = 0; i < data.length; i++)this.callArgs.push(data[i]);
1558
1559
  }
1559
1560
  }
1560
1561
  function createFakeCompilationDependencies(getDeps, addDeps) {
@@ -2361,6 +2362,12 @@ class Entries {
2361
2362
  delete(key) {
2362
2363
  return this.#data.delete(key);
2363
2364
  }
2365
+ getOrInsert(key, defaultValue) {
2366
+ return this.has(key) || this.set(key, defaultValue), this.get(key);
2367
+ }
2368
+ getOrInsertComputed(key, callback) {
2369
+ return this.has(key) || this.set(key, callback(key)), this.get(key);
2370
+ }
2364
2371
  get(key) {
2365
2372
  let binding = this.#data.get(key);
2366
2373
  return binding ? EntryData.__from_binding(binding) : void 0;
@@ -2654,28 +2661,6 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
2654
2661
  }
2655
2662
  }
2656
2663
  }
2657
- let EnableLibraryPlugin_enabledTypes = new WeakMap(), EnableLibraryPlugin_getEnabledTypes = (compiler)=>{
2658
- let set = EnableLibraryPlugin_enabledTypes.get(compiler);
2659
- return void 0 === set && (set = new Set(), EnableLibraryPlugin_enabledTypes.set(compiler, set)), set;
2660
- };
2661
- class EnableLibraryPlugin extends RspackBuiltinPlugin {
2662
- type;
2663
- name = binding_namespaceObject.BuiltinPluginName.EnableLibraryPlugin;
2664
- constructor(type){
2665
- super(), this.type = type;
2666
- }
2667
- static setEnabled(compiler, type) {
2668
- EnableLibraryPlugin_getEnabledTypes(compiler).add(type);
2669
- }
2670
- static checkEnabled(compiler, type) {
2671
- if (!EnableLibraryPlugin_getEnabledTypes(compiler).has(type)) throw Error(`Library type "${type}" is not enabled. EnableLibraryPlugin need to be used to enable this type of library. This usually happens through the "output.enabledLibraryTypes" option. If you are using a function as entry which sets "library", you need to add all potential library types to "output.enabledLibraryTypes". These types are enabled: ${Array.from(EnableLibraryPlugin_getEnabledTypes(compiler)).join(', ')}`);
2672
- }
2673
- raw(compiler) {
2674
- let type = this.type, enabled = EnableLibraryPlugin_getEnabledTypes(compiler);
2675
- if (!enabled.has(type)) return enabled.add(type), createBuiltinPlugin(this.name, type);
2676
- }
2677
- }
2678
- let EnableWasmLoadingPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EnableWasmLoadingPlugin, (type)=>type), EnsureChunkConditionsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EnsureChunkConditionsPlugin, ()=>{}), RemoveDuplicateModulesPlugin = base_create(binding_namespaceObject.BuiltinPluginName.RemoveDuplicateModulesPlugin, ()=>({}));
2679
2664
  class JsSplitChunkSizes {
2680
2665
  static __to_binding(sizes) {
2681
2666
  return 'number' == typeof sizes ? sizes : sizes && 'object' == typeof sizes ? {
@@ -2691,12 +2676,12 @@ class SplitChunksPlugin extends RspackBuiltinPlugin {
2691
2676
  super(), this.options = options;
2692
2677
  }
2693
2678
  raw(compiler) {
2694
- let rawOptions = toRawSplitChunksOptions(this.options, compiler);
2679
+ let rawOptions = SplitChunksPlugin_toRawSplitChunksOptions(this.options, compiler);
2695
2680
  if (void 0 === rawOptions) throw Error('rawOptions should not be undefined');
2696
2681
  return createBuiltinPlugin(this.name, rawOptions);
2697
2682
  }
2698
2683
  }
2699
- function toRawSplitChunksOptions(sc, compiler) {
2684
+ function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler) {
2700
2685
  if (!sc) return;
2701
2686
  function getName(name) {
2702
2687
  return 'function' == typeof name ? (ctx)=>void 0 === ctx.module ? name(void 0) : name(ctx.module, getChunks(ctx.chunks), ctx.cacheGroupKey) : name;
@@ -2745,30 +2730,33 @@ function toRawSplitChunksOptions(sc, compiler) {
2745
2730
  ...passThrough
2746
2731
  };
2747
2732
  }
2748
- function applyLimits(options) {
2749
- 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');
2750
- let { splitChunks } = options.optimization;
2751
- 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);
2752
- }
2753
- class EsmLibraryPlugin {
2754
- static PLUGIN_NAME = 'EsmLibraryPlugin';
2755
- options;
2756
- constructor(options){
2757
- this.options = options ?? {};
2733
+ let EnableLibraryPlugin_enabledTypes = new WeakMap(), EnableLibraryPlugin_getEnabledTypes = (compiler)=>{
2734
+ let set = EnableLibraryPlugin_enabledTypes.get(compiler);
2735
+ return void 0 === set && (set = new Set(), EnableLibraryPlugin_enabledTypes.set(compiler, set)), set;
2736
+ };
2737
+ class EnableLibraryPlugin extends RspackBuiltinPlugin {
2738
+ type;
2739
+ name = binding_namespaceObject.BuiltinPluginName.EnableLibraryPlugin;
2740
+ constructor(type){
2741
+ super(), this.type = type;
2758
2742
  }
2759
- apply(compiler) {
2760
- var config;
2761
- let err;
2762
- if (applyLimits(compiler.options), new RemoveDuplicateModulesPlugin().apply(compiler), err = (config = compiler.options).optimization.concatenateModules ? 'You should disable `config.optimization.concatenateModules`' : !1 !== config.output.chunkFormat ? 'You should disable default chunkFormat by `config.output.chunkFormat = false`' : void 0) throw new lib_WebpackError(`Conflicted config for ${EsmLibraryPlugin.PLUGIN_NAME}: ${err}`);
2763
- compiler.__internal__registerBuiltinPlugin({
2764
- name: binding_namespaceObject.BuiltinPluginName.EsmLibraryPlugin,
2765
- options: {
2766
- preserveModules: this.options.preserveModules,
2767
- splitChunks: toRawSplitChunksOptions(this.options.splitChunks ?? !1, compiler)
2768
- }
2743
+ static setEnabled(compiler, type) {
2744
+ EnableLibraryPlugin_getEnabledTypes(compiler).add(type);
2745
+ }
2746
+ static checkEnabled(compiler, type) {
2747
+ if (!EnableLibraryPlugin_getEnabledTypes(compiler).has(type)) throw Error(`Library type "${type}" is not enabled. EnableLibraryPlugin need to be used to enable this type of library. This usually happens through the "output.enabledLibraryTypes" option. If you are using a function as entry which sets "library", you need to add all potential library types to "output.enabledLibraryTypes". These types are enabled: ${Array.from(EnableLibraryPlugin_getEnabledTypes(compiler)).join(', ')}`);
2748
+ }
2749
+ raw(compiler) {
2750
+ let type = this.type, enabled = EnableLibraryPlugin_getEnabledTypes(compiler);
2751
+ if (!enabled.has(type)) return enabled.add(type), createBuiltinPlugin(this.name, {
2752
+ libraryType: type,
2753
+ preserveModules: compiler.options.output.library?.preserveModules,
2754
+ splitChunks: SplitChunksPlugin_toRawSplitChunksOptions(compiler.options.optimization.splitChunks ?? !1, compiler)
2769
2755
  });
2770
2756
  }
2771
2757
  }
2758
+ 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, ()=>({}));
2759
+ base_create(binding_namespaceObject.BuiltinPluginName.EsmNodeTargetPlugin, ()=>void 0);
2772
2760
  let EvalDevToolModulePlugin = base_create(binding_namespaceObject.BuiltinPluginName.EvalDevToolModulePlugin, (options)=>options, 'compilation'), EvalSourceMapDevToolPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EvalSourceMapDevToolPlugin, (options)=>options, 'compilation');
2773
2761
  function isNil(value) {
2774
2762
  return null == value;
@@ -2982,6 +2970,25 @@ function toFeatures(featureOptions) {
2982
2970
  }
2983
2971
  return feature;
2984
2972
  }
2973
+ function resolvePluginImport(pluginImport) {
2974
+ if (pluginImport) return pluginImport.map((config)=>{
2975
+ let rawConfig = {
2976
+ ...config,
2977
+ style: {}
2978
+ };
2979
+ if ('boolean' == typeof config.style) rawConfig.style.bool = config.style;
2980
+ else if ('string' == typeof config.style) {
2981
+ let isTpl = config.style.includes('{{');
2982
+ rawConfig.style[isTpl ? 'custom' : 'css'] = config.style;
2983
+ } else {
2984
+ var val;
2985
+ val = config.style, '[object Object]' === Object.prototype.toString.call(val) && (rawConfig.style = config.style);
2986
+ }
2987
+ return config.styleLibraryDirectory && (rawConfig.style = {
2988
+ styleLibraryDirectory: config.styleLibraryDirectory
2989
+ }), rawConfig;
2990
+ });
2991
+ }
2985
2992
  let $assets = Symbol('assets');
2986
2993
  Object.defineProperty(binding_default().KnownBuildInfo.prototype, node_util.inspect.custom, {
2987
2994
  enumerable: !0,
@@ -4180,27 +4187,9 @@ function createRawModuleRuleUses(uses, path, options) {
4180
4187
  options.collectTypeScriptInfo && (options.collectTypeScriptInfo = {
4181
4188
  typeExports: (options1 = options.collectTypeScriptInfo).typeExports,
4182
4189
  exportedEnum: !0 === options1.exportedEnum ? 'all' : !1 === options1.exportedEnum || void 0 === options1.exportedEnum ? 'none' : 'const-only'
4183
- });
4190
+ }), options.transformImport && (options.transformImport = resolvePluginImport(options.transformImport));
4184
4191
  let { rspackExperiments } = options;
4185
- rspackExperiments && (rspackExperiments.import || rspackExperiments.pluginImport) && (rspackExperiments.import = function(pluginImport) {
4186
- if (pluginImport) return pluginImport.map((config)=>{
4187
- let rawConfig = {
4188
- ...config,
4189
- style: {}
4190
- };
4191
- if ('boolean' == typeof config.style) rawConfig.style.bool = config.style;
4192
- else if ('string' == typeof config.style) {
4193
- let isTpl = config.style.includes('{{');
4194
- rawConfig.style[isTpl ? 'custom' : 'css'] = config.style;
4195
- } else {
4196
- var val;
4197
- val = config.style, '[object Object]' === Object.prototype.toString.call(val) && (rawConfig.style = config.style);
4198
- }
4199
- return config.styleLibraryDirectory && (rawConfig.style = {
4200
- styleLibraryDirectory: config.styleLibraryDirectory
4201
- }), rawConfig;
4202
- });
4203
- }(rspackExperiments.import || rspackExperiments.pluginImport));
4192
+ rspackExperiments && (rspackExperiments.import || rspackExperiments.pluginImport) && (rspackExperiments.import = resolvePluginImport(rspackExperiments.import || rspackExperiments.pluginImport));
4204
4193
  }
4205
4194
  return options;
4206
4195
  })(o, options);
@@ -5149,9 +5138,13 @@ class RscServerPlugin extends RspackBuiltinPlugin {
5149
5138
  super(), this.#options = options;
5150
5139
  }
5151
5140
  raw(compiler) {
5152
- return this.#options.coordinator.applyServerCompiler(compiler), createBuiltinPlugin(this.name, {
5153
- coordinator: this.#options.coordinator[GET_OR_INIT_BINDING](),
5154
- onServerComponentChanges: this.#options.onServerComponentChanges
5141
+ let onManifest;
5142
+ this.#options.coordinator.applyServerCompiler(compiler);
5143
+ let { coordinator, onServerComponentChanges } = this.#options;
5144
+ return this.#options.onManifest && (onManifest = (json)=>Promise.resolve(this.#options.onManifest(JSON.parse(json)))), createBuiltinPlugin(this.name, {
5145
+ coordinator: coordinator[GET_OR_INIT_BINDING](),
5146
+ onServerComponentChanges,
5147
+ onManifest
5155
5148
  });
5156
5149
  }
5157
5150
  }
@@ -5356,6 +5349,7 @@ class WorkerPlugin extends RspackBuiltinPlugin {
5356
5349
  module;
5357
5350
  workerPublicPath;
5358
5351
  name = binding_namespaceObject.BuiltinPluginName.WorkerPlugin;
5352
+ affectedHooks = 'compilation';
5359
5353
  constructor(chunkLoading, wasmLoading, module, workerPublicPath){
5360
5354
  super(), this.chunkLoading = chunkLoading, this.wasmLoading = wasmLoading, this.module = module, this.workerPublicPath = workerPublicPath;
5361
5355
  }
@@ -6514,7 +6508,6 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6514
6508
  }), F(options, 'performance', ()=>!!production && !!targetProperties && (!!targetProperties.browser || null === targetProperties.browser) && {}), applyPerformanceDefaults(options.performance, {
6515
6509
  production
6516
6510
  }), options.resolve = cleverMerge(getResolveDefaults({
6517
- context: options.context,
6518
6511
  targetProperties,
6519
6512
  mode: options.mode
6520
6513
  }), options.resolve), options.resolveLoader = cleverMerge(getResolveLoaderDefaults(), options.resolveLoader), !1 === targetProperties ? targetProperties : {
@@ -6684,7 +6677,11 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6684
6677
  let enabledLibraryTypes = [];
6685
6678
  return output.library && enabledLibraryTypes.push(output.library.type), forEachEntry((desc)=>{
6686
6679
  desc.library && enabledLibraryTypes.push(desc.library.type);
6687
- }), enabledLibraryTypes.includes('modern-module') && applyLimits(options), enabledLibraryTypes;
6680
+ }), enabledLibraryTypes.includes('modern-module') && function(options) {
6681
+ 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');
6682
+ let { splitChunks } = options.optimization;
6683
+ 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);
6684
+ }(options), enabledLibraryTypes;
6688
6685
  }), D(output, 'module', [
6689
6686
  'modern-module',
6690
6687
  'module'
@@ -6810,7 +6807,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6810
6807
  return output.wasmLoading && enabledWasmLoadingTypes.add(output.wasmLoading), output.workerWasmLoading && enabledWasmLoadingTypes.add(output.workerWasmLoading), forEachEntry((desc)=>{
6811
6808
  desc.wasmLoading && enabledWasmLoadingTypes.add(desc.wasmLoading);
6812
6809
  }), Array.from(enabledWasmLoadingTypes);
6813
- }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.0-beta.6"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !output.library));
6810
+ }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.0-beta.8"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !output.library));
6814
6811
  }, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp, outputModule })=>{
6815
6812
  let isUniversal = (key)=>!!(outputModule && targetProperties && null === targetProperties[key]);
6816
6813
  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')));
@@ -6828,7 +6825,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6828
6825
  }, applyPerformanceDefaults = (performance, { production })=>{
6829
6826
  !1 !== performance && (D(performance, 'maxAssetSize', 250000), D(performance, 'maxEntrypointSize', 250000), F(performance, 'hints', ()=>!!production && 'warning'));
6830
6827
  }, applyOptimizationDefaults = (optimization, { production, development })=>{
6831
- 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', ()=>[
6828
+ 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', ()=>[
6832
6829
  new SwcJsMinimizerRspackPlugin(),
6833
6830
  new LightningCssMinimizerRspackPlugin()
6834
6831
  ]), F(optimization, 'nodeEnv', ()=>production ? 'production' : !!development && 'development');
@@ -6871,15 +6868,14 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6871
6868
  mainFiles: [
6872
6869
  'index'
6873
6870
  ]
6874
- }), getResolveDefaults = ({ context, targetProperties, mode })=>{
6871
+ }), getResolveDefaults = ({ targetProperties, mode })=>{
6875
6872
  let conditions = [
6876
6873
  'webpack'
6877
6874
  ];
6878
6875
  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'));
6879
6876
  let jsExtensions = [
6880
6877
  '.js',
6881
- '.json',
6882
- '.wasm'
6878
+ '.json'
6883
6879
  ], browserField = targetProperties && targetProperties.web && (!targetProperties.node || targetProperties.electron && targetProperties.electronRenderer), aliasFields = browserField ? [
6884
6880
  'browser'
6885
6881
  ] : [], mainFields = browserField ? [
@@ -6925,9 +6921,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6925
6921
  exportsFields: [
6926
6922
  'exports'
6927
6923
  ],
6928
- roots: [
6929
- context
6930
- ],
6924
+ roots: [],
6931
6925
  mainFields: [
6932
6926
  'main'
6933
6927
  ],
@@ -6950,14 +6944,17 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6950
6944
  loader: cjsDeps(),
6951
6945
  unknown: cjsDeps()
6952
6946
  }
6953
- }, styleConditions = [];
6954
- return styleConditions.push('webpack'), styleConditions.push('development' === mode ? 'development' : 'production'), styleConditions.push('style'), resolveOptions.byDependency['css-import'] = {
6947
+ };
6948
+ return resolveOptions.byDependency['css-import'] = {
6955
6949
  mainFiles: [],
6956
6950
  mainFields: [
6957
6951
  'style',
6958
6952
  '...'
6959
6953
  ],
6960
- conditionNames: styleConditions,
6954
+ conditionNames: [
6955
+ 'development' === mode ? 'development' : 'production',
6956
+ 'style'
6957
+ ],
6961
6958
  extensions: [
6962
6959
  '.css'
6963
6960
  ],
@@ -8064,7 +8061,7 @@ class MultiStats {
8064
8061
  obj.children = this.stats.map((stat, idx)=>{
8065
8062
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
8066
8063
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
8067
- }), childOptions.version && (obj.rspackVersion = "2.0.0-beta.6", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
8064
+ }), childOptions.version && (obj.rspackVersion = "2.0.0-beta.8", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
8068
8065
  let mapError = (j, obj)=>({
8069
8066
  ...obj,
8070
8067
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -8561,7 +8558,7 @@ let arraySum = (array)=>{
8561
8558
  let str = `${a}`, length = lengths[i];
8562
8559
  return str.length === length ? str : length > 5 ? `...${str.slice(-length + 3)}` : length > 0 ? str.slice(-length) : '';
8563
8560
  });
8564
- }, CachedInputFileSystem = __webpack_require__("../../node_modules/.pnpm/enhanced-resolve@5.19.0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js");
8561
+ }, CachedInputFileSystem = __webpack_require__("../../node_modules/.pnpm/enhanced-resolve@5.20.1/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js");
8565
8562
  var CachedInputFileSystem_default = __webpack_require__.n(CachedInputFileSystem);
8566
8563
  class NodeEnvironmentPlugin {
8567
8564
  options;
@@ -9323,7 +9320,7 @@ let iterateConfig = (config, options, fn)=>{
9323
9320
  object.hash = context.getStatsCompilation(compilation).hash;
9324
9321
  },
9325
9322
  version: (object)=>{
9326
- object.version = "5.75.0", object.rspackVersion = "2.0.0-beta.6";
9323
+ object.version = "5.75.0", object.rspackVersion = "2.0.0-beta.8";
9327
9324
  },
9328
9325
  env: (object, _compilation, _context, { _env })=>{
9329
9326
  object.env = _env;
@@ -10588,16 +10585,8 @@ class RspackOptionsApply {
10588
10585
  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);
10589
10586
  let enableLibSplitChunks = !1;
10590
10587
  if (options.output.enabledLibraryTypes && options.output.enabledLibraryTypes.length > 0) {
10591
- let modernModuleCount = 0;
10592
- for (let type of options.output.enabledLibraryTypes)'modern-module' === type && modernModuleCount++;
10593
- if (options.output.library?.preserveModules && 0 === modernModuleCount) throw Error('preserveModules only works for `modern-module` library type');
10594
- if (modernModuleCount > 0) {
10595
- if (modernModuleCount !== options.output.enabledLibraryTypes.length) throw Error('`modern-module` cannot used together with other library types');
10596
- enableLibSplitChunks = !0, new EsmLibraryPlugin({
10597
- preserveModules: options.output.library?.preserveModules,
10598
- splitChunks: options.optimization.splitChunks
10599
- }).apply(compiler);
10600
- } else for (let type of options.output.enabledLibraryTypes)new EnableLibraryPlugin(type).apply(compiler);
10588
+ let hasModernModule = options.output.enabledLibraryTypes.includes('modern-module'), hasNonModernModule = options.output.enabledLibraryTypes.some((t)=>'modern-module' !== t);
10589
+ 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);
10601
10590
  }
10602
10591
  !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);
10603
10592
  let moduleIds = options.optimization.moduleIds;
@@ -10988,7 +10977,7 @@ class TraceHookPlugin {
10988
10977
  });
10989
10978
  }
10990
10979
  }
10991
- let CORE_VERSION = "2.0.0-beta.6", VFILES_BY_COMPILER = new WeakMap();
10980
+ let CORE_VERSION = "2.0.0-beta.8", VFILES_BY_COMPILER = new WeakMap();
10992
10981
  class VirtualModulesPlugin {
10993
10982
  #staticModules;
10994
10983
  #compiler;
@@ -11489,7 +11478,8 @@ class Compiler {
11489
11478
  }) : this.hooks.shutdown.callAsync((err)=>{
11490
11479
  if (err) return callback(err);
11491
11480
  this.cache.shutdown(()=>{
11492
- this.#instance?.close(), callback();
11481
+ let closePromise = this.#instance?.close();
11482
+ closePromise ? closePromise.then(()=>callback(), callback) : callback();
11493
11483
  });
11494
11484
  });
11495
11485
  }
@@ -13282,7 +13272,7 @@ async function transform(source, options) {
13282
13272
  let _options = JSON.stringify(options || {});
13283
13273
  return binding_default().transform(source, _options);
13284
13274
  }
13285
- let exports_rspackVersion = "2.0.0-beta.6", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
13275
+ let exports_rspackVersion = "2.0.0-beta.8", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
13286
13276
  getNormalizedRspackOptions: getNormalizedRspackOptions,
13287
13277
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
13288
13278
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -13456,7 +13446,7 @@ let exports_rspackVersion = "2.0.0-beta.6", exports_version = "5.75.0", exports_
13456
13446
  await JavaScriptTracer.cleanupJavaScriptTrace(), (0, binding_namespaceObject.syncTraceEvent)(JavaScriptTracer.events), (0, binding_namespaceObject.cleanupGlobalTrace)();
13457
13447
  }
13458
13448
  },
13459
- RemoveDuplicateModulesPlugin: RemoveDuplicateModulesPlugin,
13449
+ RemoveDuplicateModulesPlugin: RemoveDuplicateModulesPlugin_RemoveDuplicateModulesPlugin,
13460
13450
  RsdoctorPlugin: RsdoctorPluginImpl,
13461
13451
  RstestPlugin: RstestPlugin,
13462
13452
  RslibPlugin: RslibPlugin,
@@ -7,9 +7,7 @@ function __webpack_require__(moduleId) {
7
7
  };
8
8
  return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
9
9
  }
10
- __webpack_require__.m = __webpack_modules__, __webpack_require__.add = function(modules) {
11
- Object.assign(__webpack_require__.m, modules);
12
- }, __webpack_require__.n = (module)=>{
10
+ __webpack_require__.m = __webpack_modules__, __webpack_require__.n = (module)=>{
13
11
  var getter = module && module.__esModule ? ()=>module.default : ()=>module;
14
12
  return __webpack_require__.d(getter, {
15
13
  a: getter
@@ -19,6 +17,8 @@ __webpack_require__.m = __webpack_modules__, __webpack_require__.add = function(
19
17
  enumerable: !0,
20
18
  get: definition[key]
21
19
  });
20
+ }, __webpack_require__.add = function(modules) {
21
+ Object.assign(__webpack_require__.m, modules);
22
22
  }, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports)=>{
23
23
  "u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
24
24
  value: 'Module'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-debug/core",
3
- "version": "2.0.0-beta.6",
3
+ "version": "2.0.0-beta.8",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "Fast Rust-based bundler for the web with a modernized webpack API",
@@ -37,18 +37,18 @@
37
37
  "directory": "packages/rspack"
38
38
  },
39
39
  "devDependencies": {
40
- "@ast-grep/napi": "^0.41.0",
41
- "@napi-rs/wasm-runtime": "1.0.7",
40
+ "@ast-grep/napi": "^0.42.0",
41
+ "@napi-rs/wasm-runtime": "1.1.1",
42
42
  "@rsbuild/plugin-node-polyfill": "^1.4.4",
43
- "@rslib/core": "0.19.6",
43
+ "@rslib/core": "0.20.0",
44
44
  "@rspack/lite-tapable": "1.1.0",
45
45
  "@swc/types": "0.1.25",
46
- "@types/node": "^20.19.35",
46
+ "@types/node": "^20.19.37",
47
47
  "@types/watchpack": "^2.4.5",
48
48
  "browserslist-load-config": "^1.0.1",
49
49
  "browserslist-to-es-version": "^1.4.1",
50
50
  "connect-next": "^4.0.0",
51
- "enhanced-resolve": "5.19.0",
51
+ "enhanced-resolve": "5.20.1",
52
52
  "http-proxy-middleware": "^3.0.5",
53
53
  "memfs": "4.53.0",
54
54
  "open": "^11.0.0",
@@ -59,7 +59,7 @@
59
59
  "webpack-sources": "3.3.4"
60
60
  },
61
61
  "dependencies": {
62
- "@rspack/binding": "npm:@rspack-debug/binding@2.0.0-beta.6"
62
+ "@rspack/binding": "npm:@rspack-debug/binding@2.0.0-beta.8"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "@module-federation/runtime-tools": "^0.24.1 || ^2.0.0",