@rspack/core 1.0.9 → 1.0.11

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 (219) hide show
  1. package/dist/Dependency.d.ts +7 -6
  2. package/dist/Module.d.ts +19 -17
  3. package/dist/builtin-plugin/css-extract/utils.d.ts +1 -0
  4. package/dist/config/types.d.ts +545 -0
  5. package/dist/config/zod.d.ts +202 -1347
  6. package/dist/cssExtractHmr.js +224 -0
  7. package/dist/cssExtractLoader.js +277 -0
  8. package/dist/index.js +23347 -31
  9. package/dist/{builtin-plugin/css-extract/hmr/hotModuleReplacement.d.ts → runtime/cssExtractHmr.d.ts} +1 -0
  10. package/dist/runtime/moduleFederationDefaultRuntime.d.ts +2 -0
  11. package/dist/stats/statsFactoryUtils.d.ts +1 -0
  12. package/package.json +8 -5
  13. package/compiled/json-parse-even-better-errors/index.d.ts +0 -1
  14. package/compiled/json-parse-even-better-errors/index.js +0 -193
  15. package/compiled/json-parse-even-better-errors/package.json +0 -1
  16. package/compiled/neo-async/index.d.ts +0 -685
  17. package/compiled/neo-async/index.js +0 -9207
  18. package/compiled/neo-async/license +0 -22
  19. package/compiled/neo-async/package.json +0 -1
  20. package/compiled/zod-validation-error/index.d.ts +0 -41
  21. package/compiled/zod-validation-error/index.js +0 -335
  22. package/compiled/zod-validation-error/license +0 -9
  23. package/compiled/zod-validation-error/package.json +0 -1
  24. package/dist/Chunk.js +0 -118
  25. package/dist/ChunkGraph.js +0 -27
  26. package/dist/ChunkGroup.js +0 -76
  27. package/dist/Compilation.js +0 -854
  28. package/dist/Compiler.js +0 -920
  29. package/dist/ContextModuleFactory.js +0 -36
  30. package/dist/DependenciesBlock.js +0 -30
  31. package/dist/Dependency.js +0 -32
  32. package/dist/Entrypoint.js +0 -21
  33. package/dist/ErrorHelpers.js +0 -62
  34. package/dist/ExecuteModulePlugin.js +0 -46
  35. package/dist/FileSystem.js +0 -34
  36. package/dist/FileSystemInfo.js +0 -2
  37. package/dist/Module.js +0 -143
  38. package/dist/ModuleTypeConstants.js +0 -92
  39. package/dist/MultiCompiler.js +0 -440
  40. package/dist/MultiStats.js +0 -161
  41. package/dist/MultiWatching.js +0 -62
  42. package/dist/NormalModule.js +0 -97
  43. package/dist/NormalModuleFactory.js +0 -43
  44. package/dist/Resolver.js +0 -39
  45. package/dist/ResolverFactory.js +0 -61
  46. package/dist/RspackError.js +0 -21
  47. package/dist/RuleSetCompiler.js +0 -10
  48. package/dist/RuntimeGlobals.js +0 -357
  49. package/dist/RuntimeModule.js +0 -58
  50. package/dist/Stats.js +0 -161
  51. package/dist/Template.js +0 -206
  52. package/dist/Watching.js +0 -290
  53. package/dist/builtin-loader/index.js +0 -17
  54. package/dist/builtin-loader/lightningcss/index.js +0 -175
  55. package/dist/builtin-loader/swc/index.js +0 -5
  56. package/dist/builtin-loader/swc/pluginImport.js +0 -35
  57. package/dist/builtin-loader/swc/react.js +0 -7
  58. package/dist/builtin-loader/swc/types.js +0 -2
  59. package/dist/builtin-plugin/APIPlugin.js +0 -6
  60. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.js +0 -6
  61. package/dist/builtin-plugin/AssetModulesPlugin.js +0 -6
  62. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.js +0 -6
  63. package/dist/builtin-plugin/BannerPlugin.js +0 -22
  64. package/dist/builtin-plugin/BundlerInfoRspackPlugin.js +0 -12
  65. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.js +0 -6
  66. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.js +0 -6
  67. package/dist/builtin-plugin/ContextReplacementPlugin.js +0 -43
  68. package/dist/builtin-plugin/CopyRspackPlugin.js +0 -21
  69. package/dist/builtin-plugin/CssModulesPlugin.js +0 -6
  70. package/dist/builtin-plugin/DataUriPlugin.js +0 -6
  71. package/dist/builtin-plugin/DefinePlugin.js +0 -44
  72. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.js +0 -6
  73. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.js +0 -6
  74. package/dist/builtin-plugin/DynamicEntryPlugin.js +0 -36
  75. package/dist/builtin-plugin/ElectronTargetPlugin.js +0 -6
  76. package/dist/builtin-plugin/EnableChunkLoadingPlugin.js +0 -6
  77. package/dist/builtin-plugin/EnableLibraryPlugin.js +0 -39
  78. package/dist/builtin-plugin/EnableWasmLoadingPlugin.js +0 -6
  79. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.js +0 -6
  80. package/dist/builtin-plugin/EntryPlugin.js +0 -34
  81. package/dist/builtin-plugin/EvalDevToolModulePlugin.js +0 -6
  82. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.js +0 -16
  83. package/dist/builtin-plugin/ExternalsPlugin.js +0 -51
  84. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.js +0 -6
  85. package/dist/builtin-plugin/FileUriPlugin.js +0 -6
  86. package/dist/builtin-plugin/FlagDependencyExportsPlugin.js +0 -6
  87. package/dist/builtin-plugin/FlagDependencyUsagePlugin.js +0 -6
  88. package/dist/builtin-plugin/HotModuleReplacementPlugin.js +0 -18
  89. package/dist/builtin-plugin/HtmlRspackPlugin.js +0 -285
  90. package/dist/builtin-plugin/HttpExternalsRspackPlugin.js +0 -11
  91. package/dist/builtin-plugin/IgnorePlugin.js +0 -20
  92. package/dist/builtin-plugin/InferAsyncModulesPlugin.js +0 -6
  93. package/dist/builtin-plugin/JavascriptModulesPlugin.js +0 -55
  94. package/dist/builtin-plugin/JsLoaderRspackPlugin.js +0 -9
  95. package/dist/builtin-plugin/JsonModulesPlugin.js +0 -6
  96. package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +0 -30
  97. package/dist/builtin-plugin/LimitChunkCountPlugin.js +0 -8
  98. package/dist/builtin-plugin/MangleExportsPlugin.js +0 -6
  99. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.js +0 -6
  100. package/dist/builtin-plugin/ModuleChunkFormatPlugin.js +0 -6
  101. package/dist/builtin-plugin/ModuleConcatenationPlugin.js +0 -6
  102. package/dist/builtin-plugin/NamedChunkIdsPlugin.js +0 -6
  103. package/dist/builtin-plugin/NamedModuleIdsPlugin.js +0 -6
  104. package/dist/builtin-plugin/NaturalChunkIdsPlugin.js +0 -6
  105. package/dist/builtin-plugin/NaturalModuleIdsPlugin.js +0 -6
  106. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.js +0 -6
  107. package/dist/builtin-plugin/NodeTargetPlugin.js +0 -6
  108. package/dist/builtin-plugin/ProgressPlugin.js +0 -15
  109. package/dist/builtin-plugin/ProvidePlugin.js +0 -14
  110. package/dist/builtin-plugin/RealContentHashPlugin.js +0 -6
  111. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.js +0 -6
  112. package/dist/builtin-plugin/RuntimeChunkPlugin.js +0 -6
  113. package/dist/builtin-plugin/RuntimePlugin.js +0 -6
  114. package/dist/builtin-plugin/SideEffectsFlagPlugin.js +0 -6
  115. package/dist/builtin-plugin/SizeLimitsPlugin.js +0 -9
  116. package/dist/builtin-plugin/SourceMapDevToolPlugin.js +0 -14
  117. package/dist/builtin-plugin/SplitChunksPlugin.js +0 -92
  118. package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +0 -80
  119. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.js +0 -6
  120. package/dist/builtin-plugin/WebWorkerTemplatePlugin.js +0 -6
  121. package/dist/builtin-plugin/WorkerPlugin.js +0 -31
  122. package/dist/builtin-plugin/base.js +0 -58
  123. package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +0 -182
  124. package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.d.ts +0 -2
  125. package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.js +0 -31
  126. package/dist/builtin-plugin/css-extract/index.js +0 -105
  127. package/dist/builtin-plugin/css-extract/loader.js +0 -204
  128. package/dist/builtin-plugin/css-extract/utils.js +0 -51
  129. package/dist/builtin-plugin/index.js +0 -84
  130. package/dist/builtin-plugin/lazy-compilation/backend.js +0 -139
  131. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.js +0 -6
  132. package/dist/builtin-plugin/lazy-compilation/plugin.js +0 -60
  133. package/dist/config/adapter.js +0 -691
  134. package/dist/config/adapterRuleUse.js +0 -107
  135. package/dist/config/browserslistTargetHandler.js +0 -345
  136. package/dist/config/defaults.js +0 -876
  137. package/dist/config/index.js +0 -20
  138. package/dist/config/normalization.js +0 -299
  139. package/dist/config/target.js +0 -318
  140. package/dist/config/types.js +0 -3
  141. package/dist/config/zod.js +0 -1028
  142. package/dist/container/ContainerPlugin.js +0 -50
  143. package/dist/container/ContainerReferencePlugin.js +0 -49
  144. package/dist/container/ModuleFederationPlugin.js +0 -137
  145. package/dist/container/ModuleFederationPluginV1.js +0 -63
  146. package/dist/container/ModuleFederationRuntimePlugin.js +0 -6
  147. package/dist/container/options.js +0 -48
  148. package/dist/error/ConcurrentCompilationError.js +0 -20
  149. package/dist/exports.js +0 -183
  150. package/dist/lib/AbstractMethodError.js +0 -51
  151. package/dist/lib/Cache.js +0 -111
  152. package/dist/lib/CacheFacade.js +0 -321
  153. package/dist/lib/Dependency.js +0 -11
  154. package/dist/lib/EntryOptionPlugin.js +0 -89
  155. package/dist/lib/EnvironmentPlugin.js +0 -57
  156. package/dist/lib/HookWebpackError.js +0 -83
  157. package/dist/lib/IgnoreWarningsPlugin.js +0 -35
  158. package/dist/lib/LoaderOptionsPlugin.js +0 -74
  159. package/dist/lib/LoaderTargetPlugin.js +0 -37
  160. package/dist/lib/ModuleFilenameHelpers.js +0 -83
  161. package/dist/lib/NormalModuleReplacementPlugin.js +0 -85
  162. package/dist/lib/WebpackError.js +0 -20
  163. package/dist/lib/cache/MemoryCachePlugin.js +0 -40
  164. package/dist/lib/cache/getLazyHashedEtag.js +0 -73
  165. package/dist/lib/cache/mergeEtags.js +0 -74
  166. package/dist/lib/formatLocation.js +0 -64
  167. package/dist/loader-runner/LoaderLoadingError.js +0 -19
  168. package/dist/loader-runner/index.js +0 -735
  169. package/dist/loader-runner/loadLoader.js +0 -64
  170. package/dist/logging/Logger.js +0 -143
  171. package/dist/logging/createConsoleLogger.js +0 -176
  172. package/dist/logging/runtime.js +0 -37
  173. package/dist/logging/truncateArgs.js +0 -81
  174. package/dist/node/NodeEnvironmentPlugin.js +0 -50
  175. package/dist/node/NodeTemplatePlugin.js +0 -26
  176. package/dist/node/NodeWatchFileSystem.js +0 -144
  177. package/dist/node/nodeConsole.js +0 -146
  178. package/dist/rspack.js +0 -123
  179. package/dist/rspackOptionsApply.js +0 -274
  180. package/dist/sharing/ConsumeSharedPlugin.js +0 -69
  181. package/dist/sharing/ProvideSharedPlugin.js +0 -50
  182. package/dist/sharing/SharePlugin.js +0 -66
  183. package/dist/sharing/ShareRuntimePlugin.js +0 -26
  184. package/dist/sharing/utils.js +0 -8
  185. package/dist/stats/DefaultStatsFactoryPlugin.js +0 -1173
  186. package/dist/stats/DefaultStatsPresetPlugin.js +0 -305
  187. package/dist/stats/DefaultStatsPrinterPlugin.js +0 -1069
  188. package/dist/stats/StatsFactory.js +0 -167
  189. package/dist/stats/StatsPrinter.js +0 -142
  190. package/dist/stats/statsFactoryUtils.js +0 -341
  191. package/dist/util/ArrayQueue.js +0 -108
  192. package/dist/util/AssetInfo.js +0 -39
  193. package/dist/util/IterableHelpers.js +0 -35
  194. package/dist/util/MergeCaller.js +0 -24
  195. package/dist/util/SizeFormatHelpers.js +0 -24
  196. package/dist/util/SplitChunkSize.js +0 -18
  197. package/dist/util/assertNotNil.js +0 -9
  198. package/dist/util/assetCondition.js +0 -2
  199. package/dist/util/bindingVersionCheck.js +0 -124
  200. package/dist/util/cleverMerge.js +0 -504
  201. package/dist/util/comparators.js +0 -108
  202. package/dist/util/createHash.js +0 -161
  203. package/dist/util/createReadonlyMap.js +0 -29
  204. package/dist/util/fake.js +0 -28
  205. package/dist/util/fs.js +0 -120
  206. package/dist/util/hash/BatchedHash.js +0 -69
  207. package/dist/util/hash/index.js +0 -39
  208. package/dist/util/hash/md4.js +0 -27
  209. package/dist/util/hash/wasm-hash.js +0 -167
  210. package/dist/util/hash/xxhash64.js +0 -27
  211. package/dist/util/identifier.js +0 -330
  212. package/dist/util/index.js +0 -123
  213. package/dist/util/memoize.js +0 -61
  214. package/dist/util/scheme.js +0 -57
  215. package/dist/util/smartGrouping.js +0 -148
  216. package/dist/util/source.js +0 -42
  217. package/dist/util/validate.js +0 -77
  218. package/dist/util/webpack.js +0 -27
  219. /package/dist/{container/default.runtime.js → moduleFederationDefaultRuntime.js} +0 -0
@@ -1,8 +1,9 @@
1
- import type { DependencyDTO } from "@rspack/binding";
1
+ import { type JsDependency, JsDependencyMut } from "@rspack/binding";
2
2
  export declare class Dependency {
3
- #private;
4
- constructor(binding: DependencyDTO);
5
- get type(): string;
6
- get category(): string;
7
- get request(): string | undefined;
3
+ readonly type: string;
4
+ readonly category: string;
5
+ readonly request: string | undefined;
6
+ critical: boolean;
7
+ static __from_binding(binding: JsDependencyMut | JsDependency): Dependency;
8
+ private constructor();
8
9
  }
package/dist/Module.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import type { JsCodegenerationResult, JsContextModuleFactoryAfterResolveData, JsCreateData, JsFactoryMeta, JsModule, ModuleDTO } from "@rspack/binding";
1
+ import type { JsCodegenerationResult, JsContextModuleFactoryAfterResolveData, JsContextModuleFactoryBeforeResolveData, JsCreateData, JsFactoryMeta, JsModule, ModuleDTO } from "@rspack/binding";
2
2
  import type { Source } from "../compiled/webpack-sources";
3
3
  import type { Compilation } from "./Compilation";
4
4
  import { DependenciesBlock } from "./DependenciesBlock";
5
- import type { Dependency } from "./Dependency";
5
+ import { Dependency } from "./Dependency";
6
6
  export type ResourceData = {
7
7
  resource: string;
8
8
  path: string;
@@ -25,26 +25,28 @@ export type ResolveData = {
25
25
  contextDependencies: string[];
26
26
  createData?: CreateData;
27
27
  };
28
- export type ContextModuleFactoryBeforeResolveResult = false | {
28
+ export declare class ContextModuleFactoryBeforeResolveData {
29
+ #private;
29
30
  context: string;
30
- request?: string;
31
- };
31
+ request: string;
32
+ regExp: RegExp | undefined;
33
+ recursive: boolean;
34
+ static __from_binding(binding: JsContextModuleFactoryBeforeResolveData): ContextModuleFactoryBeforeResolveData;
35
+ static __to_binding(data: ContextModuleFactoryBeforeResolveData): JsContextModuleFactoryBeforeResolveData;
36
+ private constructor();
37
+ }
38
+ export type ContextModuleFactoryBeforeResolveResult = false | ContextModuleFactoryBeforeResolveData;
32
39
  export declare class ContextModuleFactoryAfterResolveData {
33
40
  #private;
41
+ resource: number;
42
+ context: string;
43
+ request: string;
44
+ regExp: RegExp | undefined;
45
+ recursive: boolean;
46
+ readonly dependencies: Dependency[];
34
47
  static __from_binding(binding: JsContextModuleFactoryAfterResolveData): ContextModuleFactoryAfterResolveData;
35
48
  static __to_binding(data: ContextModuleFactoryAfterResolveData): JsContextModuleFactoryAfterResolveData;
36
- constructor(data: JsContextModuleFactoryAfterResolveData);
37
- get resource(): string;
38
- set resource(val: string);
39
- get context(): string;
40
- set context(val: string);
41
- get request(): string;
42
- set request(val: string);
43
- get regExp(): RegExp | undefined;
44
- set regExp(val: RegExp | undefined);
45
- get recursive(): boolean;
46
- set recursive(val: boolean);
47
- get dependencies(): Dependency[];
49
+ private constructor();
48
50
  }
49
51
  export type ContextModuleFactoryAfterResolveResult = false | ContextModuleFactoryAfterResolveData;
50
52
  export declare class Module {
@@ -1,5 +1,6 @@
1
1
  import type { LoaderContext } from "../..";
2
2
  export declare function isAbsolutePath(str: string): boolean;
3
+ export declare const PLUGIN_NAME = "css-extract-rspack-plugin";
3
4
  export declare function isRelativePath(str: string): boolean;
4
5
  export declare function stringifyRequest(loaderContext: LoaderContext, request: string): string;
5
6
  export declare function stringifyLocal(value: any): any;
@@ -1,5 +1,8 @@
1
1
  import type { JsAssetInfo } from "@rspack/binding";
2
2
  import type { PathData } from "../Compilation";
3
+ import type { Compiler } from "../Compiler";
4
+ import type { Module } from "../Module";
5
+ import type { Chunk } from "../exports";
3
6
  export type FilenameTemplate = string;
4
7
  export type Filename = FilenameTemplate | ((pathData: PathData, assetInfo?: JsAssetInfo) => string);
5
8
  /** Name of the configuration. Used when loading multiple configurations. */
@@ -124,6 +127,315 @@ export type EntryStatic = EntryObject | EntryUnnamed;
124
127
  export type EntryDynamic = () => EntryStatic | Promise<EntryStatic>;
125
128
  /** The entry options for building */
126
129
  export type Entry = EntryStatic | EntryDynamic;
130
+ /** The output directory as an absolute path. */
131
+ export type Path = string;
132
+ /** Tells Rspack to include comments in bundles with information about the contained modules. */
133
+ export type Pathinfo = boolean | "verbose";
134
+ /** Before generating the products, delete all files in the output directory. */
135
+ export type AssetModuleFilename = Filename;
136
+ /** Specifies the filename of WebAssembly modules. */
137
+ export type WebassemblyModuleFilename = string;
138
+ /** This option determines the name of non-initial chunk files. */
139
+ export type ChunkFilename = Filename;
140
+ /** Allows you to set the [crossorigin attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) */
141
+ export type CrossOriginLoading = false | "anonymous" | "use-credentials";
142
+ /** This option determines the name of CSS output files on disk. */
143
+ export type CssFilename = Filename;
144
+ /** This option determines the name of non-initial CSS output files on disk. */
145
+ export type CssChunkFilename = Filename;
146
+ /** Customize the filenames of hot update chunks. */
147
+ export type HotUpdateChunkFilename = FilenameTemplate;
148
+ /** Customize the main hot update filename. */
149
+ export type HotUpdateMainFilename = FilenameTemplate;
150
+ /** Which uses JSONP for loading hot updates. */
151
+ export type HotUpdateGlobal = string;
152
+ /** A unique name of the Rspack build */
153
+ export type UniqueName = string;
154
+ /** The global variable is used by Rspack for loading chunks. */
155
+ export type ChunkLoadingGlobal = string;
156
+ /** List of library types enabled for use by entry points. */
157
+ export type EnabledLibraryTypes = string[];
158
+ /** Whether delete all files in the output directory. */
159
+ export type Clean = boolean;
160
+ /** Output JavaScript files as module type. */
161
+ export type OutputModule = boolean;
162
+ /** Tell Rspack to remove a module from the module instance cache (require.cache) if it throws an exception when it is required. */
163
+ export type StrictModuleExceptionHandling = boolean;
164
+ /** Handle error in module loading as per EcmaScript Modules spec at a performance cost. */
165
+ export type StrictModuleErrorHandling = boolean;
166
+ /** Indicates what global object will be used to mount the library. */
167
+ export type GlobalObject = string;
168
+ /** List of wasm loading types enabled for use by entry points. */
169
+ export type EnabledWasmLoadingTypes = string[];
170
+ /** The name of the native import() function. */
171
+ export type ImportFunctionName = string;
172
+ /** The name of the native import.meta object. */
173
+ export type ImportMetaName = string;
174
+ /** Tells Rspack to add IIFE wrapper around emitted code. */
175
+ export type Iife = boolean;
176
+ /** List of chunk loading types enabled for use by entry points. */
177
+ export type EnabledChunkLoadingTypes = string[];
178
+ /** The format of chunks */
179
+ export type ChunkFormat = string | false;
180
+ /** Set a public path for Worker. */
181
+ export type WorkerPublicPath = string;
182
+ /** Controls [Trusted Types](https://web.dev/articles/trusted-types) compatibility. */
183
+ export type TrustedTypes = {
184
+ policyName?: string;
185
+ };
186
+ /** The encoding to use when generating the hash. */
187
+ export type HashDigest = string;
188
+ /** The prefix length of the hash digest to use. */
189
+ export type HashDigestLength = number;
190
+ /** The hashing algorithm to use. */
191
+ export type HashFunction = "md4" | "xxhash64";
192
+ /** An optional salt to update the hash. */
193
+ export type HashSalt = string;
194
+ /** Configure how source maps are named. */
195
+ export type SourceMapFilename = string;
196
+ /** This option determines the module's namespace */
197
+ export type DevtoolNamespace = string;
198
+ /** This option is only used when devtool uses an option that requires module names. */
199
+ export type DevtoolModuleFilenameTemplate = string | ((info: any) => any);
200
+ /** A fallback is used when the template string or function above yields duplicates. */
201
+ export type DevtoolFallbackModuleFilenameTemplate = DevtoolModuleFilenameTemplate;
202
+ /** Tell Rspack what kind of ES-features may be used in the generated runtime-code. */
203
+ export type Environment = {
204
+ /** The environment supports arrow functions ('() => { ... }'). */
205
+ arrowFunction?: boolean;
206
+ /** The environment supports async function and await ('async function () { await ... }'). */
207
+ asyncFunction?: boolean;
208
+ /** The environment supports BigInt as literal (123n). */
209
+ bigIntLiteral?: boolean;
210
+ /** The environment supports const and let for variable declarations. */
211
+ const?: boolean;
212
+ /** The environment supports destructuring ('{ a, b } = obj'). */
213
+ destructuring?: boolean;
214
+ /** The environment supports 'document' variable. */
215
+ document?: boolean;
216
+ /** The environment supports an async import() function to import EcmaScript modules. */
217
+ dynamicImport?: boolean;
218
+ /** The environment supports an async import() when creating a worker, only for web targets at the moment. */
219
+ dynamicImportInWorker?: boolean;
220
+ /** The environment supports 'for of' iteration ('for (const x of array) { ... }'). */
221
+ forOf?: boolean;
222
+ /** The environment supports 'globalThis'. */
223
+ globalThis?: boolean;
224
+ /** The environment supports ECMAScript Module syntax to import ECMAScript modules (import ... from '...'). */
225
+ module?: boolean;
226
+ /**
227
+ * Determines if the node: prefix is generated for core module imports in environments that support it.
228
+ * This is only applicable to Webpack runtime code.
229
+ * */
230
+ nodePrefixForCoreModules?: boolean;
231
+ /** The environment supports optional chaining ('obj?.a' or 'obj?.()'). */
232
+ optionalChaining?: boolean;
233
+ /** The environment supports template literals. */
234
+ templateLiteral?: boolean;
235
+ };
236
+ export type Output = {
237
+ /**
238
+ * The output directory as an absolute path.
239
+ * @default path.resolve(process.cwd(), 'dist')
240
+ * */
241
+ path?: Path;
242
+ /**
243
+ * Tells Rspack to include comments in bundles with information about the contained modules.
244
+ * @default true
245
+ */
246
+ pathinfo?: Pathinfo;
247
+ /**
248
+ * Before generating the products, whether delete all files in the output directory.
249
+ * @default false
250
+ * */
251
+ clean?: Clean;
252
+ /** This option determines the URL prefix of the referenced resource, such as: image, file, etc. */
253
+ publicPath?: PublicPath;
254
+ /** This option determines the name of each output bundle. */
255
+ filename?: Filename;
256
+ /** This option determines the name of non-initial chunk files. */
257
+ chunkFilename?: ChunkFilename;
258
+ /** Allows you to set the [crossorigin attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) for dynamically loaded chunks. */
259
+ crossOriginLoading?: CrossOriginLoading;
260
+ /** This option determines the name of CSS output files on disk. */
261
+ cssFilename?: CssFilename;
262
+ /**
263
+ * Rspack adds some metadata in CSS to parse CSS modules, and this configuration determines whether to compress these metadata.
264
+ *
265
+ * The value is `true` in production mode.
266
+ * The value is `false` in development mode.
267
+ * */
268
+ cssHeadDataCompression?: boolean;
269
+ /** This option determines the name of non-initial CSS output files on disk. */
270
+ cssChunkFilename?: CssChunkFilename;
271
+ /**
272
+ * Customize the main hot update filename. [fullhash] and [runtime] are available as placeholder.
273
+ * @default '[runtime].[fullhash].hot-update.json'
274
+ * */
275
+ hotUpdateMainFilename?: HotUpdateMainFilename;
276
+ /**
277
+ * Customize the filenames of hot update chunks.
278
+ * @default '[id].[fullhash].hot-update.js'
279
+ * */
280
+ hotUpdateChunkFilename?: HotUpdateChunkFilename;
281
+ /**
282
+ * Only used when target is set to 'web', which uses JSONP for loading hot updates.
283
+ * @default 'webpackHotUpdate' + output.uniqueName
284
+ * */
285
+ hotUpdateGlobal?: HotUpdateGlobal;
286
+ /**
287
+ * This option determines the name of each asset modules.
288
+ * @default '[hash][ext][query]'
289
+ * */
290
+ assetModuleFilename?: AssetModuleFilename;
291
+ /** A unique name of the Rspack build to avoid multiple Rspack runtimes to conflict when using globals. */
292
+ uniqueName?: UniqueName;
293
+ /**
294
+ * The global variable is used by Rspack for loading chunks.
295
+ * Determined by output.uniqueName default.
296
+ * */
297
+ chunkLoadingGlobal?: ChunkLoadingGlobal;
298
+ /**
299
+ * List of library types enabled for use by entry points.
300
+ * Determined by output.library and Entry default.
301
+ * */
302
+ enabledLibraryTypes?: EnabledLibraryTypes;
303
+ /** Output a library exposing the exports of your entry point. */
304
+ library?: Library;
305
+ /**
306
+ * Specify which export should be exposed as a library.
307
+ * @deprecated We might drop support for this, so prefer to use output.library.export
308
+ * */
309
+ libraryExport?: LibraryExport;
310
+ /**
311
+ * Configure how the library will be exposed.
312
+ * @deprecated Use output.library.type instead as we might drop support for output.libraryTarget in the future.
313
+ * */
314
+ libraryTarget?: LibraryType;
315
+ /**
316
+ * When using output.library.type: "umd", setting output.umdNamedDefine to true will name the AMD module of the UMD build.
317
+ * @deprecated Use output.library.umdNamedDefine instead.
318
+ */
319
+ umdNamedDefine?: UmdNamedDefine;
320
+ /**
321
+ * Add a comment in the UMD wrapper.
322
+ * @deprecated use output.library.auxiliaryComment instead.
323
+ * */
324
+ auxiliaryComment?: AuxiliaryComment;
325
+ /**
326
+ * Output JavaScript files as module type.
327
+ * Disabled by default as it's an experimental feature. To use it, you must set experiments.outputModule to true.
328
+ * @default false
329
+ */
330
+ module?: OutputModule;
331
+ /** Tell Rspack to remove a module from the module instance cache (require.cache) if it throws an exception when it is required. */
332
+ strictModuleExceptionHandling?: StrictModuleExceptionHandling;
333
+ /**
334
+ * Handle error in module loading as per EcmaScript Modules spec at a performance cost.
335
+ * @default false
336
+ * */
337
+ strictModuleErrorHandling?: StrictModuleErrorHandling;
338
+ /**
339
+ * When targeting a library, especially when library.type is 'umd', this option indicates what global object will be used to mount the library.
340
+ * @default 'self'
341
+ */
342
+ globalObject?: GlobalObject;
343
+ /**
344
+ * The name of the native import() function.
345
+ * @default 'import'
346
+ * */
347
+ importFunctionName?: ImportFunctionName;
348
+ /**
349
+ * The name of the native import.meta object (can be exchanged for a polyfill).
350
+ * @default 'import.meta'
351
+ */
352
+ importMetaName?: ImportMetaName;
353
+ /**
354
+ * Tells Rspack to add IIFE wrapper around emitted code.
355
+ * @default true
356
+ */
357
+ iife?: Iife;
358
+ /**
359
+ * Option to set the method of loading WebAssembly Modules.
360
+ * @default 'fetch'
361
+ * */
362
+ wasmLoading?: WasmLoading;
363
+ /** List of wasm loading types enabled for use by entry points. */
364
+ enabledWasmLoadingTypes?: EnabledWasmLoadingTypes;
365
+ /**
366
+ * Specifies the filename of WebAssembly modules.
367
+ * @default '[hash].module.wasm'
368
+ * */
369
+ webassemblyModuleFilename?: WebassemblyModuleFilename;
370
+ /** The format of chunks (formats included by default are 'array-push' (web/webworker), 'commonjs' (node.js), 'module' (ESM). */
371
+ chunkFormat?: ChunkFormat;
372
+ /** 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) */
373
+ chunkLoading?: ChunkLoading;
374
+ /** List of chunk loading types enabled for use by entry points. */
375
+ enabledChunkLoadingTypes?: EnabledChunkLoadingTypes;
376
+ /** Controls [Trusted Types](https://web.dev/articles/trusted-types) compatibility. */
377
+ trustedTypes?: true | string | TrustedTypes;
378
+ /**
379
+ * Configure how source maps are named.
380
+ * Only takes effect when devtool is set to 'source-map', which writes an output file.
381
+ * @default '[file].map[query]'
382
+ * */
383
+ sourceMapFilename?: SourceMapFilename;
384
+ /** The encoding to use when generating the hash. */
385
+ hashDigest?: HashDigest;
386
+ /**
387
+ * The prefix length of the hash digest to use.
388
+ * @default 20
389
+ * */
390
+ hashDigestLength?: HashDigestLength;
391
+ /**
392
+ * The hashing algorithm to use.
393
+ * @default 'md4'
394
+ * */
395
+ hashFunction?: HashFunction;
396
+ /** An optional salt to update the hash. */
397
+ hashSalt?: HashSalt;
398
+ /**
399
+ * Create async chunks that are loaded on demand.
400
+ * @default true
401
+ * */
402
+ asyncChunks?: AsyncChunks;
403
+ /**
404
+ * The new option workerChunkLoading controls the chunk loading of workers.
405
+ * @default false
406
+ * */
407
+ workerChunkLoading?: ChunkLoading;
408
+ /**
409
+ * Option to set the method of loading WebAssembly Modules in workers, defaults to the value of output.wasmLoading.
410
+ * @default false
411
+ * */
412
+ workerWasmLoading?: WasmLoading;
413
+ /** Set a public path for Worker, defaults to value of output.publicPath. */
414
+ workerPublicPath?: WorkerPublicPath;
415
+ /**
416
+ * This option allows loading asynchronous chunks with a custom script type.
417
+ * @default false
418
+ * */
419
+ scriptType?: ScriptType;
420
+ /** This option determines the module's namespace used with the output.devtoolModuleFilenameTemplate */
421
+ devtoolNamespace?: DevtoolNamespace;
422
+ /** This option is only used when devtool uses an option that requires module names. */
423
+ devtoolModuleFilenameTemplate?: DevtoolModuleFilenameTemplate;
424
+ /** A fallback is used when the template string or function above yields duplicates. */
425
+ devtoolFallbackModuleFilenameTemplate?: DevtoolFallbackModuleFilenameTemplate;
426
+ /**
427
+ * The Number of milliseconds before chunk request timed out.
428
+ * @default 120000
429
+ * */
430
+ chunkLoadTimeout?: number;
431
+ /**
432
+ * Add charset="utf-8" to the HTML <script> tag.
433
+ * @default true
434
+ * */
435
+ charset?: boolean;
436
+ /** Tell Rspack what kind of ES-features may be used in the generated runtime-code. */
437
+ environment?: Environment;
438
+ };
127
439
  /**
128
440
  * Path alias
129
441
  * @example
@@ -291,3 +603,236 @@ export type ExternalItem = string | RegExp | ExternalItemObjectUnknown | ((data:
291
603
  * ```
292
604
  * */
293
605
  export type Externals = ExternalItem | ExternalItem[];
606
+ export interface RspackPluginInstance {
607
+ apply: (compiler: Compiler) => void;
608
+ [k: string]: any;
609
+ }
610
+ export type RspackPluginFunction = (this: Compiler, compiler: Compiler) => void;
611
+ export type WebpackCompiler = any;
612
+ export interface WebpackPluginInstance {
613
+ apply: (compiler: WebpackCompiler) => void;
614
+ [k: string]: any;
615
+ }
616
+ export type WebpackPluginFunction = (this: WebpackCompiler, compiler: WebpackCompiler) => void;
617
+ export type Plugin = RspackPluginInstance | RspackPluginFunction | WebpackPluginInstance | WebpackPluginFunction | Falsy;
618
+ export type Plugins = Plugin[];
619
+ /** Used to control how the runtime chunk is generated. */
620
+ export type OptimizationRuntimeChunk = boolean | "single" | "multiple" | {
621
+ name?: string | ((value: {
622
+ name: string;
623
+ }) => string);
624
+ };
625
+ export type OptimizationSplitChunksNameFunction = (module?: Module) => unknown;
626
+ type OptimizationSplitChunksName = string | false | OptimizationSplitChunksNameFunction;
627
+ type OptimizationSplitChunksSizes = number | Record<string, number>;
628
+ type OptimizationSplitChunksChunks = "initial" | "async" | "all" | RegExp | ((chunk: Chunk) => boolean);
629
+ type SharedOptimizationSplitChunksCacheGroup = {
630
+ /**
631
+ * This indicates which chunks will be selected for optimization.
632
+ * @default 'async''
633
+ * */
634
+ chunks?: OptimizationSplitChunksChunks;
635
+ /** Sets the size types which are used when a number is used for sizes. */
636
+ defaultSizeTypes?: string[];
637
+ /**
638
+ * The minimum times must a module be shared among chunks before splitting.
639
+ * @default 1
640
+ */
641
+ minChunks?: number;
642
+ /**
643
+ * Enabling this, the splitting of chunks will be grouped based on the usage of modules exports in different runtimes,
644
+ * ensuring the optimal loading size in each runtime.
645
+ */
646
+ usedExports?: boolean;
647
+ /**
648
+ * The name of the split chunk.
649
+ * @default false
650
+ * */
651
+ name?: false | OptimizationSplitChunksName;
652
+ /**
653
+ * Minimum size, in bytes, for a chunk to be generated.
654
+ *
655
+ * The value is `20000` in production mode.
656
+ * The value is `10000` in others mode.
657
+ */
658
+ minSize?: OptimizationSplitChunksSizes;
659
+ /** Maximum size, in bytes, for a chunk to be generated. */
660
+ maxSize?: OptimizationSplitChunksSizes;
661
+ /** Maximum size, in bytes, for a async chunk to be generated. */
662
+ maxAsyncSize?: OptimizationSplitChunksSizes;
663
+ /** Maximum size, in bytes, for a initial chunk to be generated. */
664
+ maxInitialSize?: OptimizationSplitChunksSizes;
665
+ /**
666
+ * Maximum number of parallel requests when on-demand loading.
667
+ * @default 30
668
+ * */
669
+ maxAsyncRequests?: number;
670
+ /**
671
+ * Maximum number of parallel requests at an entry point.
672
+ * @default 30
673
+ */
674
+ maxInitialRequests?: number;
675
+ /**
676
+ * Tell Rspack what delimiter to use for the generated names.
677
+ *
678
+ * @default '-''
679
+ */
680
+ automaticNameDelimiter?: string;
681
+ };
682
+ /** How to splitting chunks. */
683
+ export type OptimizationSplitChunksCacheGroup = {
684
+ /** Controls which modules are selected by this cache group. */
685
+ test?: string | RegExp | ((module: Module) => unknown);
686
+ /**
687
+ * A module can belong to multiple cache groups.
688
+ * @default -20
689
+ */
690
+ priority?: number;
691
+ /**
692
+ * Tells Rspack to ignore `splitChunks.minSize`, `splitChunks.minChunks`, `splitChunks.maxAsyncRequests` and `splitChunks.maxInitialRequests` options and always create chunks for this cache group.
693
+ */
694
+ enforce?: boolean;
695
+ /** Allows to override the filename when and only when it's an initial chunk. */
696
+ filename?: string;
697
+ /**
698
+ * Whether to reuse existing chunks when possible.
699
+ * @default false
700
+ * */
701
+ reuseExistingChunk?: boolean;
702
+ /** Allows to assign modules to a cache group by module type. */
703
+ type?: string | RegExp;
704
+ /** Sets the hint for chunk id. It will be added to chunk's filename. */
705
+ idHint?: string;
706
+ } & SharedOptimizationSplitChunksCacheGroup;
707
+ /** Tell Rspack how to splitting chunks. */
708
+ export type OptimizationSplitChunksOptions = {
709
+ /**
710
+ * Options for module cache group
711
+ * */
712
+ cacheGroups?: Record<string, false | OptimizationSplitChunksCacheGroup>;
713
+ /**
714
+ * Options for modules not selected by any other group.
715
+ */
716
+ fallbackCacheGroup?: {
717
+ chunks?: OptimizationSplitChunksChunks;
718
+ minSize?: number;
719
+ maxSize?: number;
720
+ maxAsyncSize?: number;
721
+ maxInitialSize?: number;
722
+ automaticNameDelimiter?: string;
723
+ };
724
+ /**
725
+ * Prevents exposing path info when creating names for parts splitted by maxSize.
726
+ *
727
+ * The value is `true` in production mode.
728
+ * The value is `false` in development mode.
729
+ * */
730
+ hidePathInfo?: boolean;
731
+ } & SharedOptimizationSplitChunksCacheGroup;
732
+ export type Optimization = {
733
+ /**
734
+ * Which algorithm to use when choosing module ids.
735
+ */
736
+ moduleIds?: "named" | "natural" | "deterministic";
737
+ /**
738
+ * Which algorithm to use when choosing chunk ids.
739
+ */
740
+ chunkIds?: "natural" | "named" | "deterministic";
741
+ /**
742
+ * Whether to minimize the bundle.
743
+ * The value is `true` in production mode.
744
+ * The value is `false` in development mode.
745
+ */
746
+ minimize?: boolean;
747
+ /**
748
+ * Customize the minimizer.
749
+ * By default, `rspack.SwcJsMinimizerRspackPlugin` and `rspack.LightningCssMinimizerRspackPlugin` are used.
750
+ */
751
+ minimizer?: Array<"..." | Plugin>;
752
+ /**
753
+ * Whether to merge chunks which contain the same modules.
754
+ * Setting optimization.mergeDuplicateChunks to false will disable this optimization.
755
+ * @default true
756
+ */
757
+ mergeDuplicateChunks?: boolean;
758
+ /**
759
+ * Support splitting chunks.
760
+ * It is enabled by default for dynamically imported modules.
761
+ * To turn it off, set it to false.
762
+ * */
763
+ splitChunks?: false | OptimizationSplitChunksOptions;
764
+ /**
765
+ * Used to control how the runtime chunk is generated.
766
+ * Setting it to true or 'multiple' will add an additional chunk containing only the runtime for each entry point.
767
+ * Setting it to 'single' will extract the runtime code of all entry points into a single separate chunk.
768
+ * @default false
769
+ */
770
+ runtimeChunk?: OptimizationRuntimeChunk;
771
+ /** Detect and remove modules from chunks these modules are already included in all parents. */
772
+ removeAvailableModules?: boolean;
773
+ /**
774
+ * Remove empty chunks generated in the compilation.
775
+ * @default true
776
+ * */
777
+ removeEmptyChunks?: boolean;
778
+ /**
779
+ * Adds an additional hash compilation pass after the assets have been processed to get the correct asset content hashes.
780
+ *
781
+ * The value is `true` in production mode.
782
+ * The value is `false` in development mode.
783
+ */
784
+ realContentHash?: boolean;
785
+ /**
786
+ * 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.
787
+ *
788
+ * The value is `true` in production mode.
789
+ * The value is `false` in development mode.
790
+ * */
791
+ sideEffects?: "flag" | boolean;
792
+ /**
793
+ * After enabling, Rspack will analyze which exports the module provides, including re-exported modules.
794
+ * @default true
795
+ * */
796
+ providedExports?: boolean;
797
+ /**
798
+ * Tells Rspack to find segments of the module graph which can be safely concatenated into a single module.
799
+ *
800
+ * The value is `true` in production mode.
801
+ * The value is `false` in development mode.
802
+ */
803
+ concatenateModules?: boolean;
804
+ /**
805
+ * Tells Rspack whether to perform a more detailed analysis of variable assignments.
806
+ *
807
+ * The value is `true` in production mode.
808
+ * The value is `false` in development mode.
809
+ */
810
+ innerGraph?: boolean;
811
+ /**
812
+ * Tells Rspack to determine used exports for each module.
813
+ *
814
+ * The value is `true` in production mode.
815
+ * The value is `false` in development mode.
816
+ * */
817
+ usedExports?: "global" | boolean;
818
+ /**
819
+ * Allows to control export mangling.
820
+ *
821
+ * The value is `isdeterministic` in production mode.
822
+ * The value is `false` in development mode.
823
+ */
824
+ mangleExports?: "size" | "deterministic" | boolean;
825
+ /**
826
+ * Tells Rspack to set process.env.NODE_ENV to a given string value.
827
+ * @default false
828
+ */
829
+ nodeEnv?: string | false;
830
+ /**
831
+ * Emit assets whenever there are errors while compiling.
832
+ *
833
+ * The value is `false` in production mode.
834
+ * The value is `true` in development mode.
835
+ * */
836
+ emitOnErrors?: boolean;
837
+ };
838
+ export {};