Skip to content

Commit ff4daff

Browse files
authored
docs: improve docs (#102)
1 parent 3a088fc commit ff4daff

File tree

11 files changed

+46
-15
lines changed

11 files changed

+46
-15
lines changed

docs/en/examples/websocket.md

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

55
<<< @/../example/mock/ws.mock.ts
66

7-
## Simulated Real-time Push
7+
## Real-time Push
88

99
::: code-group
1010

@@ -32,7 +32,7 @@ export default defineMock({
3232

3333
:::
3434

35-
## Simulated Chat Room
35+
## Chat Room
3636

3737
::: code-group
3838

docs/en/guide/define-mock.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ Mock configuration type helper function
44

55
## Usage
66

7-
```ts
7+
::: code-group
8+
9+
```ts [*.mock.ts]
810
import { defineMock } from 'vite-plugin-mock-dev-server'
911

1012
export default defineMock({
@@ -13,6 +15,8 @@ export default defineMock({
1315
})
1416
```
1517

18+
:::
19+
1620
Pass in an array:
1721

1822
```ts

docs/en/guide/introduce.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ It uses the built-in `http` and `http-proxy` services of Vite to intercept the p
66

77
You can use any third-party module in the mock configuration file with `node`. This means that you can use libraries like `mockjs` / `faker-js` to help generate mock data.
88

9-
The plugin supports responding with multiple data types including `text` / `json` / `Buffer` / `ReadStream`, and also supports setting headers and cookies.
9+
The plugin supports responding to various data types including `text/json/Buffer/ReadStream`, and also supports setting headers, cookies, etc.
1010

11-
The plugin also supports simulating `WebSocket`, making it easy to debug `WebSocket` services in local development environment.
11+
The plugin supports simulating `WebSocket`, making it easy to debug `WebSocket` services in a local development environment.
12+
13+
The plugin also supports simulating `Server-Sent Events`, making it easy to debug `EventSource` in a local development environment.
1214

1315
## Features
1416

@@ -29,5 +31,5 @@ The plugin also supports simulating `WebSocket`, making it easy to debug `WebSoc
2931
- 🌈 Support `vite preview` mode.
3032
- 📤 Support `multipart` content-type, mock upload file.
3133
- 📥 Support mock download file.
32-
- ⚜️ Support `WebSocket Mock`
34+
- ⚜️ Support `WebSocket Mock``Server-Sent Events`
3335
- 🗂 Support building small independent deployable mock services.

docs/en/guide/mock-config.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
`type: MockOptionsItem | MockOptionsItem[]`
44

5-
```ts
5+
::: code-group
6+
7+
```ts [*.mock.ts]
68
import { defineMock } from 'vite-plugin-mock-dev-server'
79

810
export default defineMock({
@@ -11,6 +13,8 @@ export default defineMock({
1113
})
1214
```
1315

16+
:::
17+
1418
**Type Definition:**
1519

1620
```ts
@@ -124,6 +128,7 @@ The actual `content-type` is determined internally by the plugin using `mime-typ
124128
- **Default**
125129

126130
The default value is determined based on the value of [type](#type):
131+
127132
| Type | Default |
128133
| -------- | -------------------------------------------------------- |
129134
| `text` | `{ 'Content-Type': 'text/plain' }` |

docs/en/guide/mock-plugin.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ Vite Plugin Function
44

55
## Usage
66

7-
``` ts
7+
::: code-group
8+
9+
``` ts [vite.config.ts]
810
import { defineConfig } from 'vite'
911
import mockDevServerPlugin from 'vite-plugin-mock-dev-server'
1012

@@ -15,6 +17,8 @@ export default defineConfig({
1517
})
1618
```
1719

20+
:::
21+
1822
## `options`
1923

2024
`type: MockServerPluginOptions`

docs/guide/define-mock.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ mock配置 类型帮助函数
44

55
## 使用
66

7-
```ts
7+
::: code-group
8+
9+
```ts [*.mock.ts]
810
import { defineMock } from 'vite-plugin-mock-dev-server'
911

1012
export default defineMock({
@@ -13,6 +15,8 @@ export default defineMock({
1315
})
1416
```
1517

18+
:::
19+
1620
传入数组:
1721

1822
```ts

docs/guide/introduce.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
你可以在 mock配置文件中使用`node` 任意第三方模块。 这表示,你可以使用如 `mockjs` / `faker-js` 等库帮助生成 `mock data`
88

9-
插件支持响应多种数据类型包括 `text/json/Buffer/ReadStream`等,还支持设置 headers、cookies。
9+
插件支持响应多种数据类型包括 `text/json/Buffer/ReadStream`等,还支持设置 headers、cookies
1010

11-
插件还支持模拟 `WebSocket`,可以轻松的实现在本地开发环境调试 `WebSocket` 服务。
11+
插件支持模拟 `WebSocket`,可以轻松的实现在本地开发环境调试 `WebSocket` 服务。
12+
13+
插件还支持 模拟 `Server-Sent Events`,可以轻松的实现在本地开发环境调试 `EventSource`
1214

1315
## 特性
1416

@@ -29,5 +31,5 @@
2931
- 🌈 支持 `vite preview` 模式
3032
- 📤 支持 multipart 类型,模拟文件上传
3133
- 📥 支持模拟文件下载
32-
- ⚜️ 支持模拟 `WebSocket`
34+
- ⚜️ 支持模拟 `WebSocket``Server-Sent Events`
3335
- 🗂 支持构建可独立部署的小型mock服务

docs/guide/mock-config.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
`type: MockOptionsItem | MockOptionsItem[]`
44

5-
```ts
5+
::: code-group
6+
7+
```ts [*.mock.ts]
68
import { defineMock } from 'vite-plugin-mock-dev-server'
79

810
export default defineMock({
@@ -11,6 +13,8 @@ export default defineMock({
1113
})
1214
```
1315

16+
:::
17+
1418
**类型定义:**
1519

1620
```ts
@@ -125,6 +129,7 @@ export default defineMock({
125129
- **默认值**
126130

127131
默认值根据 [type](#type) 的值确定:
132+
128133
| type | 默认值 |
129134
| -------- | ------------------------------------------------- |
130135
| `text` | `{ 'Content-Type': 'text/plain' }` |

docs/guide/mock-plugin.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ Vite Plugin Function
44

55
## 使用
66

7-
``` ts
7+
::: code-group
8+
9+
``` ts [vite.config.ts]
810
import { defineConfig } from 'vite'
911
import mockDevServerPlugin from 'vite-plugin-mock-dev-server'
1012

@@ -15,6 +17,8 @@ export default defineConfig({
1517
})
1618
```
1719

20+
:::
21+
1822
## `options`
1923

2024
`type: MockServerPluginOptions`

docs/public/logo.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)