@rspack-debug/core 2.0.0-alpha.0 → 2.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,6 +79,7 @@ export type CompilerHooks = {
79
79
  entryOption: liteTapable.SyncBailHook<[string, EntryNormalized], any>;
80
80
  additionalPass: liteTapable.AsyncSeriesHook<[]>;
81
81
  };
82
+ export declare const GET_COMPILER_ID: unique symbol;
82
83
  declare class Compiler {
83
84
  #private;
84
85
  hooks: CompilerHooks;
@@ -21,6 +21,10 @@ export type SwcLoaderOptions = Config & {
21
21
  */
22
22
  rspackExperiments?: {
23
23
  import?: PluginImportOptions;
24
+ /**
25
+ * Enable React Server Components support.
26
+ */
27
+ reactServerComponents?: boolean;
24
28
  };
25
29
  };
26
30
  export interface TerserCompressOptions {
@@ -73,6 +73,7 @@ export * from './RslibPlugin.js';
73
73
  export * from './RstestPlugin.js';
74
74
  export * from './RuntimeChunkPlugin.js';
75
75
  export * from './RuntimePlugin.js';
76
+ export { rsc } from './rsc/index.js';
76
77
  export * from './SideEffectsFlagPlugin.js';
77
78
  export * from './SizeLimitsPlugin.js';
78
79
  export * from './SourceMapDevToolPlugin.js';
@@ -0,0 +1,8 @@
1
+ import { type Compiler } from '../../Compiler.js';
2
+ export declare const GET_OR_INIT_BINDING: unique symbol;
3
+ export declare class Coordinator {
4
+ #private;
5
+ constructor();
6
+ applyServerCompiler(serverCompiler: Compiler): void;
7
+ applyClientCompiler(clientCompiler: Compiler): void;
8
+ }
@@ -0,0 +1,13 @@
1
+ import type binding from '@rspack/binding';
2
+ import type { Compiler } from '../../index.js';
3
+ import { RspackBuiltinPlugin } from '../base.js';
4
+ import { type Coordinator } from './Coordinator.js';
5
+ export type RscClientPluginOptions = {
6
+ coordinator: Coordinator;
7
+ };
8
+ export declare class RscClientPlugin extends RspackBuiltinPlugin {
9
+ #private;
10
+ name: string;
11
+ constructor(options: RscClientPluginOptions);
12
+ raw(compiler: Compiler): binding.BuiltinPlugin;
13
+ }
@@ -0,0 +1,14 @@
1
+ import type binding from '@rspack/binding';
2
+ import type { Compiler } from '../../index.js';
3
+ import { RspackBuiltinPlugin } from '../base.js';
4
+ import { type Coordinator } from './Coordinator.js';
5
+ export type RscServerPluginOptions = {
6
+ coordinator: Coordinator;
7
+ onServerComponentChanges?: () => Promise<void>;
8
+ };
9
+ export declare class RscServerPlugin extends RspackBuiltinPlugin {
10
+ #private;
11
+ name: string;
12
+ constructor(options: RscServerPluginOptions);
13
+ raw(compiler: Compiler): binding.BuiltinPlugin;
14
+ }
@@ -0,0 +1,24 @@
1
+ import { RscClientPlugin, type RscClientPluginOptions } from './RscClientPlugin.js';
2
+ import { RscServerPlugin } from './RscServerPlugin.js';
3
+ declare class ServerPlugin extends RscServerPlugin {
4
+ constructor(options?: Omit<RscClientPluginOptions, 'coordinator'>);
5
+ }
6
+ declare class ClientPlugin extends RscClientPlugin {
7
+ }
8
+ export declare const rsc: {
9
+ createPlugins: () => {
10
+ ServerPlugin: new (options?: Omit<RscClientPluginOptions, "coordinator">) => ServerPlugin;
11
+ ClientPlugin: new () => ClientPlugin;
12
+ };
13
+ Layers: {
14
+ /**
15
+ * The layer for server-only runtime and picking up `react-server` export conditions.
16
+ */
17
+ readonly rsc: "react-server-components";
18
+ /**
19
+ * Server Side Rendering layer for app.
20
+ */
21
+ readonly ssr: "server-side-rendering";
22
+ };
23
+ };
24
+ export {};
@@ -76,7 +76,6 @@ export interface ModuleOptionsNormalized {
76
76
  parser: ParserOptionsByModuleType;
77
77
  generator: GeneratorOptionsByModuleType;
78
78
  noParse?: NoParseOption;
79
- unsafeCache?: boolean | RegExp;
80
79
  }
81
80
  export type CacheNormalized = boolean | {
82
81
  type: 'memory';
@@ -93,10 +92,10 @@ export type CacheNormalized = boolean | {
93
92
  type: 'filesystem';
94
93
  directory: string;
95
94
  };
95
+ portable?: boolean;
96
96
  };
97
97
  export interface ExperimentsNormalized {
98
98
  asyncWebAssembly?: boolean;
99
- outputModule?: boolean;
100
99
  css?: boolean;
101
100
  futureDefaults?: boolean;
102
101
  buildHttp?: HttpUriPluginOptions;
@@ -1044,10 +1044,6 @@ export type ModuleOptions = {
1044
1044
  generator?: GeneratorOptionsByModuleType;
1045
1045
  /** Keep module mechanism of the matched modules as-is, such as module.exports, require, import. */
1046
1046
  noParse?: NoParseOption;
1047
- /**
1048
- * Cache the resolving of module requests.
1049
- */
1050
- unsafeCache?: boolean | RegExp;
1051
1047
  };
1052
1048
  type AllowTarget = 'web' | 'webworker' | 'es3' | 'es5' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'es2023' | 'es2024' | 'es2025' | 'node' | 'async-node' | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | 'electron-main' | `electron${number}-main` | `electron${number}.${number}-main` | 'electron-renderer' | `electron${number}-renderer` | `electron${number}.${number}-renderer` | 'electron-preload' | `electron${number}-preload` | `electron${number}.${number}-preload` | 'nwjs' | `nwjs${number}` | `nwjs${number}.${number}` | 'node-webkit' | `node-webkit${number}` | `node-webkit${number}.${number}` | 'browserslist' | `browserslist:${string}`;
1053
1049
  /** Used to configure the target environment of Rspack output and the ECMAScript version of Rspack runtime code. */
@@ -1239,6 +1235,80 @@ export type NodeOptions = {
1239
1235
  export type Node = false | NodeOptions;
1240
1236
  export type Loader = Record<string, any>;
1241
1237
  export type SnapshotOptions = {};
1238
+ /**
1239
+ * Snapshot options for determining which files have been modified.
1240
+ */
1241
+ export type CacheSnapshotOptions = {
1242
+ /**
1243
+ * An array of paths to immutable files, changes to these paths will be ignored during hot restart.
1244
+ */
1245
+ immutablePaths?: (string | RegExp)[];
1246
+ /**
1247
+ * An array of paths in managedPaths that are not managed by the package manager.
1248
+ */
1249
+ unmanagedPaths?: (string | RegExp)[];
1250
+ /**
1251
+ * An array of paths managed by the package manager.
1252
+ * @default [/[\\/]node_modules[\\/][^.]/]
1253
+ */
1254
+ managedPaths?: (string | RegExp)[];
1255
+ };
1256
+ /**
1257
+ * Storage options for persistent cache.
1258
+ */
1259
+ export type CacheStorageOptions = {
1260
+ /**
1261
+ * Storage type, currently only supports 'filesystem'.
1262
+ */
1263
+ type: 'filesystem';
1264
+ /**
1265
+ * Cache directory path.
1266
+ * @default 'node_modules/.cache/rspack'
1267
+ */
1268
+ directory?: string;
1269
+ };
1270
+ /**
1271
+ * Persistent cache options.
1272
+ */
1273
+ export type PersistentCacheOptions = {
1274
+ /**
1275
+ * Cache type.
1276
+ */
1277
+ type: 'persistent';
1278
+ /**
1279
+ * An array of files containing build dependencies, Rspack will use the hash of each of these files to invalidate the persistent cache.
1280
+ * @default []
1281
+ */
1282
+ buildDependencies?: string[];
1283
+ /**
1284
+ * Cache version, different versions of caches are isolated from each other.
1285
+ * @default ""
1286
+ */
1287
+ version?: string;
1288
+ /**
1289
+ * Snapshot options for determining which files have been modified.
1290
+ */
1291
+ snapshot?: CacheSnapshotOptions;
1292
+ /**
1293
+ * Storage options for cache.
1294
+ */
1295
+ storage?: CacheStorageOptions;
1296
+ /**
1297
+ * Enable portable cache mode. When enabled, the generated cache content can be shared across different platforms and paths within the same project.
1298
+ * @description Portable cache makes the cache platform-independent by converting platform-specific data (e.g., absolute paths to relative paths) during serialization and deserialization.
1299
+ * @default false
1300
+ */
1301
+ portable?: boolean;
1302
+ };
1303
+ /**
1304
+ * Memory cache options.
1305
+ */
1306
+ export type MemoryCacheOptions = {
1307
+ /**
1308
+ * Cache type.
1309
+ */
1310
+ type: 'memory';
1311
+ };
1242
1312
  /**
1243
1313
  * Options for caching snapshots and intermediate products during the build process.
1244
1314
  * @description Controls whether caching is enabled or disabled.
@@ -1250,22 +1320,7 @@ export type SnapshotOptions = {};
1250
1320
  * // Disable caching
1251
1321
  * cache: false
1252
1322
  */
1253
- export type CacheOptions = boolean | {
1254
- type: 'memory';
1255
- } | {
1256
- type: 'persistent';
1257
- buildDependencies?: string[];
1258
- version?: string;
1259
- snapshot?: {
1260
- immutablePaths?: (string | RegExp)[];
1261
- unmanagedPaths?: (string | RegExp)[];
1262
- managedPaths?: (string | RegExp)[];
1263
- };
1264
- storage?: {
1265
- type: 'filesystem';
1266
- directory?: string;
1267
- };
1268
- };
1323
+ export type CacheOptions = boolean | MemoryCacheOptions | PersistentCacheOptions;
1269
1324
  export type StatsPresets = 'normal' | 'none' | 'verbose' | 'errors-only' | 'errors-warnings' | 'minimal' | 'detailed' | 'summary';
1270
1325
  type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
1271
1326
  type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
@@ -1989,25 +2044,17 @@ export type Incremental = {
1989
2044
  */
1990
2045
  silent?: boolean;
1991
2046
  /**
1992
- * Enable incremental make.
2047
+ * Enable incremental build module graph.
1993
2048
  */
1994
- make?: boolean;
2049
+ buildModuleGraph?: boolean;
1995
2050
  /**
1996
- * Enable inference of async modules.
2051
+ * Enable incremental finish modules.
1997
2052
  */
1998
- inferAsyncModules?: boolean;
2053
+ finishModules?: boolean;
1999
2054
  /**
2000
- * Enable incremental provided exports.
2055
+ * Enable incremental optimize dependencies.
2001
2056
  */
2002
- providedExports?: boolean;
2003
- /**
2004
- * Enables diagnostics for dependencies.
2005
- */
2006
- dependenciesDiagnostics?: boolean;
2007
- /**
2008
- * Enables incremental side effects optimization.
2009
- */
2010
- sideEffects?: boolean;
2057
+ optimizeDependencies?: boolean;
2011
2058
  /**
2012
2059
  * Enable incremental build chunk graph.
2013
2060
  */
@@ -2041,11 +2088,11 @@ export type Incremental = {
2041
2088
  */
2042
2089
  chunksHashes?: boolean;
2043
2090
  /**
2044
- * Enable incremental chunk render.
2091
+ * Enable incremental chunk asset.
2045
2092
  */
2046
- chunksRender?: boolean;
2093
+ chunkAsset?: boolean;
2047
2094
  /**
2048
- * Enable incremental asset emission.
2095
+ * Enable incremental emit assets.
2049
2096
  */
2050
2097
  emitAssets?: boolean;
2051
2098
  };
@@ -2071,11 +2118,6 @@ export type Experiments = {
2071
2118
  * @default false
2072
2119
  */
2073
2120
  asyncWebAssembly?: boolean;
2074
- /**
2075
- * Enable output as ES module.
2076
- * @default false
2077
- */
2078
- outputModule?: boolean;
2079
2121
  /**
2080
2122
  * Enable CSS support.
2081
2123
  *
package/dist/exports.d.ts CHANGED
@@ -55,7 +55,7 @@ export { EnvironmentPlugin } from './lib/EnvironmentPlugin.js';
55
55
  export { LoaderOptionsPlugin } from './lib/LoaderOptionsPlugin.js';
56
56
  export { LoaderTargetPlugin } from './lib/LoaderTargetPlugin.js';
57
57
  export type { OutputFileSystem, WatchFileSystem } from './util/fs.js';
58
- import { FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, SubresourceIntegrityPlugin } from './builtin-plugin/index.js';
58
+ import { FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, rsc, SubresourceIntegrityPlugin } from './builtin-plugin/index.js';
59
59
  export { SubresourceIntegrityPlugin };
60
60
  interface Web {
61
61
  FetchCompileAsyncWasmPlugin: typeof FetchCompileAsyncWasmPlugin;
@@ -161,5 +161,6 @@ interface Experiments {
161
161
  CssChunkingPlugin: typeof CssChunkingPlugin;
162
162
  createNativePlugin: typeof createNativePlugin;
163
163
  VirtualModulesPlugin: typeof VirtualModulesPlugin;
164
+ rsc: typeof rsc;
164
165
  }
165
166
  export declare const experiments: Experiments;
package/dist/index.d.ts CHANGED
@@ -8,3 +8,4 @@ declare const rspack: Rspack;
8
8
  export * from './exports.js';
9
9
  export default rspack;
10
10
  export { rspack };
11
+ export { rspack as 'module.exports' };
package/dist/index.js CHANGED
@@ -598,6 +598,17 @@ class Stats {
598
598
  compilation: this.compilation,
599
599
  getStatsCompilation: (compilation)=>{
600
600
  if (statsCompilationMap.has(compilation)) return statsCompilationMap.get(compilation);
601
+ if (this.compilation !== this.compilation.compiler._lastCompilation) return {
602
+ assets: [],
603
+ assetsByChunkName: [],
604
+ chunks: [],
605
+ entrypoints: [],
606
+ errors: [],
607
+ hash: 'XXXX',
608
+ modules: [],
609
+ namedChunkGroups: [],
610
+ warnings: []
611
+ };
601
612
  let innerStats = this.#getInnerByCompilation(compilation);
602
613
  options.warnings = !1;
603
614
  let innerStatsCompilation = innerStats.toJson(options);
@@ -613,6 +624,17 @@ class Stats {
613
624
  compilation: this.compilation,
614
625
  getStatsCompilation: (compilation)=>{
615
626
  if (statsCompilationMap.has(compilation)) return statsCompilationMap.get(compilation);
627
+ if (this.compilation !== this.compilation.compiler._lastCompilation) return {
628
+ assets: [],
629
+ assetsByChunkName: [],
630
+ chunks: [],
631
+ entrypoints: [],
632
+ errors: [],
633
+ hash: 'XXXX',
634
+ modules: [],
635
+ namedChunkGroups: [],
636
+ warnings: []
637
+ };
616
638
  let innerStatsCompilation = this.#getInnerByCompilation(compilation).toJson(options);
617
639
  return statsCompilationMap.set(compilation, innerStatsCompilation), innerStatsCompilation;
618
640
  },
@@ -1453,7 +1475,18 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1453
1475
  seal: new SyncHook([]),
1454
1476
  afterSeal: new AsyncSeriesHook([]),
1455
1477
  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();
1478
+ };
1479
+ let availableHooks = Object.keys(this.hooks);
1480
+ this.hooks = new Proxy(this.hooks, {
1481
+ get (target, prop, receiver) {
1482
+ let value = Reflect.get(target, prop, receiver);
1483
+ if (void 0 === value && 'string' == typeof prop) {
1484
+ let hooksList = availableHooks.join(', ');
1485
+ 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}`);
1486
+ }
1487
+ return value;
1488
+ }
1489
+ }), 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
1490
  }
1458
1491
  get hash() {
1459
1492
  return this.#inner.hash;
@@ -2164,7 +2197,7 @@ class EnableLibraryPlugin extends RspackBuiltinPlugin {
2164
2197
  }
2165
2198
  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
2199
  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');
2200
+ options.optimization.concatenateModules = !1, options.optimization.removeEmptyChunks = !1, options.output.chunkFormat = !1, options.output.chunkLoading && 'import' !== options.output.chunkLoading && (options.output.chunkLoading = 'import'), void 0 === options.output.chunkLoading && (options.output.chunkLoading = 'import');
2168
2201
  let { splitChunks } = options.optimization;
2169
2202
  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
2203
  }
@@ -4563,6 +4596,66 @@ RuntimePlugin.getCompilationHooks = (compilation)=>{
4563
4596
  ])
4564
4597
  }, RuntimePlugin_compilationHooksMap.set(compilation, hooks)), hooks;
4565
4598
  };
4599
+ let Coordinator_PLUGIN_NAME = 'RscPlugin', GET_OR_INIT_BINDING = Symbol('GET_OR_INIT_BINDING');
4600
+ class Coordinator {
4601
+ #serverCompiler;
4602
+ #clientCompiler;
4603
+ #clientLastCompilation;
4604
+ #isProxyingClientWatching = !1;
4605
+ #binding;
4606
+ constructor(){
4607
+ Object.defineProperty(this, GET_OR_INIT_BINDING, {
4608
+ enumerable: !1,
4609
+ configurable: !1,
4610
+ writable: !1,
4611
+ value: ()=>(this.#binding || (this.#binding = new binding_namespaceObject.JsCoordinator(()=>{
4612
+ if (!this.#serverCompiler) throw Error("[RscPlugin] Coordinator.getOrInitBinding() called before the server compiler was attached. Call coordinator.applyServerCompiler(serverCompiler) first.");
4613
+ return this.#serverCompiler[GET_COMPILER_ID]();
4614
+ })), this.#binding)
4615
+ });
4616
+ }
4617
+ applyServerCompiler(serverCompiler) {
4618
+ this.#serverCompiler = serverCompiler, serverCompiler.hooks.done.tap(Coordinator_PLUGIN_NAME, (stats)=>{
4619
+ 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));
4620
+ }), serverCompiler.hooks.watchRun.tap(Coordinator_PLUGIN_NAME, ()=>{
4621
+ this.#isProxyingClientWatching && this.#clientCompiler.watching.invalidateWithChangesAndRemovals(new Set(this.#serverCompiler.modifiedFiles), new Set(this.#serverCompiler.removedFiles));
4622
+ });
4623
+ }
4624
+ applyClientCompiler(clientCompiler) {
4625
+ this.#clientCompiler = clientCompiler;
4626
+ let originalWatch = clientCompiler.watch;
4627
+ clientCompiler.watch = function(watchOptions, handler) {
4628
+ return watchOptions.ignored = ()=>!0, originalWatch.call(this, watchOptions, handler);
4629
+ }, clientCompiler.hooks.done.tap(Coordinator_PLUGIN_NAME, (stats)=>{
4630
+ this.#clientLastCompilation = stats.compilation;
4631
+ });
4632
+ }
4633
+ }
4634
+ class RscClientPlugin extends RspackBuiltinPlugin {
4635
+ name = 'RscClientPlugin';
4636
+ #options;
4637
+ constructor(options){
4638
+ super(), this.#options = options;
4639
+ }
4640
+ raw(compiler) {
4641
+ return this.#options.coordinator.applyClientCompiler(compiler), createBuiltinPlugin(this.name, {
4642
+ coordinator: this.#options.coordinator[GET_OR_INIT_BINDING]()
4643
+ });
4644
+ }
4645
+ }
4646
+ class RscServerPlugin extends RspackBuiltinPlugin {
4647
+ name = 'RscServerPlugin';
4648
+ #options;
4649
+ constructor(options){
4650
+ super(), this.#options = options;
4651
+ }
4652
+ raw(compiler) {
4653
+ return this.#options.coordinator.applyServerCompiler(compiler), createBuiltinPlugin(this.name, {
4654
+ coordinator: this.#options.coordinator[GET_OR_INIT_BINDING](),
4655
+ onServerComponentChanges: this.#options.onServerComponentChanges
4656
+ });
4657
+ }
4658
+ }
4566
4659
  let SideEffectsFlagPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SideEffectsFlagPlugin, ()=>{}, 'compilation'), SizeLimitsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SizeLimitsPlugin, (options)=>{
4567
4660
  let hints = !1 === options.hints ? void 0 : options.hints;
4568
4661
  return {
@@ -5955,7 +6048,6 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
5955
6048
  }), applySnapshotDefaults(options.snapshot, {
5956
6049
  production
5957
6050
  }), applyModuleDefaults(options.module, {
5958
- cache: !!options.cache,
5959
6051
  asyncWebAssembly: options.experiments.asyncWebAssembly,
5960
6052
  targetProperties,
5961
6053
  mode: options.mode,
@@ -5965,7 +6057,6 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
5965
6057
  context: options.context,
5966
6058
  targetProperties,
5967
6059
  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
6060
  entry: options.entry
5970
6061
  }), applyExternalsPresetsDefaults(options.externalsPresets, {
5971
6062
  targetProperties,
@@ -5998,11 +6089,11 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
5998
6089
  }, applyExperimentsDefaults = (experiments)=>{
5999
6090
  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);
6000
6091
  }, applyIncrementalDefaults = (options)=>{
6001
- D(options, 'incremental', {}), 'object' == typeof options.incremental && (D(options.incremental, 'silent', !0), D(options.incremental, 'make', !0), D(options.incremental, 'inferAsyncModules', !0), D(options.incremental, 'providedExports', !0), D(options.incremental, 'dependenciesDiagnostics', !0), D(options.incremental, 'sideEffects', !0), D(options.incremental, 'buildChunkGraph', !1), 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, 'chunksRender', !0), D(options.incremental, 'emitAssets', !0));
6092
+ 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, '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));
6002
6093
  }, applySnapshotDefaults = (_snapshot, _env)=>{}, applyCssGeneratorOptionsDefaults = (generatorOptions, { targetProperties })=>{
6003
6094
  D(generatorOptions, 'exportsOnly', !targetProperties || !1 === targetProperties.document), D(generatorOptions, 'esModule', !0);
6004
- }, applyModuleDefaults = (module, { cache, asyncWebAssembly, targetProperties, mode, uniqueName, deferImport })=>{
6005
- 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 })=>{
6095
+ }, applyModuleDefaults = (module, { asyncWebAssembly, targetProperties, mode, uniqueName, deferImport })=>{
6096
+ 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 })=>{
6006
6097
  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', [
6007
6098
  '...'
6008
6099
  ]), D(parserOptions, 'importMeta', !0), D(parserOptions, 'typeReexportsPresence', 'no-tolerant'), D(parserOptions, 'jsx', !1), D(parserOptions, 'deferImport', deferImport);
@@ -6123,7 +6214,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6123
6214
  type: 'asset/bytes'
6124
6215
  }), rules;
6125
6216
  });
6126
- }, applyOutputDefaults = (options, { context, outputModule, targetProperties: tp, isAffectedByBrowserslist, entry })=>{
6217
+ }, applyOutputDefaults = (options, { context, targetProperties: tp, isAffectedByBrowserslist, entry })=>{
6127
6218
  let { output } = options, getLibraryName = (library)=>{
6128
6219
  let libraryName = 'object' == typeof library && library && !Array.isArray(library) ? library.name : library;
6129
6220
  return Array.isArray(libraryName) ? libraryName.join('.') : 'object' == typeof libraryName ? getLibraryName(libraryName.root) : 'string' == typeof libraryName ? libraryName : '';
@@ -6141,7 +6232,19 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6141
6232
  if ('ENOENT' !== err.code) throw err.message += `\nwhile determining default 'output.uniqueName' from 'name' in ${pkgPath}`, err;
6142
6233
  return '';
6143
6234
  }
6144
- }), F(output, 'devtoolNamespace', ()=>output.uniqueName), F(output, 'module', ()=>!!outputModule);
6235
+ }), F(output, 'devtoolNamespace', ()=>output.uniqueName), output.library && F(output.library, 'type', ()=>output.module ? 'modern-module' : 'var');
6236
+ let forEachEntry = (fn)=>{
6237
+ if ('function' != typeof entry) for (let name of Object.keys(entry))fn(entry[name]);
6238
+ };
6239
+ A(output, 'enabledLibraryTypes', ()=>{
6240
+ let enabledLibraryTypes = [];
6241
+ return output.library && enabledLibraryTypes.push(output.library.type), forEachEntry((desc)=>{
6242
+ desc.library && enabledLibraryTypes.push(desc.library.type);
6243
+ }), enabledLibraryTypes.includes('modern-module') && applyLimits(options), enabledLibraryTypes;
6244
+ }), D(output, 'module', [
6245
+ 'modern-module',
6246
+ 'module'
6247
+ ].some((ty)=>output.enabledLibraryTypes.includes(ty)));
6145
6248
  let environment = output.environment, conditionallyOptimistic = (v, c)=>void 0 === v && c || v;
6146
6249
  F(environment, 'globalThis', ()=>tp && tp.globalThis), F(environment, 'bigIntLiteral', ()=>{
6147
6250
  let v;
@@ -6191,7 +6294,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6191
6294
  return 'function' != typeof chunkFilename ? chunkFilename.replace(/\.[mc]?js(\?|$)/, '.css$1') : '[id].css';
6192
6295
  }), D(output, 'hotUpdateChunkFilename', `[id].[fullhash].hot-update.${output.module ? 'mjs' : 'js'}`), F(output, 'hotUpdateMainFilename', ()=>`[runtime].[fullhash].hot-update.${output.module ? 'json.mjs' : 'json'}`);
6193
6296
  let uniqueNameId = Template.toIdentifier(output.uniqueName);
6194
- 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', ()=>{
6297
+ 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', ()=>{
6195
6298
  if (tp) {
6196
6299
  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.";
6197
6300
  if (output.module) {
@@ -6253,16 +6356,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6253
6356
  return 'self';
6254
6357
  }), 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);
6255
6358
  let { trustedTypes } = output;
6256
- trustedTypes && (F(trustedTypes, 'policyName', ()=>output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, '_') || 'rspack'), D(trustedTypes, 'onPolicyCreationFailure', 'stop'));
6257
- let forEachEntry = (fn)=>{
6258
- if ('function' != typeof entry) for (let name of Object.keys(entry))fn(entry[name]);
6259
- };
6260
- A(output, 'enabledLibraryTypes', ()=>{
6261
- let enabledLibraryTypes = [];
6262
- return output.library && enabledLibraryTypes.push(output.library.type), forEachEntry((desc)=>{
6263
- desc.library && enabledLibraryTypes.push(desc.library.type);
6264
- }), enabledLibraryTypes.includes('modern-module') && applyLimits(options), enabledLibraryTypes;
6265
- }), A(output, 'enabledChunkLoadingTypes', ()=>{
6359
+ trustedTypes && (F(trustedTypes, 'policyName', ()=>output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, '_') || 'rspack'), D(trustedTypes, 'onPolicyCreationFailure', 'stop')), A(output, 'enabledChunkLoadingTypes', ()=>{
6266
6360
  let enabledChunkLoadingTypes = new Set();
6267
6361
  return output.chunkLoading && enabledChunkLoadingTypes.add(output.chunkLoading), output.workerChunkLoading && enabledChunkLoadingTypes.add(output.workerChunkLoading), forEachEntry((desc)=>{
6268
6362
  desc.chunkLoading && enabledChunkLoadingTypes.add(desc.chunkLoading);
@@ -6272,7 +6366,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6272
6366
  return output.wasmLoading && enabledWasmLoadingTypes.add(output.wasmLoading), output.workerWasmLoading && enabledWasmLoadingTypes.add(output.workerWasmLoading), forEachEntry((desc)=>{
6273
6367
  desc.wasmLoading && enabledWasmLoadingTypes.add(desc.wasmLoading);
6274
6368
  }), Array.from(enabledWasmLoadingTypes);
6275
- }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.0-alpha.0"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !output.library));
6369
+ }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.0-beta.0"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !output.library));
6276
6370
  }, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp, outputModule })=>{
6277
6371
  let isUniversal = (key)=>!!(outputModule && targetProperties && null === targetProperties[key]);
6278
6372
  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')));
@@ -6553,8 +6647,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6553
6647
  ]),
6554
6648
  rules: nestedArray(module.rules, (r)=>[
6555
6649
  ...r
6556
- ]),
6557
- unsafeCache: module.unsafeCache
6650
+ ])
6558
6651
  })),
6559
6652
  target: config.target,
6560
6653
  externals: config.externals,
@@ -6590,7 +6683,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6590
6683
  storage: {
6591
6684
  type: 'filesystem',
6592
6685
  directory: node_path.resolve(config.context || process.cwd(), cache.storage?.directory || 'node_modules/.cache/rspack')
6593
- }
6686
+ },
6687
+ portable: cache.portable
6594
6688
  };
6595
6689
  }),
6596
6690
  stats: nestedConfig(config.stats, (stats)=>!1 === stats ? {
@@ -6687,12 +6781,10 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6687
6781
  }
6688
6782
  }, getNormalizedIncrementalOptions = (incremental)=>!1 !== incremental && 'none' !== incremental && ('safe' === incremental ? {
6689
6783
  silent: !0,
6690
- make: !0,
6691
- inferAsyncModules: !1,
6692
- providedExports: !1,
6693
- dependenciesDiagnostics: !1,
6694
- sideEffects: !1,
6695
- buildChunkGraph: !1,
6784
+ buildModuleGraph: !0,
6785
+ finishModules: !1,
6786
+ optimizeDependencies: !1,
6787
+ buildChunkGraph: !0,
6696
6788
  moduleIds: !1,
6697
6789
  chunkIds: !1,
6698
6790
  modulesHashes: !1,
@@ -6700,7 +6792,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6700
6792
  modulesRuntimeRequirements: !1,
6701
6793
  chunksRuntimeRequirements: !1,
6702
6794
  chunksHashes: !1,
6703
- chunksRender: !1,
6795
+ chunkAsset: !1,
6704
6796
  emitAssets: !0
6705
6797
  } : !0 === incremental || 'advance-silent' === incremental ? {} : 'advance' === incremental ? {
6706
6798
  silent: !1
@@ -7526,7 +7618,7 @@ class MultiStats {
7526
7618
  obj.children = this.stats.map((stat, idx)=>{
7527
7619
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
7528
7620
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
7529
- }), childOptions.version && (obj.rspackVersion = "2.0.0-alpha.0", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
7621
+ }), childOptions.version && (obj.rspackVersion = "2.0.0-beta.0", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
7530
7622
  let mapError = (j, obj)=>({
7531
7623
  ...obj,
7532
7624
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -8682,15 +8774,21 @@ let iterateConfig = (config, options, fn)=>{
8682
8774
  if (context.makePathsRelative || (context.makePathsRelative = makePathsRelative.bindContextCache(compilation.compiler.context, compilation.compiler.root)), !context.cachedGetErrors) {
8683
8775
  let map = new WeakMap();
8684
8776
  context.cachedGetErrors = (compilation)=>{
8685
- var errors;
8686
- return map.get(compilation) || (errors = statsCompilation.errors, map.set(compilation, errors), errors);
8777
+ if (compilation.compiler._lastCompilation !== compilation) return [];
8778
+ let cache = map.get(compilation);
8779
+ if (cache) return cache;
8780
+ let errors = statsCompilation.errors;
8781
+ return map.set(compilation, errors), errors;
8687
8782
  };
8688
8783
  }
8689
8784
  if (!context.cachedGetWarnings) {
8690
8785
  let map = new WeakMap();
8691
8786
  context.cachedGetWarnings = (compilation)=>{
8692
- var warnings;
8693
- return map.get(compilation) || (warnings = compilation.__internal_getInner().createStatsWarnings(compilation.getWarnings(), !!options.colors), map.set(compilation, warnings), warnings);
8787
+ if (compilation.compiler._lastCompilation !== compilation) return [];
8788
+ let cache = map.get(compilation);
8789
+ if (cache) return cache;
8790
+ let warnings = compilation.__internal_getInner().createStatsWarnings(compilation.getWarnings(), !!options.colors);
8791
+ return map.set(compilation, warnings), warnings;
8694
8792
  };
8695
8793
  }
8696
8794
  compilation.name && (object.name = compilation.name);
@@ -8779,7 +8877,7 @@ let iterateConfig = (config, options, fn)=>{
8779
8877
  object.hash = context.getStatsCompilation(compilation).hash;
8780
8878
  },
8781
8879
  version: (object)=>{
8782
- object.version = "5.75.0", object.rspackVersion = "2.0.0-alpha.0";
8880
+ object.version = "5.75.0", object.rspackVersion = "2.0.0-beta.0";
8783
8881
  },
8784
8882
  env: (object, _compilation, _context, { _env })=>{
8785
8883
  object.env = _env;
@@ -10440,7 +10538,7 @@ class TraceHookPlugin {
10440
10538
  });
10441
10539
  }
10442
10540
  }
10443
- let CORE_VERSION = "2.0.0-alpha.0", VFILES_BY_COMPILER = new WeakMap();
10541
+ let CORE_VERSION = "2.0.0-beta.0", VFILES_BY_COMPILER = new WeakMap();
10444
10542
  class VirtualModulesPlugin {
10445
10543
  #staticModules;
10446
10544
  #compiler;
@@ -10585,22 +10683,23 @@ class Watching {
10585
10683
  let startTime = this.startTime;
10586
10684
  this.startTime = void 0, compilation.startTime = startTime, compilation.endTime = Date.now();
10587
10685
  let cbs = this.callbacks;
10588
- this.callbacks = [];
10589
- let fileDependencies = new Set([
10590
- ...compilation.fileDependencies
10591
- ]);
10592
- fileDependencies.added = new Set(compilation.__internal__addedFileDependencies), fileDependencies.removed = new Set(compilation.__internal__removedFileDependencies);
10593
- let contextDependencies = new Set([
10594
- ...compilation.contextDependencies
10595
- ]);
10596
- contextDependencies.added = new Set(compilation.__internal__addedContextDependencies), contextDependencies.removed = new Set(compilation.__internal__removedContextDependencies);
10597
- let missingDependencies = new Set([
10598
- ...compilation.missingDependencies
10599
- ]);
10600
- missingDependencies.added = new Set(compilation.__internal__addedMissingDependencies), missingDependencies.removed = new Set(compilation.__internal__removedMissingDependencies), this.compiler.hooks.done.callAsync(stats, (err)=>{
10686
+ this.callbacks = [], this.compiler.hooks.done.callAsync(stats, (err)=>{
10601
10687
  if (err) return handleError(err, cbs);
10602
10688
  for (let cb of (this.handler(null, stats), process.nextTick(()=>{
10603
- this.#closed || this.watch(fileDependencies, contextDependencies, missingDependencies);
10689
+ if (!this.#closed) {
10690
+ let fileDependencies = new Set([
10691
+ ...compilation.fileDependencies
10692
+ ]);
10693
+ fileDependencies.added = new Set(compilation.__internal__addedFileDependencies), fileDependencies.removed = new Set(compilation.__internal__removedFileDependencies);
10694
+ let contextDependencies = new Set([
10695
+ ...compilation.contextDependencies
10696
+ ]);
10697
+ contextDependencies.added = new Set(compilation.__internal__addedContextDependencies), contextDependencies.removed = new Set(compilation.__internal__removedContextDependencies);
10698
+ let missingDependencies = new Set([
10699
+ ...compilation.missingDependencies
10700
+ ]);
10701
+ missingDependencies.added = new Set(compilation.__internal__addedMissingDependencies), missingDependencies.removed = new Set(compilation.__internal__removedMissingDependencies), this.watch(fileDependencies, contextDependencies, missingDependencies);
10702
+ }
10604
10703
  }), cbs))cb(null);
10605
10704
  this.compiler.hooks.afterDone.call(stats);
10606
10705
  });
@@ -10620,7 +10719,7 @@ class Watching {
10620
10719
  this.suspended && (this.suspended = !1, this.#invalidate());
10621
10720
  }
10622
10721
  }
10623
- let Compiler_require = createRequire(import.meta.url);
10722
+ let Compiler_require = createRequire(import.meta.url), GET_COMPILER_ID = Symbol('getCompilerId');
10624
10723
  class Compiler {
10625
10724
  #instance;
10626
10725
  #initial;
@@ -10751,6 +10850,17 @@ class Compiler {
10751
10850
  ]),
10752
10851
  additionalPass: new AsyncSeriesHook([])
10753
10852
  };
10853
+ let availableCompilerHooks = Object.keys(this.hooks);
10854
+ this.hooks = new Proxy(this.hooks, {
10855
+ get (target, prop, receiver) {
10856
+ let value = Reflect.get(target, prop, receiver);
10857
+ if (void 0 === value && 'string' == typeof prop) {
10858
+ let hooksList = availableCompilerHooks.join(', ');
10859
+ 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}`);
10860
+ }
10861
+ return value;
10862
+ }
10863
+ });
10754
10864
  let compilerRspack = Object.assign(function(...params) {
10755
10865
  return rspack(...params);
10756
10866
  }, exports_namespaceObject, {
@@ -10765,7 +10875,12 @@ class Compiler {
10765
10875
  electron: null
10766
10876
  }, this.#target = {}, this.__internal_browser_require = ()=>{
10767
10877
  throw Error('Cannot execute user defined code in browser without `BrowserRequirePlugin`');
10768
- }, 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);
10878
+ }, 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), Object.defineProperty(this, GET_COMPILER_ID, {
10879
+ writable: !1,
10880
+ configurable: !1,
10881
+ enumerable: !1,
10882
+ value: ()=>this.#instance.getCompilerId()
10883
+ });
10769
10884
  }
10770
10885
  get recordsInputPath() {
10771
10886
  return unsupported('Compiler.recordsInputPath');
@@ -11026,8 +11141,7 @@ Help:
11026
11141
  k,
11027
11142
  getRawGeneratorOptions(v, k)
11028
11143
  ]).filter(([_, v])=>void 0 !== v)),
11029
- noParse: module.noParse,
11030
- unsafeCache: module.unsafeCache
11144
+ noParse: module.noParse
11031
11145
  };
11032
11146
  }(options.module, {
11033
11147
  compiler: this,
@@ -12229,7 +12343,7 @@ async function transform(source, options) {
12229
12343
  let _options = JSON.stringify(options || {});
12230
12344
  return binding_default().transform(source, _options);
12231
12345
  }
12232
- let exports_rspackVersion = "2.0.0-alpha.0", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
12346
+ let exports_rspackVersion = "2.0.0-beta.0", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
12233
12347
  getNormalizedRspackOptions: getNormalizedRspackOptions,
12234
12348
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
12235
12349
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -12488,12 +12602,36 @@ let exports_rspackVersion = "2.0.0-alpha.0", exports_version = "5.75.0", exports
12488
12602
  if (INTERNAL_PLUGIN_NAMES.includes(name)) throw Error(`Cannot register native plugin with name '${name}', it conflicts with internal plugin names.`);
12489
12603
  return base_create(name, resolve, affectedHooks);
12490
12604
  },
12491
- VirtualModulesPlugin: VirtualModulesPlugin
12605
+ VirtualModulesPlugin: VirtualModulesPlugin,
12606
+ rsc: {
12607
+ createPlugins: ()=>{
12608
+ let coordinator = new Coordinator();
12609
+ return {
12610
+ ServerPlugin: class extends RscServerPlugin {
12611
+ constructor(options = {}){
12612
+ super({
12613
+ coordinator,
12614
+ ...options
12615
+ });
12616
+ }
12617
+ },
12618
+ ClientPlugin: class extends RscClientPlugin {
12619
+ constructor(){
12620
+ super({
12621
+ coordinator
12622
+ });
12623
+ }
12624
+ }
12625
+ };
12626
+ },
12627
+ Layers: {
12628
+ rsc: 'react-server-components',
12629
+ ssr: 'server-side-rendering'
12630
+ }
12631
+ }
12492
12632
  }, src_fn = Object.assign(rspack, exports_namespaceObject);
12493
12633
  src_fn.rspack = src_fn, src_fn.webpack = src_fn;
12494
12634
  let src_rspack_0 = src_fn;
12495
12635
  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;
12496
12636
  export default src_rspack_0;
12497
- 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 };
12498
-
12499
- export { src_rspack_0 as 'module.exports' }
12637
+ 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 "module.exports", src_rspack_0 as rspack, statsFactoryUtils_StatsErrorCode as StatsErrorCode, util, web, webworker };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-debug/core",
3
- "version": "2.0.0-alpha.0",
3
+ "version": "2.0.0-beta.0",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -39,17 +39,17 @@
39
39
  "devDependencies": {
40
40
  "@ast-grep/napi": "^0.40.5",
41
41
  "@napi-rs/wasm-runtime": "1.0.7",
42
- "@rsbuild/plugin-node-polyfill": "^1.4.2",
43
- "@rslib/core": "0.19.2",
42
+ "@rsbuild/plugin-node-polyfill": "^1.4.3",
43
+ "@rslib/core": "0.19.3",
44
44
  "@swc/types": "0.1.25",
45
- "@types/node": "^20.19.29",
45
+ "@types/node": "^20.19.30",
46
46
  "@types/watchpack": "^2.4.5",
47
47
  "browserslist-load-config": "^1.0.1",
48
48
  "browserslist-to-es-version": "^1.4.1",
49
49
  "enhanced-resolve": "5.18.4",
50
50
  "glob-to-regexp": "^0.4.1",
51
51
  "memfs": "4.53.0",
52
- "prebundle": "^1.6.0",
52
+ "prebundle": "^1.6.2",
53
53
  "tinypool": "^1.1.1",
54
54
  "tsx": "^4.21.0",
55
55
  "typescript": "^5.9.3",
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@rspack/lite-tapable": "1.1.0",
61
- "@rspack/binding": "npm:@rspack-debug/binding@2.0.0-alpha.0"
61
+ "@rspack/binding": "npm:@rspack-debug/binding@2.0.0-beta.0"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@module-federation/runtime-tools": ">=0.22.0",