@rsbuild/core 2.1.5 → 2.1.6

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.
@@ -1,4 +1,6 @@
1
+ import { type LoadConfigOptions as BaseOptions, type LoadConfigResult as BaseResult } from '../compiled/@rstackjs/load-config';
1
2
  import type { RsbuildConfig } from './types';
3
+ export type { ConfigLoader } from '../compiled/@rstackjs/load-config';
2
4
  export type ConfigParams = {
3
5
  env: string;
4
6
  command: string;
@@ -8,19 +10,7 @@ export type ConfigParams = {
8
10
  export type RsbuildConfigAsyncFn = (env: ConfigParams) => Promise<RsbuildConfig>;
9
11
  export type RsbuildConfigSyncFn = (env: ConfigParams) => RsbuildConfig;
10
12
  export type RsbuildConfigDefinition = RsbuildConfig | RsbuildConfigSyncFn | RsbuildConfigAsyncFn;
11
- export type LoadConfigOptions = {
12
- /**
13
- * The root path to resolve the config file.
14
- * @default process.cwd()
15
- */ cwd?: string;
16
- /**
17
- * The path to the config file, can be a relative or absolute path.
18
- * If `path` is not provided, the function will search for the config file in the `cwd`.
19
- */ path?: string;
20
- /**
21
- * Config file names to search in `cwd` when `path` is not provided.
22
- * The list replaces the default `rsbuild.config.*` lookup order.
23
- */ configFileNames?: string[];
13
+ export type LoadConfigOptions = Pick<BaseOptions<[ConfigParams]>, 'cwd' | 'path' | 'loader' | 'exportName' | 'configFileNames'> & {
24
14
  /**
25
15
  * A custom meta object to be passed into the config function of `defineConfig`.
26
16
  */ meta?: Record<string, unknown>;
@@ -29,35 +19,11 @@ export type LoadConfigOptions = {
29
19
  * @default process.env.NODE_ENV
30
20
  */ envMode?: string;
31
21
  /**
32
- * Specify the config loader, can be `auto`, `jiti` or `native`.
33
- * - 'auto': Use native Node.js loader first, fallback to jiti if failed
34
- * - 'jiti': Use `jiti` as loader, which supports TypeScript and ESM out of the box
35
- * - 'native': Use native Node.js loader, requires TypeScript support in Node.js >= 22.6
36
- * @default 'auto'
37
- */ loader?: ConfigLoader;
38
- /**
39
22
  * The command passed to the config function.
40
23
  * @default process.argv[2]
41
24
  */ command?: string;
42
- /**
43
- * The export name to read from the config file.
44
- * Set to `false` to execute the config file without reading exports.
45
- * @default 'default'
46
- */ exportName?: string | false;
47
- };
48
- export type LoadConfigResult<Config = RsbuildConfig> = {
49
- /**
50
- * The loaded configuration object.
51
- */ content: Config;
52
- /**
53
- * The path to the loaded configuration file.
54
- * Return `null` if the configuration file is not found.
55
- */ filePath: string | null;
56
- /**
57
- * Absolute file paths of statically imported (relative) dependencies of the
58
- * config file.
59
- */ dependencies: string[];
60
25
  };
26
+ export type LoadConfigResult<Config = RsbuildConfig> = Pick<BaseResult<Config>, 'content' | 'filePath' | 'dependencies'>;
61
27
  /**
62
28
  * This function helps you to autocomplete configuration types.
63
29
  * It accepts a Rsbuild config object, or a function that returns a config.
@@ -65,5 +31,4 @@ export type LoadConfigResult<Config = RsbuildConfig> = {
65
31
  export declare function defineConfig(config: RsbuildConfigSyncFn): RsbuildConfigSyncFn;
66
32
  export declare function defineConfig(config: RsbuildConfigAsyncFn): RsbuildConfigAsyncFn;
67
33
  export declare function defineConfig(config: RsbuildConfigDefinition): RsbuildConfigDefinition;
68
- export type ConfigLoader = 'auto' | 'jiti' | 'native';
69
34
  export declare function loadConfig<Config = RsbuildConfig>({ cwd, path, configFileNames, envMode, meta, loader, command, exportName }?: LoadConfigOptions): Promise<LoadConfigResult<Config>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -40,15 +40,16 @@
40
40
  "registry": "https://registry.npmjs.org/"
41
41
  },
42
42
  "dependencies": {
43
- "@rspack/core": "~2.1.3",
43
+ "@rspack/core": "~2.1.4",
44
44
  "@swc/helpers": "^0.5.23"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@jridgewell/remapping": "^2.3.5",
48
48
  "@jridgewell/trace-mapping": "^0.3.31",
49
49
  "@rslib/core": "0.23.2",
50
+ "@rstackjs/load-config": "^0.1.2",
50
51
  "@types/cors": "^2.8.19",
51
- "@types/node": "^24.13.2",
52
+ "@types/node": "^24.13.3",
52
53
  "@types/on-finished": "2.3.5",
53
54
  "@types/range-parser": "^1.2.7",
54
55
  "@types/ws": "^8.18.1",
@@ -66,17 +67,17 @@
66
67
  "http-proxy-middleware": "4.2.0",
67
68
  "jiti": "^2.7.0",
68
69
  "launch-editor-middleware": "^2.14.1",
69
- "memfs": "^4.57.8",
70
+ "memfs": "^4.64.0",
70
71
  "mrmime": "^2.0.1",
71
72
  "on-finished": "2.4.1",
72
73
  "open": "^11.0.0",
73
- "postcss": "^8.5.16",
74
+ "postcss": "^8.5.17",
74
75
  "postcss-load-config": "6.0.1",
75
76
  "postcss-loader": "8.2.1",
76
77
  "prebundle": "1.6.5",
77
78
  "range-parser": "^1.3.0",
78
79
  "reduce-configs": "^2.0.1",
79
- "rslog": "^2.1.3",
80
+ "rslog": "^2.2.0",
80
81
  "rspack-chain": "^2.1.1",
81
82
  "rspack-manifest-plugin": "5.2.2",
82
83
  "rspack-merge": "1.0.1",
File without changes