@rspack/core 1.0.0-alpha.1 → 1.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/compiled/zod-validation-error/index.d.ts +4 -170
  2. package/compiled/zod-validation-error/index.js +4 -4154
  3. package/dist/ChunkGraph.d.ts +1 -1
  4. package/dist/Compilation.d.ts +9 -9
  5. package/dist/Compilation.js +25 -21
  6. package/dist/Compiler.d.ts +6 -6
  7. package/dist/Compiler.js +5 -6
  8. package/dist/ContextModuleFactory.d.ts +1 -1
  9. package/dist/FileSystem.d.ts +2 -2
  10. package/dist/Module.d.ts +4 -3
  11. package/dist/Module.js +1 -0
  12. package/dist/MultiCompiler.d.ts +3 -3
  13. package/dist/MultiStats.d.ts +2 -2
  14. package/dist/MultiWatching.d.ts +2 -2
  15. package/dist/NormalModule.d.ts +1 -1
  16. package/dist/NormalModuleFactory.d.ts +1 -1
  17. package/dist/Resolver.d.ts +19 -0
  18. package/dist/Resolver.js +39 -0
  19. package/dist/ResolverFactory.d.ts +9 -47
  20. package/dist/ResolverFactory.js +49 -120
  21. package/dist/RspackError.d.ts +1 -1
  22. package/dist/RuntimeGlobals.d.ts +1 -1
  23. package/dist/Stats.d.ts +2 -2
  24. package/dist/Watching.d.ts +3 -3
  25. package/dist/builtin-loader/swc/index.d.ts +0 -4
  26. package/dist/builtin-loader/swc/index.js +1 -5
  27. package/dist/builtin-loader/swc/pluginImport.d.ts +17 -1
  28. package/dist/builtin-loader/swc/react.d.ts +11 -1
  29. package/dist/builtin-loader/swc/types.d.ts +0 -2
  30. package/dist/builtin-plugin/APIPlugin.d.ts +3 -3
  31. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +3 -3
  32. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +3 -3
  33. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +3 -3
  34. package/dist/builtin-plugin/BannerPlugin.d.ts +25 -4
  35. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +4 -4
  36. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +3 -3
  37. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +3 -3
  38. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +4 -4
  39. package/dist/builtin-plugin/CssModulesPlugin.d.ts +3 -3
  40. package/dist/builtin-plugin/DataUriPlugin.d.ts +3 -3
  41. package/dist/builtin-plugin/DefinePlugin.d.ts +10 -4
  42. package/dist/builtin-plugin/DefinePlugin.js +42 -8
  43. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +3 -3
  44. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +3 -3
  45. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +5 -5
  46. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +3 -3
  47. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +3 -3
  48. package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +2 -2
  49. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +3 -3
  50. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +3 -3
  51. package/dist/builtin-plugin/EntryPlugin.d.ts +5 -5
  52. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +4 -4
  53. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +5 -5
  54. package/dist/builtin-plugin/ExternalsPlugin.d.ts +22 -6
  55. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +3 -3
  56. package/dist/builtin-plugin/FileUriPlugin.d.ts +3 -3
  57. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +3 -3
  58. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +3 -3
  59. package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +2 -2
  60. package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +19 -4
  61. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +4 -4
  62. package/dist/builtin-plugin/IgnorePlugin.d.ts +4 -4
  63. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +3 -3
  64. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +2 -2
  65. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +4 -4
  66. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +3 -3
  67. package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +4 -4
  68. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +4 -4
  69. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +3 -3
  70. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +3 -3
  71. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +3 -3
  72. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +3 -3
  73. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +3 -3
  74. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +3 -3
  75. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +3 -3
  76. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +3 -3
  77. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +3 -3
  78. package/dist/builtin-plugin/ProgressPlugin.d.ts +4 -4
  79. package/dist/builtin-plugin/ProvidePlugin.d.ts +3 -3
  80. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +3 -3
  81. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +3 -3
  82. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +4 -4
  83. package/dist/builtin-plugin/RuntimePlugin.d.ts +3 -3
  84. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +3 -3
  85. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +9 -4
  86. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +4 -4
  87. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +3 -3
  88. package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +3 -3
  89. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +4 -4
  90. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +3 -3
  91. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +3 -3
  92. package/dist/builtin-plugin/WorkerPlugin.d.ts +3 -3
  93. package/dist/builtin-plugin/base.d.ts +6 -6
  94. package/dist/builtin-plugin/base.js +3 -3
  95. package/dist/builtin-plugin/css-extract/index.d.ts +1 -1
  96. package/dist/builtin-plugin/css-extract/loader.js +13 -3
  97. package/dist/builtin-plugin/css-extract/utils.d.ts +1 -1
  98. package/dist/builtin-plugin/index.d.ts +1 -7
  99. package/dist/builtin-plugin/index.js +3 -17
  100. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +11 -17
  101. package/dist/builtin-plugin/lazy-compilation/plugin.d.ts +2 -2
  102. package/dist/config/adapter.d.ts +5 -4
  103. package/dist/config/adapter.js +3 -2
  104. package/dist/config/adapterRuleUse.d.ts +7 -7
  105. package/dist/config/adapterRuleUse.js +0 -3
  106. package/dist/config/defaults.d.ts +1 -1
  107. package/dist/config/zod.d.ts +382 -382
  108. package/dist/config/zod.js +2 -3
  109. package/dist/container/ContainerPlugin.d.ts +3 -3
  110. package/dist/container/ContainerReferencePlugin.d.ts +4 -4
  111. package/dist/container/ModuleFederationPlugin.d.ts +2 -2
  112. package/dist/container/ModuleFederationPluginV1.d.ts +5 -5
  113. package/dist/container/ModuleFederationRuntimePlugin.d.ts +3 -3
  114. package/dist/container/default.runtime.js +1 -1
  115. package/dist/lib/EntryOptionPlugin.d.ts +2 -2
  116. package/dist/lib/NormalModuleReplacementPlugin.d.ts +2 -2
  117. package/dist/loader-runner/index.d.ts +2 -2
  118. package/dist/loader-runner/index.js +33 -46
  119. package/dist/loader-runner/loadLoader.js +1 -1
  120. package/dist/node/NodeTemplatePlugin.d.ts +1 -1
  121. package/dist/node/NodeWatchFileSystem.d.ts +1 -1
  122. package/dist/node/nodeConsole.js +26 -3
  123. package/dist/rspack.d.ts +3 -3
  124. package/dist/rspackOptionsApply.d.ts +1 -1
  125. package/dist/rspackOptionsApply.js +1 -19
  126. package/dist/sharing/ConsumeSharedPlugin.d.ts +2 -2
  127. package/dist/sharing/ProvideSharedPlugin.d.ts +2 -2
  128. package/dist/sharing/SharePlugin.d.ts +1 -1
  129. package/dist/sharing/ShareRuntimePlugin.d.ts +2 -2
  130. package/dist/stats/StatsFactory.d.ts +2 -2
  131. package/dist/stats/statsFactoryUtils.d.ts +1 -1
  132. package/dist/util/SplitChunkSize.d.ts +1 -1
  133. package/dist/util/bindingVersionCheck.js +1 -1
  134. package/dist/util/comparators.d.ts +1 -1
  135. package/dist/util/fs.d.ts +1 -1
  136. package/dist/util/index.d.ts +1 -1
  137. package/dist/util/index.js +4 -2
  138. package/dist/util/validate.d.ts +1 -1
  139. package/package.json +5 -35
  140. package/dist/builtin-loader/swc/preact.d.ts +0 -6
  141. package/dist/builtin-loader/swc/preact.js +0 -15
@@ -2,9 +2,9 @@ import { BuiltinPluginName } from "@rspack/binding";
2
2
  export declare const SideEffectsFlagPlugin: {
3
3
  new (): {
4
4
  name: BuiltinPluginName;
5
- _options: void;
6
- affectedHooks: "make" | "compile" | "emit" | "afterEmit" | "invalid" | "done" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
7
- raw(): import("@rspack/binding").BuiltinPlugin;
5
+ _args: [];
6
+ affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
7
+ raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
8
8
  apply(compiler: import("../Compiler").Compiler): void;
9
9
  };
10
10
  };
@@ -1,4 +1,4 @@
1
- import { BuiltinPluginName, RawSizeLimitsPluginOptions } from "@rspack/binding";
1
+ import { BuiltinPluginName } from "@rspack/binding";
2
2
  export declare const SizeLimitsPlugin: {
3
3
  new (options: {
4
4
  assetFilter?: ((args_0: string, ...args_1: unknown[]) => boolean) | undefined;
@@ -7,9 +7,14 @@ export declare const SizeLimitsPlugin: {
7
7
  maxEntrypointSize?: number | undefined;
8
8
  }): {
9
9
  name: BuiltinPluginName;
10
- _options: RawSizeLimitsPluginOptions;
11
- affectedHooks: "make" | "compile" | "emit" | "afterEmit" | "invalid" | "done" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
12
- raw(): import("@rspack/binding").BuiltinPlugin;
10
+ _args: [options: {
11
+ assetFilter?: ((args_0: string, ...args_1: unknown[]) => boolean) | undefined;
12
+ hints?: false | "error" | "warning" | undefined;
13
+ maxAssetSize?: number | undefined;
14
+ maxEntrypointSize?: number | undefined;
15
+ }];
16
+ affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
17
+ raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
13
18
  apply(compiler: import("../Compiler").Compiler): void;
14
19
  };
15
20
  };
@@ -1,4 +1,4 @@
1
- import { BuiltinPluginName, RawSourceMapDevToolPluginOptions } from "@rspack/binding";
1
+ import { BuiltinPluginName, type RawSourceMapDevToolPluginOptions } from "@rspack/binding";
2
2
  /**
3
3
  * Include source maps for modules based on their extension (defaults to .js and .css).
4
4
  */
@@ -15,9 +15,9 @@ export interface SourceMapDevToolPluginOptions extends Omit<RawSourceMapDevToolP
15
15
  export declare const SourceMapDevToolPlugin: {
16
16
  new (options: SourceMapDevToolPluginOptions): {
17
17
  name: BuiltinPluginName;
18
- _options: RawSourceMapDevToolPluginOptions;
19
- affectedHooks: "make" | "compile" | "emit" | "afterEmit" | "invalid" | "done" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
20
- raw(): import("@rspack/binding").BuiltinPlugin;
18
+ _args: [options: SourceMapDevToolPluginOptions];
19
+ affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
20
+ raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
21
21
  apply(compiler: import("../Compiler").Compiler): void;
22
22
  };
23
23
  };
@@ -1,6 +1,6 @@
1
- import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
2
- import { Compiler } from "../Compiler";
3
- import { type OptimizationSplitChunksOptions } from "../config/zod";
1
+ import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
2
+ import type { Compiler } from "../Compiler";
3
+ import type { OptimizationSplitChunksOptions } from "../config/zod";
4
4
  import { RspackBuiltinPlugin } from "./base";
5
5
  export declare class SplitChunksPlugin extends RspackBuiltinPlugin {
6
6
  private options;
@@ -2,9 +2,9 @@ import { BuiltinPluginName } from "@rspack/binding";
2
2
  export declare const SwcCssMinimizerRspackPlugin: {
3
3
  new (options?: any): {
4
4
  name: BuiltinPluginName;
5
- _options: undefined;
6
- affectedHooks: "make" | "compile" | "emit" | "afterEmit" | "invalid" | "done" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
7
- raw(): import("@rspack/binding").BuiltinPlugin;
5
+ _args: [options?: any];
6
+ affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
7
+ raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
8
8
  apply(compiler: import("../Compiler").Compiler): void;
9
9
  };
10
10
  };
@@ -1,4 +1,4 @@
1
- import { BuiltinPluginName, RawSwcJsMinimizerRspackPluginOptions } from "@rspack/binding";
1
+ import { BuiltinPluginName } from "@rspack/binding";
2
2
  type MinifyCondition = string | RegExp;
3
3
  type MinifyConditions = MinifyCondition | MinifyCondition[];
4
4
  type ExtractCommentsCondition = boolean | RegExp;
@@ -203,9 +203,9 @@ export interface TerserManglePropertiesOptions {
203
203
  export declare const SwcJsMinimizerRspackPlugin: {
204
204
  new (options?: SwcJsMinimizerRspackPluginOptions | undefined): {
205
205
  name: BuiltinPluginName;
206
- _options: RawSwcJsMinimizerRspackPluginOptions;
207
- affectedHooks: "make" | "compile" | "emit" | "afterEmit" | "invalid" | "done" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
208
- raw(): import("@rspack/binding").BuiltinPlugin;
206
+ _args: [options?: SwcJsMinimizerRspackPluginOptions | undefined];
207
+ affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
208
+ raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
209
209
  apply(compiler: import("../Compiler").Compiler): void;
210
210
  };
211
211
  };
@@ -2,9 +2,9 @@ import { BuiltinPluginName } from "@rspack/binding";
2
2
  export declare const WarnCaseSensitiveModulesPlugin: {
3
3
  new (): {
4
4
  name: BuiltinPluginName;
5
- _options: void;
6
- affectedHooks: "make" | "compile" | "emit" | "afterEmit" | "invalid" | "done" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
7
- raw(): import("@rspack/binding").BuiltinPlugin;
5
+ _args: [];
6
+ affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
7
+ raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
8
8
  apply(compiler: import("../Compiler").Compiler): void;
9
9
  };
10
10
  };
@@ -2,9 +2,9 @@ import { BuiltinPluginName } from "@rspack/binding";
2
2
  export declare const WebWorkerTemplatePlugin: {
3
3
  new (): {
4
4
  name: BuiltinPluginName;
5
- _options: undefined;
6
- affectedHooks: "make" | "compile" | "emit" | "afterEmit" | "invalid" | "done" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
7
- raw(): import("@rspack/binding").BuiltinPlugin;
5
+ _args: [];
6
+ affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
7
+ raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
8
8
  apply(compiler: import("../Compiler").Compiler): void;
9
9
  };
10
10
  };
@@ -1,6 +1,6 @@
1
- import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
2
- import { Compiler } from "../Compiler";
3
- import { ChunkLoading, OutputModule, WasmLoading, WorkerPublicPath } from "../config";
1
+ import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
2
+ import type { Compiler } from "../Compiler";
3
+ import type { ChunkLoading, OutputModule, WasmLoading, WorkerPublicPath } from "../config";
4
4
  import { RspackBuiltinPlugin } from "./base";
5
5
  export declare class WorkerPlugin extends RspackBuiltinPlugin {
6
6
  private chunkLoading;
@@ -1,5 +1,5 @@
1
- import * as binding from "@rspack/binding";
2
- import { Compiler, RspackPluginInstance } from "..";
1
+ import type * as binding from "@rspack/binding";
2
+ import type { Compiler, RspackPluginInstance } from "..";
3
3
  type AffectedHooks = keyof Compiler["hooks"];
4
4
  export declare const HOOKS_CAN_NOT_INHERENT_FROM_PARENT: string[];
5
5
  export declare function canInherentFromParent(affectedHooks?: AffectedHooks): boolean;
@@ -10,12 +10,12 @@ export declare abstract class RspackBuiltinPlugin implements RspackPluginInstanc
10
10
  apply(compiler: Compiler): void;
11
11
  }
12
12
  export declare function createBuiltinPlugin<R>(name: binding.BuiltinPluginName, options: R): binding.BuiltinPlugin;
13
- export declare function create<T extends any[], R>(name: binding.BuiltinPluginName, resolve: (...args: T) => R, affectedHooks?: AffectedHooks): {
13
+ export declare function create<T extends any[], R>(name: binding.BuiltinPluginName, resolve: (this: Compiler, ...args: T) => R, affectedHooks?: AffectedHooks): {
14
14
  new (...args: T): {
15
15
  name: binding.BuiltinPluginName;
16
- _options: R;
17
- affectedHooks: "make" | "compile" | "emit" | "afterEmit" | "invalid" | "done" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
18
- raw(): binding.BuiltinPlugin;
16
+ _args: T;
17
+ affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
18
+ raw(compiler: Compiler): binding.BuiltinPlugin;
19
19
  apply(compiler: Compiler): void;
20
20
  };
21
21
  };
@@ -46,10 +46,10 @@ affectedHooks) {
46
46
  super();
47
47
  this.name = name;
48
48
  this.affectedHooks = affectedHooks;
49
- this._options = resolve(...args);
49
+ this._args = args;
50
50
  }
51
- raw() {
52
- return createBuiltinPlugin(name, this._options);
51
+ raw(compiler) {
52
+ return createBuiltinPlugin(name, resolve.apply(compiler, this._args));
53
53
  }
54
54
  }
55
55
  // Make the plugin class name consistent with webpack
@@ -1,5 +1,5 @@
1
1
  import type { RawCssExtractPluginOption } from "@rspack/binding";
2
- import { Compiler } from "../..";
2
+ import type { Compiler } from "../..";
3
3
  export * from "./loader";
4
4
  export type { CssExtractRspackLoaderOptions } from "./loader";
5
5
  export interface CssExtractRspackPluginOptions {
@@ -34,7 +34,12 @@ const loader = function loader(content) {
34
34
  if (this._compiler &&
35
35
  this._compiler.options &&
36
36
  this._compiler.options.experiments &&
37
- this._compiler.options.experiments.css) {
37
+ this._compiler.options.experiments.css &&
38
+ this._module &&
39
+ (this._module.type === "css" ||
40
+ this._module.type === "css/auto" ||
41
+ this._module.type === "css/global" ||
42
+ this._module.type === "css/module")) {
38
43
  return content;
39
44
  }
40
45
  };
@@ -42,8 +47,13 @@ const pitch = function (request, _, data) {
42
47
  if (this._compiler &&
43
48
  this._compiler.options &&
44
49
  this._compiler.options.experiments &&
45
- this._compiler.options.experiments.css) {
46
- let e = new Error("You can't use `experiments.css` and `css-extract-rspack-plugin` together, please set `experiments.css` to `false`");
50
+ this._compiler.options.experiments.css &&
51
+ this._module &&
52
+ (this._module.type === "css" ||
53
+ this._module.type === "css/auto" ||
54
+ this._module.type === "css/global" ||
55
+ this._module.type === "css/module")) {
56
+ let e = new Error(`use type 'css' and \`CssExtractRspackPlugin\` together, please set \`experiments.css\` to \`false\` or set \`{ type: "javascript/auto" }\` for rules with \`CssExtractRspackPlugin\` in your rspack config (now \`CssExtractRspackPlugin\` does nothing).`);
47
57
  e.stack = undefined;
48
58
  this.emitWarning(e);
49
59
  return;
@@ -1,4 +1,4 @@
1
- import { LoaderContext } from "../..";
1
+ import type { LoaderContext } from "../..";
2
2
  export declare function isAbsolutePath(str: string): boolean;
3
3
  export declare function isRelativePath(str: string): boolean;
4
4
  export declare function stringifyRequest(loaderContext: LoaderContext, request: string): string;
@@ -1,9 +1,9 @@
1
+ export { RspackBuiltinPlugin } from "./base";
1
2
  export * from "./APIPlugin";
2
3
  export * from "./ArrayPushCallbackChunkFormatPlugin";
3
4
  export * from "./AssetModulesPlugin";
4
5
  export * from "./AsyncWebAssemblyModulesPlugin";
5
6
  export * from "./BannerPlugin";
6
- export { RspackBuiltinPlugin } from "./base";
7
7
  export * from "./BundlerInfoRspackPlugin";
8
8
  export * from "./ChunkPrefetchPreloadPlugin";
9
9
  export * from "./CommonJsChunkFormatPlugin";
@@ -63,9 +63,3 @@ export * from "./WarnCaseSensitiveModulesPlugin";
63
63
  export * from "./WebWorkerTemplatePlugin";
64
64
  export * from "./WorkerPlugin";
65
65
  export * from "./FetchCompileAsyncWasmPlugin";
66
- import { RawBuiltins } from "@rspack/binding";
67
- import { RspackOptionsNormalized } from "..";
68
- export interface Builtins {
69
- treeShaking?: boolean | "module";
70
- }
71
- export declare function deprecated_resolveBuiltins(builtins: Builtins, options: RspackOptionsNormalized): RawBuiltins;
@@ -14,14 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.deprecated_resolveBuiltins = exports.RspackBuiltinPlugin = void 0;
17
+ exports.RspackBuiltinPlugin = void 0;
18
+ var base_1 = require("./base");
19
+ Object.defineProperty(exports, "RspackBuiltinPlugin", { enumerable: true, get: function () { return base_1.RspackBuiltinPlugin; } });
18
20
  __exportStar(require("./APIPlugin"), exports);
19
21
  __exportStar(require("./ArrayPushCallbackChunkFormatPlugin"), exports);
20
22
  __exportStar(require("./AssetModulesPlugin"), exports);
21
23
  __exportStar(require("./AsyncWebAssemblyModulesPlugin"), exports);
22
24
  __exportStar(require("./BannerPlugin"), exports);
23
- var base_1 = require("./base");
24
- Object.defineProperty(exports, "RspackBuiltinPlugin", { enumerable: true, get: function () { return base_1.RspackBuiltinPlugin; } });
25
25
  __exportStar(require("./BundlerInfoRspackPlugin"), exports);
26
26
  __exportStar(require("./ChunkPrefetchPreloadPlugin"), exports);
27
27
  __exportStar(require("./CommonJsChunkFormatPlugin"), exports);
@@ -81,17 +81,3 @@ __exportStar(require("./WarnCaseSensitiveModulesPlugin"), exports);
81
81
  __exportStar(require("./WebWorkerTemplatePlugin"), exports);
82
82
  __exportStar(require("./WorkerPlugin"), exports);
83
83
  __exportStar(require("./FetchCompileAsyncWasmPlugin"), exports);
84
- function resolveTreeShaking(treeShaking, production) {
85
- return treeShaking !== undefined
86
- ? treeShaking.toString()
87
- : production
88
- ? "true"
89
- : "false";
90
- }
91
- function deprecated_resolveBuiltins(builtins, options) {
92
- const production = options.mode === "production" || !options.mode;
93
- return {
94
- treeShaking: resolveTreeShaking(builtins.treeShaking, production)
95
- };
96
- }
97
- exports.deprecated_resolveBuiltins = deprecated_resolveBuiltins;
@@ -1,4 +1,4 @@
1
- import { BuiltinPluginName, JsModule, RawRegex } from "@rspack/binding";
1
+ import { BuiltinPluginName, type JsModule, type RawRegex } from "@rspack/binding";
2
2
  export declare const BuiltinLazyCompilationPlugin: {
3
3
  new (module: (args: {
4
4
  module: string;
@@ -9,22 +9,16 @@ export declare const BuiltinLazyCompilationPlugin: {
9
9
  client: string;
10
10
  }, cacheable: boolean, entries: boolean, imports: boolean, test?: RawRegex | ((m: JsModule) => boolean) | undefined): {
11
11
  name: BuiltinPluginName;
12
- _options: {
13
- module: (args: {
14
- module: string;
15
- path: string;
16
- }) => {
17
- active: boolean;
18
- data: string;
19
- client: string;
20
- };
21
- cacheable: boolean;
22
- imports: boolean;
23
- entries: boolean;
24
- test: RawRegex | ((m: JsModule) => boolean) | undefined;
25
- };
26
- affectedHooks: "make" | "compile" | "emit" | "afterEmit" | "invalid" | "done" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
27
- raw(): import("@rspack/binding").BuiltinPlugin;
12
+ _args: [module: (args: {
13
+ module: string;
14
+ path: string;
15
+ }) => {
16
+ active: boolean;
17
+ data: string;
18
+ client: string;
19
+ }, cacheable: boolean, entries: boolean, imports: boolean, test?: RawRegex | ((m: JsModule) => boolean) | undefined];
20
+ affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
21
+ raw(compiler: import("../../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
28
22
  apply(compiler: import("../../Compiler").Compiler): void;
29
23
  };
30
24
  };
@@ -1,6 +1,6 @@
1
- import { JsModule, RawRegex } from "@rspack/binding";
1
+ import type { JsModule, RawRegex } from "@rspack/binding";
2
2
  import type { Compiler } from "../..";
3
- import { LazyCompilationDefaultBackendOptions } from "./backend";
3
+ import { type LazyCompilationDefaultBackendOptions } from "./backend";
4
4
  export default class LazyCompilationPlugin {
5
5
  cacheable: boolean;
6
6
  entries: boolean;
@@ -1,9 +1,10 @@
1
1
  import type { RawLibraryOptions, RawOptions } from "@rspack/binding";
2
- import { Compiler } from "../Compiler";
3
- import { LoaderContext, LoaderDefinition, LoaderDefinitionFunction } from "./adapterRuleUse";
4
- import { RspackOptionsNormalized } from "./normalization";
5
- import { ChunkLoading, LibraryOptions } from "./zod";
2
+ import type { Compiler } from "../Compiler";
3
+ import { type LoaderContext, type LoaderDefinition, type LoaderDefinitionFunction } from "./adapterRuleUse";
4
+ import type { RspackOptionsNormalized } from "./normalization";
5
+ import { type ChunkLoading, type LibraryOptions, type Resolve } from "./zod";
6
6
  export type { LoaderContext, LoaderDefinition, LoaderDefinitionFunction };
7
7
  export declare const getRawOptions: (options: RspackOptionsNormalized, compiler: Compiler) => RawOptions;
8
+ export declare function getRawResolve(resolve: Resolve): RawOptions["resolve"];
8
9
  export declare function getRawLibrary(library: LibraryOptions): RawLibraryOptions;
9
10
  export declare function getRawChunkLoading(chunkLoading: ChunkLoading): string;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getRawChunkLoading = exports.getRawLibrary = exports.getRawOptions = void 0;
6
+ exports.getRawChunkLoading = exports.getRawLibrary = exports.getRawResolve = exports.getRawOptions = void 0;
7
7
  const assert_1 = __importDefault(require("assert"));
8
8
  const Stats_1 = require("../Stats");
9
9
  const util_1 = require("../util");
@@ -106,6 +106,7 @@ function getRawResolve(resolve) {
106
106
  byDependency: getRawResolveByDependency(resolve.byDependency)
107
107
  };
108
108
  }
109
+ exports.getRawResolve = getRawResolve;
109
110
  function getRawCrossOriginLoading(crossOriginLoading) {
110
111
  if (typeof crossOriginLoading === "boolean") {
111
112
  return { type: "bool", boolPayload: crossOriginLoading };
@@ -325,7 +326,7 @@ const getRawModuleRule = (rule, path, options, upperType) => {
325
326
  delete rawModuleRule.resource;
326
327
  delete rawModuleRule.resourceQuery;
327
328
  delete rawModuleRule.resourceFragment;
328
- rawModuleRule.rspackResource = getRawRuleSetCondition(function (resourceQueryFragment) {
329
+ rawModuleRule.rspackResource = getRawRuleSetCondition(resourceQueryFragment => {
329
330
  const { path, query, fragment } = (0, identifier_1.parseResource)(resourceQueryFragment);
330
331
  if (rule.test && !tryMatch(path, rule.test)) {
331
332
  return false;
@@ -1,13 +1,13 @@
1
1
  /// <reference types="node" />
2
2
  import type { JsAssetInfo, RawModuleRuleUse, RawOptions } from "@rspack/binding";
3
- import { ResolveRequest } from "../../compiled/enhanced-resolve";
4
- import { Compiler } from "../Compiler";
5
- import { Logger } from "../logging/Logger";
3
+ import type { ResolveRequest } from "../../compiled/enhanced-resolve";
4
+ import type { Compiler } from "../Compiler";
5
+ import type { Logger } from "../logging/Logger";
6
6
  import Hash = require("../util/hash");
7
- import { Compilation } from "../Compilation";
8
- import { Module } from "../Module";
9
- import { LoaderObject } from "../loader-runner";
10
- import { Mode, Resolve, RuleSetUseItem, Target } from "./zod";
7
+ import type { Compilation } from "../Compilation";
8
+ import type { Module } from "../Module";
9
+ import { type LoaderObject } from "../loader-runner";
10
+ import type { Mode, Resolve, RuleSetUseItem, Target } from "./zod";
11
11
  export declare const BUILTIN_LOADER_PREFIX = "builtin:";
12
12
  export interface ComposeJsUseOptions {
13
13
  devtool: RawOptions["devtool"];
@@ -19,9 +19,6 @@ const getSwcLoaderOptions = (o, options) => {
19
19
  if (expr.import || expr.pluginImport) {
20
20
  expr.import = (0, builtin_loader_1.resolvePluginImport)(expr.import || expr.pluginImport);
21
21
  }
22
- if (expr.preact) {
23
- expr.preact = (0, builtin_loader_1.resolvePreact)(expr.preact);
24
- }
25
22
  }
26
23
  return o;
27
24
  };
@@ -7,6 +7,6 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import { RspackOptionsNormalized } from "./normalization";
10
+ import type { RspackOptionsNormalized } from "./normalization";
11
11
  export declare const applyRspackOptionsDefaults: (options: RspackOptionsNormalized) => void;
12
12
  export declare const applyRspackOptionsBaseDefaults: (options: RspackOptionsNormalized) => void;