vite-plugin-mock-dev-server 1.9.0 → 1.9.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/dist-CAA1v47s.js +204 -0
- package/dist/dist-DrfpZ4UT.cjs +323 -0
- package/dist/{helper-Dwzt-HKi.cjs → helper-CCVedLL0.cjs} +7 -8
- package/dist/{helper-XBACG61a.js → helper-DhHU-YoO.js} +1 -1
- package/dist/{helper-ssk6rMi5.d.ts → helper-r_bW1AY8.d.ts} +1 -1
- package/dist/helper.cjs +2 -1
- package/dist/helper.d.ts +2 -2
- package/dist/helper.js +2 -1
- package/dist/index.cjs +29 -30
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -5
- package/dist/{server-CZwOQzgC.cjs → server-BwOfV_62.cjs} +51 -52
- package/dist/{server-Dr9FAgt4.js → server-C-u7jwot.js} +1 -1
- package/dist/{server-XauDEVqY.d.ts → server-DgmHgcvl.d.ts} +1 -1
- package/dist/server.cjs +2 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -1
- package/package.json +5 -5
- package/dist/chunk-CUT6urMc.cjs +0 -30
- /package/dist/{types-D2dm9iaM.d.ts → types-BbbTJG0b.d.ts} +0 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
//#region ../node_modules/.pnpm/@pengzhanbo+utils@2.1.0/node_modules/@pengzhanbo/utils/dist/index.mjs
|
|
2
|
+
function toString(s) {
|
|
3
|
+
return Object.prototype.toString.call(s);
|
|
4
|
+
}
|
|
5
|
+
function getTypeName(s) {
|
|
6
|
+
return s === null ? "null" : typeof s === "object" || typeof s === "function" ? toString(s).slice(8, -1).toLowerCase() : typeof s;
|
|
7
|
+
}
|
|
8
|
+
function isPrimitive(v) {
|
|
9
|
+
return v === null || typeof v !== "object" && typeof v !== "function";
|
|
10
|
+
}
|
|
11
|
+
function isBoolean(v) {
|
|
12
|
+
return typeof v === "boolean";
|
|
13
|
+
}
|
|
14
|
+
function isFunction(v) {
|
|
15
|
+
return typeof v === "function";
|
|
16
|
+
}
|
|
17
|
+
function isString(v) {
|
|
18
|
+
return typeof v === "string";
|
|
19
|
+
}
|
|
20
|
+
function isPlainObject(v) {
|
|
21
|
+
return getTypeName(v) === "object";
|
|
22
|
+
}
|
|
23
|
+
function isArray(v) {
|
|
24
|
+
return Array.isArray(v);
|
|
25
|
+
}
|
|
26
|
+
function isEmptyObject(v) {
|
|
27
|
+
if (!isPlainObject(v)) return false;
|
|
28
|
+
for (const _ in v) return false;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
function isTypedArray(v) {
|
|
32
|
+
return ArrayBuffer.isView(v) && !(v instanceof DataView);
|
|
33
|
+
}
|
|
34
|
+
function toArray(v) {
|
|
35
|
+
if (v === null || v === void 0) return [];
|
|
36
|
+
if (isArray(v)) return v;
|
|
37
|
+
return [v];
|
|
38
|
+
}
|
|
39
|
+
function uniq(v) {
|
|
40
|
+
return Array.from(new Set(v));
|
|
41
|
+
}
|
|
42
|
+
function sortBy(array, cb) {
|
|
43
|
+
if (array.length === 0) return [];
|
|
44
|
+
return array.sort((a, b) => {
|
|
45
|
+
const s1 = cb(a);
|
|
46
|
+
const s2 = cb(b);
|
|
47
|
+
return s1 > s2 ? 1 : s2 > s1 ? -1 : 0;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function hasOwn(obj, key) {
|
|
51
|
+
return obj === null ? false : Object.prototype.hasOwnProperty.call(obj, key);
|
|
52
|
+
}
|
|
53
|
+
function deepCloneImpl(valueToClone, objectToClone, stack = /* @__PURE__ */ new Map()) {
|
|
54
|
+
if (isPrimitive(valueToClone)) return valueToClone;
|
|
55
|
+
/* istanbul ignore if -- @preserve */
|
|
56
|
+
if (stack.has(valueToClone)) return stack.get(valueToClone);
|
|
57
|
+
if (Array.isArray(valueToClone)) {
|
|
58
|
+
const result = Array.from({ length: valueToClone.length });
|
|
59
|
+
stack.set(valueToClone, result);
|
|
60
|
+
for (let i = 0; i < valueToClone.length; i++) result[i] = deepCloneImpl(valueToClone[i], objectToClone, stack);
|
|
61
|
+
if (Object.hasOwn(valueToClone, "index")) result.index = valueToClone.index;
|
|
62
|
+
if (Object.hasOwn(valueToClone, "input")) result.input = valueToClone.input;
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
if (valueToClone instanceof Date) return new Date(valueToClone.getTime());
|
|
66
|
+
if (valueToClone instanceof RegExp) {
|
|
67
|
+
const result = new RegExp(valueToClone.source, valueToClone.flags);
|
|
68
|
+
result.lastIndex = valueToClone.lastIndex;
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
if (valueToClone instanceof Map) {
|
|
72
|
+
const result = /* @__PURE__ */ new Map();
|
|
73
|
+
stack.set(valueToClone, result);
|
|
74
|
+
for (const [key, value] of valueToClone) result.set(key, deepCloneImpl(value, objectToClone, stack));
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
if (valueToClone instanceof Set) {
|
|
78
|
+
const result = /* @__PURE__ */ new Set();
|
|
79
|
+
stack.set(valueToClone, result);
|
|
80
|
+
for (const value of valueToClone) result.add(deepCloneImpl(value, objectToClone, stack));
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
if (typeof Buffer !== "undefined" && Buffer.isBuffer(valueToClone)) return valueToClone.subarray();
|
|
84
|
+
if (isTypedArray(valueToClone)) {
|
|
85
|
+
const result = new (Object.getPrototypeOf(valueToClone)).constructor(valueToClone.length);
|
|
86
|
+
stack.set(valueToClone, result);
|
|
87
|
+
for (let i = 0; i < valueToClone.length; i++) result[i] = deepCloneImpl(valueToClone[i], objectToClone, stack);
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
if (valueToClone instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && valueToClone instanceof SharedArrayBuffer) return valueToClone.slice(0);
|
|
91
|
+
if (valueToClone instanceof DataView) {
|
|
92
|
+
const result = new DataView(valueToClone.buffer.slice(0), valueToClone.byteOffset, valueToClone.byteLength);
|
|
93
|
+
stack.set(valueToClone, result);
|
|
94
|
+
copyProperties(result, valueToClone, objectToClone, stack);
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
if (typeof File !== "undefined" && valueToClone instanceof File) {
|
|
98
|
+
const result = new File([valueToClone], valueToClone.name, { type: valueToClone.type });
|
|
99
|
+
stack.set(valueToClone, result);
|
|
100
|
+
copyProperties(result, valueToClone, objectToClone, stack);
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
if (valueToClone instanceof Blob) {
|
|
104
|
+
const result = new Blob([valueToClone], { type: valueToClone.type });
|
|
105
|
+
stack.set(valueToClone, result);
|
|
106
|
+
copyProperties(result, valueToClone, objectToClone, stack);
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
if (valueToClone instanceof Error) {
|
|
110
|
+
const result = new valueToClone.constructor(valueToClone.message, { cause: valueToClone.cause });
|
|
111
|
+
stack.set(valueToClone, result);
|
|
112
|
+
if (hasOwn(valueToClone, "name")) result.name = valueToClone.name;
|
|
113
|
+
result.stack = valueToClone.stack;
|
|
114
|
+
copyProperties(result, valueToClone, objectToClone, stack);
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
/* istanbul ignore if -- @preserve */
|
|
118
|
+
if (typeof valueToClone === "object" && valueToClone !== null) {
|
|
119
|
+
const result = Object.create(Object.getPrototypeOf(valueToClone));
|
|
120
|
+
stack.set(valueToClone, result);
|
|
121
|
+
copyProperties(result, valueToClone, objectToClone, stack);
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
/* istanbul ignore next -- @preserve */
|
|
125
|
+
return valueToClone;
|
|
126
|
+
}
|
|
127
|
+
function copyProperties(target, source, objectToClone = target, stack) {
|
|
128
|
+
const keys = [...Object.keys(source), ...getSymbols(source)];
|
|
129
|
+
for (let i = 0; i < keys.length; i++) {
|
|
130
|
+
const key = keys[i];
|
|
131
|
+
const descriptor = Object.getOwnPropertyDescriptor(target, key);
|
|
132
|
+
if (descriptor == null || descriptor.writable) target[key] = deepCloneImpl(source[key], objectToClone, stack);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function getSymbols(object) {
|
|
136
|
+
return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
|
137
|
+
}
|
|
138
|
+
function deepClone(source) {
|
|
139
|
+
return deepCloneImpl(source, source, /* @__PURE__ */ new Map());
|
|
140
|
+
}
|
|
141
|
+
function deepEqual(v1, v2) {
|
|
142
|
+
const type1 = getTypeName(v1);
|
|
143
|
+
const type2 = getTypeName(v2);
|
|
144
|
+
if (type1 !== type2) return false;
|
|
145
|
+
if (type1 === "array") {
|
|
146
|
+
if (v1.length !== v2.length) return false;
|
|
147
|
+
return v1.every((item, index) => deepEqual(item, v2[index]));
|
|
148
|
+
}
|
|
149
|
+
if (type1 === "object") {
|
|
150
|
+
const keys1 = Object.keys(v1);
|
|
151
|
+
if (keys1.length !== Object.keys(v2).length) return false;
|
|
152
|
+
return keys1.every((key) => deepEqual(v1[key], v2[key]));
|
|
153
|
+
}
|
|
154
|
+
return Object.is(v1, v2);
|
|
155
|
+
}
|
|
156
|
+
function random(...args) {
|
|
157
|
+
let min, max, float;
|
|
158
|
+
if (args.length === 1) {
|
|
159
|
+
min = 0;
|
|
160
|
+
max = args[0];
|
|
161
|
+
float = false;
|
|
162
|
+
} else if (typeof args[1] === "number") {
|
|
163
|
+
min = args[0];
|
|
164
|
+
max = args[1];
|
|
165
|
+
float = !!args[2];
|
|
166
|
+
} else {
|
|
167
|
+
min = 0;
|
|
168
|
+
max = args[0];
|
|
169
|
+
float = !!args[1];
|
|
170
|
+
}
|
|
171
|
+
const num = Math.random() * (max - min) + min;
|
|
172
|
+
return float ? num : Math.floor(num);
|
|
173
|
+
}
|
|
174
|
+
async function sleep(ms, callback) {
|
|
175
|
+
return new Promise((resolve) => setTimeout(async () => {
|
|
176
|
+
await callback?.();
|
|
177
|
+
resolve();
|
|
178
|
+
}, ms));
|
|
179
|
+
}
|
|
180
|
+
function promiseParallel(promises, concurrency = Number.POSITIVE_INFINITY) {
|
|
181
|
+
promises = Array.from(promises);
|
|
182
|
+
let current = 0;
|
|
183
|
+
const result = [];
|
|
184
|
+
let resolvedCount = 0;
|
|
185
|
+
const len = promises.length;
|
|
186
|
+
return new Promise((resolve, reject) => {
|
|
187
|
+
function next() {
|
|
188
|
+
const index = current++;
|
|
189
|
+
const promise = promises[index];
|
|
190
|
+
Promise.resolve(isFunction(promise) ? promise() : promise).then((res) => {
|
|
191
|
+
result[index] = res;
|
|
192
|
+
if (++resolvedCount === len) resolve(result);
|
|
193
|
+
if (current < len) next();
|
|
194
|
+
}).catch((reason) => reject(reason));
|
|
195
|
+
}
|
|
196
|
+
for (let i = 0; i < concurrency && i < len; i++) next();
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function timestamp() {
|
|
200
|
+
return +Date.now();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
//#endregion
|
|
204
|
+
export { deepClone, deepEqual, isArray, isBoolean, isEmptyObject, isFunction, isPlainObject, isString, promiseParallel, random, sleep, sortBy, timestamp, toArray, uniq };
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
//#region ../node_modules/.pnpm/@pengzhanbo+utils@2.1.0/node_modules/@pengzhanbo/utils/dist/index.mjs
|
|
26
|
+
function toString(s) {
|
|
27
|
+
return Object.prototype.toString.call(s);
|
|
28
|
+
}
|
|
29
|
+
function getTypeName(s) {
|
|
30
|
+
return s === null ? "null" : typeof s === "object" || typeof s === "function" ? toString(s).slice(8, -1).toLowerCase() : typeof s;
|
|
31
|
+
}
|
|
32
|
+
function isPrimitive(v) {
|
|
33
|
+
return v === null || typeof v !== "object" && typeof v !== "function";
|
|
34
|
+
}
|
|
35
|
+
function isBoolean(v) {
|
|
36
|
+
return typeof v === "boolean";
|
|
37
|
+
}
|
|
38
|
+
function isFunction(v) {
|
|
39
|
+
return typeof v === "function";
|
|
40
|
+
}
|
|
41
|
+
function isString(v) {
|
|
42
|
+
return typeof v === "string";
|
|
43
|
+
}
|
|
44
|
+
function isPlainObject(v) {
|
|
45
|
+
return getTypeName(v) === "object";
|
|
46
|
+
}
|
|
47
|
+
function isArray(v) {
|
|
48
|
+
return Array.isArray(v);
|
|
49
|
+
}
|
|
50
|
+
function isEmptyObject(v) {
|
|
51
|
+
if (!isPlainObject(v)) return false;
|
|
52
|
+
for (const _ in v) return false;
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
function isTypedArray(v) {
|
|
56
|
+
return ArrayBuffer.isView(v) && !(v instanceof DataView);
|
|
57
|
+
}
|
|
58
|
+
function toArray(v) {
|
|
59
|
+
if (v === null || v === void 0) return [];
|
|
60
|
+
if (isArray(v)) return v;
|
|
61
|
+
return [v];
|
|
62
|
+
}
|
|
63
|
+
function uniq(v) {
|
|
64
|
+
return Array.from(new Set(v));
|
|
65
|
+
}
|
|
66
|
+
function sortBy(array, cb) {
|
|
67
|
+
if (array.length === 0) return [];
|
|
68
|
+
return array.sort((a, b) => {
|
|
69
|
+
const s1 = cb(a);
|
|
70
|
+
const s2 = cb(b);
|
|
71
|
+
return s1 > s2 ? 1 : s2 > s1 ? -1 : 0;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function hasOwn(obj, key) {
|
|
75
|
+
return obj === null ? false : Object.prototype.hasOwnProperty.call(obj, key);
|
|
76
|
+
}
|
|
77
|
+
function deepCloneImpl(valueToClone, objectToClone, stack = /* @__PURE__ */ new Map()) {
|
|
78
|
+
if (isPrimitive(valueToClone)) return valueToClone;
|
|
79
|
+
/* istanbul ignore if -- @preserve */
|
|
80
|
+
if (stack.has(valueToClone)) return stack.get(valueToClone);
|
|
81
|
+
if (Array.isArray(valueToClone)) {
|
|
82
|
+
const result = Array.from({ length: valueToClone.length });
|
|
83
|
+
stack.set(valueToClone, result);
|
|
84
|
+
for (let i = 0; i < valueToClone.length; i++) result[i] = deepCloneImpl(valueToClone[i], objectToClone, stack);
|
|
85
|
+
if (Object.hasOwn(valueToClone, "index")) result.index = valueToClone.index;
|
|
86
|
+
if (Object.hasOwn(valueToClone, "input")) result.input = valueToClone.input;
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
if (valueToClone instanceof Date) return new Date(valueToClone.getTime());
|
|
90
|
+
if (valueToClone instanceof RegExp) {
|
|
91
|
+
const result = new RegExp(valueToClone.source, valueToClone.flags);
|
|
92
|
+
result.lastIndex = valueToClone.lastIndex;
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
if (valueToClone instanceof Map) {
|
|
96
|
+
const result = /* @__PURE__ */ new Map();
|
|
97
|
+
stack.set(valueToClone, result);
|
|
98
|
+
for (const [key, value] of valueToClone) result.set(key, deepCloneImpl(value, objectToClone, stack));
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
if (valueToClone instanceof Set) {
|
|
102
|
+
const result = /* @__PURE__ */ new Set();
|
|
103
|
+
stack.set(valueToClone, result);
|
|
104
|
+
for (const value of valueToClone) result.add(deepCloneImpl(value, objectToClone, stack));
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
if (typeof Buffer !== "undefined" && Buffer.isBuffer(valueToClone)) return valueToClone.subarray();
|
|
108
|
+
if (isTypedArray(valueToClone)) {
|
|
109
|
+
const result = new (Object.getPrototypeOf(valueToClone)).constructor(valueToClone.length);
|
|
110
|
+
stack.set(valueToClone, result);
|
|
111
|
+
for (let i = 0; i < valueToClone.length; i++) result[i] = deepCloneImpl(valueToClone[i], objectToClone, stack);
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
if (valueToClone instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && valueToClone instanceof SharedArrayBuffer) return valueToClone.slice(0);
|
|
115
|
+
if (valueToClone instanceof DataView) {
|
|
116
|
+
const result = new DataView(valueToClone.buffer.slice(0), valueToClone.byteOffset, valueToClone.byteLength);
|
|
117
|
+
stack.set(valueToClone, result);
|
|
118
|
+
copyProperties(result, valueToClone, objectToClone, stack);
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
if (typeof File !== "undefined" && valueToClone instanceof File) {
|
|
122
|
+
const result = new File([valueToClone], valueToClone.name, { type: valueToClone.type });
|
|
123
|
+
stack.set(valueToClone, result);
|
|
124
|
+
copyProperties(result, valueToClone, objectToClone, stack);
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
if (valueToClone instanceof Blob) {
|
|
128
|
+
const result = new Blob([valueToClone], { type: valueToClone.type });
|
|
129
|
+
stack.set(valueToClone, result);
|
|
130
|
+
copyProperties(result, valueToClone, objectToClone, stack);
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
if (valueToClone instanceof Error) {
|
|
134
|
+
const result = new valueToClone.constructor(valueToClone.message, { cause: valueToClone.cause });
|
|
135
|
+
stack.set(valueToClone, result);
|
|
136
|
+
if (hasOwn(valueToClone, "name")) result.name = valueToClone.name;
|
|
137
|
+
result.stack = valueToClone.stack;
|
|
138
|
+
copyProperties(result, valueToClone, objectToClone, stack);
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
/* istanbul ignore if -- @preserve */
|
|
142
|
+
if (typeof valueToClone === "object" && valueToClone !== null) {
|
|
143
|
+
const result = Object.create(Object.getPrototypeOf(valueToClone));
|
|
144
|
+
stack.set(valueToClone, result);
|
|
145
|
+
copyProperties(result, valueToClone, objectToClone, stack);
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
148
|
+
/* istanbul ignore next -- @preserve */
|
|
149
|
+
return valueToClone;
|
|
150
|
+
}
|
|
151
|
+
function copyProperties(target, source, objectToClone = target, stack) {
|
|
152
|
+
const keys = [...Object.keys(source), ...getSymbols(source)];
|
|
153
|
+
for (let i = 0; i < keys.length; i++) {
|
|
154
|
+
const key = keys[i];
|
|
155
|
+
const descriptor = Object.getOwnPropertyDescriptor(target, key);
|
|
156
|
+
if (descriptor == null || descriptor.writable) target[key] = deepCloneImpl(source[key], objectToClone, stack);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function getSymbols(object) {
|
|
160
|
+
return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
|
161
|
+
}
|
|
162
|
+
function deepClone(source) {
|
|
163
|
+
return deepCloneImpl(source, source, /* @__PURE__ */ new Map());
|
|
164
|
+
}
|
|
165
|
+
function deepEqual(v1, v2) {
|
|
166
|
+
const type1 = getTypeName(v1);
|
|
167
|
+
const type2 = getTypeName(v2);
|
|
168
|
+
if (type1 !== type2) return false;
|
|
169
|
+
if (type1 === "array") {
|
|
170
|
+
if (v1.length !== v2.length) return false;
|
|
171
|
+
return v1.every((item, index) => deepEqual(item, v2[index]));
|
|
172
|
+
}
|
|
173
|
+
if (type1 === "object") {
|
|
174
|
+
const keys1 = Object.keys(v1);
|
|
175
|
+
if (keys1.length !== Object.keys(v2).length) return false;
|
|
176
|
+
return keys1.every((key) => deepEqual(v1[key], v2[key]));
|
|
177
|
+
}
|
|
178
|
+
return Object.is(v1, v2);
|
|
179
|
+
}
|
|
180
|
+
function random(...args) {
|
|
181
|
+
let min, max, float;
|
|
182
|
+
if (args.length === 1) {
|
|
183
|
+
min = 0;
|
|
184
|
+
max = args[0];
|
|
185
|
+
float = false;
|
|
186
|
+
} else if (typeof args[1] === "number") {
|
|
187
|
+
min = args[0];
|
|
188
|
+
max = args[1];
|
|
189
|
+
float = !!args[2];
|
|
190
|
+
} else {
|
|
191
|
+
min = 0;
|
|
192
|
+
max = args[0];
|
|
193
|
+
float = !!args[1];
|
|
194
|
+
}
|
|
195
|
+
const num = Math.random() * (max - min) + min;
|
|
196
|
+
return float ? num : Math.floor(num);
|
|
197
|
+
}
|
|
198
|
+
async function sleep(ms, callback) {
|
|
199
|
+
return new Promise((resolve) => setTimeout(async () => {
|
|
200
|
+
await callback?.();
|
|
201
|
+
resolve();
|
|
202
|
+
}, ms));
|
|
203
|
+
}
|
|
204
|
+
function promiseParallel(promises, concurrency = Number.POSITIVE_INFINITY) {
|
|
205
|
+
promises = Array.from(promises);
|
|
206
|
+
let current = 0;
|
|
207
|
+
const result = [];
|
|
208
|
+
let resolvedCount = 0;
|
|
209
|
+
const len = promises.length;
|
|
210
|
+
return new Promise((resolve, reject) => {
|
|
211
|
+
function next() {
|
|
212
|
+
const index = current++;
|
|
213
|
+
const promise = promises[index];
|
|
214
|
+
Promise.resolve(isFunction(promise) ? promise() : promise).then((res) => {
|
|
215
|
+
result[index] = res;
|
|
216
|
+
if (++resolvedCount === len) resolve(result);
|
|
217
|
+
if (current < len) next();
|
|
218
|
+
}).catch((reason) => reject(reason));
|
|
219
|
+
}
|
|
220
|
+
for (let i = 0; i < concurrency && i < len; i++) next();
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
function timestamp() {
|
|
224
|
+
return +Date.now();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
//#endregion
|
|
228
|
+
Object.defineProperty(exports, '__toESM', {
|
|
229
|
+
enumerable: true,
|
|
230
|
+
get: function () {
|
|
231
|
+
return __toESM;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
Object.defineProperty(exports, 'deepClone', {
|
|
235
|
+
enumerable: true,
|
|
236
|
+
get: function () {
|
|
237
|
+
return deepClone;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
Object.defineProperty(exports, 'deepEqual', {
|
|
241
|
+
enumerable: true,
|
|
242
|
+
get: function () {
|
|
243
|
+
return deepEqual;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
Object.defineProperty(exports, 'isArray', {
|
|
247
|
+
enumerable: true,
|
|
248
|
+
get: function () {
|
|
249
|
+
return isArray;
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
Object.defineProperty(exports, 'isBoolean', {
|
|
253
|
+
enumerable: true,
|
|
254
|
+
get: function () {
|
|
255
|
+
return isBoolean;
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
Object.defineProperty(exports, 'isEmptyObject', {
|
|
259
|
+
enumerable: true,
|
|
260
|
+
get: function () {
|
|
261
|
+
return isEmptyObject;
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
Object.defineProperty(exports, 'isFunction', {
|
|
265
|
+
enumerable: true,
|
|
266
|
+
get: function () {
|
|
267
|
+
return isFunction;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
Object.defineProperty(exports, 'isPlainObject', {
|
|
271
|
+
enumerable: true,
|
|
272
|
+
get: function () {
|
|
273
|
+
return isPlainObject;
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
Object.defineProperty(exports, 'isString', {
|
|
277
|
+
enumerable: true,
|
|
278
|
+
get: function () {
|
|
279
|
+
return isString;
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
Object.defineProperty(exports, 'promiseParallel', {
|
|
283
|
+
enumerable: true,
|
|
284
|
+
get: function () {
|
|
285
|
+
return promiseParallel;
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
Object.defineProperty(exports, 'random', {
|
|
289
|
+
enumerable: true,
|
|
290
|
+
get: function () {
|
|
291
|
+
return random;
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
Object.defineProperty(exports, 'sleep', {
|
|
295
|
+
enumerable: true,
|
|
296
|
+
get: function () {
|
|
297
|
+
return sleep;
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
Object.defineProperty(exports, 'sortBy', {
|
|
301
|
+
enumerable: true,
|
|
302
|
+
get: function () {
|
|
303
|
+
return sortBy;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
Object.defineProperty(exports, 'timestamp', {
|
|
307
|
+
enumerable: true,
|
|
308
|
+
get: function () {
|
|
309
|
+
return timestamp;
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
Object.defineProperty(exports, 'toArray', {
|
|
313
|
+
enumerable: true,
|
|
314
|
+
get: function () {
|
|
315
|
+
return toArray;
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
Object.defineProperty(exports, 'uniq', {
|
|
319
|
+
enumerable: true,
|
|
320
|
+
get: function () {
|
|
321
|
+
return uniq;
|
|
322
|
+
}
|
|
323
|
+
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const node_stream = require_chunk.__toESM(require("node:stream"));
|
|
1
|
+
const require_dist = require('./dist-DrfpZ4UT.cjs');
|
|
2
|
+
const node_stream = require_dist.__toESM(require("node:stream"));
|
|
4
3
|
|
|
5
4
|
//#region src/core/defineMock.ts
|
|
6
5
|
function defineMock(config) {
|
|
@@ -24,7 +23,7 @@ function defineMock(config) {
|
|
|
24
23
|
*/
|
|
25
24
|
function createDefineMock(transformer) {
|
|
26
25
|
const define = (config) => {
|
|
27
|
-
if (
|
|
26
|
+
if (require_dist.isArray(config)) config = config.map((item) => transformer(item) || item);
|
|
28
27
|
else config = transformer(config) || config;
|
|
29
28
|
return config;
|
|
30
29
|
};
|
|
@@ -42,14 +41,14 @@ var CacheImpl = class {
|
|
|
42
41
|
#lastUpdate;
|
|
43
42
|
constructor(value) {
|
|
44
43
|
this.value = value;
|
|
45
|
-
this.#initialValue =
|
|
44
|
+
this.#initialValue = require_dist.deepClone(value);
|
|
46
45
|
this.#lastUpdate = Date.now();
|
|
47
46
|
}
|
|
48
47
|
hotUpdate(value) {
|
|
49
48
|
if (Date.now() - this.#lastUpdate < staleInterval) return;
|
|
50
|
-
if (!
|
|
49
|
+
if (!require_dist.deepEqual(value, this.#initialValue)) {
|
|
51
50
|
this.value = value;
|
|
52
|
-
this.#initialValue =
|
|
51
|
+
this.#initialValue = require_dist.deepClone(value);
|
|
53
52
|
this.#lastUpdate = Date.now();
|
|
54
53
|
}
|
|
55
54
|
}
|
|
@@ -60,7 +59,7 @@ function defineMockData(key, initialData) {
|
|
|
60
59
|
cache.hotUpdate(initialData);
|
|
61
60
|
if (responseCache.has(cache)) return responseCache.get(cache);
|
|
62
61
|
const res = [() => cache.value, (val) => {
|
|
63
|
-
if (
|
|
62
|
+
if (require_dist.isFunction(val)) val = val(cache.value) ?? cache.value;
|
|
64
63
|
cache.value = val;
|
|
65
64
|
}];
|
|
66
65
|
Object.defineProperty(res, "value", {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MockHttpItem, MockOptions, MockWebsocketItem } from "./types-
|
|
1
|
+
import { MockHttpItem, MockOptions, MockWebsocketItem } from "./types-BbbTJG0b.js";
|
|
2
2
|
import { Transform } from "node:stream";
|
|
3
3
|
import { IncomingMessage, OutgoingHttpHeaders, ServerResponse } from "node:http";
|
|
4
4
|
|
package/dist/helper.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
require('./dist-DrfpZ4UT.cjs');
|
|
2
|
+
const require_helper = require('./helper-CCVedLL0.cjs');
|
|
2
3
|
|
|
3
4
|
exports.createDefineMock = require_helper.createDefineMock;
|
|
4
5
|
exports.createSSEStream = require_helper.createSSEStream;
|
package/dist/helper.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { MockHttpItem, MockOptions, MockRequest, MockWebsocketItem } from "./types-
|
|
2
|
-
import { HeaderStream, MockData, SSEMessage, createDefineMock, createSSEStream, defineMock, defineMockData } from "./helper-
|
|
1
|
+
import { MockHttpItem, MockOptions, MockRequest, MockWebsocketItem } from "./types-BbbTJG0b.js";
|
|
2
|
+
import { HeaderStream, MockData, SSEMessage, createDefineMock, createSSEStream, defineMock, defineMockData } from "./helper-r_bW1AY8.js";
|
|
3
3
|
export { HeaderStream, MockData, MockHttpItem, MockOptions, MockRequest, MockWebsocketItem, SSEMessage, createDefineMock, createSSEStream, defineMock, defineMockData };
|
package/dist/helper.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./dist-CAA1v47s.js";
|
|
2
|
+
import { createDefineMock, createSSEStream, defineMock, defineMockData } from "./helper-DhHU-YoO.js";
|
|
2
3
|
|
|
3
4
|
export { createDefineMock, createSSEStream, defineMock, defineMockData };
|
package/dist/index.cjs
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const
|
|
3
|
-
const require_helper = require('./helper-
|
|
4
|
-
const require_server = require('./server-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const chokidar = require_chunk.__toESM(require("chokidar"));
|
|
2
|
+
const require_dist = require('./dist-DrfpZ4UT.cjs');
|
|
3
|
+
const require_helper = require('./helper-CCVedLL0.cjs');
|
|
4
|
+
const require_server = require('./server-BwOfV_62.cjs');
|
|
5
|
+
const picocolors = require_dist.__toESM(require("picocolors"));
|
|
6
|
+
const node_fs = require_dist.__toESM(require("node:fs"));
|
|
7
|
+
const node_fs_promises = require_dist.__toESM(require("node:fs/promises"));
|
|
8
|
+
const node_path = require_dist.__toESM(require("node:path"));
|
|
9
|
+
const node_process = require_dist.__toESM(require("node:process"));
|
|
10
|
+
const __rollup_pluginutils = require_dist.__toESM(require("@rollup/pluginutils"));
|
|
11
|
+
const fast_glob = require_dist.__toESM(require("fast-glob"));
|
|
12
|
+
const is_core_module = require_dist.__toESM(require("is-core-module"));
|
|
13
|
+
const node_url = require_dist.__toESM(require("node:url"));
|
|
14
|
+
const esbuild = require_dist.__toESM(require("esbuild"));
|
|
15
|
+
const json5 = require_dist.__toESM(require("json5"));
|
|
16
|
+
const path_to_regexp = require_dist.__toESM(require("path-to-regexp"));
|
|
17
|
+
const cors = require_dist.__toESM(require("cors"));
|
|
18
|
+
const node_events = require_dist.__toESM(require("node:events"));
|
|
19
|
+
const chokidar = require_dist.__toESM(require("chokidar"));
|
|
21
20
|
|
|
22
21
|
//#region src/core/compiler.ts
|
|
23
22
|
const externalizeDeps = {
|
|
@@ -152,8 +151,8 @@ async function loadFromCode({ filepath, code, isESM, cwd }) {
|
|
|
152
151
|
//#endregion
|
|
153
152
|
//#region src/core/build.ts
|
|
154
153
|
async function generateMockServer(ctx, options) {
|
|
155
|
-
const include =
|
|
156
|
-
const exclude =
|
|
154
|
+
const include = require_dist.toArray(options.include);
|
|
155
|
+
const exclude = require_dist.toArray(options.exclude);
|
|
157
156
|
const cwd = options.cwd || node_process.default.cwd();
|
|
158
157
|
let pkg = {};
|
|
159
158
|
try {
|
|
@@ -205,7 +204,7 @@ async function generateMockServer(ctx, options) {
|
|
|
205
204
|
function getMockDependencies(deps, alias) {
|
|
206
205
|
const list = /* @__PURE__ */ new Set();
|
|
207
206
|
const excludeDeps = [
|
|
208
|
-
|
|
207
|
+
"vite-plugin-mock-dev-server",
|
|
209
208
|
"connect",
|
|
210
209
|
"cors"
|
|
211
210
|
];
|
|
@@ -236,7 +235,7 @@ function generatePackageJson(pkg, mockDeps) {
|
|
|
236
235
|
scripts: { start: "node index.js" },
|
|
237
236
|
dependencies: {
|
|
238
237
|
connect: "^3.7.0",
|
|
239
|
-
[
|
|
238
|
+
["vite-plugin-mock-dev-server"]: `^1.9.1`,
|
|
240
239
|
cors: "^2.8.5"
|
|
241
240
|
},
|
|
242
241
|
pnpm: { peerDependencyRules: { ignoreMissing: ["vite"] } }
|
|
@@ -337,7 +336,7 @@ var MockCompiler = class extends node_events.default {
|
|
|
337
336
|
* 过滤包含文件
|
|
338
337
|
*/
|
|
339
338
|
const includeFilter = (0, __rollup_pluginutils.createFilter)(include, exclude, { resolve: false });
|
|
340
|
-
(0, fast_glob.default)(include, { cwd: this.cwd }).then((files) => files.filter(includeFilter).map((file) => () => this.loadMock(file))).then((loadList) =>
|
|
339
|
+
(0, fast_glob.default)(include, { cwd: this.cwd }).then((files) => files.filter(includeFilter).map((file) => () => this.loadMock(file))).then((loadList) => require_dist.promiseParallel(loadList, 10)).then(() => this.updateMockList());
|
|
341
340
|
this.watchMockEntry();
|
|
342
341
|
this.watchDeps();
|
|
343
342
|
let timer = null;
|
|
@@ -360,7 +359,7 @@ var MockCompiler = class extends node_events.default {
|
|
|
360
359
|
}
|
|
361
360
|
watchMockEntry() {
|
|
362
361
|
const { include } = this.options;
|
|
363
|
-
const [firstGlob, ...otherGlob] =
|
|
362
|
+
const [firstGlob, ...otherGlob] = require_dist.toArray(include);
|
|
364
363
|
const watcher = this.mockWatcher = chokidar.default.watch(firstGlob, {
|
|
365
364
|
ignoreInitial: true,
|
|
366
365
|
cwd: this.cwd
|
|
@@ -596,10 +595,10 @@ function resolvePluginOptions({ prefix = [], wsPrefix = [], cwd, include = ["moc
|
|
|
596
595
|
"**/.vscode/**",
|
|
597
596
|
"**/.git/**"
|
|
598
597
|
], reload = false, log = "info", cors: cors$2 = true, formidableOptions = {}, build: build$1 = false, cookiesOptions = {}, bodyParserOptions = {}, priority = {} }, config) {
|
|
599
|
-
const logger = require_server.createLogger("vite:mock",
|
|
598
|
+
const logger = require_server.createLogger("vite:mock", require_dist.isBoolean(log) ? log ? "info" : "error" : log);
|
|
600
599
|
const { httpProxies } = require_server.ensureProxies(config.server.proxy || {});
|
|
601
|
-
const proxies =
|
|
602
|
-
const wsProxies =
|
|
600
|
+
const proxies = require_dist.uniq([...require_dist.toArray(prefix), ...httpProxies]);
|
|
601
|
+
const wsProxies = require_dist.toArray(wsPrefix);
|
|
603
602
|
if (!proxies.length && !wsProxies.length) logger.warn(`No proxy was configured, mock server will not work. See ${picocolors.default.cyan("https://vite-plugin-mock-dev-server.netlify.app/guide/usage")}`);
|
|
604
603
|
const enabled = cors$2 === false ? false : config.server.cors !== false;
|
|
605
604
|
let corsOptions = {};
|
|
@@ -613,7 +612,7 @@ function resolvePluginOptions({ prefix = [], wsPrefix = [], cwd, include = ["moc
|
|
|
613
612
|
};
|
|
614
613
|
const alias = [];
|
|
615
614
|
const aliasConfig = config.resolve.alias || [];
|
|
616
|
-
if (
|
|
615
|
+
if (require_dist.isArray(aliasConfig)) alias.push(...aliasConfig);
|
|
617
616
|
else Object.entries(aliasConfig).forEach(([find, replacement]) => {
|
|
618
617
|
alias.push({
|
|
619
618
|
find,
|
|
@@ -680,7 +679,7 @@ function serverPlugin(options) {
|
|
|
680
679
|
enforce: "pre",
|
|
681
680
|
apply: "serve",
|
|
682
681
|
config(config) {
|
|
683
|
-
const wsPrefix =
|
|
682
|
+
const wsPrefix = require_dist.toArray(options.wsPrefix);
|
|
684
683
|
if (wsPrefix.length && config.server?.proxy) {
|
|
685
684
|
const proxy = {};
|
|
686
685
|
Object.keys(config.server.proxy).forEach((key) => {
|
package/dist/index.d.cts
CHANGED
|
@@ -12,4 +12,4 @@ declare function mockDevServerPlugin(options?: MockServerPluginOptions): Plugin[
|
|
|
12
12
|
*/
|
|
13
13
|
declare function mockDevServerPluginWithDefaultExportWasDeprecated(options?: MockServerPluginOptions): Plugin[];
|
|
14
14
|
//#endregion
|
|
15
|
-
export { BaseMiddlewareOptions, FormidableFile, HeaderStream, Logger, MockData, MockHttpItem, MockOptions, MockRequest, MockServerPluginOptions, MockWebsocketItem, SSEMessage, baseMiddleware, createDefineMock, createLogger, createSSEStream, mockDevServerPluginWithDefaultExportWasDeprecated as default, defineMock, defineMockData, logLevels, mockDevServerPlugin, mockWebSocket, sortByValidator, transformMockData, transformRawData };
|
|
15
|
+
export { BaseMiddlewareOptions, type FormidableFile, HeaderStream, Logger, MockData, type MockHttpItem, type MockOptions, type MockRequest, type MockServerPluginOptions, type MockWebsocketItem, SSEMessage, baseMiddleware, createDefineMock, createLogger, createSSEStream, mockDevServerPluginWithDefaultExportWasDeprecated as default, defineMock, defineMockData, logLevels, mockDevServerPlugin, mockWebSocket, sortByValidator, transformMockData, transformRawData };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FormidableFile, MockHttpItem, MockOptions, MockRequest, MockServerPluginOptions, MockWebsocketItem } from "./types-
|
|
2
|
-
import { HeaderStream, MockData, SSEMessage, createDefineMock, createSSEStream, defineMock, defineMockData } from "./helper-
|
|
3
|
-
import { BaseMiddlewareOptions, Logger, baseMiddleware, createLogger, logLevels, mockWebSocket, sortByValidator, transformMockData, transformRawData } from "./server-
|
|
1
|
+
import { FormidableFile, MockHttpItem, MockOptions, MockRequest, MockServerPluginOptions, MockWebsocketItem } from "./types-BbbTJG0b.js";
|
|
2
|
+
import { HeaderStream, MockData, SSEMessage, createDefineMock, createSSEStream, defineMock, defineMockData } from "./helper-r_bW1AY8.js";
|
|
3
|
+
import { BaseMiddlewareOptions, Logger, baseMiddleware, createLogger, logLevels, mockWebSocket, sortByValidator, transformMockData, transformRawData } from "./server-DgmHgcvl.js";
|
|
4
4
|
import { Plugin } from "vite";
|
|
5
5
|
|
|
6
6
|
//#region src/plugin.d.ts
|
|
@@ -12,4 +12,4 @@ declare function mockDevServerPlugin(options?: MockServerPluginOptions): Plugin[
|
|
|
12
12
|
*/
|
|
13
13
|
declare function mockDevServerPluginWithDefaultExportWasDeprecated(options?: MockServerPluginOptions): Plugin[];
|
|
14
14
|
//#endregion
|
|
15
|
-
export { BaseMiddlewareOptions, FormidableFile, HeaderStream, Logger, MockData, MockHttpItem, MockOptions, MockRequest, MockServerPluginOptions, MockWebsocketItem, SSEMessage, baseMiddleware, createDefineMock, createLogger, createSSEStream, mockDevServerPluginWithDefaultExportWasDeprecated as default, defineMock, defineMockData, logLevels, mockDevServerPlugin, mockWebSocket, sortByValidator, transformMockData, transformRawData };
|
|
15
|
+
export { BaseMiddlewareOptions, type FormidableFile, HeaderStream, Logger, MockData, type MockHttpItem, type MockOptions, type MockRequest, type MockServerPluginOptions, type MockWebsocketItem, SSEMessage, baseMiddleware, createDefineMock, createLogger, createSSEStream, mockDevServerPluginWithDefaultExportWasDeprecated as default, defineMock, defineMockData, logLevels, mockDevServerPlugin, mockWebSocket, sortByValidator, transformMockData, transformRawData };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { isArray, isBoolean, promiseParallel, toArray, uniq } from "./dist-CAA1v47s.js";
|
|
2
|
+
import { createDefineMock, createSSEStream, defineMock, defineMockData } from "./helper-DhHU-YoO.js";
|
|
3
|
+
import { baseMiddleware, createLogger, debug, doesProxyContextMatchUrl, ensureProxies, logLevels, lookupFile, mockWebSocket, normalizePath, recoverRequest, sortByValidator, transformMockData, transformRawData, urlParse } from "./server-C-u7jwot.js";
|
|
4
4
|
import pc from "picocolors";
|
|
5
5
|
import fs, { promises } from "node:fs";
|
|
6
6
|
import fsp from "node:fs/promises";
|
|
@@ -203,7 +203,7 @@ async function generateMockServer(ctx, options) {
|
|
|
203
203
|
function getMockDependencies(deps, alias) {
|
|
204
204
|
const list = /* @__PURE__ */ new Set();
|
|
205
205
|
const excludeDeps = [
|
|
206
|
-
|
|
206
|
+
"vite-plugin-mock-dev-server",
|
|
207
207
|
"connect",
|
|
208
208
|
"cors"
|
|
209
209
|
];
|
|
@@ -234,7 +234,7 @@ function generatePackageJson(pkg, mockDeps) {
|
|
|
234
234
|
scripts: { start: "node index.js" },
|
|
235
235
|
dependencies: {
|
|
236
236
|
connect: "^3.7.0",
|
|
237
|
-
[
|
|
237
|
+
["vite-plugin-mock-dev-server"]: `^1.9.1`,
|
|
238
238
|
cors: "^2.8.5"
|
|
239
239
|
},
|
|
240
240
|
pnpm: { peerDependencyRules: { ignoreMissing: ["vite"] } }
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const ws = require_chunk.__toESM(require("ws"));
|
|
1
|
+
const require_dist = require('./dist-DrfpZ4UT.cjs');
|
|
2
|
+
const picocolors = require_dist.__toESM(require("picocolors"));
|
|
3
|
+
const node_fs = require_dist.__toESM(require("node:fs"));
|
|
4
|
+
const node_path = require_dist.__toESM(require("node:path"));
|
|
5
|
+
const node_url = require_dist.__toESM(require("node:url"));
|
|
6
|
+
const node_os = require_dist.__toESM(require("node:os"));
|
|
7
|
+
const node_querystring = require_dist.__toESM(require("node:querystring"));
|
|
8
|
+
const debug = require_dist.__toESM(require("debug"));
|
|
9
|
+
const path_to_regexp = require_dist.__toESM(require("path-to-regexp"));
|
|
10
|
+
const node_buffer = require_dist.__toESM(require("node:buffer"));
|
|
11
|
+
const cookies = require_dist.__toESM(require("cookies"));
|
|
12
|
+
const http_status = require_dist.__toESM(require("http-status"));
|
|
13
|
+
const mime_types = require_dist.__toESM(require("mime-types"));
|
|
14
|
+
const co_body = require_dist.__toESM(require("co-body"));
|
|
15
|
+
const formidable = require_dist.__toESM(require("formidable"));
|
|
16
|
+
const ws = require_dist.__toESM(require("ws"));
|
|
18
17
|
|
|
19
18
|
//#region src/core/utils.ts
|
|
20
19
|
function isStream(stream) {
|
|
@@ -84,7 +83,7 @@ function getTokens(rule) {
|
|
|
84
83
|
if (tokensCache[rule]) return tokensCache[rule];
|
|
85
84
|
const tks = (0, path_to_regexp.parse)(rule);
|
|
86
85
|
const tokens = [];
|
|
87
|
-
for (const tk of tks) if (!
|
|
86
|
+
for (const tk of tks) if (!require_dist.isString(tk)) tokens.push(tk);
|
|
88
87
|
else {
|
|
89
88
|
const hasPrefix = tk[0] === "/";
|
|
90
89
|
const subTks = hasPrefix ? tk.slice(1).split("/") : tk.split("/");
|
|
@@ -103,7 +102,7 @@ function sortFn(rule) {
|
|
|
103
102
|
let w = 0;
|
|
104
103
|
for (let i = 0; i < tokens.length; i++) {
|
|
105
104
|
const token = tokens[i];
|
|
106
|
-
if (!
|
|
105
|
+
if (!require_dist.isString(token)) w += 10 ** (i + 1);
|
|
107
106
|
w += 10 ** (i + 1);
|
|
108
107
|
}
|
|
109
108
|
return w;
|
|
@@ -117,12 +116,12 @@ function preSort(rules) {
|
|
|
117
116
|
if (!preMatch[len]) preMatch[len] = [];
|
|
118
117
|
preMatch[len].push(rule);
|
|
119
118
|
}
|
|
120
|
-
for (const match$1 of preMatch.filter((v) => v && v.length > 0)) matched = [...matched, ...
|
|
119
|
+
for (const match$1 of preMatch.filter((v) => v && v.length > 0)) matched = [...matched, ...require_dist.sortBy(match$1, sortFn).reverse()];
|
|
121
120
|
return matched;
|
|
122
121
|
}
|
|
123
122
|
function defaultPriority(rules) {
|
|
124
123
|
const highest = getHighest(rules);
|
|
125
|
-
return
|
|
124
|
+
return require_dist.sortBy(rules, (rule) => {
|
|
126
125
|
const tokens = getTokens(rule);
|
|
127
126
|
const dym = tokens.filter((token) => typeof token !== "string");
|
|
128
127
|
if (dym.length === 0) return 0;
|
|
@@ -130,11 +129,11 @@ function defaultPriority(rules) {
|
|
|
130
129
|
let exp = 0;
|
|
131
130
|
for (let i = 0; i < tokens.length; i++) {
|
|
132
131
|
const token = tokens[i];
|
|
133
|
-
const isDynamic = !
|
|
132
|
+
const isDynamic = !require_dist.isString(token);
|
|
134
133
|
const { pattern = "", modifier, prefix, name } = isDynamic ? token : {};
|
|
135
134
|
const isGlob = pattern && pattern.includes(".*");
|
|
136
135
|
const isSlash = prefix === "/";
|
|
137
|
-
const isNamed =
|
|
136
|
+
const isNamed = require_dist.isString(name);
|
|
138
137
|
exp += isDynamic && isSlash ? 1 : 0;
|
|
139
138
|
if (i === tokens.length - 1 && isGlob) weight += 5 * 10 ** (tokens.length === 1 ? highest + 1 : highest);
|
|
140
139
|
else if (isGlob) weight += 3 * 10 ** (highest - 1);
|
|
@@ -150,24 +149,24 @@ function defaultPriority(rules) {
|
|
|
150
149
|
function matchingWeight(rules, url, priority) {
|
|
151
150
|
let matched = defaultPriority(preSort(rules.filter((rule) => (0, path_to_regexp.pathToRegexp)(rule).test(url))));
|
|
152
151
|
const { global = [], special = {} } = priority;
|
|
153
|
-
if (global.length === 0 &&
|
|
152
|
+
if (global.length === 0 && require_dist.isEmptyObject(special) || matched.length === 0) return matched;
|
|
154
153
|
const [statics, dynamics] = twoPartMatch(matched);
|
|
155
154
|
const globalMatch = global.filter((rule) => dynamics.includes(rule));
|
|
156
|
-
if (globalMatch.length > 0) matched =
|
|
155
|
+
if (globalMatch.length > 0) matched = require_dist.uniq([
|
|
157
156
|
...statics,
|
|
158
157
|
...globalMatch,
|
|
159
158
|
...dynamics
|
|
160
159
|
]);
|
|
161
|
-
if (
|
|
160
|
+
if (require_dist.isEmptyObject(special)) return matched;
|
|
162
161
|
const specialRule = Object.keys(special).filter((rule) => matched.includes(rule))[0];
|
|
163
162
|
if (!specialRule) return matched;
|
|
164
163
|
const options = special[specialRule];
|
|
165
|
-
const { rules: lowerRules, when } =
|
|
164
|
+
const { rules: lowerRules, when } = require_dist.isArray(options) ? {
|
|
166
165
|
rules: options,
|
|
167
166
|
when: []
|
|
168
167
|
} : options;
|
|
169
168
|
if (lowerRules.includes(matched[0])) {
|
|
170
|
-
if (when.length === 0 || when.some((path$1) => (0, path_to_regexp.pathToRegexp)(path$1).test(url))) matched =
|
|
169
|
+
if (when.length === 0 || when.some((path$1) => (0, path_to_regexp.pathToRegexp)(path$1).test(url))) matched = require_dist.uniq([specialRule, ...matched]);
|
|
171
170
|
}
|
|
172
171
|
return matched;
|
|
173
172
|
}
|
|
@@ -297,7 +296,7 @@ function isObjectSubset(source, target) {
|
|
|
297
296
|
return true;
|
|
298
297
|
}
|
|
299
298
|
function isIncluded(source, target) {
|
|
300
|
-
if (
|
|
299
|
+
if (require_dist.isArray(source) && require_dist.isArray(target)) {
|
|
301
300
|
const seen = /* @__PURE__ */ new Set();
|
|
302
301
|
return target.every((ti) => source.some((si, i) => {
|
|
303
302
|
if (seen.has(i)) return false;
|
|
@@ -306,7 +305,7 @@ function isIncluded(source, target) {
|
|
|
306
305
|
return included;
|
|
307
306
|
}));
|
|
308
307
|
}
|
|
309
|
-
if (
|
|
308
|
+
if (require_dist.isPlainObject(source) && require_dist.isPlainObject(target)) return isObjectSubset(source, target);
|
|
310
309
|
return Object.is(source, target);
|
|
311
310
|
}
|
|
312
311
|
|
|
@@ -314,7 +313,7 @@ function isIncluded(source, target) {
|
|
|
314
313
|
//#region src/core/baseMiddleware.ts
|
|
315
314
|
function baseMiddleware(compiler, { formidableOptions = {}, bodyParserOptions = {}, proxies, cookiesOptions, logger, priority = {} }) {
|
|
316
315
|
return async function(req, res, next) {
|
|
317
|
-
const startTime =
|
|
316
|
+
const startTime = require_dist.timestamp();
|
|
318
317
|
const { query, pathname } = urlParse(req.url);
|
|
319
318
|
if (!pathname || proxies.length === 0 || !proxies.some((context) => doesProxyContextMatchUrl(context, req.url))) return next();
|
|
320
319
|
const mockData = compiler.mockData;
|
|
@@ -366,7 +365,7 @@ function baseMiddleware(compiler, { formidableOptions = {}, bodyParserOptions =
|
|
|
366
365
|
logger.debug(`${picocolors.default.magenta("DEBUG")} ${picocolors.default.underline(pathname)} matches: [ ${mockUrls.map((m) => m === _mockUrl ? picocolors.default.underline(picocolors.default.bold(m)) : picocolors.default.dim(m)).join(", ")} ]\n`);
|
|
367
366
|
if (body) {
|
|
368
367
|
try {
|
|
369
|
-
const content =
|
|
368
|
+
const content = require_dist.isFunction(body) ? await body(request) : body;
|
|
370
369
|
await realDelay(startTime, delay);
|
|
371
370
|
sendData(response, content, type);
|
|
372
371
|
} catch (e) {
|
|
@@ -393,12 +392,12 @@ function baseMiddleware(compiler, { formidableOptions = {}, bodyParserOptions =
|
|
|
393
392
|
function fineMock(mockList, logger, { pathname, method, request }) {
|
|
394
393
|
return mockList.find((mock) => {
|
|
395
394
|
if (!pathname || !mock || !mock.url || mock.ws === true) return false;
|
|
396
|
-
const methods = mock.method ?
|
|
395
|
+
const methods = mock.method ? require_dist.isArray(mock.method) ? mock.method : [mock.method] : ["GET", "POST"];
|
|
397
396
|
if (!methods.includes(method)) return false;
|
|
398
397
|
const hasMock = (0, path_to_regexp.pathToRegexp)(mock.url).test(pathname);
|
|
399
398
|
if (hasMock && mock.validator) {
|
|
400
399
|
const params = parseParams(mock.url, pathname);
|
|
401
|
-
if (
|
|
400
|
+
if (require_dist.isFunction(mock.validator)) return mock.validator({
|
|
402
401
|
params,
|
|
403
402
|
...request
|
|
404
403
|
});
|
|
@@ -430,7 +429,7 @@ async function provideHeaders(req, res, mock, logger) {
|
|
|
430
429
|
if (filepath) res.setHeader("X-File-Path", filepath);
|
|
431
430
|
if (!headers) return;
|
|
432
431
|
try {
|
|
433
|
-
const raw =
|
|
432
|
+
const raw = require_dist.isFunction(headers) ? await headers(req) : headers;
|
|
434
433
|
Object.keys(raw).forEach((key) => {
|
|
435
434
|
res.setHeader(key, raw[key]);
|
|
436
435
|
});
|
|
@@ -443,10 +442,10 @@ async function provideCookies(req, res, mock, logger) {
|
|
|
443
442
|
const filepath = mock.__filepath__;
|
|
444
443
|
if (!cookies$1) return;
|
|
445
444
|
try {
|
|
446
|
-
const raw =
|
|
445
|
+
const raw = require_dist.isFunction(cookies$1) ? await cookies$1(req) : cookies$1;
|
|
447
446
|
Object.keys(raw).forEach((key) => {
|
|
448
447
|
const cookie = raw[key];
|
|
449
|
-
if (
|
|
448
|
+
if (require_dist.isArray(cookie)) {
|
|
450
449
|
const [value, options] = cookie;
|
|
451
450
|
res.setCookie(key, value, options);
|
|
452
451
|
} else res.setCookie(key, cookie);
|
|
@@ -464,13 +463,13 @@ function sendData(res, raw, type) {
|
|
|
464
463
|
}
|
|
465
464
|
}
|
|
466
465
|
async function realDelay(startTime, delay) {
|
|
467
|
-
if (!delay || typeof delay === "number" && delay <= 0 ||
|
|
466
|
+
if (!delay || typeof delay === "number" && delay <= 0 || require_dist.isArray(delay) && delay.length !== 2) return;
|
|
468
467
|
let realDelay$1 = 0;
|
|
469
|
-
if (
|
|
468
|
+
if (require_dist.isArray(delay)) {
|
|
470
469
|
const [min, max] = delay;
|
|
471
|
-
realDelay$1 =
|
|
472
|
-
} else realDelay$1 = delay - (
|
|
473
|
-
if (realDelay$1 > 0) await
|
|
470
|
+
realDelay$1 = require_dist.random(min, max);
|
|
471
|
+
} else realDelay$1 = delay - (require_dist.timestamp() - startTime);
|
|
472
|
+
if (realDelay$1 > 0) await require_dist.sleep(realDelay$1);
|
|
474
473
|
}
|
|
475
474
|
function getHTTPStatusText(status) {
|
|
476
475
|
return http_status.default[status] || "Unknown";
|
|
@@ -480,7 +479,7 @@ function requestLog(request, filepath) {
|
|
|
480
479
|
let { pathname } = new URL(url, "http://example.com");
|
|
481
480
|
pathname = picocolors.default.green(decodeURIComponent(pathname));
|
|
482
481
|
const format = (prefix, data) => {
|
|
483
|
-
return !data ||
|
|
482
|
+
return !data || require_dist.isEmptyObject(data) ? "" : ` ${picocolors.default.gray(`${prefix}:`)}${JSON.stringify(data)}`;
|
|
484
483
|
};
|
|
485
484
|
const ms = picocolors.default.magenta(picocolors.default.bold(method));
|
|
486
485
|
const qs = format("query", query);
|
|
@@ -494,7 +493,7 @@ function requestLog(request, filepath) {
|
|
|
494
493
|
//#region src/core/transform.ts
|
|
495
494
|
function transformRawData(raw, __filepath__) {
|
|
496
495
|
let mockConfig;
|
|
497
|
-
if (
|
|
496
|
+
if (require_dist.isArray(raw)) mockConfig = raw.map((item) => ({
|
|
498
497
|
...item,
|
|
499
498
|
__filepath__
|
|
500
499
|
}));
|
|
@@ -506,7 +505,7 @@ function transformRawData(raw, __filepath__) {
|
|
|
506
505
|
mockConfig = [];
|
|
507
506
|
Object.keys(raw).forEach((key) => {
|
|
508
507
|
const data = raw[key];
|
|
509
|
-
if (
|
|
508
|
+
if (require_dist.isArray(data)) mockConfig.push(...data.map((item) => ({
|
|
510
509
|
...item,
|
|
511
510
|
__filepath__
|
|
512
511
|
})));
|
|
@@ -520,9 +519,9 @@ function transformRawData(raw, __filepath__) {
|
|
|
520
519
|
}
|
|
521
520
|
function transformMockData(mockList) {
|
|
522
521
|
const list = [];
|
|
523
|
-
for (const [, handle] of mockList.entries()) if (handle) list.push(...
|
|
522
|
+
for (const [, handle] of mockList.entries()) if (handle) list.push(...require_dist.toArray(handle));
|
|
524
523
|
const mocks = {};
|
|
525
|
-
list.filter((mock) =>
|
|
524
|
+
list.filter((mock) => require_dist.isPlainObject(mock) && mock.enabled !== false && mock.url).forEach((mock) => {
|
|
526
525
|
const { pathname, query } = urlParse(mock.url);
|
|
527
526
|
const list$1 = mocks[pathname] ??= [];
|
|
528
527
|
const current = {
|
|
@@ -531,7 +530,7 @@ function transformMockData(mockList) {
|
|
|
531
530
|
};
|
|
532
531
|
if (current.ws !== true) {
|
|
533
532
|
const validator = current.validator;
|
|
534
|
-
if (!
|
|
533
|
+
if (!require_dist.isEmptyObject(query)) if (require_dist.isFunction(validator)) current.validator = function(request) {
|
|
535
534
|
return isObjectSubset(request.query, query) && validator(request);
|
|
536
535
|
};
|
|
537
536
|
else if (validator) {
|
|
@@ -550,11 +549,11 @@ function transformMockData(mockList) {
|
|
|
550
549
|
return mocks;
|
|
551
550
|
}
|
|
552
551
|
function sortByValidator(mocks) {
|
|
553
|
-
return
|
|
552
|
+
return require_dist.sortBy(mocks, (item) => {
|
|
554
553
|
if (item.ws === true) return 0;
|
|
555
554
|
const { validator } = item;
|
|
556
|
-
if (!validator ||
|
|
557
|
-
if (
|
|
555
|
+
if (!validator || require_dist.isEmptyObject(validator)) return 2;
|
|
556
|
+
if (require_dist.isFunction(validator)) return 0;
|
|
558
557
|
const count = Object.keys(validator).reduce((prev, key) => prev + keysCount(validator[key]), 0);
|
|
559
558
|
return 1 / count;
|
|
560
559
|
});
|
|
@@ -698,7 +697,7 @@ const logLevels = {
|
|
|
698
697
|
function createLogger(prefix, defaultLevel = "info") {
|
|
699
698
|
prefix = `[${prefix}]`;
|
|
700
699
|
function output(type, msg, level) {
|
|
701
|
-
level =
|
|
700
|
+
level = require_dist.isBoolean(level) ? level ? defaultLevel : "error" : level;
|
|
702
701
|
const thresh = logLevels[level];
|
|
703
702
|
if (thresh >= logLevels[type]) {
|
|
704
703
|
const method = type === "info" || type === "debug" ? "log" : type;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isArray, isBoolean, isEmptyObject, isFunction, isPlainObject, isString, random, sleep, sortBy, timestamp, toArray, uniq } from "
|
|
1
|
+
import { isArray, isBoolean, isEmptyObject, isFunction, isPlainObject, isString, random, sleep, sortBy, timestamp, toArray, uniq } from "./dist-CAA1v47s.js";
|
|
2
2
|
import pc from "picocolors";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LogLevel, MockHttpItem, MockOptions, MockServerPluginOptions, MockWebsocketItem, ServerBuildOption } from "./types-
|
|
1
|
+
import { LogLevel, MockHttpItem, MockOptions, MockServerPluginOptions, MockWebsocketItem, ServerBuildOption } from "./types-BbbTJG0b.js";
|
|
2
2
|
import { CorsOptions } from "cors";
|
|
3
3
|
import EventEmitter from "node:events";
|
|
4
4
|
import { FSWatcher } from "chokidar";
|
package/dist/server.cjs
CHANGED
package/dist/server.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./types-
|
|
2
|
-
import { BaseMiddlewareOptions, Logger, baseMiddleware, createLogger, logLevels, mockWebSocket, sortByValidator, transformMockData, transformRawData } from "./server-
|
|
1
|
+
import "./types-BbbTJG0b.js";
|
|
2
|
+
import { BaseMiddlewareOptions, Logger, baseMiddleware, createLogger, logLevels, mockWebSocket, sortByValidator, transformMockData, transformRawData } from "./server-DgmHgcvl.js";
|
|
3
3
|
export { BaseMiddlewareOptions, Logger, baseMiddleware, createLogger, logLevels, mockWebSocket, sortByValidator, transformMockData, transformRawData };
|
package/dist/server.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./dist-CAA1v47s.js";
|
|
2
|
+
import { baseMiddleware, createLogger, logLevels, mockWebSocket, sortByValidator, transformMockData, transformRawData } from "./server-C-u7jwot.js";
|
|
2
3
|
|
|
3
4
|
export { baseMiddleware, createLogger, logLevels, mockWebSocket, sortByValidator, transformMockData, transformRawData };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-mock-dev-server",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.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",
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@pengzhanbo/utils": "^2.1.0",
|
|
72
71
|
"@rollup/pluginutils": "^5.2.0",
|
|
73
72
|
"chokidar": "3.6.0",
|
|
74
73
|
"co-body": "^6.2.0",
|
|
@@ -83,11 +82,12 @@
|
|
|
83
82
|
"mime-types": "^3.0.1",
|
|
84
83
|
"path-to-regexp": "6.3.0",
|
|
85
84
|
"picocolors": "^1.1.1",
|
|
86
|
-
"ws": "^8.18.
|
|
85
|
+
"ws": "^8.18.3"
|
|
87
86
|
},
|
|
88
87
|
"devDependencies": {
|
|
89
|
-
"
|
|
90
|
-
"
|
|
88
|
+
"@pengzhanbo/utils": "^2.1.0",
|
|
89
|
+
"esbuild": "^0.25.8",
|
|
90
|
+
"vite": "^7.1.1"
|
|
91
91
|
},
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
package/dist/chunk-CUT6urMc.cjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
|
|
25
|
-
Object.defineProperty(exports, '__toESM', {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return __toESM;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
File without changes
|