@rspack/core 1.6.0-beta.1 → 1.6.1

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.
@@ -7,6 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
+ import type { MultiStatsOptions, StatsPresets } from "./config";
10
11
  import type { Stats } from "./Stats";
11
12
  import type { StatsCompilation } from "./stats/statsFactoryUtils";
12
13
  export default class MultiStats {
@@ -16,7 +17,7 @@ export default class MultiStats {
16
17
  get hash(): string;
17
18
  hasErrors(): boolean;
18
19
  hasWarnings(): boolean;
19
- toJson(options: any): StatsCompilation;
20
- toString(options: any): string;
20
+ toJson(options: boolean | StatsPresets | MultiStatsOptions): StatsCompilation;
21
+ toString(options: boolean | StatsPresets | MultiStatsOptions): string;
21
22
  }
22
23
  export { MultiStats };
@@ -0,0 +1,9 @@
1
+ export declare const InlineExportsPlugin: {
2
+ new (): {
3
+ name: string;
4
+ _args: [];
5
+ affectedHooks: keyof import("..").CompilerHooks | undefined;
6
+ raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
7
+ apply(compiler: import("..").Compiler): void;
8
+ };
9
+ };
@@ -1,3 +1,4 @@
1
+ import type { LiteralUnion } from "../config";
1
2
  import type { AssetConditions } from "../util/assetCondition";
2
3
  type ExtractCommentsCondition = boolean | RegExp;
3
4
  type ExtractCommentsBanner = string | boolean;
@@ -132,7 +133,7 @@ export interface JsFormatOptions {
132
133
  */
133
134
  wrapFuncArgs?: boolean;
134
135
  }
135
- export type TerserEcmaVersion = 5 | 2015 | 2016 | string | number;
136
+ export type TerserEcmaVersion = LiteralUnion<5 | 2015 | 2016, number> | string;
136
137
  export interface TerserCompressOptions {
137
138
  arguments?: boolean;
138
139
  arrows?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { type RawCssExtractPluginOption } from "@rspack/binding";
2
- import type { Compiler } from "../..";
2
+ import type { Compiler, LiteralUnion } from "../..";
3
3
  export * from "./loader";
4
4
  export type { CssExtractRspackLoaderOptions } from "./loader";
5
5
  export interface CssExtractRspackPluginOptions {
@@ -8,7 +8,7 @@ export interface CssExtractRspackPluginOptions {
8
8
  ignoreOrder?: boolean;
9
9
  insert?: string | ((linkTag: HTMLLinkElement) => void);
10
10
  attributes?: Record<string, string>;
11
- linkType?: string | "text/css" | false;
11
+ linkType?: LiteralUnion<"text/css", string> | false;
12
12
  runtime?: boolean;
13
13
  pathinfo?: boolean;
14
14
  enforceRelative?: boolean;
@@ -40,6 +40,7 @@ export * from "./HttpUriPlugin";
40
40
  export * from "./html-plugin/index";
41
41
  export * from "./IgnorePlugin";
42
42
  export * from "./InferAsyncModulesPlugin";
43
+ export * from "./InlineExportsPlugin";
43
44
  export * from "./JavascriptModulesPlugin";
44
45
  export * from "./JsLoaderRspackPlugin";
45
46
  export * from "./JsonModulesPlugin";
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack-dev-server/blob/master/LICENSE
9
9
  */
10
- import type { Compiler, MultiCompiler, MultiStats, Stats, Watching } from "..";
10
+ import type { Compiler, LiteralUnion, MultiCompiler, MultiStats, Stats, Watching } from "..";
11
11
  type Logger = ReturnType<Compiler["getInfrastructureLogger"]>;
12
12
  type MultiWatching = MultiCompiler["watch"];
13
13
  type BasicServer = import("net").Server | import("tls").Server;
@@ -33,12 +33,11 @@ type Headers = {
33
33
  value: string;
34
34
  }[] | Record<string, string | string[]>;
35
35
  type OutputFileSystem = import("..").OutputFileSystem & {
36
- createReadStream?: typeof import("fs").createReadStream;
37
36
  statSync: import("fs").StatSyncFn;
38
37
  readFileSync: typeof import("fs").readFileSync;
39
38
  };
40
39
  type RspackConfiguration = import("..").Configuration;
41
- type Port = number | string | "auto";
40
+ type Port = number | LiteralUnion<"auto", string>;
42
41
  type HistoryContext = {
43
42
  readonly match: RegExpMatchArray;
44
43
  readonly parsedUrl: import("url").Url;
@@ -80,7 +79,7 @@ type DevMiddlewareOptions<RequestInternal extends IncomingMessage = IncomingMess
80
79
  cacheImmutable?: boolean | undefined;
81
80
  };
82
81
  type BasicApplication = any;
83
- type BonjourServer = any;
82
+ type BonjourServer = Record<string, any>;
84
83
  type ChokidarWatchOptions = {
85
84
  [key: string]: any;
86
85
  };
@@ -112,7 +111,7 @@ type Static = {
112
111
  poll?: number | boolean;
113
112
  }) | undefined;
114
113
  };
115
- type ServerType<A extends BasicApplication = BasicApplication, S extends BasicServer = import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>> = "http" | "https" | "spdy" | "http2" | string | ((arg0: ServerOptions, arg1: A) => S);
114
+ type ServerType<A extends BasicApplication = BasicApplication, S extends BasicServer = import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>> = LiteralUnion<"http" | "https" | "spdy" | "http2", string> | ((arg0: ServerOptions, arg1: A) => S);
116
115
  type ServerConfiguration<A extends BasicApplication = BasicApplication, S extends BasicServer = import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>> = {
117
116
  type?: ServerType<A, S> | undefined;
118
117
  options?: ServerOptions | undefined;
@@ -123,8 +122,8 @@ type WebSocketServerConfiguration = {
123
122
  };
124
123
  type NextFunction = (err?: any) => void;
125
124
  type ProxyConfigArrayItem = {
126
- path?: HttpProxyMiddlewareOptionsFilter | undefined;
127
- context?: HttpProxyMiddlewareOptionsFilter | undefined;
125
+ path?: HttpProxyMiddlewareOptionsFilter;
126
+ context?: HttpProxyMiddlewareOptionsFilter;
128
127
  } & {
129
128
  bypass?: ByPass;
130
129
  } & {
@@ -190,7 +189,7 @@ export type DevServerOptions<A extends BasicApplication = BasicApplication, S ex
190
189
  compress?: boolean | undefined;
191
190
  allowedHosts?: string | string[] | undefined;
192
191
  historyApiFallback?: boolean | HistoryApiFallbackOptions | undefined;
193
- bonjour?: boolean | Record<string, never> | BonjourServer | undefined;
192
+ bonjour?: boolean | BonjourServer | undefined;
194
193
  watchFiles?: string | string[] | WatchFiles | (string | WatchFiles)[] | undefined;
195
194
  static?: string | boolean | Static | (string | Static)[] | undefined;
196
195
  server?: ServerType<A, S> | ServerConfiguration<A, S> | undefined;
@@ -9,6 +9,8 @@ import type { Module } from "../Module";
9
9
  import type ModuleGraph from "../ModuleGraph";
10
10
  import type { ResolveCallback } from "./adapterRuleUse";
11
11
  import type { DevServerOptions } from "./devServer";
12
+ /** https://github.com/microsoft/TypeScript/issues/29729 */
13
+ export type LiteralUnion<T extends U, U> = T | (U & Record<never, never>);
12
14
  export type FilenameTemplate = string;
13
15
  export type Filename = FilenameTemplate | ((pathData: PathData, assetInfo?: AssetInfo) => string);
14
16
  /** Name of the configuration. Used when loading multiple configurations. */
@@ -27,17 +29,17 @@ export type Context = string;
27
29
  export type Mode = "development" | "production" | "none";
28
30
  export type Falsy = false | "" | 0 | null | undefined;
29
31
  /** The publicPath of the resource referenced by this entry. */
30
- export type PublicPath = "auto" | Filename;
32
+ export type PublicPath = LiteralUnion<"auto", string> | Exclude<Filename, string>;
31
33
  /** The baseURI of the resource referenced by this entry. */
32
34
  export type BaseUri = string;
33
35
  /** How this entry load other chunks. */
34
- export type ChunkLoadingType = string | "jsonp" | "import-scripts" | "require" | "async-node" | "import";
36
+ export type ChunkLoadingType = LiteralUnion<"jsonp" | "import-scripts" | "require" | "async-node" | "import", string>;
35
37
  /** How this entry load other chunks. */
36
38
  export type ChunkLoading = false | ChunkLoadingType;
37
39
  /** Whether to create a load-on-demand asynchronous chunk for entry. */
38
40
  export type AsyncChunks = boolean;
39
41
  /** Option to set the method of loading WebAssembly Modules. */
40
- export type WasmLoadingType = string | "fetch-streaming" | "fetch" | "async-node";
42
+ export type WasmLoadingType = LiteralUnion<"fetch-streaming" | "fetch" | "async-node", string>;
41
43
  /** Option to set the method of loading WebAssembly Modules. */
42
44
  export type WasmLoading = false | WasmLoadingType;
43
45
  export type ScriptType = false | "text/javascript" | "module";
@@ -61,7 +63,7 @@ export type AuxiliaryComment = string | LibraryCustomUmdCommentObject;
61
63
  /** Specify which export should be exposed as a library. */
62
64
  export type LibraryExport = string | string[];
63
65
  /** Configure how the library will be exposed. */
64
- export type LibraryType = string | "var" | "module" | "assign" | "assign-properties" | "this" | "window" | "self" | "global" | "commonjs" | "commonjs2" | "commonjs-module" | "commonjs-static" | "amd" | "amd-require" | "umd" | "umd2" | "jsonp" | "system";
66
+ export type LibraryType = LiteralUnion<"var" | "module" | "assign" | "assign-properties" | "this" | "window" | "self" | "global" | "commonjs" | "commonjs2" | "commonjs-module" | "commonjs-static" | "amd" | "amd-require" | "umd" | "umd2" | "jsonp" | "system", string>;
65
67
  /** When using output.library.type: "umd", setting output.library.umdNamedDefine to true will name the AMD module of the UMD build. */
66
68
  export type UmdNamedDefine = boolean;
67
69
  /** Options for library. */
@@ -224,8 +226,32 @@ export type HashSalt = string;
224
226
  export type SourceMapFilename = string;
225
227
  /** This option determines the module's namespace */
226
228
  export type DevtoolNamespace = string;
229
+ export interface ModuleFilenameTemplateContext {
230
+ /** The identifier of the module */
231
+ identifier: string;
232
+ /** The shortened identifier of the module */
233
+ shortIdentifier: string;
234
+ /** The resource of the module request */
235
+ resource: string;
236
+ /** The resource path of the module request */
237
+ resourcePath: string;
238
+ /** The absolute resource path of the module request */
239
+ absoluteResourcePath: string;
240
+ /** The loaders of the module request */
241
+ loaders: string;
242
+ /** All loaders of the module request */
243
+ allLoaders: string;
244
+ /** The query of the module identifier */
245
+ query: string;
246
+ /** The module id of the module */
247
+ moduleId: string;
248
+ /** The hash of the module identifier */
249
+ hash: string;
250
+ /** The module namespace */
251
+ namespace: string;
252
+ }
227
253
  /** This option is only used when devtool uses an option that requires module names. */
228
- export type DevtoolModuleFilenameTemplate = string | ((info: any) => any);
254
+ export type DevtoolModuleFilenameTemplate = string | ((context: ModuleFilenameTemplateContext) => string);
229
255
  /** A fallback is used when the template string or function above yields duplicates. */
230
256
  export type DevtoolFallbackModuleFilenameTemplate = DevtoolModuleFilenameTemplate;
231
257
  /** Tell Rspack what kind of ES-features may be used in the generated runtime-code. */
@@ -1199,7 +1225,7 @@ export type SnapshotOptions = {};
1199
1225
  * cache: false
1200
1226
  */
1201
1227
  export type CacheOptions = boolean;
1202
- type StatsPresets = "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary";
1228
+ export type StatsPresets = "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary";
1203
1229
  type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
1204
1230
  type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
1205
1231
  export type StatsColorOptions = {
@@ -1600,6 +1626,9 @@ export type StatsOptions = {
1600
1626
  */
1601
1627
  warningsSpace?: number;
1602
1628
  };
1629
+ export type MultiStatsOptions = Omit<StatsOptions, "children"> & {
1630
+ children?: StatsValue | (StatsValue | undefined)[];
1631
+ };
1603
1632
  /**
1604
1633
  * Represents the value for stats configuration.
1605
1634
  */
@@ -108,8 +108,7 @@ function cssReload(moduleId, options) {
108
108
  return;
109
109
  }
110
110
  reloaded ? console.log("[HMR] CSS reload %s", src && src.join(" ")) : (console.log("[HMR] Reload all CSS"), reloadAll());
111
- }, timeout = 0, function() {
112
- for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key];
111
+ }, timeout = 0, function(...args) {
113
112
  let self = this;
114
113
  clearTimeout(timeout), timeout = setTimeout(function() {
115
114
  return fn.apply(self, args);
@@ -19,14 +19,14 @@ __webpack_require__.n = (module)=>{
19
19
  };
20
20
  var __webpack_exports__ = {};
21
21
  __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
22
- ABSOLUTE_PUBLIC_PATH: ()=>ABSOLUTE_PUBLIC_PATH,
22
+ hotLoader: ()=>hotLoader,
23
23
  default: ()=>css_extract_loader,
24
- SINGLE_DOT_PATH_SEGMENT: ()=>SINGLE_DOT_PATH_SEGMENT,
24
+ ABSOLUTE_PUBLIC_PATH: ()=>ABSOLUTE_PUBLIC_PATH,
25
25
  MODULE_TYPE: ()=>MODULE_TYPE,
26
- BASE_URI: ()=>BASE_URI,
27
- hotLoader: ()=>hotLoader,
28
26
  AUTO_PUBLIC_PATH: ()=>AUTO_PUBLIC_PATH,
29
- pitch: ()=>pitch
27
+ pitch: ()=>pitch,
28
+ SINGLE_DOT_PATH_SEGMENT: ()=>SINGLE_DOT_PATH_SEGMENT,
29
+ BASE_URI: ()=>BASE_URI
30
30
  });
31
31
  const external_node_path_namespaceObject = require("node:path");
32
32
  var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
package/dist/index.js CHANGED
@@ -289,75 +289,75 @@ var __webpack_exports__ = {};
289
289
  for(var __webpack_i__ in (()=>{
290
290
  let createMd4, createXxhash64, service_pool, loadLoader_url;
291
291
  __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
292
- CopyRspackPlugin: ()=>CopyRspackPlugin,
293
- RuntimePlugin: ()=>RuntimePlugin,
292
+ EntryPlugin: ()=>EntryPlugin,
293
+ version: ()=>exports_version,
294
+ webworker: ()=>webworker,
294
295
  RspackOptionsApply: ()=>RspackOptionsApply,
295
- SourceMapDevToolPlugin: ()=>SourceMapDevToolPlugin,
296
- AsyncDependenciesBlock: ()=>binding_.AsyncDependenciesBlock,
297
- electron: ()=>electron,
298
- ExternalModule: ()=>binding_.ExternalModule,
299
- Stats: ()=>Stats,
300
- LoaderOptionsPlugin: ()=>LoaderOptionsPlugin,
301
- Template: ()=>Template,
302
- Compilation: ()=>Compilation,
303
- IgnorePlugin: ()=>IgnorePlugin,
304
- ContextModule: ()=>binding_.ContextModule,
305
- WebpackError: ()=>exports_WebpackError,
306
- RuntimeGlobals: ()=>RuntimeGlobals,
307
296
  DynamicEntryPlugin: ()=>DynamicEntryPlugin,
308
- EntryPlugin: ()=>EntryPlugin,
297
+ NoEmitOnErrorsPlugin: ()=>NoEmitOnErrorsPlugin,
298
+ Stats: ()=>Stats,
309
299
  EntryDependency: ()=>binding_.EntryDependency,
310
- DllReferencePlugin: ()=>DllReferencePlugin,
311
- HotModuleReplacementPlugin: ()=>HotModuleReplacementPlugin,
312
- Dependency: ()=>binding_.Dependency,
313
- LoaderTargetPlugin: ()=>LoaderTargetPlugin,
314
- container: ()=>container,
315
- EvalDevToolModulePlugin: ()=>EvalDevToolModulePlugin,
300
+ BannerPlugin: ()=>BannerPlugin,
301
+ ExternalsPlugin: ()=>ExternalsPlugin,
302
+ MultiStats: ()=>MultiStats,
316
303
  SwcJsMinimizerRspackPlugin: ()=>SwcJsMinimizerRspackPlugin,
317
- MultiCompiler: ()=>MultiCompiler,
318
- EntryOptionPlugin: ()=>lib_EntryOptionPlugin,
304
+ ContextModule: ()=>binding_.ContextModule,
305
+ DllPlugin: ()=>DllPlugin,
306
+ WarnCaseSensitiveModulesPlugin: ()=>WarnCaseSensitiveModulesPlugin,
307
+ ProvidePlugin: ()=>ProvidePlugin,
308
+ Template: ()=>Template,
309
+ container: ()=>container,
310
+ HtmlRspackPlugin: ()=>HtmlRspackPlugin,
319
311
  javascript: ()=>javascript,
320
- sources: ()=>sources,
321
- EvalSourceMapDevToolPlugin: ()=>EvalSourceMapDevToolPlugin,
322
- ContextReplacementPlugin: ()=>ContextReplacementPlugin,
312
+ EvalDevToolModulePlugin: ()=>EvalDevToolModulePlugin,
313
+ NormalModuleReplacementPlugin: ()=>NormalModuleReplacementPlugin,
314
+ WebpackOptionsApply: ()=>RspackOptionsApply,
323
315
  EnvironmentPlugin: ()=>EnvironmentPlugin,
324
- NoEmitOnErrorsPlugin: ()=>NoEmitOnErrorsPlugin,
316
+ HotModuleReplacementPlugin: ()=>HotModuleReplacementPlugin,
317
+ Compilation: ()=>Compilation,
318
+ experiments: ()=>exports_experiments,
319
+ CircularDependencyRspackPlugin: ()=>CircularDependencyRspackPlugin,
320
+ EvalSourceMapDevToolPlugin: ()=>EvalSourceMapDevToolPlugin,
321
+ RuntimePlugin: ()=>RuntimePlugin,
322
+ Dependency: ()=>binding_.Dependency,
323
+ DllReferencePlugin: ()=>DllReferencePlugin,
324
+ IgnorePlugin: ()=>IgnorePlugin,
325
+ StatsErrorCode: ()=>statsFactoryUtils_StatsErrorCode,
326
+ sources: ()=>sources,
325
327
  ValidationError: ()=>ValidationError,
326
- LightningCssMinimizerRspackPlugin: ()=>LightningCssMinimizerRspackPlugin,
327
- default: ()=>src_0,
328
+ ConcatenatedModule: ()=>binding_.ConcatenatedModule,
329
+ AsyncDependenciesBlock: ()=>binding_.AsyncDependenciesBlock,
328
330
  web: ()=>web,
331
+ default: ()=>src_0,
332
+ LoaderTargetPlugin: ()=>LoaderTargetPlugin,
333
+ WebpackError: ()=>exports_WebpackError,
334
+ RuntimeModule: ()=>RuntimeModule,
329
335
  sharing: ()=>sharing,
330
- CircularDependencyRspackPlugin: ()=>CircularDependencyRspackPlugin,
331
- NormalModule: ()=>binding_.NormalModule,
332
336
  config: ()=>exports_config,
337
+ ContextReplacementPlugin: ()=>ContextReplacementPlugin,
338
+ NormalModule: ()=>binding_.NormalModule,
339
+ LightningCssMinimizerRspackPlugin: ()=>LightningCssMinimizerRspackPlugin,
340
+ LoaderOptionsPlugin: ()=>LoaderOptionsPlugin,
341
+ EntryOptionPlugin: ()=>lib_EntryOptionPlugin,
342
+ Compiler: ()=>Compiler,
343
+ DefinePlugin: ()=>DefinePlugin,
333
344
  ModuleFilenameHelpers: ()=>ModuleFilenameHelpers_namespaceObject,
334
- webworker: ()=>webworker,
335
- experiments: ()=>exports_experiments,
336
- RuntimeModule: ()=>RuntimeModule,
345
+ MultiCompiler: ()=>MultiCompiler,
346
+ SourceMapDevToolPlugin: ()=>SourceMapDevToolPlugin,
337
347
  library: ()=>exports_library,
338
348
  node: ()=>exports_node,
339
- HtmlRspackPlugin: ()=>HtmlRspackPlugin,
340
- WarnCaseSensitiveModulesPlugin: ()=>WarnCaseSensitiveModulesPlugin,
349
+ RuntimeGlobals: ()=>RuntimeGlobals,
350
+ rspackVersion: ()=>exports_rspackVersion,
341
351
  util: ()=>util,
342
- ConcatenatedModule: ()=>binding_.ConcatenatedModule,
343
352
  optimize: ()=>optimize,
344
- ProvidePlugin: ()=>ProvidePlugin,
345
- rspackVersion: ()=>exports_rspackVersion,
346
- DllPlugin: ()=>DllPlugin,
347
- CssExtractRspackPlugin: ()=>CssExtractRspackPlugin,
348
- DefinePlugin: ()=>DefinePlugin,
349
- BannerPlugin: ()=>BannerPlugin,
350
- ProgressPlugin: ()=>ProgressPlugin,
351
- StatsErrorCode: ()=>statsFactoryUtils_StatsErrorCode,
352
- MultiStats: ()=>MultiStats,
353
+ ExternalModule: ()=>binding_.ExternalModule,
354
+ electron: ()=>electron,
353
355
  Module: ()=>binding_.Module,
354
- WebpackOptionsApply: ()=>RspackOptionsApply,
355
- NormalModuleReplacementPlugin: ()=>NormalModuleReplacementPlugin,
356
- ExternalsPlugin: ()=>ExternalsPlugin,
357
- rspack: ()=>src_rspack,
358
- Compiler: ()=>Compiler,
356
+ CopyRspackPlugin: ()=>CopyRspackPlugin,
357
+ rspack: ()=>src_rspack_0,
358
+ CssExtractRspackPlugin: ()=>CssExtractRspackPlugin,
359
359
  wasm: ()=>exports_wasm,
360
- version: ()=>exports_version
360
+ ProgressPlugin: ()=>ProgressPlugin
361
361
  });
362
362
  var StatsErrorCode, _computedKey, _computedKey1, _computedKey2, ArrayQueue_computedKey, browserslistTargetHandler_namespaceObject = {};
363
363
  __webpack_require__.r(browserslistTargetHandler_namespaceObject), __webpack_require__.d(browserslistTargetHandler_namespaceObject, {
@@ -449,7 +449,7 @@ for(var __webpack_i__ in (()=>{
449
449
  return -1 === nextLine ? stack === message ? "" : stack : stack.slice(0, nextLine) === `${name}: ${message}` ? stack.slice(nextLine + 1) : stack;
450
450
  }, external_node_util_namespaceObject = require("node:util");
451
451
  var external_node_util_default = __webpack_require__.n(external_node_util_namespaceObject);
452
- class WebpackError_WebpackError extends Error {
452
+ class WebpackError extends Error {
453
453
  loc;
454
454
  file;
455
455
  chunk;
@@ -457,14 +457,14 @@ for(var __webpack_i__ in (()=>{
457
457
  details;
458
458
  hideStack;
459
459
  }
460
- Object.defineProperty(WebpackError_WebpackError.prototype, external_node_util_namespaceObject.inspect.custom, {
460
+ Object.defineProperty(WebpackError.prototype, external_node_util_namespaceObject.inspect.custom, {
461
461
  value: function() {
462
462
  return this.stack + (this.details ? `\n${this.details}` : "");
463
463
  },
464
464
  enumerable: !1,
465
465
  configurable: !0
466
466
  });
467
- let WebpackError = WebpackError_WebpackError, LogType = Object.freeze({
467
+ let lib_WebpackError = WebpackError, LogType = Object.freeze({
468
468
  error: "error",
469
469
  warn: "warn",
470
470
  info: "info",
@@ -1218,22 +1218,22 @@ for(var __webpack_i__ in (()=>{
1218
1218
  };
1219
1219
  }
1220
1220
  var index_js_ = __webpack_require__("webpack-sources");
1221
- class JsSource extends index_js_.Source {
1222
- static __from_binding(source) {
1223
- return Buffer.isBuffer(source.source) || !source.map ? new index_js_.RawSource(source.source) : new index_js_.SourceMapSource(source.source, "inmemory://from rust", source.map);
1224
- }
1225
- static __to_binding(source) {
1226
- if (source instanceof index_js_.RawSource) return source.isBuffer() ? {
1227
- source: source.buffer()
1228
- } : {
1229
- source: source.source()
1221
+ class SourceAdapter {
1222
+ static fromBinding(source) {
1223
+ return source.map ? new index_js_.SourceMapSource(source.source, "inmemory://from rust", source.map) : new index_js_.RawSource(source.source);
1224
+ }
1225
+ static toBinding(source) {
1226
+ let content = source.source();
1227
+ if (Buffer.isBuffer(content)) return {
1228
+ source: content,
1229
+ map: void 0
1230
1230
  };
1231
- let map = JSON.stringify(source.map?.({
1231
+ let map = source.map?.({
1232
1232
  columns: !0
1233
- })), code = source.source();
1233
+ });
1234
1234
  return {
1235
- source: "string" == typeof code ? code : Buffer.from(code).toString("utf-8"),
1236
- map
1235
+ source: content,
1236
+ map: map ? JSON.stringify(map) : void 0
1237
1237
  };
1238
1238
  }
1239
1239
  }
@@ -1287,6 +1287,33 @@ for(var __webpack_i__ in (()=>{
1287
1287
  ...this
1288
1288
  };
1289
1289
  }
1290
+ }), Object.defineProperty(binding_.Chunks.prototype, "entries", {
1291
+ enumerable: !0,
1292
+ configurable: !0,
1293
+ value () {
1294
+ let chunks = this._values(), index = 0;
1295
+ return {
1296
+ [Symbol.iterator] () {
1297
+ return this;
1298
+ },
1299
+ next () {
1300
+ if (index < chunks.length) {
1301
+ let chunk = chunks[index++];
1302
+ return {
1303
+ value: [
1304
+ chunk,
1305
+ chunk
1306
+ ],
1307
+ done: !1
1308
+ };
1309
+ }
1310
+ return {
1311
+ value: void 0,
1312
+ done: !0
1313
+ };
1314
+ }
1315
+ };
1316
+ }
1290
1317
  }), Object.defineProperty(binding_.Chunks.prototype, "values", {
1291
1318
  enumerable: !0,
1292
1319
  configurable: !0,
@@ -1348,7 +1375,7 @@ for(var __webpack_i__ in (()=>{
1348
1375
  configurable: !0,
1349
1376
  value (sourceType) {
1350
1377
  let originalSource = this._get(sourceType);
1351
- return originalSource ? JsSource.__from_binding(originalSource) : null;
1378
+ return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
1352
1379
  }
1353
1380
  });
1354
1381
  let $proxy = Symbol.for("proxy");
@@ -1644,11 +1671,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1644
1671
  updateAsset(filename, newSourceOrFunction, assetInfoUpdateOrFunction) {
1645
1672
  let compatNewSourceOrFunction;
1646
1673
  compatNewSourceOrFunction = "function" == typeof newSourceOrFunction ? function(source) {
1647
- return JsSource.__to_binding(newSourceOrFunction(JsSource.__from_binding(source)));
1648
- } : JsSource.__to_binding(newSourceOrFunction), this.#inner.updateAsset(filename, compatNewSourceOrFunction, assetInfoUpdateOrFunction);
1674
+ return SourceAdapter.toBinding(newSourceOrFunction(SourceAdapter.fromBinding(source)));
1675
+ } : SourceAdapter.toBinding(newSourceOrFunction), this.#inner.updateAsset(filename, compatNewSourceOrFunction, assetInfoUpdateOrFunction);
1649
1676
  }
1650
1677
  emitAsset(filename, source, assetInfo) {
1651
- this.#inner.emitAsset(filename, JsSource.__to_binding(source), assetInfo);
1678
+ this.#inner.emitAsset(filename, SourceAdapter.toBinding(source), assetInfo);
1652
1679
  }
1653
1680
  deleteAsset(filename) {
1654
1681
  this.#inner.deleteAsset(filename);
@@ -1821,10 +1848,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1821
1848
  }
1822
1849
  __internal__getAssetSource(filename) {
1823
1850
  let rawSource = this.#inner.getAssetSource(filename);
1824
- if (rawSource) return JsSource.__from_binding(rawSource);
1851
+ if (rawSource) return SourceAdapter.fromBinding(rawSource);
1825
1852
  }
1826
1853
  __internal__setAssetSource(filename, source) {
1827
- this.#inner.setAssetSource(filename, JsSource.__to_binding(source));
1854
+ this.#inner.setAssetSource(filename, SourceAdapter.toBinding(source));
1828
1855
  }
1829
1856
  __internal__deleteAssetSource(filename) {
1830
1857
  this.#inner.deleteAssetSource(filename);
@@ -1875,13 +1902,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1875
1902
  let cbs = this.#cbs;
1876
1903
  this.#cbs = [], this.#inner(args, (wholeErr, results)=>{
1877
1904
  if (0 !== this.#args.length && queueMicrotask(this.#execute.bind(this)), wholeErr) {
1878
- let webpackError = new WebpackError(wholeErr.message);
1905
+ let webpackError = new lib_WebpackError(wholeErr.message);
1879
1906
  for (let cb of cbs)cb(webpackError);
1880
1907
  return;
1881
1908
  }
1882
1909
  for(let i = 0; i < results.length; i++){
1883
1910
  let [errMsg, module1] = results[i];
1884
- (0, cbs[i])(errMsg ? new WebpackError(errMsg) : null, module1);
1911
+ (0, cbs[i])(errMsg ? new lib_WebpackError(errMsg) : null, module1);
1885
1912
  }
1886
1913
  });
1887
1914
  };
@@ -2273,10 +2300,12 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
2273
2300
  }
2274
2301
  apply(compiler) {
2275
2302
  var config;
2276
- let err;
2277
- new RemoveDuplicateModulesPlugin().apply(compiler);
2278
- let { splitChunks } = compiler.options.optimization;
2279
- if (splitChunks && (splitChunks.chunks = "all", splitChunks.minSize = 0), 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 src_0.WebpackError(`Conflicted config for ${EsmLibraryPlugin.PLUGIN_NAME}: ${err}`);
2303
+ let err, logger = compiler.getInfrastructureLogger(EsmLibraryPlugin.PLUGIN_NAME);
2304
+ if (!function(options, logger) {
2305
+ options.optimization.concatenateModules = !1, options.output.chunkFormat = !1, options.output.chunkLoading && "import" !== options.output.chunkLoading && (logger.warn(`\`output.chunkLoading\` should be \`"import"\` or \`false\`, but got ${options.output.chunkLoading}, changed it to \`"import"\``), options.output.chunkLoading = "import"), void 0 === options.output.chunkLoading && (options.output.chunkLoading = "import"), options.output.library && (options.output.library = void 0);
2306
+ let { splitChunks } = options.optimization;
2307
+ 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);
2308
+ }(compiler.options, logger), 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 src_0.WebpackError(`Conflicted config for ${EsmLibraryPlugin.PLUGIN_NAME}: ${err}`);
2280
2309
  compiler.__internal__registerBuiltinPlugin({
2281
2310
  name: binding_.BuiltinPluginName.EsmLibraryPlugin,
2282
2311
  options: {
@@ -2539,13 +2568,13 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
2539
2568
  configurable: !0,
2540
2569
  value () {
2541
2570
  let originalSource = this._originalSource();
2542
- return originalSource ? JsSource.__from_binding(originalSource) : null;
2571
+ return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
2543
2572
  }
2544
2573
  }), Object.defineProperty(binding_default().NormalModule.prototype, "emitFile", {
2545
2574
  enumerable: !0,
2546
2575
  configurable: !0,
2547
2576
  value (filename, source, assetInfo) {
2548
- return this._emitFile(filename, JsSource.__to_binding(source), assetInfo);
2577
+ return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
2549
2578
  }
2550
2579
  });
2551
2580
  let deprecateAllProperties = (obj, message, code)=>{
@@ -2727,7 +2756,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
2727
2756
  this.message = match?.[1] ? createMessage(match[1]) : createMessage();
2728
2757
  }
2729
2758
  }
2730
- class AbstractMethodError extends WebpackError {
2759
+ class AbstractMethodError extends lib_WebpackError {
2731
2760
  constructor(){
2732
2761
  super(new Message().message), this.name = "AbstractMethodError";
2733
2762
  }
@@ -2919,13 +2948,13 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
2919
2948
  var stack, name, message;
2920
2949
  return err && "object" == typeof err && err.stack ? (stack = err.stack, name = err.name, message = err.message, cutOffLoaderExecution(stack), cutOffMessage(stack, name, message)) : void 0;
2921
2950
  };
2922
- class ModuleError extends WebpackError {
2951
+ class ModuleError extends lib_WebpackError {
2923
2952
  error;
2924
2953
  constructor(err, { from } = {}){
2925
2954
  super(ModuleError_createMessage(err, "Error", from)), this.name = "ModuleError", this.error = err, this.details = getErrorDetails(err);
2926
2955
  }
2927
2956
  }
2928
- class ModuleWarning extends WebpackError {
2957
+ class ModuleWarning extends lib_WebpackError {
2929
2958
  error;
2930
2959
  constructor(err, { from } = {}){
2931
2960
  super(ModuleError_createMessage(err, "Warning", from)), this.name = "ModuleWarning", this.error = err, this.details = getErrorDetails(err);
@@ -3579,8 +3608,8 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
3579
3608
  } else loaderState === binding_.JsLoaderState.Normal && function(args, raw) {
3580
3609
  if (!raw && args[0] instanceof Uint8Array) {
3581
3610
  var buf;
3582
- let str;
3583
- args[0] = (buf = args[0], 0xfeff === (str = decoder.decode(buf.buffer instanceof SharedArrayBuffer ? Buffer.from(buf) : buf)).charCodeAt(0) ? str.slice(1) : str);
3611
+ let isShared, str;
3612
+ args[0] = (isShared = (buf = args[0]).buffer instanceof SharedArrayBuffer || buf.buffer.constructor?.name === "SharedArrayBuffer", 0xfeff === (str = decoder.decode(isShared ? Buffer.from(buf) : buf)).charCodeAt(0) ? str.slice(1) : str);
3584
3613
  } else raw && "string" == typeof args[0] && (args[0] = Buffer.from(args[0], "utf-8"));
3585
3614
  raw && args[0] instanceof Uint8Array && !Buffer.isBuffer(args[0]) && (args[0] = Buffer.from(args[0].buffer));
3586
3615
  }(args, !!currentLoaderObject?.raw), result = await utils_runSyncOrAsync(fn, loaderContext, args) || [];
@@ -4364,7 +4393,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4364
4393
  ])
4365
4394
  }, hooks_compilationHooksMap.set(compilation, hooks)), hooks;
4366
4395
  }, HtmlRspackPlugin.version = 5;
4367
- let IgnorePlugin = base_create(binding_.BuiltinPluginName.IgnorePlugin, (options)=>options), InferAsyncModulesPlugin = base_create(binding_.BuiltinPluginName.InferAsyncModulesPlugin, ()=>{}, "compilation"), JavascriptModulesPlugin_compilationHooksMap = new WeakMap();
4396
+ let IgnorePlugin = base_create(binding_.BuiltinPluginName.IgnorePlugin, (options)=>options), InferAsyncModulesPlugin = base_create(binding_.BuiltinPluginName.InferAsyncModulesPlugin, ()=>{}, "compilation"), InlineExportsPlugin = base_create(binding_.BuiltinPluginName.InlineExportsPlugin, ()=>{}, "compilation"), JavascriptModulesPlugin_compilationHooksMap = new WeakMap();
4368
4397
  class JavascriptModulesPlugin extends RspackBuiltinPlugin {
4369
4398
  name = binding_.BuiltinPluginName.JavascriptModulesPlugin;
4370
4399
  affectedHooks = "compilation";
@@ -5718,7 +5747,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
5718
5747
  }, applyExperimentsDefaults = (experiments, { development })=>{
5719
5748
  F(experiments, "cache", ()=>development), D(experiments, "futureDefaults", !1), D(experiments, "lazyCompilation", !1), D(experiments, "asyncWebAssembly", experiments.futureDefaults), D(experiments, "css", !!experiments.futureDefaults || void 0), D(experiments, "topLevelAwait", !0), D(experiments, "deferImport", !1), D(experiments, "buildHttp", void 0), experiments.buildHttp && "object" == typeof experiments.buildHttp && D(experiments.buildHttp, "upgrade", !1), D(experiments, "incremental", {}), "object" == typeof experiments.incremental && (D(experiments.incremental, "silent", !0), D(experiments.incremental, "make", !0), D(experiments.incremental, "inferAsyncModules", !0), D(experiments.incremental, "providedExports", !0), D(experiments.incremental, "dependenciesDiagnostics", !0), D(experiments.incremental, "sideEffects", !0), D(experiments.incremental, "buildChunkGraph", !1), D(experiments.incremental, "moduleIds", !0), D(experiments.incremental, "chunkIds", !0), D(experiments.incremental, "modulesHashes", !0), D(experiments.incremental, "modulesCodegen", !0), D(experiments.incremental, "modulesRuntimeRequirements", !0), D(experiments.incremental, "chunksRuntimeRequirements", !0), D(experiments.incremental, "chunksHashes", !0), D(experiments.incremental, "chunksRender", !0), D(experiments.incremental, "emitAssets", !0)), D(experiments, "rspackFuture", {}), D(experiments, "parallelCodeSplitting", !1), D(experiments, "parallelLoader", !1), D(experiments, "useInputFileSystem", !1), D(experiments, "inlineConst", !1), D(experiments, "inlineEnum", !1), D(experiments, "typeReexportsPresence", !1), D(experiments, "lazyBarrel", !0);
5720
5749
  }, applybundlerInfoDefaults = (rspackFuture, library)=>{
5721
- "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.6.0-beta.1"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
5750
+ "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.6.1"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
5722
5751
  }, applySnapshotDefaults = (_snapshot, _env)=>{}, applyModuleDefaults = (module1, { cache, asyncWebAssembly, css, targetProperties, mode, uniqueName, usedExports, inlineConst, deferImport })=>{
5723
5752
  if (assertNotNill(module1.parser), assertNotNill(module1.generator), cache ? D(module1, "unsafeCache", /[\\/]node_modules[\\/]/) : D(module1, "unsafeCache", !1), F(module1.parser, "asset", ()=>({})), assertNotNill(module1.parser.asset), F(module1.parser.asset, "dataUrlCondition", ()=>({})), "object" == typeof module1.parser.asset.dataUrlCondition && D(module1.parser.asset.dataUrlCondition, "maxSize", 8096), F(module1.parser, "javascript", ()=>({})), assertNotNill(module1.parser.javascript), ((parserOptions, { usedExports, inlineConst, deferImport })=>{
5724
5753
  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", !0), D(parserOptions, "requireDynamic", !0), D(parserOptions, "requireResolve", !0), D(parserOptions, "commonjs", !0), D(parserOptions, "importDynamic", !0), D(parserOptions, "worker", [
@@ -6701,7 +6730,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6701
6730
  return new this(fs);
6702
6731
  }
6703
6732
  }
6704
- class HookWebpackError extends WebpackError {
6733
+ class HookWebpackError extends lib_WebpackError {
6705
6734
  hook;
6706
6735
  error;
6707
6736
  constructor(error, hook){
@@ -6709,7 +6738,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6709
6738
  }
6710
6739
  }
6711
6740
  let makeWebpackErrorCallback = (callback, hook)=>(err, result)=>{
6712
- err ? err instanceof WebpackError ? callback(err) : callback(new HookWebpackError(err, hook)) : callback(null, result);
6741
+ err ? err instanceof lib_WebpackError ? callback(err) : callback(new HookWebpackError(err, hook)) : callback(null, result);
6713
6742
  };
6714
6743
  class Cache {
6715
6744
  static STAGE_DISK = 10;
@@ -6741,7 +6770,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6741
6770
  let gotHandlers = [];
6742
6771
  this.hooks.get.callAsync(identifier, etag, gotHandlers, (err, res)=>{
6743
6772
  var error, hook, times, callback1;
6744
- if (err) return void callback((hook = "Cache.hooks.get", (error = err) instanceof WebpackError ? error : new HookWebpackError(error, hook)));
6773
+ if (err) return void callback((hook = "Cache.hooks.get", (error = err) instanceof lib_WebpackError ? error : new HookWebpackError(error, hook)));
6745
6774
  let result = res;
6746
6775
  if (null === result && (result = void 0), gotHandlers.length > 1) {
6747
6776
  let leftTimes, innerCallback = (times = gotHandlers.length, callback1 = ()=>callback(null, result), leftTimes = times, (err)=>0 == --leftTimes ? callback1() : err && leftTimes > 0 ? (leftTimes = 0, callback1()) : void 0);
@@ -6835,7 +6864,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6835
6864
  return await this.storePromise(result), result;
6836
6865
  }
6837
6866
  }
6838
- class CacheFacade_CacheFacade {
6867
+ class CacheFacade {
6839
6868
  _name;
6840
6869
  _cache;
6841
6870
  _hashFunction;
@@ -6843,7 +6872,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6843
6872
  this._cache = cache, this._name = name, this._hashFunction = hashFunction;
6844
6873
  }
6845
6874
  getChildCache(name) {
6846
- return new CacheFacade_CacheFacade(this._cache, `${this._name}|${name}`, this._hashFunction);
6875
+ return new CacheFacade(this._cache, `${this._name}|${name}`, this._hashFunction);
6847
6876
  }
6848
6877
  getItemCache(identifier, etag) {
6849
6878
  return new ItemCacheFacade(this._cache, `${this._name}|${identifier}`, etag);
@@ -7224,13 +7253,13 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7224
7253
  configurable: !0,
7225
7254
  value () {
7226
7255
  let originalSource = this._originalSource();
7227
- return originalSource ? JsSource.__from_binding(originalSource) : null;
7256
+ return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
7228
7257
  }
7229
7258
  }), Object.defineProperty(binding_default().Module.prototype, "emitFile", {
7230
7259
  enumerable: !0,
7231
7260
  configurable: !0,
7232
7261
  value (filename, source, assetInfo) {
7233
- return this._emitFile(filename, JsSource.__to_binding(source), assetInfo);
7262
+ return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
7234
7263
  }
7235
7264
  });
7236
7265
  let traceHookPlugin_PLUGIN_NAME = "TraceHookPlugin", PLUGIN_PROCESS_NAME = "Plugin Analysis", makeInterceptorFor = (compilerName, tracer)=>(hookName)=>({
@@ -7364,7 +7393,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7364
7393
  });
7365
7394
  }
7366
7395
  }
7367
- let CORE_VERSION = "1.6.0-beta.1", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
7396
+ let CORE_VERSION = "1.6.1", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
7368
7397
 
7369
7398
  Help:
7370
7399
  Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
@@ -7754,7 +7783,7 @@ Help:
7754
7783
  "entry"
7755
7784
  ]),
7756
7785
  additionalPass: new lite_tapable_namespaceObject.AsyncSeriesHook([])
7757
- }, this.webpack = src_rspack, this.rspack = src_rspack, this.root = this, this.outputPath = "", this.inputFileSystem = null, this.intermediateFileSystem = null, this.outputFileSystem = null, this.watchFileSystem = null, this.records = {}, this.options = options, this.context = context, this.cache = new Cache(), this.compilerPath = "", this.running = !1, this.idle = !1, this.watchMode = !1, this.__internal_browser_require = ()=>{
7786
+ }, this.webpack = src_rspack_0, this.rspack = src_rspack_0, this.root = this, this.outputPath = "", this.inputFileSystem = null, this.intermediateFileSystem = null, this.outputFileSystem = null, this.watchFileSystem = null, this.records = {}, this.options = options, this.context = context, this.cache = new Cache(), this.compilerPath = "", this.running = !1, this.idle = !1, this.watchMode = !1, this.__internal_browser_require = ()=>{
7758
7787
  throw Error("Cannot execute user defined code in browser without `BrowserRequirePlugin`");
7759
7788
  }, 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);
7760
7789
  }
@@ -7780,7 +7809,7 @@ Help:
7780
7809
  return this.#ruleSet;
7781
7810
  }
7782
7811
  getCache(name) {
7783
- return new CacheFacade_CacheFacade(this.cache, `${this.compilerPath}${name}`, this.options.output.hashFunction);
7812
+ return new CacheFacade(this.cache, `${this.compilerPath}${name}`, this.options.output.hashFunction);
7784
7813
  }
7785
7814
  getInfrastructureLogger(name) {
7786
7815
  if (!name) throw TypeError("Compiler.getInfrastructureLogger(name) called without a name");
@@ -8108,7 +8137,9 @@ Help:
8108
8137
  targetPath,
8109
8138
  outputPath,
8110
8139
  get source () {
8111
- return getCompiler1().__internal__get_compilation().getAsset(filename)?.source;
8140
+ let source = getCompiler1().__internal__get_compilation().getAsset(filename)?.source;
8141
+ if (!source) throw Error(`Asset ${filename} not found`);
8142
+ return source;
8112
8143
  },
8113
8144
  get content () {
8114
8145
  return this.source?.buffer();
@@ -8201,7 +8232,7 @@ Help:
8201
8232
  try {
8202
8233
  fn();
8203
8234
  } catch (err) {
8204
- if (err instanceof WebpackError) throw err;
8235
+ if (err instanceof lib_WebpackError) throw err;
8205
8236
  throw new HookWebpackError(err, hook);
8206
8237
  }
8207
8238
  })(()=>queried.call({
@@ -8625,8 +8656,8 @@ Help:
8625
8656
  hasWarnings() {
8626
8657
  return this.stats.some((stat)=>stat.hasWarnings());
8627
8658
  }
8628
- #createChildOptions(options, context) {
8629
- let { children: childrenOptions, ...baseOptions } = "string" == typeof options ? {
8659
+ #createChildOptions(options = {}, context) {
8660
+ let { children: childrenOptions, ...baseOptions } = "string" == typeof options || "boolean" == typeof options ? {
8630
8661
  preset: options
8631
8662
  } : options, children = this.stats.map((stat, idx)=>{
8632
8663
  let childOptions = Array.isArray(childrenOptions) ? childrenOptions[idx] : childrenOptions;
@@ -8649,13 +8680,13 @@ Help:
8649
8680
  };
8650
8681
  }
8651
8682
  toJson(options) {
8652
- let childOptions = this.#createChildOptions(options || {}, {
8683
+ let childOptions = this.#createChildOptions(options, {
8653
8684
  forToString: !1
8654
8685
  }), obj = {};
8655
8686
  obj.children = this.stats.map((stat, idx)=>{
8656
8687
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
8657
8688
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
8658
- }), childOptions.version && (obj.rspackVersion = "1.6.0-beta.1", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
8689
+ }), childOptions.version && (obj.rspackVersion = "1.6.1", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
8659
8690
  let mapError = (j, obj)=>({
8660
8691
  ...obj,
8661
8692
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -8667,7 +8698,7 @@ Help:
8667
8698
  return obj;
8668
8699
  }
8669
8700
  toString(options) {
8670
- let childOptions = this.#createChildOptions(options || {}, {
8701
+ let childOptions = this.#createChildOptions(options, {
8671
8702
  forToString: !0
8672
8703
  });
8673
8704
  return this.stats.map((stat, idx)=>{
@@ -8702,7 +8733,7 @@ Help:
8702
8733
  }(callback1));
8703
8734
  }
8704
8735
  size || callback(null);
8705
- }, MultiWatching = class {
8736
+ }, src_MultiWatching = class {
8706
8737
  watchings;
8707
8738
  compiler;
8708
8739
  constructor(watchings, compiler){
@@ -8731,7 +8762,7 @@ Help:
8731
8762
  }
8732
8763
  };
8733
8764
  ArrayQueue_computedKey = Symbol.iterator;
8734
- let ArrayQueue = class {
8765
+ let util_ArrayQueue = class {
8735
8766
  _list;
8736
8767
  _listReversed;
8737
8768
  constructor(items){
@@ -8892,7 +8923,7 @@ Help:
8892
8923
  node.parents.push(parent), parent.children.push(node);
8893
8924
  }
8894
8925
  }
8895
- let queue = new ArrayQueue();
8926
+ let queue = new util_ArrayQueue();
8896
8927
  for (let node of nodes)0 === node.parents.length && (node.state = "queued", queue.enqueue(node));
8897
8928
  let errored = !1, running = 0, parallelism = this._options.parallelism, nodeDone = (node, err, stats)=>{
8898
8929
  if (!errored) {
@@ -8941,9 +8972,9 @@ Help:
8941
8972
  }, (compiler, watching, _done)=>{
8942
8973
  compiler.watching === watching && (watching.running || watching.invalidate());
8943
8974
  }, handler);
8944
- return this.watching = new MultiWatching(watchings, this), this.watching;
8975
+ return this.watching = new src_MultiWatching(watchings, this), this.watching;
8945
8976
  }
8946
- return this.watching = new MultiWatching([], this), this.watching;
8977
+ return this.watching = new src_MultiWatching([], this), this.watching;
8947
8978
  }
8948
8979
  run(callback, options) {
8949
8980
  if (this.running) return callback(new ConcurrentCompilationError());
@@ -9554,7 +9585,7 @@ Help:
9554
9585
  object.hash = context.getStatsCompilation(compilation).hash;
9555
9586
  },
9556
9587
  version: (object)=>{
9557
- object.version = "5.75.0", object.rspackVersion = "1.6.0-beta.1";
9588
+ object.version = "5.75.0", object.rspackVersion = "1.6.1";
9558
9589
  },
9559
9590
  env: (object, _compilation, _context, { _env })=>{
9560
9591
  object.env = _env;
@@ -10893,7 +10924,7 @@ Help:
10893
10924
  moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
10894
10925
  namespace: options.output.devtoolNamespace
10895
10926
  }).apply(compiler);
10896
- if (new JavascriptModulesPlugin().apply(compiler), new URLPlugin().apply(compiler), new JsonModulesPlugin().apply(compiler), new AssetModulesPlugin().apply(compiler), options.experiments.asyncWebAssembly && new AsyncWebAssemblyModulesPlugin().apply(compiler), options.experiments.css && 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.experiments.rspackFuture.bundlerInfo && new BundlerInfoRspackPlugin(options.experiments.rspackFuture.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.mangleExports && new MangleExportsPlugin("size" !== options.optimization.mangleExports).apply(compiler), options.output.enabledLibraryTypes && options.output.enabledLibraryTypes.length > 0) for (let type of options.output.enabledLibraryTypes)new EnableLibraryPlugin(type).apply(compiler);
10927
+ if (new JavascriptModulesPlugin().apply(compiler), new URLPlugin().apply(compiler), new JsonModulesPlugin().apply(compiler), new AssetModulesPlugin().apply(compiler), options.experiments.asyncWebAssembly && new AsyncWebAssemblyModulesPlugin().apply(compiler), options.experiments.css && 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.experiments.rspackFuture.bundlerInfo && new BundlerInfoRspackPlugin(options.experiments.rspackFuture.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.experiments.inlineConst || options.experiments.inlineEnum) && new InlineExportsPlugin().apply(compiler), options.optimization.mangleExports && new MangleExportsPlugin("size" !== options.optimization.mangleExports).apply(compiler), options.output.enabledLibraryTypes && options.output.enabledLibraryTypes.length > 0) for (let type of options.output.enabledLibraryTypes)new EnableLibraryPlugin(type).apply(compiler);
10897
10928
  options.optimization.splitChunks && new SplitChunksPlugin(options.optimization.splitChunks).apply(compiler), options.optimization.removeEmptyChunks && new RemoveEmptyChunksPlugin().apply(compiler), options.optimization.realContentHash && new RealContentHashPlugin().apply(compiler);
10898
10929
  let moduleIds = options.optimization.moduleIds;
10899
10930
  if (moduleIds) switch(moduleIds){
@@ -10953,13 +10984,13 @@ Help:
10953
10984
  configurable: !0,
10954
10985
  value () {
10955
10986
  let originalSource = this._originalSource();
10956
- return originalSource ? JsSource.__from_binding(originalSource) : null;
10987
+ return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
10957
10988
  }
10958
10989
  }), Object.defineProperty(binding_default().ConcatenatedModule.prototype, "emitFile", {
10959
10990
  enumerable: !0,
10960
10991
  configurable: !0,
10961
10992
  value (filename, source, assetInfo) {
10962
- return this._emitFile(filename, JsSource.__to_binding(source), assetInfo);
10993
+ return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
10963
10994
  }
10964
10995
  }), Object.defineProperty(binding_default().ContextModule.prototype, "identifier", {
10965
10996
  enumerable: !0,
@@ -10972,13 +11003,13 @@ Help:
10972
11003
  configurable: !0,
10973
11004
  value () {
10974
11005
  let originalSource = this._originalSource();
10975
- return originalSource ? JsSource.__from_binding(originalSource) : null;
11006
+ return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
10976
11007
  }
10977
11008
  }), Object.defineProperty(binding_default().ContextModule.prototype, "emitFile", {
10978
11009
  enumerable: !0,
10979
11010
  configurable: !0,
10980
11011
  value (filename, source, assetInfo) {
10981
- return this._emitFile(filename, JsSource.__to_binding(source), assetInfo);
11012
+ return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
10982
11013
  }
10983
11014
  }), Object.defineProperty(binding_default().ExternalModule.prototype, "identifier", {
10984
11015
  enumerable: !0,
@@ -10991,13 +11022,13 @@ Help:
10991
11022
  configurable: !0,
10992
11023
  value () {
10993
11024
  let originalSource = this._originalSource();
10994
- return originalSource ? JsSource.__from_binding(originalSource) : null;
11025
+ return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
10995
11026
  }
10996
11027
  }), Object.defineProperty(binding_default().ExternalModule.prototype, "emitFile", {
10997
11028
  enumerable: !0,
10998
11029
  configurable: !0,
10999
11030
  value (filename, source, assetInfo) {
11000
- return this._emitFile(filename, JsSource.__to_binding(source), assetInfo);
11031
+ return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
11001
11032
  }
11002
11033
  });
11003
11034
  let asRegExp = (test)=>"string" == typeof test ? RegExp(`^${test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")}`) : test, matchPart = (str, test)=>!test || (Array.isArray(test) ? test.map(asRegExp).some((regExp)=>regExp.test(str)) : asRegExp(test).test(str)), matchObject = (obj, str)=>!(obj.test && !matchPart(str, obj.test) || obj.include && !matchPart(str, obj.include) || obj.exclude && matchPart(str, obj.exclude)), FlagAllModulesAsUsedPlugin = base_create(binding_.BuiltinPluginName.FlagAllModulesAsUsedPlugin, (explanation)=>({
@@ -11067,7 +11098,7 @@ Help:
11067
11098
  });
11068
11099
  }
11069
11100
  }
11070
- class DllManifestError extends WebpackError {
11101
+ class DllManifestError extends lib_WebpackError {
11071
11102
  constructor(filename, message){
11072
11103
  super(), this.name = "DllManifestError", this.message = `Dll manifest ${filename}\n${message}`;
11073
11104
  }
@@ -11083,7 +11114,7 @@ Help:
11083
11114
  for (let key of this.keys){
11084
11115
  let value = void 0 !== process.env[key] ? process.env[key] : this.defaultValues[key];
11085
11116
  void 0 === value && compiler.hooks.thisCompilation.tap("EnvironmentPlugin", (compilation)=>{
11086
- let error = new WebpackError(`EnvironmentPlugin - ${key} environment variable is undefined.\n\nYou can pass an object with default values to suppress this warning.\nSee https://rspack.rs/plugins/webpack/environment-plugin for example.`);
11117
+ let error = new lib_WebpackError(`EnvironmentPlugin - ${key} environment variable is undefined.\n\nYou can pass an object with default values to suppress this warning.\nSee https://rspack.rs/plugins/webpack/environment-plugin for example.`);
11087
11118
  error.name = "EnvVariableNotDefinedError", compilation.errors.push(error);
11088
11119
  }), definitions[`process.env.${key}`] = void 0 === value ? "undefined" : JSON.stringify(value);
11089
11120
  }
@@ -11658,7 +11689,7 @@ Help:
11658
11689
  let _options = JSON.stringify(options || {});
11659
11690
  return binding_default().transform(source, _options);
11660
11691
  }
11661
- let exports_rspackVersion = "1.6.0-beta.1", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
11692
+ let exports_rspackVersion = "1.6.1", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
11662
11693
  getNormalizedRspackOptions: getNormalizedRspackOptions,
11663
11694
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
11664
11695
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -11912,6 +11943,8 @@ Help:
11912
11943
  function validateRspackConfig(config) {
11913
11944
  (({ context })=>{
11914
11945
  if (context && !(0, external_node_path_namespaceObject.isAbsolute)(context)) throw Error(`${ERROR_PREFIX} "context" must be an absolute path, get "${context}".`);
11946
+ })(config), (({ output })=>{
11947
+ if (output?.path && !(0, external_node_path_namespaceObject.isAbsolute)(output.path)) throw Error(`${ERROR_PREFIX} "output.path" must be an absolute path, get "${output.path}".`);
11915
11948
  })(config), (({ optimization })=>{
11916
11949
  if (optimization?.splitChunks) {
11917
11950
  let { minChunks } = optimization.splitChunks;
@@ -11990,7 +12023,7 @@ Help:
11990
12023
  }
11991
12024
  }, exports_namespaceObject);
11992
12025
  src_fn.rspack = src_fn, src_fn.webpack = src_fn;
11993
- let src_rspack = src_fn, src_0 = src_rspack;
12026
+ let src_rspack_0 = src_fn, src_0 = src_rspack_0;
11994
12027
  })(), exports.AsyncDependenciesBlock = __webpack_exports__.AsyncDependenciesBlock, exports.BannerPlugin = __webpack_exports__.BannerPlugin, exports.CircularDependencyRspackPlugin = __webpack_exports__.CircularDependencyRspackPlugin, exports.Compilation = __webpack_exports__.Compilation, exports.Compiler = __webpack_exports__.Compiler, exports.ConcatenatedModule = __webpack_exports__.ConcatenatedModule, exports.ContextModule = __webpack_exports__.ContextModule, exports.ContextReplacementPlugin = __webpack_exports__.ContextReplacementPlugin, exports.CopyRspackPlugin = __webpack_exports__.CopyRspackPlugin, exports.CssExtractRspackPlugin = __webpack_exports__.CssExtractRspackPlugin, exports.DefinePlugin = __webpack_exports__.DefinePlugin, exports.Dependency = __webpack_exports__.Dependency, exports.DllPlugin = __webpack_exports__.DllPlugin, exports.DllReferencePlugin = __webpack_exports__.DllReferencePlugin, exports.DynamicEntryPlugin = __webpack_exports__.DynamicEntryPlugin, exports.EntryDependency = __webpack_exports__.EntryDependency, exports.EntryOptionPlugin = __webpack_exports__.EntryOptionPlugin, exports.EntryPlugin = __webpack_exports__.EntryPlugin, exports.EnvironmentPlugin = __webpack_exports__.EnvironmentPlugin, exports.EvalDevToolModulePlugin = __webpack_exports__.EvalDevToolModulePlugin, exports.EvalSourceMapDevToolPlugin = __webpack_exports__.EvalSourceMapDevToolPlugin, exports.ExternalModule = __webpack_exports__.ExternalModule, exports.ExternalsPlugin = __webpack_exports__.ExternalsPlugin, exports.HotModuleReplacementPlugin = __webpack_exports__.HotModuleReplacementPlugin, exports.HtmlRspackPlugin = __webpack_exports__.HtmlRspackPlugin, exports.IgnorePlugin = __webpack_exports__.IgnorePlugin, exports.LightningCssMinimizerRspackPlugin = __webpack_exports__.LightningCssMinimizerRspackPlugin, exports.LoaderOptionsPlugin = __webpack_exports__.LoaderOptionsPlugin, exports.LoaderTargetPlugin = __webpack_exports__.LoaderTargetPlugin, exports.Module = __webpack_exports__.Module, exports.ModuleFilenameHelpers = __webpack_exports__.ModuleFilenameHelpers, exports.MultiCompiler = __webpack_exports__.MultiCompiler, exports.MultiStats = __webpack_exports__.MultiStats, exports.NoEmitOnErrorsPlugin = __webpack_exports__.NoEmitOnErrorsPlugin, exports.NormalModule = __webpack_exports__.NormalModule, exports.NormalModuleReplacementPlugin = __webpack_exports__.NormalModuleReplacementPlugin, exports.ProgressPlugin = __webpack_exports__.ProgressPlugin, exports.ProvidePlugin = __webpack_exports__.ProvidePlugin, exports.RspackOptionsApply = __webpack_exports__.RspackOptionsApply, exports.RuntimeGlobals = __webpack_exports__.RuntimeGlobals, exports.RuntimeModule = __webpack_exports__.RuntimeModule, exports.RuntimePlugin = __webpack_exports__.RuntimePlugin, exports.SourceMapDevToolPlugin = __webpack_exports__.SourceMapDevToolPlugin, exports.Stats = __webpack_exports__.Stats, exports.StatsErrorCode = __webpack_exports__.StatsErrorCode, exports.SwcJsMinimizerRspackPlugin = __webpack_exports__.SwcJsMinimizerRspackPlugin, exports.Template = __webpack_exports__.Template, exports.ValidationError = __webpack_exports__.ValidationError, exports.WarnCaseSensitiveModulesPlugin = __webpack_exports__.WarnCaseSensitiveModulesPlugin, exports.WebpackError = __webpack_exports__.WebpackError, exports.WebpackOptionsApply = __webpack_exports__.WebpackOptionsApply, exports.config = __webpack_exports__.config, exports.container = __webpack_exports__.container, exports.default = __webpack_exports__.default, exports.electron = __webpack_exports__.electron, exports.experiments = __webpack_exports__.experiments, exports.javascript = __webpack_exports__.javascript, exports.library = __webpack_exports__.library, exports.node = __webpack_exports__.node, exports.optimize = __webpack_exports__.optimize, exports.rspack = __webpack_exports__.rspack, exports.rspackVersion = __webpack_exports__.rspackVersion, exports.sharing = __webpack_exports__.sharing, exports.sources = __webpack_exports__.sources, exports.util = __webpack_exports__.util, exports.version = __webpack_exports__.version, exports.wasm = __webpack_exports__.wasm, exports.web = __webpack_exports__.web, exports.webworker = __webpack_exports__.webworker, __webpack_exports__)-1 === [
11995
12028
  "AsyncDependenciesBlock",
11996
12029
  "BannerPlugin",
@@ -13,7 +13,7 @@ export interface Etag {
13
13
  toString(): string;
14
14
  }
15
15
  export type CallbackCache<T> = (err?: WebpackError | null, result?: T) => void;
16
- type GotHandler = (result: any | null, callback: (error: Error | null) => void) => void;
16
+ type GotHandler<T = any> = (result: T | null, callback: (error: Error | null) => void) => void;
17
17
  export declare class Cache {
18
18
  static STAGE_DISK: number;
19
19
  static STAGE_MEMORY: number;
@@ -61,7 +61,7 @@ export declare enum RequestType {
61
61
  export declare enum RequestSyncType {
62
62
  WaitForPendingRequest = "WaitForPendingRequest"
63
63
  }
64
- export type HandleIncomingRequest = (requestType: RequestType, ...args: any[]) => Promise<any> | any;
64
+ export type HandleIncomingRequest = (requestType: RequestType, ...args: any[]) => any;
65
65
  type WorkerArgs = any[];
66
66
  export type WorkerError = Error;
67
67
  export declare function serializeError(error: unknown): WorkerError;
package/dist/util/fs.d.ts CHANGED
@@ -68,6 +68,28 @@ interface IDirent {
68
68
  isSocket: () => boolean;
69
69
  name: string | Buffer;
70
70
  }
71
+ export interface StreamOptions {
72
+ flags?: string;
73
+ encoding?: NodeJS.BufferEncoding;
74
+ fd?: any;
75
+ mode?: number;
76
+ autoClose?: boolean;
77
+ emitClose?: boolean;
78
+ start?: number;
79
+ signal?: null | AbortSignal;
80
+ }
81
+ export interface FSImplementation {
82
+ open?: (...args: any[]) => any;
83
+ close?: (...args: any[]) => any;
84
+ }
85
+ export type CreateReadStreamFSImplementation = FSImplementation & {
86
+ read: (...args: any[]) => any;
87
+ };
88
+ export type ReadStreamOptions = StreamOptions & {
89
+ fs?: null | CreateReadStreamFSImplementation;
90
+ end?: number;
91
+ };
92
+ export type CreateReadStream = (path: PathLike, options?: NodeJS.BufferEncoding | ReadStreamOptions) => NodeJS.ReadableStream;
71
93
  export interface OutputFileSystem {
72
94
  writeFile: (arg0: string | number, arg1: string | Buffer, arg2: (arg0?: null | NodeJS.ErrnoException) => void) => void;
73
95
  mkdir: (arg0: string, arg1: (arg0?: null | NodeJS.ErrnoException) => void) => void;
@@ -81,6 +103,7 @@ export interface OutputFileSystem {
81
103
  join?: (arg0: string, arg1: string) => string;
82
104
  relative?: (arg0: string, arg1: string) => string;
83
105
  dirname?: (arg0: string) => string;
106
+ createReadStream?: CreateReadStream;
84
107
  }
85
108
  export type JsonPrimitive = string | number | boolean | null;
86
109
  export type JsonArray = JsonValue[];
@@ -1,7 +1,6 @@
1
- import type { JsCompatSourceOwned } from "@rspack/binding";
2
- import { Source } from "../../compiled/webpack-sources";
3
- declare class JsSource extends Source {
4
- static __from_binding(source: JsCompatSourceOwned): Source;
5
- static __to_binding(source: Source): JsCompatSourceOwned;
1
+ import type { JsSource } from "@rspack/binding";
2
+ import { type Source } from "../../compiled/webpack-sources";
3
+ export declare class SourceAdapter {
4
+ static fromBinding(source: JsSource): Source;
5
+ static toBinding(source: Source): JsSource;
6
6
  }
7
- export { JsSource };
package/dist/worker.js CHANGED
@@ -209,7 +209,7 @@ var __webpack_modules__ = {
209
209
  n: ()=>createHash_createHash
210
210
  });
211
211
  var external_node_util_ = __webpack_require__("node:util");
212
- class WebpackError_WebpackError extends Error {
212
+ class WebpackError extends Error {
213
213
  loc;
214
214
  file;
215
215
  chunk;
@@ -217,14 +217,14 @@ var __webpack_modules__ = {
217
217
  details;
218
218
  hideStack;
219
219
  }
220
- Object.defineProperty(WebpackError_WebpackError.prototype, external_node_util_.inspect.custom, {
220
+ Object.defineProperty(WebpackError.prototype, external_node_util_.inspect.custom, {
221
221
  value: function() {
222
222
  return this.stack + (this.details ? `\n${this.details}` : "");
223
223
  },
224
224
  enumerable: !1,
225
225
  configurable: !0
226
226
  });
227
- let WebpackError = WebpackError_WebpackError, CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
227
+ let lib_WebpackError = WebpackError, CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
228
228
  function createMessage(method) {
229
229
  return `Abstract method${method ? ` ${method}` : ""}. Must be overridden.`;
230
230
  }
@@ -235,7 +235,7 @@ var __webpack_modules__ = {
235
235
  this.message = match?.[1] ? createMessage(match[1]) : createMessage();
236
236
  }
237
237
  }
238
- class AbstractMethodError extends WebpackError {
238
+ class AbstractMethodError extends lib_WebpackError {
239
239
  constructor(){
240
240
  super(new Message().message), this.name = "AbstractMethodError";
241
241
  }
@@ -905,8 +905,8 @@ for(var __webpack_i__ in (()=>{
905
905
  currentLoaderObject.normalExecuted = !0, fn && (!function(args, raw) {
906
906
  if (!raw && args[0] instanceof Uint8Array) {
907
907
  var buf;
908
- let str;
909
- args[0] = (buf = args[0], 0xfeff === (str = decoder.decode(buf.buffer instanceof SharedArrayBuffer ? Buffer.from(buf) : buf)).charCodeAt(0) ? str.slice(1) : str);
908
+ let isShared, str;
909
+ args[0] = (isShared = (buf = args[0]).buffer instanceof SharedArrayBuffer || buf.buffer.constructor?.name === "SharedArrayBuffer", 0xfeff === (str = decoder.decode(isShared ? Buffer.from(buf) : buf)).charCodeAt(0) ? str.slice(1) : str);
910
910
  } else raw && "string" == typeof args[0] && (args[0] = Buffer.from(args[0], "utf-8"));
911
911
  raw && args[0] instanceof Uint8Array && !Buffer.isBuffer(args[0]) && (args[0] = Buffer.from(args[0].buffer));
912
912
  }(args, !!currentLoaderObject.raw), args = await utils_runSyncOrAsync(fn, loaderContext, args) || []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "1.6.0-beta.1",
3
+ "version": "1.6.1",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -37,11 +37,12 @@
37
37
  "directory": "packages/rspack"
38
38
  },
39
39
  "devDependencies": {
40
- "@ast-grep/napi": "^0.39.6",
40
+ "@ast-grep/napi": "^0.39.7",
41
+ "@napi-rs/wasm-runtime": "1.0.7",
41
42
  "@rsbuild/plugin-node-polyfill": "^1.4.2",
42
- "@rslib/core": "0.15.1",
43
+ "@rslib/core": "0.17.0",
43
44
  "@swc/types": "0.1.25",
44
- "@types/node": "^20.19.23",
45
+ "@types/node": "^20.19.24",
45
46
  "@types/watchpack": "^2.4.4",
46
47
  "browserslist-load-config": "^1.0.1",
47
48
  "enhanced-resolve": "5.18.3",
@@ -55,9 +56,9 @@
55
56
  "webpack-sources": "3.3.3"
56
57
  },
57
58
  "dependencies": {
58
- "@module-federation/runtime-tools": "0.21.1",
59
+ "@module-federation/runtime-tools": "0.21.2",
59
60
  "@rspack/lite-tapable": "1.0.1",
60
- "@rspack/binding": "1.6.0-beta.1"
61
+ "@rspack/binding": "1.6.1"
61
62
  },
62
63
  "peerDependencies": {
63
64
  "@swc/helpers": ">=0.5.1"