@rspack-canary/browser 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 "./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.mjs CHANGED
@@ -50562,13 +50562,13 @@ __webpack_require__.r(exports_namespaceObject);
50562
50562
  __webpack_require__.d(exports_namespaceObject, {
50563
50563
  AsyncDependenciesBlock: ()=>external_rspack_wasi_browser_js_.AsyncDependenciesBlock,
50564
50564
  BannerPlugin: ()=>BannerPlugin,
50565
+ CaseSensitivePlugin: ()=>CaseSensitivePlugin,
50565
50566
  CircularDependencyRspackPlugin: ()=>CircularDependencyRspackPlugin,
50566
50567
  Compilation: ()=>Compilation,
50567
50568
  Compiler: ()=>Compiler,
50568
50569
  ConcatenatedModule: ()=>external_rspack_wasi_browser_js_.ConcatenatedModule,
50569
50570
  ContextModule: ()=>external_rspack_wasi_browser_js_.ContextModule,
50570
50571
  ContextReplacementPlugin: ()=>ContextReplacementPlugin,
50571
- Coordinator: ()=>Coordinator,
50572
50572
  CopyRspackPlugin: ()=>CopyRspackPlugin,
50573
50573
  CssExtractRspackPlugin: ()=>CssExtractRspackPlugin,
50574
50574
  DefinePlugin: ()=>DefinePlugin,
@@ -50599,8 +50599,6 @@ __webpack_require__.d(exports_namespaceObject, {
50599
50599
  NormalModuleReplacementPlugin: ()=>NormalModuleReplacementPlugin,
50600
50600
  ProgressPlugin: ()=>ProgressPlugin,
50601
50601
  ProvidePlugin: ()=>ProvidePlugin,
50602
- RscClientPlugin: ()=>RscClientPlugin,
50603
- RscServerPlugin: ()=>RscServerPlugin,
50604
50602
  RspackOptionsApply: ()=>RspackOptionsApply,
50605
50603
  RuntimeGlobals: ()=>DefaultRuntimeGlobals,
50606
50604
  RuntimeModule: ()=>RuntimeModule,
@@ -50612,7 +50610,7 @@ __webpack_require__.d(exports_namespaceObject, {
50612
50610
  SwcJsMinimizerRspackPlugin: ()=>SwcJsMinimizerRspackPlugin,
50613
50611
  Template: ()=>Template,
50614
50612
  ValidationError: ()=>ValidationError,
50615
- WarnCaseSensitiveModulesPlugin: ()=>WarnCaseSensitiveModulesPlugin,
50613
+ WarnCaseSensitiveModulesPlugin: ()=>CaseSensitivePlugin,
50616
50614
  WebpackError: ()=>exports_WebpackError,
50617
50615
  WebpackOptionsApply: ()=>RspackOptionsApply,
50618
50616
  config: ()=>exports_config,
@@ -52993,6 +52991,7 @@ const BundlerInfoRspackPlugin = base_create(external_rspack_wasi_browser_js_.Bui
52993
52991
  bundler: options.bundler || "rspack",
52994
52992
  force: options.force ?? true
52995
52993
  }));
52994
+ const CaseSensitivePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.CaseSensitivePlugin, ()=>{}, "compilation");
52996
52995
  const ChunkPrefetchPreloadPlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ChunkPrefetchPreloadPlugin, ()=>{});
52997
52996
  function CircularDependencyRspackPlugin_define_property(obj, key, value) {
52998
52997
  if (key in obj) Object.defineProperty(obj, key, {
@@ -53501,10 +53500,16 @@ function stringifyLoaderObject(o) {
53501
53500
  return o.path + o.query + o.fragment;
53502
53501
  }
53503
53502
  const unsupported = (name, issue)=>{
53504
- let s = `${name} is not supported by rspack.`;
53505
- if (issue) s += ` Please refer to issue ${issue} for more information.`;
53503
+ let s = `${name} is not supported by Rspack.`;
53504
+ if (issue) s += ` Refer to issue ${issue} for more information.`;
53506
53505
  throw new Error(s);
53507
53506
  };
53507
+ const warnedMessages = new Set();
53508
+ function deprecate(message) {
53509
+ if (warnedMessages.has(message)) return;
53510
+ warnedMessages.add(message);
53511
+ console.warn(`[Rspack Deprecation] ${message}`);
53512
+ }
53508
53513
  const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/;
53509
53514
  const SEGMENTS_SPLIT_REGEXP = /([|!])/;
53510
53515
  const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g;
@@ -55283,10 +55288,15 @@ const getSwcLoaderOptions = (options, _)=>{
55283
55288
  options.jsc ??= {};
55284
55289
  options.jsc.experimental ??= {};
55285
55290
  options.jsc.experimental.disableAllLints ??= true;
55291
+ if (options.collectTypeScriptInfo) options.collectTypeScriptInfo = resolveCollectTypeScriptInfo(options.collectTypeScriptInfo);
55286
55292
  const { rspackExperiments } = options;
55287
55293
  if (rspackExperiments) {
55288
55294
  if (rspackExperiments.import || rspackExperiments.pluginImport) rspackExperiments.import = resolvePluginImport(rspackExperiments.import || rspackExperiments.pluginImport);
55289
- if (rspackExperiments.collectTypeScriptInfo) rspackExperiments.collectTypeScriptInfo = resolveCollectTypeScriptInfo(rspackExperiments.collectTypeScriptInfo);
55295
+ if (rspackExperiments.collectTypeScriptInfo) {
55296
+ deprecate("`rspackExperiments.collectTypeScriptInfo` is deprecated and will be removed in Rspack v2.0. Use top-level `collectTypeScriptInfo` instead.");
55297
+ if (!options.collectTypeScriptInfo) options.collectTypeScriptInfo = resolveCollectTypeScriptInfo(rspackExperiments.collectTypeScriptInfo);
55298
+ delete rspackExperiments.collectTypeScriptInfo;
55299
+ }
55290
55300
  }
55291
55301
  }
55292
55302
  return options;
@@ -56358,23 +56368,9 @@ const lazyCompilationMiddleware = (compiler)=>{
56358
56368
  if (compiler instanceof MultiCompiler) {
56359
56369
  const middlewareByCompiler = new Map();
56360
56370
  let i = 0;
56361
- let isReportDeprecatedWarned = false;
56362
- let isReportRepeatWarned = false;
56363
56371
  for (const c of compiler.compilers){
56364
- if (c.options.experiments.lazyCompilation) {
56365
- if (c.name) console.warn(`The 'experiments.lazyCompilation' option in compiler named '${c.name}' is deprecated, please use the Configuration top level 'lazyCompilation' instead.`);
56366
- else if (!isReportDeprecatedWarned) {
56367
- console.warn(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN);
56368
- isReportDeprecatedWarned = true;
56369
- }
56370
- }
56371
- if (c.options.lazyCompilation && c.options.experiments.lazyCompilation) {
56372
- if (c.name) console.warn(`The top-level 'lazyCompilation' option in compiler named '${c.name}' will override the 'experiments.lazyCompilation' option.`);
56373
- else if (!isReportRepeatWarned) {
56374
- console.warn(REPEAT_LAZY_COMPILATION_OPTIONS_WARN);
56375
- isReportRepeatWarned = true;
56376
- }
56377
- }
56372
+ 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);
56373
+ if (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);
56378
56374
  if (!c.options.lazyCompilation && !c.options.experiments.lazyCompilation) continue;
56379
56375
  const options = {
56380
56376
  ...c.options.experiments.lazyCompilation,
@@ -56397,8 +56393,8 @@ const lazyCompilationMiddleware = (compiler)=>{
56397
56393
  };
56398
56394
  }
56399
56395
  if (compiler.options.experiments.lazyCompilation) {
56400
- console.warn(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN);
56401
- if (compiler.options.lazyCompilation) console.warn(REPEAT_LAZY_COMPILATION_OPTIONS_WARN);
56396
+ deprecate(DEPRECATED_LAZY_COMPILATION_OPTIONS_WARN);
56397
+ if (compiler.options.lazyCompilation) deprecate(REPEAT_LAZY_COMPILATION_OPTIONS_WARN);
56402
56398
  }
56403
56399
  if (!compiler.options.lazyCompilation && !compiler.options.experiments.lazyCompilation) return noop;
56404
56400
  const activeModules = new Set();
@@ -56686,238 +56682,6 @@ const createRuntimePluginHooksRegisters = (getCompiler, createTap)=>({
56686
56682
  };
56687
56683
  })
56688
56684
  });
56689
- function Coordinator_check_private_redeclaration(obj, privateCollection) {
56690
- if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
56691
- }
56692
- function Coordinator_class_apply_descriptor_get(receiver, descriptor) {
56693
- if (descriptor.get) return descriptor.get.call(receiver);
56694
- return descriptor.value;
56695
- }
56696
- function Coordinator_class_apply_descriptor_set(receiver, descriptor, value) {
56697
- if (descriptor.set) descriptor.set.call(receiver, value);
56698
- else {
56699
- if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
56700
- descriptor.value = value;
56701
- }
56702
- }
56703
- function Coordinator_class_extract_field_descriptor(receiver, privateMap, action) {
56704
- if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
56705
- return privateMap.get(receiver);
56706
- }
56707
- function Coordinator_class_private_field_get(receiver, privateMap) {
56708
- var descriptor = Coordinator_class_extract_field_descriptor(receiver, privateMap, "get");
56709
- return Coordinator_class_apply_descriptor_get(receiver, descriptor);
56710
- }
56711
- function Coordinator_class_private_field_init(obj, privateMap, value) {
56712
- Coordinator_check_private_redeclaration(obj, privateMap);
56713
- privateMap.set(obj, value);
56714
- }
56715
- function Coordinator_class_private_field_set(receiver, privateMap, value) {
56716
- var descriptor = Coordinator_class_extract_field_descriptor(receiver, privateMap, "set");
56717
- Coordinator_class_apply_descriptor_set(receiver, descriptor, value);
56718
- return value;
56719
- }
56720
- const Coordinator_PLUGIN_NAME = "RscPlugin";
56721
- const GET_OR_INIT_BINDING = Symbol("GET_OR_INIT_BINDING");
56722
- var _serverCompiler = /*#__PURE__*/ new WeakMap(), _clientCompiler = /*#__PURE__*/ new WeakMap(), _clientLastCompilation = /*#__PURE__*/ new WeakMap(), _binding = /*#__PURE__*/ new WeakMap();
56723
- class Coordinator {
56724
- applyServerCompiler(serverCompiler) {
56725
- Coordinator_class_private_field_set(this, _serverCompiler, serverCompiler);
56726
- serverCompiler.hooks.done.tap(Coordinator_PLUGIN_NAME, (stats)=>{
56727
- if (Coordinator_class_private_field_get(this, _clientLastCompilation)) {
56728
- stats.compilation.fileDependencies.addAll(Coordinator_class_private_field_get(this, _clientLastCompilation).fileDependencies);
56729
- stats.compilation.contextDependencies.addAll(Coordinator_class_private_field_get(this, _clientLastCompilation).contextDependencies);
56730
- stats.compilation.missingDependencies.addAll(Coordinator_class_private_field_get(this, _clientLastCompilation).missingDependencies);
56731
- }
56732
- });
56733
- serverCompiler.hooks.watchRun.tap(Coordinator_PLUGIN_NAME, ()=>{
56734
- Coordinator_class_private_field_get(this, _clientCompiler).watching.invalidateWithChangesAndRemovals(new Set(Coordinator_class_private_field_get(this, _serverCompiler).modifiedFiles), new Set(Coordinator_class_private_field_get(this, _serverCompiler).removedFiles));
56735
- });
56736
- }
56737
- applyClientCompiler(clientCompiler) {
56738
- Coordinator_class_private_field_set(this, _clientCompiler, clientCompiler);
56739
- const originalWatch = clientCompiler.watch;
56740
- clientCompiler.watch = function(watchOptions, handler) {
56741
- watchOptions.ignored = ()=>true;
56742
- return originalWatch.call(this, watchOptions, handler);
56743
- };
56744
- clientCompiler.hooks.done.tap(Coordinator_PLUGIN_NAME, (stats)=>{
56745
- Coordinator_class_private_field_set(this, _clientLastCompilation, stats.compilation);
56746
- });
56747
- }
56748
- constructor(){
56749
- Coordinator_class_private_field_init(this, _serverCompiler, {
56750
- writable: true,
56751
- value: void 0
56752
- });
56753
- Coordinator_class_private_field_init(this, _clientCompiler, {
56754
- writable: true,
56755
- value: void 0
56756
- });
56757
- Coordinator_class_private_field_init(this, _clientLastCompilation, {
56758
- writable: true,
56759
- value: void 0
56760
- });
56761
- Coordinator_class_private_field_init(this, _binding, {
56762
- writable: true,
56763
- value: void 0
56764
- });
56765
- Object.defineProperty(this, GET_OR_INIT_BINDING, {
56766
- enumerable: false,
56767
- configurable: false,
56768
- writable: false,
56769
- value: ()=>{
56770
- if (!Coordinator_class_private_field_get(this, _binding)) Coordinator_class_private_field_set(this, _binding, new external_rspack_wasi_browser_js_.JsCoordinator(()=>{
56771
- if (!Coordinator_class_private_field_get(this, _serverCompiler)) throw new Error("[RscPlugin] Coordinator.getOrInitBinding() called before the server compiler was attached. Call coordinator.applyServerCompiler(serverCompiler) first.");
56772
- return Coordinator_class_private_field_get(this, _serverCompiler)[GET_COMPILER_ID]();
56773
- }));
56774
- return Coordinator_class_private_field_get(this, _binding);
56775
- }
56776
- });
56777
- }
56778
- }
56779
- function RscClientPlugin_check_private_redeclaration(obj, privateCollection) {
56780
- if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
56781
- }
56782
- function RscClientPlugin_class_apply_descriptor_get(receiver, descriptor) {
56783
- if (descriptor.get) return descriptor.get.call(receiver);
56784
- return descriptor.value;
56785
- }
56786
- function RscClientPlugin_class_apply_descriptor_set(receiver, descriptor, value) {
56787
- if (descriptor.set) descriptor.set.call(receiver, value);
56788
- else {
56789
- if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
56790
- descriptor.value = value;
56791
- }
56792
- }
56793
- function RscClientPlugin_class_extract_field_descriptor(receiver, privateMap, action) {
56794
- if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
56795
- return privateMap.get(receiver);
56796
- }
56797
- function RscClientPlugin_class_private_field_get(receiver, privateMap) {
56798
- var descriptor = RscClientPlugin_class_extract_field_descriptor(receiver, privateMap, "get");
56799
- return RscClientPlugin_class_apply_descriptor_get(receiver, descriptor);
56800
- }
56801
- function RscClientPlugin_class_private_field_init(obj, privateMap, value) {
56802
- RscClientPlugin_check_private_redeclaration(obj, privateMap);
56803
- privateMap.set(obj, value);
56804
- }
56805
- function RscClientPlugin_class_private_field_set(receiver, privateMap, value) {
56806
- var descriptor = RscClientPlugin_class_extract_field_descriptor(receiver, privateMap, "set");
56807
- RscClientPlugin_class_apply_descriptor_set(receiver, descriptor, value);
56808
- return value;
56809
- }
56810
- function RscClientPlugin_define_property(obj, key, value) {
56811
- if (key in obj) Object.defineProperty(obj, key, {
56812
- value: value,
56813
- enumerable: true,
56814
- configurable: true,
56815
- writable: true
56816
- });
56817
- else obj[key] = value;
56818
- return obj;
56819
- }
56820
- var _coordinator = /*#__PURE__*/ new WeakMap();
56821
- class RscClientPlugin extends RspackBuiltinPlugin {
56822
- raw(compiler) {
56823
- RscClientPlugin_class_private_field_get(this, _coordinator).applyClientCompiler(compiler);
56824
- return createBuiltinPlugin(this.name, RscClientPlugin_class_private_field_get(this, _coordinator)[GET_OR_INIT_BINDING]());
56825
- }
56826
- constructor(coordinator){
56827
- super(), RscClientPlugin_define_property(this, "name", "RscClientPlugin"), RscClientPlugin_class_private_field_init(this, _coordinator, {
56828
- writable: true,
56829
- value: void 0
56830
- });
56831
- RscClientPlugin_class_private_field_set(this, _coordinator, coordinator);
56832
- }
56833
- }
56834
- function RscServerPlugin_check_private_redeclaration(obj, privateCollection) {
56835
- if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
56836
- }
56837
- function RscServerPlugin_class_apply_descriptor_get(receiver, descriptor) {
56838
- if (descriptor.get) return descriptor.get.call(receiver);
56839
- return descriptor.value;
56840
- }
56841
- function RscServerPlugin_class_apply_descriptor_set(receiver, descriptor, value) {
56842
- if (descriptor.set) descriptor.set.call(receiver, value);
56843
- else {
56844
- if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
56845
- descriptor.value = value;
56846
- }
56847
- }
56848
- function RscServerPlugin_class_extract_field_descriptor(receiver, privateMap, action) {
56849
- if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
56850
- return privateMap.get(receiver);
56851
- }
56852
- function RscServerPlugin_class_private_field_get(receiver, privateMap) {
56853
- var descriptor = RscServerPlugin_class_extract_field_descriptor(receiver, privateMap, "get");
56854
- return RscServerPlugin_class_apply_descriptor_get(receiver, descriptor);
56855
- }
56856
- function RscServerPlugin_class_private_field_init(obj, privateMap, value) {
56857
- RscServerPlugin_check_private_redeclaration(obj, privateMap);
56858
- privateMap.set(obj, value);
56859
- }
56860
- function RscServerPlugin_class_private_field_set(receiver, privateMap, value) {
56861
- var descriptor = RscServerPlugin_class_extract_field_descriptor(receiver, privateMap, "set");
56862
- RscServerPlugin_class_apply_descriptor_set(receiver, descriptor, value);
56863
- return value;
56864
- }
56865
- function RscServerPlugin_class_private_method_get(receiver, privateSet, fn) {
56866
- if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
56867
- return fn;
56868
- }
56869
- function RscServerPlugin_class_private_method_init(obj, privateSet) {
56870
- RscServerPlugin_check_private_redeclaration(obj, privateSet);
56871
- privateSet.add(obj);
56872
- }
56873
- function RscServerPlugin_define_property(obj, key, value) {
56874
- if (key in obj) Object.defineProperty(obj, key, {
56875
- value: value,
56876
- enumerable: true,
56877
- configurable: true,
56878
- writable: true
56879
- });
56880
- else obj[key] = value;
56881
- return obj;
56882
- }
56883
- var RscServerPlugin_coordinator = /*#__PURE__*/ new WeakMap(), _resolve = /*#__PURE__*/ new WeakSet();
56884
- class RscServerPlugin extends RspackBuiltinPlugin {
56885
- raw(compiler) {
56886
- const bindingOptions = RscServerPlugin_class_private_method_get(this, _resolve, RscServerPlugin_resolve).call(this, compiler);
56887
- return createBuiltinPlugin(this.name, bindingOptions);
56888
- }
56889
- constructor(coordinator){
56890
- super(), RscServerPlugin_class_private_method_init(this, _resolve), RscServerPlugin_define_property(this, "name", "RscServerPlugin"), RscServerPlugin_class_private_field_init(this, RscServerPlugin_coordinator, {
56891
- writable: true,
56892
- value: void 0
56893
- });
56894
- RscServerPlugin_class_private_field_set(this, RscServerPlugin_coordinator, coordinator);
56895
- }
56896
- }
56897
- function RscServerPlugin_resolve(serverCompiler) {
56898
- RscServerPlugin_class_private_field_get(this, RscServerPlugin_coordinator).applyServerCompiler(serverCompiler);
56899
- return RscServerPlugin_class_private_field_get(this, RscServerPlugin_coordinator)[GET_OR_INIT_BINDING]();
56900
- }
56901
- function createRscPlugins() {
56902
- const coordinator = new Coordinator();
56903
- return {
56904
- ServerPlugin: class extends RscServerPlugin {
56905
- constructor(){
56906
- super(coordinator);
56907
- }
56908
- },
56909
- ClientPlugin: class extends RscClientPlugin {
56910
- constructor(){
56911
- super(coordinator);
56912
- }
56913
- }
56914
- };
56915
- }
56916
- const RSC_LAYERS_NAMES = {
56917
- reactServerComponents: "react-server-components",
56918
- serverSideRendering: "server-side-rendering",
56919
- actionBrowser: "action-browser"
56920
- };
56921
56685
  const SideEffectsFlagPlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.SideEffectsFlagPlugin, ()=>{}, "compilation");
56922
56686
  const SizeLimitsPlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.SizeLimitsPlugin, (options)=>{
56923
56687
  const hints = false === options.hints ? void 0 : options.hints;
@@ -57246,7 +57010,6 @@ const SwcJsMinimizerRspackPlugin = base_create(external_rspack_wasi_browser_js_.
57246
57010
  };
57247
57011
  }, "compilation");
57248
57012
  const URLPlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.URLPlugin, ()=>{}, "compilation");
57249
- const WarnCaseSensitiveModulesPlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.WarnCaseSensitiveModulesPlugin, ()=>{}, "compilation");
57250
57013
  function WebWorkerTemplatePlugin_define_property(obj, key, value) {
57251
57014
  if (key in obj) Object.defineProperty(obj, key, {
57252
57015
  value: value,
@@ -58402,6 +58165,16 @@ const applyRspackOptionsDefaults = (options)=>{
58402
58165
  css: options.experiments.css
58403
58166
  }), options.resolve);
58404
58167
  options.resolveLoader = cleverMerge(getResolveLoaderDefaults(), options.resolveLoader);
58168
+ return {
58169
+ platform: false === targetProperties ? targetProperties : {
58170
+ web: targetProperties.web,
58171
+ browser: targetProperties.browser,
58172
+ webworker: targetProperties.webworker,
58173
+ node: targetProperties.node,
58174
+ nwjs: targetProperties.nwjs,
58175
+ electron: targetProperties.electron
58176
+ }
58177
+ };
58405
58178
  };
58406
58179
  const applyRspackOptionsBaseDefaults = (options)=>{
58407
58180
  F(options, "context", ()=>defaults_process.cwd());
@@ -58456,7 +58229,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58456
58229
  if ("object" == typeof rspackFuture) {
58457
58230
  D(rspackFuture, "bundlerInfo", {});
58458
58231
  if ("object" == typeof rspackFuture.bundlerInfo) {
58459
- D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-ecf3f75d-20251223084957");
58232
+ D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-e20de023-20251223174329");
58460
58233
  D(rspackFuture.bundlerInfo, "bundler", "rspack");
58461
58234
  D(rspackFuture.bundlerInfo, "force", !library);
58462
58235
  }
@@ -59174,7 +58947,7 @@ const getNormalizedRspackOptions = (config)=>({
59174
58947
  main: {}
59175
58948
  } : "function" == typeof config.entry ? ((fn)=>()=>Promise.resolve().then(fn).then(getNormalizedEntryStatic))(config.entry) : getNormalizedEntryStatic(config.entry),
59176
58949
  output: nestedConfig(config.output, (output)=>{
59177
- if ("cssHeadDataCompression" in output) 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")();
58950
+ if ("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");
59178
58951
  const { library } = output;
59179
58952
  const libraryAsName = library;
59180
58953
  const libraryBase = "object" == typeof library && library && !Array.isArray(library) && "type" in library ? library : libraryAsName || output.libraryTarget ? {
@@ -59325,12 +59098,12 @@ const getNormalizedRspackOptions = (config)=>({
59325
59098
  ...p
59326
59099
  ]),
59327
59100
  experiments: nestedConfig(config.experiments, (experiments)=>{
59328
- if (experiments.layers) 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.")();
59329
- if (false === experiments.topLevelAwait) 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.")();
59330
- if (experiments.lazyBarrel) 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.")();
59331
- if (experiments.inlineConst) 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.")();
59332
- if (experiments.inlineEnum) 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.")();
59333
- if (experiments.typeReexportsPresence) 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.")();
59101
+ if (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.");
59102
+ if (false === 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.");
59103
+ if (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.");
59104
+ if (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.");
59105
+ if (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.");
59106
+ if (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.");
59334
59107
  return {
59335
59108
  ...experiments,
59336
59109
  cache: optionalNestedConfig(experiments.cache, (cache)=>{
@@ -60525,13 +60298,13 @@ function Resolver_class_private_field_set(receiver, privateMap, value) {
60525
60298
  Resolver_class_apply_descriptor_set(receiver, descriptor, value);
60526
60299
  return value;
60527
60300
  }
60528
- var Resolver_binding = /*#__PURE__*/ new WeakMap();
60301
+ var _binding = /*#__PURE__*/ new WeakMap();
60529
60302
  class Resolver {
60530
60303
  resolveSync(_context, path, request) {
60531
- return Resolver_class_private_field_get(this, Resolver_binding).resolveSync(path, request) ?? false;
60304
+ return Resolver_class_private_field_get(this, _binding).resolveSync(path, request) ?? false;
60532
60305
  }
60533
60306
  resolve(_context, path, request, resolveContext, callback) {
60534
- Resolver_class_private_field_get(this, Resolver_binding).resolve(path, request, (error, text)=>{
60307
+ Resolver_class_private_field_get(this, _binding).resolve(path, request, (error, text)=>{
60535
60308
  if (error) return void callback(error);
60536
60309
  const req = text ? JSON.parse(text) : void 0;
60537
60310
  if (req?.fileDependencies) req.fileDependencies.forEach((file)=>{
@@ -60544,11 +60317,11 @@ class Resolver {
60544
60317
  });
60545
60318
  }
60546
60319
  constructor(binding){
60547
- Resolver_class_private_field_init(this, Resolver_binding, {
60320
+ Resolver_class_private_field_init(this, _binding, {
60548
60321
  writable: true,
60549
60322
  value: void 0
60550
60323
  });
60551
- Resolver_class_private_field_set(this, Resolver_binding, binding);
60324
+ Resolver_class_private_field_set(this, _binding, binding);
60552
60325
  }
60553
60326
  }
60554
60327
  function ResolverFactory_check_private_redeclaration(obj, privateCollection) {
@@ -61948,8 +61721,7 @@ function Compiler_define_property(obj, key, value) {
61948
61721
  return obj;
61949
61722
  }
61950
61723
  const COMPILATION_WEAK_MAP = new WeakMap();
61951
- const GET_COMPILER_ID = Symbol("getCompilerId");
61952
- var _instance = /*#__PURE__*/ new WeakMap(), Compiler_initial = /*#__PURE__*/ new WeakMap(), Compiler_compilation = /*#__PURE__*/ new WeakMap(), _compilationParams = /*#__PURE__*/ new WeakMap(), _builtinPlugins = /*#__PURE__*/ new WeakMap(), _moduleExecutionResultsMap = /*#__PURE__*/ new WeakMap(), _nonSkippableRegisters = /*#__PURE__*/ new WeakMap(), _registers = /*#__PURE__*/ new WeakMap(), _ruleSet = /*#__PURE__*/ new WeakMap(), _build = /*#__PURE__*/ new WeakSet(), _resetThisCompilation = /*#__PURE__*/ new WeakSet(), _newCompilationParams = /*#__PURE__*/ new WeakSet(), _getInstance = /*#__PURE__*/ new WeakSet(), _createHooksRegisters = /*#__PURE__*/ new WeakSet(), _updateNonSkippableRegisters = /*#__PURE__*/ new WeakSet(), _decorateJsTaps = /*#__PURE__*/ new WeakSet(), _createHookRegisterTaps = /*#__PURE__*/ new WeakSet(), _createHookMapRegisterTaps = /*#__PURE__*/ new WeakSet();
61724
+ var _instance = /*#__PURE__*/ new WeakMap(), Compiler_initial = /*#__PURE__*/ new WeakMap(), Compiler_compilation = /*#__PURE__*/ new WeakMap(), _compilationParams = /*#__PURE__*/ new WeakMap(), _builtinPlugins = /*#__PURE__*/ new WeakMap(), _moduleExecutionResultsMap = /*#__PURE__*/ new WeakMap(), _nonSkippableRegisters = /*#__PURE__*/ new WeakMap(), _registers = /*#__PURE__*/ new WeakMap(), _ruleSet = /*#__PURE__*/ new WeakMap(), _platform = /*#__PURE__*/ new WeakMap(), _build = /*#__PURE__*/ new WeakSet(), _resetThisCompilation = /*#__PURE__*/ new WeakSet(), _newCompilationParams = /*#__PURE__*/ new WeakSet(), _getInstance = /*#__PURE__*/ new WeakSet(), _createHooksRegisters = /*#__PURE__*/ new WeakSet(), _updateNonSkippableRegisters = /*#__PURE__*/ new WeakSet(), _decorateJsTaps = /*#__PURE__*/ new WeakSet(), _createHookRegisterTaps = /*#__PURE__*/ new WeakSet(), _createHookMapRegisterTaps = /*#__PURE__*/ new WeakSet();
61953
61725
  class Compiler {
61954
61726
  get recordsInputPath() {
61955
61727
  return unsupported("Compiler.recordsInputPath");
@@ -61966,6 +61738,12 @@ class Compiler {
61966
61738
  get _lastCompilation() {
61967
61739
  return Compiler_class_private_field_get(this, Compiler_compilation);
61968
61740
  }
61741
+ get platform() {
61742
+ return Compiler_class_private_field_get(this, _platform);
61743
+ }
61744
+ set platform(platform) {
61745
+ Compiler_class_private_field_set(this, _platform, platform);
61746
+ }
61969
61747
  get __internal__builtinPlugins() {
61970
61748
  return Compiler_class_private_field_get(this, _builtinPlugins);
61971
61749
  }
@@ -62290,6 +62068,10 @@ class Compiler {
62290
62068
  Compiler_define_property(this, "context", void 0);
62291
62069
  Compiler_define_property(this, "cache", void 0);
62292
62070
  Compiler_define_property(this, "compilerPath", void 0);
62071
+ Compiler_class_private_field_init(this, _platform, {
62072
+ writable: true,
62073
+ value: void 0
62074
+ });
62293
62075
  Compiler_define_property(this, "options", void 0);
62294
62076
  Compiler_define_property(this, "unsafeFastDrop", false);
62295
62077
  Compiler_define_property(this, "__internal_browser_require", void 0);
@@ -62408,18 +62190,20 @@ class Compiler {
62408
62190
  this.running = false;
62409
62191
  this.idle = false;
62410
62192
  this.watchMode = false;
62193
+ Compiler_class_private_field_set(this, _platform, {
62194
+ web: null,
62195
+ browser: null,
62196
+ webworker: null,
62197
+ node: null,
62198
+ nwjs: null,
62199
+ electron: null
62200
+ });
62411
62201
  this.__internal_browser_require = ()=>{
62412
62202
  throw new Error("Cannot execute user defined code in browser without `BrowserRequirePlugin`");
62413
62203
  };
62414
62204
  this.resolverFactory = new ResolverFactory(options.resolve.pnp ?? getPnpDefault(), options.resolve, options.resolveLoader);
62415
62205
  new JsLoaderRspackPlugin(this).apply(this);
62416
62206
  new ExecuteModulePlugin().apply(this);
62417
- Object.defineProperty(this, GET_COMPILER_ID, {
62418
- writable: false,
62419
- configurable: false,
62420
- enumerable: false,
62421
- value: ()=>Compiler_class_private_field_get(this, _instance).getCompilerId()
62422
- });
62423
62207
  }
62424
62208
  }
62425
62209
  function build(callback) {
@@ -62460,7 +62244,7 @@ function getInstance(callback) {
62460
62244
  Compiler_class_private_field_set(this, _registers, Compiler_class_private_method_get(this, _createHooksRegisters, createHooksRegisters).call(this));
62461
62245
  const inputFileSystem = this.inputFileSystem && ThreadsafeInputNodeFS.needsBinding(options.experiments.useInputFileSystem) ? ThreadsafeInputNodeFS.__to_binding(this.inputFileSystem) : void 0;
62462
62246
  try {
62463
- Compiler_class_private_field_set(this, _instance, new instanceBinding.JsCompiler(this.compilerPath, rawOptions, Compiler_class_private_field_get(this, _builtinPlugins), Compiler_class_private_field_get(this, _registers), ThreadsafeOutputNodeFS.__to_binding(this.outputFileSystem), this.intermediateFileSystem ? ThreadsafeIntermediateNodeFS.__to_binding(this.intermediateFileSystem) : void 0, inputFileSystem, ResolverFactory.__to_binding(this.resolverFactory), this.unsafeFastDrop));
62247
+ Compiler_class_private_field_set(this, _instance, new instanceBinding.JsCompiler(this.compilerPath, rawOptions, Compiler_class_private_field_get(this, _builtinPlugins), Compiler_class_private_field_get(this, _registers), ThreadsafeOutputNodeFS.__to_binding(this.outputFileSystem), this.intermediateFileSystem ? ThreadsafeIntermediateNodeFS.__to_binding(this.intermediateFileSystem) : void 0, inputFileSystem, ResolverFactory.__to_binding(this.resolverFactory), this.unsafeFastDrop, Compiler_class_private_field_get(this, _platform)));
62464
62248
  callback(null, Compiler_class_private_field_get(this, _instance));
62465
62249
  } catch (err) {
62466
62250
  if (err instanceof Error) delete err.stack;
@@ -62621,7 +62405,7 @@ class MultiStats {
62621
62405
  return obj;
62622
62406
  });
62623
62407
  if (childOptions.version) {
62624
- obj.rspackVersion = "1.7.0-canary-ecf3f75d-20251223084957";
62408
+ obj.rspackVersion = "1.7.0-canary-e20de023-20251223174329";
62625
62409
  obj.version = "5.75.0";
62626
62410
  }
62627
62411
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
@@ -63937,7 +63721,7 @@ const SIMPLE_EXTRACTORS = {
63937
63721
  },
63938
63722
  version: (object)=>{
63939
63723
  object.version = "5.75.0";
63940
- object.rspackVersion = "1.7.0-canary-ecf3f75d-20251223084957";
63724
+ object.rspackVersion = "1.7.0-canary-e20de023-20251223174329";
63941
63725
  },
63942
63726
  env: (object, _compilation, _context, { _env })=>{
63943
63727
  object.env = _env;
@@ -67074,7 +66858,7 @@ function transformSync(source, options) {
67074
66858
  const _options = JSON.stringify(options || {});
67075
66859
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
67076
66860
  }
67077
- const exports_rspackVersion = "1.7.0-canary-ecf3f75d-20251223084957";
66861
+ const exports_rspackVersion = "1.7.0-canary-e20de023-20251223174329";
67078
66862
  const exports_version = "5.75.0";
67079
66863
  const exports_WebpackError = Error;
67080
66864
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -67162,9 +66946,7 @@ const exports_experiments = {
67162
66946
  },
67163
66947
  CssChunkingPlugin: CssChunkingPlugin,
67164
66948
  createNativePlugin: createNativePlugin,
67165
- VirtualModulesPlugin: VirtualModulesPlugin,
67166
- createRscPlugins: createRscPlugins,
67167
- RSC_LAYERS_NAMES: RSC_LAYERS_NAMES
66949
+ VirtualModulesPlugin: VirtualModulesPlugin
67168
66950
  };
67169
66951
  const ERROR_PREFIX = "Invalid Rspack configuration:";
67170
66952
  const validateContext = ({ context })=>{
@@ -67225,7 +67007,8 @@ function createCompiler(userOptions) {
67225
67007
  for (const plugin of options.plugins)if ("function" == typeof plugin) plugin.call(compiler, compiler);
67226
67008
  else if (plugin) plugin.apply(compiler);
67227
67009
  }
67228
- applyRspackOptionsDefaults(compiler.options);
67010
+ const { platform } = applyRspackOptionsDefaults(compiler.options);
67011
+ if (platform) compiler.platform = platform;
67229
67012
  compiler.hooks.environment.call();
67230
67013
  compiler.hooks.afterEnvironment.call();
67231
67014
  new RspackOptionsApply().process(compiler.options, compiler);
@@ -67281,7 +67064,7 @@ function rspack(options, callback) {
67281
67064
  }
67282
67065
  {
67283
67066
  const { compiler, watch } = create();
67284
- if (watch) 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.")();
67067
+ if (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.");
67285
67068
  return compiler;
67286
67069
  }
67287
67070
  }
@@ -67487,4 +67270,4 @@ var __webpack_exports__EntryDependency = external_rspack_wasi_browser_js_.EntryD
67487
67270
  var __webpack_exports__ExternalModule = external_rspack_wasi_browser_js_.ExternalModule;
67488
67271
  var __webpack_exports__Module = external_rspack_wasi_browser_js_.Module;
67489
67272
  var __webpack_exports__NormalModule = external_rspack_wasi_browser_js_.NormalModule;
67490
- export { BannerPlugin, BrowserHttpImportEsmPlugin, BrowserRequirePlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ContextReplacementPlugin, Coordinator, CopyRspackPlugin, CssExtractRspackPlugin, DefinePlugin, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, lib_EntryOptionPlugin as EntryOptionPlugin, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RscClientPlugin, RscServerPlugin, RspackOptionsApply, DefaultRuntimeGlobals as RuntimeGlobals, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, statsFactoryUtils_StatsErrorCode as StatsErrorCode, SubresourceIntegrityPlugin, SwcJsMinimizerRspackPlugin, Template, ValidationError, WarnCaseSensitiveModulesPlugin, exports_WebpackError as WebpackError, RspackOptionsApply as WebpackOptionsApply, builtinMemFs, exports_config as config, container, electron, exports_experiments as experiments, javascript, lazyCompilationMiddleware, exports_library as library, exports_node as node, optimize, src_rspack_0 as rspack, exports_rspackVersion as rspackVersion, sharing, sources, exports_util as util, exports_version as version, exports_wasm as wasm, web, webworker, __webpack_exports__AsyncDependenciesBlock as AsyncDependenciesBlock, __webpack_exports__ConcatenatedModule as ConcatenatedModule, __webpack_exports__ContextModule as ContextModule, __webpack_exports__Dependency as Dependency, __webpack_exports__EntryDependency as EntryDependency, __webpack_exports__ExternalModule as ExternalModule, __webpack_exports__Module as Module, __webpack_exports__NormalModule as NormalModule };
67273
+ export { BannerPlugin, BrowserHttpImportEsmPlugin, BrowserRequirePlugin, CaseSensitivePlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefinePlugin, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, lib_EntryOptionPlugin as EntryOptionPlugin, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, DefaultRuntimeGlobals as RuntimeGlobals, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, statsFactoryUtils_StatsErrorCode as StatsErrorCode, SubresourceIntegrityPlugin, SwcJsMinimizerRspackPlugin, Template, ValidationError, CaseSensitivePlugin as WarnCaseSensitiveModulesPlugin, exports_WebpackError as WebpackError, RspackOptionsApply as WebpackOptionsApply, builtinMemFs, exports_config as config, container, electron, exports_experiments as experiments, javascript, lazyCompilationMiddleware, exports_library as library, exports_node as node, optimize, src_rspack_0 as rspack, exports_rspackVersion as rspackVersion, sharing, sources, exports_util as util, exports_version as version, exports_wasm as wasm, web, webworker, __webpack_exports__AsyncDependenciesBlock as AsyncDependenciesBlock, __webpack_exports__ConcatenatedModule as ConcatenatedModule, __webpack_exports__ContextModule as ContextModule, __webpack_exports__Dependency as Dependency, __webpack_exports__EntryDependency as EntryDependency, __webpack_exports__ExternalModule as ExternalModule, __webpack_exports__Module as Module, __webpack_exports__NormalModule as NormalModule };
@@ -326,7 +326,7 @@ export declare class JsCompilation {
326
326
  }
327
327
 
328
328
  export declare class JsCompiler {
329
- constructor(compilerPath: string, options: RawOptions, builtinPlugins: Array<BuiltinPlugin>, registerJsTaps: RegisterJsTaps, outputFilesystem: ThreadsafeNodeFS, intermediateFilesystem: ThreadsafeNodeFS | undefined | null, inputFilesystem: ThreadsafeNodeFS | undefined | null, resolverFactoryReference: JsResolverFactory, unsafeFastDrop: boolean)
329
+ constructor(compilerPath: string, options: RawOptions, builtinPlugins: Array<BuiltinPlugin>, registerJsTaps: RegisterJsTaps, outputFilesystem: ThreadsafeNodeFS, intermediateFilesystem: ThreadsafeNodeFS | undefined | null, inputFilesystem: ThreadsafeNodeFS | undefined | null, resolverFactoryReference: JsResolverFactory, unsafeFastDrop: boolean, platform: RawCompilerPlatform)
330
330
  setNonSkippableRegisters(kinds: Array<RegisterJsTapKind>): void
331
331
  /** Build with the given option passed to the constructor */
332
332
  build(callback: (err: null | Error) => void): void
@@ -334,7 +334,6 @@ export declare class JsCompiler {
334
334
  rebuild(changed_files: string[], removed_files: string[], callback: (err: null | Error) => void): void
335
335
  close(): Promise<void>
336
336
  getVirtualFileStore(): VirtualFileStore | null
337
- getCompilerId(): ExternalObject<CompilerId>
338
337
  }
339
338
 
340
339
  export declare class JsContextModuleFactoryAfterResolveData {
@@ -362,10 +361,6 @@ export declare class JsContextModuleFactoryBeforeResolveData {
362
361
  set recursive(recursive: boolean)
363
362
  }
364
363
 
365
- export declare class JsCoordinator {
366
- constructor(getServerCompilerIdJsFn: () => ExternalObject<CompilerId>)
367
- }
368
-
369
364
  export declare class JsDependencies {
370
365
  get fileDependencies(): Array<string>
371
366
  get addedFileDependencies(): Array<string>
@@ -561,7 +556,7 @@ export declare enum BuiltinPluginName {
561
556
  RealContentHashPlugin = 'RealContentHashPlugin',
562
557
  RemoveEmptyChunksPlugin = 'RemoveEmptyChunksPlugin',
563
558
  EnsureChunkConditionsPlugin = 'EnsureChunkConditionsPlugin',
564
- WarnCaseSensitiveModulesPlugin = 'WarnCaseSensitiveModulesPlugin',
559
+ CaseSensitivePlugin = 'CaseSensitivePlugin',
565
560
  DataUriPlugin = 'DataUriPlugin',
566
561
  FileUriPlugin = 'FileUriPlugin',
567
562
  RuntimePlugin = 'RuntimePlugin',
@@ -607,9 +602,7 @@ export declare enum BuiltinPluginName {
607
602
  LazyCompilationPlugin = 'LazyCompilationPlugin',
608
603
  ModuleInfoHeaderPlugin = 'ModuleInfoHeaderPlugin',
609
604
  HttpUriPlugin = 'HttpUriPlugin',
610
- CssChunkingPlugin = 'CssChunkingPlugin',
611
- RscServerPlugin = 'RscServerPlugin',
612
- RscClientPlugin = 'RscClientPlugin'
605
+ CssChunkingPlugin = 'CssChunkingPlugin'
613
606
  }
614
607
 
615
608
  export declare function cleanupGlobalTrace(): void
@@ -1845,6 +1838,15 @@ export interface RawCircularDependencyRspackPluginOptions {
1845
1838
  onEnd?: () => void
1846
1839
  }
1847
1840
 
1841
+ export interface RawCompilerPlatform {
1842
+ web?: boolean | null
1843
+ browser?: boolean | null
1844
+ webworker?: boolean | null
1845
+ node?: boolean | null
1846
+ nwjs?: boolean | null
1847
+ electron?: boolean | null
1848
+ }
1849
+
1848
1850
  export interface RawConsumeOptions {
1849
1851
  key: string
1850
1852
  import?: string
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";
@@ -85,7 +85,6 @@ export const JsCompilation = __napiModule.exports.JsCompilation
85
85
  export const JsCompiler = __napiModule.exports.JsCompiler
86
86
  export const JsContextModuleFactoryAfterResolveData = __napiModule.exports.JsContextModuleFactoryAfterResolveData
87
87
  export const JsContextModuleFactoryBeforeResolveData = __napiModule.exports.JsContextModuleFactoryBeforeResolveData
88
- export const JsCoordinator = __napiModule.exports.JsCoordinator
89
88
  export const JsDependencies = __napiModule.exports.JsDependencies
90
89
  export const JsEntries = __napiModule.exports.JsEntries
91
90
  export const JsExportsInfo = __napiModule.exports.JsExportsInfo
Binary file
@@ -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/browser",
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": "Rspack for running in the browser. This is still in early stage and may not follow the semver.",
@@ -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 "../../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 "../../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
- };