@rspack-debug/core 2.0.0-alpha.1 → 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.
@@ -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[];
@@ -2063,11 +2118,6 @@ export type Experiments = {
2063
2118
  * @default false
2064
2119
  */
2065
2120
  asyncWebAssembly?: boolean;
2066
- /**
2067
- * Enable output as ES module.
2068
- * @default false
2069
- */
2070
- outputModule?: boolean;
2071
2121
  /**
2072
2122
  * Enable CSS support.
2073
2123
  *
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
@@ -1475,7 +1475,18 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1475
1475
  seal: new SyncHook([]),
1476
1476
  afterSeal: new AsyncSeriesHook([]),
1477
1477
  needAdditionalPass: new SyncBailHook([])
1478
- }, 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();
1479
1490
  }
1480
1491
  get hash() {
1481
1492
  return this.#inner.hash;
@@ -2186,7 +2197,7 @@ class EnableLibraryPlugin extends RspackBuiltinPlugin {
2186
2197
  }
2187
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, ()=>({}));
2188
2199
  function applyLimits(options) {
2189
- 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');
2190
2201
  let { splitChunks } = options.optimization;
2191
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);
2192
2203
  }
@@ -6037,7 +6048,6 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6037
6048
  }), applySnapshotDefaults(options.snapshot, {
6038
6049
  production
6039
6050
  }), applyModuleDefaults(options.module, {
6040
- cache: !!options.cache,
6041
6051
  asyncWebAssembly: options.experiments.asyncWebAssembly,
6042
6052
  targetProperties,
6043
6053
  mode: options.mode,
@@ -6047,7 +6057,6 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6047
6057
  context: options.context,
6048
6058
  targetProperties,
6049
6059
  isAffectedByBrowserslist: void 0 === target || 'string' == typeof target && target.startsWith('browserslist') || Array.isArray(target) && target.some((target)=>target.startsWith('browserslist')),
6050
- outputModule: options.experiments.outputModule,
6051
6060
  entry: options.entry
6052
6061
  }), applyExternalsPresetsDefaults(options.externalsPresets, {
6053
6062
  targetProperties,
@@ -6080,11 +6089,11 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6080
6089
  }, applyExperimentsDefaults = (experiments)=>{
6081
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);
6082
6091
  }, applyIncrementalDefaults = (options)=>{
6083
- 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', !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, 'chunkAsset', !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));
6084
6093
  }, applySnapshotDefaults = (_snapshot, _env)=>{}, applyCssGeneratorOptionsDefaults = (generatorOptions, { targetProperties })=>{
6085
6094
  D(generatorOptions, 'exportsOnly', !targetProperties || !1 === targetProperties.document), D(generatorOptions, 'esModule', !0);
6086
- }, applyModuleDefaults = (module, { cache, asyncWebAssembly, targetProperties, mode, uniqueName, deferImport })=>{
6087
- 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 })=>{
6088
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', [
6089
6098
  '...'
6090
6099
  ]), D(parserOptions, 'importMeta', !0), D(parserOptions, 'typeReexportsPresence', 'no-tolerant'), D(parserOptions, 'jsx', !1), D(parserOptions, 'deferImport', deferImport);
@@ -6205,7 +6214,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6205
6214
  type: 'asset/bytes'
6206
6215
  }), rules;
6207
6216
  });
6208
- }, applyOutputDefaults = (options, { context, outputModule, targetProperties: tp, isAffectedByBrowserslist, entry })=>{
6217
+ }, applyOutputDefaults = (options, { context, targetProperties: tp, isAffectedByBrowserslist, entry })=>{
6209
6218
  let { output } = options, getLibraryName = (library)=>{
6210
6219
  let libraryName = 'object' == typeof library && library && !Array.isArray(library) ? library.name : library;
6211
6220
  return Array.isArray(libraryName) ? libraryName.join('.') : 'object' == typeof libraryName ? getLibraryName(libraryName.root) : 'string' == typeof libraryName ? libraryName : '';
@@ -6223,7 +6232,19 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6223
6232
  if ('ENOENT' !== err.code) throw err.message += `\nwhile determining default 'output.uniqueName' from 'name' in ${pkgPath}`, err;
6224
6233
  return '';
6225
6234
  }
6226
- }), 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)));
6227
6248
  let environment = output.environment, conditionallyOptimistic = (v, c)=>void 0 === v && c || v;
6228
6249
  F(environment, 'globalThis', ()=>tp && tp.globalThis), F(environment, 'bigIntLiteral', ()=>{
6229
6250
  let v;
@@ -6273,7 +6294,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6273
6294
  return 'function' != typeof chunkFilename ? chunkFilename.replace(/\.[mc]?js(\?|$)/, '.css$1') : '[id].css';
6274
6295
  }), D(output, 'hotUpdateChunkFilename', `[id].[fullhash].hot-update.${output.module ? 'mjs' : 'js'}`), F(output, 'hotUpdateMainFilename', ()=>`[runtime].[fullhash].hot-update.${output.module ? 'json.mjs' : 'json'}`);
6275
6296
  let uniqueNameId = Template.toIdentifier(output.uniqueName);
6276
- 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', ()=>{
6277
6298
  if (tp) {
6278
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.";
6279
6300
  if (output.module) {
@@ -6335,16 +6356,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6335
6356
  return 'self';
6336
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);
6337
6358
  let { trustedTypes } = output;
6338
- trustedTypes && (F(trustedTypes, 'policyName', ()=>output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, '_') || 'rspack'), D(trustedTypes, 'onPolicyCreationFailure', 'stop'));
6339
- let forEachEntry = (fn)=>{
6340
- if ('function' != typeof entry) for (let name of Object.keys(entry))fn(entry[name]);
6341
- };
6342
- A(output, 'enabledLibraryTypes', ()=>{
6343
- let enabledLibraryTypes = [];
6344
- return output.library && enabledLibraryTypes.push(output.library.type), forEachEntry((desc)=>{
6345
- desc.library && enabledLibraryTypes.push(desc.library.type);
6346
- }), enabledLibraryTypes.includes('modern-module') && applyLimits(options), enabledLibraryTypes;
6347
- }), A(output, 'enabledChunkLoadingTypes', ()=>{
6359
+ trustedTypes && (F(trustedTypes, 'policyName', ()=>output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, '_') || 'rspack'), D(trustedTypes, 'onPolicyCreationFailure', 'stop')), A(output, 'enabledChunkLoadingTypes', ()=>{
6348
6360
  let enabledChunkLoadingTypes = new Set();
6349
6361
  return output.chunkLoading && enabledChunkLoadingTypes.add(output.chunkLoading), output.workerChunkLoading && enabledChunkLoadingTypes.add(output.workerChunkLoading), forEachEntry((desc)=>{
6350
6362
  desc.chunkLoading && enabledChunkLoadingTypes.add(desc.chunkLoading);
@@ -6354,7 +6366,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6354
6366
  return output.wasmLoading && enabledWasmLoadingTypes.add(output.wasmLoading), output.workerWasmLoading && enabledWasmLoadingTypes.add(output.workerWasmLoading), forEachEntry((desc)=>{
6355
6367
  desc.wasmLoading && enabledWasmLoadingTypes.add(desc.wasmLoading);
6356
6368
  }), Array.from(enabledWasmLoadingTypes);
6357
- }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.0-alpha.1"), 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));
6358
6370
  }, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp, outputModule })=>{
6359
6371
  let isUniversal = (key)=>!!(outputModule && targetProperties && null === targetProperties[key]);
6360
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')));
@@ -6635,8 +6647,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6635
6647
  ]),
6636
6648
  rules: nestedArray(module.rules, (r)=>[
6637
6649
  ...r
6638
- ]),
6639
- unsafeCache: module.unsafeCache
6650
+ ])
6640
6651
  })),
6641
6652
  target: config.target,
6642
6653
  externals: config.externals,
@@ -6672,7 +6683,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6672
6683
  storage: {
6673
6684
  type: 'filesystem',
6674
6685
  directory: node_path.resolve(config.context || process.cwd(), cache.storage?.directory || 'node_modules/.cache/rspack')
6675
- }
6686
+ },
6687
+ portable: cache.portable
6676
6688
  };
6677
6689
  }),
6678
6690
  stats: nestedConfig(config.stats, (stats)=>!1 === stats ? {
@@ -6772,7 +6784,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6772
6784
  buildModuleGraph: !0,
6773
6785
  finishModules: !1,
6774
6786
  optimizeDependencies: !1,
6775
- buildChunkGraph: !1,
6787
+ buildChunkGraph: !0,
6776
6788
  moduleIds: !1,
6777
6789
  chunkIds: !1,
6778
6790
  modulesHashes: !1,
@@ -7606,7 +7618,7 @@ class MultiStats {
7606
7618
  obj.children = this.stats.map((stat, idx)=>{
7607
7619
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
7608
7620
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
7609
- }), childOptions.version && (obj.rspackVersion = "2.0.0-alpha.1", 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(''));
7610
7622
  let mapError = (j, obj)=>({
7611
7623
  ...obj,
7612
7624
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -8865,7 +8877,7 @@ let iterateConfig = (config, options, fn)=>{
8865
8877
  object.hash = context.getStatsCompilation(compilation).hash;
8866
8878
  },
8867
8879
  version: (object)=>{
8868
- object.version = "5.75.0", object.rspackVersion = "2.0.0-alpha.1";
8880
+ object.version = "5.75.0", object.rspackVersion = "2.0.0-beta.0";
8869
8881
  },
8870
8882
  env: (object, _compilation, _context, { _env })=>{
8871
8883
  object.env = _env;
@@ -10526,7 +10538,7 @@ class TraceHookPlugin {
10526
10538
  });
10527
10539
  }
10528
10540
  }
10529
- let CORE_VERSION = "2.0.0-alpha.1", VFILES_BY_COMPILER = new WeakMap();
10541
+ let CORE_VERSION = "2.0.0-beta.0", VFILES_BY_COMPILER = new WeakMap();
10530
10542
  class VirtualModulesPlugin {
10531
10543
  #staticModules;
10532
10544
  #compiler;
@@ -10838,6 +10850,17 @@ class Compiler {
10838
10850
  ]),
10839
10851
  additionalPass: new AsyncSeriesHook([])
10840
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
+ });
10841
10864
  let compilerRspack = Object.assign(function(...params) {
10842
10865
  return rspack(...params);
10843
10866
  }, exports_namespaceObject, {
@@ -11118,8 +11141,7 @@ Help:
11118
11141
  k,
11119
11142
  getRawGeneratorOptions(v, k)
11120
11143
  ]).filter(([_, v])=>void 0 !== v)),
11121
- noParse: module.noParse,
11122
- unsafeCache: module.unsafeCache
11144
+ noParse: module.noParse
11123
11145
  };
11124
11146
  }(options.module, {
11125
11147
  compiler: this,
@@ -12321,7 +12343,7 @@ async function transform(source, options) {
12321
12343
  let _options = JSON.stringify(options || {});
12322
12344
  return binding_default().transform(source, _options);
12323
12345
  }
12324
- let exports_rspackVersion = "2.0.0-alpha.1", 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 = {
12325
12347
  getNormalizedRspackOptions: getNormalizedRspackOptions,
12326
12348
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
12327
12349
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -12612,6 +12634,4 @@ src_fn.rspack = src_fn, src_fn.webpack = src_fn;
12612
12634
  let src_rspack_0 = src_fn;
12613
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;
12614
12636
  export default src_rspack_0;
12615
- 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 };
12616
-
12617
- 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.1",
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.1"
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",