@rspack/core 1.2.1 → 1.2.3

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.
package/dist/Module.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import type { JsCodegenerationResult, JsContextModuleFactoryAfterResolveData, JsContextModuleFactoryBeforeResolveData, JsCreateData, JsFactoryMeta } from "@rspack/binding";
1
+ import type { JsCodegenerationResult, JsContextModuleFactoryAfterResolveData, JsContextModuleFactoryBeforeResolveData, JsCreateData, JsFactoryMeta, JsLibIdentOptions } from "@rspack/binding";
2
2
  import type { JsModule } from "@rspack/binding";
3
3
  import type { Source } from "../compiled/webpack-sources";
4
4
  import { DependenciesBlock } from "./DependenciesBlock";
5
5
  import { Dependency } from "./Dependency";
6
+ import { type AssetInfo } from "./util/AssetInfo";
6
7
  export type ResourceData = {
7
8
  resource: string;
8
9
  path: string;
@@ -74,6 +75,8 @@ export declare class Module {
74
75
  readonly blocks: DependenciesBlock[];
75
76
  readonly dependencies: Dependency[];
76
77
  readonly useSourceMap: boolean;
78
+ readonly resourceResolveData: Record<string, any> | undefined;
79
+ readonly matchResource: string | undefined;
77
80
  static __from_binding(binding: JsModule): Module;
78
81
  static __to_binding(module: Module): JsModule;
79
82
  constructor(module: JsModule);
@@ -81,6 +84,8 @@ export declare class Module {
81
84
  identifier(): string;
82
85
  nameForCondition(): string | null;
83
86
  size(type?: string): number;
87
+ libIdent(options: JsLibIdentOptions): string | null;
88
+ emitFile(filename: string, source: Source, assetInfo: AssetInfo): void;
84
89
  }
85
90
  export declare class CodeGenerationResult {
86
91
  #private;
@@ -9,8 +9,12 @@ export default class ModuleGraph {
9
9
  private constructor();
10
10
  getModule(dependency: Dependency): Module | null;
11
11
  getResolvedModule(dependency: Dependency): Module | null;
12
+ getParentModule(dependency: Dependency): Module | null;
12
13
  getIssuer(module: Module): Module | null;
13
14
  getExportsInfo(module: Module): ExportsInfo;
14
15
  getConnection(dependency: Dependency): ModuleGraphConnection | null;
15
16
  getOutgoingConnections(module: Module): ModuleGraphConnection[];
17
+ getIncomingConnections(module: Module): ModuleGraphConnection[];
18
+ getParentBlockIndex(dependency: Dependency): number;
19
+ isAsync(module: Module): boolean;
16
20
  }
@@ -5,6 +5,8 @@ export declare class ModuleGraphConnection {
5
5
  #private;
6
6
  readonly module: Module | null;
7
7
  readonly dependency: Dependency;
8
+ readonly resolvedModule: Module | null;
9
+ readonly originModule: Module | null;
8
10
  static __from_binding(binding: JsModuleGraphConnection): ModuleGraphConnection;
9
11
  static __to_binding(data: ModuleGraphConnection): JsModuleGraphConnection;
10
12
  private constructor();
@@ -1,6 +1,7 @@
1
1
  import type * as binding from "@rspack/binding";
2
2
  import * as liteTapable from "@rspack/lite-tapable";
3
3
  import type { ResolveData, ResourceDataWithData } from "./Module";
4
+ import type { ResolverFactory } from "./ResolverFactory";
4
5
  export type NormalModuleCreateData = binding.JsNormalModuleFactoryCreateModuleArgs & {
5
6
  settings: {};
6
7
  };
@@ -16,5 +17,7 @@ export declare class NormalModuleFactory {
16
17
  {}
17
18
  ], void>;
18
19
  };
19
- constructor();
20
+ resolverFactory: ResolverFactory;
21
+ constructor(resolverFactory: ResolverFactory);
22
+ getResolver(type: string, resolveOptions: Parameters<ResolverFactory["get"]>[1]): import("./Resolver").Resolver;
20
23
  }
@@ -1,10 +1,26 @@
1
+ /**
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack/blob/3919c84/lib/javascript/EnableChunkLoadingPlugin.js
4
+ *
5
+ * MIT Licensed
6
+ * Author Tobias Koppers @sokra
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/webpack/blob/main/LICENSE
9
+ */
1
10
  import { BuiltinPluginName } from "@rspack/binding";
2
- export declare const EnableChunkLoadingPlugin: {
11
+ import type { ChunkLoadingType, Compiler } from "../exports";
12
+ declare const EnableChunkLoadingPluginInner: {
3
13
  new (type: string): {
4
14
  name: BuiltinPluginName;
5
15
  _args: [type: string];
6
16
  affectedHooks: "done" | "environment" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
7
- raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
8
- apply(compiler: import("..").Compiler): void;
17
+ raw(compiler: Compiler): import("@rspack/binding").BuiltinPlugin;
18
+ apply(compiler: Compiler): void;
9
19
  };
10
20
  };
21
+ export declare class EnableChunkLoadingPlugin extends EnableChunkLoadingPluginInner {
22
+ static setEnabled(compiler: Compiler, type: ChunkLoadingType): void;
23
+ static checkEnabled(compiler: Compiler, type: ChunkLoadingType): void;
24
+ apply(compiler: Compiler): void;
25
+ }
26
+ export {};
@@ -0,0 +1,45 @@
1
+ import { BuiltinPluginName, type JsRsdoctorAsset, type JsRsdoctorAssetPatch, type JsRsdoctorChunk, type JsRsdoctorChunkAssets, type JsRsdoctorChunkGraph, type JsRsdoctorChunkModules, type JsRsdoctorDependency, type JsRsdoctorEntrypoint, type JsRsdoctorEntrypointAssets, type JsRsdoctorExportInfo, type JsRsdoctorModule, type JsRsdoctorModuleGraph, type JsRsdoctorModuleGraphModule, type JsRsdoctorModuleIdsPatch, type JsRsdoctorModuleOriginalSource, type JsRsdoctorModuleSourcesPatch, type JsRsdoctorSideEffect, type JsRsdoctorSourcePosition, type JsRsdoctorSourceRange, type JsRsdoctorStatement, type JsRsdoctorVariable } from "@rspack/binding";
2
+ import * as liteTapable from "@rspack/lite-tapable";
3
+ import { Compilation } from "../Compilation";
4
+ import type { Compiler } from "../Compiler";
5
+ import type { CreatePartialRegisters } from "../taps/types";
6
+ export declare namespace RsdoctorPluginData {
7
+ export type { JsRsdoctorAsset as RsdoctorAsset, JsRsdoctorChunkGraph as RsdoctorChunkGraph, JsRsdoctorModuleGraph as RsdoctorModuleGraph, JsRsdoctorChunk as RsdoctorChunk, JsRsdoctorModule as RsdoctorModule, JsRsdoctorSideEffect as RsdoctorSideEffect, JsRsdoctorExportInfo as RsdoctorExportInfo, JsRsdoctorVariable as RsdoctorVariable, JsRsdoctorDependency as RsdoctorDependency, JsRsdoctorEntrypoint as RsdoctorEntrypoint, JsRsdoctorStatement as RsdoctorStatement, JsRsdoctorSourceRange as RsdoctorSourceRange, JsRsdoctorSourcePosition as RsdoctorSourcePosition, JsRsdoctorModuleGraphModule as RsdoctorModuleGraphModule, JsRsdoctorModuleIdsPatch as RsdoctorModuleIdsPatch, JsRsdoctorModuleOriginalSource as RsdoctorModuleOriginalSource, JsRsdoctorAssetPatch as RsdoctorAssetPatch, JsRsdoctorChunkAssets as RsdoctorChunkAssets, JsRsdoctorEntrypointAssets as RsdoctorEntrypointAssets, JsRsdoctorChunkModules as RsdoctorChunkModules, JsRsdoctorModuleSourcesPatch as RsdoctorModuleSourcesPatch };
8
+ }
9
+ export type RsdoctorPluginOptions = {
10
+ moduleGraphFeatures?: boolean | Array<"graph" | "ids" | "sources">;
11
+ chunkGraphFeatures?: boolean | Array<"graph" | "assets">;
12
+ };
13
+ declare const RsdoctorPluginImpl: {
14
+ new (c?: RsdoctorPluginOptions | undefined): {
15
+ name: BuiltinPluginName;
16
+ _args: [c?: RsdoctorPluginOptions | undefined];
17
+ affectedHooks: "done" | "environment" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
18
+ raw(compiler: Compiler): import("@rspack/binding").BuiltinPlugin;
19
+ apply(compiler: Compiler): void;
20
+ };
21
+ };
22
+ export type RsdoctorPluginHooks = {
23
+ moduleGraph: liteTapable.AsyncSeriesBailHook<[
24
+ JsRsdoctorModuleGraph
25
+ ], false | void>;
26
+ chunkGraph: liteTapable.AsyncSeriesBailHook<[
27
+ JsRsdoctorChunkGraph
28
+ ], false | void>;
29
+ moduleIds: liteTapable.AsyncSeriesBailHook<[
30
+ JsRsdoctorModuleIdsPatch
31
+ ], false | void>;
32
+ moduleSources: liteTapable.AsyncSeriesBailHook<[
33
+ JsRsdoctorModuleSourcesPatch
34
+ ], false | void>;
35
+ assets: liteTapable.AsyncSeriesBailHook<[JsRsdoctorAssetPatch], false | void>;
36
+ };
37
+ declare const RsdoctorPlugin: typeof RsdoctorPluginImpl & {
38
+ /**
39
+ * @deprecated Use `getCompilationHooks` instead.
40
+ */
41
+ getHooks: (compilation: Compilation) => RsdoctorPluginHooks;
42
+ getCompilationHooks: (compilation: Compilation) => RsdoctorPluginHooks;
43
+ };
44
+ export declare const createRsdoctorPluginHooksRegisters: CreatePartialRegisters<`RsdoctorPlugin`>;
45
+ export { RsdoctorPlugin };
@@ -1,10 +1,28 @@
1
- import { BuiltinPluginName } from "@rspack/binding";
2
- export declare const RuntimePlugin: {
1
+ import * as binding from "@rspack/binding";
2
+ import * as liteTapable from "@rspack/lite-tapable";
3
+ import { Chunk } from "../Chunk";
4
+ import { Compilation } from "../Compilation";
5
+ import type { CreatePartialRegisters } from "../taps/types";
6
+ export declare const RuntimePluginImpl: {
3
7
  new (): {
4
- name: BuiltinPluginName;
8
+ name: binding.BuiltinPluginName;
5
9
  _args: [];
6
10
  affectedHooks: "done" | "environment" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
7
- raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
11
+ raw(compiler: import("..").Compiler): binding.BuiltinPlugin;
8
12
  apply(compiler: import("..").Compiler): void;
9
13
  };
10
14
  };
15
+ export type RuntimePluginHooks = {
16
+ createScript: liteTapable.SyncWaterfallHook<[string, Chunk]>;
17
+ linkPreload: liteTapable.SyncWaterfallHook<[string, Chunk]>;
18
+ linkPrefetch: liteTapable.SyncWaterfallHook<[string, Chunk]>;
19
+ };
20
+ declare const RuntimePlugin: typeof RuntimePluginImpl & {
21
+ /**
22
+ * @deprecated Use `getCompilationHooks` instead.
23
+ */
24
+ getHooks: (compilation: Compilation) => RuntimePluginHooks;
25
+ getCompilationHooks: (compilation: Compilation) => RuntimePluginHooks;
26
+ };
27
+ export declare const createRuntimePluginHooksRegisters: CreatePartialRegisters<`RuntimePlugin`>;
28
+ export { RuntimePlugin };
@@ -5,63 +5,69 @@ export type HtmlRspackPluginOptions = {
5
5
  /** The title to use for the generated HTML document. */
6
6
  title?: string;
7
7
  /**
8
- * The file to write the HTML to. You can specify a subdirectory here too (eg: pages/index.html).
9
- * @default 'index.html'
8
+ * The file to write the HTML to. You can specify a subdirectory here too (e.g.: `"pages/index.html"`).
9
+ * @default "index.html"
10
10
  */
11
11
  filename?: string | ((entry: string) => string);
12
12
  /** The template file path. */
13
13
  template?: string;
14
14
  /**
15
- * The template file content, priority is greater than template.
15
+ * The template file content, priority is greater than `template` option.
16
+ *
16
17
  * When using a function, pass in the template parameters and use the returned string as the template content.
17
18
  */
18
19
  templateContent?: string | TemplateRenderFunction;
19
20
  /**
20
21
  * Allows to overwrite the parameters used in the template.
22
+ *
21
23
  * When using a function, pass in the original template parameters and use the returned object as the final template parameters.
22
24
  */
23
25
  templateParameters?: Record<string, string> | boolean | TemplateParamFunction;
24
26
  /**
25
- * The script and link tag inject position in template. Use false to not inject.
26
- * If not specified, it will be automatically determined based on scriptLoading.
27
+ * The script and link tag inject position in template. Use `false` to not inject.
28
+ * If not specified, it will be automatically determined based on `scriptLoading` value.
29
+ * @default true
27
30
  */
28
31
  inject?: boolean | "head" | "body";
29
- /** The publicPath used for script and link tags. */
32
+ /** The public path used for script and link tags. */
30
33
  publicPath?: string;
31
- /** Inject a [base](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base) tag */
34
+ /** Inject a [`base`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base) tag. */
32
35
  base?: string | {
33
36
  href?: string;
34
37
  target?: "_self" | "_blank" | "_parent" | "_top";
35
38
  };
36
39
  /**
37
- * Modern browsers support non blocking javascript loading ('defer') to improve the page startup performance.
38
- * Setting to 'module' adds attribute type='module'.
39
- * This also implies 'defer', since modules are automatically deferred.
40
- * @default 'defer'
40
+ * Modern browsers support non-blocking JavaScript loading ([`defer` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#defer)) to improve the page startup performance.
41
+ *
42
+ * Setting this option to `'module'` adds attribute `type="module"` to the `script`. This also implies `defer` attribute on the `script`, since modules are automatically deferred.
43
+ * @default "defer"
41
44
  * */
42
45
  scriptLoading?: "blocking" | "defer" | "module" | "systemjs-module";
43
46
  /** Allows you to add only some chunks. */
44
47
  chunks?: string[];
45
48
  /** Allows you to skip some chunks. */
46
49
  excludeChunks?: string[];
47
- /** Allows to control how chunks should be sorted before they are included to the HTML. */
50
+ /**
51
+ * Allows to control how chunks should be sorted before they are included to the HTML.
52
+ * @default "auto"
53
+ */
48
54
  chunksSortMode?: "auto" | "manual";
49
- /** The sri hash algorithm, disabled by default. */
55
+ /** The SRI hash algorithm, disabled by default. */
50
56
  sri?: "sha256" | "sha384" | "sha512";
51
57
  /**
52
- * Controls whether to minify the output.
53
- * @default false
58
+ * Controls whether to minify the output, disabled by default.
54
59
  */
55
60
  minify?: boolean;
56
61
  /** Adds the given favicon path to the output HTML. */
57
62
  favicon?: string;
58
63
  /**
59
- * If true then append a unique rspack compilation hash to all included scripts and CSS files.
60
- * This is useful for cache busting
61
- * @default false
62
- * */
64
+ * Allows to inject meta-tags.
65
+ * @default {}
66
+ */
63
67
  meta?: Record<string, string | Record<string, string>>;
64
- /** Inject a base tag */
68
+ /**
69
+ * If `true` then append a unique Rspack compilation hash to all included scripts and CSS files. This is useful for cache busting.
70
+ */
65
71
  hash?: boolean;
66
72
  };
67
73
  export declare function validateHtmlPluginOptions(options: HtmlRspackPluginOptions): void;
@@ -70,3 +70,4 @@ export * from "./ContextReplacementPlugin";
70
70
  export * from "./LibManifestPlugin";
71
71
  export * from "./DllEntryPlugin";
72
72
  export * from "./DllReferenceAgencyPlugin";
73
+ export * from "./RsdoctorPlugin";
@@ -1,7 +1,16 @@
1
1
  import type { IncomingMessage, ServerOptions as ServerOptionsImport, ServerResponse } from "node:http";
2
- import type { ListenOptions, Server } from "node:net";
2
+ import type { AddressInfo, ListenOptions, Socket } from "node:net";
3
3
  import type { SecureContextOptions, TlsOptions } from "node:tls";
4
4
  import type { Compiler } from "../..";
5
+ interface Server {
6
+ on(event: "request", callback: (req: IncomingMessage, res: ServerResponse) => void): void;
7
+ on(event: "connection", callback: (socket: Socket) => void): void;
8
+ on(event: "listening", callback: (err?: Error) => void): void;
9
+ off(event: "request", callback: (req: IncomingMessage, res: ServerResponse) => void): void;
10
+ address(): AddressInfo;
11
+ close(callback: (err?: any) => void): void;
12
+ listen(listenOptions?: number | ListenOptions): void;
13
+ }
5
14
  export interface LazyCompilationDefaultBackendOptions {
6
15
  /**
7
16
  * A custom client script path.
@@ -10,3 +10,4 @@
10
10
  import type { RspackOptionsNormalized } from "./normalization";
11
11
  export declare const applyRspackOptionsDefaults: (options: RspackOptionsNormalized) => void;
12
12
  export declare const applyRspackOptionsBaseDefaults: (options: RspackOptionsNormalized) => void;
13
+ export declare const getPnpDefault: () => boolean;
@@ -1599,6 +1599,10 @@ export type OptimizationSplitChunksCacheGroup = {
1599
1599
  type?: string | RegExp;
1600
1600
  /** Sets the hint for chunk id. It will be added to chunk's filename. */
1601
1601
  idHint?: string;
1602
+ /**
1603
+ * Assign modules to a cache group by module layer.
1604
+ */
1605
+ layer?: string | ((layer?: string) => boolean) | RegExp;
1602
1606
  } & SharedOptimizationSplitChunksCacheGroup;
1603
1607
  /** Tell Rspack how to splitting chunks. */
1604
1608
  export type OptimizationSplitChunksOptions = {
@@ -884,7 +884,7 @@ export declare const rspackOptions: z.ZodObject<{
884
884
  lazyCompilation: z.ZodUnion<[z.ZodOptional<z.ZodBoolean>, z.ZodObject<{
885
885
  backend: z.ZodOptional<z.ZodObject<{
886
886
  client: z.ZodOptional<z.ZodString>;
887
- listen: z.ZodUnion<[z.ZodOptional<z.ZodNumber>, z.ZodObject<{
887
+ listen: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodNumber, z.ZodObject<{
888
888
  port: z.ZodOptional<z.ZodNumber>;
889
889
  host: z.ZodOptional<z.ZodString>;
890
890
  backlog: z.ZodOptional<z.ZodNumber>;
@@ -911,8 +911,9 @@ export declare const rspackOptions: z.ZodObject<{
911
911
  readableAll?: boolean | undefined;
912
912
  writableAll?: boolean | undefined;
913
913
  ipv6Only?: boolean | undefined;
914
- }>]>;
914
+ }>]>, z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodVoid>]>>;
915
915
  protocol: z.ZodOptional<z.ZodEnum<["http", "https"]>>;
916
+ server: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodAny>]>>;
916
917
  }, "strip", z.ZodTypeAny, {
917
918
  client?: string | undefined;
918
919
  listen?: number | {
@@ -924,8 +925,9 @@ export declare const rspackOptions: z.ZodObject<{
924
925
  readableAll?: boolean | undefined;
925
926
  writableAll?: boolean | undefined;
926
927
  ipv6Only?: boolean | undefined;
927
- } | undefined;
928
+ } | ((args_0: any, ...args: unknown[]) => void) | undefined;
928
929
  protocol?: "http" | "https" | undefined;
930
+ server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
929
931
  }, {
930
932
  client?: string | undefined;
931
933
  listen?: number | {
@@ -937,8 +939,9 @@ export declare const rspackOptions: z.ZodObject<{
937
939
  readableAll?: boolean | undefined;
938
940
  writableAll?: boolean | undefined;
939
941
  ipv6Only?: boolean | undefined;
940
- } | undefined;
942
+ } | ((args_0: any, ...args: unknown[]) => void) | undefined;
941
943
  protocol?: "http" | "https" | undefined;
944
+ server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
942
945
  }>>;
943
946
  imports: z.ZodOptional<z.ZodBoolean>;
944
947
  entries: z.ZodOptional<z.ZodBoolean>;
@@ -958,8 +961,9 @@ export declare const rspackOptions: z.ZodObject<{
958
961
  readableAll?: boolean | undefined;
959
962
  writableAll?: boolean | undefined;
960
963
  ipv6Only?: boolean | undefined;
961
- } | undefined;
964
+ } | ((args_0: any, ...args: unknown[]) => void) | undefined;
962
965
  protocol?: "http" | "https" | undefined;
966
+ server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
963
967
  } | undefined;
964
968
  }, {
965
969
  entries?: boolean | undefined;
@@ -976,8 +980,9 @@ export declare const rspackOptions: z.ZodObject<{
976
980
  readableAll?: boolean | undefined;
977
981
  writableAll?: boolean | undefined;
978
982
  ipv6Only?: boolean | undefined;
979
- } | undefined;
983
+ } | ((args_0: any, ...args: unknown[]) => void) | undefined;
980
984
  protocol?: "http" | "https" | undefined;
985
+ server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
981
986
  } | undefined;
982
987
  }>]>;
983
988
  asyncWebAssembly: z.ZodOptional<z.ZodBoolean>;
@@ -1096,8 +1101,9 @@ export declare const rspackOptions: z.ZodObject<{
1096
1101
  readableAll?: boolean | undefined;
1097
1102
  writableAll?: boolean | undefined;
1098
1103
  ipv6Only?: boolean | undefined;
1099
- } | undefined;
1104
+ } | ((args_0: any, ...args: unknown[]) => void) | undefined;
1100
1105
  protocol?: "http" | "https" | undefined;
1106
+ server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
1101
1107
  } | undefined;
1102
1108
  } | undefined;
1103
1109
  asyncWebAssembly?: boolean | undefined;
@@ -1163,8 +1169,9 @@ export declare const rspackOptions: z.ZodObject<{
1163
1169
  readableAll?: boolean | undefined;
1164
1170
  writableAll?: boolean | undefined;
1165
1171
  ipv6Only?: boolean | undefined;
1166
- } | undefined;
1172
+ } | ((args_0: any, ...args: unknown[]) => void) | undefined;
1167
1173
  protocol?: "http" | "https" | undefined;
1174
+ server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
1168
1175
  } | undefined;
1169
1176
  } | undefined;
1170
1177
  asyncWebAssembly?: boolean | undefined;
@@ -1368,11 +1375,9 @@ export declare const rspackOptions: z.ZodObject<{
1368
1375
  }, "strict", z.ZodTypeAny, {
1369
1376
  modules?: boolean | undefined;
1370
1377
  chunks?: boolean | undefined;
1371
- ids?: boolean | undefined;
1372
- runtime?: boolean | undefined;
1373
- hash?: boolean | undefined;
1374
1378
  all?: boolean | undefined;
1375
1379
  version?: boolean | undefined;
1380
+ runtime?: boolean | undefined;
1376
1381
  publicPath?: boolean | undefined;
1377
1382
  preset?: boolean | "none" | "verbose" | "normal" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary" | undefined;
1378
1383
  assets?: boolean | undefined;
@@ -1383,10 +1388,12 @@ export declare const rspackOptions: z.ZodObject<{
1383
1388
  errors?: boolean | undefined;
1384
1389
  errorsCount?: boolean | undefined;
1385
1390
  colors?: boolean | undefined;
1391
+ hash?: boolean | undefined;
1386
1392
  reasons?: boolean | undefined;
1387
1393
  outputPath?: boolean | undefined;
1388
1394
  chunkModules?: boolean | undefined;
1389
1395
  chunkRelations?: boolean | undefined;
1396
+ ids?: boolean | undefined;
1390
1397
  timings?: boolean | undefined;
1391
1398
  builtAt?: boolean | undefined;
1392
1399
  moduleAssets?: boolean | undefined;
@@ -1445,11 +1452,9 @@ export declare const rspackOptions: z.ZodObject<{
1445
1452
  }, {
1446
1453
  modules?: boolean | undefined;
1447
1454
  chunks?: boolean | undefined;
1448
- ids?: boolean | undefined;
1449
- runtime?: boolean | undefined;
1450
- hash?: boolean | undefined;
1451
1455
  all?: boolean | undefined;
1452
1456
  version?: boolean | undefined;
1457
+ runtime?: boolean | undefined;
1453
1458
  publicPath?: boolean | undefined;
1454
1459
  preset?: boolean | "none" | "verbose" | "normal" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary" | undefined;
1455
1460
  assets?: boolean | undefined;
@@ -1460,10 +1465,12 @@ export declare const rspackOptions: z.ZodObject<{
1460
1465
  errors?: boolean | undefined;
1461
1466
  errorsCount?: boolean | undefined;
1462
1467
  colors?: boolean | undefined;
1468
+ hash?: boolean | undefined;
1463
1469
  reasons?: boolean | undefined;
1464
1470
  outputPath?: boolean | undefined;
1465
1471
  chunkModules?: boolean | undefined;
1466
1472
  chunkRelations?: boolean | undefined;
1473
+ ids?: boolean | undefined;
1467
1474
  timings?: boolean | undefined;
1468
1475
  builtAt?: boolean | undefined;
1469
1476
  moduleAssets?: boolean | undefined;
@@ -1560,8 +1567,10 @@ export declare const rspackOptions: z.ZodObject<{
1560
1567
  reuseExistingChunk: z.ZodOptional<z.ZodBoolean>;
1561
1568
  type: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>>;
1562
1569
  idHint: z.ZodOptional<z.ZodString>;
1570
+ layer: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodFunction<z.ZodTuple<[z.ZodOptional<z.ZodString>], null>, z.ZodBoolean>]>>;
1563
1571
  }, "strict", z.ZodTypeAny, {
1564
1572
  type?: string | RegExp | undefined;
1573
+ layer?: string | RegExp | ((args_0: string | undefined) => boolean) | undefined;
1565
1574
  chunks?: RegExp | "initial" | "async" | "all" | ((args_0: Chunk, ...args: unknown[]) => boolean) | undefined;
1566
1575
  name?: string | false | ((args_0: Module, args_1: Chunk[], args_2: string, ...args: unknown[]) => string | undefined) | undefined;
1567
1576
  filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args: unknown[]) => string) | undefined;
@@ -1582,6 +1591,7 @@ export declare const rspackOptions: z.ZodObject<{
1582
1591
  idHint?: string | undefined;
1583
1592
  }, {
1584
1593
  type?: string | RegExp | undefined;
1594
+ layer?: string | RegExp | ((args_0: string | undefined) => boolean) | undefined;
1585
1595
  chunks?: RegExp | "initial" | "async" | "all" | ((args_0: Chunk, ...args: unknown[]) => boolean) | undefined;
1586
1596
  name?: string | false | ((args_0: Module, args_1: Chunk[], args_2: string, ...args: unknown[]) => string | undefined) | undefined;
1587
1597
  filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args: unknown[]) => string) | undefined;
@@ -1631,6 +1641,7 @@ export declare const rspackOptions: z.ZodObject<{
1631
1641
  defaultSizeTypes?: string[] | undefined;
1632
1642
  cacheGroups?: Record<string, false | {
1633
1643
  type?: string | RegExp | undefined;
1644
+ layer?: string | RegExp | ((args_0: string | undefined) => boolean) | undefined;
1634
1645
  chunks?: RegExp | "initial" | "async" | "all" | ((args_0: Chunk, ...args: unknown[]) => boolean) | undefined;
1635
1646
  name?: string | false | ((args_0: Module, args_1: Chunk[], args_2: string, ...args: unknown[]) => string | undefined) | undefined;
1636
1647
  filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args: unknown[]) => string) | undefined;
@@ -1674,6 +1685,7 @@ export declare const rspackOptions: z.ZodObject<{
1674
1685
  defaultSizeTypes?: string[] | undefined;
1675
1686
  cacheGroups?: Record<string, false | {
1676
1687
  type?: string | RegExp | undefined;
1688
+ layer?: string | RegExp | ((args_0: string | undefined) => boolean) | undefined;
1677
1689
  chunks?: RegExp | "initial" | "async" | "all" | ((args_0: Chunk, ...args: unknown[]) => boolean) | undefined;
1678
1690
  name?: string | false | ((args_0: Module, args_1: Chunk[], args_2: string, ...args: unknown[]) => string | undefined) | undefined;
1679
1691
  filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args: unknown[]) => string) | undefined;
@@ -1756,6 +1768,7 @@ export declare const rspackOptions: z.ZodObject<{
1756
1768
  defaultSizeTypes?: string[] | undefined;
1757
1769
  cacheGroups?: Record<string, false | {
1758
1770
  type?: string | RegExp | undefined;
1771
+ layer?: string | RegExp | ((args_0: string | undefined) => boolean) | undefined;
1759
1772
  chunks?: RegExp | "initial" | "async" | "all" | ((args_0: Chunk, ...args: unknown[]) => boolean) | undefined;
1760
1773
  name?: string | false | ((args_0: Module, args_1: Chunk[], args_2: string, ...args: unknown[]) => string | undefined) | undefined;
1761
1774
  filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args: unknown[]) => string) | undefined;
@@ -1823,6 +1836,7 @@ export declare const rspackOptions: z.ZodObject<{
1823
1836
  defaultSizeTypes?: string[] | undefined;
1824
1837
  cacheGroups?: Record<string, false | {
1825
1838
  type?: string | RegExp | undefined;
1839
+ layer?: string | RegExp | ((args_0: string | undefined) => boolean) | undefined;
1826
1840
  chunks?: RegExp | "initial" | "async" | "all" | ((args_0: Chunk, ...args: unknown[]) => boolean) | undefined;
1827
1841
  name?: string | false | ((args_0: Module, args_1: Chunk[], args_2: string, ...args: unknown[]) => string | undefined) | undefined;
1828
1842
  filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args: unknown[]) => string) | undefined;
@@ -3109,8 +3123,9 @@ export declare const rspackOptions: z.ZodObject<{
3109
3123
  readableAll?: boolean | undefined;
3110
3124
  writableAll?: boolean | undefined;
3111
3125
  ipv6Only?: boolean | undefined;
3112
- } | undefined;
3126
+ } | ((args_0: any, ...args: unknown[]) => void) | undefined;
3113
3127
  protocol?: "http" | "https" | undefined;
3128
+ server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
3114
3129
  } | undefined;
3115
3130
  } | undefined;
3116
3131
  asyncWebAssembly?: boolean | undefined;
@@ -3149,11 +3164,9 @@ export declare const rspackOptions: z.ZodObject<{
3149
3164
  stats?: boolean | "none" | "verbose" | "normal" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary" | {
3150
3165
  modules?: boolean | undefined;
3151
3166
  chunks?: boolean | undefined;
3152
- ids?: boolean | undefined;
3153
- runtime?: boolean | undefined;
3154
- hash?: boolean | undefined;
3155
3167
  all?: boolean | undefined;
3156
3168
  version?: boolean | undefined;
3169
+ runtime?: boolean | undefined;
3157
3170
  publicPath?: boolean | undefined;
3158
3171
  preset?: boolean | "none" | "verbose" | "normal" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary" | undefined;
3159
3172
  assets?: boolean | undefined;
@@ -3164,10 +3177,12 @@ export declare const rspackOptions: z.ZodObject<{
3164
3177
  errors?: boolean | undefined;
3165
3178
  errorsCount?: boolean | undefined;
3166
3179
  colors?: boolean | undefined;
3180
+ hash?: boolean | undefined;
3167
3181
  reasons?: boolean | undefined;
3168
3182
  outputPath?: boolean | undefined;
3169
3183
  chunkModules?: boolean | undefined;
3170
3184
  chunkRelations?: boolean | undefined;
3185
+ ids?: boolean | undefined;
3171
3186
  timings?: boolean | undefined;
3172
3187
  builtAt?: boolean | undefined;
3173
3188
  moduleAssets?: boolean | undefined;
@@ -3449,6 +3464,7 @@ export declare const rspackOptions: z.ZodObject<{
3449
3464
  defaultSizeTypes?: string[] | undefined;
3450
3465
  cacheGroups?: Record<string, false | {
3451
3466
  type?: string | RegExp | undefined;
3467
+ layer?: string | RegExp | ((args_0: string | undefined) => boolean) | undefined;
3452
3468
  chunks?: RegExp | "initial" | "async" | "all" | ((args_0: Chunk, ...args: unknown[]) => boolean) | undefined;
3453
3469
  name?: string | false | ((args_0: Module, args_1: Chunk[], args_2: string, ...args: unknown[]) => string | undefined) | undefined;
3454
3470
  filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args: unknown[]) => string) | undefined;
@@ -3714,8 +3730,9 @@ export declare const rspackOptions: z.ZodObject<{
3714
3730
  readableAll?: boolean | undefined;
3715
3731
  writableAll?: boolean | undefined;
3716
3732
  ipv6Only?: boolean | undefined;
3717
- } | undefined;
3733
+ } | ((args_0: any, ...args: unknown[]) => void) | undefined;
3718
3734
  protocol?: "http" | "https" | undefined;
3735
+ server?: Record<string, any> | ((...args: unknown[]) => any) | undefined;
3719
3736
  } | undefined;
3720
3737
  } | undefined;
3721
3738
  asyncWebAssembly?: boolean | undefined;
@@ -3754,11 +3771,9 @@ export declare const rspackOptions: z.ZodObject<{
3754
3771
  stats?: boolean | "none" | "verbose" | "normal" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary" | {
3755
3772
  modules?: boolean | undefined;
3756
3773
  chunks?: boolean | undefined;
3757
- ids?: boolean | undefined;
3758
- runtime?: boolean | undefined;
3759
- hash?: boolean | undefined;
3760
3774
  all?: boolean | undefined;
3761
3775
  version?: boolean | undefined;
3776
+ runtime?: boolean | undefined;
3762
3777
  publicPath?: boolean | undefined;
3763
3778
  preset?: boolean | "none" | "verbose" | "normal" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary" | undefined;
3764
3779
  assets?: boolean | undefined;
@@ -3769,10 +3784,12 @@ export declare const rspackOptions: z.ZodObject<{
3769
3784
  errors?: boolean | undefined;
3770
3785
  errorsCount?: boolean | undefined;
3771
3786
  colors?: boolean | undefined;
3787
+ hash?: boolean | undefined;
3772
3788
  reasons?: boolean | undefined;
3773
3789
  outputPath?: boolean | undefined;
3774
3790
  chunkModules?: boolean | undefined;
3775
3791
  chunkRelations?: boolean | undefined;
3792
+ ids?: boolean | undefined;
3776
3793
  timings?: boolean | undefined;
3777
3794
  builtAt?: boolean | undefined;
3778
3795
  moduleAssets?: boolean | undefined;
@@ -4054,6 +4071,7 @@ export declare const rspackOptions: z.ZodObject<{
4054
4071
  defaultSizeTypes?: string[] | undefined;
4055
4072
  cacheGroups?: Record<string, false | {
4056
4073
  type?: string | RegExp | undefined;
4074
+ layer?: string | RegExp | ((args_0: string | undefined) => boolean) | undefined;
4057
4075
  chunks?: RegExp | "initial" | "async" | "all" | ((args_0: Chunk, ...args: unknown[]) => boolean) | undefined;
4058
4076
  name?: string | false | ((args_0: Module, args_1: Chunk[], args_2: string, ...args: unknown[]) => string | undefined) | undefined;
4059
4077
  filename?: string | ((args_0: PathData, args_1: JsAssetInfo | undefined, ...args: unknown[]) => string) | undefined;
package/dist/exports.d.ts CHANGED
@@ -10,7 +10,7 @@ import { RspackOptionsApply } from "./rspackOptionsApply";
10
10
  export { RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply };
11
11
  export type { Chunk } from "./Chunk";
12
12
  export type { ChunkGroup } from "./ChunkGroup";
13
- export type { Module, ResolveData } from "./Module";
13
+ export type { Module, ResolveData, ResourceDataWithData } from "./Module";
14
14
  export { MultiStats } from "./MultiStats";
15
15
  export { NormalModule } from "./NormalModule";
16
16
  export type { NormalModuleFactory } from "./NormalModuleFactory";
@@ -58,6 +58,7 @@ export { ExternalsPlugin } from "./builtin-plugin";
58
58
  export { HotModuleReplacementPlugin } from "./builtin-plugin";
59
59
  export { NoEmitOnErrorsPlugin } from "./builtin-plugin";
60
60
  export { WarnCaseSensitiveModulesPlugin } from "./builtin-plugin";
61
+ export { RuntimePlugin } from "./builtin-plugin";
61
62
  export { DllPlugin, type DllPluginOptions } from "./lib/DllPlugin";
62
63
  export { DllReferencePlugin, type DllReferencePluginOptions, type DllReferencePluginOptionsSourceType, type DllReferencePluginOptionsContent, type DllReferencePluginOptionsManifest } from "./lib/DllReferencePlugin";
63
64
  export { EnvironmentPlugin } from "./lib/EnvironmentPlugin";
@@ -108,6 +109,7 @@ import { LimitChunkCountPlugin } from "./builtin-plugin";
108
109
  import { RuntimeChunkPlugin } from "./builtin-plugin";
109
110
  import { SplitChunksPlugin } from "./builtin-plugin";
110
111
  import { RemoveDuplicateModulesPlugin } from "./builtin-plugin";
112
+ import { RsdoctorPlugin } from "./builtin-plugin";
111
113
  interface Optimize {
112
114
  LimitChunkCountPlugin: typeof LimitChunkCountPlugin;
113
115
  RuntimeChunkPlugin: typeof RuntimeChunkPlugin;
@@ -139,6 +141,7 @@ export declare const sharing: {
139
141
  ConsumeSharedPlugin: typeof ConsumeSharedPlugin;
140
142
  SharePlugin: typeof SharePlugin;
141
143
  };
144
+ export type { RsdoctorPluginData, RsdoctorPluginHooks } from "./builtin-plugin";
142
145
  export type { HtmlRspackPluginOptions } from "./builtin-plugin";
143
146
  export type { SwcJsMinimizerRspackPluginOptions } from "./builtin-plugin";
144
147
  export type { LightningCssMinimizerRspackPluginOptions } from "./builtin-plugin";
@@ -163,5 +166,6 @@ interface Experiments {
163
166
  cleanup: () => Promise<void>;
164
167
  };
165
168
  RemoveDuplicateModulesPlugin: typeof RemoveDuplicateModulesPlugin;
169
+ RsdoctorPlugin: typeof RsdoctorPlugin;
166
170
  }
167
171
  export declare const experiments: Experiments;