Skip to content

Commit a811c95

Browse files
committed
chore: update
1 parent 1b2ced8 commit a811c95

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

packages/plugin-dts/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ pluginDts({
201201

202202
Whether to automatically redirect the import paths of Typescript declaration output files.
203203

204-
- When set to `true`, the [compilerOptions.paths](https://typescriptlang.org/tsconfig#paths) configured in the `tsconfig.json` file will take effect, and the import path of the DTS output file will be redirected to the corresponding relative path.
204+
- When set to `true`, Rslib will redirect the import path in the DTS output file to the corresponding relative path based on the [compilerOptions.paths](https://typescriptlang.org/tsconfig#paths) configured in `tsconfig.json`.
205205

206206
```ts
207207
// `compilerOptions.paths` is set to `{ "@/*": ["src/*"] }`

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ overviewHeaders: [2, 3]
66

77
:::info
88

9-
`redirect` is the unique configuration for [bundleless mode](/guide/basic/output-structure#bundle--bundleless). It will not take effect in bundle mode where all output files are packaged into a single file, eliminating the need for import path redirection.
9+
`redirect` is the unique configuration for [bundleless mode](/guide/basic/output-structure#bundle--bundleless). It will not take effect in bundle mode where all output files are bundled into a single file, eliminating the need for import path redirection.
1010

1111
:::
1212

@@ -58,7 +58,7 @@ const defaultRedirect = {
5858

5959
Configure the redirect for import paths in output files.
6060

61-
In bundleless mode, there are often needs such as using aliases or automatically appending suffixes for ESM products. The `redirect` configuration is designed to address these issues.
61+
In bundleless mode, there are often needs such as using aliases or automatically appending suffixes for ESM outputs. The `redirect` configuration is designed to address these issues.
6262

6363
## redirect.js
6464

@@ -190,10 +190,12 @@ Controls the redirect of the import paths of output asset files.
190190
- **Type:** `boolean`
191191
- **Default:** `true`
192192

193-
When set to `true`, the paths of imported resource files will be rewritten to the corresponding JavaScript product file.
193+
When set to `true`, the paths of imported asset files will be redirected to the corresponding JavaScript output file.
194194

195195
When set to `false`, the file extension will remain unchanged from the original import path.
196196

197+
- **Example:**
198+
197199
```ts
198200
import url from './assets/logo.svg'; // source code ↓
199201
import url from './assets/logo.mjs'; // expected output
@@ -210,7 +212,7 @@ Whether to automatically redirect the import paths of Typescript declaration out
210212
- **Type:** `boolean`
211213
- **Default:** `true`
212214

213-
When set to `true`, the [compilerOptions.paths](https://typescriptlang.org/tsconfig#paths) configured in the `tsconfig.json` file will take effect, and the import path of the DTS output file will be redirected to the corresponding relative path.
215+
When set to `true`, Rslib will redirect the import path in the DTS output file to the corresponding relative path based on the [compilerOptions.paths](https://typescriptlang.org/tsconfig#paths) configured in `tsconfig.json`.
214216

215217
When set to `false`, the original import path will remain unchanged.
216218

@@ -243,7 +245,7 @@ The extension of the TypeScript declaration file is related to the [dts.autoExte
243245

244246
- **Example:**
245247

246-
For the `.d.mts` file, in some scenarios, the full extension of the module import path is needed to load correctly.
248+
For the `.d.mts` declaration file, in some scenarios, the full extension of the module import path is needed to load correctly.
247249

248250
```ts
249251
import { foo } from './foo'; // source code of './src/bar.ts' ↓

website/docs/zh/config/lib/redirect.mdx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ import styles from '../foo.css'; // './dist/utils/index.js' 预期生成的代
166166

167167
当设置为 `true` 时:
168168

169-
- 导入普通样式文件的文件扩展名将被重写为 `.css`
169+
- 导入普通样式文件的文件扩展名将被重写为 `.css`
170170
- 导入 [CSS Modules](/config/rsbuild/output#outputcssmodules) 时,路径将被重写为到对应的 JavaScript 产物文件。
171171

172172
当设置为 `false` 时,文件扩展名将保持原始导入路径。
@@ -194,6 +194,8 @@ import styles from './index.module.mjs'; // 预期生成的代码
194194

195195
当设置为 `false` 时,文件扩展名将保持原始导入路径。
196196

197+
- **示例:**
198+
197199
```ts
198200
import url from './assets/logo.svg'; // 源码 ↓
199201
import url from './assets/logo.mjs'; // 预期生成的代码
@@ -210,7 +212,7 @@ import url from './assets/logo.mjs'; // 预期生成的代码
210212
- **类型:** `boolean`
211213
- **默认值:** `true`
212214

213-
当设置为 `true` 时,`tsconfig.json` 文件中配置的 [compilerOptions.paths](https://typescriptlang.org/tsconfig#paths) 将生效,DTS 产物文件的导入路径会被重定向到对应的相对路径
215+
当设置为 `true` 时,Rslib 会根据 `tsconfig.json` 文件中配置的 [compilerOptions.paths](https://typescriptlang.org/tsconfig#paths),将 DTS 产物文件中的导入路径重定向为对应的相对路径
214216

215217
当设置为 `false` 时,将保持原始导入路径不变。
216218

@@ -233,7 +235,7 @@ import { foo } from '../foo'; // './dist/utils/index.d.ts' 预期生成的代码
233235
- **类型:** `boolean`
234236
- **默认值:** `false`
235237

236-
当设置为 `true` 时,DTS 文件中的引入路径会被重定向到对应的可以解析到对应 DTS 文件的 JavaScript 文件扩展名。
238+
当设置为 `true` 时,DTS 文件中的引入路径会被重定向到对应的可以解析到相应 DTS 文件的 JavaScript 文件扩展名。
237239

238240
当设置为 `false` 时,文件扩展名将保持原始导入路径不变(无论是否指定或指定为任意值)。
239241

@@ -243,7 +245,7 @@ TypeScript 类型文件的扩展名与 [dts.autoExtension](/config/lib/dts#dtsau
243245

244246
- **示例:**
245247

246-
对于 `.d.mts` 文件,在一些场景下需要指定模块导入路径的完整扩展名才能正确加载。
248+
对于 `.d.mts` 类型文件,在一些场景下需要指定模块导入路径的完整扩展名才能正确加载。
247249

248250
```ts
249251
import { foo } from './foo'; // './src/bar.ts' 的源码 ↓

0 commit comments

Comments
 (0)