Skip to content

Commit e46c0b2

Browse files
committed
docs: update readme
1 parent 1045dc6 commit e46c0b2

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,18 +235,26 @@ export default defineMock({
235235

236236
Configure the matching context for `include` and `exclude`.
237237

238+
### options.dir
239+
240+
- **Type:** `string`
241+
- **Default:** `mock` (relative to [`options.cwd`](#optionscwd))
242+
- **Details:**
243+
244+
Configure the directory where mock files are located
245+
238246
### options.include
239247

240248
- **Type:** `string | string[]`
241-
- **Default:** `['mock/**/*.mock.{js,ts,cjs,mjs,json,json5}']`
249+
- **Default:** `['**/*.mock.{js,ts,cjs,mjs,json,json5}']` (relative to [`options.dir`](#optionsdir))
242250
- **Details:**
243251

244252
glob string matching mock includes files. see [picomatch](https://github.com/micromatch/picomatch#globbing-features)
245253

246254
### options.exclude
247255

248256
- **Type:** `string | string[]`
249-
- **Default:** `['**/node_modules/**', '**/.vscode/**', '**/.git/**']`
257+
- **Default:** `[]` (relative to [`options.dir`](#optionsdir))
250258
- **Details:**
251259

252260
glob string matching mock excluded files. see [picomatch](https://github.com/micromatch/picomatch#globbing-features)

README.zh-CN.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[Rspack](https://rspack.dev) and [Rsbuild](https://rsbuild.dev) 中注入 API mock 服务。
44

5-
`rspack``rsbuild` 中实现一个与 [vite-plugin-mock-dev-server](https://github.com/pengzhanbo/vite-plugin-mock-dev-server) 完全一致的模拟开发服务器
5+
`rspack``rsbuild` 中实现与 [vite-plugin-mock-dev-server](https://github.com/pengzhanbo/vite-plugin-mock-dev-server) 完全一致的模拟开发服务
66

77
<p align="center">
88
<a href="https://www.npmjs.com/package/rspack-plugin-mock"><img alt="npm" src="https://img.shields.io/npm/v/rspack-plugin-mock?style=flat-square&colorA=564341&colorB=EDED91"></a>
@@ -31,8 +31,8 @@
3131
- ⚙️ 随意开启或关闭对某个接口的 mock配置
3232
- 📀 支持多种响应体数据类型,包括 `text/json/buffer/stream`.
3333
- ⚖️ rspack 中使用 `devServer.proxy` 配置, rsbuild 中使用 `server.proxy` 配置
34-
- 🍕 支持在 mock文件中使用 `define`配置
35-
- ⚓️ 支持在 mock文件中使用 `resolve.alias` 路径别名
34+
- 🍕 支持在 mock 文件中使用 `define`配置
35+
- ⚓️ 支持在 mock 文件中使用 `resolve.alias` 路径别名
3636
- 📤 支持 multipart 类型,模拟文件上传
3737
- 📥 支持模拟文件下载
3838
- ⚜️ 支持模拟 `WebSocket``Server-Sent Events`
@@ -232,18 +232,26 @@ export default defineMock({
232232

233233
配置 `include``exclude` 的匹配上下文。
234234

235+
### options.dir
236+
237+
- **类型:** `string`
238+
- **默认值:** `mock` (相对于 [`options.cwd`](#optionscwd))
239+
- **详情:**
240+
241+
配置 mock 包的输出目录,相对于 [`options.cwd`](#optionscwd)
242+
235243
### options.include
236244

237245
- **类型:** `string | string[]`
238-
- **默认值:** `['mock/**/*.mock.{js,ts,cjs,mjs,json,json5}']`
246+
- **默认值:** `[**/*.mock.{js,ts,cjs,mjs,json,json5}']` (相对于 [`options.dir`](#optionsdir))
239247
- **详情:**
240248

241249
glob 字符串匹配 mock 包含的文件。 查看 [picomatch](https://github.com/micromatch/picomatch#globbing-features)
242250

243251
### options.exclude
244252

245253
- **类型:** `string | string[]`
246-
- **默认值:** `['**/node_modules/**', '**/.vscode/**', '**/.git/**']`
254+
- **默认值:** `[]` (相对于 [`options.dir`](#optionsdir))
247255
- **详情:**
248256

249257
glob 字符串匹配 mock 排除的文件。 查看 [picomatch](https://github.com/micromatch/picomatch#globbing-features)

0 commit comments

Comments
 (0)