vite-plugin-mock-data 8.0.1 → 8.1.0
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/dist/configureServer.d.ts +15 -5
- package/dist/index.js +122 -139
- package/dist/loadRoutes.d.ts +1 -1
- package/dist/types.d.ts +49 -10
- package/package.json +5 -4
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Config as SirvConfig, HTTPVersion } from 'find-my-way';
|
|
3
|
-
import { Options as SirvOptions } from 'sirv';
|
|
1
|
+
import { FastifyServerOptions } from 'fastify';
|
|
4
2
|
import { ViteDevServer } from 'vite';
|
|
5
3
|
import { RouteConfig } from './types';
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Mounts mock routes on the Vite dev server via a fastify instance.
|
|
6
|
+
*
|
|
7
|
+
* fastify is embedded as a connect middleware using its internal
|
|
8
|
+
* `routing(req, res)` API, so the plugin keeps the exact middleware
|
|
9
|
+
* semantics of the previous find-my-way based implementation:
|
|
10
|
+
* - matched mock routes are answered by fastify;
|
|
11
|
+
* - unmatched requests fall through to the next middleware via
|
|
12
|
+
* `setNotFoundHandler` + `reply.hijack()` + `next()`.
|
|
13
|
+
*
|
|
14
|
+
* Route config contract (unchanged from before):
|
|
15
|
+
* key = "METHOD /path", supports `METHOD1/METHOD2 /path` and `:param`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function configureServer(server: ViteDevServer, fastifyOptions: FastifyServerOptions | undefined, routes: RouteConfig[], cwd: string): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { isObject } from "is-what-type";
|
|
2
2
|
import { banner, logFactory, toAbsolutePath } from "vp-runtime-helper";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
3
|
+
import fastifyFormbody from "@fastify/formbody";
|
|
4
|
+
import fastifyStatic from "@fastify/static";
|
|
5
|
+
import fastify from "fastify";
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
7
|
import { readFileSync } from "node:fs";
|
|
8
|
-
import { unlink, writeFile } from "node:fs/promises";
|
|
8
|
+
import { mkdir, unlink, writeFile } from "node:fs/promises";
|
|
9
9
|
import { createRequire } from "node:module";
|
|
10
|
+
import { join, parse } from "node:path";
|
|
10
11
|
import { glob } from "tinyglobby";
|
|
12
|
+
import { transformWithOxc } from "vite";
|
|
11
13
|
//#region \0rolldown/runtime.js
|
|
12
14
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
13
15
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
@@ -18,7 +20,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
18
20
|
var name = "vite-plugin-mock-data";
|
|
19
21
|
var package_default = {
|
|
20
22
|
name,
|
|
21
|
-
version: "8.0
|
|
23
|
+
version: "8.1.0",
|
|
22
24
|
description: "Provides a simple way to mock data.",
|
|
23
25
|
type: "module",
|
|
24
26
|
types: "./dist/index.d.ts",
|
|
@@ -49,9 +51,10 @@ var package_default = {
|
|
|
49
51
|
bugs: { "url": "https://github.com/fengxinming/vite-plugins/issues" },
|
|
50
52
|
homepage: "https://fengxinming.github.io/vite-plugins/plugins/vite-plugin-mock-data/quick-start",
|
|
51
53
|
dependencies: {
|
|
52
|
-
"
|
|
54
|
+
"@fastify/formbody": "^9.0.0",
|
|
55
|
+
"@fastify/static": "^10.1.3",
|
|
56
|
+
"fastify": "^5.12.1",
|
|
53
57
|
"is-what-type": "^1.1.4",
|
|
54
|
-
"sirv": "^3.0.1",
|
|
55
58
|
"tinyglobby": "^0.2.12",
|
|
56
59
|
"vp-runtime-helper": "workspace:^"
|
|
57
60
|
},
|
|
@@ -65,120 +68,89 @@ var package_default = {
|
|
|
65
68
|
//#endregion
|
|
66
69
|
//#region src/configureServer.ts
|
|
67
70
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* matching the documented handler signature `(req) => req.body`.
|
|
71
|
+
* 解析路由 key:`"METHOD /path"`,支持 `METHOD1/METHOD2 /path` 与 `:param`。
|
|
72
|
+
* 缺省 METHOD 时默认 GET。
|
|
71
73
|
*/
|
|
72
|
-
function
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
req.on("data", (c) => chunks.push(Buffer.isBuffer(c) ? c : Buffer.from(c)));
|
|
76
|
-
req.on("end", () => {
|
|
77
|
-
const raw = Buffer.concat(chunks).toString("utf8");
|
|
78
|
-
if (!raw) {
|
|
79
|
-
resolve(void 0);
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const type = (req.headers["content-type"] || "").toLowerCase();
|
|
83
|
-
try {
|
|
84
|
-
if (type.includes("application/json")) resolve(JSON.parse(raw));
|
|
85
|
-
else if (type.includes("application/x-www-form-urlencoded")) {
|
|
86
|
-
const out = {};
|
|
87
|
-
for (const [k, v] of new URLSearchParams(raw)) out[k] = v;
|
|
88
|
-
resolve(out);
|
|
89
|
-
} else resolve(raw);
|
|
90
|
-
} catch (e) {
|
|
91
|
-
reject(e);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
req.on("error", reject);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
function sendResult(req, res, ret, defaultHeaders) {
|
|
98
|
-
if (res.headersSent || ret === void 0) return;
|
|
99
|
-
send(req, res, typeof ret !== "string" ? JSON.stringify(ret) : ret, isObject(ret) ? "json" : "html", { headers: defaultHeaders });
|
|
100
|
-
}
|
|
101
|
-
function sirvOptions(headers) {
|
|
74
|
+
function parseRouteKey(xpath) {
|
|
75
|
+
const [first, second] = xpath.split(" ");
|
|
76
|
+
const pathname = second ?? first;
|
|
102
77
|
return {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
extensions: [],
|
|
106
|
-
setHeaders(res, pathname) {
|
|
107
|
-
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
108
|
-
if (/\.[tj]sx?$/.test(pathname)) res.setHeader("Content-Type", "application/javascript");
|
|
109
|
-
if (headers) Object.entries(headers).forEach(([key, val]) => {
|
|
110
|
-
if (val) res.setHeader(key, val);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
78
|
+
methods: (second ? first : "GET").toUpperCase().split("/"),
|
|
79
|
+
pathname
|
|
113
80
|
};
|
|
114
81
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
detail: String(e)
|
|
171
|
-
}));
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
};
|
|
82
|
+
/**
|
|
83
|
+
* 静态数据发送 handler:
|
|
84
|
+
* - 对象 / 数组(isObject 为真,数组也是 object)→ `reply.send(data)`,fastify 序列化为 JSON;
|
|
85
|
+
* - 其他(string / number / boolean / null)→ `String()` 转成字符串按文本发送
|
|
86
|
+
* (fastify 对 string 默认 Content-Type: text/plain)。
|
|
87
|
+
*/
|
|
88
|
+
function createStaticHandler(data) {
|
|
89
|
+
return (_request, reply) => {
|
|
90
|
+
reply.send(isObject(data) ? data : String(data));
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 在 fastify 实例上注册单条 mock 路由。
|
|
95
|
+
*
|
|
96
|
+
* 路由值只分两种(与 types.ts 的 RouteValue 一一对应):
|
|
97
|
+
* - 函数 → 原样透传,它就是 fastify 的 handler
|
|
98
|
+
* (fastify 原生处理两种响应方式:async 返回值自动发送 / 内部 reply.send());
|
|
99
|
+
* - 其他一切(对象 / 数组 / string / number / boolean / null)→ 静态数据,
|
|
100
|
+
* 由 createStaticHandler 生成 handler 发送。
|
|
101
|
+
*/
|
|
102
|
+
function registerMockRoute(app, xpath, raw) {
|
|
103
|
+
const { methods, pathname } = parseRouteKey(xpath);
|
|
104
|
+
app.route({
|
|
105
|
+
method: methods,
|
|
106
|
+
url: pathname,
|
|
107
|
+
handler: typeof raw === "function" ? raw : createStaticHandler(raw)
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Mounts mock routes on the Vite dev server via a fastify instance.
|
|
112
|
+
*
|
|
113
|
+
* fastify is embedded as a connect middleware using its internal
|
|
114
|
+
* `routing(req, res)` API, so the plugin keeps the exact middleware
|
|
115
|
+
* semantics of the previous find-my-way based implementation:
|
|
116
|
+
* - matched mock routes are answered by fastify;
|
|
117
|
+
* - unmatched requests fall through to the next middleware via
|
|
118
|
+
* `setNotFoundHandler` + `reply.hijack()` + `next()`.
|
|
119
|
+
*
|
|
120
|
+
* Route config contract (unchanged from before):
|
|
121
|
+
* key = "METHOD /path", supports `METHOD1/METHOD2 /path` and `:param`.
|
|
122
|
+
*/
|
|
123
|
+
async function configureServer(server, fastifyOptions, routes, cwd) {
|
|
124
|
+
const app = fastify({
|
|
125
|
+
logger: false,
|
|
126
|
+
...fastifyOptions
|
|
127
|
+
});
|
|
128
|
+
app.register(fastifyFormbody);
|
|
129
|
+
app.register(fastifyStatic, {
|
|
130
|
+
root: cwd,
|
|
131
|
+
setHeaders(reply, pathname) {
|
|
132
|
+
reply.header("Access-Control-Allow-Origin", "*");
|
|
133
|
+
if (/\.[tj]sx?$/.test(pathname)) reply.header("Content-Type", "application/javascript");
|
|
134
|
+
const headers = server.config.server.headers;
|
|
135
|
+
if (headers) {
|
|
136
|
+
for (const [key, val] of Object.entries(headers)) if (val) reply.header(key, val);
|
|
175
137
|
}
|
|
176
|
-
|
|
177
|
-
});
|
|
138
|
+
}
|
|
178
139
|
});
|
|
140
|
+
app.setNotFoundHandler((request, reply) => {
|
|
141
|
+
reply.hijack();
|
|
142
|
+
const raw = request.raw;
|
|
143
|
+
const next = raw.__mockNext;
|
|
144
|
+
delete raw.__mockNext;
|
|
145
|
+
next?.();
|
|
146
|
+
});
|
|
147
|
+
routes.forEach((route) => {
|
|
148
|
+
for (const [key, val] of Object.entries(route)) registerMockRoute(app, key, val);
|
|
149
|
+
});
|
|
150
|
+
await app.ready();
|
|
179
151
|
server.middlewares.use((req, res, next) => {
|
|
180
|
-
|
|
181
|
-
|
|
152
|
+
req.__mockNext = next;
|
|
153
|
+
app.routing(req, res);
|
|
182
154
|
});
|
|
183
155
|
}
|
|
184
156
|
//#endregion
|
|
@@ -188,32 +160,42 @@ var logger = logFactory.getLogger(PLUGIN_NAME);
|
|
|
188
160
|
//#endregion
|
|
189
161
|
//#region src/loadRoutes.ts
|
|
190
162
|
var _require = typeof __require === "function" ? __require : createRequire(import.meta.url);
|
|
191
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Temp directory for transpiled mock files, shared by every mock dir of this project.
|
|
165
|
+
* Kept under node_modules so `rm -rf node_modules` cleans it up along with everything
|
|
166
|
+
* else, and git ignores it by default.
|
|
167
|
+
*/
|
|
168
|
+
function getTempDir(cwd) {
|
|
169
|
+
return join(cwd, "node_modules", ".vite-plugin-mock-data");
|
|
170
|
+
}
|
|
171
|
+
async function getRoute(filename, tmpDir) {
|
|
192
172
|
logger.debug("Load mock file:", filename);
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (isTs) {
|
|
173
|
+
const { ext, name } = parse(filename);
|
|
174
|
+
if (ext === ".ts" || ext === ".mts") {
|
|
196
175
|
const { code } = await transformWithOxc(readFileSync(filename, "utf-8"), filename);
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
await
|
|
176
|
+
const hash = createHash("sha256").update(filename).digest("hex").slice(0, 12);
|
|
177
|
+
const tmpFile = join(tmpDir, `${hash}-${name}-${PLUGIN_NAME}.mjs`);
|
|
178
|
+
await mkdir(tmpDir, { recursive: true });
|
|
179
|
+
await writeFile(tmpFile, code);
|
|
180
|
+
try {
|
|
181
|
+
return (await import(tmpFile)).default;
|
|
182
|
+
} finally {
|
|
183
|
+
await unlink(tmpFile).catch(() => {});
|
|
184
|
+
}
|
|
200
185
|
}
|
|
201
|
-
let config;
|
|
202
186
|
switch (ext) {
|
|
203
|
-
case ".js":
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
case ".mjs":
|
|
207
|
-
config = (await import(filename)).default;
|
|
208
|
-
if (isTs) await unlink(filename);
|
|
209
|
-
break;
|
|
210
|
-
case ".json": config = JSON.parse(readFileSync(filename, "utf-8"));
|
|
187
|
+
case ".js": return _require(filename);
|
|
188
|
+
case ".mjs": return (await import(filename)).default;
|
|
189
|
+
case ".json": return JSON.parse(readFileSync(filename, "utf-8"));
|
|
211
190
|
}
|
|
212
|
-
return config;
|
|
213
191
|
}
|
|
214
|
-
async function loadRoutes(dir, routes) {
|
|
215
|
-
const
|
|
216
|
-
const
|
|
192
|
+
async function loadRoutes(dir, routes, cwd = process.cwd()) {
|
|
193
|
+
const tmpDir = getTempDir(cwd);
|
|
194
|
+
const paths = await glob(`${dir}/**/*.{js,mjs,json,ts,mts}`, {
|
|
195
|
+
absolute: true,
|
|
196
|
+
ignore: [`**/*-${PLUGIN_NAME}.mjs`]
|
|
197
|
+
});
|
|
198
|
+
const configs = await Promise.all(paths.map((p) => getRoute(p, tmpDir)));
|
|
217
199
|
for (const config of configs) if (config) routes.push(config);
|
|
218
200
|
}
|
|
219
201
|
//#endregion
|
|
@@ -240,25 +222,26 @@ async function loadRoutes(dir, routes) {
|
|
|
240
222
|
*/
|
|
241
223
|
function pluginMockDate(opts) {
|
|
242
224
|
if (opts.enableBanner) banner(package_default.name);
|
|
243
|
-
const { isAfter,
|
|
225
|
+
const { isAfter, fastifyOptions, routes, logLevel, cwd = process.cwd() } = opts;
|
|
244
226
|
if (logLevel) logger.level = logLevel;
|
|
245
227
|
const allRoutes = [];
|
|
246
228
|
return {
|
|
247
229
|
name: PLUGIN_NAME,
|
|
248
230
|
async configureServer(server) {
|
|
231
|
+
allRoutes.length = 0;
|
|
249
232
|
if (typeof routes === "string") {
|
|
250
233
|
logger.debug("Load routes from", routes);
|
|
251
|
-
await loadRoutes(toAbsolutePath(routes, cwd), allRoutes);
|
|
234
|
+
await loadRoutes(toAbsolutePath(routes, cwd), allRoutes, cwd);
|
|
252
235
|
} else if (Array.isArray(routes)) for (const route of routes) {
|
|
253
236
|
logger.debug("Load routes from", route);
|
|
254
|
-
if (typeof route === "string") await loadRoutes(toAbsolutePath(route, cwd), allRoutes);
|
|
237
|
+
if (typeof route === "string") await loadRoutes(toAbsolutePath(route, cwd), allRoutes, cwd);
|
|
255
238
|
else allRoutes.push(route);
|
|
256
239
|
}
|
|
257
240
|
else if (isObject(routes)) {
|
|
258
241
|
logger.debug("Load routes from", routes);
|
|
259
242
|
allRoutes.push(routes);
|
|
260
243
|
}
|
|
261
|
-
return isAfter ? () => configureServer(server,
|
|
244
|
+
return isAfter ? () => configureServer(server, fastifyOptions, allRoutes, cwd) : configureServer(server, fastifyOptions, allRoutes, cwd);
|
|
262
245
|
}
|
|
263
246
|
};
|
|
264
247
|
}
|
package/dist/loadRoutes.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { RouteConfig } from './types';
|
|
2
|
-
export default function loadRoutes(dir: string, routes: RouteConfig[]): Promise<void>;
|
|
2
|
+
export default function loadRoutes(dir: string, routes: RouteConfig[], cwd?: string): Promise<void>;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,13 +1,52 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FastifyServerOptions, RouteHandlerMethod } from 'fastify';
|
|
2
2
|
import { LogLevel } from 'vp-runtime-helper';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
/**
|
|
4
|
+
* 函数形式的 handler:fastify 原生风格 `(request, reply)`。
|
|
5
|
+
* 原样透传给 fastify,两种响应方式都由 fastify 处理:
|
|
6
|
+
* - async handler 的返回值自动发送(对象序列化为 JSON);
|
|
7
|
+
* - handler 内部自行调用 `reply.send()`。
|
|
8
|
+
* Function handler in fastify style. Passed through to fastify as-is.
|
|
9
|
+
*/
|
|
10
|
+
export type MockHandler = RouteHandlerMethod;
|
|
11
|
+
/**
|
|
12
|
+
* 任意 JSON 可序列化的静态数据。
|
|
13
|
+
*
|
|
14
|
+
* 可直接写在路由 key 后面(顶层),对象 / 数组 / 原始值一律按数据发送:
|
|
15
|
+
* - string → String() 后按文本发送(fastify 默认 text/plain);
|
|
16
|
+
* - 其他值(object / array / number / boolean / null)→ 对象按 JSON 发送,
|
|
17
|
+
* 非对象经 String() 转成字符串按文本发送(见 configureServer.ts 的 createStaticHandler)。
|
|
18
|
+
*
|
|
19
|
+
* 不再需要排除任何字段——运行时分流只判断「是不是函数」:
|
|
20
|
+
* 函数 → handler 透传;非函数 → 本类型(静态数据)。
|
|
21
|
+
*
|
|
22
|
+
* Any JSON-serializable static data, usable directly at the route top level.
|
|
23
|
+
* Runtime dispatch only checks `typeof value === 'function'` — functions are
|
|
24
|
+
* passed through as handlers, everything else is static data.
|
|
25
|
+
*/
|
|
26
|
+
export type MockData = string | number | boolean | null | MockData[] | {
|
|
27
|
+
[key: string]: MockData;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* 路由配置值:函数 handler 或静态数据两种形态。
|
|
31
|
+
* 函数原样透传给 fastify;非函数按静态数据发送。
|
|
32
|
+
*
|
|
33
|
+
* Route config value: a function handler (passed through to fastify) or
|
|
34
|
+
* static data (sent by a plugin-generated handler).
|
|
35
|
+
*/
|
|
36
|
+
export type RouteValue = MockHandler | MockData;
|
|
9
37
|
export interface RouteConfig {
|
|
10
|
-
[route: string]:
|
|
38
|
+
[route: string]: RouteValue;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* connect 中间件的 next 回调在 fastify 404 handler 之间的传递载体。
|
|
42
|
+
*
|
|
43
|
+
* fastify 以 `app.routing(req, res)` 嵌入 connect 中间件时,未匹配的请求会
|
|
44
|
+
* 走到 fastify 的 404 handler,但那里拿不到 connect 的 `next`。因此
|
|
45
|
+
* configureServer 在 middleware 里先把 `next` 挂到 `request.raw.__mockNext`,
|
|
46
|
+
* 404 handler 取出并调用,让请求落回 Vite 的中间件链(配合 reply.hijack())。
|
|
47
|
+
*/
|
|
48
|
+
export interface MockRequest {
|
|
49
|
+
__mockNext?: () => void;
|
|
11
50
|
}
|
|
12
51
|
export interface Options {
|
|
13
52
|
/**
|
|
@@ -35,9 +74,9 @@ export interface Options {
|
|
|
35
74
|
*/
|
|
36
75
|
isAfter?: boolean;
|
|
37
76
|
/**
|
|
38
|
-
* Initial options of `
|
|
77
|
+
* Initial options of `fastify`. see more at https://fastify.dev/docs/latest/Reference/Server/
|
|
39
78
|
*/
|
|
40
|
-
|
|
79
|
+
fastifyOptions?: FastifyServerOptions;
|
|
41
80
|
/**
|
|
42
81
|
* Initial list of mock routes that should be added to the dev server
|
|
43
82
|
* or specify the directory to define mock routes that should be added to the dev server.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-mock-data",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "Provides a simple way to mock data.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -30,16 +30,17 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://fengxinming.github.io/vite-plugins/plugins/vite-plugin-mock-data/quick-start",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"
|
|
33
|
+
"@fastify/formbody": "^9.0.0",
|
|
34
|
+
"@fastify/static": "^10.1.3",
|
|
35
|
+
"fastify": "^5.12.1",
|
|
34
36
|
"is-what-type": "^1.1.4",
|
|
35
|
-
"sirv": "^3.0.1",
|
|
36
37
|
"tinyglobby": "^0.2.12",
|
|
37
38
|
"vp-runtime-helper": "^8.0.0"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"vite": "^8.0.0",
|
|
41
42
|
"vite-plugin-dts": "^5.0.3",
|
|
42
|
-
"vite-plugin-external": "^8.0.
|
|
43
|
+
"vite-plugin-external": "^8.0.3"
|
|
43
44
|
},
|
|
44
45
|
"files": [
|
|
45
46
|
"dist"
|