vite-plugin-mock-dev-server 1.0.4 → 1.0.5

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
@@ -53,7 +53,7 @@ var import_vite = require("vite");
53
53
 
54
54
  // package.json
55
55
  var name = "vite-plugin-mock-dev-server";
56
- var version = "1.0.4";
56
+ var version = "1.0.5";
57
57
 
58
58
  // src/esbuildPlugin.ts
59
59
  var import_promises = __toESM(require("fs/promises"), 1);
@@ -215,7 +215,7 @@ async function generateMockServer(ctx, config, options) {
215
215
  }
216
216
  function getMockDependencies(deps) {
217
217
  const list = /* @__PURE__ */ new Set();
218
- const excludeDeps = [name, "connect"];
218
+ const excludeDeps = [name, "connect", "cors"];
219
219
  Object.keys(deps).forEach((mPath) => {
220
220
  const imports = deps[mPath].imports.filter((_) => _.external).map((_) => _.path);
221
221
  imports.forEach((dep) => {
@@ -273,7 +273,7 @@ async function generateMockEntryCode(cwd, include, exclude) {
273
273
  let importers = "";
274
274
  let exporters = "";
275
275
  mockFiles.forEach((filepath, index) => {
276
- const file = import_node_path3.default.join(cwd, filepath);
276
+ const file = (0, import_vite.normalizePath)(import_node_path3.default.join(cwd, filepath));
277
277
  importers += `import * as m${index} from '${file}';
278
278
  `;
279
279
  exporters += `m${index}, `;
package/dist/index.js CHANGED
@@ -5,11 +5,11 @@ import path3 from "path";
5
5
  import { build } from "esbuild";
6
6
  import fg from "fast-glob";
7
7
  import isCore from "is-core-module";
8
- import { createFilter } from "vite";
8
+ import { createFilter, normalizePath } from "vite";
9
9
 
10
10
  // package.json
11
11
  var name = "vite-plugin-mock-dev-server";
12
- var version = "1.0.4";
12
+ var version = "1.0.5";
13
13
 
14
14
  // src/esbuildPlugin.ts
15
15
  import fsp from "fs/promises";
@@ -171,7 +171,7 @@ async function generateMockServer(ctx, config, options) {
171
171
  }
172
172
  function getMockDependencies(deps) {
173
173
  const list = /* @__PURE__ */ new Set();
174
- const excludeDeps = [name, "connect"];
174
+ const excludeDeps = [name, "connect", "cors"];
175
175
  Object.keys(deps).forEach((mPath) => {
176
176
  const imports = deps[mPath].imports.filter((_) => _.external).map((_) => _.path);
177
177
  imports.forEach((dep) => {
@@ -229,7 +229,7 @@ async function generateMockEntryCode(cwd, include, exclude) {
229
229
  let importers = "";
230
230
  let exporters = "";
231
231
  mockFiles.forEach((filepath, index) => {
232
- const file = path3.join(cwd, filepath);
232
+ const file = normalizePath(path3.join(cwd, filepath));
233
233
  importers += `import * as m${index} from '${file}';
234
234
  `;
235
235
  exporters += `m${index}, `;
@@ -455,7 +455,7 @@ import chokidar from "chokidar";
455
455
  import { build as build2 } from "esbuild";
456
456
  import fastGlob from "fast-glob";
457
457
  import JSON52 from "json5";
458
- import { createFilter as createFilter2, normalizePath } from "vite";
458
+ import { createFilter as createFilter2, normalizePath as normalizePath2 } from "vite";
459
459
 
460
460
  // src/transform.ts
461
461
  import { parse as urlParse2 } from "url";
@@ -544,17 +544,17 @@ var _MockLoader = class extends EventEmitter {
544
544
  });
545
545
  otherGlob.length > 0 && otherGlob.forEach((glob) => watcher.add(glob));
546
546
  watcher.on("add", async (filepath) => {
547
- filepath = normalizePath(filepath);
547
+ filepath = normalizePath2(filepath);
548
548
  this.emit("mock:update", filepath);
549
549
  debug("watcher:add", filepath);
550
550
  });
551
551
  watcher.on("change", async (filepath) => {
552
- filepath = normalizePath(filepath);
552
+ filepath = normalizePath2(filepath);
553
553
  this.emit("mock:update", filepath);
554
554
  debug("watcher:change", filepath);
555
555
  });
556
556
  watcher.on("unlink", async (filepath) => {
557
- filepath = normalizePath(filepath);
557
+ filepath = normalizePath2(filepath);
558
558
  this.emit("mock:unlink", filepath);
559
559
  debug("watcher:unlink", filepath);
560
560
  });
@@ -571,14 +571,14 @@ var _MockLoader = class extends EventEmitter {
571
571
  cwd: this.cwd
572
572
  });
573
573
  this.depsWatcher.on("change", (filepath) => {
574
- filepath = normalizePath(filepath);
574
+ filepath = normalizePath2(filepath);
575
575
  const mockFiles = this.moduleDeps.get(filepath);
576
576
  mockFiles && mockFiles.forEach((file) => {
577
577
  this.emit("mock:update", file);
578
578
  });
579
579
  });
580
580
  this.depsWatcher.on("unlink", (filepath) => {
581
- filepath = normalizePath(filepath);
581
+ filepath = normalizePath2(filepath);
582
582
  this.moduleDeps.delete(filepath);
583
583
  });
584
584
  this.on("update:deps", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-mock-dev-server",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "keywords": [
5
5
  "vite",
6
6
  "plugin",