Skip to content

Commit f56ed8b

Browse files
committed
chore: update
1 parent dcdbcc6 commit f56ed8b

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

packages/plugin-dts/README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# rsbuild-plugin-dts
66

7-
An Rsbuild plugin to emit declaration files for TypeScript which is built-in in Rslib.
7+
An [Rsbuild plugin](https://www.npmjs.com/package/rsbuild-plugin-dts) to emit declaration files for TypeScript which is built-in in Rslib.
88

99
## Using in Rslib
1010

@@ -18,7 +18,7 @@ Install:
1818
npm add rsbuild-plugin-dts -D
1919
```
2020

21-
Add plugin to your `rsbuild.config.ts`:
21+
Add plugin to `rsbuild.config.ts`:
2222

2323
```ts
2424
// rsbuild.config.ts
@@ -38,15 +38,15 @@ export default {
3838

3939
Whether to bundle the DTS files.
4040

41-
If you want to generate [bundle DTS](https://lib.rsbuild.dev/guide/advanced/dts#bundle-dts) files, you should:
41+
If you want to [bundle DTS](https://lib.rsbuild.dev/guide/advanced/dts#bundle-dts) files, you should:
4242

43-
- Install `@microsoft/api-extractor` as a development dependency.
43+
1. Install `@microsoft/api-extractor` as a development dependency, which is the underlying tool used for bundling DTS files.
4444

4545
```bash
4646
npm add @microsoft/api-extractor -D
4747
```
4848

49-
- Set `bundle` to `true`.
49+
2. Set `bundle` to `true`.
5050

5151
```js
5252
pluginDts({
@@ -75,7 +75,7 @@ pluginDts({
7575
- **Type:** `boolean`
7676
- **Default:** `false`
7777

78-
Determines whether to generate DTS files while building the project's references. This is equivalent to using the `--build` flag with the `tsc` command.
78+
Determines whether to generate DTS files while building the project references. This is equivalent to using the `--build` flag with the `tsc` command. See [Project References](https://www.typescriptlang.org/docs/handbook/project-references.html) for more details.
7979

8080
When this option is enabled, you must explicitly set `declarationDir` or `outDir` in `tsconfig.json` in order to meet the build requirements.
8181

@@ -86,7 +86,9 @@ When this option is enabled, you must explicitly set `declarationDir` or `outDir
8686

8787
Whether to abort the build process when an error occurs during DTS generation.
8888

89-
By default, type errors will cause the build to fail. When `abortOnError` is set to `false`, the build will still succeed even if there are type issues in the code.
89+
By default, type errors will cause the build to fail.
90+
91+
When `abortOnError` is set to `false`, the build will still succeed even if there are type issues in the code.
9092

9193
```js
9294
pluginDts({
@@ -153,14 +155,14 @@ pluginDts({
153155
- **Type:** `string`
154156
- **Default:** `undefined`
155157

158+
Inject content into the bottom of each DTS file.
159+
156160
```js
157161
pluginDts({
158162
footer: '/** @footer */',
159163
});
160164
```
161165

162-
Inject content into the bottom of each DTS file.
163-
164166
## Contributing
165167

166168
Please read the [Contributing Guide](https://github.com/web-infra-dev/rslib/blob/main/CONTRIBUTING.md).

website/docs/en/config/lib/dts.mdx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ Whether to bundle the DTS files.
6363

6464
#### Example
6565

66-
If you want to generate [bundle DTS](/guide/advanced/dts#bundle-dts) files, you should:
66+
If you want to [bundle DTS](/guide/advanced/dts#bundle-dts) files, you should:
6767

68-
- Install `@microsoft/api-extractor` as a development dependency.
68+
1. Install `@microsoft/api-extractor` as a development dependency, which is the underlying tool used for bundling DTS files.
6969

7070
import { PackageManagerTabs } from '@theme';
7171

7272
<PackageManagerTabs command="add @microsoft/api-extractor -D" />
7373

74-
- Set `dts.bundle` to `true`.
74+
2. Set `dts.bundle` to `true`.
7575

7676
```ts title="rslib.config.ts" {5-7}
7777
export default {
@@ -92,6 +92,10 @@ export default {
9292

9393
:::
9494

95+
#### Handle Third-Party Packages
96+
97+
When we bundle DTS files, we should specify which third-party package types need to be bundled, refer to the [Handle Third-Party Dependencies](/guide/advanced/third-party-deps) documentation for more details about externals related configurations.
98+
9599
### dts.distPath
96100

97101
- **Type:** `string`
@@ -126,7 +130,7 @@ export default {
126130
- **Type:** `boolean`
127131
- **Default:** `false`
128132

129-
Determines whether to generate DTS files while building the project's references. This is equivalent to using the `--build` flag with the `tsc` command.
133+
Determines whether to generate DTS files while building the project references. This is equivalent to using the `--build` flag with the `tsc` command. See [Project References](https://www.typescriptlang.org/docs/handbook/project-references.html) for more details.
130134

131135
::: note
132136

@@ -141,7 +145,9 @@ When this option is enabled, you must explicitly set `declarationDir` or `outDir
141145

142146
Whether to abort the build process when an error occurs during DTS generation.
143147

144-
By default, type errors will cause the build to fail. When `abortOnError` is set to `false`, the build will still succeed even if there are type issues in the code.
148+
By default, type errors will cause the build to fail.
149+
150+
When `abortOnError` is set to `false` like below, the build will still succeed even if there are type issues in the code.
145151

146152
```ts title="rslib.config.ts" {5-7}
147153
export default {

website/docs/en/guide/advanced/dts.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,16 @@ If you want to generate bundleless DTS, you can:
5050

5151
If you want to generate bundle DTS, you can:
5252

53-
- Install `@microsoft/api-extractor` as a development dependency.
53+
1. Install `@microsoft/api-extractor` as a development dependency, which is the underlying tool used for bundling DTS files.
5454

5555
import { PackageManagerTabs } from '@theme';
5656

5757
<PackageManagerTabs command="add @microsoft/api-extractor -D" />
5858

59-
- Set `dts: { bundle: true }` in the Rslib configuration file.
59+
2. Set `dts: { bundle: true }` in the Rslib configuration file.
60+
61+
::: tip
6062

6163
You can refer to [lib.dts](/config/lib/dts) for more details about DTS configuration.
6264

63-
- Specify which third-party package types need to be bundled, refer to the [Handle Third-Party Dependencies](/guide/advanced/third-party-deps) documentation for more details about externals related configurations.
65+
:::

0 commit comments

Comments
 (0)