vite-plugin-mock-dev-server 0.3.6 → 0.3.9

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/index.cjs CHANGED
@@ -274,6 +274,11 @@ var _MockLoader = class extends import_node_events.default {
274
274
  }
275
275
  async transformWithEsbuild(filepath, isESM) {
276
276
  var _a;
277
+ const userDefine = {};
278
+ for (const key in this.options.define) {
279
+ const val = this.options.define[key];
280
+ userDefine[key] = typeof val === "string" ? val : JSON.stringify(val);
281
+ }
277
282
  try {
278
283
  const result = await (0, import_esbuild.build)({
279
284
  entryPoints: [filepath],
@@ -284,7 +289,7 @@ var _MockLoader = class extends import_node_events.default {
284
289
  bundle: true,
285
290
  metafile: true,
286
291
  format: isESM ? "esm" : "cjs",
287
- define: this.options.define,
292
+ define: userDefine,
288
293
  plugins: [
289
294
  {
290
295
  name: "externalize-deps",
@@ -331,7 +336,7 @@ async function parseReqBody(req) {
331
336
  if (type === "text/plain") {
332
337
  return await import_co_body.default.text(req);
333
338
  }
334
- return await (0, import_co_body.default)(req);
339
+ return void 0;
335
340
  }
336
341
 
337
342
  // src/validator.ts
package/dist/index.js CHANGED
@@ -239,6 +239,11 @@ var _MockLoader = class extends EventEmitter {
239
239
  }
240
240
  async transformWithEsbuild(filepath, isESM) {
241
241
  var _a;
242
+ const userDefine = {};
243
+ for (const key in this.options.define) {
244
+ const val = this.options.define[key];
245
+ userDefine[key] = typeof val === "string" ? val : JSON.stringify(val);
246
+ }
242
247
  try {
243
248
  const result = await build({
244
249
  entryPoints: [filepath],
@@ -249,7 +254,7 @@ var _MockLoader = class extends EventEmitter {
249
254
  bundle: true,
250
255
  metafile: true,
251
256
  format: isESM ? "esm" : "cjs",
252
- define: this.options.define,
257
+ define: userDefine,
253
258
  plugins: [
254
259
  {
255
260
  name: "externalize-deps",
@@ -296,7 +301,7 @@ async function parseReqBody(req) {
296
301
  if (type === "text/plain") {
297
302
  return await bodyParser.text(req);
298
303
  }
299
- return await bodyParser(req);
304
+ return void 0;
300
305
  }
301
306
 
302
307
  // src/validator.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-mock-dev-server",
3
- "version": "0.3.6",
3
+ "version": "0.3.9",
4
4
  "keywords": [
5
5
  "vite",
6
6
  "plugin",