You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/en/guide/api-reference.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# API reference
2
2
3
-
Rstack exposes a unified configuration API and dedicated entry points for the public APIs of Rsbuild, Rslib, Rstest, and Rslint. Prefer these entry points over direct imports from each tool's core package so that import paths and tool versions stay aligned with Rstack.
3
+
Rstack provides a unified configuration API and re-exports the public APIs of Rsbuild, Rslib, Rstest, and Rslint through dedicated subpaths. Prefer these subpaths to direct imports from each tool's core package so that dependency entry points and tool versions remain aligned with Rstack.
4
4
5
5
## Import paths
6
6
@@ -19,11 +19,11 @@ Rstack exposes a unified configuration API and dedicated entry points for the pu
19
19
20
20
### `define`
21
21
22
-
Import`define`from`rstack`toregistertoolconfigurationsin`rstack.config.ts`. Fordetails, see [ConfigurationAPIs](./configuration#configuration-apis).
22
+
Import`define`from`rstack`toregistertoolconfigurationsin`rstack.config.ts`; see [ConfigurationAPIs](./configuration#configuration-apis)fordetails.
23
23
24
24
## Re-exports
25
25
26
-
Each tool-specific subpath re-exports the public APIs of its corresponding core package.
26
+
The tool-specific subpaths below re-export the public APIs from their corresponding core packages. Using these Rstack entry points keeps dependency entry points and tool versions aligned with the toolchain integrated by Rstack.
27
27
28
28
### `rstack/app`
29
29
@@ -53,7 +53,7 @@ For details, see the [Rslib core APIs](https://rslib.rs/api/javascript-api/core)
53
53
import { describe, expect, test } from'rstack/test';
54
54
```
55
55
56
-
For test APIs, see the [Rstest runtime API](https://rstest.rs/api/runtime-api/). For configuration helpers, see the [Rstest core APIs](https://rstest.rs/api/javascript-api/rstest-core).
56
+
See the [Rstest runtime API](https://rstest.rs/api/runtime-api/) for test APIs and the [Rstest core APIs](https://rstest.rs/api/javascript-api/rstest-core) for configuration helpers.
57
57
58
58
> For more guidance on testing, see [Testing](./testing).
59
59
@@ -69,7 +69,7 @@ For details about the available presets and plugins, see [Rslint rules and prese
69
69
70
70
## TypeScript types
71
71
72
-
The following type-only entry points add ambient declarations to a TypeScript project. Add only the entries your project needs to [`compilerOptions.types`](https://www.typescriptlang.org/tsconfig/#types) in `tsconfig.json`.
72
+
These type-only entry points add ambient declarations to a TypeScript project. Add only the entries your project needs to [`compilerOptions.types`](https://www.typescriptlang.org/tsconfig/#types) in `tsconfig.json`.
Copy file name to clipboardExpand all lines: website/docs/en/guide/cli/preview.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
# preview
2
2
3
-
The `rs preview` command uses [Rsbuild](https://rsbuild.rs/guide/basic/cli#rsbuild-preview) to preview an application's production output locally.
3
+
The `rs preview` command uses [Rsbuild](https://rsbuild.rs/guide/basic/cli#rsbuild-preview) to preview an application's production build locally.
4
4
5
5
## Usage
6
6
7
7
```bash
8
8
rs preview [options]
9
9
```
10
10
11
-
The command loads the application configuration registered with [`define.app()`](../configuration#define-app). Before starting the preview server, run [`rs build`](./build) to generate the production output:
11
+
The command loads the application configuration registered with [`define.app()`](../configuration#define-app). Run [`rs build`](./build) before starting the preview server to generate the production output:
12
12
13
13
```bash
14
14
rs build
@@ -27,7 +27,7 @@ Examples:
27
27
# Start the preview server and open the page in the browser
28
28
rs preview --open
29
29
30
-
# Use port 8080 and exit if it is already in use
30
+
# Use port 8080 and fail if it is already in use
31
31
rs preview --port 8080 --strict-port
32
32
33
33
# Make the preview server available on the local network
Copy file name to clipboardExpand all lines: website/docs/en/guide/configuration.mdx
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Configuration
2
2
3
-
Rstack centralizes your project's tool configurations in one file. Register only the configurations your project needs with the `define.*()` APIs.
3
+
Rstack centralizes the configuration for your project's tools in a single file. Define only the configurations your project needs with the `define.*()` APIs.
4
4
5
5
## Configuration file
6
6
@@ -24,7 +24,7 @@ define.lint({
24
24
25
25
The configuration file does not require a default export. Each `define.*()` API can be called at most once; defining the same configuration type more than once throws an error.
26
26
27
-
By default, Rstack looks for any of the following files in the project root:
27
+
By default, Rstack looks for a file with one of the following names:
Before running a tool, Rstack loads and executes the configuration file. It then resolves only the configuration functions required by that command.
42
+
Every `rs` command loads and executes the Rstack configuration file, then resolves only the configuration functions needed by that command.
43
43
44
-
When a configuration uses a tool-specific plugin or dependency, define it as an async function and load that dependency with dynamic `import()` inside the function. This defers loading until the configuration is needed.
44
+
When a configuration needs to import plugins or other tool-specific dependencies, use an async configuration function and load those dependencies with dynamic `import()` inside it. This ensures that they are loaded only when the configuration is resolved.
45
45
46
46
```ts title="rstack.config.ts"
47
47
import { define } from'rstack';
@@ -57,7 +57,7 @@ define.app(async () => {
57
57
58
58
## Configuration APIs
59
59
60
-
Each API accepts the configuration format of its underlying tool. When using APIs and helpers re-exported by Rstack, import them from the `rstack/app`, `rstack/lib`, `rstack/test`, and `rstack/lint` entry points.
60
+
Configuration options follow the formats of the underlying tools. When using APIs and helpers that Rstack re-exports, prefer the `rstack/app`, `rstack/lib`, `rstack/test`, and `rstack/lint` entry points.
@@ -70,7 +70,7 @@ Each API accepts the configuration format of its underlying tool. When using API
70
70
71
71
### `define.app()`\{#define-app}
72
72
73
-
Defines the [Rsbuild configuration](https://rsbuild.rs/config/) for an application. It accepts a configuration object or a configuration function. The function receives the same configuration parameters as Rsbuild.
73
+
Defines the [Rsbuild configuration](https://rsbuild.rs/config/) for an application. It accepts a configuration object or a configuration function. The function receives the standard Rsbuild configuration parameters.
74
74
75
75
```ts title="rstack.config.ts"
76
76
import { define } from'rstack';
@@ -89,7 +89,7 @@ define.app({
89
89
90
90
### `define.lib()`\{#define-lib}
91
91
92
-
Defines the [Rslib configuration](https://rslib.rs/config/) for a library. It accepts a configuration object or a configuration function. The function receives the same configuration parameters as Rslib.
92
+
Defines the [Rslib configuration](https://rslib.rs/config/) for a library. It accepts a configuration object or a configuration function. The function receives the standard Rslib configuration parameters.
93
93
94
94
```ts title="rstack.config.ts"
95
95
import { define } from'rstack';
@@ -106,7 +106,7 @@ define.lib({
106
106
107
107
### `define.doc()`\{#define-doc}
108
108
109
-
Defines the [Rspress configuration](https://rspress.rs/api/config/config-basic) for a documentation site. It accepts either a configuration object or an async configuration function.
109
+
Defines the [Rspress configuration](https://rspress.rs/api/config/config-basic) for a documentation site. It accepts a configuration object or an async configuration function.
110
110
111
111
```ts title="rstack.config.ts"
112
112
import { define } from'rstack';
@@ -117,15 +117,15 @@ define.doc({
117
117
});
118
118
```
119
119
120
-
`@rspress/core` is an optional peer dependency of Rstack. Install it in each project that runs `rs doc`:
120
+
`@rspress/core` is an optional dependency of Rstack. Install it in every project that uses the `rs doc` command:
121
121
122
122
```bash
123
123
pnpm add -D @rspress/core
124
124
```
125
125
126
126
### `define.test()`\{#define-test}
127
127
128
-
Defines the [Rstest configuration](https://rstest.rs/config/). It accepts either a configuration object or a configuration function.
128
+
Defines the [Rstest configuration](https://rstest.rs/config/). It accepts a configuration object or a configuration function.
129
129
130
130
```ts title="rstack.config.ts"
131
131
import { define } from'rstack';
@@ -140,15 +140,15 @@ define.test({
140
140
});
141
141
```
142
142
143
-
When `extends` is omitted, Rstack uses the Rsbuild adapter to inherit the configuration from `define.app()`. If no application configuration is registered, it uses the Rslib adapter to inherit `define.lib()`instead. `define.app()`takes precedence when both are registered. Set `extends` explicitly to opt out of automatic inheritance.
143
+
When `extends` is omitted, Rstack automatically connects the test configuration to `define.app()` through the Rsbuild adapter. If no application configuration is defined, it falls back to `define.lib()`through the Rslib adapter. The application configuration takes precedence when both are defined. Set `extends` explicitly to opt out of this automatic inheritance.
144
144
145
-
If the root test configuration contains `projects` and does not define `extends`, each inline project without its own `extends` inherits the same application or library configuration. A function-based configuration is resolved once and shared by those projects. String entries are passed to Rstest unchanged, so their external configurations load independently and do not inherit the current application or library configuration.
145
+
If the root test configuration does not define `extends` and contains `projects`, Rstack applies automatic inheritance to each inline project that omits its own `extends`. A function-based application or library configurationis resolved once and shared by those projects. String project entries are passed to Rstest unchanged; they load their external configurations independently and do not inherit the current application or library configuration.
146
146
147
147
> For more guidance on testing, see [Testing](./testing).
148
148
149
149
### `define.lint()`\{#define-lint}
150
150
151
-
Defines the [Rslint configuration](https://rslint.rs/config/). Pass a configuration directly, or use an async function to load presets and plugins from `rstack/lint` on demand.
151
+
Defines the [Rslint configuration](https://rslint.rs/config/). Pass the configuration directly, or use an async function to load presets and plugins from `rstack/lint` on demand.
152
152
153
153
```ts title="rstack.config.ts"
154
154
import { define } from'rstack';
@@ -162,7 +162,7 @@ define.lint(async () => {
162
162
163
163
### `define.staged()`\{#define-staged}
164
164
165
-
Defines the [lint-staged configuration](https://github.com/lint-staged/lint-staged#configuration)for files staged in Git. It accepts either an object that maps glob patterns to tasks or a task-generator function. Tasks can be commands, command arrays, or functions supported by lint-staged.
165
+
Defines the [lint-staged configuration](https://github.com/lint-staged/lint-staged#configuration)used to run tasks on staged Git files. It accepts either an object that maps glob patterns to tasks or a task-generator function. Tasks can be commands, command arrays, or functions supported by lint-staged.
166
166
167
167
```ts title="rstack.config.ts"
168
168
import { define } from'rstack';
@@ -172,4 +172,4 @@ define.staged({
172
172
});
173
173
```
174
174
175
-
Unlike the other tool commands, `rs staged` requires a `define.staged()` configuration and exits with an error when it is missing.
175
+
Unlike the other commands, `rs staged` requires a `define.staged()` configuration and reports an error when it is missing.
0 commit comments