vite-plugin-mock-dev-server 2.0.1 → 2.0.2
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/{helper-BbR8Si2U.js → helper-BXYm8ulO.js} +1 -1
- package/dist/helper.d.ts +2 -2
- package/dist/helper.js +1 -1
- package/dist/{index-CJc2Oax2.d.ts → index-HdmSyOec.d.ts} +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +25 -34
- package/dist/{server-G9rXmGpR.js → server-4Xi0IyG-.js} +13 -28
- package/dist/{server-nJXXNIV3.d.ts → server-nb5Kby5K.d.ts} +3 -3
- package/dist/server.d.ts +2 -2
- package/dist/server.js +1 -1
- package/dist/{types-BtCJqeLH.d.ts → types-BYW0Xh7Y.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +6 -6
package/dist/helper.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { HeaderStream,
|
|
1
|
+
import { _ as WebSocketSetupContext, a as LogType, c as MockMatchPriority, d as MockRequest, f as MockResponse, g as ServerBuildOption, h as ResponseBody, i as LogLevel, l as MockMatchSpecialPriority, m as MockWebsocketItem, n as ExtraRequest, o as Method, p as MockServerPluginOptions, r as FormidableFile, s as MockHttpItem, t as BodyParserOptions, u as MockOptions } from "./types-BYW0Xh7Y.js";
|
|
2
|
+
import { a as HeaderStream, i as defineMock, n as defineMockData, o as SSEMessage, r as createDefineMock, s as createSSEStream, t as MockData } from "./index-HdmSyOec.js";
|
|
3
3
|
export { BodyParserOptions, ExtraRequest, FormidableFile, HeaderStream, LogLevel, LogType, Method, MockData, MockHttpItem, MockMatchPriority, MockMatchSpecialPriority, MockOptions, MockRequest, MockResponse, MockServerPluginOptions, MockWebsocketItem, ResponseBody, SSEMessage, ServerBuildOption, WebSocketSetupContext, createDefineMock, createSSEStream, defineMock, defineMockData };
|
package/dist/helper.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as createSSEStream, n as createDefineMock, r as defineMock, t as defineMockData } from "./helper-BXYm8ulO.js";
|
|
2
2
|
|
|
3
3
|
export { createDefineMock, createSSEStream, defineMock, defineMockData };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MockHttpItem, MockOptions
|
|
1
|
+
import { m as MockWebsocketItem, s as MockHttpItem, u as MockOptions } from "./types-BYW0Xh7Y.js";
|
|
2
2
|
import { Transform } from "node:stream";
|
|
3
3
|
import { IncomingMessage, OutgoingHttpHeaders, ServerResponse } from "node:http";
|
|
4
4
|
|
|
@@ -123,4 +123,4 @@ type MockData<T = any> = readonly [() => T, (val: T | ((val: T) => T | void)) =>
|
|
|
123
123
|
};
|
|
124
124
|
declare function defineMockData<T = any>(key: string, initialData: T): MockData<T>;
|
|
125
125
|
//#endregion
|
|
126
|
-
export { HeaderStream,
|
|
126
|
+
export { HeaderStream as a, defineMock as i, defineMockData as n, SSEMessage as o, createDefineMock as r, createSSEStream as s, MockData as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { HeaderStream,
|
|
3
|
-
import {
|
|
1
|
+
import { _ as WebSocketSetupContext, a as LogType, c as MockMatchPriority, d as MockRequest, f as MockResponse, g as ServerBuildOption, h as ResponseBody, i as LogLevel, l as MockMatchSpecialPriority, m as MockWebsocketItem, n as ExtraRequest, o as Method, p as MockServerPluginOptions, r as FormidableFile, s as MockHttpItem, t as BodyParserOptions, u as MockOptions } from "./types-BYW0Xh7Y.js";
|
|
2
|
+
import { a as HeaderStream, i as defineMock, n as defineMockData, o as SSEMessage, r as createDefineMock, s as createSSEStream, t as MockData } from "./index-HdmSyOec.js";
|
|
3
|
+
import { a as createLogger, c as processRawData, i as Logger, l as sortByValidator, n as CreateMockMiddlewareOptions, o as logLevels, r as createMockMiddleware, s as processMockData, t as mockWebSocket } from "./server-nb5Kby5K.js";
|
|
4
4
|
import { Plugin } from "vite";
|
|
5
5
|
|
|
6
6
|
//#region src/plugin.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as processRawData, c as debug, d as logLevels, f as isPathMatch, h as createMatcher, i as processMockData, l as normalizePath, m as doesProxyContextMatchUrl, n as createMockMiddleware, o as sortByValidator, p as isPackageExists, r as recoverRequest, s as urlParse, t as mockWebSocket, u as createLogger } from "./server-4Xi0IyG-.js";
|
|
2
|
+
import { i as createSSEStream, n as createDefineMock, r as defineMock, t as defineMockData } from "./helper-BXYm8ulO.js";
|
|
3
3
|
import { isArray, isBoolean, promiseParallel, toArray, uniq } from "@pengzhanbo/utils";
|
|
4
4
|
import fs, { promises } from "node:fs";
|
|
5
5
|
import fsp from "node:fs/promises";
|
|
@@ -40,9 +40,8 @@ const jsonLoader = {
|
|
|
40
40
|
name: "json-loader",
|
|
41
41
|
setup(build) {
|
|
42
42
|
build.onLoad({ filter: /\.json$/ }, async ({ path: path$1 }) => {
|
|
43
|
-
const content = await fsp.readFile(path$1, "utf-8");
|
|
44
43
|
return {
|
|
45
|
-
contents: `export default ${
|
|
44
|
+
contents: `export default ${await fsp.readFile(path$1, "utf-8")}`,
|
|
46
45
|
loader: "js"
|
|
47
46
|
};
|
|
48
47
|
});
|
|
@@ -68,13 +67,12 @@ function aliasPlugin(alias) {
|
|
|
68
67
|
const matchedEntry = alias.find(({ find: find$1 }) => aliasMatches(find$1, id));
|
|
69
68
|
if (!matchedEntry) return null;
|
|
70
69
|
const { find, replacement } = matchedEntry;
|
|
71
|
-
const result = await build.resolve(id.replace(find, replacement), {
|
|
72
|
-
kind: "import-statement",
|
|
73
|
-
resolveDir: replacement,
|
|
74
|
-
namespace: "file"
|
|
75
|
-
});
|
|
76
70
|
return {
|
|
77
|
-
path:
|
|
71
|
+
path: (await build.resolve(id.replace(find, replacement), {
|
|
72
|
+
kind: "import-statement",
|
|
73
|
+
resolveDir: replacement,
|
|
74
|
+
namespace: "file"
|
|
75
|
+
})).path,
|
|
78
76
|
external: false
|
|
79
77
|
};
|
|
80
78
|
});
|
|
@@ -97,8 +95,7 @@ async function transformWithEsbuild(entryPoint, { isESM = true, define, alias, c
|
|
|
97
95
|
const filename = path.basename(entryPoint);
|
|
98
96
|
const dirname = path.dirname(filepath);
|
|
99
97
|
try {
|
|
100
|
-
const
|
|
101
|
-
const result = await build({
|
|
98
|
+
const result = await (await esbuild())({
|
|
102
99
|
entryPoints: [entryPoint],
|
|
103
100
|
outfile: "out.js",
|
|
104
101
|
write: false,
|
|
@@ -201,12 +198,12 @@ async function transformWithRolldown(entryPoint, { isESM = true, define, alias,
|
|
|
201
198
|
file: "out.js"
|
|
202
199
|
},
|
|
203
200
|
platform: "node",
|
|
204
|
-
define: {
|
|
201
|
+
transform: { define: {
|
|
205
202
|
...define,
|
|
206
203
|
__dirname: JSON.stringify(dirname),
|
|
207
204
|
__filename: JSON.stringify(filename),
|
|
208
205
|
...isESM ? {} : { "import.meta.url": JSON.stringify(pathToFileURL(filepath)) }
|
|
209
|
-
},
|
|
206
|
+
} },
|
|
210
207
|
external(id) {
|
|
211
208
|
if (isAlias(id)) return false;
|
|
212
209
|
if (id[0] !== "." && !path.isAbsolute(id) && id !== "vite-plugin-mock-dev-server") return true;
|
|
@@ -246,14 +243,13 @@ async function compile(filepath, options) {
|
|
|
246
243
|
...options,
|
|
247
244
|
isESM
|
|
248
245
|
});
|
|
249
|
-
const data = await loadFromCode({
|
|
250
|
-
filepath,
|
|
251
|
-
code,
|
|
252
|
-
isESM,
|
|
253
|
-
cwd: options.cwd || process.cwd()
|
|
254
|
-
}) || {};
|
|
255
246
|
return {
|
|
256
|
-
data
|
|
247
|
+
data: await loadFromCode({
|
|
248
|
+
filepath,
|
|
249
|
+
code,
|
|
250
|
+
isESM,
|
|
251
|
+
cwd: options.cwd || process.cwd()
|
|
252
|
+
}) || {},
|
|
257
253
|
deps
|
|
258
254
|
};
|
|
259
255
|
}
|
|
@@ -271,13 +267,13 @@ var Compiler = class extends EventEmitter {
|
|
|
271
267
|
depsWatcher;
|
|
272
268
|
isESM = false;
|
|
273
269
|
_mockData = {};
|
|
270
|
+
options;
|
|
274
271
|
constructor(options) {
|
|
275
272
|
super();
|
|
276
273
|
this.options = options;
|
|
277
274
|
this.cwd = options.cwd || process.cwd();
|
|
278
275
|
try {
|
|
279
|
-
|
|
280
|
-
this.isESM = pkg?.type === "module";
|
|
276
|
+
this.isESM = loadPackageJSONSync(this.cwd)?.type === "module";
|
|
281
277
|
} catch {}
|
|
282
278
|
}
|
|
283
279
|
get mockData() {
|
|
@@ -338,8 +334,7 @@ var Compiler = class extends EventEmitter {
|
|
|
338
334
|
updateModuleDeps(filepath, deps) {
|
|
339
335
|
for (const dep of deps) {
|
|
340
336
|
if (!this.moduleDeps.has(dep)) this.moduleDeps.set(dep, /* @__PURE__ */ new Set());
|
|
341
|
-
|
|
342
|
-
cur.add(filepath);
|
|
337
|
+
this.moduleDeps.get(dep).add(filepath);
|
|
343
338
|
}
|
|
344
339
|
this.emit("update:deps");
|
|
345
340
|
}
|
|
@@ -376,8 +371,7 @@ var Compiler = class extends EventEmitter {
|
|
|
376
371
|
});
|
|
377
372
|
watcher.on("change", (filepath) => {
|
|
378
373
|
filepath = normalizePath(filepath);
|
|
379
|
-
|
|
380
|
-
mockFiles?.forEach((file) => this.emit("mock:update", file));
|
|
374
|
+
this.moduleDeps.get(filepath)?.forEach((file) => this.emit("mock:update", file));
|
|
381
375
|
});
|
|
382
376
|
watcher.on("unlink", (filepath) => {
|
|
383
377
|
filepath = normalizePath(filepath);
|
|
@@ -417,7 +411,7 @@ export default processMockData(mockList);`;
|
|
|
417
411
|
//#endregion
|
|
418
412
|
//#region package.json
|
|
419
413
|
var name = "vite-plugin-mock-dev-server";
|
|
420
|
-
var version = "2.0.
|
|
414
|
+
var version = "2.0.2";
|
|
421
415
|
|
|
422
416
|
//#endregion
|
|
423
417
|
//#region src/build/packageJson.ts
|
|
@@ -573,8 +567,7 @@ function createCorsMiddleware(compiler, { proxies, cors: corsOptions }) {
|
|
|
573
567
|
const { pathname } = urlParse(req.url);
|
|
574
568
|
if (!pathname || proxies.length === 0 || !proxies.some((context) => doesProxyContextMatchUrl(context, req.url))) return next();
|
|
575
569
|
const mockData = compiler.mockData;
|
|
576
|
-
|
|
577
|
-
if (!mockUrl) return next();
|
|
570
|
+
if (!Object.keys(mockData).find((pattern) => isPathMatch(pattern, pathname))) return next();
|
|
578
571
|
cors(corsOptions)(req, res, next);
|
|
579
572
|
};
|
|
580
573
|
}
|
|
@@ -819,12 +812,10 @@ function serverPlugin(options) {
|
|
|
819
812
|
config.logger.warn("");
|
|
820
813
|
},
|
|
821
814
|
configureServer({ middlewares, httpServer, ws }) {
|
|
822
|
-
|
|
823
|
-
middlewareList.forEach((middleware) => middlewares.use(middleware));
|
|
815
|
+
initMockMiddlewares(resolvedOptions, httpServer, ws).forEach((middleware) => middlewares.use(middleware));
|
|
824
816
|
},
|
|
825
817
|
configurePreviewServer({ middlewares, httpServer }) {
|
|
826
|
-
|
|
827
|
-
middlewareList.forEach((middleware) => middlewares.use(middleware));
|
|
818
|
+
initMockMiddlewares(resolvedOptions, httpServer).forEach((middleware) => middlewares.use(middleware));
|
|
828
819
|
}
|
|
829
820
|
};
|
|
830
821
|
}
|
|
@@ -22,11 +22,10 @@ function createMatcher(include, exclude) {
|
|
|
22
22
|
if (item[0] === "!") ignore.push(item.slice(1));
|
|
23
23
|
else pattern.push(item);
|
|
24
24
|
});
|
|
25
|
-
const isMatch = picomatch(pattern, { ignore });
|
|
26
25
|
return {
|
|
27
26
|
pattern,
|
|
28
27
|
ignore,
|
|
29
|
-
isMatch
|
|
28
|
+
isMatch: picomatch(pattern, { ignore })
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
31
|
|
|
@@ -115,15 +114,14 @@ function createLogger(prefix, defaultLevel = "info") {
|
|
|
115
114
|
prefix = `[${prefix}]`;
|
|
116
115
|
function output(type, msg, level) {
|
|
117
116
|
level = isBoolean(level) ? level ? defaultLevel : "error" : level;
|
|
118
|
-
|
|
119
|
-
if (thresh >= logLevels[type]) {
|
|
117
|
+
if (logLevels[level] >= logLevels[type]) {
|
|
120
118
|
const method = type === "info" || type === "debug" ? "log" : type;
|
|
121
119
|
const tag = type === "debug" ? ansis.magenta.bold(prefix) : type === "info" ? ansis.cyan.bold(prefix) : type === "warn" ? ansis.yellow.bold(prefix) : ansis.red.bold(prefix);
|
|
122
120
|
const format = `${ansis.dim((/* @__PURE__ */ new Date()).toLocaleTimeString())} ${tag} ${msg}`;
|
|
123
121
|
console[method](format);
|
|
124
122
|
}
|
|
125
123
|
}
|
|
126
|
-
|
|
124
|
+
return {
|
|
127
125
|
debug(msg, level = defaultLevel) {
|
|
128
126
|
output("debug", msg, level);
|
|
129
127
|
},
|
|
@@ -137,7 +135,6 @@ function createLogger(prefix, defaultLevel = "info") {
|
|
|
137
135
|
output("error", msg, level);
|
|
138
136
|
}
|
|
139
137
|
};
|
|
140
|
-
return logger;
|
|
141
138
|
}
|
|
142
139
|
|
|
143
140
|
//#endregion
|
|
@@ -160,11 +157,9 @@ function normalizePath(id) {
|
|
|
160
157
|
*/
|
|
161
158
|
function urlParse(input) {
|
|
162
159
|
const url = new URL(input, "http://example.com");
|
|
163
|
-
const pathname = decodeURIComponent(url.pathname);
|
|
164
|
-
const query = parse$1(url.search.replace(/^\?/, ""));
|
|
165
160
|
return {
|
|
166
|
-
pathname,
|
|
167
|
-
query
|
|
161
|
+
pathname: decodeURIComponent(url.pathname),
|
|
162
|
+
query: parse$1(url.search.replace(/^\?/, ""))
|
|
168
163
|
};
|
|
169
164
|
}
|
|
170
165
|
|
|
@@ -233,8 +228,7 @@ function sortByValidator(mocks) {
|
|
|
233
228
|
const { validator } = item;
|
|
234
229
|
if (!validator || isEmptyObject(validator)) return 2;
|
|
235
230
|
if (isFunction(validator)) return 0;
|
|
236
|
-
|
|
237
|
-
return 1 / count;
|
|
231
|
+
return 1 / Object.keys(validator).reduce((prev, key) => prev + keysCount(validator[key]), 0);
|
|
238
232
|
});
|
|
239
233
|
}
|
|
240
234
|
function keysCount(obj) {
|
|
@@ -269,7 +263,6 @@ async function parseRequestBody(req, formidableOptions, bodyParserOptions = {})
|
|
|
269
263
|
} catch (e) {
|
|
270
264
|
console.error(e);
|
|
271
265
|
}
|
|
272
|
-
return void 0;
|
|
273
266
|
}
|
|
274
267
|
const DEFAULT_FORMIDABLE_OPTIONS = {
|
|
275
268
|
keepExtensions: true,
|
|
@@ -340,8 +333,7 @@ function requestLog(request, filepath) {
|
|
|
340
333
|
function fineMockData(mockList, logger, { pathname, method, request }) {
|
|
341
334
|
return mockList.find((mock) => {
|
|
342
335
|
if (!pathname || !mock || !mock.url || mock.ws) return false;
|
|
343
|
-
|
|
344
|
-
if (!methods.includes(method)) return false;
|
|
336
|
+
if (!(mock.method ? isArray(mock.method) ? mock.method : [mock.method] : ["GET", "POST"]).includes(method)) return false;
|
|
345
337
|
const hasMock = isPathMatch(mock.url, pathname);
|
|
346
338
|
if (hasMock && mock.validator) {
|
|
347
339
|
const params = parseRequestParams(mock.url, pathname);
|
|
@@ -396,8 +388,7 @@ function sortFn(rule) {
|
|
|
396
388
|
const tokens = getTokens(rule);
|
|
397
389
|
let w = 0;
|
|
398
390
|
for (let i = 0; i < tokens.length; i++) {
|
|
399
|
-
|
|
400
|
-
if (token.type !== "text") w += 10 ** (i + 1);
|
|
391
|
+
if (tokens[i].type !== "text") w += 10 ** (i + 1);
|
|
401
392
|
w += 10 ** (i + 1);
|
|
402
393
|
}
|
|
403
394
|
return w;
|
|
@@ -406,8 +397,7 @@ function preSort(rules) {
|
|
|
406
397
|
let matched = [];
|
|
407
398
|
const preMatch = [];
|
|
408
399
|
for (const rule of rules) {
|
|
409
|
-
const
|
|
410
|
-
const len = tokens.filter((token) => token.type !== "text").length;
|
|
400
|
+
const len = getTokens(rule).filter((token) => token.type !== "text").length;
|
|
411
401
|
if (!preMatch[len]) preMatch[len] = [];
|
|
412
402
|
preMatch[len].push(rule);
|
|
413
403
|
}
|
|
@@ -468,12 +458,8 @@ function matchingWeight(rules, url, priority) {
|
|
|
468
458
|
function twoPartMatch(rules) {
|
|
469
459
|
const statics = [];
|
|
470
460
|
const dynamics = [];
|
|
471
|
-
for (const rule of rules)
|
|
472
|
-
|
|
473
|
-
const dym = tokens.filter((token) => token.type !== "text");
|
|
474
|
-
if (dym.length > 0) dynamics.push(rule);
|
|
475
|
-
else statics.push(rule);
|
|
476
|
-
}
|
|
461
|
+
for (const rule of rules) if (getTokens(rule).filter((token) => token.type !== "text").length > 0) dynamics.push(rule);
|
|
462
|
+
else statics.push(rule);
|
|
477
463
|
return [statics, dynamics];
|
|
478
464
|
}
|
|
479
465
|
|
|
@@ -791,8 +777,7 @@ function mockWebSocket(compiler, server, { wsProxies: proxies, cookiesOptions, l
|
|
|
791
777
|
server?.on("close", () => {
|
|
792
778
|
for (const wssMap of poolMap.values()) {
|
|
793
779
|
for (const wss of wssMap.values()) {
|
|
794
|
-
|
|
795
|
-
cleanupRunner(wssContext.cleanupList);
|
|
780
|
+
cleanupRunner(wssContextMap.get(wss).cleanupList);
|
|
796
781
|
wss.close();
|
|
797
782
|
}
|
|
798
783
|
wssMap.clear();
|
|
@@ -807,4 +792,4 @@ function cleanupRunner(cleanupList) {
|
|
|
807
792
|
}
|
|
808
793
|
|
|
809
794
|
//#endregion
|
|
810
|
-
export {
|
|
795
|
+
export { processRawData as a, debug as c, logLevels as d, isPathMatch as f, createMatcher as h, processMockData as i, normalizePath as l, doesProxyContextMatchUrl as m, createMockMiddleware as n, sortByValidator as o, isPackageExists as p, recoverRequest as r, urlParse as s, mockWebSocket as t, createLogger as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as ServerBuildOption, i as LogLevel, m as MockWebsocketItem, p as MockServerPluginOptions, s as MockHttpItem, u as MockOptions } from "./types-BYW0Xh7Y.js";
|
|
2
2
|
import { Matcher } from "picomatch";
|
|
3
3
|
import EventEmitter from "node:events";
|
|
4
4
|
import { CorsOptions } from "cors";
|
|
@@ -42,7 +42,6 @@ type ResolvedMockServerPluginOptions = Required<Omit<MockServerPluginOptions, "b
|
|
|
42
42
|
* Mock 文件加载编译,并转换为 Mock 数据
|
|
43
43
|
*/
|
|
44
44
|
declare class Compiler extends EventEmitter {
|
|
45
|
-
options: ResolvedMockServerPluginOptions;
|
|
46
45
|
private moduleCache;
|
|
47
46
|
private moduleDeps;
|
|
48
47
|
cwd: string;
|
|
@@ -50,6 +49,7 @@ declare class Compiler extends EventEmitter {
|
|
|
50
49
|
private depsWatcher;
|
|
51
50
|
private isESM;
|
|
52
51
|
private _mockData;
|
|
52
|
+
options: ResolvedMockServerPluginOptions;
|
|
53
53
|
constructor(options: ResolvedMockServerPluginOptions);
|
|
54
54
|
get mockData(): Record<string, MockOptions>;
|
|
55
55
|
run(watch?: boolean): void;
|
|
@@ -85,4 +85,4 @@ declare function mockWebSocket(compiler: Compiler, server: Server | Http2SecureS
|
|
|
85
85
|
logger
|
|
86
86
|
}: ResolvedMockServerPluginOptions): void;
|
|
87
87
|
//#endregion
|
|
88
|
-
export {
|
|
88
|
+
export { createLogger as a, processRawData as c, Logger as i, sortByValidator as l, CreateMockMiddlewareOptions as n, logLevels as o, createMockMiddleware as r, processMockData as s, mockWebSocket as t };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./types-
|
|
2
|
-
import {
|
|
1
|
+
import "./types-BYW0Xh7Y.js";
|
|
2
|
+
import { a as createLogger, c as processRawData, i as Logger, l as sortByValidator, n as CreateMockMiddlewareOptions, o as logLevels, r as createMockMiddleware, s as processMockData, t as mockWebSocket } from "./server-nb5Kby5K.js";
|
|
3
3
|
export { CreateMockMiddlewareOptions, Logger, createLogger, createMockMiddleware, logLevels, mockWebSocket, processMockData, processRawData, sortByValidator };
|
package/dist/server.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as processRawData, d as logLevels, i as processMockData, n as createMockMiddleware, o as sortByValidator, t as mockWebSocket, u as createLogger } from "./server-4Xi0IyG-.js";
|
|
2
2
|
|
|
3
3
|
export { createLogger, createMockMiddleware, logLevels, mockWebSocket, processMockData, processRawData, sortByValidator };
|
|
@@ -578,4 +578,4 @@ type FormidableFile = formidable.File | formidable.File[];
|
|
|
578
578
|
type LogType = "info" | "warn" | "error" | "debug";
|
|
579
579
|
type LogLevel = LogType | "silent";
|
|
580
580
|
//#endregion
|
|
581
|
-
export {
|
|
581
|
+
export { WebSocketSetupContext as _, LogType as a, MockMatchPriority as c, MockRequest as d, MockResponse as f, ServerBuildOption as g, ResponseBody as h, LogLevel as i, MockMatchSpecialPriority as l, MockWebsocketItem as m, ExtraRequest as n, Method as o, MockServerPluginOptions as p, FormidableFile as r, MockHttpItem as s, BodyParserOptions as t, MockOptions as u };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as WebSocketSetupContext, a as LogType, c as MockMatchPriority, d as MockRequest, f as MockResponse, g as ServerBuildOption, h as ResponseBody, i as LogLevel, l as MockMatchSpecialPriority, m as MockWebsocketItem, n as ExtraRequest, o as Method, p as MockServerPluginOptions, r as FormidableFile, s as MockHttpItem, t as BodyParserOptions, u as MockOptions } from "./types-BYW0Xh7Y.js";
|
|
2
2
|
export { BodyParserOptions, ExtraRequest, FormidableFile, LogLevel, LogType, Method, MockHttpItem, MockMatchPriority, MockMatchSpecialPriority, MockOptions, MockRequest, MockResponse, MockServerPluginOptions, MockWebsocketItem, ResponseBody, ServerBuildOption, WebSocketSetupContext };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-mock-dev-server",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.2",
|
|
5
5
|
"author": "pengzhanbo <q942450674@outlook.com> (https://github.com/pengzhanbo)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://vite-plugin-mock-dev-server.netlify.app",
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@pengzhanbo/utils": "^2.1.0",
|
|
64
|
-
"ansis": "^4.
|
|
64
|
+
"ansis": "^4.2.0",
|
|
65
65
|
"chokidar": "^4.0.3",
|
|
66
66
|
"co-body": "^6.2.0",
|
|
67
67
|
"cookies": "^0.9.1",
|
|
68
68
|
"cors": "^2.8.5",
|
|
69
|
-
"debug": "^4.4.
|
|
69
|
+
"debug": "^4.4.3",
|
|
70
70
|
"formidable": "3.5.4",
|
|
71
71
|
"http-status": "^2.1.0",
|
|
72
72
|
"is-core-module": "^2.16.1",
|
|
@@ -75,12 +75,12 @@
|
|
|
75
75
|
"mime-types": "^3.0.1",
|
|
76
76
|
"path-to-regexp": "^8.3.0",
|
|
77
77
|
"picomatch": "^4.0.3",
|
|
78
|
-
"tinyglobby": "^0.2.
|
|
78
|
+
"tinyglobby": "^0.2.15",
|
|
79
79
|
"ws": "^8.18.3"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"esbuild": "^0.25.
|
|
83
|
-
"rolldown": "^1.0.0-beta.
|
|
82
|
+
"esbuild": "^0.25.11",
|
|
83
|
+
"rolldown": "^1.0.0-beta.45",
|
|
84
84
|
"vite": "npm:rolldown-vite@latest"
|
|
85
85
|
},
|
|
86
86
|
"publishConfig": {
|