@rspack/core 1.4.0-rc.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ export type CollectTypeScriptInfoOptions = {
2
+ typeExports?: boolean;
3
+ exportedEnum?: boolean | "const-only";
4
+ };
5
+ export declare function resolveCollectTypeScriptInfo(options: CollectTypeScriptInfoOptions): {
6
+ typeExports: boolean | undefined;
7
+ exportedEnum: string;
8
+ };
@@ -1,3 +1,5 @@
1
1
  export { resolvePluginImport } from "./pluginImport";
2
2
  export type { PluginImportOptions } from "./pluginImport";
3
+ export { resolveCollectTypeScriptInfo } from "./collectTypeScriptInfo";
4
+ export type { CollectTypeScriptInfoOptions } from "./collectTypeScriptInfo";
3
5
  export type { SwcLoaderEnvConfig, SwcLoaderEsParserConfig, SwcLoaderJscConfig, SwcLoaderModuleConfig, SwcLoaderOptions, SwcLoaderParserConfig, SwcLoaderTransformConfig, SwcLoaderTsParserConfig } from "./types";
@@ -1,4 +1,3 @@
1
- import * as z from "zod/v4";
2
1
  type RawStyleConfig = {
3
2
  styleLibraryDirectory?: string;
4
3
  custom?: string;
@@ -28,19 +27,7 @@ type PluginImportConfig = {
28
27
  ignoreEsComponent?: string[];
29
28
  ignoreStyleComponent?: string[];
30
29
  };
31
- type PluginImportOptions = PluginImportConfig[] | undefined;
32
- export declare const ZodSwcPluginImportConfig: z.ZodOptional<z.ZodArray<z.ZodObject<{
33
- libraryName: z.ZodString;
34
- libraryDirectory: z.ZodOptional<z.ZodString>;
35
- customName: z.ZodOptional<z.ZodString>;
36
- customStyleName: z.ZodOptional<z.ZodString>;
37
- style: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
38
- styleLibraryDirectory: z.ZodOptional<z.ZodString>;
39
- camelToDashComponentName: z.ZodOptional<z.ZodBoolean>;
40
- transformToDefaultImport: z.ZodOptional<z.ZodBoolean>;
41
- ignoreEsComponent: z.ZodOptional<z.ZodArray<z.ZodString>>;
42
- ignoreStyleComponent: z.ZodOptional<z.ZodArray<z.ZodString>>;
43
- }, z.core.$strict>>>;
30
+ type PluginImportOptions = PluginImportConfig[];
44
31
  declare function resolvePluginImport(pluginImport: PluginImportOptions): RawPluginImportConfig[] | undefined;
45
32
  export { resolvePluginImport };
46
33
  export type { PluginImportOptions };
@@ -1,6 +1,7 @@
1
1
  import type { Config, EnvConfig, EsParserConfig, JscConfig, ModuleConfig, ParserConfig, TerserEcmaVersion, TransformConfig, TsParserConfig } from "../../../compiled/@swc/types";
2
2
  import * as z from "zod/v4";
3
- import { type PluginImportOptions } from "./pluginImport";
3
+ import type { CollectTypeScriptInfoOptions } from "./collectTypeScriptInfo";
4
+ import type { PluginImportOptions } from "./pluginImport";
4
5
  export type SwcLoaderEnvConfig = EnvConfig;
5
6
  export type SwcLoaderJscConfig = JscConfig;
6
7
  export type SwcLoaderModuleConfig = ModuleConfig;
@@ -16,6 +17,7 @@ export type SwcLoaderOptions = Config & {
16
17
  */
17
18
  rspackExperiments?: {
18
19
  import?: PluginImportOptions;
20
+ collectTypeScriptInfo?: CollectTypeScriptInfoOptions;
19
21
  };
20
22
  };
21
23
  export interface TerserCompressOptions {
@@ -77,10 +79,10 @@ export interface TerserCompressOptions {
77
79
  module?: boolean;
78
80
  }
79
81
  export declare const getZodSwcLoaderOptionsSchema: () => z.ZodObject<{
80
- $schema: z.ZodOptional<z.ZodString>;
81
- test: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString>]>>;
82
- exclude: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString>]>>;
83
- env: z.ZodOptional<z.ZodObject<{
82
+ $schema: z.ZodOptional<z.ZodOptional<z.ZodString>>;
83
+ test: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString>]>>>;
84
+ exclude: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString>]>>>;
85
+ env: z.ZodOptional<z.ZodOptional<z.ZodObject<{
84
86
  mode: z.ZodOptional<z.ZodEnum<{
85
87
  usage: "usage";
86
88
  entry: "entry";
@@ -97,8 +99,8 @@ export declare const getZodSwcLoaderOptionsSchema: () => z.ZodObject<{
97
99
  path: z.ZodOptional<z.ZodString>;
98
100
  shippedProposals: z.ZodOptional<z.ZodBoolean>;
99
101
  forceAllTransforms: z.ZodOptional<z.ZodBoolean>;
100
- }, z.core.$strict>>;
101
- jsc: z.ZodOptional<z.ZodObject<{
102
+ }, z.core.$strict>>>;
103
+ jsc: z.ZodOptional<z.ZodOptional<z.ZodObject<{
102
104
  assumptions: z.ZodOptional<z.ZodObject<{
103
105
  arrayLikeIsIterable: z.ZodOptional<z.ZodBoolean>;
104
106
  constantReexports: z.ZodOptional<z.ZodBoolean>;
@@ -339,8 +341,8 @@ export declare const getZodSwcLoaderOptionsSchema: () => z.ZodObject<{
339
341
  utf8: "utf8";
340
342
  }>>;
341
343
  }, z.core.$strict>>;
342
- }, z.core.$strict>>;
343
- module: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
344
+ }, z.core.$strict>>>;
345
+ module: z.ZodOptional<z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
344
346
  strict: z.ZodOptional<z.ZodBoolean>;
345
347
  strictMode: z.ZodOptional<z.ZodBoolean>;
346
348
  lazy: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
@@ -450,13 +452,13 @@ export declare const getZodSwcLoaderOptionsSchema: () => z.ZodObject<{
450
452
  }, z.core.$strict>, z.ZodObject<{
451
453
  type: z.ZodLiteral<"systemjs">;
452
454
  allowTopLevelThis: z.ZodOptional<z.ZodBoolean>;
453
- }, z.core.$strict>]>>;
454
- minify: z.ZodOptional<z.ZodBoolean>;
455
- sourceMaps: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"inline">]>>;
456
- inlineSourcesContent: z.ZodOptional<z.ZodBoolean>;
455
+ }, z.core.$strict>]>>>;
456
+ minify: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
457
+ sourceMaps: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"inline">]>>>;
458
+ inlineSourcesContent: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
457
459
  isModule: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"unknown">]>>;
458
460
  rspackExperiments: z.ZodOptional<z.ZodObject<{
459
- import: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
461
+ import: z.ZodOptional<z.ZodArray<z.ZodObject<{
460
462
  libraryName: z.ZodString;
461
463
  libraryDirectory: z.ZodOptional<z.ZodString>;
462
464
  customName: z.ZodOptional<z.ZodString>;
@@ -467,6 +469,10 @@ export declare const getZodSwcLoaderOptionsSchema: () => z.ZodObject<{
467
469
  transformToDefaultImport: z.ZodOptional<z.ZodBoolean>;
468
470
  ignoreEsComponent: z.ZodOptional<z.ZodArray<z.ZodString>>;
469
471
  ignoreStyleComponent: z.ZodOptional<z.ZodArray<z.ZodString>>;
470
- }, z.core.$strict>>>>;
472
+ }, z.core.$strict>>>;
473
+ collectTypeScriptInfo: z.ZodOptional<z.ZodObject<{
474
+ typeExports: z.ZodOptional<z.ZodBoolean>;
475
+ exportedEnum: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"const-only">]>>;
476
+ }, z.core.$strict>>;
471
477
  }, z.core.$strict>>;
472
478
  }, z.core.$strict>;
@@ -1,6 +1,8 @@
1
1
  import * as binding from "@rspack/binding";
2
2
  export interface CssChunkingPluginOptions {
3
3
  strict?: boolean;
4
+ minSize?: number;
5
+ maxSize?: number;
4
6
  /**
5
7
  * This plugin is intended to be generic, but currently requires some special handling for Next.js.
6
8
  * A `next` option has been added to accommodate this.
@@ -9,9 +11,9 @@ export interface CssChunkingPluginOptions {
9
11
  nextjs?: boolean;
10
12
  }
11
13
  export declare const CssChunkingPlugin: {
12
- new (options: CssChunkingPluginOptions): {
14
+ new (options?: CssChunkingPluginOptions | undefined): {
13
15
  name: binding.BuiltinPluginName;
14
- _args: [options: CssChunkingPluginOptions];
16
+ _args: [options?: CssChunkingPluginOptions | undefined];
15
17
  affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
16
18
  raw(compiler: import("..").Compiler): binding.BuiltinPlugin;
17
19
  apply(compiler: import("..").Compiler): void;
@@ -0,0 +1,11 @@
1
+ import { BuiltinPluginName, type RawRslibPluginOptions } from "@rspack/binding";
2
+ export type RslibPluginArgument = Partial<Omit<RawRslibPluginOptions, "handler">> | ((percentage: number, msg: string, ...args: string[]) => void) | undefined;
3
+ export declare const RslibPlugin: {
4
+ new (rslib: RawRslibPluginOptions): {
5
+ name: BuiltinPluginName;
6
+ _args: [rslib: RawRslibPluginOptions];
7
+ affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
8
+ raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
9
+ apply(compiler: import("..").Compiler): void;
10
+ };
11
+ };
@@ -51,6 +51,7 @@ export * from "./NodeTargetPlugin";
51
51
  export * from "./OccurrenceChunkIdsPlugin";
52
52
  export * from "./ProgressPlugin";
53
53
  export * from "./RstestPlugin";
54
+ export * from "./RslibPlugin";
54
55
  export * from "./ProvidePlugin";
55
56
  export * from "./RealContentHashPlugin";
56
57
  export * from "./RemoveEmptyChunksPlugin";
@@ -1,6 +1,6 @@
1
1
  import * as z from "zod/v4";
2
2
  import type * as t from "./types";
3
- export declare const externalsType: z.ZodEnum<{
3
+ export declare const getExternalsTypeSchema: () => z.ZodEnum<{
4
4
  module: "module";
5
5
  import: "import";
6
6
  jsonp: "jsonp";
@@ -25,7 +25,7 @@ export declare const externalsType: z.ZodEnum<{
25
25
  "node-commonjs": "node-commonjs";
26
26
  "commonjs-import": "commonjs-import";
27
27
  }>;
28
- export declare const rspackOptions: z.ZodObject<{
28
+ export declare const getRspackOptionsSchema: () => z.ZodObject<{
29
29
  name: z.ZodOptional<z.ZodString>;
30
30
  dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
31
31
  extends: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
@@ -326,7 +326,7 @@ export declare const rspackOptions: z.ZodObject<{
326
326
  production: "production";
327
327
  }>>;
328
328
  experiments: z.ZodOptional<z.ZodObject<{
329
- cache: z.ZodUnion<[z.ZodOptional<z.ZodBoolean>, z.ZodUnion<[z.ZodObject<{
329
+ cache: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodObject<{
330
330
  type: z.ZodEnum<{
331
331
  memory: "memory";
332
332
  }>;
@@ -347,15 +347,15 @@ export declare const rspackOptions: z.ZodObject<{
347
347
  }>;
348
348
  directory: z.ZodOptional<z.ZodString>;
349
349
  }, z.core.$strip>>;
350
- }, z.core.$strip>]>]>;
351
- lazyCompilation: z.ZodUnion<[z.ZodOptional<z.ZodBoolean>, z.ZodObject<{
350
+ }, z.core.$strip>]>]>>;
351
+ lazyCompilation: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
352
352
  imports: z.ZodOptional<z.ZodBoolean>;
353
353
  entries: z.ZodOptional<z.ZodBoolean>;
354
354
  test: z.ZodOptional<z.ZodUnion<[z.ZodCustom<RegExp, RegExp>, z.ZodCustom<(...args: unknown[]) => any, (...args: unknown[]) => any>]>>;
355
355
  client: z.ZodOptional<z.ZodString>;
356
356
  serverUrl: z.ZodOptional<z.ZodString>;
357
357
  prefix: z.ZodOptional<z.ZodString>;
358
- }, z.core.$strip>]>;
358
+ }, z.core.$strip>]>>;
359
359
  asyncWebAssembly: z.ZodOptional<z.ZodBoolean>;
360
360
  outputModule: z.ZodOptional<z.ZodBoolean>;
361
361
  topLevelAwait: z.ZodOptional<z.ZodBoolean>;
package/dist/exports.d.ts CHANGED
@@ -119,6 +119,7 @@ import { SplitChunksPlugin } from "./builtin-plugin";
119
119
  import { RemoveDuplicateModulesPlugin } from "./builtin-plugin";
120
120
  import { RsdoctorPlugin } from "./builtin-plugin";
121
121
  import { RstestPlugin } from "./builtin-plugin";
122
+ import { RslibPlugin } from "./builtin-plugin";
122
123
  import { CssChunkingPlugin } from "./builtin-plugin";
123
124
  interface Optimize {
124
125
  LimitChunkCountPlugin: typeof LimitChunkCountPlugin;
@@ -182,6 +183,7 @@ interface Experiments {
182
183
  RemoveDuplicateModulesPlugin: typeof RemoveDuplicateModulesPlugin;
183
184
  RsdoctorPlugin: typeof RsdoctorPlugin;
184
185
  RstestPlugin: typeof RstestPlugin;
186
+ RslibPlugin: typeof RslibPlugin;
185
187
  SubresourceIntegrityPlugin: typeof SubresourceIntegrityPlugin;
186
188
  lazyCompilationMiddleware: typeof lazyCompilationMiddleware;
187
189
  swc: {