@rspack-canary/core 1.7.0-canary-ecf3f75d-20251223084957 → 1.7.0-canary-e20de023-20251223174329

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.
@@ -16,6 +16,7 @@ import type { CompilationParams } from "./Compilation";
16
16
  import { Compilation } from "./Compilation";
17
17
  import { ContextModuleFactory } from "./ContextModuleFactory";
18
18
  import type { EntryNormalized, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance } from "./config";
19
+ import type { PlatformTargetProperties } from "./config/target";
19
20
  import type { FileSystemInfoEntry } from "./FileSystemInfo";
20
21
  import { rspack } from "./index";
21
22
  import Cache from "./lib/Cache";
@@ -78,7 +79,6 @@ export type CompilerHooks = {
78
79
  entryOption: liteTapable.SyncBailHook<[string, EntryNormalized], any>;
79
80
  additionalPass: liteTapable.AsyncSeriesHook<[]>;
80
81
  };
81
- export declare const GET_COMPILER_ID: unique symbol;
82
82
  declare class Compiler {
83
83
  #private;
84
84
  hooks: CompilerHooks;
@@ -127,6 +127,8 @@ declare class Compiler {
127
127
  get managedPaths(): never;
128
128
  get immutablePaths(): never;
129
129
  get _lastCompilation(): Compilation | undefined;
130
+ get platform(): PlatformTargetProperties;
131
+ set platform(platform: PlatformTargetProperties);
130
132
  /**
131
133
  * Note: This is not a webpack public API, maybe removed in future.
132
134
  * @internal
@@ -10,6 +10,11 @@ export type SwcLoaderTsParserConfig = TsParserConfig;
10
10
  export type SwcLoaderTransformConfig = TransformConfig;
11
11
  export type SwcLoaderOptions = Config & {
12
12
  isModule?: boolean | "unknown";
13
+ /**
14
+ * Collects information from TypeScript's AST for consumption by subsequent Rspack processes,
15
+ * providing better TypeScript development experience and smaller output bundle size.
16
+ */
17
+ collectTypeScriptInfo?: CollectTypeScriptInfoOptions;
13
18
  /**
14
19
  * Experimental features provided by Rspack.
15
20
  * @experimental
@@ -17,14 +22,11 @@ export type SwcLoaderOptions = Config & {
17
22
  rspackExperiments?: {
18
23
  import?: PluginImportOptions;
19
24
  /**
25
+ * @deprecated Use top-level `collectTypeScriptInfo` instead.
20
26
  * Collects information from TypeScript's AST for consumption by subsequent Rspack processes,
21
27
  * providing better TypeScript development experience and smaller output bundle size.
22
28
  */
23
29
  collectTypeScriptInfo?: CollectTypeScriptInfoOptions;
24
- /**
25
- * Enable React Server Components support.
26
- */
27
- reactServerComponents?: boolean;
28
30
  };
29
31
  };
30
32
  export interface TerserCompressOptions {
@@ -1,4 +1,4 @@
1
- export declare const WarnCaseSensitiveModulesPlugin: {
1
+ export declare const CaseSensitivePlugin: {
2
2
  new (): {
3
3
  name: string;
4
4
  _args: [];
@@ -5,6 +5,7 @@ export * from "./AsyncWebAssemblyModulesPlugin";
5
5
  export * from "./BannerPlugin";
6
6
  export * from "./BundlerInfoRspackPlugin";
7
7
  export { createNativePlugin, RspackBuiltinPlugin } from "./base";
8
+ export * from "./CaseSensitivePlugin";
8
9
  export * from "./ChunkPrefetchPreloadPlugin";
9
10
  export * from "./CircularDependencyRspackPlugin";
10
11
  export * from "./CommonJsChunkFormatPlugin";
@@ -72,10 +73,6 @@ export * from "./RslibPlugin";
72
73
  export * from "./RstestPlugin";
73
74
  export * from "./RuntimeChunkPlugin";
74
75
  export * from "./RuntimePlugin";
75
- export { createRscPlugins, RSC_LAYERS_NAMES } from "./rsc";
76
- export * from "./rsc/Coordinator";
77
- export * from "./rsc/RscClientPlugin";
78
- export * from "./rsc/RscServerPlugin";
79
76
  export * from "./SideEffectsFlagPlugin";
80
77
  export * from "./SizeLimitsPlugin";
81
78
  export * from "./SourceMapDevToolPlugin";
@@ -83,6 +80,5 @@ export * from "./SplitChunksPlugin";
83
80
  export * from "./SubresourceIntegrityPlugin";
84
81
  export * from "./SwcJsMinimizerPlugin";
85
82
  export * from "./URLPlugin";
86
- export * from "./WarnCaseSensitiveModulesPlugin";
87
83
  export * from "./WebWorkerTemplatePlugin";
88
84
  export * from "./WorkerPlugin";
@@ -1,4 +1,13 @@
1
1
  import type { RspackOptionsNormalized } from "./normalization";
2
- export declare const applyRspackOptionsDefaults: (options: RspackOptionsNormalized) => void;
2
+ export declare const applyRspackOptionsDefaults: (options: RspackOptionsNormalized) => {
3
+ platform: false | {
4
+ web: boolean | null | undefined;
5
+ browser: boolean | null | undefined;
6
+ webworker: boolean | null | undefined;
7
+ node: boolean | null | undefined;
8
+ nwjs: boolean | null | undefined;
9
+ electron: boolean | null | undefined;
10
+ };
11
+ };
3
12
  export declare const applyRspackOptionsBaseDefaults: (options: RspackOptionsNormalized) => void;
4
13
  export declare const getPnpDefault: () => boolean;
@@ -5,17 +5,17 @@
5
5
  export declare const getDefaultTarget: (context: string) => "browserslist" | "web";
6
6
  export type PlatformTargetProperties = {
7
7
  /** web platform, importing of http(s) and std: is available */
8
- web: boolean | null;
8
+ web?: boolean | null;
9
9
  /** browser platform, running in a normal web browser */
10
- browser: boolean | null;
10
+ browser?: boolean | null;
11
11
  /** (Web)Worker platform, running in a web/shared/service worker */
12
- webworker: boolean | null;
12
+ webworker?: boolean | null;
13
13
  /** node platform, require of node built-in modules is available */
14
- node: boolean | null;
14
+ node?: boolean | null;
15
15
  /** nwjs platform, require of legacy nw.gui is available */
16
- nwjs: boolean | null;
16
+ nwjs?: boolean | null;
17
17
  /** electron platform, require of some electron built-in modules is available */
18
- electron: boolean | null;
18
+ electron?: boolean | null;
19
19
  };
20
20
  export type ElectronContextTargetProperties = {
21
21
  /** in main context */
@@ -2103,6 +2103,7 @@ export type Experiments = {
2103
2103
  outputModule?: boolean;
2104
2104
  /**
2105
2105
  * Enable top-level await.
2106
+ * @deprecated This option is deprecated, top-level await is enabled by default.
2106
2107
  * @default true
2107
2108
  */
2108
2109
  topLevelAwait?: boolean;
package/dist/exports.d.ts CHANGED
@@ -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, DefinePlugin, DynamicEntryPlugin, EntryPlugin, ExternalsPlugin, HotModuleReplacementPlugin, IgnorePlugin, type IgnorePluginOptions, NoEmitOnErrorsPlugin, ProgressPlugin, ProvidePlugin, RuntimePlugin, WarnCaseSensitiveModulesPlugin } 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 { createRscPlugins, EsmLibraryPlugin, FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, RSC_LAYERS_NAMES, 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;
@@ -132,7 +136,7 @@ export declare const sharing: {
132
136
  export type { FeatureOptions as LightningcssFeatureOptions, LoaderOptions as LightningcssLoaderOptions } from "./builtin-loader/lightningcss/index";
133
137
  export type { SwcLoaderEnvConfig, SwcLoaderEsParserConfig, SwcLoaderJscConfig, SwcLoaderModuleConfig, SwcLoaderOptions, SwcLoaderParserConfig, SwcLoaderTransformConfig, SwcLoaderTsParserConfig } from "./builtin-loader/swc/index";
134
138
  export type { CircularDependencyRspackPluginOptions, CopyRspackPluginOptions, CssExtractRspackLoaderOptions, CssExtractRspackPluginOptions, EvalDevToolModulePluginOptions, HtmlRspackPluginOptions, LightningCssMinimizerRspackPluginOptions, RsdoctorPluginData, RsdoctorPluginHooks, SourceMapDevToolPluginOptions, SubresourceIntegrityPluginOptions, SwcJsMinimizerRspackPluginOptions } from "./builtin-plugin";
135
- export { CircularDependencyRspackPlugin, ContextReplacementPlugin, Coordinator, CopyRspackPlugin, CssExtractRspackPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, HtmlRspackPlugin, LightningCssMinimizerRspackPlugin, NormalModuleReplacementPlugin, RscClientPlugin, RscServerPlugin, SourceMapDevToolPlugin, SwcJsMinimizerRspackPlugin } from "./builtin-plugin";
139
+ export { CircularDependencyRspackPlugin, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, HtmlRspackPlugin, LightningCssMinimizerRspackPlugin, NormalModuleReplacementPlugin, SourceMapDevToolPlugin, SwcJsMinimizerRspackPlugin } from "./builtin-plugin";
136
140
  import { EnforceExtension, ResolverFactory, async as resolveAsync, sync as resolveSync } from "@rspack/binding";
137
141
  import { createNativePlugin } from "./builtin-plugin";
138
142
  import { minify, minifySync, transform, transformSync } from "./swc";
@@ -170,7 +174,5 @@ interface Experiments {
170
174
  CssChunkingPlugin: typeof CssChunkingPlugin;
171
175
  createNativePlugin: typeof createNativePlugin;
172
176
  VirtualModulesPlugin: typeof VirtualModulesPlugin;
173
- createRscPlugins: typeof createRscPlugins;
174
- RSC_LAYERS_NAMES: typeof RSC_LAYERS_NAMES;
175
177
  }
176
178
  export declare const experiments: Experiments;
package/dist/index.js CHANGED
@@ -288,10 +288,8 @@ for(var __rspack_i in (()=>{
288
288
  SwcJsMinimizerRspackPlugin: ()=>SwcJsMinimizerRspackPlugin,
289
289
  ContextModule: ()=>binding_.ContextModule,
290
290
  DllPlugin: ()=>DllPlugin,
291
- WarnCaseSensitiveModulesPlugin: ()=>WarnCaseSensitiveModulesPlugin,
292
- Coordinator: ()=>Coordinator,
291
+ WarnCaseSensitiveModulesPlugin: ()=>CaseSensitivePlugin,
293
292
  ProvidePlugin: ()=>ProvidePlugin,
294
- RscClientPlugin: ()=>RscClientPlugin,
295
293
  Template: ()=>Template,
296
294
  container: ()=>container,
297
295
  HtmlRspackPlugin: ()=>HtmlRspackPlugin,
@@ -303,7 +301,6 @@ for(var __rspack_i in (()=>{
303
301
  EnvironmentPlugin: ()=>EnvironmentPlugin,
304
302
  HotModuleReplacementPlugin: ()=>HotModuleReplacementPlugin,
305
303
  Compilation: ()=>Compilation,
306
- RscServerPlugin: ()=>RscServerPlugin,
307
304
  experiments: ()=>exports_experiments,
308
305
  CircularDependencyRspackPlugin: ()=>CircularDependencyRspackPlugin,
309
306
  EvalSourceMapDevToolPlugin: ()=>EvalSourceMapDevToolPlugin,
@@ -333,9 +330,10 @@ for(var __rspack_i in (()=>{
333
330
  ModuleFilenameHelpers: ()=>ModuleFilenameHelpers_namespaceObject,
334
331
  MultiCompiler: ()=>MultiCompiler,
335
332
  SourceMapDevToolPlugin: ()=>SourceMapDevToolPlugin,
333
+ CaseSensitivePlugin: ()=>CaseSensitivePlugin,
336
334
  SubresourceIntegrityPlugin: ()=>SubresourceIntegrityPlugin,
337
- library: ()=>exports_library,
338
335
  RuntimeGlobals: ()=>DefaultRuntimeGlobals,
336
+ library: ()=>exports_library,
339
337
  node: ()=>exports_node,
340
338
  rspackVersion: ()=>exports_rspackVersion,
341
339
  util: ()=>util,
@@ -363,13 +361,13 @@ for(var __rspack_i in (()=>{
363
361
  __webpack_require__.r(exports_namespaceObject), __webpack_require__.d(exports_namespaceObject, {
364
362
  AsyncDependenciesBlock: ()=>binding_.AsyncDependenciesBlock,
365
363
  BannerPlugin: ()=>BannerPlugin,
364
+ CaseSensitivePlugin: ()=>CaseSensitivePlugin,
366
365
  CircularDependencyRspackPlugin: ()=>CircularDependencyRspackPlugin,
367
366
  Compilation: ()=>Compilation,
368
367
  Compiler: ()=>Compiler,
369
368
  ConcatenatedModule: ()=>binding_.ConcatenatedModule,
370
369
  ContextModule: ()=>binding_.ContextModule,
371
370
  ContextReplacementPlugin: ()=>ContextReplacementPlugin,
372
- Coordinator: ()=>Coordinator,
373
371
  CopyRspackPlugin: ()=>CopyRspackPlugin,
374
372
  CssExtractRspackPlugin: ()=>CssExtractRspackPlugin,
375
373
  DefinePlugin: ()=>DefinePlugin,
@@ -400,8 +398,6 @@ for(var __rspack_i in (()=>{
400
398
  NormalModuleReplacementPlugin: ()=>NormalModuleReplacementPlugin,
401
399
  ProgressPlugin: ()=>ProgressPlugin,
402
400
  ProvidePlugin: ()=>ProvidePlugin,
403
- RscClientPlugin: ()=>RscClientPlugin,
404
- RscServerPlugin: ()=>RscServerPlugin,
405
401
  RspackOptionsApply: ()=>RspackOptionsApply,
406
402
  RuntimeGlobals: ()=>DefaultRuntimeGlobals,
407
403
  RuntimeModule: ()=>RuntimeModule,
@@ -413,7 +409,7 @@ for(var __rspack_i in (()=>{
413
409
  SwcJsMinimizerRspackPlugin: ()=>SwcJsMinimizerRspackPlugin,
414
410
  Template: ()=>Template,
415
411
  ValidationError: ()=>ValidationError,
416
- WarnCaseSensitiveModulesPlugin: ()=>WarnCaseSensitiveModulesPlugin,
412
+ WarnCaseSensitiveModulesPlugin: ()=>CaseSensitivePlugin,
417
413
  WebpackError: ()=>exports_WebpackError,
418
414
  WebpackOptionsApply: ()=>RspackOptionsApply,
419
415
  config: ()=>exports_config,
@@ -2048,7 +2044,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2048
2044
  version: options.version || "unknown",
2049
2045
  bundler: options.bundler || "rspack",
2050
2046
  force: options.force ?? !0
2051
- })), ChunkPrefetchPreloadPlugin = base_create(binding_.BuiltinPluginName.ChunkPrefetchPreloadPlugin, ()=>{});
2047
+ })), CaseSensitivePlugin = base_create(binding_.BuiltinPluginName.CaseSensitivePlugin, ()=>{}, "compilation"), ChunkPrefetchPreloadPlugin = base_create(binding_.BuiltinPluginName.ChunkPrefetchPreloadPlugin, ()=>{});
2052
2048
  class CircularDependencyRspackPlugin extends RspackBuiltinPlugin {
2053
2049
  name = binding_.BuiltinPluginName.CircularDependencyRspackPlugin;
2054
2050
  _options;
@@ -2341,9 +2337,13 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
2341
2337
  return o.path + o.query + o.fragment;
2342
2338
  }
2343
2339
  let unsupported = (name, issue)=>{
2344
- let s = `${name} is not supported by rspack.`;
2345
- throw issue && (s += ` Please refer to issue ${issue} for more information.`), Error(s);
2346
- }, WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>"" === relativePath ? "./." : ".." === relativePath ? "../." : relativePath.startsWith("../") ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
2340
+ let s = `${name} is not supported by Rspack.`;
2341
+ throw issue && (s += ` Refer to issue ${issue} for more information.`), Error(s);
2342
+ }, warnedMessages = new Set();
2343
+ function deprecate(message) {
2344
+ warnedMessages.has(message) || (warnedMessages.add(message), console.warn(`[Rspack Deprecation] ${message}`));
2345
+ }
2346
+ let WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>"" === relativePath ? "./." : ".." === relativePath ? "../." : relativePath.startsWith("../") ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
2347
2347
  if ("/" === maybeAbsolutePath[0]) {
2348
2348
  if (maybeAbsolutePath.length > 1 && "/" === maybeAbsolutePath[maybeAbsolutePath.length - 1]) return maybeAbsolutePath;
2349
2349
  let querySplitPos = maybeAbsolutePath.indexOf("?"), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
@@ -2427,6 +2427,12 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
2427
2427
  query: match[2] ? match[2].replace(/\u200b(.)/g, "$1") : ""
2428
2428
  };
2429
2429
  });
2430
+ function resolveCollectTypeScriptInfo(options) {
2431
+ return {
2432
+ typeExports: options.typeExports,
2433
+ exportedEnum: !0 === options.exportedEnum ? "all" : !1 === options.exportedEnum || void 0 === options.exportedEnum ? "none" : "const-only"
2434
+ };
2435
+ }
2430
2436
  function toFeatures(featureOptions) {
2431
2437
  let feature = 0;
2432
2438
  for (let key of Reflect.ownKeys(featureOptions))if (!0 === featureOptions[key]) switch(key){
@@ -3724,33 +3730,27 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
3724
3730
  let temp = function(identifier, o, options) {
3725
3731
  if (identifier.startsWith(`${BUILTIN_LOADER_PREFIX}swc-loader`)) return ((options, _)=>{
3726
3732
  if (options && "object" == typeof options) {
3727
- options.jsc ??= {}, options.jsc.experimental ??= {}, options.jsc.experimental.disableAllLints ??= !0;
3733
+ options.jsc ??= {}, options.jsc.experimental ??= {}, options.jsc.experimental.disableAllLints ??= !0, options.collectTypeScriptInfo && (options.collectTypeScriptInfo = resolveCollectTypeScriptInfo(options.collectTypeScriptInfo));
3728
3734
  let { rspackExperiments } = options;
3729
- if (rspackExperiments) {
3730
- var options1;
3731
- (rspackExperiments.import || rspackExperiments.pluginImport) && (rspackExperiments.import = function(pluginImport) {
3732
- if (pluginImport) return pluginImport.map((config)=>{
3733
- let rawConfig = {
3734
- ...config,
3735
- style: {}
3736
- };
3737
- if ("boolean" == typeof config.style) rawConfig.style.bool = config.style;
3738
- else if ("string" == typeof config.style) {
3739
- let isTpl = config.style.includes("{{");
3740
- rawConfig.style[isTpl ? "custom" : "css"] = config.style;
3741
- } else {
3742
- var val;
3743
- val = config.style, "[object Object]" === Object.prototype.toString.call(val) && (rawConfig.style = config.style);
3744
- }
3745
- return config.styleLibraryDirectory && (rawConfig.style = {
3746
- styleLibraryDirectory: config.styleLibraryDirectory
3747
- }), rawConfig;
3748
- });
3749
- }(rspackExperiments.import || rspackExperiments.pluginImport)), rspackExperiments.collectTypeScriptInfo && (rspackExperiments.collectTypeScriptInfo = {
3750
- typeExports: (options1 = rspackExperiments.collectTypeScriptInfo).typeExports,
3751
- exportedEnum: !0 === options1.exportedEnum ? "all" : !1 === options1.exportedEnum || void 0 === options1.exportedEnum ? "none" : "const-only"
3735
+ rspackExperiments && ((rspackExperiments.import || rspackExperiments.pluginImport) && (rspackExperiments.import = function(pluginImport) {
3736
+ if (pluginImport) return pluginImport.map((config)=>{
3737
+ let rawConfig = {
3738
+ ...config,
3739
+ style: {}
3740
+ };
3741
+ if ("boolean" == typeof config.style) rawConfig.style.bool = config.style;
3742
+ else if ("string" == typeof config.style) {
3743
+ let isTpl = config.style.includes("{{");
3744
+ rawConfig.style[isTpl ? "custom" : "css"] = config.style;
3745
+ } else {
3746
+ var val;
3747
+ val = config.style, "[object Object]" === Object.prototype.toString.call(val) && (rawConfig.style = config.style);
3748
+ }
3749
+ return config.styleLibraryDirectory && (rawConfig.style = {
3750
+ styleLibraryDirectory: config.styleLibraryDirectory
3751
+ }), rawConfig;
3752
3752
  });
3753
- }
3753
+ }(rspackExperiments.import || rspackExperiments.pluginImport)), rspackExperiments.collectTypeScriptInfo && (deprecate("`rspackExperiments.collectTypeScriptInfo` is deprecated and will be removed in Rspack v2.0. Use top-level `collectTypeScriptInfo` instead."), options.collectTypeScriptInfo || (options.collectTypeScriptInfo = resolveCollectTypeScriptInfo(rspackExperiments.collectTypeScriptInfo)), delete rspackExperiments.collectTypeScriptInfo));
3754
3754
  }
3755
3755
  return options;
3756
3756
  })(o, 0);
@@ -4468,9 +4468,9 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4468
4468
  "function" == typeof next && next();
4469
4469
  }, DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN = "The `experiments.lazyCompilation` option is deprecated, please use the configuration top level `lazyCompilation` instead.", REPEAT_LAZY_COMPILATION_OPTIONS_WARN = "Both top-level `lazyCompilation` and `experiments.lazyCompilation` options are set. The top-level `lazyCompilation` configuration will take precedence.", lazyCompilationMiddleware = (compiler)=>{
4470
4470
  if (compiler instanceof MultiCompiler) {
4471
- let middlewareByCompiler = new Map(), i = 0, isReportDeprecatedWarned = !1, isReportRepeatWarned = !1;
4471
+ let middlewareByCompiler = new Map(), i = 0;
4472
4472
  for (let c of compiler.compilers){
4473
- if (c.options.experiments.lazyCompilation && (c.name ? console.warn(`The 'experiments.lazyCompilation' option in compiler named '${c.name}' is deprecated, please use the Configuration top level 'lazyCompilation' instead.`) : isReportDeprecatedWarned || (console.warn(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN), isReportDeprecatedWarned = !0)), c.options.lazyCompilation && c.options.experiments.lazyCompilation && (c.name ? console.warn(`The top-level 'lazyCompilation' option in compiler named '${c.name}' will override the 'experiments.lazyCompilation' option.`) : isReportRepeatWarned || (console.warn(REPEAT_LAZY_COMPILATION_OPTIONS_WARN), isReportRepeatWarned = !0)), !c.options.lazyCompilation && !c.options.experiments.lazyCompilation) continue;
4473
+ if (c.options.experiments.lazyCompilation && (c.name ? deprecate(`The 'experiments.lazyCompilation' option in compiler named '${c.name}' is deprecated, please use the Configuration top level 'lazyCompilation' instead.`) : deprecate(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN)), c.options.lazyCompilation && c.options.experiments.lazyCompilation && (c.name ? deprecate(`The top-level 'lazyCompilation' option in compiler named '${c.name}' will override the 'experiments.lazyCompilation' option.`) : deprecate(REPEAT_LAZY_COMPILATION_OPTIONS_WARN)), !c.options.lazyCompilation && !c.options.experiments.lazyCompilation) continue;
4474
4474
  let options = {
4475
4475
  ...c.options.experiments.lazyCompilation,
4476
4476
  ...c.options.lazyCompilation
@@ -4489,7 +4489,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4489
4489
  return middleware?.(req, res, next);
4490
4490
  };
4491
4491
  }
4492
- if (compiler.options.experiments.lazyCompilation && (console.warn(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN), compiler.options.lazyCompilation && console.warn(REPEAT_LAZY_COMPILATION_OPTIONS_WARN)), !compiler.options.lazyCompilation && !compiler.options.experiments.lazyCompilation) return noop;
4492
+ if (compiler.options.experiments.lazyCompilation && (deprecate(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN), compiler.options.lazyCompilation && deprecate(REPEAT_LAZY_COMPILATION_OPTIONS_WARN)), !compiler.options.lazyCompilation && !compiler.options.experiments.lazyCompilation) return noop;
4493
4493
  let activeModules = new Set(), options = {
4494
4494
  ...compiler.options.experiments.lazyCompilation,
4495
4495
  ...compiler.options.lazyCompilation
@@ -4622,64 +4622,6 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4622
4622
  ])
4623
4623
  }, RuntimePlugin_compilationHooksMap.set(compilation, hooks)), hooks;
4624
4624
  };
4625
- let Coordinator_PLUGIN_NAME = "RscPlugin", GET_OR_INIT_BINDING = Symbol("GET_OR_INIT_BINDING");
4626
- class Coordinator {
4627
- #serverCompiler;
4628
- #clientCompiler;
4629
- #clientLastCompilation;
4630
- #binding;
4631
- constructor(){
4632
- Object.defineProperty(this, GET_OR_INIT_BINDING, {
4633
- enumerable: !1,
4634
- configurable: !1,
4635
- writable: !1,
4636
- value: ()=>(this.#binding || (this.#binding = new binding_.JsCoordinator(()=>{
4637
- if (!this.#serverCompiler) throw Error("[RscPlugin] Coordinator.getOrInitBinding() called before the server compiler was attached. Call coordinator.applyServerCompiler(serverCompiler) first.");
4638
- return this.#serverCompiler[GET_COMPILER_ID]();
4639
- })), this.#binding)
4640
- });
4641
- }
4642
- applyServerCompiler(serverCompiler) {
4643
- this.#serverCompiler = serverCompiler, serverCompiler.hooks.done.tap(Coordinator_PLUGIN_NAME, (stats)=>{
4644
- this.#clientLastCompilation && (stats.compilation.fileDependencies.addAll(this.#clientLastCompilation.fileDependencies), stats.compilation.contextDependencies.addAll(this.#clientLastCompilation.contextDependencies), stats.compilation.missingDependencies.addAll(this.#clientLastCompilation.missingDependencies));
4645
- }), serverCompiler.hooks.watchRun.tap(Coordinator_PLUGIN_NAME, ()=>{
4646
- this.#clientCompiler.watching.invalidateWithChangesAndRemovals(new Set(this.#serverCompiler.modifiedFiles), new Set(this.#serverCompiler.removedFiles));
4647
- });
4648
- }
4649
- applyClientCompiler(clientCompiler) {
4650
- this.#clientCompiler = clientCompiler;
4651
- let originalWatch = clientCompiler.watch;
4652
- clientCompiler.watch = function(watchOptions, handler) {
4653
- return watchOptions.ignored = ()=>!0, originalWatch.call(this, watchOptions, handler);
4654
- }, clientCompiler.hooks.done.tap(Coordinator_PLUGIN_NAME, (stats)=>{
4655
- this.#clientLastCompilation = stats.compilation;
4656
- });
4657
- }
4658
- }
4659
- class RscClientPlugin extends RspackBuiltinPlugin {
4660
- name = "RscClientPlugin";
4661
- #coordinator;
4662
- constructor(coordinator){
4663
- super(), this.#coordinator = coordinator;
4664
- }
4665
- raw(compiler) {
4666
- return this.#coordinator.applyClientCompiler(compiler), createBuiltinPlugin(this.name, this.#coordinator[GET_OR_INIT_BINDING]());
4667
- }
4668
- }
4669
- class RscServerPlugin extends RspackBuiltinPlugin {
4670
- name = "RscServerPlugin";
4671
- #coordinator;
4672
- constructor(coordinator){
4673
- super(), this.#coordinator = coordinator;
4674
- }
4675
- #resolve(serverCompiler) {
4676
- return this.#coordinator.applyServerCompiler(serverCompiler), this.#coordinator[GET_OR_INIT_BINDING]();
4677
- }
4678
- raw(compiler) {
4679
- let bindingOptions = this.#resolve(compiler);
4680
- return createBuiltinPlugin(this.name, bindingOptions);
4681
- }
4682
- }
4683
4625
  let SideEffectsFlagPlugin = base_create(binding_.BuiltinPluginName.SideEffectsFlagPlugin, ()=>{}, "compilation"), SizeLimitsPlugin = base_create(binding_.BuiltinPluginName.SizeLimitsPlugin, (options)=>{
4684
4626
  let hints = !1 === options.hints ? void 0 : options.hints;
4685
4627
  return {
@@ -4927,7 +4869,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4927
4869
  module: options?.minimizerOptions?.module
4928
4870
  }
4929
4871
  };
4930
- }, "compilation"), URLPlugin = base_create(binding_.BuiltinPluginName.URLPlugin, ()=>{}, "compilation"), WarnCaseSensitiveModulesPlugin = base_create(binding_.BuiltinPluginName.WarnCaseSensitiveModulesPlugin, ()=>{}, "compilation");
4872
+ }, "compilation"), URLPlugin = base_create(binding_.BuiltinPluginName.URLPlugin, ()=>{}, "compilation");
4931
4873
  class WebWorkerTemplatePlugin extends RspackBuiltinPlugin {
4932
4874
  name = binding_.BuiltinPluginName.WebWorkerTemplatePlugin;
4933
4875
  raw(compiler) {
@@ -5846,7 +5788,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
5846
5788
  if ("function" != typeof options.entry) for (let key of Object.keys(options.entry))F(options.entry[key], "import", ()=>[
5847
5789
  "./src"
5848
5790
  ]);
5849
- F(options, "devtool", ()=>!!development && "eval"), D(options, "watch", !1), D(options, "profile", !1), F(options, "lazyCompilation", ()=>!!targetProperties && !!targetProperties.web && !targetProperties.electron && !targetProperties.node && !targetProperties.nwjs && {
5791
+ return F(options, "devtool", ()=>!!development && "eval"), D(options, "watch", !1), D(options, "profile", !1), F(options, "lazyCompilation", ()=>!!targetProperties && !!targetProperties.web && !targetProperties.electron && !targetProperties.node && !targetProperties.nwjs && {
5850
5792
  imports: !0,
5851
5793
  entries: !1
5852
5794
  }), D(options, "bail", !1), F(options, "cache", ()=>development), !1 === options.cache && (options.experiments.cache = !1), applyExperimentsDefaults(options.experiments, {
@@ -5888,7 +5830,16 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
5888
5830
  targetProperties,
5889
5831
  mode: options.mode,
5890
5832
  css: options.experiments.css
5891
- }), options.resolve), options.resolveLoader = cleverMerge(getResolveLoaderDefaults(), options.resolveLoader);
5833
+ }), options.resolve), options.resolveLoader = cleverMerge(getResolveLoaderDefaults(), options.resolveLoader), {
5834
+ platform: !1 === targetProperties ? targetProperties : {
5835
+ web: targetProperties.web,
5836
+ browser: targetProperties.browser,
5837
+ webworker: targetProperties.webworker,
5838
+ node: targetProperties.node,
5839
+ nwjs: targetProperties.nwjs,
5840
+ electron: targetProperties.electron
5841
+ }
5842
+ };
5892
5843
  }, applyInfrastructureLoggingDefaults = (infrastructureLogging)=>{
5893
5844
  F(infrastructureLogging, "stream", ()=>process.stderr);
5894
5845
  let tty = infrastructureLogging.stream?.isTTY && "dumb" !== process.env.TERM;
@@ -5896,7 +5847,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
5896
5847
  }, applyExperimentsDefaults = (experiments, { development })=>{
5897
5848
  F(experiments, "cache", ()=>development), D(experiments, "futureDefaults", !1), D(experiments, "lazyCompilation", !1), D(experiments, "asyncWebAssembly", experiments.futureDefaults), D(experiments, "css", !!experiments.futureDefaults || void 0), D(experiments, "topLevelAwait", !0), D(experiments, "deferImport", !1), D(experiments, "buildHttp", void 0), experiments.buildHttp && "object" == typeof experiments.buildHttp && D(experiments.buildHttp, "upgrade", !1), D(experiments, "incremental", {}), "object" == typeof experiments.incremental && (D(experiments.incremental, "silent", !0), D(experiments.incremental, "make", !0), D(experiments.incremental, "inferAsyncModules", !0), D(experiments.incremental, "providedExports", !0), D(experiments.incremental, "dependenciesDiagnostics", !0), D(experiments.incremental, "sideEffects", !0), D(experiments.incremental, "buildChunkGraph", !1), D(experiments.incremental, "moduleIds", !0), D(experiments.incremental, "chunkIds", !0), D(experiments.incremental, "modulesHashes", !0), D(experiments.incremental, "modulesCodegen", !0), D(experiments.incremental, "modulesRuntimeRequirements", !0), D(experiments.incremental, "chunksRuntimeRequirements", !0), D(experiments.incremental, "chunksHashes", !0), D(experiments.incremental, "chunksRender", !0), D(experiments.incremental, "emitAssets", !0)), D(experiments, "rspackFuture", {}), D(experiments, "parallelLoader", !1), D(experiments, "useInputFileSystem", !1), D(experiments, "inlineConst", !0), D(experiments, "inlineEnum", !1), D(experiments, "typeReexportsPresence", !1), D(experiments, "lazyBarrel", !0);
5898
5849
  }, applybundlerInfoDefaults = (rspackFuture, library)=>{
5899
- "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-ecf3f75d-20251223084957"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
5850
+ "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-e20de023-20251223174329"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
5900
5851
  }, applySnapshotDefaults = (_snapshot, _env)=>{}, applyModuleDefaults = (module1, { cache, asyncWebAssembly, css, targetProperties, mode, uniqueName, deferImport })=>{
5901
5852
  if (assertNotNill(module1.parser), assertNotNill(module1.generator), cache ? D(module1, "unsafeCache", /[\\/]node_modules[\\/]/) : D(module1, "unsafeCache", !1), F(module1.parser, "asset", ()=>({})), assertNotNill(module1.parser.asset), F(module1.parser.asset, "dataUrlCondition", ()=>({})), "object" == typeof module1.parser.asset.dataUrlCondition && D(module1.parser.asset.dataUrlCondition, "maxSize", 8096), F(module1.parser, "javascript", ()=>({})), assertNotNill(module1.parser.javascript), ((parserOptions, { deferImport })=>{
5902
5853
  D(parserOptions, "dynamicImportMode", "lazy"), D(parserOptions, "dynamicImportPrefetch", !1), D(parserOptions, "dynamicImportPreload", !1), D(parserOptions, "url", !0), D(parserOptions, "exprContextCritical", !0), D(parserOptions, "unknownContextCritical", !0), D(parserOptions, "wrappedContextCritical", !1), D(parserOptions, "wrappedContextRegExp", /.*/), D(parserOptions, "strictExportPresence", !1), D(parserOptions, "requireAsExpression", !0), D(parserOptions, "requireDynamic", !0), D(parserOptions, "requireResolve", !0), D(parserOptions, "commonjs", !0), D(parserOptions, "importDynamic", !0), D(parserOptions, "worker", [
@@ -6376,7 +6327,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6376
6327
  main: {}
6377
6328
  } : "function" == typeof config.entry ? (fn = config.entry, ()=>Promise.resolve().then(fn).then(getNormalizedEntryStatic)) : getNormalizedEntryStatic(config.entry),
6378
6329
  output: nestedConfig(config.output, (output)=>{
6379
- "cssHeadDataCompression" in output && external_node_util_default().deprecate(()=>{}, "cssHeadDataCompression is not used now, see https://github.com/web-infra-dev/rspack/pull/8534, this option could be removed in the future")();
6330
+ "cssHeadDataCompression" in output && deprecate("cssHeadDataCompression is not used now, see https://github.com/web-infra-dev/rspack/pull/8534, this option could be removed in the future");
6380
6331
  let { library } = output, libraryBase = "object" == typeof library && library && !Array.isArray(library) && "type" in library ? library : library || output.libraryTarget ? {
6381
6332
  name: library
6382
6333
  } : void 0;
@@ -6515,7 +6466,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6515
6466
  plugins: nestedArray(config.plugins, (p)=>[
6516
6467
  ...p
6517
6468
  ]),
6518
- experiments: nestedConfig(config.experiments, (experiments)=>(experiments.layers && external_node_util_default().deprecate(()=>{}, "`experiments.layers` config has been deprecated and will be removed in Rspack v2.0. Feature layers will be always enabled. Please remove this option from your Rspack configuration.")(), !1 === experiments.topLevelAwait && external_node_util_default().deprecate(()=>{}, "`experiments.topLevelAwait` config has been deprecated and will be removed in Rspack v2.0. Top-level await will be always enabled. Please remove this option from your Rspack configuration.")(), experiments.lazyBarrel && external_node_util_default().deprecate(()=>{}, "`experiments.lazyBarrel` config has been deprecated and will be removed in Rspack v2.0. Lazy barrel is already stable and enabled by default. Please remove this option from your Rspack configuration.")(), experiments.inlineConst && external_node_util_default().deprecate(()=>{}, "`experiments.inlineConst` config has been deprecated and will be removed in Rspack v2.0. Inline Const is already stable and enabled by default. Please remove this option from your Rspack configuration.")(), experiments.inlineEnum && external_node_util_default().deprecate(()=>{}, "`experiments.inlineEnum` config has been deprecated and will be removed in Rspack v2.0. Inline Enum is already stable. Please remove this option from your Rspack configuration.")(), experiments.typeReexportsPresence && external_node_util_default().deprecate(()=>{}, "`experiments.typeReexportsPresence` config has been deprecated and will be removed in Rspack v2.0. typeReexportsPresence is already stable. Please remove this option from your Rspack configuration.")(), {
6469
+ experiments: nestedConfig(config.experiments, (experiments)=>(experiments.layers && deprecate("`experiments.layers` config is deprecated and will be removed in Rspack v2.0. Feature layers will always be enabled. Remove this option from your Rspack configuration."), !1 === experiments.topLevelAwait && deprecate("`experiments.topLevelAwait` config is deprecated and will be removed in Rspack v2.0. Top-level await will always be enabled. Remove this option from your Rspack configuration."), experiments.lazyBarrel && deprecate("`experiments.lazyBarrel` config is deprecated and will be removed in Rspack v2.0. Lazy barrel is already stable and enabled by default. Remove this option from your Rspack configuration."), experiments.inlineConst && deprecate("`experiments.inlineConst` config is deprecated and will be removed in Rspack v2.0. Inline Const is already stable and enabled by default. Remove this option from your Rspack configuration."), experiments.inlineEnum && deprecate("`experiments.inlineEnum` config is deprecated and will be removed in Rspack v2.0. Inline Enum is already stable. Remove this option from your Rspack configuration."), experiments.typeReexportsPresence && deprecate("`experiments.typeReexportsPresence` config is deprecated and will be removed in Rspack v2.0. typeReexportsPresence is already stable. Remove this option from your Rspack configuration."), {
6519
6470
  ...experiments,
6520
6471
  cache: optionalNestedConfig(experiments.cache, (cache)=>{
6521
6472
  if ("boolean" == typeof cache || "memory" === cache.type) return cache;
@@ -7662,7 +7613,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7662
7613
  });
7663
7614
  }
7664
7615
  }
7665
- let CORE_VERSION = "1.7.0-canary-ecf3f75d-20251223084957", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
7616
+ let CORE_VERSION = "1.7.0-canary-e20de023-20251223174329", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
7666
7617
 
7667
7618
  Help:
7668
7619
  Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
@@ -7925,7 +7876,7 @@ Help:
7925
7876
  this.suspended && (this.suspended = !1, this.#invalidate());
7926
7877
  }
7927
7878
  }
7928
- let COMPILATION_WEAK_MAP = new WeakMap(), GET_COMPILER_ID = Symbol("getCompilerId");
7879
+ let COMPILATION_WEAK_MAP = new WeakMap();
7929
7880
  class Compiler {
7930
7881
  #instance;
7931
7882
  #initial;
@@ -7962,6 +7913,7 @@ Help:
7962
7913
  context;
7963
7914
  cache;
7964
7915
  compilerPath;
7916
+ #platform;
7965
7917
  options;
7966
7918
  unsafeFastDrop = !1;
7967
7919
  __internal_browser_require;
@@ -8060,14 +8012,16 @@ Help:
8060
8012
  }, this.rspack = {
8061
8013
  ...src_rspack_0,
8062
8014
  RuntimeGlobals: compilerRuntimeGlobals
8063
- }, this.root = this, this.outputPath = "", this.inputFileSystem = null, this.intermediateFileSystem = null, this.outputFileSystem = null, this.watchFileSystem = null, this.records = {}, this.options = options, this.context = context, this.cache = new Cache(), this.compilerPath = "", this.running = !1, this.idle = !1, this.watchMode = !1, this.__internal_browser_require = ()=>{
8015
+ }, this.root = this, this.outputPath = "", this.inputFileSystem = null, this.intermediateFileSystem = null, this.outputFileSystem = null, this.watchFileSystem = null, this.records = {}, this.options = options, this.context = context, this.cache = new Cache(), this.compilerPath = "", this.running = !1, this.idle = !1, this.watchMode = !1, this.#platform = {
8016
+ web: null,
8017
+ browser: null,
8018
+ webworker: null,
8019
+ node: null,
8020
+ nwjs: null,
8021
+ electron: null
8022
+ }, this.__internal_browser_require = ()=>{
8064
8023
  throw Error("Cannot execute user defined code in browser without `BrowserRequirePlugin`");
8065
- }, this.resolverFactory = new ResolverFactory(options.resolve.pnp ?? getPnpDefault(), options.resolve, options.resolveLoader), new JsLoaderRspackPlugin(this).apply(this), new ExecuteModulePlugin().apply(this), new TraceHookPlugin().apply(this), Object.defineProperty(this, GET_COMPILER_ID, {
8066
- writable: !1,
8067
- configurable: !1,
8068
- enumerable: !1,
8069
- value: ()=>this.#instance.getCompilerId()
8070
- });
8024
+ }, this.resolverFactory = new ResolverFactory(options.resolve.pnp ?? getPnpDefault(), options.resolve, options.resolveLoader), new JsLoaderRspackPlugin(this).apply(this), new ExecuteModulePlugin().apply(this), new TraceHookPlugin().apply(this);
8071
8025
  }
8072
8026
  get recordsInputPath() {
8073
8027
  return unsupported("Compiler.recordsInputPath");
@@ -8084,6 +8038,12 @@ Help:
8084
8038
  get _lastCompilation() {
8085
8039
  return this.#compilation;
8086
8040
  }
8041
+ get platform() {
8042
+ return this.#platform;
8043
+ }
8044
+ set platform(platform) {
8045
+ this.#platform = platform;
8046
+ }
8087
8047
  get __internal__builtinPlugins() {
8088
8048
  return this.#builtinPlugins;
8089
8049
  }
@@ -8350,7 +8310,7 @@ Help:
8350
8310
  this.#registers = this.#createHooksRegisters();
8351
8311
  let inputFileSystem = this.inputFileSystem && ThreadsafeInputNodeFS.needsBinding(options1.experiments.useInputFileSystem) ? ThreadsafeInputNodeFS.__to_binding(this.inputFileSystem) : void 0;
8352
8312
  try {
8353
- this.#instance = new instanceBinding.JsCompiler(this.compilerPath, rawOptions, this.#builtinPlugins, this.#registers, ThreadsafeOutputNodeFS.__to_binding(this.outputFileSystem), this.intermediateFileSystem ? ThreadsafeIntermediateNodeFS.__to_binding(this.intermediateFileSystem) : void 0, inputFileSystem, ResolverFactory.__to_binding(this.resolverFactory), this.unsafeFastDrop), callback(null, this.#instance);
8313
+ this.#instance = new instanceBinding.JsCompiler(this.compilerPath, rawOptions, this.#builtinPlugins, this.#registers, ThreadsafeOutputNodeFS.__to_binding(this.outputFileSystem), this.intermediateFileSystem ? ThreadsafeIntermediateNodeFS.__to_binding(this.intermediateFileSystem) : void 0, inputFileSystem, ResolverFactory.__to_binding(this.resolverFactory), this.unsafeFastDrop, this.#platform), callback(null, this.#instance);
8354
8314
  } catch (err) {
8355
8315
  err instanceof Error && delete err.stack, callback(Error("Failed to create Rspack compiler instance, check the Rspack configuration.", {
8356
8316
  cause: err
@@ -8976,7 +8936,7 @@ Help:
8976
8936
  obj.children = this.stats.map((stat, idx)=>{
8977
8937
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
8978
8938
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
8979
- }), childOptions.version && (obj.rspackVersion = "1.7.0-canary-ecf3f75d-20251223084957", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
8939
+ }), childOptions.version && (obj.rspackVersion = "1.7.0-canary-e20de023-20251223174329", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
8980
8940
  let mapError = (j, obj)=>({
8981
8941
  ...obj,
8982
8942
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -9886,7 +9846,7 @@ Help:
9886
9846
  object.hash = context.getStatsCompilation(compilation).hash;
9887
9847
  },
9888
9848
  version: (object)=>{
9889
- object.version = "5.75.0", object.rspackVersion = "1.7.0-canary-ecf3f75d-20251223084957";
9849
+ object.version = "5.75.0", object.rspackVersion = "1.7.0-canary-e20de023-20251223174329";
9890
9850
  },
9891
9851
  env: (object, _compilation, _context, { _env })=>{
9892
9852
  object.env = _env;
@@ -12105,7 +12065,7 @@ Help:
12105
12065
  let _options = JSON.stringify(options || {});
12106
12066
  return binding_default().transform(source, _options);
12107
12067
  }
12108
- let exports_rspackVersion = "1.7.0-canary-ecf3f75d-20251223084957", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
12068
+ let exports_rspackVersion = "1.7.0-canary-e20de023-20251223174329", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
12109
12069
  getNormalizedRspackOptions: getNormalizedRspackOptions,
12110
12070
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
12111
12071
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -12338,27 +12298,7 @@ Help:
12338
12298
  if (INTERNAL_PLUGIN_NAMES.includes(name)) throw Error(`Cannot register native plugin with name '${name}', it conflicts with internal plugin names.`);
12339
12299
  return base_create(name, resolve, affectedHooks);
12340
12300
  },
12341
- VirtualModulesPlugin: VirtualModulesPlugin,
12342
- createRscPlugins: function() {
12343
- let coordinator = new Coordinator();
12344
- return {
12345
- ServerPlugin: class extends RscServerPlugin {
12346
- constructor(){
12347
- super(coordinator);
12348
- }
12349
- },
12350
- ClientPlugin: class extends RscClientPlugin {
12351
- constructor(){
12352
- super(coordinator);
12353
- }
12354
- }
12355
- };
12356
- },
12357
- RSC_LAYERS_NAMES: {
12358
- reactServerComponents: "react-server-components",
12359
- serverSideRendering: "server-side-rendering",
12360
- actionBrowser: "action-browser"
12361
- }
12301
+ VirtualModulesPlugin: VirtualModulesPlugin
12362
12302
  }, ERROR_PREFIX = "Invalid Rspack configuration:";
12363
12303
  function validateRspackConfig(config) {
12364
12304
  (({ context })=>{
@@ -12394,7 +12334,8 @@ Help:
12394
12334
  if (new NodeEnvironmentPlugin({
12395
12335
  infrastructureLogging: options1.infrastructureLogging
12396
12336
  }).apply(compiler), Array.isArray(options1.plugins)) for (let plugin of options1.plugins)"function" == typeof plugin ? plugin.call(compiler, compiler) : plugin && plugin.apply(compiler);
12397
- return applyRspackOptionsDefaults(compiler.options), compiler.hooks.environment.call(), compiler.hooks.afterEnvironment.call(), new RspackOptionsApply().process(compiler.options, compiler), compiler.hooks.initialize.call(), compiler;
12337
+ let { platform } = applyRspackOptionsDefaults(compiler.options);
12338
+ return platform && (compiler.platform = platform), compiler.hooks.environment.call(), compiler.hooks.afterEnvironment.call(), new RspackOptionsApply().process(compiler.options, compiler), compiler.hooks.initialize.call(), compiler;
12398
12339
  }
12399
12340
  function isMultiRspackOptions(o) {
12400
12341
  return Array.isArray(o);
@@ -12439,21 +12380,21 @@ Help:
12439
12380
  }
12440
12381
  {
12441
12382
  let { compiler, watch } = create();
12442
- return watch && external_node_util_default().deprecate(()=>{}, "A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.")(), compiler;
12383
+ return watch && deprecate("A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback."), compiler;
12443
12384
  }
12444
12385
  }, exports_namespaceObject);
12445
12386
  src_fn.rspack = src_fn, src_fn.webpack = src_fn;
12446
12387
  let src_rspack_0 = src_fn, src_0 = src_rspack_0;
12447
- })(), exports.AsyncDependenciesBlock = __webpack_exports__.AsyncDependenciesBlock, exports.BannerPlugin = __webpack_exports__.BannerPlugin, exports.CircularDependencyRspackPlugin = __webpack_exports__.CircularDependencyRspackPlugin, exports.Compilation = __webpack_exports__.Compilation, exports.Compiler = __webpack_exports__.Compiler, exports.ConcatenatedModule = __webpack_exports__.ConcatenatedModule, exports.ContextModule = __webpack_exports__.ContextModule, exports.ContextReplacementPlugin = __webpack_exports__.ContextReplacementPlugin, exports.Coordinator = __webpack_exports__.Coordinator, exports.CopyRspackPlugin = __webpack_exports__.CopyRspackPlugin, exports.CssExtractRspackPlugin = __webpack_exports__.CssExtractRspackPlugin, exports.DefinePlugin = __webpack_exports__.DefinePlugin, exports.Dependency = __webpack_exports__.Dependency, exports.DllPlugin = __webpack_exports__.DllPlugin, exports.DllReferencePlugin = __webpack_exports__.DllReferencePlugin, exports.DynamicEntryPlugin = __webpack_exports__.DynamicEntryPlugin, exports.EntryDependency = __webpack_exports__.EntryDependency, exports.EntryOptionPlugin = __webpack_exports__.EntryOptionPlugin, exports.EntryPlugin = __webpack_exports__.EntryPlugin, exports.EnvironmentPlugin = __webpack_exports__.EnvironmentPlugin, exports.EvalDevToolModulePlugin = __webpack_exports__.EvalDevToolModulePlugin, exports.EvalSourceMapDevToolPlugin = __webpack_exports__.EvalSourceMapDevToolPlugin, exports.ExternalModule = __webpack_exports__.ExternalModule, exports.ExternalsPlugin = __webpack_exports__.ExternalsPlugin, exports.HotModuleReplacementPlugin = __webpack_exports__.HotModuleReplacementPlugin, exports.HtmlRspackPlugin = __webpack_exports__.HtmlRspackPlugin, exports.IgnorePlugin = __webpack_exports__.IgnorePlugin, exports.LightningCssMinimizerRspackPlugin = __webpack_exports__.LightningCssMinimizerRspackPlugin, exports.LoaderOptionsPlugin = __webpack_exports__.LoaderOptionsPlugin, exports.LoaderTargetPlugin = __webpack_exports__.LoaderTargetPlugin, exports.Module = __webpack_exports__.Module, exports.ModuleFilenameHelpers = __webpack_exports__.ModuleFilenameHelpers, exports.MultiCompiler = __webpack_exports__.MultiCompiler, exports.MultiStats = __webpack_exports__.MultiStats, exports.NoEmitOnErrorsPlugin = __webpack_exports__.NoEmitOnErrorsPlugin, exports.NormalModule = __webpack_exports__.NormalModule, exports.NormalModuleReplacementPlugin = __webpack_exports__.NormalModuleReplacementPlugin, exports.ProgressPlugin = __webpack_exports__.ProgressPlugin, exports.ProvidePlugin = __webpack_exports__.ProvidePlugin, exports.RscClientPlugin = __webpack_exports__.RscClientPlugin, exports.RscServerPlugin = __webpack_exports__.RscServerPlugin, exports.RspackOptionsApply = __webpack_exports__.RspackOptionsApply, exports.RuntimeGlobals = __webpack_exports__.RuntimeGlobals, exports.RuntimeModule = __webpack_exports__.RuntimeModule, exports.RuntimePlugin = __webpack_exports__.RuntimePlugin, exports.SourceMapDevToolPlugin = __webpack_exports__.SourceMapDevToolPlugin, exports.Stats = __webpack_exports__.Stats, exports.StatsErrorCode = __webpack_exports__.StatsErrorCode, exports.SubresourceIntegrityPlugin = __webpack_exports__.SubresourceIntegrityPlugin, exports.SwcJsMinimizerRspackPlugin = __webpack_exports__.SwcJsMinimizerRspackPlugin, exports.Template = __webpack_exports__.Template, exports.ValidationError = __webpack_exports__.ValidationError, exports.WarnCaseSensitiveModulesPlugin = __webpack_exports__.WarnCaseSensitiveModulesPlugin, exports.WebpackError = __webpack_exports__.WebpackError, exports.WebpackOptionsApply = __webpack_exports__.WebpackOptionsApply, exports.config = __webpack_exports__.config, exports.container = __webpack_exports__.container, exports.default = __webpack_exports__.default, exports.electron = __webpack_exports__.electron, exports.experiments = __webpack_exports__.experiments, exports.javascript = __webpack_exports__.javascript, exports.lazyCompilationMiddleware = __webpack_exports__.lazyCompilationMiddleware, exports.library = __webpack_exports__.library, exports.node = __webpack_exports__.node, exports.optimize = __webpack_exports__.optimize, exports.rspack = __webpack_exports__.rspack, exports.rspackVersion = __webpack_exports__.rspackVersion, exports.sharing = __webpack_exports__.sharing, exports.sources = __webpack_exports__.sources, exports.util = __webpack_exports__.util, exports.version = __webpack_exports__.version, exports.wasm = __webpack_exports__.wasm, exports.web = __webpack_exports__.web, exports.webworker = __webpack_exports__.webworker, __webpack_exports__)-1 === [
12388
+ })(), exports.AsyncDependenciesBlock = __webpack_exports__.AsyncDependenciesBlock, exports.BannerPlugin = __webpack_exports__.BannerPlugin, exports.CaseSensitivePlugin = __webpack_exports__.CaseSensitivePlugin, exports.CircularDependencyRspackPlugin = __webpack_exports__.CircularDependencyRspackPlugin, exports.Compilation = __webpack_exports__.Compilation, exports.Compiler = __webpack_exports__.Compiler, exports.ConcatenatedModule = __webpack_exports__.ConcatenatedModule, exports.ContextModule = __webpack_exports__.ContextModule, exports.ContextReplacementPlugin = __webpack_exports__.ContextReplacementPlugin, exports.CopyRspackPlugin = __webpack_exports__.CopyRspackPlugin, exports.CssExtractRspackPlugin = __webpack_exports__.CssExtractRspackPlugin, exports.DefinePlugin = __webpack_exports__.DefinePlugin, exports.Dependency = __webpack_exports__.Dependency, exports.DllPlugin = __webpack_exports__.DllPlugin, exports.DllReferencePlugin = __webpack_exports__.DllReferencePlugin, exports.DynamicEntryPlugin = __webpack_exports__.DynamicEntryPlugin, exports.EntryDependency = __webpack_exports__.EntryDependency, exports.EntryOptionPlugin = __webpack_exports__.EntryOptionPlugin, exports.EntryPlugin = __webpack_exports__.EntryPlugin, exports.EnvironmentPlugin = __webpack_exports__.EnvironmentPlugin, exports.EvalDevToolModulePlugin = __webpack_exports__.EvalDevToolModulePlugin, exports.EvalSourceMapDevToolPlugin = __webpack_exports__.EvalSourceMapDevToolPlugin, exports.ExternalModule = __webpack_exports__.ExternalModule, exports.ExternalsPlugin = __webpack_exports__.ExternalsPlugin, exports.HotModuleReplacementPlugin = __webpack_exports__.HotModuleReplacementPlugin, exports.HtmlRspackPlugin = __webpack_exports__.HtmlRspackPlugin, exports.IgnorePlugin = __webpack_exports__.IgnorePlugin, exports.LightningCssMinimizerRspackPlugin = __webpack_exports__.LightningCssMinimizerRspackPlugin, exports.LoaderOptionsPlugin = __webpack_exports__.LoaderOptionsPlugin, exports.LoaderTargetPlugin = __webpack_exports__.LoaderTargetPlugin, exports.Module = __webpack_exports__.Module, exports.ModuleFilenameHelpers = __webpack_exports__.ModuleFilenameHelpers, exports.MultiCompiler = __webpack_exports__.MultiCompiler, exports.MultiStats = __webpack_exports__.MultiStats, exports.NoEmitOnErrorsPlugin = __webpack_exports__.NoEmitOnErrorsPlugin, exports.NormalModule = __webpack_exports__.NormalModule, exports.NormalModuleReplacementPlugin = __webpack_exports__.NormalModuleReplacementPlugin, exports.ProgressPlugin = __webpack_exports__.ProgressPlugin, exports.ProvidePlugin = __webpack_exports__.ProvidePlugin, exports.RspackOptionsApply = __webpack_exports__.RspackOptionsApply, exports.RuntimeGlobals = __webpack_exports__.RuntimeGlobals, exports.RuntimeModule = __webpack_exports__.RuntimeModule, exports.RuntimePlugin = __webpack_exports__.RuntimePlugin, exports.SourceMapDevToolPlugin = __webpack_exports__.SourceMapDevToolPlugin, exports.Stats = __webpack_exports__.Stats, exports.StatsErrorCode = __webpack_exports__.StatsErrorCode, exports.SubresourceIntegrityPlugin = __webpack_exports__.SubresourceIntegrityPlugin, exports.SwcJsMinimizerRspackPlugin = __webpack_exports__.SwcJsMinimizerRspackPlugin, exports.Template = __webpack_exports__.Template, exports.ValidationError = __webpack_exports__.ValidationError, exports.WarnCaseSensitiveModulesPlugin = __webpack_exports__.WarnCaseSensitiveModulesPlugin, exports.WebpackError = __webpack_exports__.WebpackError, exports.WebpackOptionsApply = __webpack_exports__.WebpackOptionsApply, exports.config = __webpack_exports__.config, exports.container = __webpack_exports__.container, exports.default = __webpack_exports__.default, exports.electron = __webpack_exports__.electron, exports.experiments = __webpack_exports__.experiments, exports.javascript = __webpack_exports__.javascript, exports.lazyCompilationMiddleware = __webpack_exports__.lazyCompilationMiddleware, exports.library = __webpack_exports__.library, exports.node = __webpack_exports__.node, exports.optimize = __webpack_exports__.optimize, exports.rspack = __webpack_exports__.rspack, exports.rspackVersion = __webpack_exports__.rspackVersion, exports.sharing = __webpack_exports__.sharing, exports.sources = __webpack_exports__.sources, exports.util = __webpack_exports__.util, exports.version = __webpack_exports__.version, exports.wasm = __webpack_exports__.wasm, exports.web = __webpack_exports__.web, exports.webworker = __webpack_exports__.webworker, __webpack_exports__)-1 === [
12448
12389
  "AsyncDependenciesBlock",
12449
12390
  "BannerPlugin",
12391
+ "CaseSensitivePlugin",
12450
12392
  "CircularDependencyRspackPlugin",
12451
12393
  "Compilation",
12452
12394
  "Compiler",
12453
12395
  "ConcatenatedModule",
12454
12396
  "ContextModule",
12455
12397
  "ContextReplacementPlugin",
12456
- "Coordinator",
12457
12398
  "CopyRspackPlugin",
12458
12399
  "CssExtractRspackPlugin",
12459
12400
  "DefinePlugin",
@@ -12484,8 +12425,6 @@ Help:
12484
12425
  "NormalModuleReplacementPlugin",
12485
12426
  "ProgressPlugin",
12486
12427
  "ProvidePlugin",
12487
- "RscClientPlugin",
12488
- "RscServerPlugin",
12489
12428
  "RspackOptionsApply",
12490
12429
  "RuntimeGlobals",
12491
12430
  "RuntimeModule",
package/dist/rspack.d.ts CHANGED
@@ -1,3 +1,12 @@
1
+ /**
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack/blob/4b4ca3b/lib
4
+ *
5
+ * MIT Licensed
6
+ * Author Tobias Koppers @sokra
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/webpack/blob/main/LICENSE
9
+ */
1
10
  import type { Callback } from "@rspack/lite-tapable";
2
11
  import { Compiler } from "./Compiler";
3
12
  import { type RspackOptions } from "./config";
@@ -6,3 +6,4 @@ export declare function serializeObject(map: string | object | undefined | null)
6
6
  export declare function indent(str: string, prefix: string): string;
7
7
  export declare function stringifyLoaderObject(o: LoaderObject): string;
8
8
  export declare const unsupported: (name: string, issue?: string) => never;
9
+ export declare function deprecate(message: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-canary/core",
3
- "version": "1.7.0-canary-ecf3f75d-20251223084957",
3
+ "version": "1.7.0-canary-e20de023-20251223174329",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -56,9 +56,9 @@
56
56
  "webpack-sources": "3.3.3"
57
57
  },
58
58
  "dependencies": {
59
- "@module-federation/runtime-tools": "0.21.6",
59
+ "@module-federation/runtime-tools": "0.22.0",
60
60
  "@rspack/lite-tapable": "1.1.0",
61
- "@rspack/binding": "npm:@rspack-canary/binding@1.7.0-canary-ecf3f75d-20251223084957"
61
+ "@rspack/binding": "npm:@rspack-canary/binding@1.7.0-canary-e20de023-20251223174329"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@swc/helpers": ">=0.5.1"
@@ -1,8 +0,0 @@
1
- import { type Compiler } from "../../Compiler";
2
- export declare const GET_OR_INIT_BINDING: unique symbol;
3
- export declare class Coordinator {
4
- #private;
5
- constructor();
6
- applyServerCompiler(serverCompiler: Compiler): void;
7
- applyClientCompiler(clientCompiler: Compiler): void;
8
- }
@@ -1,10 +0,0 @@
1
- import type binding from "@rspack/binding";
2
- import type { Compiler } from "../..";
3
- import { RspackBuiltinPlugin } from "../base";
4
- import { type Coordinator } from "./Coordinator";
5
- export declare class RscClientPlugin extends RspackBuiltinPlugin {
6
- #private;
7
- name: string;
8
- constructor(coordinator: Coordinator);
9
- raw(compiler: Compiler): binding.BuiltinPlugin;
10
- }
@@ -1,10 +0,0 @@
1
- import type binding from "@rspack/binding";
2
- import type { Compiler } from "../..";
3
- import { RspackBuiltinPlugin } from "../base";
4
- import { type Coordinator } from "./Coordinator";
5
- export declare class RscServerPlugin extends RspackBuiltinPlugin {
6
- #private;
7
- name: string;
8
- constructor(coordinator: Coordinator);
9
- raw(compiler: Compiler): binding.BuiltinPlugin;
10
- }
@@ -1,19 +0,0 @@
1
- import type { RspackPluginInstance } from "../..";
2
- export declare function createRscPlugins(): {
3
- ServerPlugin: RspackPluginInstance;
4
- ClientPlugin: RspackPluginInstance;
5
- };
6
- export declare const RSC_LAYERS_NAMES: {
7
- /**
8
- * The layer for server-only runtime and picking up `react-server` export conditions.
9
- */
10
- reactServerComponents: string;
11
- /**
12
- * Server Side Rendering layer for app.
13
- */
14
- serverSideRendering: string;
15
- /**
16
- * The browser client bundle layer for actions.
17
- */
18
- actionBrowser: string;
19
- };