@rspack-canary/browser 1.7.3-canary-965a4980-20260119085659 → 1.7.3-canary-6991b7b5-20260119174555

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 (33) hide show
  1. package/dist/Compiler.d.ts +0 -1
  2. package/dist/MultiCompiler.d.ts +1 -1
  3. package/dist/browser/middleware.d.ts +1 -0
  4. package/dist/builtin-loader/lightningcss/index.d.ts +5 -0
  5. package/dist/builtin-loader/swc/types.d.ts +4 -2
  6. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
  7. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
  8. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +5 -0
  9. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +5 -1
  10. package/dist/builtin-plugin/RuntimePlugin.d.ts +4 -0
  11. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +1 -1
  12. package/dist/builtin-plugin/html-plugin/options.d.ts +5 -0
  13. package/dist/builtin-plugin/html-plugin/plugin.d.ts +5 -1
  14. package/dist/builtin-plugin/index.d.ts +0 -1
  15. package/dist/config/normalization.d.ts +32 -4
  16. package/dist/config/types.d.ts +145 -56
  17. package/dist/exports.d.ts +15 -4
  18. package/dist/{index.js → index.mjs} +36360 -4202
  19. package/dist/{index.js.LICENSE.txt → index.mjs.LICENSE.txt} +7 -0
  20. package/dist/lib/DllPlugin.d.ts +1 -1
  21. package/dist/lib/DllReferencePlugin.d.ts +2 -2
  22. package/dist/napi-binding.d.ts +30 -34
  23. package/dist/{rslib-runtime.js → rslib-runtime.mjs} +11 -1
  24. package/dist/rspack.wasi-browser.js +0 -1
  25. package/dist/rspack.wasm32-wasi.wasm +0 -0
  26. package/dist/runtime/moduleFederationDefaultRuntime.d.ts +2 -1
  27. package/dist/stats/statsFactoryUtils.d.ts +3 -0
  28. package/dist/wasi-worker-browser.mjs +22749 -22744
  29. package/package.json +2 -2
  30. package/dist/builtin-plugin/rsc/Coordinator.d.ts +0 -8
  31. package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +0 -13
  32. package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +0 -14
  33. package/dist/builtin-plugin/rsc/index.d.ts +0 -24
@@ -79,7 +79,6 @@ export type CompilerHooks = {
79
79
  entryOption: liteTapable.SyncBailHook<[string, EntryNormalized], any>;
80
80
  additionalPass: liteTapable.AsyncSeriesHook<[]>;
81
81
  };
82
- export declare const GET_COMPILER_ID: unique symbol;
83
82
  declare class Compiler {
84
83
  #private;
85
84
  hooks: CompilerHooks;
@@ -42,7 +42,7 @@ export declare class MultiCompiler {
42
42
  watching?: MultiWatching;
43
43
  constructor(compilers: Compiler[] | Record<string, Compiler>, options?: MultiCompilerOptions);
44
44
  set unsafeFastDrop(value: boolean);
45
- get options(): import("./config").RspackOptionsNormalized[] & MultiCompilerOptions;
45
+ get options(): import(".").RspackOptionsNormalized[] & MultiCompilerOptions;
46
46
  get outputPath(): string;
47
47
  get inputFileSystem(): InputFileSystem;
48
48
  get outputFileSystem(): typeof import("fs");
@@ -0,0 +1 @@
1
+ export declare const lazyCompilationMiddleware: () => never;
@@ -105,6 +105,11 @@ export type LoaderOptions = {
105
105
  targets?: Targets | string[] | string;
106
106
  include?: FeatureOptions;
107
107
  exclude?: FeatureOptions;
108
+ /**
109
+ * @deprecated Use `drafts` instead.
110
+ * This will be removed in the next major version.
111
+ */
112
+ draft?: Drafts;
108
113
  drafts?: Drafts;
109
114
  nonStandard?: NonStandard;
110
115
  pseudoClasses?: PseudoClasses;
@@ -22,9 +22,11 @@ export type SwcLoaderOptions = Config & {
22
22
  rspackExperiments?: {
23
23
  import?: PluginImportOptions;
24
24
  /**
25
- * Enable React Server Components support.
25
+ * @deprecated Use top-level `collectTypeScriptInfo` instead.
26
+ * Collects information from TypeScript's AST for consumption by subsequent Rspack processes,
27
+ * providing better TypeScript development experience and smaller output bundle size.
26
28
  */
27
- reactServerComponents?: boolean;
29
+ collectTypeScriptInfo?: CollectTypeScriptInfoOptions;
28
30
  };
29
31
  };
30
32
  export interface TerserCompressOptions {
@@ -12,7 +12,7 @@ declare const EnableChunkLoadingPluginInner: {
12
12
  new (type: string): {
13
13
  name: string;
14
14
  _args: [type: string];
15
- affectedHooks: keyof import("..").CompilerHooks | undefined;
15
+ affectedHooks: keyof import("../Compiler").CompilerHooks | undefined;
16
16
  raw(compiler: Compiler): import("../binding").BuiltinPlugin;
17
17
  apply(compiler: Compiler): void;
18
18
  };
@@ -3,7 +3,7 @@ export declare const JsLoaderRspackPlugin: {
3
3
  new (compiler: Compiler): {
4
4
  name: string;
5
5
  _args: [compiler: Compiler];
6
- affectedHooks: keyof import("..").CompilerHooks | undefined;
6
+ affectedHooks: keyof import("../Compiler").CompilerHooks | undefined;
7
7
  raw(compiler: Compiler): import("../binding").BuiltinPlugin;
8
8
  apply(compiler: Compiler): void;
9
9
  };
@@ -10,6 +10,11 @@ export type LightningCssMinimizerRspackPluginOptions = {
10
10
  targets?: string[] | string;
11
11
  include?: FeatureOptions;
12
12
  exclude?: FeatureOptions;
13
+ /**
14
+ * @deprecated Use `drafts` instead.
15
+ * This will be removed in the next major version.
16
+ */
17
+ draft?: Drafts;
13
18
  drafts?: Drafts;
14
19
  nonStandard?: NonStandard;
15
20
  pseudoClasses?: PseudoClasses;
@@ -18,7 +18,7 @@ declare const RsdoctorPluginImpl: {
18
18
  new (c?: RsdoctorPluginOptions | undefined): {
19
19
  name: string;
20
20
  _args: [c?: RsdoctorPluginOptions | undefined];
21
- affectedHooks: keyof import("..").CompilerHooks | undefined;
21
+ affectedHooks: keyof import("../Compiler").CompilerHooks | undefined;
22
22
  raw(compiler: Compiler): import("../binding").BuiltinPlugin;
23
23
  apply(compiler: Compiler): void;
24
24
  };
@@ -39,6 +39,10 @@ export type RsdoctorPluginHooks = {
39
39
  assets: liteTapable.AsyncSeriesBailHook<[JsRsdoctorAssetPatch], false | void>;
40
40
  };
41
41
  declare const RsdoctorPlugin: typeof RsdoctorPluginImpl & {
42
+ /**
43
+ * @deprecated Use `getCompilationHooks` instead.
44
+ */
45
+ getHooks: (compilation: Compilation) => RsdoctorPluginHooks;
42
46
  getCompilationHooks: (compilation: Compilation) => RsdoctorPluginHooks;
43
47
  };
44
48
  export declare const createRsdoctorPluginHooksRegisters: CreatePartialRegisters<`RsdoctorPlugin`>;
@@ -19,6 +19,10 @@ export type RuntimePluginHooks = {
19
19
  linkPrefetch: liteTapable.SyncWaterfallHook<[string, Chunk]>;
20
20
  };
21
21
  declare const RuntimePlugin: typeof RuntimePluginImpl & {
22
+ /**
23
+ * @deprecated Use `getCompilationHooks` instead.
24
+ */
25
+ getHooks: (compilation: Compilation) => RuntimePluginHooks;
22
26
  getCompilationHooks: (compilation: Compilation) => RuntimePluginHooks;
23
27
  };
24
28
  export declare const createRuntimePluginHooksRegisters: CreatePartialRegisters<`RuntimePlugin`>;
@@ -20,7 +20,7 @@ declare const NativeSubresourceIntegrityPlugin: {
20
20
  new (options: NativeSubresourceIntegrityPluginOptions): {
21
21
  name: string;
22
22
  _args: [options: NativeSubresourceIntegrityPluginOptions];
23
- affectedHooks: keyof import("..").CompilerHooks | undefined;
23
+ affectedHooks: keyof import("../Compiler").CompilerHooks | undefined;
24
24
  raw(compiler: Compiler): import("../binding").BuiltinPlugin;
25
25
  apply(compiler: Compiler): void;
26
26
  };
@@ -52,6 +52,11 @@ export type HtmlRspackPluginOptions = {
52
52
  * @default "auto"
53
53
  */
54
54
  chunksSortMode?: 'auto' | 'manual';
55
+ /**
56
+ * Configure the SRI hash algorithm, which is disabled by default.
57
+ * @deprecated Use `experiments.SubresourceIntegrityPlugin` instead.
58
+ */
59
+ sri?: 'sha256' | 'sha384' | 'sha512';
55
60
  /**
56
61
  * Controls whether to minify the output, disabled by default.
57
62
  */
@@ -7,12 +7,16 @@ declare const HtmlRspackPluginImpl: {
7
7
  new (c?: HtmlRspackPluginOptions | undefined): {
8
8
  name: string;
9
9
  _args: [c?: HtmlRspackPluginOptions | undefined];
10
- affectedHooks: keyof import("../..").CompilerHooks | undefined;
10
+ affectedHooks: keyof import("../../Compiler").CompilerHooks | undefined;
11
11
  raw(compiler: Compiler): import("../../binding").BuiltinPlugin;
12
12
  apply(compiler: Compiler): void;
13
13
  };
14
14
  };
15
15
  declare const HtmlRspackPlugin: typeof HtmlRspackPluginImpl & {
16
+ /**
17
+ * @deprecated Use `getCompilationHooks` instead.
18
+ */
19
+ getHooks: (compilation: Compilation) => HtmlRspackPluginHooks;
16
20
  getCompilationHooks: (compilation: Compilation) => HtmlRspackPluginHooks;
17
21
  createHtmlTagObject: (tagName: string, attributes?: Record<string, string | boolean>, innerHTML?: string) => JsHtmlPluginTag;
18
22
  version: number;
@@ -73,7 +73,6 @@ export * from './RslibPlugin';
73
73
  export * from './RstestPlugin';
74
74
  export * from './RuntimeChunkPlugin';
75
75
  export * from './RuntimePlugin';
76
- export { rsc } from './rsc';
77
76
  export * from './SideEffectsFlagPlugin';
78
77
  export * from './SizeLimitsPlugin';
79
78
  export * from './SourceMapDevToolPlugin';
@@ -10,7 +10,7 @@
10
10
  import type { HttpUriPluginOptions } from '../builtin-plugin';
11
11
  import type { Compilation } from '../Compilation';
12
12
  import type WebpackError from '../lib/WebpackError';
13
- import type { Amd, AssetModuleFilename, Bail, BundlerInfoOptions, ChunkFilename, ChunkLoading, ChunkLoadingGlobal, Clean, Context, CrossOriginLoading, CssChunkFilename, CssFilename, Dependencies, DevServer, DevTool, DevtoolFallbackModuleFilenameTemplate, DevtoolModuleFilenameTemplate, DevtoolNamespace, EnabledLibraryTypes, EnabledWasmLoadingTypes, EntryDescription, Environment, Externals, ExternalsPresets, ExternalsType, Filename, GeneratorOptionsByModuleType, GlobalObject, HashDigest, HashDigestLength, HashFunction, HashSalt, HotUpdateChunkFilename, HotUpdateGlobal, HotUpdateMainFilename, Iife, ImportFunctionName, ImportMetaName, Incremental, InfrastructureLogging, LazyCompilationOptions, LibraryOptions, Loader, Mode, Name, Node, NoParseOption, Optimization, OutputModule, ParserOptionsByModuleType, Path, Performance, Plugins, PublicPath, Resolve, RspackOptions, RuleSetRules, ScriptType, SnapshotOptions, SourceMapFilename, StatsValue, StrictModuleErrorHandling, Target, TrustedTypes, UniqueName, WasmLoading, Watch, WatchOptions, WebassemblyModuleFilename, WorkerPublicPath } from './types';
13
+ import type { Amd, AssetModuleFilename, Bail, CacheOptions, ChunkFilename, ChunkLoading, ChunkLoadingGlobal, Clean, Context, CrossOriginLoading, CssChunkFilename, CssFilename, Dependencies, DevServer, DevTool, DevtoolFallbackModuleFilenameTemplate, DevtoolModuleFilenameTemplate, DevtoolNamespace, EnabledLibraryTypes, EnabledWasmLoadingTypes, EntryDescription, Environment, Externals, ExternalsPresets, ExternalsType, Filename, GeneratorOptionsByModuleType, GlobalObject, HashDigest, HashDigestLength, HashFunction, HashSalt, HotUpdateChunkFilename, HotUpdateGlobal, HotUpdateMainFilename, Iife, ImportFunctionName, ImportMetaName, Incremental, InfrastructureLogging, LazyCompilationOptions, LibraryOptions, Loader, Mode, Name, Node, NoParseOption, Optimization, OutputModule, ParserOptionsByModuleType, Path, Performance, Plugins, Profile, PublicPath, Resolve, RspackFutureOptions, RspackOptions, RuleSetRules, ScriptType, SnapshotOptions, SourceMapFilename, StatsValue, StrictModuleErrorHandling, Target, TrustedTypes, UniqueName, WasmLoading, Watch, WatchOptions, WebassemblyModuleFilename, WorkerPublicPath } from './types';
14
14
  export declare const getNormalizedRspackOptions: (config: RspackOptions) => RspackOptionsNormalized;
15
15
  export type EntryDynamicNormalized = () => Promise<EntryStaticNormalized>;
16
16
  export type EntryNormalized = EntryDynamicNormalized | EntryStaticNormalized;
@@ -66,9 +66,9 @@ export interface OutputNormalized {
66
66
  devtoolModuleFilenameTemplate?: DevtoolModuleFilenameTemplate;
67
67
  devtoolFallbackModuleFilenameTemplate?: DevtoolFallbackModuleFilenameTemplate;
68
68
  environment?: Environment;
69
+ charset?: boolean;
69
70
  chunkLoadTimeout?: number;
70
71
  compareBeforeEmit?: boolean;
71
- bundlerInfo?: BundlerInfoOptions;
72
72
  }
73
73
  export interface ModuleOptionsNormalized {
74
74
  defaultRules?: RuleSetRules;
@@ -78,7 +78,7 @@ export interface ModuleOptionsNormalized {
78
78
  noParse?: NoParseOption;
79
79
  unsafeCache?: boolean | RegExp;
80
80
  }
81
- export type CacheNormalized = boolean | {
81
+ export type ExperimentCacheNormalized = boolean | {
82
82
  type: 'memory';
83
83
  } | {
84
84
  type: 'persistent';
@@ -95,13 +95,40 @@ export type CacheNormalized = boolean | {
95
95
  };
96
96
  };
97
97
  export interface ExperimentsNormalized {
98
+ cache?: ExperimentCacheNormalized;
99
+ /**
100
+ * @deprecated This option is deprecated and will be removed in future versions.
101
+ *
102
+ * Please use the Configuration top-level `lazyCompilation` option instead.
103
+ */
104
+ lazyCompilation?: false | LazyCompilationOptions;
98
105
  asyncWebAssembly?: boolean;
99
106
  outputModule?: boolean;
107
+ topLevelAwait?: boolean;
100
108
  css?: boolean;
109
+ /**
110
+ * @deprecated This option is deprecated, layers is enabled since v1.6.0
111
+ */
112
+ layers?: boolean;
101
113
  incremental?: false | Incremental;
102
114
  futureDefaults?: boolean;
115
+ rspackFuture?: RspackFutureOptions;
103
116
  buildHttp?: HttpUriPluginOptions;
117
+ parallelLoader?: boolean;
104
118
  useInputFileSystem?: false | RegExp[];
119
+ /**
120
+ * @deprecated This option is deprecated, it's already stable and enabled by default, Rspack will remove this option in future version
121
+ */
122
+ inlineConst?: boolean;
123
+ /**
124
+ * @deprecated This option is deprecated, it's already stable and enabled by default, Rspack will remove this option in future version
125
+ */
126
+ inlineEnum?: boolean;
127
+ typeReexportsPresence?: boolean;
128
+ /**
129
+ * @deprecated This option is deprecated, it's already stable and enabled by default, Rspack will remove this option in future version
130
+ */
131
+ lazyBarrel?: boolean;
105
132
  nativeWatcher?: boolean;
106
133
  deferImport?: boolean;
107
134
  }
@@ -130,7 +157,7 @@ export interface RspackOptionsNormalized {
130
157
  node: Node;
131
158
  loader: Loader;
132
159
  snapshot: SnapshotOptions;
133
- cache?: CacheNormalized;
160
+ cache?: CacheOptions;
134
161
  stats: StatsValue;
135
162
  optimization: Optimization;
136
163
  plugins: Plugins;
@@ -141,6 +168,7 @@ export interface RspackOptionsNormalized {
141
168
  devServer?: DevServer;
142
169
  ignoreWarnings?: IgnoreWarningsNormalized;
143
170
  performance?: Performance;
171
+ profile?: Profile;
144
172
  amd?: Amd;
145
173
  bail?: Bail;
146
174
  }
@@ -325,6 +325,14 @@ export type Output = {
325
325
  crossOriginLoading?: CrossOriginLoading;
326
326
  /** This option determines the name of CSS output files on disk. */
327
327
  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;
328
336
  /** This option determines the name of non-initial CSS output files on disk. */
329
337
  cssChunkFilename?: CssChunkFilename;
330
338
  /**
@@ -361,6 +369,26 @@ export type Output = {
361
369
  enabledLibraryTypes?: EnabledLibraryTypes;
362
370
  /** Output a library exposing the exports of your entry point. */
363
371
  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;
364
392
  /**
365
393
  * Output JavaScript files as module type.
366
394
  * Disabled by default as it's an experimental feature. To use it, you must set experiments.outputModule to true.
@@ -473,16 +501,17 @@ export type Output = {
473
501
  * @default 120000
474
502
  * */
475
503
  chunkLoadTimeout?: number;
504
+ /**
505
+ * Add charset="utf-8" to the HTML <script> tag.
506
+ * @default true
507
+ * */
508
+ charset?: boolean;
476
509
  /** Tell Rspack what kind of ES-features may be used in the generated runtime-code. */
477
510
  environment?: Environment;
478
511
  /**
479
512
  * Check if to be emitted file already exists and have the same content before writing to output filesystem.
480
513
  */
481
514
  compareBeforeEmit?: boolean;
482
- /**
483
- * Information about the bundler.
484
- */
485
- bundlerInfo?: BundlerInfoOptions;
486
515
  };
487
516
  /**
488
517
  * Path alias
@@ -826,33 +855,17 @@ export type JavascriptParserOptions = {
826
855
  overrideStrict?: 'strict' | 'non-strict';
827
856
  /**
828
857
  * Control whether renaming of the CommonJS `require` function will be parsed and transformed.
829
- * @default false
830
- */
831
- requireAlias?: boolean;
832
- /**
833
- * Control whether `require` used as an expression (e.g., `const req = require; req('./module')`) will be parsed.
834
858
  * @default true
835
859
  */
860
+ requireAlias?: boolean;
836
861
  requireAsExpression?: boolean;
837
- /**
838
- * Control whether dynamic `require` calls (e.g., `require(variable)`) will be parsed.
839
- * @default true
840
- */
841
862
  requireDynamic?: boolean;
842
- /**
843
- * Control whether `require.resolve()` calls will be parsed.
844
- * @default true
845
- */
846
863
  requireResolve?: boolean;
847
864
  /**
848
865
  * CommonJS-specific parser options. `true` enables the default behaviour, `{ exports: 'skipInEsm' }` preserves CommonJS export mutations when executed inside ESM.
849
866
  * @default true
850
867
  */
851
868
  commonjs?: JavascriptParserCommonjsOption;
852
- /**
853
- * Control whether dynamic `import()` calls (e.g., `import(variable)`) will be parsed.
854
- * @default true
855
- */
856
869
  importDynamic?: boolean;
857
870
  /**
858
871
  * Enable magic comments for CommonJS require() expressions.
@@ -862,11 +875,7 @@ export type JavascriptParserOptions = {
862
875
  typeReexportsPresence?: 'no-tolerant' | 'tolerant' | 'tolerant-no-check';
863
876
  /** Whether to enable JSX parsing */
864
877
  jsx?: boolean;
865
- /**
866
- * Whether to enable defer import.
867
- * This option is controlled by `experiments.deferImport` and should not be set directly.
868
- * @default false
869
- */
878
+ /** Whether to enable defer import */
870
879
  deferImport?: boolean;
871
880
  };
872
881
  export type JsonParserOptions = {
@@ -1050,12 +1059,12 @@ type AllowTarget = 'web' | 'webworker' | 'es3' | 'es5' | 'es2015' | 'es2016' | '
1050
1059
  export type Target = false | AllowTarget | AllowTarget[];
1051
1060
  /**
1052
1061
  * Specify the default type of externals.
1053
- * `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.
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.
1054
1063
  * @default 'var'
1055
1064
  */
1056
1065
  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';
1057
1066
  /**
1058
- * External item object when both library.type and externalsType is 'umd'
1067
+ * External item object when both libraryTarget and externalsType is 'umd'
1059
1068
  */
1060
1069
  export type ExternalItemUmdValue = {
1061
1070
  root: string | string[];
@@ -1072,7 +1081,7 @@ export type ExternalItemObjectValue = Record<string, string | string[]>;
1072
1081
  */
1073
1082
  export type ExternalItemValue = string | boolean | string[] | ExternalItemUmdValue
1074
1083
  /**
1075
- * when library.type and externalsType is not 'umd'
1084
+ * when libraryTarget and externalsType is not 'umd'
1076
1085
  */
1077
1086
  | ExternalItemObjectValue;
1078
1087
  /**
@@ -1246,22 +1255,7 @@ export type SnapshotOptions = {};
1246
1255
  * // Disable caching
1247
1256
  * cache: false
1248
1257
  */
1249
- export type CacheOptions = boolean | {
1250
- type: 'memory';
1251
- } | {
1252
- type: 'persistent';
1253
- buildDependencies?: string[];
1254
- version?: string;
1255
- snapshot?: {
1256
- immutablePaths?: (string | RegExp)[];
1257
- unmanagedPaths?: (string | RegExp)[];
1258
- managedPaths?: (string | RegExp)[];
1259
- };
1260
- storage?: {
1261
- type: 'filesystem';
1262
- directory?: string;
1263
- };
1264
- };
1258
+ export type CacheOptions = boolean;
1265
1259
  export type StatsPresets = 'normal' | 'none' | 'verbose' | 'errors-only' | 'errors-warnings' | 'minimal' | 'detailed' | 'summary';
1266
1260
  type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
1267
1261
  type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
@@ -1923,21 +1917,53 @@ export type Optimization = {
1923
1917
  avoidEntryIife?: boolean;
1924
1918
  };
1925
1919
  /**
1926
- * Information about the bundler.
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
1927
1929
  */
1928
- export type BundlerInfoOptions = {
1929
- /**
1930
- * Version of the bundler.
1931
- */
1930
+ export type ExperimentCacheOptions = boolean | {
1931
+ type: 'memory';
1932
+ } | {
1933
+ type: 'persistent';
1934
+ buildDependencies?: string[];
1932
1935
  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 = {
1933
1950
  /**
1934
- * Name of the bundler.
1935
- */
1936
- bundler?: string;
1937
- /**
1938
- * Force specific features.
1951
+ * Information about the bundler.
1939
1952
  */
1940
- force?: boolean | ('version' | 'uniqueId')[];
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
+ };
1941
1967
  };
1942
1968
  /**
1943
1969
  * Options for lazy compilation.
@@ -2061,6 +2087,16 @@ export type UseInputFileSystem = false | RegExp[];
2061
2087
  * Experimental features configuration.
2062
2088
  */
2063
2089
  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;
2064
2100
  /**
2065
2101
  * Enable async WebAssembly.
2066
2102
  * Support the new WebAssembly according to the [updated specification](https://github.com/WebAssembly/esm-integration), it makes a WebAssembly module an async module.
@@ -2072,6 +2108,12 @@ export type Experiments = {
2072
2108
  * @default false
2073
2109
  */
2074
2110
  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;
2075
2117
  /**
2076
2118
  * Enable CSS support.
2077
2119
  *
@@ -2085,6 +2127,12 @@ export type Experiments = {
2085
2127
  * - `module.generator["css/module"]`
2086
2128
  */
2087
2129
  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;
2088
2136
  /**
2089
2137
  * Enable incremental builds.
2090
2138
  */
@@ -2094,11 +2142,20 @@ export type Experiments = {
2094
2142
  * @default false
2095
2143
  */
2096
2144
  futureDefaults?: boolean;
2145
+ /**
2146
+ * Enable future Rspack features default options.
2147
+ */
2148
+ rspackFuture?: RspackFutureOptions;
2097
2149
  /**
2098
2150
  * Enable loading of modules via HTTP/HTTPS requests.
2099
2151
  * @default false
2100
2152
  */
2101
2153
  buildHttp?: HttpUriOptions;
2154
+ /**
2155
+ * Enable parallel loader
2156
+ * @default false
2157
+ */
2158
+ parallelLoader?: boolean;
2102
2159
  /**
2103
2160
  * Enable Node.js input file system
2104
2161
  * @default false
@@ -2109,6 +2166,30 @@ export type Experiments = {
2109
2166
  * @default false
2110
2167
  */
2111
2168
  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;
2112
2193
  /**
2113
2194
  * Enable defer import feature
2114
2195
  * @default false
@@ -2165,6 +2246,10 @@ export type IgnoreWarnings = (RegExp | {
2165
2246
  */
2166
2247
  module?: RegExp;
2167
2248
  } | ((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;
2168
2253
  /**
2169
2254
  * Set the value of `require.amd` and `define.amd`. Or disable AMD support.
2170
2255
  */
@@ -2320,6 +2405,10 @@ export type RspackOptions = {
2320
2405
  * Options for module configuration.
2321
2406
  */
2322
2407
  module?: ModuleOptions;
2408
+ /**
2409
+ * Whether to capture a profile of the application.
2410
+ */
2411
+ profile?: Profile;
2323
2412
  /**
2324
2413
  * Set the value of `require.amd` or `define.amd`.
2325
2414
  * Setting `amd` to false will disable rspack's AMD support.
package/dist/exports.d.ts CHANGED
@@ -31,7 +31,7 @@ export { ModuleFilenameHelpers };
31
31
  export { Template } from './Template';
32
32
  export declare const WebpackError: ErrorConstructor;
33
33
  export type { Watching } from './Watching';
34
- import * as sources from 'webpack-sources';
34
+ import sources = require('webpack-sources');
35
35
  export { sources };
36
36
  import { applyRspackOptionsDefaults, getNormalizedRspackOptions } from './config';
37
37
  type Config = {
@@ -47,7 +47,11 @@ export declare const util: {
47
47
  cleverMerge: <First, Second>(first: First, second: Second) => First | Second | (First & Second);
48
48
  };
49
49
  export type { BannerPluginArgument, DefinePluginOptions, EntryOptions, ProgressPluginArgument, ProvidePluginOptions, } from './builtin-plugin';
50
- export { BannerPlugin, CaseSensitivePlugin, DefinePlugin, DynamicEntryPlugin, EntryPlugin, ExternalsPlugin, HotModuleReplacementPlugin, IgnorePlugin, type IgnorePluginOptions, NoEmitOnErrorsPlugin, ProgressPlugin, ProvidePlugin, RuntimePlugin, } from './builtin-plugin';
50
+ export { BannerPlugin, CaseSensitivePlugin,
51
+ /**
52
+ * @deprecated Use `rspack.CaseSensitivePlugin` instead
53
+ */
54
+ CaseSensitivePlugin as WarnCaseSensitiveModulesPlugin, DefinePlugin, DynamicEntryPlugin, EntryPlugin, ExternalsPlugin, HotModuleReplacementPlugin, IgnorePlugin, type IgnorePluginOptions, NoEmitOnErrorsPlugin, ProgressPlugin, ProvidePlugin, RuntimePlugin, } from './builtin-plugin';
51
55
  export { DllPlugin, type DllPluginOptions } from './lib/DllPlugin';
52
56
  export { DllReferencePlugin, type DllReferencePluginOptions, type DllReferencePluginOptionsContent, type DllReferencePluginOptionsManifest, type DllReferencePluginOptionsSourceType, } from './lib/DllReferencePlugin';
53
57
  export { default as EntryOptionPlugin } from './lib/EntryOptionPlugin';
@@ -55,7 +59,7 @@ export { EnvironmentPlugin } from './lib/EnvironmentPlugin';
55
59
  export { LoaderOptionsPlugin } from './lib/LoaderOptionsPlugin';
56
60
  export { LoaderTargetPlugin } from './lib/LoaderTargetPlugin';
57
61
  export type { OutputFileSystem, WatchFileSystem } from './util/fs';
58
- import { EsmLibraryPlugin, FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, rsc, SubresourceIntegrityPlugin } from './builtin-plugin';
62
+ import { EsmLibraryPlugin, FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, SubresourceIntegrityPlugin } from './builtin-plugin';
59
63
  export { SubresourceIntegrityPlugin };
60
64
  interface Web {
61
65
  FetchCompileAsyncWasmPlugin: typeof FetchCompileAsyncWasmPlugin;
@@ -143,10 +147,18 @@ interface Experiments {
143
147
  cleanup: () => Promise<void>;
144
148
  };
145
149
  RemoveDuplicateModulesPlugin: typeof RemoveDuplicateModulesPlugin;
150
+ /**
151
+ * @deprecated Use `rspack.SubresourceIntegrityPlugin` instead
152
+ */
153
+ SubresourceIntegrityPlugin: typeof SubresourceIntegrityPlugin;
146
154
  EsmLibraryPlugin: typeof EsmLibraryPlugin;
147
155
  RsdoctorPlugin: typeof RsdoctorPlugin;
148
156
  RstestPlugin: typeof RstestPlugin;
149
157
  RslibPlugin: typeof RslibPlugin;
158
+ /**
159
+ * @deprecated Use `rspack.lazyCompilationMiddleware` instead
160
+ */
161
+ lazyCompilationMiddleware: typeof lazyCompilationMiddleware;
150
162
  swc: {
151
163
  transform: typeof transform;
152
164
  minify: typeof minify;
@@ -162,6 +174,5 @@ interface Experiments {
162
174
  CssChunkingPlugin: typeof CssChunkingPlugin;
163
175
  createNativePlugin: typeof createNativePlugin;
164
176
  VirtualModulesPlugin: typeof VirtualModulesPlugin;
165
- rsc: typeof rsc;
166
177
  }
167
178
  export declare const experiments: Experiments;