@rspack/core 1.7.3 → 2.0.0-alpha.0

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 (211) hide show
  1. package/dist/ChunkGraph.d.ts +1 -1
  2. package/dist/Compilation.d.ts +27 -27
  3. package/dist/Compiler.d.ts +19 -17
  4. package/dist/ContextModuleFactory.d.ts +1 -1
  5. package/dist/Diagnostics.d.ts +1 -1
  6. package/dist/ExecuteModulePlugin.d.ts +1 -1
  7. package/dist/ExportsInfo.d.ts +1 -1
  8. package/dist/FileSystem.d.ts +1 -1
  9. package/dist/Module.d.ts +2 -2
  10. package/dist/ModuleGraph.d.ts +2 -2
  11. package/dist/MultiCompiler.d.ts +7 -7
  12. package/dist/MultiStats.d.ts +3 -3
  13. package/dist/MultiWatching.d.ts +2 -2
  14. package/dist/NativeWatchFileSystem.d.ts +1 -1
  15. package/dist/NormalModule.d.ts +3 -3
  16. package/dist/NormalModuleFactory.d.ts +3 -3
  17. package/dist/Resolver.d.ts +1 -1
  18. package/dist/ResolverFactory.d.ts +2 -2
  19. package/dist/RuntimeGlobals.d.ts +2 -2
  20. package/dist/RuntimeModule.d.ts +3 -3
  21. package/dist/Stats.d.ts +4 -4
  22. package/dist/VirtualModulesPlugin.d.ts +1 -1
  23. package/dist/Watching.d.ts +4 -4
  24. package/dist/builtin-loader/lightningcss/index.d.ts +11 -14
  25. package/dist/builtin-loader/lightningcss/target.d.ts +4 -0
  26. package/dist/builtin-loader/swc/index.d.ts +5 -5
  27. package/dist/builtin-loader/swc/types.d.ts +2 -8
  28. package/dist/builtin-plugin/APIPlugin.d.ts +3 -3
  29. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +3 -3
  30. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +3 -3
  31. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +3 -3
  32. package/dist/builtin-plugin/BannerPlugin.d.ts +3 -3
  33. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +3 -3
  34. package/dist/builtin-plugin/CaseSensitivePlugin.d.ts +3 -3
  35. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +3 -3
  36. package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +4 -4
  37. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +3 -3
  38. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +3 -3
  39. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +3 -3
  40. package/dist/builtin-plugin/CssChunkingPlugin.d.ts +3 -3
  41. package/dist/builtin-plugin/CssModulesPlugin.d.ts +3 -3
  42. package/dist/builtin-plugin/DataUriPlugin.d.ts +3 -3
  43. package/dist/builtin-plugin/DefinePlugin.d.ts +3 -3
  44. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
  45. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
  46. package/dist/builtin-plugin/DllEntryPlugin.d.ts +3 -3
  47. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +3 -3
  48. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +3 -3
  49. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +3 -3
  50. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +2 -2
  51. package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +2 -2
  52. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +3 -3
  53. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +3 -3
  54. package/dist/builtin-plugin/EntryPlugin.d.ts +4 -4
  55. package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +3 -1
  56. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +3 -3
  57. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +3 -3
  58. package/dist/builtin-plugin/ExternalsPlugin.d.ts +2 -2
  59. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +3 -3
  60. package/dist/builtin-plugin/FileUriPlugin.d.ts +3 -3
  61. package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +3 -3
  62. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +3 -3
  63. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
  64. package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +2 -2
  65. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +3 -3
  66. package/dist/builtin-plugin/HttpUriPlugin.d.ts +2 -2
  67. package/dist/builtin-plugin/IgnorePlugin.d.ts +3 -3
  68. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +3 -3
  69. package/dist/builtin-plugin/InlineExportsPlugin.d.ts +3 -3
  70. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +4 -4
  71. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +2 -2
  72. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +3 -3
  73. package/dist/builtin-plugin/LibManifestPlugin.d.ts +3 -3
  74. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +7 -11
  75. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +3 -3
  76. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
  77. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +3 -3
  78. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +3 -3
  79. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
  80. package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +3 -3
  81. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +3 -3
  82. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +3 -3
  83. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -1
  84. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -1
  85. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +3 -3
  86. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +3 -3
  87. package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +4 -4
  88. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +3 -3
  89. package/dist/builtin-plugin/ProgressPlugin.d.ts +3 -3
  90. package/dist/builtin-plugin/ProvidePlugin.d.ts +3 -3
  91. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +3 -3
  92. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +3 -3
  93. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +3 -3
  94. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +4 -8
  95. package/dist/builtin-plugin/RslibPlugin.d.ts +3 -3
  96. package/dist/builtin-plugin/RstestPlugin.d.ts +3 -3
  97. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +3 -3
  98. package/dist/builtin-plugin/RuntimePlugin.d.ts +6 -10
  99. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +3 -3
  100. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +3 -3
  101. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +3 -3
  102. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +3 -3
  103. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +2 -2
  104. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +6 -5
  105. package/dist/builtin-plugin/URLPlugin.d.ts +3 -3
  106. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +2 -2
  107. package/dist/builtin-plugin/WorkerPlugin.d.ts +3 -3
  108. package/dist/builtin-plugin/base.d.ts +3 -3
  109. package/dist/builtin-plugin/css-extract/index.d.ts +3 -3
  110. package/dist/builtin-plugin/css-extract/loader.d.ts +1 -1
  111. package/dist/builtin-plugin/css-extract/utils.d.ts +1 -1
  112. package/dist/builtin-plugin/html-plugin/hooks.d.ts +2 -2
  113. package/dist/builtin-plugin/html-plugin/index.d.ts +2 -2
  114. package/dist/builtin-plugin/html-plugin/options.d.ts +1 -6
  115. package/dist/builtin-plugin/html-plugin/plugin.d.ts +5 -9
  116. package/dist/builtin-plugin/html-plugin/taps.d.ts +1 -1
  117. package/dist/builtin-plugin/index.d.ts +84 -84
  118. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +4 -4
  119. package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +2 -2
  120. package/dist/config/adapter.d.ts +4 -4
  121. package/dist/config/adapterRuleUse.d.ts +10 -9
  122. package/dist/config/browserslistTargetHandler.d.ts +1 -1
  123. package/dist/config/defaults.d.ts +5 -3
  124. package/dist/config/devServer.d.ts +3 -3
  125. package/dist/config/index.d.ts +5 -5
  126. package/dist/config/normalization.d.ts +8 -36
  127. package/dist/config/target.d.ts +14 -11
  128. package/dist/config/types.d.ts +85 -162
  129. package/dist/container/ContainerPlugin.d.ts +3 -3
  130. package/dist/container/ContainerReferencePlugin.d.ts +3 -3
  131. package/dist/container/ModuleFederationManifestPlugin.d.ts +2 -2
  132. package/dist/container/ModuleFederationPlugin.d.ts +5 -3
  133. package/dist/container/ModuleFederationPluginV1.d.ts +5 -5
  134. package/dist/container/ModuleFederationRuntimePlugin.d.ts +7 -3
  135. package/dist/container/index.d.ts +4 -4
  136. package/dist/cssExtractHmr.js +2 -27
  137. package/dist/cssExtractLoader.js +18 -60
  138. package/dist/exports.d.ts +69 -82
  139. package/dist/index.d.ts +3 -3
  140. package/dist/index.js +11678 -11722
  141. package/dist/lib/AbstractMethodError.d.ts +1 -1
  142. package/dist/lib/Cache.d.ts +1 -1
  143. package/dist/lib/CacheFacade.d.ts +3 -3
  144. package/dist/lib/DllPlugin.d.ts +2 -2
  145. package/dist/lib/DllReferencePlugin.d.ts +3 -3
  146. package/dist/lib/EntryOptionPlugin.d.ts +2 -2
  147. package/dist/lib/EnvironmentPlugin.d.ts +1 -1
  148. package/dist/lib/HookWebpackError.d.ts +1 -1
  149. package/dist/lib/IgnoreWarningsPlugin.d.ts +1 -1
  150. package/dist/lib/LoaderOptionsPlugin.d.ts +2 -2
  151. package/dist/lib/LoaderTargetPlugin.d.ts +2 -2
  152. package/dist/lib/WebpackError.d.ts +2 -2
  153. package/dist/lib/cache/MemoryCachePlugin.d.ts +1 -1
  154. package/dist/lib/cache/getLazyHashedEtag.d.ts +1 -1
  155. package/dist/lib/cache/mergeEtags.d.ts +1 -1
  156. package/dist/loader-runner/ModuleError.d.ts +1 -1
  157. package/dist/loader-runner/index.d.ts +1 -1
  158. package/dist/loader-runner/loadLoader.d.ts +2 -2
  159. package/dist/loader-runner/utils.d.ts +3 -3
  160. package/dist/loader-runner/worker.d.ts +1 -1
  161. package/dist/logging/createConsoleLogger.d.ts +2 -2
  162. package/dist/moduleFederationDefaultRuntime.js +1 -1
  163. package/dist/node/NodeEnvironmentPlugin.d.ts +2 -2
  164. package/dist/node/NodeTemplatePlugin.d.ts +1 -1
  165. package/dist/node/NodeWatchFileSystem.d.ts +1 -1
  166. package/dist/node/nodeConsole.d.ts +1 -1
  167. package/dist/rslib-runtime.js +29 -0
  168. package/dist/rspack.d.ts +5 -5
  169. package/dist/rspackOptionsApply.d.ts +1 -1
  170. package/dist/runtime/moduleFederationDefaultRuntime.d.ts +1 -2
  171. package/dist/sharing/ConsumeSharedPlugin.d.ts +2 -2
  172. package/dist/sharing/ProvideSharedPlugin.d.ts +2 -2
  173. package/dist/sharing/SharePlugin.d.ts +1 -1
  174. package/dist/sharing/ShareRuntimePlugin.d.ts +2 -2
  175. package/dist/stats/DefaultStatsFactoryPlugin.d.ts +1 -1
  176. package/dist/stats/DefaultStatsPresetPlugin.d.ts +1 -1
  177. package/dist/stats/DefaultStatsPrinterPlugin.d.ts +1 -1
  178. package/dist/stats/StatsFactory.d.ts +2 -2
  179. package/dist/stats/StatsPrinter.d.ts +1 -1
  180. package/dist/stats/statsFactoryUtils.d.ts +3 -6
  181. package/dist/taps/compilation.d.ts +1 -1
  182. package/dist/taps/compiler.d.ts +1 -1
  183. package/dist/taps/contextModuleFactory.d.ts +1 -1
  184. package/dist/taps/index.d.ts +6 -6
  185. package/dist/taps/javascriptModules.d.ts +1 -1
  186. package/dist/taps/normalModuleFactory.d.ts +1 -1
  187. package/dist/taps/types.d.ts +1 -1
  188. package/dist/trace/traceHookPlugin.d.ts +1 -1
  189. package/dist/util/createHash.d.ts +1 -1
  190. package/dist/util/fs.d.ts +1 -1
  191. package/dist/util/hash/md4.d.ts +1 -1
  192. package/dist/util/hash/xxhash64.d.ts +1 -1
  193. package/dist/util/index.d.ts +1 -1
  194. package/dist/util/targetsVersion.d.ts +2 -0
  195. package/dist/util/validateConfig.d.ts +1 -1
  196. package/dist/worker.js +846 -918
  197. package/hot/dev-server.js +12 -9
  198. package/hot/emitter.js +5 -1
  199. package/hot/lazy-compilation-node.js +4 -1
  200. package/hot/lazy-compilation-web.js +2 -3
  201. package/hot/log-apply-result.js +8 -5
  202. package/hot/log.js +17 -7
  203. package/hot/only-dev-server.js +13 -10
  204. package/hot/poll.js +11 -8
  205. package/hot/signal.js +13 -9
  206. package/package.json +10 -6
  207. package/compiled/browserslist-load-config/index.d.ts +0 -21
  208. package/compiled/browserslist-load-config/index.js +0 -252
  209. package/compiled/browserslist-load-config/license +0 -21
  210. package/compiled/browserslist-load-config/package.json +0 -1
  211. package/dist/builtin-loader/index.d.ts +0 -1
@@ -1,14 +1,14 @@
1
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';
2
+ import type { HttpUriPluginOptions } from '../builtin-plugin/HttpUriPlugin.js';
3
+ import type { ChunkGraph } from '../ChunkGraph.js';
4
+ import type { Compilation, PathData } from '../Compilation.js';
5
+ import type { Compiler } from '../Compiler.js';
6
+ import type { Chunk } from '../exports.js';
7
+ import type WebpackError from '../lib/WebpackError.js';
8
+ import type { Module } from '../Module.js';
9
+ import type ModuleGraph from '../ModuleGraph.js';
10
+ import type { ResolveCallback } from './adapterRuleUse.js';
11
+ import type { DevServerOptions } from './devServer.js';
12
12
  /** https://github.com/microsoft/TypeScript/issues/29729 */
13
13
  export type LiteralUnion<T extends U, U> = T | (U & Record<never, never>);
14
14
  export type FilenameTemplate = string;
@@ -63,7 +63,7 @@ export type AuxiliaryComment = string | LibraryCustomUmdCommentObject;
63
63
  /** Specify which export should be exposed as a library. */
64
64
  export type LibraryExport = string | string[];
65
65
  /** Configure how the library will be exposed. */
66
- export type LibraryType = LiteralUnion<'var' | 'module' | 'assign' | 'assign-properties' | 'this' | 'window' | 'self' | 'global' | 'commonjs' | 'commonjs2' | 'commonjs-module' | 'commonjs-static' | 'amd' | 'amd-require' | 'umd' | 'umd2' | 'jsonp' | 'system', string>;
66
+ export type LibraryType = LiteralUnion<'var' | 'module' | 'modern-module' | 'assign' | 'assign-properties' | 'this' | 'window' | 'self' | 'global' | 'commonjs' | 'commonjs2' | 'commonjs-module' | 'commonjs-static' | 'amd' | 'amd-require' | 'umd' | 'umd2' | 'jsonp' | 'system', string>;
67
67
  /** When using output.library.type: "umd", setting output.library.umdNamedDefine to true will name the AMD module of the UMD build. */
68
68
  export type UmdNamedDefine = boolean;
69
69
  /** Options for library. */
@@ -83,6 +83,10 @@ export type LibraryOptions = {
83
83
  * Otherwise, an anonymous define is used.
84
84
  * */
85
85
  umdNamedDefine?: UmdNamedDefine;
86
+ /**
87
+ * PreserveModules only works for `modern-module`
88
+ */
89
+ preserveModules?: string;
86
90
  };
87
91
  /** Options for library. */
88
92
  export type Library = LibraryName | LibraryOptions | undefined;
@@ -325,14 +329,6 @@ export type Output = {
325
329
  crossOriginLoading?: CrossOriginLoading;
326
330
  /** This option determines the name of CSS output files on disk. */
327
331
  cssFilename?: CssFilename;
328
- /**
329
- * @deprecated this config is unused, and will be removed in the future.
330
- * Rspack adds some metadata in CSS to parse CSS modules, and this configuration determines whether to compress these metadata.
331
- *
332
- * The value is `true` in production mode.
333
- * The value is `false` in development mode.
334
- * */
335
- cssHeadDataCompression?: boolean;
336
332
  /** This option determines the name of non-initial CSS output files on disk. */
337
333
  cssChunkFilename?: CssChunkFilename;
338
334
  /**
@@ -347,7 +343,7 @@ export type Output = {
347
343
  hotUpdateChunkFilename?: HotUpdateChunkFilename;
348
344
  /**
349
345
  * Only used when target is set to 'web', which uses JSONP for loading hot updates.
350
- * @default 'webpackHotUpdate' + output.uniqueName
346
+ * @default 'rspackHotUpdate' + output.uniqueName
351
347
  * */
352
348
  hotUpdateGlobal?: HotUpdateGlobal;
353
349
  /**
@@ -369,26 +365,6 @@ export type Output = {
369
365
  enabledLibraryTypes?: EnabledLibraryTypes;
370
366
  /** Output a library exposing the exports of your entry point. */
371
367
  library?: Library;
372
- /**
373
- * Specify which export should be exposed as a library.
374
- * @deprecated We might drop support for this, so prefer to use output.library.export
375
- * */
376
- libraryExport?: LibraryExport;
377
- /**
378
- * Configure how the library will be exposed.
379
- * @deprecated Use output.library.type instead as we might drop support for output.libraryTarget in the future.
380
- * */
381
- libraryTarget?: LibraryType;
382
- /**
383
- * When using output.library.type: "umd", setting output.umdNamedDefine to true will name the AMD module of the UMD build.
384
- * @deprecated Use output.library.umdNamedDefine instead.
385
- */
386
- umdNamedDefine?: UmdNamedDefine;
387
- /**
388
- * Add a comment in the UMD wrapper.
389
- * @deprecated use output.library.auxiliaryComment instead.
390
- * */
391
- auxiliaryComment?: AuxiliaryComment;
392
368
  /**
393
369
  * Output JavaScript files as module type.
394
370
  * Disabled by default as it's an experimental feature. To use it, you must set experiments.outputModule to true.
@@ -501,17 +477,16 @@ export type Output = {
501
477
  * @default 120000
502
478
  * */
503
479
  chunkLoadTimeout?: number;
504
- /**
505
- * Add charset="utf-8" to the HTML <script> tag.
506
- * @default true
507
- * */
508
- charset?: boolean;
509
480
  /** Tell Rspack what kind of ES-features may be used in the generated runtime-code. */
510
481
  environment?: Environment;
511
482
  /**
512
483
  * Check if to be emitted file already exists and have the same content before writing to output filesystem.
513
484
  */
514
485
  compareBeforeEmit?: boolean;
486
+ /**
487
+ * Information about the bundler.
488
+ */
489
+ bundlerInfo?: BundlerInfoOptions;
515
490
  };
516
491
  /**
517
492
  * Path alias
@@ -855,17 +830,33 @@ export type JavascriptParserOptions = {
855
830
  overrideStrict?: 'strict' | 'non-strict';
856
831
  /**
857
832
  * Control whether renaming of the CommonJS `require` function will be parsed and transformed.
858
- * @default true
833
+ * @default false
859
834
  */
860
835
  requireAlias?: boolean;
836
+ /**
837
+ * Control whether `require` used as an expression (e.g., `const req = require; req('./module')`) will be parsed.
838
+ * @default true
839
+ */
861
840
  requireAsExpression?: boolean;
841
+ /**
842
+ * Control whether dynamic `require` calls (e.g., `require(variable)`) will be parsed.
843
+ * @default true
844
+ */
862
845
  requireDynamic?: boolean;
846
+ /**
847
+ * Control whether `require.resolve()` calls will be parsed.
848
+ * @default true
849
+ */
863
850
  requireResolve?: boolean;
864
851
  /**
865
852
  * CommonJS-specific parser options. `true` enables the default behaviour, `{ exports: 'skipInEsm' }` preserves CommonJS export mutations when executed inside ESM.
866
853
  * @default true
867
854
  */
868
855
  commonjs?: JavascriptParserCommonjsOption;
856
+ /**
857
+ * Control whether dynamic `import()` calls (e.g., `import(variable)`) will be parsed.
858
+ * @default true
859
+ */
869
860
  importDynamic?: boolean;
870
861
  /**
871
862
  * Enable magic comments for CommonJS require() expressions.
@@ -875,7 +866,11 @@ export type JavascriptParserOptions = {
875
866
  typeReexportsPresence?: 'no-tolerant' | 'tolerant' | 'tolerant-no-check';
876
867
  /** Whether to enable JSX parsing */
877
868
  jsx?: boolean;
878
- /** Whether to enable defer import */
869
+ /**
870
+ * Whether to enable defer import.
871
+ * This option is controlled by `experiments.deferImport` and should not be set directly.
872
+ * @default false
873
+ */
879
874
  deferImport?: boolean;
880
875
  };
881
876
  export type JsonParserOptions = {
@@ -1059,12 +1054,12 @@ type AllowTarget = 'web' | 'webworker' | 'es3' | 'es5' | 'es2015' | 'es2016' | '
1059
1054
  export type Target = false | AllowTarget | AllowTarget[];
1060
1055
  /**
1061
1056
  * Specify the default type of externals.
1062
- * `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.
1057
+ * `amd`, `umd`, `system` and `jsonp` externals depend on the `output.library.type` being set to the same value e.g. you can only consume amd externals within an amd library.
1063
1058
  * @default 'var'
1064
1059
  */
1065
1060
  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';
1066
1061
  /**
1067
- * External item object when both libraryTarget and externalsType is 'umd'
1062
+ * External item object when both library.type and externalsType is 'umd'
1068
1063
  */
1069
1064
  export type ExternalItemUmdValue = {
1070
1065
  root: string | string[];
@@ -1081,7 +1076,7 @@ export type ExternalItemObjectValue = Record<string, string | string[]>;
1081
1076
  */
1082
1077
  export type ExternalItemValue = string | boolean | string[] | ExternalItemUmdValue
1083
1078
  /**
1084
- * when libraryTarget and externalsType is not 'umd'
1079
+ * when library.type and externalsType is not 'umd'
1085
1080
  */
1086
1081
  | ExternalItemObjectValue;
1087
1082
  /**
@@ -1255,7 +1250,22 @@ export type SnapshotOptions = {};
1255
1250
  * // Disable caching
1256
1251
  * cache: false
1257
1252
  */
1258
- export type CacheOptions = boolean;
1253
+ export type CacheOptions = boolean | {
1254
+ type: 'memory';
1255
+ } | {
1256
+ type: 'persistent';
1257
+ buildDependencies?: string[];
1258
+ version?: string;
1259
+ snapshot?: {
1260
+ immutablePaths?: (string | RegExp)[];
1261
+ unmanagedPaths?: (string | RegExp)[];
1262
+ managedPaths?: (string | RegExp)[];
1263
+ };
1264
+ storage?: {
1265
+ type: 'filesystem';
1266
+ directory?: string;
1267
+ };
1268
+ };
1259
1269
  export type StatsPresets = 'normal' | 'none' | 'verbose' | 'errors-only' | 'errors-warnings' | 'minimal' | 'detailed' | 'summary';
1260
1270
  type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
1261
1271
  type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
@@ -1917,53 +1927,21 @@ export type Optimization = {
1917
1927
  avoidEntryIife?: boolean;
1918
1928
  };
1919
1929
  /**
1920
- * Options for caching snapshots and intermediate products during the build process.
1921
- * @description Controls whether caching is enabled or disabled.
1922
- * @default true in development mode, false in production mode
1923
- * @example
1924
- * // Enable caching
1925
- * cache: true
1926
- *
1927
- * // Disable caching
1928
- * cache: false
1930
+ * Information about the bundler.
1929
1931
  */
1930
- export type ExperimentCacheOptions = boolean | {
1931
- type: 'memory';
1932
- } | {
1933
- type: 'persistent';
1934
- buildDependencies?: string[];
1932
+ export type BundlerInfoOptions = {
1933
+ /**
1934
+ * Version of the bundler.
1935
+ */
1935
1936
  version?: string;
1936
- snapshot?: {
1937
- immutablePaths?: (string | RegExp)[];
1938
- unmanagedPaths?: (string | RegExp)[];
1939
- managedPaths?: (string | RegExp)[];
1940
- };
1941
- storage?: {
1942
- type: 'filesystem';
1943
- directory?: string;
1944
- };
1945
- };
1946
- /**
1947
- * Options for future Rspack features.
1948
- */
1949
- export type RspackFutureOptions = {
1950
1937
  /**
1951
- * Information about the bundler.
1938
+ * Name of the bundler.
1952
1939
  */
1953
- bundlerInfo?: {
1954
- /**
1955
- * Version of the bundler.
1956
- */
1957
- version?: string;
1958
- /**
1959
- * Name of the bundler.
1960
- */
1961
- bundler?: string;
1962
- /**
1963
- * Force specific features.
1964
- */
1965
- force?: boolean | ('version' | 'uniqueId')[];
1966
- };
1940
+ bundler?: string;
1941
+ /**
1942
+ * Force specific features.
1943
+ */
1944
+ force?: boolean | ('version' | 'uniqueId')[];
1967
1945
  };
1968
1946
  /**
1969
1947
  * Options for lazy compilation.
@@ -2087,16 +2065,6 @@ export type UseInputFileSystem = false | RegExp[];
2087
2065
  * Experimental features configuration.
2088
2066
  */
2089
2067
  export type Experiments = {
2090
- /**
2091
- * Enable new cache.
2092
- */
2093
- cache?: ExperimentCacheOptions;
2094
- /**
2095
- * Enable lazy compilation.
2096
- * @deprecated Please use the configuration top-level `lazyCompilation` option instead.
2097
- * @default false
2098
- */
2099
- lazyCompilation?: boolean | LazyCompilationOptions;
2100
2068
  /**
2101
2069
  * Enable async WebAssembly.
2102
2070
  * Support the new WebAssembly according to the [updated specification](https://github.com/WebAssembly/esm-integration), it makes a WebAssembly module an async module.
@@ -2108,12 +2076,6 @@ export type Experiments = {
2108
2076
  * @default false
2109
2077
  */
2110
2078
  outputModule?: boolean;
2111
- /**
2112
- * Enable top-level await.
2113
- * @deprecated This option is deprecated, top-level await is enabled by default.
2114
- * @default true
2115
- */
2116
- topLevelAwait?: boolean;
2117
2079
  /**
2118
2080
  * Enable CSS support.
2119
2081
  *
@@ -2125,37 +2087,26 @@ export type Experiments = {
2125
2087
  * - `module.generator["css/auto"]`
2126
2088
  * - `module.generator.css`
2127
2089
  * - `module.generator["css/module"]`
2090
+ *
2091
+ * @deprecated This option is deprecated. In Rspack 2.0, users need to manually add CSS rules to enable CSS support.
2092
+ * Example:
2093
+ * ```js
2094
+ * module: {
2095
+ * rules: [{ test: /\.css$/, type: "css/auto" }]
2096
+ * }
2097
+ * ```
2128
2098
  */
2129
2099
  css?: boolean;
2130
- /**
2131
- * Enable module layers feature.
2132
- * @deprecated This option is deprecated, layers is enabled since v1.6.0
2133
- * @default false
2134
- */
2135
- layers?: boolean;
2136
- /**
2137
- * Enable incremental builds.
2138
- */
2139
- incremental?: IncrementalPresets | Incremental;
2140
2100
  /**
2141
2101
  * Enable future default options.
2142
2102
  * @default false
2143
2103
  */
2144
2104
  futureDefaults?: boolean;
2145
- /**
2146
- * Enable future Rspack features default options.
2147
- */
2148
- rspackFuture?: RspackFutureOptions;
2149
2105
  /**
2150
2106
  * Enable loading of modules via HTTP/HTTPS requests.
2151
2107
  * @default false
2152
2108
  */
2153
2109
  buildHttp?: HttpUriOptions;
2154
- /**
2155
- * Enable parallel loader
2156
- * @default false
2157
- */
2158
- parallelLoader?: boolean;
2159
2110
  /**
2160
2111
  * Enable Node.js input file system
2161
2112
  * @default false
@@ -2166,30 +2117,6 @@ export type Experiments = {
2166
2117
  * @default false
2167
2118
  */
2168
2119
  nativeWatcher?: boolean;
2169
- /**
2170
- * Enable inline const feature
2171
- * @default false
2172
- * @deprecated This option is deprecated, it's already stable and enabled by default, Rspack will remove this option in future version
2173
- */
2174
- inlineConst?: boolean;
2175
- /**
2176
- * Enable inline enum feature
2177
- * @default false
2178
- * @deprecated This option is deprecated, it's already stable. Rspack will remove this option in future version
2179
- */
2180
- inlineEnum?: boolean;
2181
- /**
2182
- * Enable type reexports presence feature
2183
- * @default false
2184
- * @deprecated This option is deprecated, it's already stable. Rspack will remove this option in future version
2185
- */
2186
- typeReexportsPresence?: boolean;
2187
- /**
2188
- * Enable lazy make side effects free barrel file
2189
- * @default false
2190
- * @deprecated This option is deprecated, it's already stable and enabled by default, Rspack will remove this option in future version
2191
- */
2192
- lazyBarrel?: boolean;
2193
2120
  /**
2194
2121
  * Enable defer import feature
2195
2122
  * @default false
@@ -2228,7 +2155,7 @@ export type WatchOptions = {
2228
2155
  * Options for devServer, it based on `webpack-dev-server@5`
2229
2156
  * */
2230
2157
  export type DevServer = DevServerOptions;
2231
- export type { Middleware as DevServerMiddleware } from './devServer';
2158
+ export type { Middleware as DevServerMiddleware } from './devServer.js';
2232
2159
  /**
2233
2160
  * Ignore specific warnings.
2234
2161
  */
@@ -2246,10 +2173,6 @@ export type IgnoreWarnings = (RegExp | {
2246
2173
  */
2247
2174
  module?: RegExp;
2248
2175
  } | ((warning: WebpackError, compilation: Compilation) => boolean))[];
2249
- /**
2250
- * Capture a "profile" of the application, including statistics and hints, which can then be dissected using the Analyze tool.
2251
- * */
2252
- export type Profile = boolean;
2253
2176
  /**
2254
2177
  * Set the value of `require.amd` and `define.amd`. Or disable AMD support.
2255
2178
  */
@@ -2405,10 +2328,6 @@ export type RspackOptions = {
2405
2328
  * Options for module configuration.
2406
2329
  */
2407
2330
  module?: ModuleOptions;
2408
- /**
2409
- * Whether to capture a profile of the application.
2410
- */
2411
- profile?: Profile;
2412
2331
  /**
2413
2332
  * Set the value of `require.amd` or `define.amd`.
2414
2333
  * Setting `amd` to false will disable rspack's AMD support.
@@ -2427,6 +2346,10 @@ export type RspackOptions = {
2427
2346
  * @default false
2428
2347
  */
2429
2348
  lazyCompilation?: boolean | LazyCompilationOptions;
2349
+ /**
2350
+ * Enable incremental builds.
2351
+ */
2352
+ incremental?: IncrementalPresets | Incremental;
2430
2353
  };
2431
2354
  /** Configuration for Rspack */
2432
2355
  export type Configuration = RspackOptions;
@@ -1,7 +1,7 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
- import { RspackBuiltinPlugin } from '../builtin-plugin/base';
3
- import type { Compiler } from '../Compiler';
4
- import type { EntryRuntime, FilenameTemplate, LibraryOptions } from '../config';
2
+ import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
3
+ import type { Compiler } from '../Compiler.js';
4
+ import type { EntryRuntime, FilenameTemplate, LibraryOptions } from '../config/index.js';
5
5
  export type ContainerPluginOptions = {
6
6
  exposes: Exposes;
7
7
  filename?: FilenameTemplate;
@@ -1,7 +1,7 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
- import { RspackBuiltinPlugin } from '../builtin-plugin/base';
3
- import type { Compiler } from '../Compiler';
4
- import type { ExternalsType } from '../config';
2
+ import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
3
+ import type { Compiler } from '../Compiler.js';
4
+ import type { ExternalsType } from '../config/index.js';
5
5
  export type ContainerReferencePluginOptions = {
6
6
  remoteType: ExternalsType;
7
7
  remotes: Remotes;
@@ -1,6 +1,6 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
- import { RspackBuiltinPlugin } from '../builtin-plugin/base';
3
- import type { Compiler } from '../Compiler';
2
+ import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
3
+ import type { Compiler } from '../Compiler.js';
4
4
  export type RemoteAliasMap = Record<string, {
5
5
  name: string;
6
6
  entry?: string;
@@ -1,11 +1,13 @@
1
- import type { Compiler } from '../Compiler';
2
- import { type ModuleFederationManifestPluginOptions } from './ModuleFederationManifestPlugin';
3
- import type { ModuleFederationPluginV1Options } from './ModuleFederationPluginV1';
1
+ import type { Compiler } from '../Compiler.js';
2
+ import { type ModuleFederationManifestPluginOptions } from './ModuleFederationManifestPlugin.js';
3
+ import type { ModuleFederationPluginV1Options } from './ModuleFederationPluginV1.js';
4
+ import { type ModuleFederationRuntimeExperimentsOptions } from './ModuleFederationRuntimePlugin.js';
4
5
  export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPluginV1Options, 'enhanced'> {
5
6
  runtimePlugins?: RuntimePlugins;
6
7
  implementation?: string;
7
8
  shareStrategy?: 'version-first' | 'loaded-first';
8
9
  manifest?: boolean | Omit<ModuleFederationManifestPluginOptions, 'remoteAliasMap' | 'globalName' | 'name' | 'exposes' | 'shared'>;
10
+ experiments?: ModuleFederationRuntimeExperimentsOptions;
9
11
  }
10
12
  export type RuntimePlugins = string[] | [string, Record<string, unknown>][];
11
13
  export declare class ModuleFederationPlugin {
@@ -1,8 +1,8 @@
1
- import type { Compiler } from '../Compiler';
2
- import type { EntryRuntime, ExternalsType, LibraryOptions } from '../config';
3
- import { type Shared } from '../sharing/SharePlugin';
4
- import { type Exposes } from './ContainerPlugin';
5
- import { type Remotes } from './ContainerReferencePlugin';
1
+ import type { Compiler } from '../Compiler.js';
2
+ import type { EntryRuntime, ExternalsType, LibraryOptions } from '../config/index.js';
3
+ import { type Shared } from '../sharing/SharePlugin.js';
4
+ import { type Exposes } from './ContainerPlugin.js';
5
+ import { type Remotes } from './ContainerReferencePlugin.js';
6
6
  export interface ModuleFederationPluginV1Options {
7
7
  exposes?: Exposes;
8
8
  filename?: string;
@@ -1,12 +1,16 @@
1
+ export interface ModuleFederationRuntimeExperimentsOptions {
2
+ asyncStartup?: boolean;
3
+ }
1
4
  export interface ModuleFederationRuntimeOptions {
2
5
  entryRuntime?: string;
6
+ experiments?: ModuleFederationRuntimeExperimentsOptions;
3
7
  }
4
8
  export declare const ModuleFederationRuntimePlugin: {
5
9
  new (options?: ModuleFederationRuntimeOptions | undefined): {
6
10
  name: string;
7
11
  _args: [options?: ModuleFederationRuntimeOptions | undefined];
8
- affectedHooks: keyof import("..").CompilerHooks | undefined;
9
- raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
10
- apply(compiler: import("..").Compiler): void;
12
+ affectedHooks: keyof import("../index.js").CompilerHooks | undefined;
13
+ raw(compiler: import("../index.js").Compiler): import("@rspack/binding").BuiltinPlugin;
14
+ apply(compiler: import("../index.js").Compiler): void;
11
15
  };
12
16
  };
@@ -1,4 +1,4 @@
1
- export * from './ContainerPlugin';
2
- export * from './ContainerReferencePlugin';
3
- export * from './ModuleFederationPlugin';
4
- export * from './ModuleFederationPluginV1';
1
+ export * from './ContainerPlugin.js';
2
+ export * from './ContainerReferencePlugin.js';
3
+ export * from './ModuleFederationPlugin.js';
4
+ export * from './ModuleFederationPluginV1.js';
@@ -1,18 +1,3 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- __webpack_require__.d = (exports1, definition)=>{
4
- for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
5
- enumerable: !0,
6
- get: definition[key]
7
- });
8
- }, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
9
- "u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
10
- value: 'Module'
11
- }), Object.defineProperty(exports1, '__esModule', {
12
- value: !0
13
- });
14
- };
15
- var __webpack_exports__ = {};
16
1
  function normalizeUrl(url) {
17
2
  let urlString = url.trim();
18
3
  if (/^data:/i.test(urlString)) return urlString;
@@ -30,11 +15,7 @@ function normalizeUrl(url) {
30
15
  return accumulator;
31
16
  }, []).join('/');
32
17
  }
33
- __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
34
- cssReload: ()=>cssReload,
35
- normalizeUrl: ()=>normalizeUrl
36
- });
37
- const srcByModuleId = Object.create(null), noDocument = "u" < typeof document, { forEach } = Array.prototype;
18
+ let srcByModuleId = Object.create(null), noDocument = "u" < typeof document, { forEach: forEach } = Array.prototype;
38
19
  function noop() {}
39
20
  function updateCss(el, url) {
40
21
  let normalizedUrl;
@@ -115,10 +96,4 @@ function cssReload(moduleId, options) {
115
96
  }, 50);
116
97
  };
117
98
  }
118
- for(var __rspack_i in exports.cssReload = __webpack_exports__.cssReload, exports.normalizeUrl = __webpack_exports__.normalizeUrl, __webpack_exports__)-1 === [
119
- "cssReload",
120
- "normalizeUrl"
121
- ].indexOf(__rspack_i) && (exports[__rspack_i] = __webpack_exports__[__rspack_i]);
122
- Object.defineProperty(exports, '__esModule', {
123
- value: !0
124
- });
99
+ export { cssReload, normalizeUrl };