File tree Expand file tree Collapse file tree
.agents/skills/rstack-cli-best-practices Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ Prefer Rstack-exported paths:
7575
7676| Instead of | Prefer |
7777| ------------------------- | ------------------------ |
78+ | ` @rslib/core ` | ` rstack/lib ` |
7879| ` @rstest/core ` | ` rstack/test ` |
7980| ` @rslint/core ` | ` rstack/lint ` |
8081| ` @rsbuild/core/types ` | ` rstack/types ` |
Original file line number Diff line number Diff line change @@ -86,6 +86,22 @@ pnpm lib
8686pnpm doc
8787```
8888
89+ ## API imports
90+
91+ Rstack re-exports the APIs of its underlying tools through dedicated entry points:
92+
93+ | Tool | Import path |
94+ | ------ | ------------- |
95+ | Rslib | ` rstack/lib ` |
96+ | Rslint | ` rstack/lint ` |
97+ | Rstest | ` rstack/test ` |
98+
99+ For example, import Rstest APIs without adding ` @rstest/core ` as a direct dependency:
100+
101+ ``` ts
102+ import { expect , test } from ' rstack/test' ;
103+ ```
104+
89105## Credits
90106
91107Rstack CLI is inspired by:
Original file line number Diff line number Diff line change 2323 "types" : " ./dist/test.d.ts" ,
2424 "default" : " ./dist/test.js"
2525 },
26+ "./lib" : {
27+ "types" : " ./dist/lib.d.ts" ,
28+ "default" : " ./dist/lib.js"
29+ },
2630 "./lint" : {
2731 "types" : " ./dist/lint.d.ts" ,
2832 "default" : " ./dist/lint.js"
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export default defineConfig({
1111 rslintConfig : './src/rslintConfig.ts' ,
1212 rspressConfig : './src/rspressConfig.ts' ,
1313 rstestConfig : './src/rstestConfig.ts' ,
14+ lib : './src/lib.ts' ,
1415 lint : './src/lint.ts' ,
1516 test : './src/test.ts' ,
1617 } ,
Original file line number Diff line number Diff line change 1+ /**
2+ * Re-export @rslib/core APIs so users can import library APIs from `rstack/lib`.
3+ *
4+ * @example
5+ * ```ts
6+ * import { defineConfig } from 'rstack/lib';
7+ * ```
8+ */
9+ export * from '@rslib/core' ;
Original file line number Diff line number Diff line change 1+ import * as rslib from '@rslib/core' ;
2+ import { expect , test } from 'rstack/test' ;
3+
4+ test ( 'should expose all Rslib APIs from `rstack/lib`' , async ( ) => {
5+ const lib = await import ( 'rstack/lib' ) ;
6+
7+ expect ( lib ) . toEqual ( rslib ) ;
8+ } ) ;
Original file line number Diff line number Diff line change 77 "types" : [" node" ],
88 "paths" : {
99 "rstack" : [" ../src/index.ts" ],
10+ "rstack/lib" : [" ../src/lib.ts" ],
1011 "rstack/lint" : [" ../src/lint.ts" ],
1112 "rstack/test" : [" ../src/test.ts" ],
1213 "#test-helpers" : [" ./helpers/index.ts" ]
You can’t perform that action at this time.
0 commit comments