@rspack-canary/core 1.5.8-canary-e88f22dc-20250928174002 → 1.5.9-canary-61eba72c-20250930173821

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.
@@ -222,7 +222,7 @@ export declare class Compilation {
222
222
  * Get a map of all entrypoints.
223
223
  */
224
224
  get entrypoints(): ReadonlyMap<string, Entrypoint>;
225
- get chunkGroups(): ReadonlyArray<ChunkGroup>;
225
+ get chunkGroups(): readonly ChunkGroup[];
226
226
  /**
227
227
  * Get the named chunk groups.
228
228
  *
@@ -261,7 +261,7 @@ export declare class Compilation {
261
261
  /**
262
262
  * Get an array of Asset
263
263
  */
264
- getAssets(): ReadonlyArray<Asset>;
264
+ getAssets(): readonly Asset[];
265
265
  getAsset(name: string): Readonly<Asset> | void;
266
266
  /**
267
267
  * Note: This is not a webpack public API, maybe removed in future.
@@ -19,7 +19,7 @@ export interface MultiCompilerOptions {
19
19
  */
20
20
  parallelism?: number;
21
21
  }
22
- export type MultiRspackOptions = ReadonlyArray<RspackOptions> & MultiCompilerOptions;
22
+ export type MultiRspackOptions = readonly RspackOptions[] & MultiCompilerOptions;
23
23
  export declare class MultiCompiler {
24
24
  #private;
25
25
  compilers: Compiler[];
@@ -12,8 +12,8 @@ type RawPluginImportConfig = {
12
12
  style?: RawStyleConfig;
13
13
  camelToDashComponentName?: boolean;
14
14
  transformToDefaultImport?: boolean;
15
- ignoreEsComponent?: Array<string>;
16
- ignoreStyleComponent?: Array<string>;
15
+ ignoreEsComponent?: string[];
16
+ ignoreStyleComponent?: string[];
17
17
  };
18
18
  type PluginImportConfig = {
19
19
  libraryName: string;
@@ -31,7 +31,7 @@ export type CircularDependencyRspackPluginOptions = {
31
31
  * module "app/design/components/Button.tsx". When the entry is a RegExp,
32
32
  * it is tested against the entire identifier.
33
33
  */
34
- ignoredConnections?: Array<[string | RegExp, string | RegExp]>;
34
+ ignoredConnections?: [string | RegExp, string | RegExp][];
35
35
  /**
36
36
  * Called once for every detected cycle. Providing this handler overrides the
37
37
  * default behavior of adding diagnostics to the compilation.
@@ -12,5 +12,5 @@ type CodeValue = RecursiveArrayOrRecord<CodeValuePrimitive>;
12
12
  type CodeValuePrimitive = null | undefined | RegExp | Function | string | number | boolean | bigint;
13
13
  type RecursiveArrayOrRecord<T> = {
14
14
  [index: string]: RecursiveArrayOrRecord<T>;
15
- } | Array<RecursiveArrayOrRecord<T>> | T;
15
+ } | RecursiveArrayOrRecord<T>[] | T;
16
16
  export {};
@@ -7,8 +7,8 @@ export declare namespace RsdoctorPluginData {
7
7
  export type { JsRsdoctorAsset as RsdoctorAsset, JsRsdoctorChunkGraph as RsdoctorChunkGraph, JsRsdoctorModuleGraph as RsdoctorModuleGraph, JsRsdoctorChunk as RsdoctorChunk, JsRsdoctorModule as RsdoctorModule, JsRsdoctorSideEffect as RsdoctorSideEffect, JsRsdoctorExportInfo as RsdoctorExportInfo, JsRsdoctorVariable as RsdoctorVariable, JsRsdoctorDependency as RsdoctorDependency, JsRsdoctorEntrypoint as RsdoctorEntrypoint, JsRsdoctorStatement as RsdoctorStatement, JsRsdoctorSourceRange as RsdoctorSourceRange, JsRsdoctorSourcePosition as RsdoctorSourcePosition, JsRsdoctorModuleGraphModule as RsdoctorModuleGraphModule, JsRsdoctorModuleIdsPatch as RsdoctorModuleIdsPatch, JsRsdoctorModuleOriginalSource as RsdoctorModuleOriginalSource, JsRsdoctorAssetPatch as RsdoctorAssetPatch, JsRsdoctorChunkAssets as RsdoctorChunkAssets, JsRsdoctorEntrypointAssets as RsdoctorEntrypointAssets, JsRsdoctorChunkModules as RsdoctorChunkModules, JsRsdoctorModuleSourcesPatch as RsdoctorModuleSourcesPatch };
8
8
  }
9
9
  export type RsdoctorPluginOptions = {
10
- moduleGraphFeatures?: boolean | Array<"graph" | "ids" | "sources">;
11
- chunkGraphFeatures?: boolean | Array<"graph" | "assets">;
10
+ moduleGraphFeatures?: boolean | ("graph" | "ids" | "sources")[];
11
+ chunkGraphFeatures?: boolean | ("graph" | "assets")[];
12
12
  sourceMapFeatures?: {
13
13
  module?: boolean;
14
14
  cheap?: boolean;
@@ -18,7 +18,7 @@ declare const HtmlRspackPlugin: typeof HtmlRspackPluginImpl & {
18
18
  */
19
19
  getHooks: (compilation: Compilation) => HtmlRspackPluginHooks;
20
20
  getCompilationHooks: (compilation: Compilation) => HtmlRspackPluginHooks;
21
- createHtmlTagObject: (tagName: string, attributes?: Record<string, string | boolean>, innerHTML?: string | undefined) => JsHtmlPluginTag;
21
+ createHtmlTagObject: (tagName: string, attributes?: Record<string, string | boolean>, innerHTML?: string) => JsHtmlPluginTag;
22
22
  version: number;
23
23
  };
24
24
  export { HtmlRspackPlugin };
@@ -79,10 +79,13 @@ export interface Diagnostic {
79
79
  sourceCode?: string;
80
80
  /**
81
81
  * Location to the source code.
82
- *
83
82
  * If `sourceCode` is not provided, location will be omitted.
84
83
  */
85
84
  location?: DiagnosticLocation;
85
+ /**
86
+ * Optional filename to show.
87
+ * If provided, it becomes the `StatsError.file` value in stats.
88
+ */
86
89
  file?: string;
87
90
  severity: "error" | "warning";
88
91
  }
@@ -28,10 +28,10 @@ type ResponseData = {
28
28
  byteLength: number;
29
29
  };
30
30
  type ModifyResponseData<RequestInternal extends IncomingMessage = IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = (req: RequestInternal, res: ResponseInternal, data: Buffer | ReadStream, byteLength: number) => ResponseData;
31
- type Headers = Array<{
31
+ type Headers = {
32
32
  key: string;
33
33
  value: string;
34
- }> | Record<string, string | string[]>;
34
+ }[] | Record<string, string | string[]>;
35
35
  type OutputFileSystem = import("..").OutputFileSystem & {
36
36
  createReadStream?: typeof import("fs").createReadStream;
37
37
  statSync: import("fs").StatSyncFn;
@@ -131,8 +131,8 @@ type ProxyConfigArrayItem = {
131
131
  [key: string]: any;
132
132
  };
133
133
  type ByPass = (req: Request, res: Response, proxyConfig: ProxyConfigArrayItem) => any;
134
- type ProxyConfigArray = (ProxyConfigArrayItem | ((req?: Request | undefined, res?: Response | undefined, next?: NextFunction | undefined) => ProxyConfigArrayItem))[];
135
- type Callback = (stats?: Stats | MultiStats | undefined) => any;
134
+ type ProxyConfigArray = (ProxyConfigArrayItem | ((req?: Request, res?: Response, next?: NextFunction) => ProxyConfigArrayItem))[];
135
+ type Callback = (stats?: Stats | MultiStats) => any;
136
136
  type DevMiddlewareContext<_RequestInternal extends IncomingMessage = IncomingMessage, _ResponseInternal extends ServerResponse = ServerResponse> = {
137
137
  state: boolean;
138
138
  stats: Stats | MultiStats | undefined;
@@ -84,9 +84,9 @@ export type ExperimentCacheNormalized = boolean | {
84
84
  buildDependencies: string[];
85
85
  version: string;
86
86
  snapshot: {
87
- immutablePaths: Array<string | RegExp>;
88
- unmanagedPaths: Array<string | RegExp>;
89
- managedPaths: Array<string | RegExp>;
87
+ immutablePaths: (string | RegExp)[];
88
+ unmanagedPaths: (string | RegExp)[];
89
+ managedPaths: (string | RegExp)[];
90
90
  };
91
91
  storage: {
92
92
  type: "filesystem";
@@ -1194,6 +1194,32 @@ export type CacheOptions = boolean;
1194
1194
  type StatsPresets = "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary";
1195
1195
  type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
1196
1196
  type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
1197
+ export type StatsColorOptions = {
1198
+ /**
1199
+ * Custom color for bold text.
1200
+ */
1201
+ bold?: string;
1202
+ /**
1203
+ * Custom color for cyan text.
1204
+ */
1205
+ cyan?: string;
1206
+ /**
1207
+ * Custom color for green text.
1208
+ */
1209
+ green?: string;
1210
+ /**
1211
+ * Custom color for magenta text.
1212
+ */
1213
+ magenta?: string;
1214
+ /**
1215
+ * Custom color for red text.
1216
+ */
1217
+ red?: string;
1218
+ /**
1219
+ * Custom color for yellow text.
1220
+ */
1221
+ yellow?: string;
1222
+ };
1197
1223
  /** Options for stats */
1198
1224
  export type StatsOptions = {
1199
1225
  /**
@@ -1253,7 +1279,7 @@ export type StatsOptions = {
1253
1279
  * Enables or disables the use of colors in the output.
1254
1280
  * @default false
1255
1281
  */
1256
- colors?: boolean;
1282
+ colors?: boolean | StatsColorOptions;
1257
1283
  /**
1258
1284
  * Enables or disables the display of the hash.
1259
1285
  * @default true
@@ -1724,7 +1750,7 @@ export type Optimization = {
1724
1750
  * Customize the minimizer.
1725
1751
  * By default, `rspack.SwcJsMinimizerRspackPlugin` and `rspack.LightningCssMinimizerRspackPlugin` are used.
1726
1752
  */
1727
- minimizer?: Array<"..." | Plugin>;
1753
+ minimizer?: ("..." | Plugin)[];
1728
1754
  /**
1729
1755
  * Whether to merge chunks which contain the same modules.
1730
1756
  * Setting optimization.mergeDuplicateChunks to false will disable this optimization.
@@ -1833,9 +1859,9 @@ export type ExperimentCacheOptions = boolean | {
1833
1859
  buildDependencies?: string[];
1834
1860
  version?: string;
1835
1861
  snapshot?: {
1836
- immutablePaths?: Array<string | RegExp>;
1837
- unmanagedPaths?: Array<string | RegExp>;
1838
- managedPaths?: Array<string | RegExp>;
1862
+ immutablePaths?: (string | RegExp)[];
1863
+ unmanagedPaths?: (string | RegExp)[];
1864
+ managedPaths?: (string | RegExp)[];
1839
1865
  };
1840
1866
  storage?: {
1841
1867
  type: "filesystem";
@@ -34,7 +34,7 @@ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_expo
34
34
  cssReload: ()=>cssReload,
35
35
  normalizeUrl: ()=>normalizeUrl
36
36
  });
37
- let srcByModuleId = Object.create(null), noDocument = "undefined" == typeof document, { forEach } = Array.prototype;
37
+ const srcByModuleId = Object.create(null), noDocument = "undefined" == typeof document, { forEach } = Array.prototype;
38
38
  function noop() {}
39
39
  function updateCss(el, url) {
40
40
  let normalizedUrl;
@@ -94,14 +94,13 @@ function cssReload(moduleId, options) {
94
94
  if (!src) return !1;
95
95
  let elements = document.querySelectorAll("link"), loaded = !1;
96
96
  return forEach.call(elements, (el)=>{
97
+ var href;
98
+ let ret, normalizedHref;
97
99
  if (!el.href) return;
98
- let url = function(href, src) {
99
- let ret = "", normalizedHref = normalizeUrl(href);
100
- return src.some((url)=>{
101
- normalizedHref.indexOf(src) > -1 && (ret = url);
102
- }), ret;
103
- }(el.href, src);
104
- isUrlRequest(url) && !0 !== el.visited && url && (updateCss(el, url), loaded = !0);
100
+ let url = (href = el.href, ret = "", normalizedHref = normalizeUrl(href), src.some((url)=>{
101
+ normalizedHref.indexOf(src) > -1 && (ret = url);
102
+ }), ret);
103
+ !isUrlRequest(url) || !0 !== el.visited && url && (updateCss(el, url), loaded = !0);
105
104
  }), loaded;
106
105
  }(src);
107
106
  if (options.locals) {
@@ -28,12 +28,12 @@ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_expo
28
28
  AUTO_PUBLIC_PATH: ()=>AUTO_PUBLIC_PATH,
29
29
  pitch: ()=>pitch
30
30
  });
31
- let external_node_path_namespaceObject = require("node:path");
31
+ const external_node_path_namespaceObject = require("node:path");
32
32
  var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
33
33
  function isAbsolutePath(str) {
34
34
  return external_node_path_default().posix.isAbsolute(str) || external_node_path_default().win32.isAbsolute(str);
35
35
  }
36
- let PLUGIN_NAME = "css-extract-rspack-plugin", RELATIVE_PATH_REGEXP = /^\.\.?[/\\]/, BASE_URI = "webpack://", MODULE_TYPE = "css/mini-extract", AUTO_PUBLIC_PATH = "__mini_css_extract_plugin_public_path_auto__", ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/mini-css-extract-plugin/`, SINGLE_DOT_PATH_SEGMENT = "__mini_css_extract_plugin_single_dot_path_segment__";
36
+ const PLUGIN_NAME = "css-extract-rspack-plugin", RELATIVE_PATH_REGEXP = /^\.\.?[/\\]/, BASE_URI = "webpack://", MODULE_TYPE = "css/mini-extract", AUTO_PUBLIC_PATH = "__mini_css_extract_plugin_public_path_auto__", ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/mini-css-extract-plugin/`, SINGLE_DOT_PATH_SEGMENT = "__mini_css_extract_plugin_single_dot_path_segment__";
37
37
  function hotLoader(content, context) {
38
38
  let localsJsonString = JSON.stringify(JSON.stringify(context.locals));
39
39
  return `${content}
@@ -72,7 +72,7 @@ function hotLoader(content, context) {
72
72
  }
73
73
  `;
74
74
  }
75
- let pitch = function(request, _, data) {
75
+ const pitch = function(request, _, data) {
76
76
  let publicPathForExtract;
77
77
  if (this._compiler?.options?.experiments?.css && this._module && ("css" === this._module.type || "css/auto" === this._module.type || "css/global" === this._module.type || "css/module" === this._module.type)) {
78
78
  let e = Error("use type 'css' and `CssExtractRspackPlugin` together, please set `experiments.css` to `false` or set `{ type: \"javascript/auto\" }` for rules with `CssExtractRspackPlugin` in your rspack config (now `CssExtractRspackPlugin` does nothing).");
@@ -140,8 +140,7 @@ let pitch = function(request, _, data) {
140
140
  publicPath: publicPathForExtract,
141
141
  baseUri: `${BASE_URI}/`
142
142
  }, (error, exports1)=>{
143
- if (error) return void callback(error);
144
- handleExports(exports1);
143
+ error ? callback(error) : handleExports(exports1);
145
144
  });
146
145
  }, css_extract_loader = function(content) {
147
146
  if (this._compiler?.options?.experiments?.css && this._module && ("css" === this._module.type || "css/auto" === this._module.type || "css/global" === this._module.type || "css/module" === this._module.type)) return content;
package/dist/exports.d.ts CHANGED
@@ -56,7 +56,7 @@ export { default as EntryOptionPlugin } from "./lib/EntryOptionPlugin";
56
56
  export { EnvironmentPlugin } from "./lib/EnvironmentPlugin";
57
57
  export { LoaderOptionsPlugin } from "./lib/LoaderOptionsPlugin";
58
58
  export { LoaderTargetPlugin } from "./lib/LoaderTargetPlugin";
59
- export type { OutputFileSystem } from "./util/fs";
59
+ export type { OutputFileSystem, WatchFileSystem } from "./util/fs";
60
60
  import { EsmLibraryPlugin, FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, SubresourceIntegrityPlugin } from "./builtin-plugin";
61
61
  interface Web {
62
62
  FetchCompileAsyncWasmPlugin: typeof FetchCompileAsyncWasmPlugin;