@rspack-canary/browser 1.4.12-canary-c9012b88-20250801081627 → 1.4.12-canary-d2f8a578-20250801090118

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.
Files changed (246) hide show
  1. package/dist/BuildInfo.d.ts +17 -0
  2. package/dist/Chunk.d.ts +16 -0
  3. package/dist/ChunkGraph.d.ts +9 -0
  4. package/dist/Chunks.d.ts +12 -0
  5. package/dist/CodeGenerationResults.d.ts +1 -0
  6. package/dist/Compilation.d.ts +420 -0
  7. package/dist/Compiler.d.ts +192 -0
  8. package/dist/ConcatenatedModule.d.ts +1 -0
  9. package/dist/ContextModule.d.ts +1 -0
  10. package/dist/ContextModuleFactory.d.ts +13 -0
  11. package/dist/Diagnostics.d.ts +7 -0
  12. package/dist/Entrypoint.d.ts +2 -0
  13. package/dist/ErrorHelpers.d.ts +3 -0
  14. package/dist/ExecuteModulePlugin.d.ts +4 -0
  15. package/dist/ExportsInfo.d.ts +20 -0
  16. package/dist/ExternalModule.d.ts +1 -0
  17. package/dist/FileSystem.d.ts +54 -0
  18. package/dist/FileSystemInfo.d.ts +5 -0
  19. package/dist/Module.d.ts +53 -0
  20. package/dist/ModuleGraph.d.ts +19 -0
  21. package/dist/ModuleTypeConstants.d.ts +8 -0
  22. package/dist/MultiCompiler.d.ts +78 -0
  23. package/dist/MultiStats.d.ts +22 -0
  24. package/dist/MultiWatching.d.ts +27 -0
  25. package/dist/NativeWatchFileSystem.d.ts +17 -0
  26. package/dist/NormalModule.d.ts +15 -0
  27. package/dist/NormalModuleFactory.d.ts +23 -0
  28. package/dist/Resolver.d.ts +24 -0
  29. package/dist/ResolverFactory.d.ts +14 -0
  30. package/dist/RspackError.d.ts +9 -0
  31. package/dist/RuleSetCompiler.d.ts +9 -0
  32. package/dist/RuntimeGlobals.d.ts +325 -0
  33. package/dist/RuntimeModule.d.ts +32 -0
  34. package/dist/Stats.d.ts +17 -0
  35. package/dist/Template.d.ts +77 -0
  36. package/dist/Watching.d.ts +47 -0
  37. package/dist/browser/buffer.d.ts +1 -0
  38. package/dist/browser/fs.d.ts +12 -0
  39. package/dist/browser/index.d.ts +5 -0
  40. package/dist/browser/service.d.ts +3 -0
  41. package/dist/builtin-loader/index.d.ts +1 -0
  42. package/dist/builtin-loader/lightningcss/index.d.ts +117 -0
  43. package/dist/builtin-loader/swc/collectTypeScriptInfo.d.ts +21 -0
  44. package/dist/builtin-loader/swc/index.d.ts +5 -0
  45. package/dist/builtin-loader/swc/pluginImport.d.ts +33 -0
  46. package/dist/builtin-loader/swc/types.d.ts +83 -0
  47. package/dist/builtin-plugin/APIPlugin.d.ts +9 -0
  48. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +9 -0
  49. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +9 -0
  50. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +9 -0
  51. package/dist/builtin-plugin/BannerPlugin.d.ts +40 -0
  52. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +14 -0
  53. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +9 -0
  54. package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +59 -0
  55. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +9 -0
  56. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +9 -0
  57. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +14 -0
  58. package/dist/builtin-plugin/CssChunkingPlugin.d.ts +21 -0
  59. package/dist/builtin-plugin/CssModulesPlugin.d.ts +9 -0
  60. package/dist/builtin-plugin/DataUriPlugin.d.ts +9 -0
  61. package/dist/builtin-plugin/DefinePlugin.d.ts +16 -0
  62. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +8 -0
  63. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +8 -0
  64. package/dist/builtin-plugin/DllEntryPlugin.d.ts +12 -0
  65. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +11 -0
  66. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +12 -0
  67. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +9 -0
  68. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +25 -0
  69. package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +11 -0
  70. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +9 -0
  71. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +9 -0
  72. package/dist/builtin-plugin/EntryPlugin.d.ts +32 -0
  73. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +11 -0
  74. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +10 -0
  75. package/dist/builtin-plugin/ExternalsPlugin.d.ts +11 -0
  76. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +9 -0
  77. package/dist/builtin-plugin/FileUriPlugin.d.ts +9 -0
  78. package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +9 -0
  79. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +9 -0
  80. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +10 -0
  81. package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +7 -0
  82. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +9 -0
  83. package/dist/builtin-plugin/HttpUriPlugin.d.ts +36 -0
  84. package/dist/builtin-plugin/IgnorePlugin.d.ts +19 -0
  85. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +9 -0
  86. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +15 -0
  87. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +10 -0
  88. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +9 -0
  89. package/dist/builtin-plugin/LibManifestPlugin.d.ts +17 -0
  90. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +32 -0
  91. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +14 -0
  92. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +10 -0
  93. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +9 -0
  94. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +9 -0
  95. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +8 -0
  96. package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +9 -0
  97. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +9 -0
  98. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +9 -0
  99. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +8 -0
  100. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +8 -0
  101. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +9 -0
  102. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +9 -0
  103. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +10 -0
  104. package/dist/builtin-plugin/ProgressPlugin.d.ts +11 -0
  105. package/dist/builtin-plugin/ProvidePlugin.d.ts +10 -0
  106. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +9 -0
  107. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +9 -0
  108. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +9 -0
  109. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +49 -0
  110. package/dist/builtin-plugin/RslibPlugin.d.ts +11 -0
  111. package/dist/builtin-plugin/RstestPlugin.d.ts +11 -0
  112. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +11 -0
  113. package/dist/builtin-plugin/RuntimePlugin.d.ts +28 -0
  114. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +9 -0
  115. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +19 -0
  116. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +11 -0
  117. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +11 -0
  118. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +40 -0
  119. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +214 -0
  120. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +9 -0
  121. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +7 -0
  122. package/dist/builtin-plugin/WorkerPlugin.d.ts +13 -0
  123. package/dist/builtin-plugin/base.d.ts +45 -0
  124. package/dist/builtin-plugin/css-extract/index.d.ts +24 -0
  125. package/dist/builtin-plugin/css-extract/loader.d.ts +21 -0
  126. package/dist/builtin-plugin/css-extract/utils.d.ts +6 -0
  127. package/dist/builtin-plugin/html-plugin/hooks.d.ts +32 -0
  128. package/dist/builtin-plugin/html-plugin/index.d.ts +2 -0
  129. package/dist/builtin-plugin/html-plugin/options.d.ts +83 -0
  130. package/dist/builtin-plugin/html-plugin/plugin.d.ts +24 -0
  131. package/dist/builtin-plugin/html-plugin/taps.d.ts +2 -0
  132. package/dist/builtin-plugin/index.d.ts +80 -0
  133. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +24 -0
  134. package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +4 -0
  135. package/dist/config/adapter.d.ts +8 -0
  136. package/dist/config/adapterRuleUse.d.ts +333 -0
  137. package/dist/config/browserslistTargetHandler.d.ts +15 -0
  138. package/dist/config/defaults.d.ts +13 -0
  139. package/dist/config/devServer.d.ts +207 -0
  140. package/dist/config/index.d.ts +4 -0
  141. package/dist/config/normalization.d.ts +154 -0
  142. package/dist/config/target.d.ts +89 -0
  143. package/dist/config/types.d.ts +2282 -0
  144. package/dist/container/ContainerPlugin.d.ts +40 -0
  145. package/dist/container/ContainerReferencePlugin.d.ts +33 -0
  146. package/dist/container/ModuleFederationPlugin.d.ts +13 -0
  147. package/dist/container/ModuleFederationPluginV1.d.ts +22 -0
  148. package/dist/container/ModuleFederationRuntimePlugin.d.ts +12 -0
  149. package/dist/container/index.d.ts +4 -0
  150. package/dist/container/options.d.ts +3 -0
  151. package/dist/error/ConcurrentCompilationError.d.ts +14 -0
  152. package/dist/exports.d.ts +166 -0
  153. package/dist/index.d.ts +10 -0
  154. package/dist/index.mjs +57013 -0
  155. package/dist/index.mjs.LICENSE.txt +10 -0
  156. package/dist/lib/AbstractMethodError.d.ts +23 -0
  157. package/dist/lib/Cache.d.ts +65 -0
  158. package/dist/lib/CacheFacade.d.ts +139 -0
  159. package/dist/lib/DllPlugin.d.ts +42 -0
  160. package/dist/lib/DllReferencePlugin.d.ts +119 -0
  161. package/dist/lib/EntryOptionPlugin.d.ts +33 -0
  162. package/dist/lib/EnvironmentPlugin.d.ts +22 -0
  163. package/dist/lib/HookWebpackError.d.ts +40 -0
  164. package/dist/lib/IgnoreWarningsPlugin.d.ts +25 -0
  165. package/dist/lib/LoaderOptionsPlugin.d.ts +28 -0
  166. package/dist/lib/LoaderTargetPlugin.d.ts +24 -0
  167. package/dist/lib/ModuleFilenameHelpers.d.ts +53 -0
  168. package/dist/lib/NormalModuleReplacementPlugin.d.ts +29 -0
  169. package/dist/lib/WebpackError.d.ts +21 -0
  170. package/dist/lib/cache/MemoryCachePlugin.d.ts +5 -0
  171. package/dist/lib/cache/getLazyHashedEtag.d.ts +35 -0
  172. package/dist/lib/cache/mergeEtags.d.ts +17 -0
  173. package/dist/loader-runner/LoaderLoadingError.d.ts +13 -0
  174. package/dist/loader-runner/ModuleError.d.ts +7 -0
  175. package/dist/loader-runner/ModuleWarning.d.ts +7 -0
  176. package/dist/loader-runner/index.d.ts +34 -0
  177. package/dist/loader-runner/loadLoader.d.ts +12 -0
  178. package/dist/loader-runner/service.d.ts +71 -0
  179. package/dist/loader-runner/utils.d.ts +7 -0
  180. package/dist/loader-runner/worker.d.ts +14 -0
  181. package/dist/logging/Logger.d.ts +61 -0
  182. package/dist/logging/createConsoleLogger.d.ts +35 -0
  183. package/dist/logging/truncateArgs.d.ts +16 -0
  184. package/dist/node/NodeEnvironmentPlugin.d.ts +10 -0
  185. package/dist/node/NodeTemplatePlugin.d.ts +18 -0
  186. package/dist/node/NodeWatchFileSystem.d.ts +18 -0
  187. package/dist/node/nodeConsole.d.ts +15 -0
  188. package/dist/rspack.d.ts +16 -0
  189. package/dist/rspack.wasi-browser.js +101 -0
  190. package/dist/rspackOptionsApply.d.ts +4 -0
  191. package/dist/runtime/cssExtractHmr.d.ts +4 -0
  192. package/dist/runtime/moduleFederationDefaultRuntime.d.ts +2 -0
  193. package/dist/schema/config.d.ts +995 -0
  194. package/dist/schema/loaders.d.ts +399 -0
  195. package/dist/schema/plugins.d.ts +166 -0
  196. package/dist/schema/utils.d.ts +3 -0
  197. package/dist/schema/validate.d.ts +9 -0
  198. package/dist/sharing/ConsumeSharedPlugin.d.ts +41 -0
  199. package/dist/sharing/ProvideSharedPlugin.d.ts +34 -0
  200. package/dist/sharing/SharePlugin.d.ts +51 -0
  201. package/dist/sharing/ShareRuntimePlugin.d.ts +9 -0
  202. package/dist/sharing/utils.d.ts +1 -0
  203. package/dist/stats/DefaultStatsFactoryPlugin.d.ts +4 -0
  204. package/dist/stats/DefaultStatsPresetPlugin.d.ts +4 -0
  205. package/dist/stats/DefaultStatsPrinterPlugin.d.ts +13 -0
  206. package/dist/stats/StatsFactory.d.ts +57 -0
  207. package/dist/stats/StatsPrinter.d.ts +57 -0
  208. package/dist/stats/statsFactoryUtils.d.ts +325 -0
  209. package/dist/swc.d.ts +7 -0
  210. package/dist/taps/compilation.d.ts +8 -0
  211. package/dist/taps/compiler.d.ts +2 -0
  212. package/dist/taps/contextModuleFactory.d.ts +2 -0
  213. package/dist/taps/index.d.ts +6 -0
  214. package/dist/taps/javascriptModules.d.ts +2 -0
  215. package/dist/taps/normalModuleFactory.d.ts +2 -0
  216. package/dist/taps/types.d.ts +11 -0
  217. package/dist/trace/index.d.ts +46 -0
  218. package/dist/trace/traceHookPlugin.d.ts +5 -0
  219. package/dist/util/ArrayQueue.d.ts +45 -0
  220. package/dist/util/AsyncTask.d.ts +7 -0
  221. package/dist/util/MergeCaller.d.ts +10 -0
  222. package/dist/util/SizeFormatHelpers.d.ts +10 -0
  223. package/dist/util/SplitChunkSize.d.ts +5 -0
  224. package/dist/util/assertNotNil.d.ts +1 -0
  225. package/dist/util/assetCondition.d.ts +2 -0
  226. package/dist/util/asyncLib.d.ts +54 -0
  227. package/dist/util/bindingVersionCheck.d.ts +5 -0
  228. package/dist/util/cleverMerge.d.ts +24 -0
  229. package/dist/util/comparators.d.ts +16 -0
  230. package/dist/util/createHash.d.ts +16 -0
  231. package/dist/util/createReadonlyMap.d.ts +1 -0
  232. package/dist/util/fake.d.ts +9 -0
  233. package/dist/util/fs.d.ts +352 -0
  234. package/dist/util/hash/index.d.ts +26 -0
  235. package/dist/util/hash/md4.d.ts +11 -0
  236. package/dist/util/hash/wasm-hash.d.ts +51 -0
  237. package/dist/util/hash/xxhash64.d.ts +11 -0
  238. package/dist/util/identifier.d.ts +31 -0
  239. package/dist/util/index.d.ts +11 -0
  240. package/dist/util/memoize.d.ts +2 -0
  241. package/dist/util/require.d.ts +3 -0
  242. package/dist/util/runtime.d.ts +2 -0
  243. package/dist/util/smartGrouping.d.ts +21 -0
  244. package/dist/util/source.d.ts +7 -0
  245. package/dist/wasi-worker-browser.mjs +34 -0
  246. package/package.json +3 -3
@@ -0,0 +1,2282 @@
1
+ import type { AssetInfo, RawFuncUseCtx } from "@rspack/binding";
2
+ import type { HttpUriPluginOptions } from "../builtin-plugin/HttpUriPlugin";
3
+ import type { ChunkGraph } from "../ChunkGraph";
4
+ import type { Compilation, PathData } from "../Compilation";
5
+ import type { Compiler } from "../Compiler";
6
+ import type { Chunk } from "../exports";
7
+ import type WebpackError from "../lib/WebpackError";
8
+ import type { Module } from "../Module";
9
+ import type ModuleGraph from "../ModuleGraph";
10
+ import type { ResolveCallback } from "./adapterRuleUse";
11
+ import type { DevServerOptions } from "./devServer";
12
+ export type FilenameTemplate = string;
13
+ export type Filename = FilenameTemplate | ((pathData: PathData, assetInfo?: AssetInfo) => string);
14
+ /** Name of the configuration. Used when loading multiple configurations. */
15
+ export type Name = string;
16
+ /** A list of name defining all sibling configurations it depends on. Dependent configurations need to be compiled first. */
17
+ export type Dependencies = Name[];
18
+ /**
19
+ * The context configuration is used to set the base directory for Rspack builds.
20
+ * @default process.cwd()
21
+ * */
22
+ export type Context = string;
23
+ /**
24
+ * The mode configuration is used to set the build mode of Rspack to enable the default optimization strategy.
25
+ * @default 'production'
26
+ * */
27
+ export type Mode = "development" | "production" | "none";
28
+ export type Falsy = false | "" | 0 | null | undefined;
29
+ /** The publicPath of the resource referenced by this entry. */
30
+ export type PublicPath = "auto" | Filename;
31
+ /** The baseURI of the resource referenced by this entry. */
32
+ export type BaseUri = string;
33
+ /** How this entry load other chunks. */
34
+ export type ChunkLoadingType = string | "jsonp" | "import-scripts" | "require" | "async-node" | "import";
35
+ /** How this entry load other chunks. */
36
+ export type ChunkLoading = false | ChunkLoadingType;
37
+ /** Whether to create a load-on-demand asynchronous chunk for entry. */
38
+ export type AsyncChunks = boolean;
39
+ /** Option to set the method of loading WebAssembly Modules. */
40
+ export type WasmLoadingType = string | "fetch-streaming" | "fetch" | "async-node";
41
+ /** Option to set the method of loading WebAssembly Modules. */
42
+ export type WasmLoading = false | WasmLoadingType;
43
+ export type ScriptType = false | "text/javascript" | "module";
44
+ export type LibraryCustomUmdObject = {
45
+ amd?: string;
46
+ commonjs?: string;
47
+ root?: string | string[];
48
+ };
49
+ /** Specify a name for the library. */
50
+ export type LibraryName = string | string[] | LibraryCustomUmdObject;
51
+ export type LibraryCustomUmdCommentObject = {
52
+ amd?: string;
53
+ commonjs?: string;
54
+ commonjs2?: string;
55
+ root?: string;
56
+ };
57
+ /** Use a container(defined in global space) for calling define/require functions in an AMD module. */
58
+ export type AmdContainer = string;
59
+ /** Add a comment in the UMD wrapper. */
60
+ export type AuxiliaryComment = string | LibraryCustomUmdCommentObject;
61
+ /** Specify which export should be exposed as a library. */
62
+ export type LibraryExport = string | string[];
63
+ /** 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";
65
+ /** When using output.library.type: "umd", setting output.library.umdNamedDefine to true will name the AMD module of the UMD build. */
66
+ export type UmdNamedDefine = boolean;
67
+ /** Options for library. */
68
+ export type LibraryOptions = {
69
+ /** Use a container(defined in global space) for calling define/require functions in an AMD module. */
70
+ amdContainer?: AmdContainer;
71
+ /** Add a comment in the UMD wrapper. */
72
+ auxiliaryComment?: AuxiliaryComment;
73
+ /** Specify which export should be exposed as a library. */
74
+ export?: LibraryExport;
75
+ /** Specify a name for the library. */
76
+ name?: LibraryName;
77
+ /** Configure how the library will be exposed. */
78
+ type: LibraryType;
79
+ /**
80
+ * When using output.library.type: "umd", setting output.library.umdNamedDefine to true will name the AMD module of the UMD build.
81
+ * Otherwise, an anonymous define is used.
82
+ * */
83
+ umdNamedDefine?: UmdNamedDefine;
84
+ };
85
+ /** Options for library. */
86
+ export type Library = LibraryName | LibraryOptions | undefined;
87
+ /** The layer of this entry. */
88
+ export type Layer = string | null;
89
+ /** The filename of the entry chunk. */
90
+ export type EntryFilename = Filename;
91
+ /** The name of the runtime chunk. */
92
+ export type EntryRuntime = false | string;
93
+ /** The path to the entry module. */
94
+ export type EntryItem = string | string[];
95
+ /** The entry that the current entry depends on. With dependOn option you can share the modules from one entry chunk to another. */
96
+ export type EntryDependOn = string | string[];
97
+ /**
98
+ * An object with entry point description.
99
+ */
100
+ export type EntryDescription = {
101
+ /**
102
+ * The path to the entry module.
103
+ * @default './src/index.js'
104
+ * @example ['./src/index.js', './src/foo.js']
105
+ * */
106
+ import: EntryItem;
107
+ /**
108
+ * The name of the runtime chunk.
109
+ * When runtime is set, a new runtime chunk will be created.
110
+ * You can also set it to false to avoid a new runtime chunk.
111
+ * */
112
+ runtime?: EntryRuntime;
113
+ /** The publicPath of the resource referenced by this entry. */
114
+ publicPath?: PublicPath;
115
+ /** The baseURI of the resource referenced by this entry. */
116
+ baseUri?: BaseUri;
117
+ /** How this entry load other chunks. */
118
+ chunkLoading?: ChunkLoading;
119
+ /** Whether to create a load-on-demand asynchronous chunk for this entry. */
120
+ asyncChunks?: AsyncChunks;
121
+ /** Option to set the method of loading WebAssembly Modules. */
122
+ wasmLoading?: WasmLoading;
123
+ /** The filename of the entry chunk. */
124
+ filename?: EntryFilename;
125
+ /**
126
+ * The format of the chunk generated by this entry as a library.
127
+ * For detailed configuration, see `output.library`.
128
+ */
129
+ library?: LibraryOptions;
130
+ /**
131
+ * The entry that the current entry depends on. With `dependOn` option
132
+ * you can share the modules from one entry chunk to another.
133
+ */
134
+ dependOn?: EntryDependOn;
135
+ /**
136
+ * Specifies the layer in which modules of this entrypoint are placed.
137
+ * Make the corresponding configuration take effect through layer matching
138
+ * in split chunks, rules, stats, and externals.
139
+ */
140
+ layer?: Layer;
141
+ };
142
+ export type EntryUnnamed = EntryItem;
143
+ export type EntryObject = Record<string, EntryItem | EntryDescription>;
144
+ /** A static entry. */
145
+ export type EntryStatic = EntryObject | EntryUnnamed;
146
+ /** A Function returning entry options. */
147
+ export type EntryDynamic = () => EntryStatic | Promise<EntryStatic>;
148
+ /** The entry options for building */
149
+ export type Entry = EntryStatic | EntryDynamic;
150
+ /** The output directory as an absolute path. */
151
+ export type Path = string;
152
+ /** Tells Rspack to include comments in bundles with information about the contained modules. */
153
+ export type Pathinfo = boolean | "verbose";
154
+ /** Before generating the products, delete all files in the output directory. */
155
+ export type AssetModuleFilename = Filename;
156
+ /** Specifies the filename of WebAssembly modules. */
157
+ export type WebassemblyModuleFilename = string;
158
+ /** This option determines the name of non-initial chunk files. */
159
+ export type ChunkFilename = Filename;
160
+ /** Allows you to set the [crossorigin attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) */
161
+ export type CrossOriginLoading = false | "anonymous" | "use-credentials";
162
+ /** This option determines the name of CSS output files on disk. */
163
+ export type CssFilename = Filename;
164
+ /** This option determines the name of non-initial CSS output files on disk. */
165
+ export type CssChunkFilename = Filename;
166
+ /** Customize the filenames of hot update chunks. */
167
+ export type HotUpdateChunkFilename = FilenameTemplate;
168
+ /** Customize the main hot update filename. */
169
+ export type HotUpdateMainFilename = FilenameTemplate;
170
+ /** Which uses JSONP for loading hot updates. */
171
+ export type HotUpdateGlobal = string;
172
+ /** A unique name of the Rspack build */
173
+ export type UniqueName = string;
174
+ /** The global variable is used by Rspack for loading chunks. */
175
+ export type ChunkLoadingGlobal = string;
176
+ /** List of library types enabled for use by entry points. */
177
+ export type EnabledLibraryTypes = string[];
178
+ /** Whether delete all files in the output directory. */
179
+ export type Clean = boolean | {
180
+ keep?: string | RegExp | ((path: string) => boolean);
181
+ };
182
+ /** Output JavaScript files as module type. */
183
+ export type OutputModule = boolean;
184
+ /** Tell Rspack to remove a module from the module instance cache (require.cache) if it throws an exception when it is required. */
185
+ export type StrictModuleExceptionHandling = boolean;
186
+ /** Handle error in module loading as per EcmaScript Modules spec at a performance cost. */
187
+ export type StrictModuleErrorHandling = boolean;
188
+ /** Indicates what global object will be used to mount the library. */
189
+ export type GlobalObject = string;
190
+ /** List of wasm loading types enabled for use by entry points. */
191
+ export type EnabledWasmLoadingTypes = string[];
192
+ /** The name of the native import() function. */
193
+ export type ImportFunctionName = string;
194
+ /** The name of the native import.meta object. */
195
+ export type ImportMetaName = string;
196
+ /** Tells Rspack to add IIFE wrapper around emitted code. */
197
+ export type Iife = boolean;
198
+ /** List of chunk loading types enabled for use by entry points. */
199
+ export type EnabledChunkLoadingTypes = string[];
200
+ /** The format of chunks */
201
+ export type ChunkFormat = string | false;
202
+ /** Set a public path for Worker. */
203
+ export type WorkerPublicPath = string;
204
+ /** Controls [Trusted Types](https://web.dev/articles/trusted-types) compatibility. */
205
+ export type TrustedTypes = {
206
+ /**
207
+ * The name of the Trusted Types policy created by webpack to serve bundle chunks.
208
+ */
209
+ policyName?: string;
210
+ /**
211
+ * If the call to `trustedTypes.createPolicy(...)` fails -- e.g., due to the policy name missing from the CSP `trusted-types` list, or it being a duplicate name, etc. -- controls whether to continue with loading in the hope that `require-trusted-types-for 'script'` isn't enforced yet, versus fail immediately. Default behavior is 'stop'.
212
+ */
213
+ onPolicyCreationFailure?: "continue" | "stop";
214
+ };
215
+ /** The encoding to use when generating the hash. */
216
+ export type HashDigest = string;
217
+ /** The prefix length of the hash digest to use. */
218
+ export type HashDigestLength = number;
219
+ /** The hashing algorithm to use. */
220
+ export type HashFunction = "md4" | "xxhash64" | "sha256";
221
+ /** An optional salt to update the hash. */
222
+ export type HashSalt = string;
223
+ /** Configure how source maps are named. */
224
+ export type SourceMapFilename = string;
225
+ /** This option determines the module's namespace */
226
+ export type DevtoolNamespace = string;
227
+ /** This option is only used when devtool uses an option that requires module names. */
228
+ export type DevtoolModuleFilenameTemplate = string | ((info: any) => any);
229
+ /** A fallback is used when the template string or function above yields duplicates. */
230
+ export type DevtoolFallbackModuleFilenameTemplate = DevtoolModuleFilenameTemplate;
231
+ /** Tell Rspack what kind of ES-features may be used in the generated runtime-code. */
232
+ export type Environment = {
233
+ /** The environment supports arrow functions ('() => { ... }'). */
234
+ arrowFunction?: boolean;
235
+ /** The environment supports async function and await ('async function () { await ... }'). */
236
+ asyncFunction?: boolean;
237
+ /** The environment supports BigInt as literal (123n). */
238
+ bigIntLiteral?: boolean;
239
+ /** The environment supports const and let for variable declarations. */
240
+ const?: boolean;
241
+ /** The environment supports destructuring ('{ a, b } = obj'). */
242
+ destructuring?: boolean;
243
+ /** The environment supports 'document' variable. */
244
+ document?: boolean;
245
+ /** The environment supports an async import() function to import EcmaScript modules. */
246
+ dynamicImport?: boolean;
247
+ /** The environment supports an async import() when creating a worker, only for web targets at the moment. */
248
+ dynamicImportInWorker?: boolean;
249
+ /** The environment supports 'for of' iteration ('for (const x of array) { ... }'). */
250
+ forOf?: boolean;
251
+ /** The environment supports 'globalThis'. */
252
+ globalThis?: boolean;
253
+ /** The environment supports ECMAScript Module syntax to import ECMAScript modules (import ... from '...'). */
254
+ module?: boolean;
255
+ /**
256
+ * Determines if the node: prefix is generated for core module imports in environments that support it.
257
+ * This is only applicable to Webpack runtime code.
258
+ * */
259
+ nodePrefixForCoreModules?: boolean;
260
+ /** The environment supports optional chaining ('obj?.a' or 'obj?.()'). */
261
+ optionalChaining?: boolean;
262
+ /** The environment supports template literals. */
263
+ templateLiteral?: boolean;
264
+ };
265
+ export type Output = {
266
+ /**
267
+ * The output directory as an absolute path.
268
+ * @default path.resolve(process.cwd(), 'dist')
269
+ * */
270
+ path?: Path;
271
+ /**
272
+ * Tells Rspack to include comments in bundles with information about the contained modules.
273
+ * @default true
274
+ */
275
+ pathinfo?: Pathinfo;
276
+ /**
277
+ * Before generating the products, whether delete all files in the output directory.
278
+ * @default false
279
+ * */
280
+ clean?: Clean;
281
+ /** This option determines the URL prefix of the referenced resource, such as: image, file, etc. */
282
+ publicPath?: PublicPath;
283
+ /** This option determines the name of each output bundle. */
284
+ filename?: Filename;
285
+ /** This option determines the name of non-initial chunk files. */
286
+ chunkFilename?: ChunkFilename;
287
+ /** Allows you to set the [crossorigin attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for dynamically loaded chunks. */
288
+ crossOriginLoading?: CrossOriginLoading;
289
+ /** This option determines the name of CSS output files on disk. */
290
+ cssFilename?: CssFilename;
291
+ /**
292
+ * @deprecated this config is unused, and will be removed in the future.
293
+ * Rspack adds some metadata in CSS to parse CSS modules, and this configuration determines whether to compress these metadata.
294
+ *
295
+ * The value is `true` in production mode.
296
+ * The value is `false` in development mode.
297
+ * */
298
+ cssHeadDataCompression?: boolean;
299
+ /** This option determines the name of non-initial CSS output files on disk. */
300
+ cssChunkFilename?: CssChunkFilename;
301
+ /**
302
+ * Customize the main hot update filename. [fullhash] and [runtime] are available as placeholder.
303
+ * @default '[runtime].[fullhash].hot-update.json'
304
+ * */
305
+ hotUpdateMainFilename?: HotUpdateMainFilename;
306
+ /**
307
+ * Customize the filenames of hot update chunks.
308
+ * @default '[id].[fullhash].hot-update.js'
309
+ * */
310
+ hotUpdateChunkFilename?: HotUpdateChunkFilename;
311
+ /**
312
+ * Only used when target is set to 'web', which uses JSONP for loading hot updates.
313
+ * @default 'webpackHotUpdate' + output.uniqueName
314
+ * */
315
+ hotUpdateGlobal?: HotUpdateGlobal;
316
+ /**
317
+ * This option determines the name of each asset modules.
318
+ * @default '[hash][ext][query]'
319
+ * */
320
+ assetModuleFilename?: AssetModuleFilename;
321
+ /** A unique name of the Rspack build to avoid multiple Rspack runtimes to conflict when using globals. */
322
+ uniqueName?: UniqueName;
323
+ /**
324
+ * The global variable is used by Rspack for loading chunks.
325
+ * Determined by output.uniqueName default.
326
+ * */
327
+ chunkLoadingGlobal?: ChunkLoadingGlobal;
328
+ /**
329
+ * List of library types enabled for use by entry points.
330
+ * Determined by output.library and Entry default.
331
+ * */
332
+ enabledLibraryTypes?: EnabledLibraryTypes;
333
+ /** Output a library exposing the exports of your entry point. */
334
+ library?: Library;
335
+ /**
336
+ * Specify which export should be exposed as a library.
337
+ * @deprecated We might drop support for this, so prefer to use output.library.export
338
+ * */
339
+ libraryExport?: LibraryExport;
340
+ /**
341
+ * Configure how the library will be exposed.
342
+ * @deprecated Use output.library.type instead as we might drop support for output.libraryTarget in the future.
343
+ * */
344
+ libraryTarget?: LibraryType;
345
+ /**
346
+ * When using output.library.type: "umd", setting output.umdNamedDefine to true will name the AMD module of the UMD build.
347
+ * @deprecated Use output.library.umdNamedDefine instead.
348
+ */
349
+ umdNamedDefine?: UmdNamedDefine;
350
+ /**
351
+ * Add a comment in the UMD wrapper.
352
+ * @deprecated use output.library.auxiliaryComment instead.
353
+ * */
354
+ auxiliaryComment?: AuxiliaryComment;
355
+ /**
356
+ * Output JavaScript files as module type.
357
+ * Disabled by default as it's an experimental feature. To use it, you must set experiments.outputModule to true.
358
+ * @default false
359
+ */
360
+ module?: OutputModule;
361
+ /** Tell Rspack to remove a module from the module instance cache (require.cache) if it throws an exception when it is required. */
362
+ strictModuleExceptionHandling?: StrictModuleExceptionHandling;
363
+ /**
364
+ * Handle error in module loading as per EcmaScript Modules spec at a performance cost.
365
+ * @default false
366
+ * */
367
+ strictModuleErrorHandling?: StrictModuleErrorHandling;
368
+ /**
369
+ * When targeting a library, especially when library.type is 'umd', this option indicates what global object will be used to mount the library.
370
+ * @default 'self'
371
+ */
372
+ globalObject?: GlobalObject;
373
+ /**
374
+ * The name of the native import() function.
375
+ * @default 'import'
376
+ * */
377
+ importFunctionName?: ImportFunctionName;
378
+ /**
379
+ * The name of the native import.meta object (can be exchanged for a polyfill).
380
+ * @default 'import.meta'
381
+ */
382
+ importMetaName?: ImportMetaName;
383
+ /**
384
+ * Tells Rspack to add IIFE wrapper around emitted code.
385
+ * @default true
386
+ */
387
+ iife?: Iife;
388
+ /**
389
+ * Option to set the method of loading WebAssembly Modules.
390
+ * @default 'fetch'
391
+ * */
392
+ wasmLoading?: WasmLoading;
393
+ /** List of wasm loading types enabled for use by entry points. */
394
+ enabledWasmLoadingTypes?: EnabledWasmLoadingTypes;
395
+ /**
396
+ * Specifies the filename of WebAssembly modules.
397
+ * @default '[hash].module.wasm'
398
+ * */
399
+ webassemblyModuleFilename?: WebassemblyModuleFilename;
400
+ /** The format of chunks (formats included by default are 'array-push' (web/webworker), 'commonjs' (node.js), 'module' (ESM). */
401
+ chunkFormat?: ChunkFormat;
402
+ /** The method to load chunks (methods included by default are 'jsonp' (web), 'import' (ESM), 'importScripts' (webworker), 'require' (sync node.js), 'async-node' (async node.js) */
403
+ chunkLoading?: ChunkLoading;
404
+ /** List of chunk loading types enabled for use by entry points. */
405
+ enabledChunkLoadingTypes?: EnabledChunkLoadingTypes;
406
+ /** Controls [Trusted Types](https://web.dev/articles/trusted-types) compatibility. */
407
+ trustedTypes?: true | string | TrustedTypes;
408
+ /**
409
+ * Configure how source maps are named.
410
+ * Only takes effect when devtool is set to 'source-map', which writes an output file.
411
+ * @default '[file].map[query]'
412
+ * */
413
+ sourceMapFilename?: SourceMapFilename;
414
+ /** The encoding to use when generating the hash. */
415
+ hashDigest?: HashDigest;
416
+ /**
417
+ * The prefix length of the hash digest to use.
418
+ * @default 16
419
+ * */
420
+ hashDigestLength?: HashDigestLength;
421
+ /**
422
+ * The hashing algorithm to use.
423
+ * @default 'xxhash64'
424
+ * */
425
+ hashFunction?: HashFunction;
426
+ /** An optional salt to update the hash. */
427
+ hashSalt?: HashSalt;
428
+ /**
429
+ * Create async chunks that are loaded on demand.
430
+ * @default true
431
+ * */
432
+ asyncChunks?: AsyncChunks;
433
+ /**
434
+ * The new option workerChunkLoading controls the chunk loading of workers.
435
+ * @default false
436
+ * */
437
+ workerChunkLoading?: ChunkLoading;
438
+ /**
439
+ * Option to set the method of loading WebAssembly Modules in workers, defaults to the value of output.wasmLoading.
440
+ * @default false
441
+ * */
442
+ workerWasmLoading?: WasmLoading;
443
+ /** Set a public path for Worker, defaults to value of output.publicPath. */
444
+ workerPublicPath?: WorkerPublicPath;
445
+ /**
446
+ * This option allows loading asynchronous chunks with a custom script type.
447
+ * @default false
448
+ * */
449
+ scriptType?: ScriptType;
450
+ /** This option determines the module's namespace used with the output.devtoolModuleFilenameTemplate */
451
+ devtoolNamespace?: DevtoolNamespace;
452
+ /** This option is only used when devtool uses an option that requires module names. */
453
+ devtoolModuleFilenameTemplate?: DevtoolModuleFilenameTemplate;
454
+ /** A fallback is used when the template string or function above yields duplicates. */
455
+ devtoolFallbackModuleFilenameTemplate?: DevtoolFallbackModuleFilenameTemplate;
456
+ /**
457
+ * The Number of milliseconds before chunk request timed out.
458
+ * @default 120000
459
+ * */
460
+ chunkLoadTimeout?: number;
461
+ /**
462
+ * Add charset="utf-8" to the HTML <script> tag.
463
+ * @default true
464
+ * */
465
+ charset?: boolean;
466
+ /** Tell Rspack what kind of ES-features may be used in the generated runtime-code. */
467
+ environment?: Environment;
468
+ /**
469
+ * Check if to be emitted file already exists and have the same content before writing to output filesystem.
470
+ */
471
+ compareBeforeEmit?: boolean;
472
+ };
473
+ /**
474
+ * Path alias
475
+ * @example
476
+ * ```js
477
+ * {
478
+ * "@": path.resolve(__dirname, './src'),
479
+ * "abc$": path.resolve(__dirname, './node_modules/abc/index.js'),
480
+ * }
481
+ * // - require("@/a") will attempt to resolve <root>/src/a.
482
+ * // - require("abc") will attempt to resolve <root>/src/abc.
483
+ * // - require("abc/file.js") will not match, and it will attempt to resolve node_modules/abc/file.js.
484
+ * ```
485
+ * */
486
+ export type ResolveAlias = {
487
+ [x: string]: string | false | (string | false)[];
488
+ } | false;
489
+ /** The replacement of [tsconfig-paths-webpack-plugin](https://www.npmjs.com/package/tsconfig-paths-webpack-plugin) in Rspack. */
490
+ export type ResolveTsConfig = string | {
491
+ configFile: string;
492
+ references?: string[] | "auto" | undefined;
493
+ };
494
+ /** Used to configure the Rspack module resolution */
495
+ export type ResolveOptions = {
496
+ /** Path alias */
497
+ alias?: ResolveAlias;
498
+ /**
499
+ * Specifies the condition names used to match entry points in the `exports` field of a package.
500
+ * @link https://nodejs.org/api/packages.html#packages_exports
501
+ */
502
+ conditionNames?: string[];
503
+ /**
504
+ * Parse modules in order.
505
+ * @default [".js", ".json", ".wasm"]
506
+ * */
507
+ extensions?: string[];
508
+ /** Redirect module requests when normal resolving fails. */
509
+ fallback?: ResolveAlias;
510
+ /** Try to parse the fields in package.json */
511
+ mainFields?: string[];
512
+ /**
513
+ * The filename suffix when resolving directories, e.g. require('. /dir/') will try to resolve '. /dir/index'.
514
+ * @default ['index']
515
+ */
516
+ mainFiles?: string[];
517
+ /**
518
+ * The name of the directory to use when resolving dependencies.
519
+ * @default ["node_modules"]
520
+ */
521
+ modules?: string[];
522
+ /**
523
+ * When enabled, require('file') will first look for the . /file file in the current directory, not <modules>/file.
524
+ * @default false
525
+ */
526
+ preferRelative?: boolean;
527
+ /**
528
+ * Opt for absolute paths when resolving, in relation to resolve.roots.
529
+ * @default false
530
+ */
531
+ preferAbsolute?: boolean;
532
+ /**
533
+ * Whether to resolve symlinks to their symlinked location.
534
+ * @default true
535
+ */
536
+ symlinks?: boolean;
537
+ /**
538
+ * By default, It changes to true if resolve.extensions contains an empty string;
539
+ * otherwise, this value changes to false.
540
+ */
541
+ enforceExtension?: boolean;
542
+ /**
543
+ * Customize the imports field in package.json which are used to provide the internal requests of a package (requests starting with # are considered internal).
544
+ * @default ["imports"]
545
+ */
546
+ importsFields?: string[];
547
+ /**
548
+ * The JSON files to use for descriptions.
549
+ * @default ['package.json']
550
+ */
551
+ descriptionFiles?: string[];
552
+ /** The replacement of [tsconfig-paths-webpack-plugin](https://www.npmjs.com/package/tsconfig-paths-webpack-plugin) in Rspack. */
553
+ tsConfig?: ResolveTsConfig;
554
+ /**
555
+ * No longer resolve extensions, no longer resolve mainFiles in package.json (but does not affect requests from mainFiles, browser, alias).
556
+ * @default false
557
+ * */
558
+ fullySpecified?: boolean;
559
+ /**
560
+ * Customize the exports field in package.json.
561
+ * @default ["exports"]
562
+ * */
563
+ exportsFields?: string[];
564
+ /** Define alias for the extension. */
565
+ extensionAlias?: Record<string, string | string[]>;
566
+ /**
567
+ * Define a field, such as browser, that should be parsed in accordance with this [specification](https://github.com/defunctzombie/package-browser-field-spec).
568
+ * @default ['browser']
569
+ * */
570
+ aliasFields?: string[];
571
+ /**
572
+ * A list of resolve restrictions to restrict the paths that a request can be resolved on.
573
+ * @default []
574
+ * */
575
+ restrictions?: string[];
576
+ /**
577
+ * A list of directories where server-relative URLs (beginning with '/') are resolved.
578
+ * It defaults to the context configuration option.
579
+ * On systems other than Windows, these requests are initially resolved as an absolute path.
580
+ * @default []
581
+ */
582
+ roots?: string[];
583
+ /** Customize the Resolve configuration based on the module type. */
584
+ byDependency?: Record<string, ResolveOptions>;
585
+ /** enable Yarn PnP */
586
+ pnp?: boolean;
587
+ };
588
+ /** Used to configure the Rspack module resolution */
589
+ export type Resolve = ResolveOptions;
590
+ export type RuleSetCondition = string | RegExp | ((value: string) => boolean) | RuleSetConditions | RuleSetLogicalConditions;
591
+ export type RuleSetConditions = RuleSetCondition[];
592
+ export type RuleSetLogicalConditions = {
593
+ and?: RuleSetConditions;
594
+ or?: RuleSetConditions;
595
+ not?: RuleSetCondition;
596
+ };
597
+ export type RuleSetLoader = string;
598
+ export type RuleSetLoaderOptions = string | Record<string, any>;
599
+ export type RuleSetLoaderWithOptions = {
600
+ ident?: string;
601
+ loader: RuleSetLoader;
602
+ parallel?: boolean;
603
+ options?: RuleSetLoaderOptions;
604
+ };
605
+ export type RuleSetUseItem = RuleSetLoader | RuleSetLoaderWithOptions;
606
+ export type RuleSetUse = RuleSetUseItem | RuleSetUseItem[] | ((data: RawFuncUseCtx) => RuleSetUseItem[]);
607
+ /** Rule defines the conditions for matching a module and the behavior of handling those modules. */
608
+ export type RuleSetRule = {
609
+ /** Matches all modules that match this resource, and will match against Resource. */
610
+ test?: RuleSetCondition;
611
+ /** Excludes all modules that match this condition and will match against the absolute path of the resource */
612
+ exclude?: RuleSetCondition;
613
+ /** Matches all modules that match this condition against the absolute path of the resource */
614
+ include?: RuleSetCondition;
615
+ /** Matches all modules that match this resource, and will match against Resource */
616
+ issuer?: RuleSetCondition;
617
+ /** Matches all modules that match this resource, and will match against layer of the module that issued the current module. */
618
+ issuerLayer?: RuleSetCondition;
619
+ /** Matches all modules that match this resource, and will match against the category of the dependency that introduced the current module */
620
+ dependency?: RuleSetCondition;
621
+ /** Matches all modules that match this resource, and will match against Resource */
622
+ resource?: RuleSetCondition;
623
+ /** Matches all modules that match this resource against the Resource's fragment. */
624
+ resourceFragment?: RuleSetCondition;
625
+ /** Matches all modules that match this resource against the Resource's query. */
626
+ resourceQuery?: RuleSetCondition;
627
+ /** Matches modules based on [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/MIME_types) instead of file extension. It's primarily useful for data URI module */
628
+ mimetype?: RuleSetCondition;
629
+ /** Matches all modules that match this resource, and will match against the Resource's scheme. */
630
+ scheme?: RuleSetCondition;
631
+ /** Allows you to match values of properties in the description file, typically package.json, to determine which modules a rule should apply to. */
632
+ descriptionData?: Record<string, RuleSetCondition>;
633
+ /** Used in conjunction with [import attributes](https://github.com/tc39/proposal-import-attributes). */
634
+ with?: Record<string, RuleSetCondition>;
635
+ /** Used to mark the type of the matching module, which affects how the module is handled by Rspack's built-in processing. */
636
+ type?: string;
637
+ /** Used to mark the layer of the matching module. */
638
+ layer?: string;
639
+ /** A loader name */
640
+ loader?: RuleSetLoader;
641
+ /** A loader options */
642
+ options?: RuleSetLoaderOptions;
643
+ /** An array to pass the Loader package name and its options. */
644
+ use?: RuleSetUse;
645
+ /**
646
+ * Parser options for the specific modules that matched by the rule conditions
647
+ * It will override the parser options in module.parser.
648
+ * @default {}
649
+ * */
650
+ parser?: Record<string, any>;
651
+ /**
652
+ * Generator options for the specific modules that matched by the rule conditions
653
+ * It will override the parser options in module.generator.
654
+ * @default {}
655
+ */
656
+ generator?: Record<string, any>;
657
+ /** Matches all modules that match this resource, and will match against Resource. */
658
+ resolve?: ResolveOptions;
659
+ /** Flag the module for side effects */
660
+ sideEffects?: boolean;
661
+ /** Specify loader category. */
662
+ enforce?: "pre" | "post";
663
+ /** A kind of Nested Rule, an array of Rules from which only the first matching Rule is used when the parent Rule matches. */
664
+ oneOf?: (RuleSetRule | Falsy)[];
665
+ /** A kind of Nested Rule, an array of Rules that is also used when the parent Rule matches. */
666
+ rules?: (RuleSetRule | Falsy)[];
667
+ };
668
+ /** A list of rules. */
669
+ export type RuleSetRules = ("..." | RuleSetRule | Falsy)[];
670
+ /**
671
+ * Options object for DataUrl condition.
672
+ * */
673
+ export type AssetParserDataUrlOptions = {
674
+ maxSize?: number | undefined;
675
+ };
676
+ /**
677
+ * Options object for DataUrl condition.
678
+ * */
679
+ export type AssetParserDataUrl = AssetParserDataUrlOptions;
680
+ /** Options object for `asset` modules. */
681
+ export type AssetParserOptions = {
682
+ /**
683
+ * It be used only for Asset Module scenarios.
684
+ * @default { maxSize: 8096 }
685
+ * */
686
+ dataUrlCondition?: AssetParserDataUrlOptions;
687
+ };
688
+ export type CssParserNamedExports = boolean;
689
+ export type CssParserUrl = boolean;
690
+ /** Options object for `css` modules. */
691
+ export type CssParserOptions = {
692
+ /**
693
+ * Use ES modules named export for CSS exports.
694
+ * @default true
695
+ * */
696
+ namedExports?: CssParserNamedExports;
697
+ /**
698
+ * Allow to enable/disables handling the CSS functions url.
699
+ * @default true
700
+ * */
701
+ url?: CssParserUrl;
702
+ };
703
+ /** Options object for `css/auto` modules. */
704
+ export type CssAutoParserOptions = {
705
+ /**
706
+ * Use ES modules named export for CSS exports.
707
+ * @default true
708
+ * */
709
+ namedExports?: CssParserNamedExports;
710
+ /**
711
+ * Allow to enable/disables handling the CSS functions url.
712
+ * @default true
713
+ * */
714
+ url?: CssParserUrl;
715
+ };
716
+ /** Options object for `css/module` modules. */
717
+ export type CssModuleParserOptions = {
718
+ /**
719
+ * Use ES modules named export for CSS exports.
720
+ * @default true
721
+ * */
722
+ namedExports?: CssParserNamedExports;
723
+ /**
724
+ * Allow to enable/disables handling the CSS functions url.
725
+ * @default true
726
+ * */
727
+ url?: CssParserUrl;
728
+ };
729
+ type ExportsPresence = "error" | "warn" | "auto" | false;
730
+ export type JavascriptParserOptions = {
731
+ /**
732
+ * Specifies global mode for dynamic import.
733
+ * @default 'lazy'
734
+ * */
735
+ dynamicImportMode?: "eager" | "lazy" | "weak" | "lazy-once";
736
+ /**
737
+ * Specifies global preload for dynamic import.
738
+ * @default false
739
+ * */
740
+ dynamicImportPreload?: boolean | number;
741
+ /**
742
+ * Specifies global prefetch for dynamic import
743
+ * @default false
744
+ * */
745
+ dynamicImportPrefetch?: boolean | number;
746
+ /**
747
+ * Specifies global fetchPriority for dynamic import
748
+ * @default 'auto'
749
+ */
750
+ dynamicImportFetchPriority?: "low" | "high" | "auto";
751
+ /**
752
+ * Enable or disable evaluating import.meta.
753
+ * @default true
754
+ */
755
+ importMeta?: boolean;
756
+ /**
757
+ * Enable parsing of new URL() syntax.
758
+ * @default true
759
+ * */
760
+ url?: "relative" | boolean;
761
+ /**
762
+ * Enable warnings for full dynamic dependencies
763
+ * @default true
764
+ * */
765
+ exprContextCritical?: boolean;
766
+ /**
767
+ * Enable warnings for partial dynamic dependencies
768
+ * @default false
769
+ * */
770
+ wrappedContextCritical?: boolean;
771
+ /**
772
+ * Set the inner regular expression for partial dynamic dependencies
773
+ * */
774
+ wrappedContextRegExp?: RegExp;
775
+ /**
776
+ * Warn or error for using non-existent exports and conflicting re-exports.
777
+ * @default 'auto'
778
+ */
779
+ exportsPresence?: ExportsPresence;
780
+ /** Warn or error for using non-existent exports */
781
+ importExportsPresence?: ExportsPresence;
782
+ /** Warn or error for conflicting re-exports */
783
+ reexportExportsPresence?: ExportsPresence;
784
+ /** Emit errors instead of warnings when imported names don't exist in imported module. */
785
+ strictExportPresence?: boolean;
786
+ /** Provide custom syntax for Worker parsing, commonly used to support Worklet */
787
+ worker?: string[] | boolean;
788
+ /** Override the module to strict or non-strict. */
789
+ overrideStrict?: "strict" | "non-strict";
790
+ requireAsExpression?: boolean;
791
+ requireDynamic?: boolean;
792
+ requireResolve?: boolean;
793
+ importDynamic?: boolean;
794
+ /** Inline const values in this module */
795
+ inlineConst?: boolean;
796
+ /** Whether to tolerant exportsPresence for type reexport */
797
+ typeReexportsPresence?: "no-tolerant" | "tolerant" | "tolerant-no-check";
798
+ };
799
+ export type JsonParserOptions = {
800
+ /**
801
+ * The depth of json dependency flagged as `exportInfo`.
802
+ */
803
+ exportsDepth?: number;
804
+ /**
805
+ * If Rule.type is set to 'json' then Rules.parser.parse option may be a function that implements custom logic to parse module's source and convert it to a json-compatible data.
806
+ */
807
+ parse?: (source: string) => any;
808
+ };
809
+ /** Configure all parsers' options in one place with module.parser. */
810
+ export type ParserOptionsByModuleTypeKnown = {
811
+ /** Parser options for `asset` modules. */
812
+ asset?: AssetParserOptions;
813
+ /** Parser options for `css` modules. */
814
+ css?: CssParserOptions;
815
+ /** Parser options for `css/auto` modules. */
816
+ "css/auto"?: CssAutoParserOptions;
817
+ /** Parser options for `css/module` modules. */
818
+ "css/module"?: CssModuleParserOptions;
819
+ /** Parser options for `javascript` modules. */
820
+ javascript?: JavascriptParserOptions;
821
+ /** Parser options for `javascript/auto` modules. */
822
+ "javascript/auto"?: JavascriptParserOptions;
823
+ /** Parser options for `javascript/dynamic` modules. */
824
+ "javascript/dynamic"?: JavascriptParserOptions;
825
+ /** Parser options for `javascript/esm` modules. */
826
+ "javascript/esm"?: JavascriptParserOptions;
827
+ /** Parser options for `json` modules. */
828
+ json?: JsonParserOptions;
829
+ };
830
+ /** Configure all parsers' options in one place with module.parser. */
831
+ export type ParserOptionsByModuleTypeUnknown = {
832
+ [x: string]: Record<string, any>;
833
+ };
834
+ /** Configure all parsers' options in one place with module.parser. */
835
+ export type ParserOptionsByModuleType = ParserOptionsByModuleTypeKnown | ParserOptionsByModuleTypeUnknown;
836
+ export type AssetGeneratorDataUrlOptions = {
837
+ encoding?: false | "base64";
838
+ mimetype?: string;
839
+ };
840
+ export type AssetGeneratorDataUrlFunction = (content: Buffer, context: {
841
+ filename: string;
842
+ module: Module;
843
+ }) => string;
844
+ export type AssetGeneratorDataUrl = AssetGeneratorDataUrlOptions | AssetGeneratorDataUrlFunction;
845
+ /** Options for asset inline modules. */
846
+ export type AssetInlineGeneratorOptions = {
847
+ /** Only for modules with module type 'asset' or 'asset/inline'. */
848
+ dataUrl?: AssetGeneratorDataUrl;
849
+ /**
850
+ * Whether or not this asset module should be considered binary. This can be set to 'false' to treat this asset module as text.
851
+ */
852
+ binary?: boolean;
853
+ };
854
+ /** Emit the asset in the specified folder relative to 'output.path'. */
855
+ export type AssetModuleOutputPath = Filename;
856
+ /**
857
+ * If "url", a URL pointing to the asset will be generated based on publicPath.
858
+ * If "preserve", preserve import/require statement from generated asset.
859
+ * Only for modules with module type 'asset' or 'asset/resource'.
860
+ * @default "url"
861
+ */
862
+ export type AssetModuleImportMode = "url" | "preserve";
863
+ /** Options for asset modules. */
864
+ export type AssetResourceGeneratorOptions = {
865
+ /**
866
+ * Whether to output assets to disk.
867
+ * @default true
868
+ * */
869
+ emit?: boolean;
870
+ /** This option determines the name of each asset resource output bundle.*/
871
+ filename?: Filename;
872
+ /** Emit the asset in the specified folder relative to 'output.path' */
873
+ outputPath?: AssetModuleOutputPath;
874
+ /** This option determines the URL prefix of the referenced 'asset' or 'asset/resource'*/
875
+ publicPath?: PublicPath;
876
+ /**
877
+ * If "url", a URL pointing to the asset will be generated based on publicPath.
878
+ * If "preserve", preserve import/require statement from generated asset.
879
+ * Only for modules with module type 'asset' or 'asset/resource'.
880
+ * @default "url"
881
+ */
882
+ importMode?: AssetModuleImportMode;
883
+ /**
884
+ * Whether or not this asset module should be considered binary. This can be set to 'false' to treat this asset module as text.
885
+ */
886
+ binary?: boolean;
887
+ };
888
+ /** Generator options for asset modules. */
889
+ export type AssetGeneratorOptions = AssetInlineGeneratorOptions & AssetResourceGeneratorOptions;
890
+ export type CssGeneratorExportsConvention = "as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only";
891
+ export type CssGeneratorExportsOnly = boolean;
892
+ export type CssGeneratorLocalIdentName = string;
893
+ export type CssGeneratorEsModule = boolean;
894
+ /** Generator options for css modules. */
895
+ export type CssGeneratorOptions = {
896
+ /**
897
+ * If true, only exports the identifier mappings from CSS into the output JavaScript files
898
+ * If false, generate stylesheets and embed them in the template.
899
+ */
900
+ exportsOnly?: CssGeneratorExportsOnly;
901
+ /** This configuration is available for improved ESM-CJS interoperability purposes. */
902
+ esModule?: CssGeneratorEsModule;
903
+ };
904
+ /** Generator options for css/auto modules. */
905
+ export type CssAutoGeneratorOptions = {
906
+ /**
907
+ * Customize how CSS export names are exported to javascript modules
908
+ * @default 'as-is'
909
+ * */
910
+ exportsConvention?: CssGeneratorExportsConvention;
911
+ /**
912
+ * If true, only exports the identifier mappings from CSS into the output JavaScript files
913
+ * If false, generate stylesheets and embed them in the template.
914
+ */
915
+ exportsOnly?: CssGeneratorExportsOnly;
916
+ /** Customize the format of the local class names generated for CSS modules */
917
+ localIdentName?: CssGeneratorLocalIdentName;
918
+ /** This configuration is available for improved ESM-CJS interoperability purposes. */
919
+ esModule?: CssGeneratorEsModule;
920
+ };
921
+ /** Generator options for css/module modules. */
922
+ export type CssModuleGeneratorOptions = CssAutoGeneratorOptions;
923
+ /** Generator options for json modules. */
924
+ export type JsonGeneratorOptions = {
925
+ /**
926
+ * Use `JSON.parse` when the JSON string is longer than 20 characters.
927
+ * @default true
928
+ */
929
+ JSONParse?: boolean;
930
+ };
931
+ export type GeneratorOptionsByModuleTypeKnown = {
932
+ /** Generator options for asset modules. */
933
+ asset?: AssetGeneratorOptions;
934
+ /** Generator options for asset/inline modules. */
935
+ "asset/inline"?: AssetInlineGeneratorOptions;
936
+ /** Generator options for asset/resource modules. */
937
+ "asset/resource"?: AssetResourceGeneratorOptions;
938
+ /** Generator options for css modules. */
939
+ css?: CssGeneratorOptions;
940
+ /** Generator options for css/auto modules. */
941
+ "css/auto"?: CssAutoGeneratorOptions;
942
+ /** Generator options for css/module modules. */
943
+ "css/module"?: CssModuleGeneratorOptions;
944
+ /** Generator options for json modules. */
945
+ json?: JsonGeneratorOptions;
946
+ };
947
+ export type GeneratorOptionsByModuleTypeUnknown = Record<string, Record<string, any>>;
948
+ /** Options for module.generator */
949
+ export type GeneratorOptionsByModuleType = GeneratorOptionsByModuleTypeKnown | GeneratorOptionsByModuleTypeUnknown;
950
+ type NoParseOptionSingle = string | RegExp | ((request: string) => boolean);
951
+ /** Options for module.noParse */
952
+ export type NoParseOption = NoParseOptionSingle | NoParseOptionSingle[];
953
+ export type ModuleOptions = {
954
+ /** Used to decide how to handle different types of modules in a project. */
955
+ defaultRules?: RuleSetRules;
956
+ /**
957
+ * An array of rules that match the module's requests when it is created.
958
+ * @default []
959
+ * */
960
+ rules?: RuleSetRules;
961
+ /**
962
+ * Configure all parsers' options in one place with module.parser.
963
+ * @default {}
964
+ * */
965
+ parser?: ParserOptionsByModuleType;
966
+ /** Configure all generators' options in one place with module.generator. */
967
+ generator?: GeneratorOptionsByModuleType;
968
+ /** Keep module mechanism of the matched modules as-is, such as module.exports, require, import. */
969
+ noParse?: NoParseOption;
970
+ };
971
+ type AllowTarget = "web" | "webworker" | "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "es2023" | "es2024" | "es2025" | "node" | "async-node" | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | "electron-main" | `electron${number}-main` | `electron${number}.${number}-main` | "electron-renderer" | `electron${number}-renderer` | `electron${number}.${number}-renderer` | "electron-preload" | `electron${number}-preload` | `electron${number}.${number}-preload` | "nwjs" | `nwjs${number}` | `nwjs${number}.${number}` | "node-webkit" | `node-webkit${number}` | `node-webkit${number}.${number}` | "browserslist" | `browserslist:${string}`;
972
+ /** Used to configure the target environment of Rspack output and the ECMAScript version of Rspack runtime code. */
973
+ export type Target = false | AllowTarget | AllowTarget[];
974
+ /**
975
+ * Specify the default type of externals.
976
+ * `amd`, `umd`, `system` and `jsonp` externals depend on the `output.libraryTarget` being set to the same value e.g. you can only consume amd externals within an amd library.
977
+ * @default 'var'
978
+ */
979
+ export type ExternalsType = "var" | "module" | "assign" | "this" | "window" | "self" | "global" | "commonjs" | "commonjs2" | "commonjs-module" | "commonjs-static" | "amd" | "amd-require" | "umd" | "umd2" | "jsonp" | "system" | "promise" | "import" | "module-import" | "script" | "node-commonjs" | "commonjs-import";
980
+ /**
981
+ * External item object when both libraryTarget and externalsType is 'umd'
982
+ */
983
+ export type ExternalItemUmdValue = {
984
+ root: string | string[];
985
+ commonjs: string | string[];
986
+ commonjs2: string | string[];
987
+ amd: string | string[];
988
+ };
989
+ /**
990
+ * External item object when not umd
991
+ */
992
+ export type ExternalItemObjectValue = Record<string, string | string[]>;
993
+ /**
994
+ * The dependency used for the external.
995
+ */
996
+ export type ExternalItemValue = string | boolean | string[] | ExternalItemUmdValue
997
+ /**
998
+ * when libraryTarget and externalsType is not 'umd'
999
+ */
1000
+ | ExternalItemObjectValue;
1001
+ /**
1002
+ * If an dependency matches exactly a property of the object, the property value is used as dependency.
1003
+ */
1004
+ export type ExternalItemObjectUnknown = {
1005
+ [x: string]: ExternalItemValue;
1006
+ };
1007
+ /**
1008
+ * Data object passed as argument when a function is set for 'externals'.
1009
+ */
1010
+ export type ExternalItemFunctionData = {
1011
+ context?: string;
1012
+ dependencyType?: string;
1013
+ request?: string;
1014
+ contextInfo?: {
1015
+ issuer: string;
1016
+ issuerLayer?: string | null;
1017
+ };
1018
+ /**
1019
+ * Get a resolve function with the current resolver options.
1020
+ */
1021
+ getResolve?: (options?: ResolveOptions) => ((context: string, request: string, callback: ResolveCallback) => void) | ((context: string, request: string) => Promise<string>);
1022
+ };
1023
+ /**
1024
+ * Prevent bundling of certain imported package and instead retrieve these external dependencies at runtime.
1025
+ *
1026
+ * @example
1027
+ * ```js
1028
+ * // jquery lib will be excluded from bundling.
1029
+ * module.exports = {
1030
+ * externals: {
1031
+ * jquery: 'jQuery',
1032
+ * }
1033
+ * }
1034
+ * ```
1035
+ * */
1036
+ export type ExternalItem = string | RegExp | ExternalItemObjectUnknown | ((data: ExternalItemFunctionData) => ExternalItemValue) | ((data: ExternalItemFunctionData, callback: (err?: Error, result?: ExternalItemValue, type?: ExternalsType) => void) => void) | ((data: ExternalItemFunctionData) => Promise<ExternalItemValue>);
1037
+ /**
1038
+ * Prevent bundling of certain imported packages and instead retrieve these external dependencies at runtime.
1039
+ *
1040
+ * @example
1041
+ * ```js
1042
+ * // jquery lib will be excluded from bundling.
1043
+ * module.exports = {
1044
+ * externals: {
1045
+ * jquery: 'jQuery',
1046
+ * }
1047
+ * }
1048
+ * ```
1049
+ * */
1050
+ export type Externals = ExternalItem | ExternalItem[];
1051
+ /** Enable presets of externals for specific targets. */
1052
+ export type ExternalsPresets = {
1053
+ /** Treat node.js built-in modules like `fs`, `path` or `vm` as external and load them via `require()` when used. */
1054
+ node?: boolean;
1055
+ /** Treat references to `http(s)://...` and `std:...` as external and load them via import when used. */
1056
+ web?: boolean;
1057
+ /** Treat references to `http(s)://...` and `std:...` as external and load them via async import() when used */
1058
+ webAsync?: boolean;
1059
+ /** Treat common electron built-in modules in main and preload context like `electron`, `ipc` or `shell` as external and load them via `require()` when used. */
1060
+ electron?: boolean;
1061
+ /** Treat electron built-in modules in the main context like `app`, `ipc-main` or `shell` as external and load them via `require()` when used. */
1062
+ electronMain?: boolean;
1063
+ /** Treat electron built-in modules in the preload context like `web-frame`, `ipc-renderer` or `shell` as external and load them via require() when used. */
1064
+ electronPreload?: boolean;
1065
+ /** Treat electron built-in modules in the preload context like `web-frame`, `ipc-renderer` or `shell` as external and load them via require() when used. */
1066
+ electronRenderer?: boolean;
1067
+ /** Treat `NW.js` legacy `nw.gui` module as external and load it via `require()` when used. */
1068
+ nwjs?: boolean;
1069
+ };
1070
+ /**
1071
+ * Represents a filter item type for infrastructure logging.
1072
+ * Can be a RegExp, a string, or a function that takes a string and returns a boolean.
1073
+ */
1074
+ export type FilterItemTypes = RegExp | string | ((value: string) => boolean);
1075
+ /**
1076
+ * Represents filter types for infrastructure logging.
1077
+ * Can be a single FilterItemTypes or an array of FilterItemTypes.
1078
+ */
1079
+ export type FilterTypes = FilterItemTypes | FilterItemTypes[];
1080
+ /**
1081
+ * Options for infrastructure level logging.
1082
+ */
1083
+ export type InfrastructureLogging = {
1084
+ /**
1085
+ * Append lines to the output instead of updating existing output, useful for status messages.
1086
+ */
1087
+ appendOnly?: boolean;
1088
+ /**
1089
+ * Enable colorful output for infrastructure level logging.
1090
+ */
1091
+ colors?: boolean;
1092
+ /**
1093
+ * Customize the console used for infrastructure level logging.
1094
+ */
1095
+ console?: Console;
1096
+ /**
1097
+ * Enable debug information of specified loggers such as plugins or loaders.
1098
+ */
1099
+ debug?: boolean | FilterTypes;
1100
+ /**
1101
+ * Enable infrastructure logging output.
1102
+ */
1103
+ level?: "none" | "error" | "warn" | "info" | "log" | "verbose";
1104
+ /**
1105
+ * Stream used for logging output.
1106
+ */
1107
+ stream?: NodeJS.WritableStream;
1108
+ };
1109
+ /**
1110
+ * Configuration used to control the behavior of the Source Map generation.
1111
+ */
1112
+ type DevToolPosition = "inline-" | "hidden-" | "eval-" | "";
1113
+ type DevToolNoSources = "nosources-" | "";
1114
+ type DevToolCheap = "cheap-" | "cheap-module-" | "";
1115
+ type DevToolDebugIds = "-debugids" | "";
1116
+ export type DevTool = false | "eval" | `${DevToolPosition}${DevToolNoSources}${DevToolCheap}source-map${DevToolDebugIds}`;
1117
+ /**
1118
+ * Options for mocking Node.js globals and modules.
1119
+ */
1120
+ export type NodeOptions = {
1121
+ /**
1122
+ * Controls the behavior of `__dirname`.
1123
+ * @description
1124
+ * - `true`: The dirname of the input file relative to the context option.
1125
+ * - `false`: Regular Node.js `__dirname` behavior. The dirname of the output file when run in a Node.js environment.
1126
+ * - `"mock"`: The fixed value '/'.
1127
+ * - `"warn-mock"`: Use the fixed value of '/' but show a warning.
1128
+ * - `"node-module"`: Replace `__dirname` in CommonJS modules to `fileURLToPath(import.meta.url + "/..")` when `output.module` is enabled.
1129
+ * - `"eval-only"`: Equivalent to `false`.
1130
+ */
1131
+ __dirname?: boolean | "warn-mock" | "mock" | "eval-only" | "node-module";
1132
+ /**
1133
+ * Controls the behavior of `__filename`.
1134
+ * @description
1135
+ * - `true`: The filename of the input file relative to the context option.
1136
+ * - `false`: Regular Node.js `__filename` behavior. The filename of the output file when run in a Node.js environment.
1137
+ * - `"mock"`: The fixed value '/index.js'.
1138
+ * - `"warn-mock"`: Use the fixed value of '/index.js' but show a warning.
1139
+ * - `"node-module"`: Replace `__filename` in CommonJS modules to `fileURLToPath(import.meta.url)` when `output.module` is enabled.
1140
+ * - `"eval-only"`: Equivalent to `false`.
1141
+ */
1142
+ __filename?: boolean | "warn-mock" | "mock" | "eval-only" | "node-module";
1143
+ /**
1144
+ * Controls the behavior of `global`.
1145
+ * @description
1146
+ * - `true`: Provide a polyfill.
1147
+ * - `false`: Don't provide a polyfill.
1148
+ * - `"warn"`: Provide a polyfill but show a warning.
1149
+ * @see {@link https://nodejs.org/api/globals.html#globals_global | Node.js documentation} for the exact behavior of this object.
1150
+ * @default "warn"
1151
+ */
1152
+ global?: boolean | "warn";
1153
+ };
1154
+ /**
1155
+ * Options for mocking Node.js globals and modules.
1156
+ * @description Set to `false` to disable all mocking, or use `NodeOptions` to configure specific behaviors.
1157
+ */
1158
+ export type Node = false | NodeOptions;
1159
+ export type Loader = Record<string, any>;
1160
+ export type SnapshotOptions = {};
1161
+ /**
1162
+ * Options for caching snapshots and intermediate products during the build process.
1163
+ * @description Controls whether caching is enabled or disabled.
1164
+ * @default true in development mode, false in production mode
1165
+ * @example
1166
+ * // Enable caching
1167
+ * cache: true
1168
+ *
1169
+ * // Disable caching
1170
+ * cache: false
1171
+ */
1172
+ export type CacheOptions = boolean;
1173
+ type StatsPresets = "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary";
1174
+ type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
1175
+ type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
1176
+ /** Options for stats */
1177
+ export type StatsOptions = {
1178
+ /**
1179
+ * Enables or disables the display of all stats.
1180
+ */
1181
+ all?: boolean;
1182
+ /**
1183
+ * Sets the preset for stats or enables/disables them.
1184
+ */
1185
+ preset?: boolean | StatsPresets;
1186
+ /**
1187
+ * Enables or disables the display of asset stats.
1188
+ * @default true
1189
+ */
1190
+ assets?: boolean;
1191
+ /**
1192
+ * Enables or disables the display of chunk stats.
1193
+ * @default true
1194
+ */
1195
+ chunks?: boolean;
1196
+ /**
1197
+ * Enables or disables the display of module stats.
1198
+ * @default true
1199
+ */
1200
+ modules?: boolean;
1201
+ /**
1202
+ * Enables or disables the display of entrypoint stats or sets it to 'auto'.
1203
+ * @default false
1204
+ */
1205
+ entrypoints?: boolean | "auto";
1206
+ /**
1207
+ * Enables or disables the display of chunk group stats.
1208
+ * @default true
1209
+ */
1210
+ chunkGroups?: boolean;
1211
+ /**
1212
+ * Enables or disables the display of warning stats.
1213
+ * @default true
1214
+ */
1215
+ warnings?: boolean;
1216
+ /**
1217
+ * Enables or disables the display of warning counts.
1218
+ * @default true
1219
+ */
1220
+ warningsCount?: boolean;
1221
+ /**
1222
+ * Enables or disables the display of error stats.
1223
+ * @default true
1224
+ */
1225
+ errors?: boolean;
1226
+ /**
1227
+ * Enables or disables the display of error counts.
1228
+ * @default true
1229
+ */
1230
+ errorsCount?: boolean;
1231
+ /**
1232
+ * Enables or disables the use of colors in the output.
1233
+ * @default false
1234
+ */
1235
+ colors?: boolean;
1236
+ /**
1237
+ * Enables or disables the display of the hash.
1238
+ * @default true
1239
+ */
1240
+ hash?: boolean;
1241
+ /**
1242
+ * Enables or disables the display of the version.
1243
+ * @default true
1244
+ */
1245
+ version?: boolean;
1246
+ /**
1247
+ * Enables or disables the display of reasons.
1248
+ * @default true
1249
+ */
1250
+ reasons?: boolean;
1251
+ /**
1252
+ * Enables or disables the display of the public path.
1253
+ * @default true
1254
+ */
1255
+ publicPath?: boolean;
1256
+ /**
1257
+ * Enables or disables the display of the output path.
1258
+ * @default true
1259
+ */
1260
+ outputPath?: boolean;
1261
+ /**
1262
+ * Enables or disables the display of chunk module stats.
1263
+ * @default true
1264
+ */
1265
+ chunkModules?: boolean;
1266
+ /**
1267
+ * Enables or disables the display of chunk relations.
1268
+ * @default false
1269
+ */
1270
+ chunkRelations?: boolean;
1271
+ /**
1272
+ * Enables or disables the display of module IDs.
1273
+ * @default false
1274
+ */
1275
+ ids?: boolean;
1276
+ /**
1277
+ * Enables or disables the display of build timings.
1278
+ * @default true
1279
+ */
1280
+ timings?: boolean;
1281
+ /**
1282
+ * Enables or disables the display of the build date.
1283
+ * @default true
1284
+ */
1285
+ builtAt?: boolean;
1286
+ /**
1287
+ * Enables or disables the display of module assets.
1288
+ * @default true
1289
+ */
1290
+ moduleAssets?: boolean;
1291
+ /**
1292
+ * Enables or disables the display of nested modules.
1293
+ * @default true
1294
+ */
1295
+ nestedModules?: boolean;
1296
+ /**
1297
+ * Enables or disables the display of source code.
1298
+ * @default false
1299
+ */
1300
+ source?: boolean;
1301
+ /**
1302
+ * Configures the level of logging output.
1303
+ * Can be set to a string value of "none", "error", "warn", "info", "log", "verbose", or a boolean value.
1304
+ *
1305
+ * @description
1306
+ * - `'none'`, false: Logging is disabled.
1307
+ * - `'error'`: Only errors are logged.
1308
+ * - `'warn'`: Errors and warnings are logged.
1309
+ * - `'info'`: Errors, warnings, and info messages are logged.
1310
+ * - `'log'`, true: Errors, warnings, info messages, log messages, groups, and clears are logged. Collapsed groups are initially collapsed.
1311
+ * - `'verbose'`: All log levels except debug and trace are logged. Collapsed groups are initially expanded.
1312
+ */
1313
+ logging?: "none" | "error" | "warn" | "info" | "log" | "verbose" | boolean;
1314
+ /**
1315
+ * Enables or disables debug logging, or specifies a filter for debug logging.
1316
+ */
1317
+ loggingDebug?: boolean | FilterTypes;
1318
+ /**
1319
+ * Enables or disables trace logging.
1320
+ * @default true
1321
+ */
1322
+ loggingTrace?: boolean;
1323
+ /**
1324
+ * Enables or disables the display of runtime modules.
1325
+ * @default true
1326
+ */
1327
+ runtimeModules?: boolean;
1328
+ /**
1329
+ * Enables or disables the display of children modules.
1330
+ * @default true
1331
+ */
1332
+ children?: boolean;
1333
+ /**
1334
+ * Enables or disables the display of used exports.
1335
+ * @default false
1336
+ */
1337
+ usedExports?: boolean;
1338
+ /**
1339
+ * Enables or disables the display of provided exports.
1340
+ * @default false
1341
+ */
1342
+ providedExports?: boolean;
1343
+ /**
1344
+ * Enables or disables optimization bailout.
1345
+ * @default false
1346
+ */
1347
+ optimizationBailout?: boolean;
1348
+ /**
1349
+ * Enables or disables grouping of modules by type.
1350
+ */
1351
+ groupModulesByType?: boolean;
1352
+ /**
1353
+ * Enables or disables grouping of modules by cache status.
1354
+ */
1355
+ groupModulesByCacheStatus?: boolean;
1356
+ /**
1357
+ * Enables or disables grouping of modules by layer.
1358
+ */
1359
+ groupModulesByLayer?: boolean;
1360
+ /**
1361
+ * Enables or disables grouping of modules by attributes.
1362
+ */
1363
+ groupModulesByAttributes?: boolean;
1364
+ /**
1365
+ * Enables or disables grouping of modules by path.
1366
+ */
1367
+ groupModulesByPath?: boolean;
1368
+ /**
1369
+ * Enables or disables grouping of modules by extension.
1370
+ */
1371
+ groupModulesByExtension?: boolean;
1372
+ /**
1373
+ * Specifies the space to use for displaying modules.
1374
+ * @default 15
1375
+ */
1376
+ modulesSpace?: number;
1377
+ /**
1378
+ * Specifies the space to use for displaying chunk modules.
1379
+ * @default 10
1380
+ */
1381
+ chunkModulesSpace?: number;
1382
+ /**
1383
+ * Specifies the space to use for displaying nested modules.
1384
+ * @default 10
1385
+ */
1386
+ nestedModulesSpace?: number;
1387
+ /**
1388
+ * Enables or disables the display of related assets.
1389
+ * @default false
1390
+ */
1391
+ relatedAssets?: boolean;
1392
+ /**
1393
+ * Enables or disables grouping of assets by emit status.
1394
+ */
1395
+ groupAssetsByEmitStatus?: boolean;
1396
+ /**
1397
+ * Enables or disables grouping of assets by info.
1398
+ */
1399
+ groupAssetsByInfo?: boolean;
1400
+ /**
1401
+ * Enables or disables grouping of assets by path.
1402
+ */
1403
+ groupAssetsByPath?: boolean;
1404
+ /**
1405
+ * Enables or disables grouping of assets by extension.
1406
+ */
1407
+ groupAssetsByExtension?: boolean;
1408
+ /**
1409
+ * Enables or disables grouping of assets by chunk.
1410
+ */
1411
+ groupAssetsByChunk?: boolean;
1412
+ /**
1413
+ * Specifies the space to use for displaying assets.
1414
+ * @default 15
1415
+ */
1416
+ assetsSpace?: number;
1417
+ /**
1418
+ * Enables or disables the display of orphan modules.
1419
+ * @default false
1420
+ */
1421
+ orphanModules?: boolean;
1422
+ /**
1423
+ * Specifies modules to exclude from the bundle.
1424
+ * @default false
1425
+ */
1426
+ excludeModules?: ModuleFilterTypes;
1427
+ /**
1428
+ * Exclude the matching assets information.
1429
+ * @default false
1430
+ */
1431
+ excludeAssets?: ModuleFilterTypes;
1432
+ /**
1433
+ * Specifies the sorting order for modules.
1434
+ * @default 'id'
1435
+ */
1436
+ modulesSort?: string;
1437
+ /**
1438
+ * Specifies the sorting order for chunk modules.
1439
+ */
1440
+ chunkModulesSort?: string;
1441
+ /**
1442
+ * Specifies the sorting order for nested modules.
1443
+ */
1444
+ nestedModulesSort?: string;
1445
+ /**
1446
+ * Specifies the sorting order for chunks.
1447
+ * @default 'id'
1448
+ */
1449
+ chunksSort?: string;
1450
+ /**
1451
+ * Specifies the sorting order for assets.
1452
+ * @default 'id'
1453
+ */
1454
+ assetsSort?: string;
1455
+ /**
1456
+ * Enables or disables performance optimization.
1457
+ * @default true
1458
+ */
1459
+ performance?: boolean;
1460
+ /**
1461
+ * Enables or disables environment variables.
1462
+ * @default false
1463
+ */
1464
+ env?: boolean;
1465
+ /**
1466
+ * Enables or disables auxiliary chunk grouping.
1467
+ * @default true
1468
+ */
1469
+ chunkGroupAuxiliary?: boolean;
1470
+ /**
1471
+ * Enables or disables child chunk grouping.
1472
+ * @default true
1473
+ */
1474
+ chunkGroupChildren?: boolean;
1475
+ /**
1476
+ * Specifies the maximum number of assets per chunk group.
1477
+ * @default 5
1478
+ */
1479
+ chunkGroupMaxAssets?: number;
1480
+ /**
1481
+ * Enables or disables the display of dependent modules.
1482
+ * @default false
1483
+ */
1484
+ dependentModules?: boolean;
1485
+ /**
1486
+ * Enables or disables the display of chunk origins.
1487
+ * @default true
1488
+ */
1489
+ chunkOrigins?: boolean;
1490
+ /**
1491
+ * Enables or disables the display of runtime information.
1492
+ */
1493
+ runtime?: boolean;
1494
+ /**
1495
+ * Enables or disables the display of depth information.
1496
+ * @default false
1497
+ */
1498
+ depth?: boolean;
1499
+ /**
1500
+ * Specifies the space to use for displaying reasons.
1501
+ * @default 100
1502
+ */
1503
+ reasonsSpace?: number;
1504
+ /**
1505
+ * Enables or disables grouping of reasons by origin.
1506
+ */
1507
+ groupReasonsByOrigin?: boolean;
1508
+ /**
1509
+ * Enables or disables the display of error details.
1510
+ * @default false
1511
+ */
1512
+ errorDetails?: boolean;
1513
+ /**
1514
+ * Enables or disables the display of error stack traces.
1515
+ * @default true
1516
+ */
1517
+ errorStack?: boolean;
1518
+ /**
1519
+ * Enables or disables the display of module trace information.
1520
+ * @default true
1521
+ */
1522
+ moduleTrace?: boolean;
1523
+ /**
1524
+ * Enables or disables the display of cached modules.
1525
+ * @default true
1526
+ */
1527
+ cachedModules?: boolean;
1528
+ /**
1529
+ * Enables or disables the display of cached assets.
1530
+ * @default true
1531
+ */
1532
+ cachedAssets?: boolean;
1533
+ /**
1534
+ * Enables or disables the display of cached information.
1535
+ */
1536
+ cached?: boolean;
1537
+ /**
1538
+ * Specifies the space to use for displaying errors.
1539
+ * @default 5
1540
+ */
1541
+ errorsSpace?: number;
1542
+ /**
1543
+ * Specifies the space to use for displaying warnings.
1544
+ * @default 5
1545
+ */
1546
+ warningsSpace?: number;
1547
+ };
1548
+ /**
1549
+ * Represents the value for stats configuration.
1550
+ */
1551
+ export type StatsValue = boolean | StatsOptions | StatsPresets;
1552
+ export interface RspackPluginInstance {
1553
+ apply: (compiler: Compiler) => void;
1554
+ [k: string]: any;
1555
+ }
1556
+ export type RspackPluginFunction = (this: Compiler, compiler: Compiler) => void;
1557
+ export type WebpackCompiler = any;
1558
+ export interface WebpackPluginInstance {
1559
+ apply: (compiler: WebpackCompiler) => void;
1560
+ [k: string]: any;
1561
+ }
1562
+ export type WebpackPluginFunction = (this: WebpackCompiler, compiler: WebpackCompiler) => void;
1563
+ export type Plugin = RspackPluginInstance | RspackPluginFunction | WebpackPluginInstance | WebpackPluginFunction | Falsy;
1564
+ export type Plugins = Plugin[];
1565
+ /** Used to control how the runtime chunk is generated. */
1566
+ export type OptimizationRuntimeChunk = boolean | "single" | "multiple" | {
1567
+ name?: string | ((value: {
1568
+ name: string;
1569
+ }) => string);
1570
+ };
1571
+ export type OptimizationSplitChunksNameFunction = (module: Module, chunks: Chunk[], cacheGroupKey: string) => string | undefined;
1572
+ type OptimizationSplitChunksName = string | false | OptimizationSplitChunksNameFunction;
1573
+ type OptimizationSplitChunksSizes = number | Record<string, number>;
1574
+ type OptimizationSplitChunksChunks = "initial" | "async" | "all" | RegExp | ((chunk: Chunk) => boolean);
1575
+ type SharedOptimizationSplitChunksCacheGroup = {
1576
+ /**
1577
+ * This indicates which chunks will be selected for optimization.
1578
+ * @default 'async''
1579
+ * */
1580
+ chunks?: OptimizationSplitChunksChunks;
1581
+ /** Sets the size types which are used when a number is used for sizes. */
1582
+ defaultSizeTypes?: string[];
1583
+ /**
1584
+ * The minimum times must a module be shared among chunks before splitting.
1585
+ * @default 1
1586
+ */
1587
+ minChunks?: number;
1588
+ /**
1589
+ * Enabling this, the splitting of chunks will be grouped based on the usage of modules exports in different runtimes,
1590
+ * ensuring the optimal loading size in each runtime.
1591
+ */
1592
+ usedExports?: boolean;
1593
+ /**
1594
+ * The name of the split chunk.
1595
+ * @default false
1596
+ * */
1597
+ name?: false | OptimizationSplitChunksName;
1598
+ /** Allows to override the filename when and only when it's an initial chunk. */
1599
+ filename?: Filename;
1600
+ /**
1601
+ * Minimum size, in bytes, for a chunk to be generated.
1602
+ *
1603
+ * The value is `20000` in production mode.
1604
+ * The value is `10000` in others mode.
1605
+ */
1606
+ minSize?: OptimizationSplitChunksSizes;
1607
+ minSizeReduction?: OptimizationSplitChunksSizes;
1608
+ /** Maximum size, in bytes, for a chunk to be generated. */
1609
+ maxSize?: OptimizationSplitChunksSizes;
1610
+ /** Maximum size, in bytes, for a async chunk to be generated. */
1611
+ maxAsyncSize?: OptimizationSplitChunksSizes;
1612
+ /** Maximum size, in bytes, for a initial chunk to be generated. */
1613
+ maxInitialSize?: OptimizationSplitChunksSizes;
1614
+ /**
1615
+ * Maximum number of parallel requests when on-demand loading.
1616
+ * @default 30
1617
+ * */
1618
+ maxAsyncRequests?: number;
1619
+ /**
1620
+ * Maximum number of parallel requests at an entry point.
1621
+ * @default 30
1622
+ */
1623
+ maxInitialRequests?: number;
1624
+ /**
1625
+ * Tell Rspack what delimiter to use for the generated names.
1626
+ *
1627
+ * @default '-''
1628
+ */
1629
+ automaticNameDelimiter?: string;
1630
+ };
1631
+ export type OptimizationSplitChunksCacheGroupTestFn = (module: Module, ctx: {
1632
+ chunkGraph: ChunkGraph;
1633
+ moduleGraph: ModuleGraph;
1634
+ }) => boolean;
1635
+ /** How to splitting chunks. */
1636
+ export type OptimizationSplitChunksCacheGroup = {
1637
+ /** Controls which modules are selected by this cache group. */
1638
+ test?: string | RegExp | OptimizationSplitChunksCacheGroupTestFn;
1639
+ /**
1640
+ * A module can belong to multiple cache groups.
1641
+ * @default -20
1642
+ */
1643
+ priority?: number;
1644
+ /**
1645
+ * Tells Rspack to ignore `splitChunks.minSize`, `splitChunks.minChunks`, `splitChunks.maxAsyncRequests` and `splitChunks.maxInitialRequests` options and always create chunks for this cache group.
1646
+ */
1647
+ enforce?: boolean;
1648
+ /**
1649
+ * Whether to reuse existing chunks when possible.
1650
+ * @default false
1651
+ * */
1652
+ reuseExistingChunk?: boolean;
1653
+ /** Allows to assign modules to a cache group by module type. */
1654
+ type?: string | RegExp;
1655
+ /** Sets the hint for chunk id. It will be added to chunk's filename. */
1656
+ idHint?: string;
1657
+ /**
1658
+ * Assign modules to a cache group by module layer.
1659
+ */
1660
+ layer?: string | ((layer?: string) => boolean) | RegExp;
1661
+ } & SharedOptimizationSplitChunksCacheGroup;
1662
+ /** Tell Rspack how to splitting chunks. */
1663
+ export type OptimizationSplitChunksOptions = {
1664
+ /**
1665
+ * Options for module cache group
1666
+ * */
1667
+ cacheGroups?: Record<string, false | OptimizationSplitChunksCacheGroup>;
1668
+ /**
1669
+ * Options for modules not selected by any other group.
1670
+ */
1671
+ fallbackCacheGroup?: {
1672
+ chunks?: OptimizationSplitChunksChunks;
1673
+ minSize?: number;
1674
+ maxSize?: number;
1675
+ maxAsyncSize?: number;
1676
+ maxInitialSize?: number;
1677
+ automaticNameDelimiter?: string;
1678
+ };
1679
+ /**
1680
+ * Prevents exposing path info when creating names for parts splitted by maxSize.
1681
+ *
1682
+ * The value is `true` in production mode.
1683
+ * The value is `false` in development mode.
1684
+ * */
1685
+ hidePathInfo?: boolean;
1686
+ } & SharedOptimizationSplitChunksCacheGroup;
1687
+ export type Optimization = {
1688
+ /**
1689
+ * Which algorithm to use when choosing module ids.
1690
+ */
1691
+ moduleIds?: "named" | "natural" | "deterministic";
1692
+ /**
1693
+ * Which algorithm to use when choosing chunk ids.
1694
+ */
1695
+ chunkIds?: "natural" | "named" | "deterministic" | "size" | "total-size";
1696
+ /**
1697
+ * Whether to minimize the bundle.
1698
+ * The value is `true` in production mode.
1699
+ * The value is `false` in development mode.
1700
+ */
1701
+ minimize?: boolean;
1702
+ /**
1703
+ * Customize the minimizer.
1704
+ * By default, `rspack.SwcJsMinimizerRspackPlugin` and `rspack.LightningCssMinimizerRspackPlugin` are used.
1705
+ */
1706
+ minimizer?: Array<"..." | Plugin>;
1707
+ /**
1708
+ * Whether to merge chunks which contain the same modules.
1709
+ * Setting optimization.mergeDuplicateChunks to false will disable this optimization.
1710
+ * @default true
1711
+ */
1712
+ mergeDuplicateChunks?: boolean;
1713
+ /**
1714
+ * Support splitting chunks.
1715
+ * It is enabled by default for dynamically imported modules.
1716
+ * To turn it off, set it to false.
1717
+ * */
1718
+ splitChunks?: false | OptimizationSplitChunksOptions;
1719
+ /**
1720
+ * Used to control how the runtime chunk is generated.
1721
+ * Setting it to true or 'multiple' will add an additional chunk containing only the runtime for each entry point.
1722
+ * Setting it to 'single' will extract the runtime code of all entry points into a single separate chunk.
1723
+ * @default false
1724
+ */
1725
+ runtimeChunk?: OptimizationRuntimeChunk;
1726
+ /** Detect and remove modules from chunks these modules are already included in all parents. */
1727
+ removeAvailableModules?: boolean;
1728
+ /**
1729
+ * Remove empty chunks generated in the compilation.
1730
+ * @default true
1731
+ * */
1732
+ removeEmptyChunks?: boolean;
1733
+ /**
1734
+ * Adds an additional hash compilation pass after the assets have been processed to get the correct asset content hashes.
1735
+ *
1736
+ * The value is `true` in production mode.
1737
+ * The value is `false` in development mode.
1738
+ */
1739
+ realContentHash?: boolean;
1740
+ /**
1741
+ * Tells Rspack to recognise the sideEffects flag in package.json or rules to skip over modules which are flagged to contain no side effects when exports are not used.
1742
+ *
1743
+ * The value is `true` in production mode.
1744
+ * The value is `false` in development mode.
1745
+ * */
1746
+ sideEffects?: "flag" | boolean;
1747
+ /**
1748
+ * After enabling, Rspack will analyze which exports the module provides, including re-exported modules.
1749
+ * @default true
1750
+ * */
1751
+ providedExports?: boolean;
1752
+ /**
1753
+ * Tells Rspack to find segments of the module graph which can be safely concatenated into a single module.
1754
+ *
1755
+ * The value is `true` in production mode.
1756
+ * The value is `false` in development mode.
1757
+ */
1758
+ concatenateModules?: boolean;
1759
+ /**
1760
+ * Tells Rspack whether to perform a more detailed analysis of variable assignments.
1761
+ *
1762
+ * The value is `true` in production mode.
1763
+ * The value is `false` in development mode.
1764
+ */
1765
+ innerGraph?: boolean;
1766
+ /**
1767
+ * Tells Rspack to determine used exports for each module.
1768
+ *
1769
+ * The value is `true` in production mode.
1770
+ * The value is `false` in development mode.
1771
+ * */
1772
+ usedExports?: "global" | boolean;
1773
+ /**
1774
+ * Allows to control export mangling.
1775
+ *
1776
+ * The value is `isdeterministic` in production mode.
1777
+ * The value is `false` in development mode.
1778
+ */
1779
+ mangleExports?: "size" | "deterministic" | boolean;
1780
+ /**
1781
+ * Tells Rspack to set process.env.NODE_ENV to a given string value.
1782
+ * @default false
1783
+ */
1784
+ nodeEnv?: string | false;
1785
+ /**
1786
+ * Emit assets whenever there are errors while compiling.
1787
+ *
1788
+ * The value is `false` in production mode.
1789
+ * The value is `true` in development mode.
1790
+ * */
1791
+ emitOnErrors?: boolean;
1792
+ /**
1793
+ * Avoid wrapping the entry module in an IIFE.
1794
+ */
1795
+ avoidEntryIife?: boolean;
1796
+ };
1797
+ /**
1798
+ * Options for caching snapshots and intermediate products during the build process.
1799
+ * @description Controls whether caching is enabled or disabled.
1800
+ * @default true in development mode, false in production mode
1801
+ * @example
1802
+ * // Enable caching
1803
+ * cache: true
1804
+ *
1805
+ * // Disable caching
1806
+ * cache: false
1807
+ */
1808
+ export type ExperimentCacheOptions = boolean | {
1809
+ type: "memory";
1810
+ } | {
1811
+ type: "persistent";
1812
+ buildDependencies?: string[];
1813
+ version?: string;
1814
+ snapshot?: {
1815
+ immutablePaths?: Array<string | RegExp>;
1816
+ unmanagedPaths?: Array<string | RegExp>;
1817
+ managedPaths?: Array<string | RegExp>;
1818
+ };
1819
+ storage?: {
1820
+ type: "filesystem";
1821
+ directory?: string;
1822
+ };
1823
+ };
1824
+ /**
1825
+ * Options for future Rspack features.
1826
+ */
1827
+ export type RspackFutureOptions = {
1828
+ /**
1829
+ * Information about the bundler.
1830
+ */
1831
+ bundlerInfo?: {
1832
+ /**
1833
+ * Version of the bundler.
1834
+ */
1835
+ version?: string;
1836
+ /**
1837
+ * Name of the bundler.
1838
+ */
1839
+ bundler?: string;
1840
+ /**
1841
+ * Force specific features.
1842
+ */
1843
+ force?: boolean | ("version" | "uniqueId")[];
1844
+ };
1845
+ };
1846
+ /**
1847
+ * Options for lazy compilation.
1848
+ */
1849
+ export type LazyCompilationOptions = {
1850
+ /**
1851
+ * Enable lazy compilation for dynamic imports.
1852
+ * @default true
1853
+ */
1854
+ imports?: boolean;
1855
+ /**
1856
+ * Enable lazy compilation for entries.
1857
+ * @default true
1858
+ */
1859
+ entries?: boolean;
1860
+ /**
1861
+ * Test function or regex to determine which modules to include.
1862
+ */
1863
+ test?: RegExp | ((module: Module) => boolean);
1864
+ /**
1865
+ * The path to a custom runtime code that overrides the default lazy
1866
+ * compilation client. If you want to customize the logic of the client
1867
+ * runtime, you can specify it through this option.
1868
+ */
1869
+ client?: string;
1870
+ /**
1871
+ * Tells the client the server URL that needs to be requested.
1872
+ * By default it is empty, in a browser environment it will find
1873
+ * the server path where the page is located, but in a node
1874
+ * environment you need to explicitly specify a specific path.
1875
+ */
1876
+ serverUrl?: string;
1877
+ /**
1878
+ * Customize the prefix used for lazy compilation endpoint.
1879
+ * @default "/lazy-compilation-using-"
1880
+ */
1881
+ prefix?: string;
1882
+ };
1883
+ /**
1884
+ * Options for incremental builds.
1885
+ */
1886
+ export type Incremental = {
1887
+ /**
1888
+ * Warning if there are cases that not friendly for incremental
1889
+ */
1890
+ silent?: boolean;
1891
+ /**
1892
+ * Enable incremental make.
1893
+ */
1894
+ make?: boolean;
1895
+ /**
1896
+ * Enable inference of async modules.
1897
+ */
1898
+ inferAsyncModules?: boolean;
1899
+ /**
1900
+ * Enable incremental provided exports.
1901
+ */
1902
+ providedExports?: boolean;
1903
+ /**
1904
+ * Enables diagnostics for dependencies.
1905
+ */
1906
+ dependenciesDiagnostics?: boolean;
1907
+ /**
1908
+ * Enables incremental side effects optimization.
1909
+ */
1910
+ sideEffects?: boolean;
1911
+ /**
1912
+ * Enable incremental build chunk graph.
1913
+ */
1914
+ buildChunkGraph?: boolean;
1915
+ /**
1916
+ * Enable incremental module ids.
1917
+ */
1918
+ moduleIds?: boolean;
1919
+ /**
1920
+ * Enable incremental chunk ids.
1921
+ */
1922
+ chunkIds?: boolean;
1923
+ /**
1924
+ * Enable incremental module hashes.
1925
+ */
1926
+ modulesHashes?: boolean;
1927
+ /**
1928
+ * Enable incremental module code generation.
1929
+ */
1930
+ modulesCodegen?: boolean;
1931
+ /**
1932
+ * Enable incremental module runtime requirements.
1933
+ */
1934
+ modulesRuntimeRequirements?: boolean;
1935
+ /**
1936
+ * Enable incremental chunk runtime requirements.
1937
+ */
1938
+ chunksRuntimeRequirements?: boolean;
1939
+ /**
1940
+ * Enable incremental chunk hashes.
1941
+ */
1942
+ chunksHashes?: boolean;
1943
+ /**
1944
+ * Enable incremental chunk render.
1945
+ */
1946
+ chunksRender?: boolean;
1947
+ /**
1948
+ * Enable incremental asset emission.
1949
+ */
1950
+ emitAssets?: boolean;
1951
+ };
1952
+ /**
1953
+ * Presets for incremental
1954
+ */
1955
+ export type IncrementalPresets = boolean | "none" | "safe" | "advance" | "advance-silent";
1956
+ /**
1957
+ * Options for experiments.buildHttp
1958
+ */
1959
+ export type HttpUriOptions = HttpUriPluginOptions;
1960
+ /**
1961
+ * Options for experiments.useInputFileSystem
1962
+ */
1963
+ export type UseInputFileSystem = false | RegExp[];
1964
+ /**
1965
+ * Experimental features configuration.
1966
+ */
1967
+ export type Experiments = {
1968
+ /**
1969
+ * Enable new cache.
1970
+ */
1971
+ cache?: ExperimentCacheOptions;
1972
+ /**
1973
+ * Enable lazy compilation.
1974
+ * @default false
1975
+ */
1976
+ lazyCompilation?: boolean | LazyCompilationOptions;
1977
+ /**
1978
+ * Enable async WebAssembly.
1979
+ * Support the new WebAssembly according to the [updated specification](https://github.com/WebAssembly/esm-integration), it makes a WebAssembly module an async module.
1980
+ * @default false
1981
+ */
1982
+ asyncWebAssembly?: boolean;
1983
+ /**
1984
+ * Enable output as ES module.
1985
+ * @default false
1986
+ */
1987
+ outputModule?: boolean;
1988
+ /**
1989
+ * Enable top-level await.
1990
+ * @default true
1991
+ */
1992
+ topLevelAwait?: boolean;
1993
+ /**
1994
+ * Enable CSS support.
1995
+ *
1996
+ * @description
1997
+ * Once enabled, Rspack will enable native CSS support, and CSS related parser and generator options.
1998
+ * - `module.parser["css/auto"]`
1999
+ * - `module.parser.css`
2000
+ * - `module.parser["css/module"]`
2001
+ * - `module.generator["css/auto"]`
2002
+ * - `module.generator.css`
2003
+ * - `module.generator["css/module"]`
2004
+ */
2005
+ css?: boolean;
2006
+ /**
2007
+ * Enable module layers feature.
2008
+ * @default false
2009
+ */
2010
+ layers?: boolean;
2011
+ /**
2012
+ * Enable incremental builds.
2013
+ */
2014
+ incremental?: IncrementalPresets | Incremental;
2015
+ /**
2016
+ * Enable multi-threaded code splitting algorithm.
2017
+ */
2018
+ parallelCodeSplitting?: boolean;
2019
+ /**
2020
+ * Enable future default options.
2021
+ * @default false
2022
+ */
2023
+ futureDefaults?: boolean;
2024
+ /**
2025
+ * Enable future Rspack features default options.
2026
+ */
2027
+ rspackFuture?: RspackFutureOptions;
2028
+ /**
2029
+ * Enable loading of modules via HTTP/HTTPS requests.
2030
+ * @default false
2031
+ */
2032
+ buildHttp?: HttpUriOptions;
2033
+ /**
2034
+ * Enable parallel loader
2035
+ * @default false
2036
+ */
2037
+ parallelLoader?: boolean;
2038
+ /**
2039
+ * Enable Node.js input file system
2040
+ * @default false
2041
+ */
2042
+ useInputFileSystem?: UseInputFileSystem;
2043
+ /**
2044
+ * Enable inline const feature
2045
+ * @default false
2046
+ */
2047
+ inlineConst?: boolean;
2048
+ /**
2049
+ * Enable native watcher
2050
+ * @default false
2051
+ */
2052
+ nativeWatcher?: boolean;
2053
+ /**
2054
+ * Enable inline enum feature
2055
+ * @default false
2056
+ */
2057
+ inlineEnum?: boolean;
2058
+ /**
2059
+ * Enable type reexports presence feature
2060
+ * @default false
2061
+ */
2062
+ typeReexportsPresence?: boolean;
2063
+ };
2064
+ export type Watch = boolean;
2065
+ /** Options for watch mode. */
2066
+ export type WatchOptions = {
2067
+ /**
2068
+ * Add a delay before rebuilding once the first file changed.
2069
+ * This allows webpack to aggregate any other changes made during this time period into one rebuild.
2070
+ * @default 5
2071
+ */
2072
+ aggregateTimeout?: number;
2073
+ /**
2074
+ * Follow symlinks while looking for files.
2075
+ * This is usually not needed as webpack already resolves symlinks ('resolve.symlinks' and 'resolve.alias').
2076
+ */
2077
+ followSymlinks?: boolean;
2078
+ /**
2079
+ * Ignore some files from being watched.
2080
+ */
2081
+ ignored?: string | RegExp | string[];
2082
+ /**
2083
+ * Turn on polling by passing true, or specifying a poll interval in milliseconds.
2084
+ * @default false
2085
+ */
2086
+ poll?: number | boolean;
2087
+ /**
2088
+ * Stop watching when stdin stream has ended.
2089
+ */
2090
+ stdin?: boolean;
2091
+ };
2092
+ /**
2093
+ * Options for devServer, it based on `webpack-dev-server@5`
2094
+ * */
2095
+ export interface DevServer extends DevServerOptions {
2096
+ }
2097
+ export type { Middleware as DevServerMiddleware } from "./devServer";
2098
+ /**
2099
+ * Ignore specific warnings.
2100
+ */
2101
+ export type IgnoreWarnings = (RegExp | {
2102
+ /**
2103
+ * A RegExp to select the origin file for the warning.
2104
+ */
2105
+ file?: RegExp;
2106
+ /**
2107
+ * A RegExp to select the warning message.
2108
+ */
2109
+ message?: RegExp;
2110
+ /**
2111
+ * A RegExp to select the origin module for the warning.
2112
+ */
2113
+ module?: RegExp;
2114
+ } | ((warning: WebpackError, compilation: Compilation) => boolean))[];
2115
+ /**
2116
+ * Capture a "profile" of the application, including statistics and hints, which can then be dissected using the Analyze tool.
2117
+ * */
2118
+ export type Profile = boolean;
2119
+ /**
2120
+ * Set the value of `require.amd` and `define.amd`. Or disable AMD support.
2121
+ */
2122
+ export type Amd = false | Record<string, any>;
2123
+ /**
2124
+ * Fail out on the first error instead of tolerating it.
2125
+ * @default false
2126
+ * */
2127
+ export type Bail = boolean;
2128
+ /** Options to control how Rspack notifies you of assets and entry points that exceed a specific file limit. */
2129
+ export type Performance = false | {
2130
+ /**
2131
+ * Filter function to select assets that are checked.
2132
+ */
2133
+ assetFilter?: (assetFilename: string) => boolean;
2134
+ /**
2135
+ * Sets the format of the hints: warnings, errors or nothing at all.
2136
+ */
2137
+ hints?: false | "warning" | "error";
2138
+ /**
2139
+ * File size limit (in bytes) when exceeded, that webpack will provide performance hints.
2140
+ * @default 250000
2141
+ */
2142
+ maxAssetSize?: number;
2143
+ /**
2144
+ * Total size of an entry point (in bytes).
2145
+ * @default 250000
2146
+ */
2147
+ maxEntrypointSize?: number;
2148
+ };
2149
+ export type RspackOptions = {
2150
+ /**
2151
+ * The name of the Rspack configuration.
2152
+ */
2153
+ name?: Name;
2154
+ /**
2155
+ * An array of dependencies required by the project.
2156
+ */
2157
+ dependencies?: Dependencies;
2158
+ /**
2159
+ * Configuration files to extend from. The configurations are merged from right to left,
2160
+ * with the rightmost configuration taking precedence(only works when using @rspack/cli).
2161
+ */
2162
+ extends?: string | string[];
2163
+ /**
2164
+ * The entry point of the application.
2165
+ */
2166
+ entry?: Entry;
2167
+ /**
2168
+ * Configuration for the output of the compilation.
2169
+ */
2170
+ output?: Output;
2171
+ /**
2172
+ * The environment in which the code should run.
2173
+ */
2174
+ target?: Target;
2175
+ /**
2176
+ * The mode in which Rspack should operate.
2177
+ */
2178
+ mode?: Mode;
2179
+ /**
2180
+ * Options for experimental features.
2181
+ */
2182
+ experiments?: Experiments;
2183
+ /**
2184
+ * External libraries that should not be bundled.
2185
+ */
2186
+ externals?: Externals;
2187
+ /**
2188
+ * The type of externals.
2189
+ */
2190
+ externalsType?: ExternalsType;
2191
+ /**
2192
+ * Presets for external libraries.
2193
+ */
2194
+ externalsPresets?: ExternalsPresets;
2195
+ /**
2196
+ * Logging options for infrastructure.
2197
+ */
2198
+ infrastructureLogging?: InfrastructureLogging;
2199
+ /**
2200
+ * Options for caching.
2201
+ */
2202
+ cache?: CacheOptions;
2203
+ /**
2204
+ * The context in which the compilation should occur.
2205
+ */
2206
+ context?: Context;
2207
+ /**
2208
+ * The source map configuration.
2209
+ */
2210
+ devtool?: DevTool;
2211
+ /**
2212
+ * Options for Node.js environment.
2213
+ */
2214
+ node?: Node;
2215
+ /**
2216
+ * Configuration for loaders.
2217
+ */
2218
+ loader?: Loader;
2219
+ /**
2220
+ * Warnings to ignore during compilation.
2221
+ */
2222
+ ignoreWarnings?: IgnoreWarnings;
2223
+ /**
2224
+ * Options for watch mode.
2225
+ */
2226
+ watchOptions?: WatchOptions;
2227
+ /**
2228
+ * Whether to enable watch mode.
2229
+ */
2230
+ watch?: Watch;
2231
+ /**
2232
+ * Options for the stats output.
2233
+ */
2234
+ stats?: StatsValue;
2235
+ /**
2236
+ * Options for snapshotting.
2237
+ */
2238
+ snapshot?: SnapshotOptions;
2239
+ /**
2240
+ * Optimization options.
2241
+ */
2242
+ optimization?: Optimization;
2243
+ /**
2244
+ * Options for resolving modules.
2245
+ */
2246
+ resolve?: ResolveOptions;
2247
+ /**
2248
+ * Options for resolving loader modules.
2249
+ */
2250
+ resolveLoader?: ResolveOptions;
2251
+ /**
2252
+ * Plugins to use during compilation.
2253
+ */
2254
+ plugins?: Plugins;
2255
+ /**
2256
+ * Configuration for the development server.
2257
+ */
2258
+ devServer?: DevServer;
2259
+ /**
2260
+ * Options for module configuration.
2261
+ */
2262
+ module?: ModuleOptions;
2263
+ /**
2264
+ * Whether to capture a profile of the application.
2265
+ */
2266
+ profile?: Profile;
2267
+ /**
2268
+ * Set the value of `require.amd` or `define.amd`.
2269
+ * Setting `amd` to false will disable rspack's AMD support.
2270
+ */
2271
+ amd?: Amd;
2272
+ /**
2273
+ * Whether to fail on the first error.
2274
+ */
2275
+ bail?: Bail;
2276
+ /**
2277
+ * Performance optimization options.
2278
+ */
2279
+ performance?: Performance;
2280
+ };
2281
+ /** Configuration for Rspack */
2282
+ export type Configuration = RspackOptions;