vite-plugin-mock-dev-server 1.1.3 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,18 +30,19 @@
30
30
  - 🧲 Not injection-based, non-intrusive to client code.
31
31
  - 💡 ESModule/commonjs.
32
32
  - 🦾 Typescript.
33
+ - 🔥 HMR
33
34
  - 🏷 Support `json` / `json5`.
34
35
  - 📦 Auto import mock file.
35
36
  - 🎨 Support any lib,like `mockjs`,or not use it.
36
37
  - 📥 Path rule matching, request parameter matching.
37
38
  - ⚙️ Support Enabled/Disabled any one of api mock
38
- - 🔥 HMR
39
+ - 📀 Supports response body content type such as `text/json/buffer/stream`.
39
40
  - ⚖️ Use `server.proxy`
40
41
  - 🍕 Support `viteConfig.define` in mock file.
41
- - ⚓️ Support `resolve.alias` in mock file.
42
+ - ⚓️ Support `viteConfig.resolve.alias` in mock file.
43
+ - 🌈 Support `vite preview` mode.
42
44
  - 📤 Support `multipart` content-type,mock upload file.
43
- - 🍪 Support cookies
44
- - 🌈 Support `vite preview` mode
45
+ - 📥 Support mock download file.
45
46
  - 🗂 Support building small independent deployable mock services.
46
47
 
47
48
 
@@ -513,7 +514,7 @@ export default defineMock({
513
514
  ```ts
514
515
  export default defineMock({
515
516
  url: '/api/test',
516
- status: 504,
517
+ status: 502,
517
518
  statusText: 'Bad Gateway'
518
519
  })
519
520
  ```
@@ -561,7 +562,7 @@ export default defineMock({
561
562
  url: '/api/download',
562
563
  // When you are unsure of the type, you can pass in the file name for internal parsing by the plugin.
563
564
  type: 'my-app.dmg',
564
- body: createReadStream('./my-app.dmg')
565
+ body: () => createReadStream('./my-app.dmg')
565
566
  })
566
567
  ```
567
568
  ```html
package/README.zh-CN.md CHANGED
@@ -31,18 +31,19 @@
31
31
  - 🧲 非注入式,对客户端代码无侵入
32
32
  - 💡 ESModule/commonjs
33
33
  - 🦾 Typescript
34
+ - 🔥 热更新
34
35
  - 🏷 支持 `json` / `json5` 编写 mock 数据
35
36
  - 📦 自动加载 mock 文件
36
37
  - 🎨 可选择你喜欢的任意用于生成mock数据库,如 `mockjs`,或者不使用其他库
37
38
  - 📥 路径规则匹配,请求参数匹配
38
39
  - ⚙️ 随意开启或关闭对某个接口的 mock配置
39
- - 🔥 热更新
40
+ - - 📀 支持多种响应体数据类型,包括 `text/json/buffer/stream`.
40
41
  - ⚖️ 使用 `server.proxy` 配置
41
42
  - 🍕 支持在 mock文件中使用 `viteConfig.define`配置字段
42
- - ⚓️ 支持 `resolve.alias`
43
- - 📤 支持 multipart 类型,模拟文件上传
44
- - 🍪 支持 cookies
43
+ - ⚓️ 支持在 mock文件中使用 `viteConfig.resolve.alias` 路径别名
45
44
  - 🌈 支持 `vite preview` 模式
45
+ - 📤 支持 multipart 类型,模拟文件上传
46
+ - 📥 支持模拟文件下载
46
47
  - 🗂 支持构建可独立部署的小型mock服务
47
48
 
48
49
 
@@ -557,7 +558,7 @@ export default defineMock({
557
558
  url: '/api/download',
558
559
  // 当你不确定类型,可传入文件名由插件内部进行解析
559
560
  type: 'my-app.dmg',
560
- body: createReadStream('./my-app.dmg')
561
+ body: () => createReadStream('./my-app.dmg')
561
562
  })
562
563
  ```
563
564
  ```html