@rsbuild/core 2.0.0-alpha.0 → 2.0.0-alpha.1

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.
@@ -2,7 +2,7 @@ import type { IncomingMessage, ServerResponse } from 'node:http';
2
2
  import type { SecureServerSessionOptions } from 'node:http2';
3
3
  import type { ServerOptions as HttpsServerOptions } from 'node:https';
4
4
  import type { URL } from 'node:url';
5
- import type { Configuration, CopyRspackPluginOptions, Externals, LightningCssMinimizerRspackPluginOptions, ModuleFederationPluginOptions, RuleSetCondition, SwcJsMinimizerRspackPluginOptions, SwcLoaderOptions } from '@rspack/core';
5
+ import type { CopyRspackPluginOptions, DefinePluginOptions, Externals, LightningCssMinimizerRspackPluginOptions, ModuleFederationPluginOptions, RuleSetCondition, SwcJsMinimizerRspackPluginOptions, SwcLoaderOptions } from '@rspack/core';
6
6
  import type { CorsOptions } from 'cors';
7
7
  import type RspackChain from '../../compiled/rspack-chain/types';
8
8
  import type { FileDescriptor } from 'rspack-manifest-plugin';
@@ -12,7 +12,7 @@ import type { RsbuildDevServer } from '../server/devServer';
12
12
  import type { EnvironmentContext, ModifyBundlerChainUtils, ModifyChainUtils, Routes } from './hooks';
13
13
  import type { RsbuildPlugins } from './plugin';
14
14
  import type { RsbuildEntry, RsbuildMode, RsbuildTarget } from './rsbuild';
15
- import type { BundlerPluginInstance, Rspack, RspackRule } from './rspack';
15
+ import type { Rspack, RspackRule } from './rspack';
16
16
  import type { Connect, CSSExtractOptions, CSSLoaderModulesOptions, CSSLoaderOptions, HtmlRspackPlugin, LoosePostCSSPlugin, PostCSSLoaderOptions, StyleLoaderOptions } from './thirdParty';
17
17
  import type { ConfigChain, ConfigChainMergeContext, ConfigChainWithContext, LiteralUnion, MaybePromise, OneOrMany, Optional, TwoLevelReadonly } from './utils';
18
18
  export type ToolsSwcConfig = ConfigChain<SwcLoaderOptions>;
@@ -39,8 +39,8 @@ export type RspackMerge = (firstConfiguration: Rspack.Configuration | Rspack.Con
39
39
  export type ModifyRspackConfigUtils = ModifyChainUtils & {
40
40
  addRules: (rules: RspackRule | RspackRule[]) => void;
41
41
  appendRules: (rules: RspackRule | RspackRule[]) => void;
42
- prependPlugins: (plugins: BundlerPluginInstance | BundlerPluginInstance[]) => void;
43
- appendPlugins: (plugins: BundlerPluginInstance | BundlerPluginInstance[]) => void;
42
+ prependPlugins: (plugins: Rspack.RspackPluginInstance | Rspack.RspackPluginInstance[]) => void;
43
+ appendPlugins: (plugins: Rspack.RspackPluginInstance | Rspack.RspackPluginInstance[]) => void;
44
44
  removePlugin: (pluginName: string) => void;
45
45
  mergeConfig: RspackMerge;
46
46
  };
@@ -133,7 +133,6 @@ export type NormalizedToolsConfig = ToolsConfig & {
133
133
  cssExtract: Required<CSSExtractOptions>;
134
134
  };
135
135
  export type Alias = Record<string, string | false | (string | false)[]>;
136
- export type Define = Record<string, any>;
137
136
  export type AliasStrategy = 'prefer-tsconfig' | 'prefer-alias';
138
137
  export type Decorators = {
139
138
  /**
@@ -193,7 +192,7 @@ export interface SourceConfig {
193
192
  * Replaces variables in your code with other values or expressions at compile time.
194
193
  * This is useful for enabling different behavior between development and production builds.
195
194
  */
196
- define?: Define;
195
+ define?: DefinePluginOptions;
197
196
  /**
198
197
  * Configuring decorators syntax.
199
198
  */
@@ -211,16 +210,18 @@ export interface SourceConfig {
211
210
  export type TransformImport = {
212
211
  libraryName: string;
213
212
  libraryDirectory?: string;
213
+ customName?: string;
214
+ customStyleName?: string;
214
215
  style?: string | boolean;
215
216
  styleLibraryDirectory?: string;
216
217
  camelToDashComponentName?: boolean;
217
218
  transformToDefaultImport?: boolean;
218
- customName?: any;
219
- customStyleName?: any;
219
+ ignoreEsComponent?: string[];
220
+ ignoreStyleComponent?: string[];
220
221
  };
221
222
  type TransformImportFn = (imports: TransformImport[]) => TransformImport[] | void;
222
223
  export interface NormalizedSourceConfig extends SourceConfig {
223
- define: Define;
224
+ define: DefinePluginOptions;
224
225
  preEntry: string[];
225
226
  decorators: Required<Decorators>;
226
227
  }
@@ -587,11 +588,6 @@ export interface PerformanceConfig {
587
588
  * @default false
588
589
  */
589
590
  removeConsole?: boolean | ConsoleType[];
590
- /**
591
- * Whether to remove the locales of [moment.js](https://momentjs.com/).
592
- * @default false
593
- */
594
- removeMomentLocale?: boolean;
595
591
  /**
596
592
  * To enable or configure persistent build cache.
597
593
  * @experimental This feature is experimental and may be changed in the future.
@@ -660,11 +656,7 @@ export interface NormalizedPerformanceConfig extends PerformanceConfig {
660
656
  printFileSize: PrintFileSizeOptions | boolean;
661
657
  chunkSplit: ChunkSplit;
662
658
  }
663
- export type SplitChunks = Configuration extends {
664
- optimization?: {
665
- splitChunks?: infer P;
666
- };
667
- } ? P : never;
659
+ export type SplitChunks = Rspack.OptimizationSplitChunksOptions | false;
668
660
  export type ForceSplitting = RegExp[] | Record<string, RegExp>;
669
661
  export interface BaseSplitRules {
670
662
  strategy?: string;
@@ -7,10 +7,4 @@ declare module '@rspack/core' {
7
7
  __rsbuildTransformer?: Record<string, TransformHandler>;
8
8
  }
9
9
  }
10
- export interface BundlerPluginInstance {
11
- [index: string]: any;
12
- apply: (compiler: any) => void;
13
- }
14
- /** T[] => T */
15
- type GetElementType<T extends any[]> = T extends (infer U)[] ? U : never;
16
- export type RspackRule = GetElementType<Rspack.RuleSetRules>;
10
+ export type RspackRule = Rspack.RuleSetRules[number];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "2.0.0-alpha.0",
3
+ "version": "2.0.0-alpha.1",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -36,7 +36,7 @@
36
36
  "types.d.ts"
37
37
  ],
38
38
  "dependencies": {
39
- "@rspack/core": "~1.7.2",
39
+ "@rspack/core": "2.0.0-canary.20260120",
40
40
  "@rspack/lite-tapable": "~1.1.0",
41
41
  "@swc/helpers": "^0.5.18",
42
42
  "jiti": "^2.6.1"
@@ -52,10 +52,10 @@
52
52
  "devDependencies": {
53
53
  "@jridgewell/remapping": "^2.3.5",
54
54
  "@jridgewell/trace-mapping": "^0.3.31",
55
- "@rslib/core": "0.19.1",
55
+ "@rslib/core": "0.19.2",
56
56
  "@types/connect": "3.4.38",
57
57
  "@types/cors": "^2.8.19",
58
- "@types/node": "^24.10.7",
58
+ "@types/node": "^24.10.9",
59
59
  "@types/on-finished": "2.3.5",
60
60
  "@types/range-parser": "^1.2.7",
61
61
  "@types/ws": "^8.18.1",
@@ -82,8 +82,8 @@
82
82
  "range-parser": "^1.2.1",
83
83
  "reduce-configs": "^1.1.1",
84
84
  "rslog": "^1.3.2",
85
- "rspack-chain": "^1.4.3",
86
- "rspack-manifest-plugin": "5.2.0",
85
+ "rspack-chain": "^2.0.0-alpha.0",
86
+ "rspack-manifest-plugin": "5.2.1",
87
87
  "sirv": "^3.0.2",
88
88
  "stacktrace-parser": "^0.1.11",
89
89
  "style-loader": "3.3.4",
@@ -1,2 +0,0 @@
1
- import type { RsbuildPlugin } from '../types';
2
- export declare const pluginMoment: () => RsbuildPlugin;