vite-plugin-mock-dev-server 1.0.2 → 1.0.3
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 +2 -2
- package/dist/index.cjs +7 -3
- package/dist/index.js +7 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
- 🍕 Support `viteConfig.define` in mock file
|
|
41
41
|
- 📤 Support `multipart` content-type,mock upload file.
|
|
42
42
|
- 🌈 Support `vite preview` mode
|
|
43
|
-
- 🗂 Support for building
|
|
43
|
+
- 🗂 Support for building independently deployed mock services
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
## Documentation
|
|
@@ -171,7 +171,7 @@ export default defineConfig({
|
|
|
171
171
|
|
|
172
172
|
**Type:** `boolean`
|
|
173
173
|
|
|
174
|
-
When mock resources are hot
|
|
174
|
+
When mock resources are hot reload, only the data content is updated, but the page is not refreshed by default.
|
|
175
175
|
Turn this on when you want to refresh the page every time you modify the mock file.
|
|
176
176
|
|
|
177
177
|
|
package/dist/index.cjs
CHANGED
|
@@ -52,7 +52,7 @@ var import_vite = require("vite");
|
|
|
52
52
|
|
|
53
53
|
// package.json
|
|
54
54
|
var name = "vite-plugin-mock-dev-server";
|
|
55
|
-
var version = "1.0.
|
|
55
|
+
var version = "1.0.3";
|
|
56
56
|
|
|
57
57
|
// src/esbuildPlugin.ts
|
|
58
58
|
var import_promises = __toESM(require("fs/promises"), 1);
|
|
@@ -638,10 +638,14 @@ var _MockLoader = class extends import_node_events.default {
|
|
|
638
638
|
updateMockList() {
|
|
639
639
|
const mockList = [];
|
|
640
640
|
for (const [, handle] of this.moduleCache.entries()) {
|
|
641
|
-
|
|
641
|
+
if (handle) {
|
|
642
|
+
isArray(handle) ? mockList.push(...handle) : mockList.push(handle);
|
|
643
|
+
}
|
|
642
644
|
}
|
|
643
645
|
const mocks = {};
|
|
644
|
-
mockList.filter(
|
|
646
|
+
mockList.filter(
|
|
647
|
+
(mock) => (mock.enabled || typeof mock.enabled === "undefined") && mock.url
|
|
648
|
+
).forEach((mock) => {
|
|
645
649
|
const { pathname, query } = (0, import_node_url3.parse)(mock.url, true);
|
|
646
650
|
if (!mocks[pathname]) {
|
|
647
651
|
mocks[pathname] = [];
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { createFilter } from "vite";
|
|
|
9
9
|
|
|
10
10
|
// package.json
|
|
11
11
|
var name = "vite-plugin-mock-dev-server";
|
|
12
|
-
var version = "1.0.
|
|
12
|
+
var version = "1.0.3";
|
|
13
13
|
|
|
14
14
|
// src/esbuildPlugin.ts
|
|
15
15
|
import fsp from "fs/promises";
|
|
@@ -595,10 +595,14 @@ var _MockLoader = class extends EventEmitter {
|
|
|
595
595
|
updateMockList() {
|
|
596
596
|
const mockList = [];
|
|
597
597
|
for (const [, handle] of this.moduleCache.entries()) {
|
|
598
|
-
|
|
598
|
+
if (handle) {
|
|
599
|
+
isArray(handle) ? mockList.push(...handle) : mockList.push(handle);
|
|
600
|
+
}
|
|
599
601
|
}
|
|
600
602
|
const mocks = {};
|
|
601
|
-
mockList.filter(
|
|
603
|
+
mockList.filter(
|
|
604
|
+
(mock) => (mock.enabled || typeof mock.enabled === "undefined") && mock.url
|
|
605
|
+
).forEach((mock) => {
|
|
602
606
|
const { pathname, query } = urlParse2(mock.url, true);
|
|
603
607
|
if (!mocks[pathname]) {
|
|
604
608
|
mocks[pathname] = [];
|