File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 "types" : " ./dist/index.d.ts" ,
1919 "default" : " ./dist/index.js"
2020 },
21+ "./config" : {
22+ "types" : " ./dist/configExports.d.ts" ,
23+ "default" : " ./dist/configExports.js"
24+ },
2125 "./app" : {
2226 "types" : " ./dist/app.d.ts" ,
2327 "default" : " ./dist/app.js"
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export default defineConfig({
88 source : {
99 entry : {
1010 index : './src/index.ts' ,
11+ configExports : './src/configExports.ts' ,
1112 rsbuildConfig : './src/rsbuildConfig.ts' ,
1213 rslibConfig : './src/rslibConfig.ts' ,
1314 rslintConfig : './src/rslintConfig.ts' ,
Original file line number Diff line number Diff line change @@ -21,13 +21,13 @@ export type Configs = {
2121 staged ?: StagedConfig ;
2222} ;
2323
24- type LoadedRstackConfig = {
24+ export type LoadedRstackConfig = {
2525 configs : Configs ;
2626 filePath : string | null ;
2727 dependencies : string [ ] ;
2828} ;
2929
30- type LoadRstackConfigOptions = {
30+ export type LoadRstackConfigOptions = {
3131 /**
3232 * The path to the Rstack config file, can be a relative or absolute path.
3333 * If `configFilePath` is not provided, the config path set by the CLI is used.
Original file line number Diff line number Diff line change 1+ /** Public configuration APIs exposed through `rstack/config`. */
2+ export {
3+ loadRstackConfig ,
4+ type Configs ,
5+ type LoadedRstackConfig ,
6+ type LoadRstackConfigOptions ,
7+ } from './config.ts' ;
Original file line number Diff line number Diff line change 1+ import { expect , test } from 'rstack/test' ;
2+
3+ test ( 'should expose only the config loader API from `rstack/config`' , async ( ) => {
4+ const config = await import ( 'rstack/config' ) ;
5+
6+ expect ( Object . keys ( config ) ) . toEqual ( [ 'loadRstackConfig' ] ) ;
7+ } ) ;
Original file line number Diff line number Diff line change @@ -4,12 +4,24 @@ import 'rstack/test/importMeta';
44import 'rstack/types' ;
55import { define } from 'rstack' ;
66import { createRsbuild , defineConfig as defineAppConfig } from 'rstack/app' ;
7+ import {
8+ loadRstackConfig ,
9+ type Configs ,
10+ type LoadedRstackConfig ,
11+ type LoadRstackConfigOptions ,
12+ } from 'rstack/config' ;
713import { defineConfig as defineLibConfig } from 'rstack/lib' ;
814import { js , ts } from 'rstack/lint' ;
915import { expect as importedExpect , test as importedTest } from 'rstack/test' ;
1016
1117const appConfig = defineAppConfig ( { } ) ;
1218const libConfig = defineLibConfig ( { } ) ;
19+ const loadOptions : LoadRstackConfigOptions = { configFilePath : 'rstack.config.ts' } ;
20+ const loadedConfig : Promise < LoadedRstackConfig > = loadRstackConfig ( loadOptions ) ;
21+ const configs : Configs = { } ;
22+
23+ void loadedConfig ;
24+ void configs ;
1325
1426createRsbuild ( { config : appConfig } ) ;
1527define . app ( appConfig ) ;
Original file line number Diff line number Diff line change @@ -4,12 +4,24 @@ import 'rstack/test/importMeta';
44import 'rstack/types' ;
55import { define } from 'rstack' ;
66import { createRsbuild , defineConfig as defineAppConfig } from 'rstack/app' ;
7+ import {
8+ loadRstackConfig ,
9+ type Configs ,
10+ type LoadedRstackConfig ,
11+ type LoadRstackConfigOptions ,
12+ } from 'rstack/config' ;
713import { defineConfig as defineLibConfig } from 'rstack/lib' ;
814import { js , ts } from 'rstack/lint' ;
915import { expect as importedExpect , test as importedTest } from 'rstack/test' ;
1016
1117const appConfig = defineAppConfig ( { } ) ;
1218const libConfig = defineLibConfig ( { } ) ;
19+ const loadOptions : LoadRstackConfigOptions = { configFilePath : 'rstack.config.ts' } ;
20+ const loadedConfig : Promise < LoadedRstackConfig > = loadRstackConfig ( loadOptions ) ;
21+ const configs : Configs = { } ;
22+
23+ void loadedConfig ;
24+ void configs ;
1325
1426createRsbuild ( { config : appConfig } ) ;
1527define . app ( appConfig ) ;
You can’t perform that action at this time.
0 commit comments