@rspack-debug/browser 2.0.0-canary-20260116 → 2.0.0-rc.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 (127) hide show
  1. package/dist/BuildInfo.d.ts +3 -3
  2. package/dist/Chunk.d.ts +3 -3
  3. package/dist/ChunkGraph.d.ts +2 -2
  4. package/dist/Chunks.d.ts +2 -2
  5. package/dist/Compilation.d.ts +6 -3
  6. package/dist/Compiler.d.ts +5 -2
  7. package/dist/ConcatenatedModule.d.ts +1 -1
  8. package/dist/ContextModule.d.ts +1 -1
  9. package/dist/Diagnostics.d.ts +1 -1
  10. package/dist/Entrypoint.d.ts +1 -1
  11. package/dist/ExportsInfo.d.ts +1 -1
  12. package/dist/ExternalModule.d.ts +1 -1
  13. package/dist/FileSystem.d.ts +2 -2
  14. package/dist/Module.d.ts +3 -3
  15. package/dist/ModuleGraph.d.ts +2 -1
  16. package/dist/NativeWatchFileSystem.d.ts +1 -1
  17. package/dist/NormalModule.d.ts +2 -3
  18. package/dist/NormalModuleFactory.d.ts +1 -1
  19. package/dist/Resolver.d.ts +1 -1
  20. package/dist/ResolverFactory.d.ts +1 -1
  21. package/dist/RspackError.d.ts +2 -2
  22. package/dist/RuntimeGlobals.d.ts +2 -2
  23. package/dist/RuntimeModule.d.ts +1 -1
  24. package/dist/browser/BrowserRequirePlugin.d.ts +1 -1
  25. package/dist/browser/fs.d.ts +1 -1
  26. package/dist/browser/middleware.d.ts +1 -0
  27. package/dist/builtin-loader/lightningcss/index.d.ts +11 -9
  28. package/dist/builtin-loader/lightningcss/target.d.ts +4 -0
  29. package/dist/builtin-loader/swc/index.d.ts +2 -2
  30. package/dist/builtin-loader/swc/pluginImport.d.ts +1 -1
  31. package/dist/builtin-loader/swc/types.d.ts +36 -1
  32. package/dist/builtin-plugin/BannerPlugin.d.ts +1 -1
  33. package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +1 -1
  34. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
  35. package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
  36. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
  37. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
  38. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +1 -1
  39. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +1 -1
  40. package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +1 -1
  41. package/dist/builtin-plugin/EntryPlugin.d.ts +1 -1
  42. package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +5 -1
  43. package/dist/builtin-plugin/EsmNodeTargetPlugin.d.ts +9 -0
  44. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
  45. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
  46. package/dist/builtin-plugin/ExternalsPlugin.d.ts +1 -1
  47. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
  48. package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +1 -1
  49. package/dist/builtin-plugin/HttpUriPlugin.d.ts +1 -1
  50. package/dist/builtin-plugin/IgnorePlugin.d.ts +1 -1
  51. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
  52. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +5 -4
  53. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
  54. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
  55. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -1
  56. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -1
  57. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +1 -1
  58. package/dist/builtin-plugin/ProgressPlugin.d.ts +5 -4
  59. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +2 -2
  60. package/dist/builtin-plugin/RslibPlugin.d.ts +1 -1
  61. package/dist/builtin-plugin/RstestPlugin.d.ts +1 -1
  62. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
  63. package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
  64. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
  65. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +2 -1
  66. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +1 -1
  67. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +3 -2
  68. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +1 -1
  69. package/dist/builtin-plugin/WorkerPlugin.d.ts +2 -1
  70. package/dist/builtin-plugin/base.d.ts +1 -1
  71. package/dist/builtin-plugin/css-extract/index.d.ts +1 -1
  72. package/dist/builtin-plugin/html-plugin/hooks.d.ts +1 -1
  73. package/dist/builtin-plugin/html-plugin/plugin.d.ts +1 -1
  74. package/dist/builtin-plugin/index.d.ts +2 -0
  75. package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +3 -3
  76. package/dist/builtin-plugin/rsc/Coordinator.d.ts +8 -0
  77. package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +13 -0
  78. package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +39 -0
  79. package/dist/builtin-plugin/rsc/index.d.ts +24 -0
  80. package/dist/checkNodeVersion.d.ts +1 -0
  81. package/dist/config/adapter.d.ts +1 -1
  82. package/dist/config/adapterRuleUse.d.ts +3 -2
  83. package/dist/config/defaults.d.ts +4 -2
  84. package/dist/config/devServer.d.ts +102 -237
  85. package/dist/config/normalization.d.ts +2 -3
  86. package/dist/config/target.d.ts +14 -11
  87. package/dist/config/types.d.ts +152 -63
  88. package/dist/container/ContainerPlugin.d.ts +4 -3
  89. package/dist/container/ContainerReferencePlugin.d.ts +5 -4
  90. package/dist/container/ModuleFederationManifestPlugin.d.ts +11 -4
  91. package/dist/container/ModuleFederationPlugin.d.ts +20 -1
  92. package/dist/container/ModuleFederationPluginV1.d.ts +2 -2
  93. package/dist/container/ModuleFederationRuntimePlugin.d.ts +4 -0
  94. package/dist/exports.d.ts +13 -10
  95. package/dist/index.d.ts +2 -1
  96. package/dist/index.js +43927 -8544
  97. package/dist/index.js.LICENSE.txt +7 -0
  98. package/dist/lib/DllReferencePlugin.d.ts +1 -1
  99. package/dist/lib/WebpackError.d.ts +1 -1
  100. package/dist/loader-runner/index.d.ts +1 -1
  101. package/dist/loader-runner/worker.d.ts +1 -1
  102. package/dist/napi-binding.d.ts +248 -101
  103. package/dist/rspack.wasi-browser.js +7 -0
  104. package/dist/sharing/CollectSharedEntryPlugin.d.ts +22 -0
  105. package/dist/sharing/ConsumeSharedPlugin.d.ts +17 -4
  106. package/dist/sharing/IndependentSharedPlugin.d.ts +35 -0
  107. package/dist/sharing/ProvideSharedPlugin.d.ts +23 -3
  108. package/dist/sharing/SharePlugin.d.ts +43 -5
  109. package/dist/sharing/ShareRuntimePlugin.d.ts +1 -1
  110. package/dist/sharing/SharedContainerPlugin.d.ts +23 -0
  111. package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +14 -0
  112. package/dist/sharing/TreeShakingSharedPlugin.d.ts +16 -0
  113. package/dist/sharing/utils.d.ts +1 -0
  114. package/dist/stats/StatsFactory.d.ts +1 -1
  115. package/dist/stats/statsFactoryUtils.d.ts +2 -2
  116. package/dist/swc.d.ts +2 -2
  117. package/dist/taps/compilation.d.ts +1 -1
  118. package/dist/taps/types.d.ts +1 -1
  119. package/dist/util/SplitChunkSize.d.ts +1 -1
  120. package/dist/util/createHash.d.ts +1 -1
  121. package/dist/util/source.d.ts +1 -1
  122. package/dist/util/supportsColor.d.ts +6 -0
  123. package/dist/util/targetsVersion.d.ts +2 -0
  124. package/dist/wasi-worker-browser.mjs +26464 -22498
  125. package/package.json +6 -7
  126. package/dist/builtin-loader/index.d.ts +0 -1
  127. package/dist/rslib-runtime.js +0 -58
@@ -1,4 +1,4 @@
1
- import type { AssetInfo, RawFuncUseCtx } from '@rspack/binding';
1
+ import type { AssetInfo, RawFuncUseCtx } from '../binding';
2
2
  import type { HttpUriPluginOptions } from '../builtin-plugin/HttpUriPlugin';
3
3
  import type { ChunkGraph } from '../ChunkGraph';
4
4
  import type { Compilation, PathData } from '../Compilation';
@@ -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;
@@ -339,7 +343,7 @@ export type Output = {
339
343
  hotUpdateChunkFilename?: HotUpdateChunkFilename;
340
344
  /**
341
345
  * Only used when target is set to 'web', which uses JSONP for loading hot updates.
342
- * @default 'webpackHotUpdate' + output.uniqueName
346
+ * @default 'rspackHotUpdate' + output.uniqueName
343
347
  * */
344
348
  hotUpdateGlobal?: HotUpdateGlobal;
345
349
  /**
@@ -363,7 +367,6 @@ export type Output = {
363
367
  library?: Library;
364
368
  /**
365
369
  * Output JavaScript files as module type.
366
- * Disabled by default as it's an experimental feature. To use it, you must set experiments.outputModule to true.
367
370
  * @default false
368
371
  */
369
372
  module?: OutputModule;
@@ -589,7 +592,6 @@ export type ResolveOptions = {
589
592
  restrictions?: string[];
590
593
  /**
591
594
  * A list of directories where server-relative URLs (beginning with '/') are resolved.
592
- * It defaults to the context configuration option.
593
595
  * On systems other than Windows, these requests are initially resolved as an absolute path.
594
596
  * @default []
595
597
  */
@@ -714,6 +716,14 @@ export type AssetParserOptions = {
714
716
  };
715
717
  export type CssParserNamedExports = boolean;
716
718
  export type CssParserUrl = boolean;
719
+ export type CssParserResolveImportContext = {
720
+ url: string;
721
+ media: string | undefined;
722
+ resourcePath: string;
723
+ supports: string | undefined;
724
+ layer: string | undefined;
725
+ };
726
+ export type CssParserResolveImport = boolean | ((context: CssParserResolveImportContext) => boolean);
717
727
  /** Options object for `css` modules. */
718
728
  export type CssParserOptions = {
719
729
  /**
@@ -726,6 +736,11 @@ export type CssParserOptions = {
726
736
  * @default true
727
737
  * */
728
738
  url?: CssParserUrl;
739
+ /**
740
+ * Allow to enable/disables `@import` at-rules handling.
741
+ * @default true
742
+ * */
743
+ resolveImport?: CssParserResolveImport;
729
744
  };
730
745
  /** Options object for `css/auto` modules. */
731
746
  export type CssAutoParserOptions = {
@@ -739,6 +754,11 @@ export type CssAutoParserOptions = {
739
754
  * @default true
740
755
  * */
741
756
  url?: CssParserUrl;
757
+ /**
758
+ * Allow to enable/disables `@import` at-rules handling.
759
+ * @default true
760
+ * */
761
+ resolveImport?: CssParserResolveImport;
742
762
  };
743
763
  /** Options object for `css/module` modules. */
744
764
  export type CssModuleParserOptions = {
@@ -752,6 +772,11 @@ export type CssModuleParserOptions = {
752
772
  * @default true
753
773
  * */
754
774
  url?: CssParserUrl;
775
+ /**
776
+ * Allow to enable/disables `@import` at-rules handling.
777
+ * @default true
778
+ * */
779
+ resolveImport?: CssParserResolveImport;
755
780
  };
756
781
  type ExportsPresence = 'error' | 'warn' | 'auto' | false;
757
782
  export type JavascriptParserCommonjsExports = boolean | 'skipInEsm';
@@ -781,10 +806,10 @@ export type JavascriptParserOptions = {
781
806
  */
782
807
  dynamicImportFetchPriority?: 'low' | 'high' | 'auto';
783
808
  /**
784
- * Enable or disable evaluating import.meta.
785
- * @default true
809
+ * Enable or disable evaluating import.meta. Set to 'preserve-unknown' to preserve unknown properties for runtime evaluation.
810
+ * @default 'preserve-unknown'
786
811
  */
787
- importMeta?: boolean;
812
+ importMeta?: boolean | 'preserve-unknown';
788
813
  /**
789
814
  * Enable parsing of new URL() syntax.
790
815
  * @default true
@@ -811,15 +836,15 @@ export type JavascriptParserOptions = {
811
836
  wrappedContextRegExp?: RegExp;
812
837
  /**
813
838
  * Warn or error for using non-existent exports and conflicting re-exports.
814
- * @default 'auto'
839
+ * @default 'error'
815
840
  */
816
841
  exportsPresence?: ExportsPresence;
817
842
  /** Warn or error for using non-existent exports */
818
843
  importExportsPresence?: ExportsPresence;
819
844
  /** Warn or error for conflicting re-exports */
820
845
  reexportExportsPresence?: ExportsPresence;
821
- /** Emit errors instead of warnings when imported names don't exist in imported module. */
822
- strictExportPresence?: boolean;
846
+ /** Handle the this context correctly according to the spec for namespace objects. */
847
+ strictThisContextOnImports?: boolean;
823
848
  /** Provide custom syntax for Worker parsing, commonly used to support Worklet */
824
849
  worker?: string[] | boolean;
825
850
  /** Override the module to strict or non-strict. */
@@ -868,6 +893,11 @@ export type JavascriptParserOptions = {
868
893
  * @default false
869
894
  */
870
895
  deferImport?: boolean;
896
+ /**
897
+ * Whether to enable import.meta.resolve().
898
+ * @default false
899
+ */
900
+ importMetaResolve?: boolean;
871
901
  };
872
902
  export type JsonParserOptions = {
873
903
  /**
@@ -1040,10 +1070,6 @@ export type ModuleOptions = {
1040
1070
  generator?: GeneratorOptionsByModuleType;
1041
1071
  /** Keep module mechanism of the matched modules as-is, such as module.exports, require, import. */
1042
1072
  noParse?: NoParseOption;
1043
- /**
1044
- * Cache the resolving of module requests.
1045
- */
1046
- unsafeCache?: boolean | RegExp;
1047
1073
  };
1048
1074
  type AllowTarget = 'web' | 'webworker' | 'es3' | 'es5' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'es2023' | 'es2024' | 'es2025' | 'node' | 'async-node' | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | 'electron-main' | `electron${number}-main` | `electron${number}.${number}-main` | 'electron-renderer' | `electron${number}-renderer` | `electron${number}.${number}-renderer` | 'electron-preload' | `electron${number}-preload` | `electron${number}.${number}-preload` | 'nwjs' | `nwjs${number}` | `nwjs${number}.${number}` | 'node-webkit' | `node-webkit${number}` | `node-webkit${number}.${number}` | 'browserslist' | `browserslist:${string}`;
1049
1075
  /** Used to configure the target environment of Rspack output and the ECMAScript version of Rspack runtime code. */
@@ -1235,6 +1261,86 @@ export type NodeOptions = {
1235
1261
  export type Node = false | NodeOptions;
1236
1262
  export type Loader = Record<string, any>;
1237
1263
  export type SnapshotOptions = {};
1264
+ /**
1265
+ * Snapshot options for determining which files have been modified.
1266
+ */
1267
+ export type CacheSnapshotOptions = {
1268
+ /**
1269
+ * An array of paths to immutable files, changes to these paths will be ignored during hot restart.
1270
+ */
1271
+ immutablePaths?: (string | RegExp)[];
1272
+ /**
1273
+ * An array of paths in managedPaths that are not managed by the package manager.
1274
+ */
1275
+ unmanagedPaths?: (string | RegExp)[];
1276
+ /**
1277
+ * An array of paths managed by the package manager.
1278
+ * @default [/[\\/]node_modules[\\/][^.]/]
1279
+ */
1280
+ managedPaths?: (string | RegExp)[];
1281
+ };
1282
+ /**
1283
+ * Storage options for persistent cache.
1284
+ */
1285
+ export type CacheStorageOptions = {
1286
+ /**
1287
+ * Storage type, currently only supports 'filesystem'.
1288
+ */
1289
+ type: 'filesystem';
1290
+ /**
1291
+ * Cache directory path.
1292
+ * @default 'node_modules/.cache/rspack'
1293
+ */
1294
+ directory?: string;
1295
+ };
1296
+ /**
1297
+ * Persistent cache options.
1298
+ */
1299
+ export type PersistentCacheOptions = {
1300
+ /**
1301
+ * Cache type.
1302
+ */
1303
+ type: 'persistent';
1304
+ /**
1305
+ * An array of files containing build dependencies, Rspack will use the hash of each of these files to invalidate the persistent cache.
1306
+ * @default []
1307
+ */
1308
+ buildDependencies?: string[];
1309
+ /**
1310
+ * Cache version, different versions of caches are isolated from each other.
1311
+ * @default ""
1312
+ */
1313
+ version?: string;
1314
+ /**
1315
+ * Snapshot options for determining which files have been modified.
1316
+ */
1317
+ snapshot?: CacheSnapshotOptions;
1318
+ /**
1319
+ * Storage options for cache.
1320
+ */
1321
+ storage?: CacheStorageOptions;
1322
+ /**
1323
+ * Enable portable cache mode. When enabled, the generated cache content can be shared across different platforms and paths within the same project.
1324
+ * @description Portable cache makes the cache platform-independent by converting platform-specific data (e.g., absolute paths to relative paths) during serialization and deserialization.
1325
+ * @default false
1326
+ */
1327
+ portable?: boolean;
1328
+ /**
1329
+ * Enable read-only mode. When enabled, the cache will only be read from disk and never written to.
1330
+ * @description This is useful for CI environments where you want to use a pre-warmed cache without modifying it.
1331
+ * @default false
1332
+ */
1333
+ readonly?: boolean;
1334
+ };
1335
+ /**
1336
+ * Memory cache options.
1337
+ */
1338
+ export type MemoryCacheOptions = {
1339
+ /**
1340
+ * Cache type.
1341
+ */
1342
+ type: 'memory';
1343
+ };
1238
1344
  /**
1239
1345
  * Options for caching snapshots and intermediate products during the build process.
1240
1346
  * @description Controls whether caching is enabled or disabled.
@@ -1246,22 +1352,7 @@ export type SnapshotOptions = {};
1246
1352
  * // Disable caching
1247
1353
  * cache: false
1248
1354
  */
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
- };
1355
+ export type CacheOptions = boolean | MemoryCacheOptions | PersistentCacheOptions;
1265
1356
  export type StatsPresets = 'normal' | 'none' | 'verbose' | 'errors-only' | 'errors-warnings' | 'minimal' | 'detailed' | 'summary';
1266
1357
  type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
1267
1358
  type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
@@ -1348,7 +1439,8 @@ export type StatsOptions = {
1348
1439
  errorsCount?: boolean;
1349
1440
  /**
1350
1441
  * Enables or disables the use of colors in the output.
1351
- * @default false
1442
+ * When undefined, defaults to true if the environment supports color (TTY, FORCE_COLOR, or NO_COLOR unset), otherwise false.
1443
+ * @default environment-dependent (see above)
1352
1444
  */
1353
1445
  colors?: boolean | StatsColorOptions;
1354
1446
  /**
@@ -1844,8 +1936,6 @@ export type Optimization = {
1844
1936
  * @default false
1845
1937
  */
1846
1938
  runtimeChunk?: OptimizationRuntimeChunk;
1847
- /** Detect and remove modules from chunks these modules are already included in all parents. */
1848
- removeAvailableModules?: boolean;
1849
1939
  /**
1850
1940
  * Remove empty chunks generated in the compilation.
1851
1941
  * @default true
@@ -1972,7 +2062,7 @@ export type LazyCompilationOptions = {
1972
2062
  serverUrl?: string;
1973
2063
  /**
1974
2064
  * Customize the prefix used for lazy compilation endpoint.
1975
- * @default "/lazy-compilation-using-"
2065
+ * @default "/_rspack/lazy/trigger"
1976
2066
  */
1977
2067
  prefix?: string;
1978
2068
  };
@@ -1985,29 +2075,25 @@ export type Incremental = {
1985
2075
  */
1986
2076
  silent?: boolean;
1987
2077
  /**
1988
- * Enable incremental make.
1989
- */
1990
- make?: boolean;
1991
- /**
1992
- * Enable inference of async modules.
2078
+ * Enable incremental build module graph.
1993
2079
  */
1994
- inferAsyncModules?: boolean;
1995
- /**
1996
- * Enable incremental provided exports.
1997
- */
1998
- providedExports?: boolean;
2080
+ buildModuleGraph?: boolean;
1999
2081
  /**
2000
- * Enables diagnostics for dependencies.
2082
+ * Enable incremental finish modules.
2001
2083
  */
2002
- dependenciesDiagnostics?: boolean;
2084
+ finishModules?: boolean;
2003
2085
  /**
2004
- * Enables incremental side effects optimization.
2086
+ * Enable incremental optimize dependencies.
2005
2087
  */
2006
- sideEffects?: boolean;
2088
+ optimizeDependencies?: boolean;
2007
2089
  /**
2008
2090
  * Enable incremental build chunk graph.
2009
2091
  */
2010
2092
  buildChunkGraph?: boolean;
2093
+ /**
2094
+ * Enable incremental optimize chunk modules.
2095
+ */
2096
+ optimizeChunkModules?: boolean;
2011
2097
  /**
2012
2098
  * Enable incremental module ids.
2013
2099
  */
@@ -2037,11 +2123,11 @@ export type Incremental = {
2037
2123
  */
2038
2124
  chunksHashes?: boolean;
2039
2125
  /**
2040
- * Enable incremental chunk render.
2126
+ * Enable incremental chunk asset.
2041
2127
  */
2042
- chunksRender?: boolean;
2128
+ chunkAsset?: boolean;
2043
2129
  /**
2044
- * Enable incremental asset emission.
2130
+ * Enable incremental emit assets.
2045
2131
  */
2046
2132
  emitAssets?: boolean;
2047
2133
  };
@@ -2067,11 +2153,6 @@ export type Experiments = {
2067
2153
  * @default false
2068
2154
  */
2069
2155
  asyncWebAssembly?: boolean;
2070
- /**
2071
- * Enable output as ES module.
2072
- * @default false
2073
- */
2074
- outputModule?: boolean;
2075
2156
  /**
2076
2157
  * Enable CSS support.
2077
2158
  *
@@ -2083,12 +2164,16 @@ export type Experiments = {
2083
2164
  * - `module.generator["css/auto"]`
2084
2165
  * - `module.generator.css`
2085
2166
  * - `module.generator["css/module"]`
2167
+ *
2168
+ * @deprecated This option is deprecated. In Rspack 2.0, users need to manually add CSS rules to enable CSS support.
2169
+ * Example:
2170
+ * ```js
2171
+ * module: {
2172
+ * rules: [{ test: /\.css$/, type: "css/auto" }]
2173
+ * }
2174
+ * ```
2086
2175
  */
2087
2176
  css?: boolean;
2088
- /**
2089
- * Enable incremental builds.
2090
- */
2091
- incremental?: IncrementalPresets | Incremental;
2092
2177
  /**
2093
2178
  * Enable future default options.
2094
2179
  * @default false
@@ -2144,10 +2229,10 @@ export type WatchOptions = {
2144
2229
  stdin?: boolean;
2145
2230
  };
2146
2231
  /**
2147
- * Options for devServer, it based on `webpack-dev-server@5`
2232
+ * Options for dev server
2148
2233
  * */
2149
2234
  export type DevServer = DevServerOptions;
2150
- export type { Middleware as DevServerMiddleware } from './devServer';
2235
+ export type { DevServerClient, DevServerHeaders, DevServerHost, DevServerMiddleware, DevServerMiddlewareHandler, DevServerMiddlewareObject, DevServerOpenOptions, DevServerProxyConfigArray, DevServerProxyConfigArrayItem, DevServerStatic, DevServerStaticItem, DevServerWebSocketURL, } from './devServer';
2151
2236
  /**
2152
2237
  * Ignore specific warnings.
2153
2238
  */
@@ -2338,6 +2423,10 @@ export type RspackOptions = {
2338
2423
  * @default false
2339
2424
  */
2340
2425
  lazyCompilation?: boolean | LazyCompilationOptions;
2426
+ /**
2427
+ * Enable incremental builds.
2428
+ */
2429
+ incremental?: IncrementalPresets | Incremental;
2341
2430
  };
2342
2431
  /** Configuration for Rspack */
2343
2432
  export type Configuration = RspackOptions;
@@ -1,14 +1,15 @@
1
- import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
1
+ import { type BuiltinPlugin, BuiltinPluginName } from '../binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base';
3
3
  import type { Compiler } from '../Compiler';
4
4
  import type { EntryRuntime, FilenameTemplate, LibraryOptions } from '../config';
5
+ import { type ShareScope } from '../sharing/SharePlugin';
5
6
  export type ContainerPluginOptions = {
6
7
  exposes: Exposes;
7
8
  filename?: FilenameTemplate;
8
9
  library?: LibraryOptions;
9
10
  name: string;
10
11
  runtime?: EntryRuntime;
11
- shareScope?: string;
12
+ shareScope?: ShareScope;
12
13
  enhanced?: boolean;
13
14
  };
14
15
  export type Exposes = (ExposesItem | ExposesObject)[] | ExposesObject;
@@ -25,7 +26,7 @@ export declare class ContainerPlugin extends RspackBuiltinPlugin {
25
26
  name: BuiltinPluginName;
26
27
  _options: {
27
28
  name: string;
28
- shareScope: string;
29
+ shareScope: ShareScope;
29
30
  library: LibraryOptions;
30
31
  runtime: EntryRuntime | undefined;
31
32
  filename: string | undefined;
@@ -1,11 +1,12 @@
1
- import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
1
+ import { type BuiltinPlugin, BuiltinPluginName } from '../binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base';
3
3
  import type { Compiler } from '../Compiler';
4
4
  import type { ExternalsType } from '../config';
5
+ import { type ShareScope } from '../sharing/SharePlugin';
5
6
  export type ContainerReferencePluginOptions = {
6
7
  remoteType: ExternalsType;
7
8
  remotes: Remotes;
8
- shareScope?: string;
9
+ shareScope?: ShareScope;
9
10
  enhanced?: boolean;
10
11
  };
11
12
  export type Remotes = (RemotesItem | RemotesObject)[] | RemotesObject;
@@ -16,7 +17,7 @@ export type RemotesObject = {
16
17
  };
17
18
  export type RemotesConfig = {
18
19
  external: RemotesItem | RemotesItems;
19
- shareScope?: string;
20
+ shareScope?: ShareScope;
20
21
  };
21
22
  export declare class ContainerReferencePlugin extends RspackBuiltinPlugin {
22
23
  name: BuiltinPluginName;
@@ -24,7 +25,7 @@ export declare class ContainerReferencePlugin extends RspackBuiltinPlugin {
24
25
  remoteType: ExternalsType;
25
26
  remotes: [string, {
26
27
  external: string[];
27
- shareScope: string;
28
+ shareScope: ShareScope;
28
29
  }][];
29
30
  enhanced: boolean;
30
31
  };
@@ -1,6 +1,7 @@
1
- import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
1
+ import { type BuiltinPlugin, BuiltinPluginName } from '../binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base';
3
3
  import type { Compiler } from '../Compiler';
4
+ import { type ModuleFederationPluginOptions } from './ModuleFederationPlugin';
4
5
  export type RemoteAliasMap = Record<string, {
5
6
  name: string;
6
7
  entry?: string;
@@ -15,7 +16,7 @@ export type ManifestSharedOption = {
15
16
  requiredVersion?: string;
16
17
  singleton?: boolean;
17
18
  };
18
- export type ModuleFederationManifestPluginOptions = {
19
+ type InternalManifestPluginOptions = {
19
20
  name?: string;
20
21
  globalName?: string;
21
22
  filePath?: string;
@@ -25,13 +26,19 @@ export type ModuleFederationManifestPluginOptions = {
25
26
  exposes?: ManifestExposeOption[];
26
27
  shared?: ManifestSharedOption[];
27
28
  };
29
+ export type ModuleFederationManifestPluginOptions = boolean | Pick<InternalManifestPluginOptions, 'disableAssetsAnalyze' | 'filePath' | 'fileName'>;
30
+ export declare function getFileName(manifestOptions: ModuleFederationManifestPluginOptions): {
31
+ statsFileName: string;
32
+ manifestFileName: string;
33
+ };
28
34
  /**
29
35
  * JS-side post-processing plugin: reads mf-manifest.json and mf-stats.json, executes additionalData callback and merges/overwrites manifest.
30
36
  * To avoid cross-NAPI callback complexity, this plugin runs at the afterProcessAssets stage to ensure Rust-side MfManifestPlugin has already output its artifacts.
31
37
  */
32
38
  export declare class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
33
39
  name: BuiltinPluginName;
34
- private opts;
35
- constructor(opts: ModuleFederationManifestPluginOptions);
40
+ private rawOpts;
41
+ constructor(opts: ModuleFederationPluginOptions);
36
42
  raw(compiler: Compiler): BuiltinPlugin;
37
43
  }
44
+ export {};
@@ -1,15 +1,34 @@
1
1
  import type { Compiler } from '../Compiler';
2
+ import type { ExternalsType } from '../config';
3
+ import type { ShareScope } from '../sharing/SharePlugin';
2
4
  import { type ModuleFederationManifestPluginOptions } from './ModuleFederationManifestPlugin';
3
5
  import type { ModuleFederationPluginV1Options } from './ModuleFederationPluginV1';
6
+ import { type ModuleFederationRuntimeExperimentsOptions } from './ModuleFederationRuntimePlugin';
4
7
  export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPluginV1Options, 'enhanced'> {
5
8
  runtimePlugins?: RuntimePlugins;
6
9
  implementation?: string;
7
10
  shareStrategy?: 'version-first' | 'loaded-first';
8
- manifest?: boolean | Omit<ModuleFederationManifestPluginOptions, 'remoteAliasMap' | 'globalName' | 'name' | 'exposes' | 'shared'>;
11
+ manifest?: ModuleFederationManifestPluginOptions;
12
+ injectTreeShakingUsedExports?: boolean;
13
+ treeShakingSharedDir?: string;
14
+ treeShakingSharedExcludePlugins?: string[];
15
+ treeShakingSharedPlugins?: string[];
16
+ experiments?: ModuleFederationRuntimeExperimentsOptions;
9
17
  }
10
18
  export type RuntimePlugins = string[] | [string, Record<string, unknown>][];
11
19
  export declare class ModuleFederationPlugin {
12
20
  private _options;
21
+ private _treeShakingSharedPlugin?;
13
22
  constructor(_options: ModuleFederationPluginOptions);
14
23
  apply(compiler: Compiler): void;
15
24
  }
25
+ interface RemoteInfo {
26
+ alias: string;
27
+ name?: string;
28
+ entry?: string;
29
+ externalType: ExternalsType;
30
+ shareScope: ShareScope;
31
+ }
32
+ type RemoteInfos = Record<string, RemoteInfo[]>;
33
+ export declare function getRemoteInfos(options: ModuleFederationPluginOptions): RemoteInfos;
34
+ export {};
@@ -1,6 +1,6 @@
1
1
  import type { Compiler } from '../Compiler';
2
2
  import type { EntryRuntime, ExternalsType, LibraryOptions } from '../config';
3
- import { type Shared } from '../sharing/SharePlugin';
3
+ import { type Shared, type ShareScope } from '../sharing/SharePlugin';
4
4
  import { type Exposes } from './ContainerPlugin';
5
5
  import { type Remotes } from './ContainerReferencePlugin';
6
6
  export interface ModuleFederationPluginV1Options {
@@ -11,7 +11,7 @@ export interface ModuleFederationPluginV1Options {
11
11
  remoteType?: ExternalsType;
12
12
  remotes?: Remotes;
13
13
  runtime?: EntryRuntime;
14
- shareScope?: string;
14
+ shareScope?: ShareScope;
15
15
  shared?: Shared;
16
16
  enhanced?: boolean;
17
17
  }
@@ -1,5 +1,9 @@
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): {
package/dist/exports.d.ts CHANGED
@@ -1,15 +1,14 @@
1
1
  declare const rspackVersion: string;
2
2
  declare const version: string;
3
- export { rspackVersion, version };
4
3
  export type { Asset, AssetInfo, Assets, ChunkPathData, CompilationParams, LogEntry, PathData, } from './Compilation';
5
4
  export { Compilation } from './Compilation';
6
5
  export { Compiler, type CompilerHooks } from './Compiler';
7
6
  export type { MultiCompilerOptions, MultiRspackOptions } from './MultiCompiler';
8
7
  export { MultiCompiler } from './MultiCompiler';
8
+ export { rspackVersion, version };
9
9
  import { RspackOptionsApply } from './rspackOptionsApply';
10
- export { RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply };
11
- export type { ChunkGroup } from '@rspack/binding';
12
- export { AsyncDependenciesBlock, Dependency, EntryDependency, } from '@rspack/binding';
10
+ export type { ChunkGroup } from './binding';
11
+ export { AsyncDependenciesBlock, Dependency, EntryDependency, } from './binding';
13
12
  export type { Chunk } from './Chunk';
14
13
  export { ConcatenatedModule } from './ConcatenatedModule';
15
14
  export { ContextModule } from './ContextModule';
@@ -26,9 +25,10 @@ export { RuntimeModule } from './RuntimeModule';
26
25
  export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule, } from './Stats';
27
26
  export { Stats } from './Stats';
28
27
  export { StatsErrorCode } from './stats/statsFactoryUtils';
28
+ export { RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply };
29
29
  import * as ModuleFilenameHelpers from './lib/ModuleFilenameHelpers';
30
- export { ModuleFilenameHelpers };
31
30
  export { Template } from './Template';
31
+ export { ModuleFilenameHelpers };
32
32
  export declare const WebpackError: ErrorConstructor;
33
33
  export type { Watching } from './Watching';
34
34
  import * as sources from 'webpack-sources';
@@ -43,10 +43,10 @@ type Config = {
43
43
  export declare const config: Config;
44
44
  export type * from './config';
45
45
  export declare const util: {
46
- createHash: (algorithm: "debug" | "xxhash64" | "md4" | "native-md4" | (string & {}) | (new () => import("./util/hash").default)) => import("./util/hash").default;
46
+ createHash: (algorithm: "xxhash64" | "md4" | "native-md4" | (string & {}) | (new () => import("./util/hash").default)) => import("./util/hash").default;
47
47
  cleverMerge: <First, Second>(first: First, second: Second) => First | Second | (First & Second);
48
48
  };
49
- export type { BannerPluginArgument, DefinePluginOptions, EntryOptions, ProgressPluginArgument, ProvidePluginOptions, } from './builtin-plugin';
49
+ export type { BannerPluginArgument, DefinePluginOptions, EntryOptions, ProgressPluginHandlerInfo, ProgressPluginOptions, ProvidePluginOptions, } from './builtin-plugin';
50
50
  export { BannerPlugin, CaseSensitivePlugin, DefinePlugin, DynamicEntryPlugin, EntryPlugin, ExternalsPlugin, HotModuleReplacementPlugin, IgnorePlugin, type IgnorePluginOptions, NoEmitOnErrorsPlugin, ProgressPlugin, ProvidePlugin, RuntimePlugin, } from './builtin-plugin';
51
51
  export { DllPlugin, type DllPluginOptions } from './lib/DllPlugin';
52
52
  export { DllReferencePlugin, type DllReferencePluginOptions, type DllReferencePluginOptionsContent, type DllReferencePluginOptionsManifest, type DllReferencePluginOptionsSourceType, } from './lib/DllReferencePlugin';
@@ -55,7 +55,7 @@ export { EnvironmentPlugin } from './lib/EnvironmentPlugin';
55
55
  export { LoaderOptionsPlugin } from './lib/LoaderOptionsPlugin';
56
56
  export { LoaderTargetPlugin } from './lib/LoaderTargetPlugin';
57
57
  export type { OutputFileSystem, WatchFileSystem } from './util/fs';
58
- import { EsmLibraryPlugin, FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, SubresourceIntegrityPlugin } from './builtin-plugin';
58
+ import { FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, rsc, SubresourceIntegrityPlugin } from './builtin-plugin';
59
59
  export { SubresourceIntegrityPlugin };
60
60
  interface Web {
61
61
  FetchCompileAsyncWasmPlugin: typeof FetchCompileAsyncWasmPlugin;
@@ -121,11 +121,14 @@ export declare const container: {
121
121
  import { ConsumeSharedPlugin } from './sharing/ConsumeSharedPlugin';
122
122
  import { ProvideSharedPlugin } from './sharing/ProvideSharedPlugin';
123
123
  import { SharePlugin } from './sharing/SharePlugin';
124
+ import { TreeShakingSharedPlugin } from './sharing/TreeShakingSharedPlugin';
124
125
  export type { ConsumeSharedPluginOptions, Consumes, ConsumesConfig, ConsumesItem, ConsumesObject, } from './sharing/ConsumeSharedPlugin';
125
126
  export type { ProvideSharedPluginOptions, Provides, ProvidesConfig, ProvidesItem, ProvidesObject, } from './sharing/ProvideSharedPlugin';
126
127
  export type { Shared, SharedConfig, SharedItem, SharedObject, SharePluginOptions, } from './sharing/SharePlugin';
128
+ export type { TreeshakingSharedPluginOptions } from './sharing/TreeShakingSharedPlugin';
127
129
  export declare const sharing: {
128
130
  ProvideSharedPlugin: typeof ProvideSharedPlugin;
131
+ TreeShakingSharedPlugin: typeof TreeShakingSharedPlugin;
129
132
  ConsumeSharedPlugin: typeof ConsumeSharedPlugin;
130
133
  SharePlugin: typeof SharePlugin;
131
134
  };
@@ -133,7 +136,7 @@ export type { FeatureOptions as LightningcssFeatureOptions, LoaderOptions as Lig
133
136
  export type { SwcLoaderEnvConfig, SwcLoaderEsParserConfig, SwcLoaderJscConfig, SwcLoaderModuleConfig, SwcLoaderOptions, SwcLoaderParserConfig, SwcLoaderTransformConfig, SwcLoaderTsParserConfig, } from './builtin-loader/swc/index';
134
137
  export type { CircularDependencyRspackPluginOptions, CopyRspackPluginOptions, CssExtractRspackLoaderOptions, CssExtractRspackPluginOptions, EvalDevToolModulePluginOptions, HtmlRspackPluginOptions, LightningCssMinimizerRspackPluginOptions, RsdoctorPluginData, RsdoctorPluginHooks, SourceMapDevToolPluginOptions, SubresourceIntegrityPluginOptions, SwcJsMinimizerRspackPluginOptions, } from './builtin-plugin';
135
138
  export { CircularDependencyRspackPlugin, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, HtmlRspackPlugin, LightningCssMinimizerRspackPlugin, NormalModuleReplacementPlugin, SourceMapDevToolPlugin, SwcJsMinimizerRspackPlugin, } from './builtin-plugin';
136
- import { EnforceExtension, ResolverFactory, async as resolveAsync, sync as resolveSync } from '@rspack/binding';
139
+ import { EnforceExtension, ResolverFactory, async as resolveAsync, sync as resolveSync } from './binding';
137
140
  import { createNativePlugin } from './builtin-plugin';
138
141
  import { minify, minifySync, transform, transformSync } from './swc';
139
142
  import { VirtualModulesPlugin } from './VirtualModulesPlugin';
@@ -143,7 +146,6 @@ interface Experiments {
143
146
  cleanup: () => Promise<void>;
144
147
  };
145
148
  RemoveDuplicateModulesPlugin: typeof RemoveDuplicateModulesPlugin;
146
- EsmLibraryPlugin: typeof EsmLibraryPlugin;
147
149
  RsdoctorPlugin: typeof RsdoctorPlugin;
148
150
  RstestPlugin: typeof RstestPlugin;
149
151
  RslibPlugin: typeof RslibPlugin;
@@ -162,5 +164,6 @@ interface Experiments {
162
164
  CssChunkingPlugin: typeof CssChunkingPlugin;
163
165
  createNativePlugin: typeof createNativePlugin;
164
166
  VirtualModulesPlugin: typeof VirtualModulesPlugin;
167
+ rsc: typeof rsc;
165
168
  }
166
169
  export declare const experiments: Experiments;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import './checkNodeVersion';
1
2
  import * as rspackExports from './exports';
2
3
  import { rspack as rspackFn } from './rspack';
3
4
  type Rspack = typeof rspackFn & typeof rspackExports & {
@@ -7,4 +8,4 @@ type Rspack = typeof rspackFn & typeof rspackExports & {
7
8
  declare const rspack: Rspack;
8
9
  export * from './exports';
9
10
  export default rspack;
10
- export { rspack };
11
+ export { rspack, rspack as 'module.exports' };