@rspack-debug/core 2.0.0-canary.20260120 → 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 (91) hide show
  1. package/README.md +1 -1
  2. package/compiled/@rspack/lite-tapable/dist/index.d.ts +175 -0
  3. package/compiled/@rspack/lite-tapable/license +22 -0
  4. package/compiled/@rspack/lite-tapable/package.json +1 -0
  5. package/compiled/@swc/types/index.d.ts +15 -9
  6. package/compiled/@swc/types/package.json +1 -1
  7. package/compiled/connect-next/index.d.ts +56 -0
  8. package/compiled/connect-next/license +26 -0
  9. package/compiled/connect-next/package.json +1 -0
  10. package/compiled/http-proxy-middleware/index.d.ts +544 -0
  11. package/compiled/http-proxy-middleware/license +22 -0
  12. package/compiled/http-proxy-middleware/package.json +1 -0
  13. package/compiled/open/index.d.ts +161 -0
  14. package/compiled/open/package.json +1 -0
  15. package/compiled/watchpack/index.d.ts +2 -0
  16. package/compiled/webpack-sources/index.js +188 -131
  17. package/compiled/webpack-sources/package.json +1 -1
  18. package/compiled/webpack-sources/types.d.ts +6 -3
  19. package/dist/BuildInfo.d.ts +1 -1
  20. package/dist/Compilation.d.ts +5 -2
  21. package/dist/Compiler.d.ts +4 -3
  22. package/dist/ContextModuleFactory.d.ts +1 -1
  23. package/dist/FileSystem.d.ts +1 -1
  24. package/dist/Module.d.ts +1 -1
  25. package/dist/ModuleGraph.d.ts +1 -0
  26. package/dist/MultiCompiler.d.ts +1 -1
  27. package/dist/MultiWatching.d.ts +1 -1
  28. package/dist/NativeWatchFileSystem.d.ts +1 -1
  29. package/dist/NormalModule.d.ts +1 -2
  30. package/dist/NormalModuleFactory.d.ts +1 -1
  31. package/dist/RuntimeGlobals.d.ts +1 -1
  32. package/dist/Watching.d.ts +1 -1
  33. package/dist/builtin-loader/swc/pluginImport.d.ts +1 -1
  34. package/dist/builtin-loader/swc/types.d.ts +37 -2
  35. package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +4 -2
  36. package/dist/builtin-plugin/EsmNodeTargetPlugin.d.ts +9 -0
  37. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
  38. package/dist/builtin-plugin/ProgressPlugin.d.ts +5 -4
  39. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +3 -3
  40. package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
  41. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +2 -1
  42. package/dist/builtin-plugin/WorkerPlugin.d.ts +1 -0
  43. package/dist/builtin-plugin/html-plugin/hooks.d.ts +1 -1
  44. package/dist/builtin-plugin/index.d.ts +2 -0
  45. package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +3 -3
  46. package/dist/builtin-plugin/rsc/Coordinator.d.ts +8 -0
  47. package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +13 -0
  48. package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +39 -0
  49. package/dist/builtin-plugin/rsc/index.d.ts +24 -0
  50. package/dist/checkNodeVersion.d.ts +1 -0
  51. package/dist/config/devServer.d.ts +102 -237
  52. package/dist/config/normalization.d.ts +2 -3
  53. package/dist/config/types.d.ts +138 -61
  54. package/dist/container/ContainerPlugin.d.ts +3 -2
  55. package/dist/container/ContainerReferencePlugin.d.ts +4 -3
  56. package/dist/container/ModuleFederationManifestPlugin.d.ts +10 -3
  57. package/dist/container/ModuleFederationPlugin.d.ts +20 -1
  58. package/dist/container/ModuleFederationPluginV1.d.ts +2 -2
  59. package/dist/container/ModuleFederationRuntimePlugin.d.ts +4 -0
  60. package/dist/exports.d.ts +11 -8
  61. package/dist/index.d.ts +1 -0
  62. package/dist/index.js +1678 -620
  63. package/dist/lib/Cache.d.ts +1 -1
  64. package/dist/lib/HookWebpackError.d.ts +1 -1
  65. package/dist/moduleFederationDefaultRuntime.js +1 -1
  66. package/dist/node/NodeWatchFileSystem.d.ts +1 -1
  67. package/dist/rspack.d.ts +1 -1
  68. package/dist/sharing/CollectSharedEntryPlugin.d.ts +22 -0
  69. package/dist/sharing/ConsumeSharedPlugin.d.ts +16 -3
  70. package/dist/sharing/IndependentSharedPlugin.d.ts +35 -0
  71. package/dist/sharing/ProvideSharedPlugin.d.ts +22 -2
  72. package/dist/sharing/SharePlugin.d.ts +43 -5
  73. package/dist/sharing/SharedContainerPlugin.d.ts +23 -0
  74. package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +14 -0
  75. package/dist/sharing/TreeShakingSharedPlugin.d.ts +16 -0
  76. package/dist/sharing/utils.d.ts +1 -0
  77. package/dist/stats/StatsFactory.d.ts +1 -1
  78. package/dist/stats/StatsPrinter.d.ts +1 -1
  79. package/dist/swc.d.ts +2 -2
  80. package/dist/taps/types.d.ts +1 -1
  81. package/dist/util/createHash.d.ts +1 -1
  82. package/dist/util/source.d.ts +1 -1
  83. package/dist/util/supportsColor.d.ts +6 -0
  84. package/dist/worker.js +20 -19
  85. package/hot/dev-server.js +1 -1
  86. package/hot/emitter.js +0 -2
  87. package/hot/log.js +0 -2
  88. package/hot/only-dev-server.js +1 -1
  89. package/module.d.ts +4 -2
  90. package/package.json +20 -22
  91. package/dist/rslib-runtime.js +0 -29
@@ -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. */
@@ -367,7 +367,6 @@ export type Output = {
367
367
  library?: Library;
368
368
  /**
369
369
  * Output JavaScript files as module type.
370
- * Disabled by default as it's an experimental feature. To use it, you must set experiments.outputModule to true.
371
370
  * @default false
372
371
  */
373
372
  module?: OutputModule;
@@ -593,7 +592,6 @@ export type ResolveOptions = {
593
592
  restrictions?: string[];
594
593
  /**
595
594
  * A list of directories where server-relative URLs (beginning with '/') are resolved.
596
- * It defaults to the context configuration option.
597
595
  * On systems other than Windows, these requests are initially resolved as an absolute path.
598
596
  * @default []
599
597
  */
@@ -718,6 +716,14 @@ export type AssetParserOptions = {
718
716
  };
719
717
  export type CssParserNamedExports = boolean;
720
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);
721
727
  /** Options object for `css` modules. */
722
728
  export type CssParserOptions = {
723
729
  /**
@@ -730,6 +736,11 @@ export type CssParserOptions = {
730
736
  * @default true
731
737
  * */
732
738
  url?: CssParserUrl;
739
+ /**
740
+ * Allow to enable/disables `@import` at-rules handling.
741
+ * @default true
742
+ * */
743
+ resolveImport?: CssParserResolveImport;
733
744
  };
734
745
  /** Options object for `css/auto` modules. */
735
746
  export type CssAutoParserOptions = {
@@ -743,6 +754,11 @@ export type CssAutoParserOptions = {
743
754
  * @default true
744
755
  * */
745
756
  url?: CssParserUrl;
757
+ /**
758
+ * Allow to enable/disables `@import` at-rules handling.
759
+ * @default true
760
+ * */
761
+ resolveImport?: CssParserResolveImport;
746
762
  };
747
763
  /** Options object for `css/module` modules. */
748
764
  export type CssModuleParserOptions = {
@@ -756,6 +772,11 @@ export type CssModuleParserOptions = {
756
772
  * @default true
757
773
  * */
758
774
  url?: CssParserUrl;
775
+ /**
776
+ * Allow to enable/disables `@import` at-rules handling.
777
+ * @default true
778
+ * */
779
+ resolveImport?: CssParserResolveImport;
759
780
  };
760
781
  type ExportsPresence = 'error' | 'warn' | 'auto' | false;
761
782
  export type JavascriptParserCommonjsExports = boolean | 'skipInEsm';
@@ -785,10 +806,10 @@ export type JavascriptParserOptions = {
785
806
  */
786
807
  dynamicImportFetchPriority?: 'low' | 'high' | 'auto';
787
808
  /**
788
- * Enable or disable evaluating import.meta.
789
- * @default true
809
+ * Enable or disable evaluating import.meta. Set to 'preserve-unknown' to preserve unknown properties for runtime evaluation.
810
+ * @default 'preserve-unknown'
790
811
  */
791
- importMeta?: boolean;
812
+ importMeta?: boolean | 'preserve-unknown';
792
813
  /**
793
814
  * Enable parsing of new URL() syntax.
794
815
  * @default true
@@ -815,15 +836,15 @@ export type JavascriptParserOptions = {
815
836
  wrappedContextRegExp?: RegExp;
816
837
  /**
817
838
  * Warn or error for using non-existent exports and conflicting re-exports.
818
- * @default 'auto'
839
+ * @default 'error'
819
840
  */
820
841
  exportsPresence?: ExportsPresence;
821
842
  /** Warn or error for using non-existent exports */
822
843
  importExportsPresence?: ExportsPresence;
823
844
  /** Warn or error for conflicting re-exports */
824
845
  reexportExportsPresence?: ExportsPresence;
825
- /** Emit errors instead of warnings when imported names don't exist in imported module. */
826
- strictExportPresence?: boolean;
846
+ /** Handle the this context correctly according to the spec for namespace objects. */
847
+ strictThisContextOnImports?: boolean;
827
848
  /** Provide custom syntax for Worker parsing, commonly used to support Worklet */
828
849
  worker?: string[] | boolean;
829
850
  /** Override the module to strict or non-strict. */
@@ -872,6 +893,11 @@ export type JavascriptParserOptions = {
872
893
  * @default false
873
894
  */
874
895
  deferImport?: boolean;
896
+ /**
897
+ * Whether to enable import.meta.resolve().
898
+ * @default false
899
+ */
900
+ importMetaResolve?: boolean;
875
901
  };
876
902
  export type JsonParserOptions = {
877
903
  /**
@@ -1044,10 +1070,6 @@ export type ModuleOptions = {
1044
1070
  generator?: GeneratorOptionsByModuleType;
1045
1071
  /** Keep module mechanism of the matched modules as-is, such as module.exports, require, import. */
1046
1072
  noParse?: NoParseOption;
1047
- /**
1048
- * Cache the resolving of module requests.
1049
- */
1050
- unsafeCache?: boolean | RegExp;
1051
1073
  };
1052
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}`;
1053
1075
  /** Used to configure the target environment of Rspack output and the ECMAScript version of Rspack runtime code. */
@@ -1239,6 +1261,86 @@ export type NodeOptions = {
1239
1261
  export type Node = false | NodeOptions;
1240
1262
  export type Loader = Record<string, any>;
1241
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
+ };
1242
1344
  /**
1243
1345
  * Options for caching snapshots and intermediate products during the build process.
1244
1346
  * @description Controls whether caching is enabled or disabled.
@@ -1250,22 +1352,7 @@ export type SnapshotOptions = {};
1250
1352
  * // Disable caching
1251
1353
  * cache: false
1252
1354
  */
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
- };
1355
+ export type CacheOptions = boolean | MemoryCacheOptions | PersistentCacheOptions;
1269
1356
  export type StatsPresets = 'normal' | 'none' | 'verbose' | 'errors-only' | 'errors-warnings' | 'minimal' | 'detailed' | 'summary';
1270
1357
  type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
1271
1358
  type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
@@ -1352,7 +1439,8 @@ export type StatsOptions = {
1352
1439
  errorsCount?: boolean;
1353
1440
  /**
1354
1441
  * Enables or disables the use of colors in the output.
1355
- * @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)
1356
1444
  */
1357
1445
  colors?: boolean | StatsColorOptions;
1358
1446
  /**
@@ -1848,8 +1936,6 @@ export type Optimization = {
1848
1936
  * @default false
1849
1937
  */
1850
1938
  runtimeChunk?: OptimizationRuntimeChunk;
1851
- /** Detect and remove modules from chunks these modules are already included in all parents. */
1852
- removeAvailableModules?: boolean;
1853
1939
  /**
1854
1940
  * Remove empty chunks generated in the compilation.
1855
1941
  * @default true
@@ -1976,7 +2062,7 @@ export type LazyCompilationOptions = {
1976
2062
  serverUrl?: string;
1977
2063
  /**
1978
2064
  * Customize the prefix used for lazy compilation endpoint.
1979
- * @default "/lazy-compilation-using-"
2065
+ * @default "/_rspack/lazy/trigger"
1980
2066
  */
1981
2067
  prefix?: string;
1982
2068
  };
@@ -1989,29 +2075,25 @@ export type Incremental = {
1989
2075
  */
1990
2076
  silent?: boolean;
1991
2077
  /**
1992
- * Enable incremental make.
2078
+ * Enable incremental build module graph.
1993
2079
  */
1994
- make?: boolean;
2080
+ buildModuleGraph?: boolean;
1995
2081
  /**
1996
- * Enable inference of async modules.
2082
+ * Enable incremental finish modules.
1997
2083
  */
1998
- inferAsyncModules?: boolean;
1999
- /**
2000
- * Enable incremental provided exports.
2001
- */
2002
- providedExports?: boolean;
2084
+ finishModules?: boolean;
2003
2085
  /**
2004
- * Enables diagnostics for dependencies.
2086
+ * Enable incremental optimize dependencies.
2005
2087
  */
2006
- dependenciesDiagnostics?: boolean;
2007
- /**
2008
- * Enables incremental side effects optimization.
2009
- */
2010
- sideEffects?: boolean;
2088
+ optimizeDependencies?: boolean;
2011
2089
  /**
2012
2090
  * Enable incremental build chunk graph.
2013
2091
  */
2014
2092
  buildChunkGraph?: boolean;
2093
+ /**
2094
+ * Enable incremental optimize chunk modules.
2095
+ */
2096
+ optimizeChunkModules?: boolean;
2015
2097
  /**
2016
2098
  * Enable incremental module ids.
2017
2099
  */
@@ -2041,11 +2123,11 @@ export type Incremental = {
2041
2123
  */
2042
2124
  chunksHashes?: boolean;
2043
2125
  /**
2044
- * Enable incremental chunk render.
2126
+ * Enable incremental chunk asset.
2045
2127
  */
2046
- chunksRender?: boolean;
2128
+ chunkAsset?: boolean;
2047
2129
  /**
2048
- * Enable incremental asset emission.
2130
+ * Enable incremental emit assets.
2049
2131
  */
2050
2132
  emitAssets?: boolean;
2051
2133
  };
@@ -2071,11 +2153,6 @@ export type Experiments = {
2071
2153
  * @default false
2072
2154
  */
2073
2155
  asyncWebAssembly?: boolean;
2074
- /**
2075
- * Enable output as ES module.
2076
- * @default false
2077
- */
2078
- outputModule?: boolean;
2079
2156
  /**
2080
2157
  * Enable CSS support.
2081
2158
  *
@@ -2097,10 +2174,6 @@ export type Experiments = {
2097
2174
  * ```
2098
2175
  */
2099
2176
  css?: boolean;
2100
- /**
2101
- * Enable incremental builds.
2102
- */
2103
- incremental?: IncrementalPresets | Incremental;
2104
2177
  /**
2105
2178
  * Enable future default options.
2106
2179
  * @default false
@@ -2156,10 +2229,10 @@ export type WatchOptions = {
2156
2229
  stdin?: boolean;
2157
2230
  };
2158
2231
  /**
2159
- * Options for devServer, it based on `webpack-dev-server@5`
2232
+ * Options for dev server
2160
2233
  * */
2161
2234
  export type DevServer = DevServerOptions;
2162
- export type { Middleware as DevServerMiddleware } from './devServer.js';
2235
+ export type { DevServerClient, DevServerHeaders, DevServerHost, DevServerMiddleware, DevServerMiddlewareHandler, DevServerMiddlewareObject, DevServerOpenOptions, DevServerProxyConfigArray, DevServerProxyConfigArrayItem, DevServerStatic, DevServerStaticItem, DevServerWebSocketURL, } from './devServer.js';
2163
2236
  /**
2164
2237
  * Ignore specific warnings.
2165
2238
  */
@@ -2350,6 +2423,10 @@ export type RspackOptions = {
2350
2423
  * @default false
2351
2424
  */
2352
2425
  lazyCompilation?: boolean | LazyCompilationOptions;
2426
+ /**
2427
+ * Enable incremental builds.
2428
+ */
2429
+ incremental?: IncrementalPresets | Incremental;
2353
2430
  };
2354
2431
  /** Configuration for Rspack */
2355
2432
  export type Configuration = RspackOptions;
@@ -2,13 +2,14 @@ import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
3
3
  import type { Compiler } from '../Compiler.js';
4
4
  import type { EntryRuntime, FilenameTemplate, LibraryOptions } from '../config/index.js';
5
+ import { type ShareScope } from '../sharing/SharePlugin.js';
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;
@@ -2,10 +2,11 @@ import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
3
3
  import type { Compiler } from '../Compiler.js';
4
4
  import type { ExternalsType } from '../config/index.js';
5
+ import { type ShareScope } from '../sharing/SharePlugin.js';
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
1
  import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
3
3
  import type { Compiler } from '../Compiler.js';
4
+ import { type ModuleFederationPluginOptions } from './ModuleFederationPlugin.js';
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.js';
2
+ import type { ExternalsType } from '../config/index.js';
3
+ import type { ShareScope } from '../sharing/SharePlugin.js';
2
4
  import { type ModuleFederationManifestPluginOptions } from './ModuleFederationManifestPlugin.js';
3
5
  import type { ModuleFederationPluginV1Options } from './ModuleFederationPluginV1.js';
6
+ import { type ModuleFederationRuntimeExperimentsOptions } from './ModuleFederationRuntimePlugin.js';
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.js';
2
2
  import type { EntryRuntime, ExternalsType, LibraryOptions } from '../config/index.js';
3
- import { type Shared } from '../sharing/SharePlugin.js';
3
+ import { type Shared, type ShareScope } from '../sharing/SharePlugin.js';
4
4
  import { type Exposes } from './ContainerPlugin.js';
5
5
  import { type Remotes } from './ContainerReferencePlugin.js';
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,13 +1,12 @@
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.js';
5
4
  export { Compilation } from './Compilation.js';
6
5
  export { Compiler, type CompilerHooks } from './Compiler.js';
7
6
  export type { MultiCompilerOptions, MultiRspackOptions } from './MultiCompiler.js';
8
7
  export { MultiCompiler } from './MultiCompiler.js';
8
+ export { rspackVersion, version };
9
9
  import { RspackOptionsApply } from './rspackOptionsApply.js';
10
- export { RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply };
11
10
  export type { ChunkGroup } from '@rspack/binding';
12
11
  export { AsyncDependenciesBlock, Dependency, EntryDependency, } from '@rspack/binding';
13
12
  export type { Chunk } from './Chunk.js';
@@ -26,12 +25,13 @@ export { RuntimeModule } from './RuntimeModule.js';
26
25
  export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule, } from './Stats.js';
27
26
  export { Stats } from './Stats.js';
28
27
  export { StatsErrorCode } from './stats/statsFactoryUtils.js';
28
+ export { RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply };
29
29
  import * as ModuleFilenameHelpers from './lib/ModuleFilenameHelpers.js';
30
- export { ModuleFilenameHelpers };
31
30
  export { Template } from './Template.js';
31
+ export { ModuleFilenameHelpers };
32
32
  export declare const WebpackError: ErrorConstructor;
33
33
  export type { Watching } from './Watching.js';
34
- import * as sources from '../compiled/webpack-sources';
34
+ import * as sources from '../compiled/webpack-sources/types.js';
35
35
  export { sources };
36
36
  import { applyRspackOptionsDefaults, getNormalizedRspackOptions } from './config/index.js';
37
37
  type Config = {
@@ -43,10 +43,10 @@ type Config = {
43
43
  export declare const config: Config;
44
44
  export type * from './config/index.js';
45
45
  export declare const util: {
46
- createHash: (algorithm: "debug" | "xxhash64" | "md4" | "native-md4" | (string & {}) | (new () => import("./util/hash/index.js").default)) => import("./util/hash/index.js").default;
46
+ createHash: (algorithm: "xxhash64" | "md4" | "native-md4" | (string & {}) | (new () => import("./util/hash/index.js").default)) => import("./util/hash/index.js").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/index.js';
49
+ export type { BannerPluginArgument, DefinePluginOptions, EntryOptions, ProgressPluginHandlerInfo, ProgressPluginOptions, ProvidePluginOptions, } from './builtin-plugin/index.js';
50
50
  export { BannerPlugin, CaseSensitivePlugin, DefinePlugin, DynamicEntryPlugin, EntryPlugin, ExternalsPlugin, HotModuleReplacementPlugin, IgnorePlugin, type IgnorePluginOptions, NoEmitOnErrorsPlugin, ProgressPlugin, ProvidePlugin, RuntimePlugin, } from './builtin-plugin/index.js';
51
51
  export { DllPlugin, type DllPluginOptions } from './lib/DllPlugin.js';
52
52
  export { DllReferencePlugin, type DllReferencePluginOptions, type DllReferencePluginOptionsContent, type DllReferencePluginOptionsManifest, type DllReferencePluginOptionsSourceType, } from './lib/DllReferencePlugin.js';
@@ -55,7 +55,7 @@ export { EnvironmentPlugin } from './lib/EnvironmentPlugin.js';
55
55
  export { LoaderOptionsPlugin } from './lib/LoaderOptionsPlugin.js';
56
56
  export { LoaderTargetPlugin } from './lib/LoaderTargetPlugin.js';
57
57
  export type { OutputFileSystem, WatchFileSystem } from './util/fs.js';
58
- import { EsmLibraryPlugin, FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, SubresourceIntegrityPlugin } from './builtin-plugin/index.js';
58
+ import { FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, rsc, SubresourceIntegrityPlugin } from './builtin-plugin/index.js';
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.js';
122
122
  import { ProvideSharedPlugin } from './sharing/ProvideSharedPlugin.js';
123
123
  import { SharePlugin } from './sharing/SharePlugin.js';
124
+ import { TreeShakingSharedPlugin } from './sharing/TreeShakingSharedPlugin.js';
124
125
  export type { ConsumeSharedPluginOptions, Consumes, ConsumesConfig, ConsumesItem, ConsumesObject, } from './sharing/ConsumeSharedPlugin.js';
125
126
  export type { ProvideSharedPluginOptions, Provides, ProvidesConfig, ProvidesItem, ProvidesObject, } from './sharing/ProvideSharedPlugin.js';
126
127
  export type { Shared, SharedConfig, SharedItem, SharedObject, SharePluginOptions, } from './sharing/SharePlugin.js';
128
+ export type { TreeshakingSharedPluginOptions } from './sharing/TreeShakingSharedPlugin.js';
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
  };
@@ -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.js';
1
2
  import * as rspackExports from './exports.js';
2
3
  import { rspack as rspackFn } from './rspack.js';
3
4
  type Rspack = typeof rspackFn & typeof rspackExports & {