Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .agents/skills/rstack-cli-best-practices/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Prefer Rstack-exported paths:

| Instead of | Prefer |
| ------------------------- | ------------------------ |
| `@rsbuild/core` | `rstack/app` |
| `@rslib/core` | `rstack/lib` |
| `@rstest/core` | `rstack/test` |
| `@rslint/core` | `rstack/lint` |
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@ pnpm doc

Rstack re-exports the APIs of its underlying tools through dedicated entry points:

| Tool | Import path |
| ------ | ------------- |
| Rslib | `rstack/lib` |
| Rslint | `rstack/lint` |
| Rstest | `rstack/test` |
| Tool | Import path |
| ------- | ------------- |
| Rsbuild | `rstack/app` |
| Rslib | `rstack/lib` |
| Rslint | `rstack/lint` |
| Rstest | `rstack/test` |

For example, import Rstest APIs without adding `@rstest/core` as a direct dependency:

Expand Down
4 changes: 4 additions & 0 deletions packages/rstack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./app": {
"types": "./dist/app.d.ts",
"default": "./dist/app.js"
},
"./test": {
"types": "./dist/test.d.ts",
"default": "./dist/test.js"
Expand Down
1 change: 1 addition & 0 deletions packages/rstack/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default defineConfig({
rslintConfig: './src/rslintConfig.ts',
rspressConfig: './src/rspressConfig.ts',
rstestConfig: './src/rstestConfig.ts',
app: './src/app.ts',
lib: './src/lib.ts',
lint: './src/lint.ts',
test: './src/test.ts',
Expand Down
9 changes: 9 additions & 0 deletions packages/rstack/src/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Re-export @rsbuild/core APIs so users can import application APIs from `rstack/app`.
*
* @example
* ```ts
* import { createRsbuild } from 'rstack/app';
* ```
*/
export * from '@rsbuild/core';
8 changes: 8 additions & 0 deletions packages/rstack/test/exports/app-subpath/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as rsbuild from '@rsbuild/core';
import { expect, test } from 'rstack/test';

test('should expose all Rsbuild APIs from `rstack/app`', async () => {
const app = await import('rstack/app');

expect(app).toEqual(rsbuild);
});
1 change: 1 addition & 0 deletions packages/rstack/test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"types": ["node"],
"paths": {
"rstack": ["../src/index.ts"],
"rstack/app": ["../src/app.ts"],
"rstack/lib": ["../src/lib.ts"],
"rstack/lint": ["../src/lint.ts"],
"rstack/test": ["../src/test.ts"],
Expand Down