vite-plugin-mock-dev-server 0.4.1 → 0.4.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/index.cjs +6 -1
- package/dist/index.js +7 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -52,7 +52,7 @@ var import_vite = require("vite");
|
|
|
52
52
|
|
|
53
53
|
// package.json
|
|
54
54
|
var name = "vite-plugin-mock-dev-server";
|
|
55
|
-
var version = "0.4.
|
|
55
|
+
var version = "0.4.2";
|
|
56
56
|
|
|
57
57
|
// src/esbuildPlugin.ts
|
|
58
58
|
var import_promises = __toESM(require("fs/promises"), 1);
|
|
@@ -551,14 +551,17 @@ var _MockLoader = class extends import_node_events.default {
|
|
|
551
551
|
});
|
|
552
552
|
otherGlob.length > 0 && otherGlob.forEach((glob) => watcher.add(glob));
|
|
553
553
|
watcher.on("add", async (filepath) => {
|
|
554
|
+
filepath = (0, import_vite2.normalizePath)(filepath);
|
|
554
555
|
this.emit("mock:update", filepath);
|
|
555
556
|
debug("watcher:add", filepath);
|
|
556
557
|
});
|
|
557
558
|
watcher.on("change", async (filepath) => {
|
|
559
|
+
filepath = (0, import_vite2.normalizePath)(filepath);
|
|
558
560
|
this.emit("mock:update", filepath);
|
|
559
561
|
debug("watcher:change", filepath);
|
|
560
562
|
});
|
|
561
563
|
watcher.on("unlink", async (filepath) => {
|
|
564
|
+
filepath = (0, import_vite2.normalizePath)(filepath);
|
|
562
565
|
this.emit("mock:unlink", filepath);
|
|
563
566
|
debug("watcher:unlink", filepath);
|
|
564
567
|
});
|
|
@@ -575,12 +578,14 @@ var _MockLoader = class extends import_node_events.default {
|
|
|
575
578
|
cwd: this.cwd
|
|
576
579
|
});
|
|
577
580
|
this.depsWatcher.on("change", (filepath) => {
|
|
581
|
+
filepath = (0, import_vite2.normalizePath)(filepath);
|
|
578
582
|
const mockFiles = this.moduleDeps.get(filepath);
|
|
579
583
|
mockFiles && mockFiles.forEach((file) => {
|
|
580
584
|
this.emit("mock:update", file);
|
|
581
585
|
});
|
|
582
586
|
});
|
|
583
587
|
this.depsWatcher.on("unlink", (filepath) => {
|
|
588
|
+
filepath = (0, import_vite2.normalizePath)(filepath);
|
|
584
589
|
this.moduleDeps.delete(filepath);
|
|
585
590
|
});
|
|
586
591
|
this.on("update:deps", () => {
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { createFilter } from "vite";
|
|
|
9
9
|
|
|
10
10
|
// package.json
|
|
11
11
|
var name = "vite-plugin-mock-dev-server";
|
|
12
|
-
var version = "0.4.
|
|
12
|
+
var version = "0.4.2";
|
|
13
13
|
|
|
14
14
|
// src/esbuildPlugin.ts
|
|
15
15
|
import fsp from "fs/promises";
|
|
@@ -451,7 +451,7 @@ import chokidar from "chokidar";
|
|
|
451
451
|
import { build as build2 } from "esbuild";
|
|
452
452
|
import fastGlob from "fast-glob";
|
|
453
453
|
import JSON52 from "json5";
|
|
454
|
-
import { createFilter as createFilter2 } from "vite";
|
|
454
|
+
import { createFilter as createFilter2, normalizePath } from "vite";
|
|
455
455
|
var _dirname = getDirname(import.meta.url);
|
|
456
456
|
var _require = createRequire(_dirname);
|
|
457
457
|
var _MockLoader = class extends EventEmitter {
|
|
@@ -508,14 +508,17 @@ var _MockLoader = class extends EventEmitter {
|
|
|
508
508
|
});
|
|
509
509
|
otherGlob.length > 0 && otherGlob.forEach((glob) => watcher.add(glob));
|
|
510
510
|
watcher.on("add", async (filepath) => {
|
|
511
|
+
filepath = normalizePath(filepath);
|
|
511
512
|
this.emit("mock:update", filepath);
|
|
512
513
|
debug("watcher:add", filepath);
|
|
513
514
|
});
|
|
514
515
|
watcher.on("change", async (filepath) => {
|
|
516
|
+
filepath = normalizePath(filepath);
|
|
515
517
|
this.emit("mock:update", filepath);
|
|
516
518
|
debug("watcher:change", filepath);
|
|
517
519
|
});
|
|
518
520
|
watcher.on("unlink", async (filepath) => {
|
|
521
|
+
filepath = normalizePath(filepath);
|
|
519
522
|
this.emit("mock:unlink", filepath);
|
|
520
523
|
debug("watcher:unlink", filepath);
|
|
521
524
|
});
|
|
@@ -532,12 +535,14 @@ var _MockLoader = class extends EventEmitter {
|
|
|
532
535
|
cwd: this.cwd
|
|
533
536
|
});
|
|
534
537
|
this.depsWatcher.on("change", (filepath) => {
|
|
538
|
+
filepath = normalizePath(filepath);
|
|
535
539
|
const mockFiles = this.moduleDeps.get(filepath);
|
|
536
540
|
mockFiles && mockFiles.forEach((file) => {
|
|
537
541
|
this.emit("mock:update", file);
|
|
538
542
|
});
|
|
539
543
|
});
|
|
540
544
|
this.depsWatcher.on("unlink", (filepath) => {
|
|
545
|
+
filepath = normalizePath(filepath);
|
|
541
546
|
this.moduleDeps.delete(filepath);
|
|
542
547
|
});
|
|
543
548
|
this.on("update:deps", () => {
|