vite-plugin-mock-dev-server 1.7.0 → 1.7.1

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
@@ -160,14 +160,15 @@ async function loadFromCode({
160
160
  }) {
161
161
  filepath = _path2.default.resolve(cwd, filepath);
162
162
  const ext = isESM ? ".mjs" : ".cjs";
163
- const file = `${filepath}.timestamp-${Date.now()}${ext}`;
164
- await _fs.promises.writeFile(file, code, "utf8");
163
+ const filepathTmp = `${filepath}.timestamp-${Date.now()}${ext}`;
164
+ const file = _url.pathToFileURL.call(void 0, filepathTmp).toString();
165
+ await _fs.promises.writeFile(filepathTmp, code, "utf8");
165
166
  try {
166
167
  const mod = await import(file);
167
168
  return mod.default || mod;
168
169
  } finally {
169
170
  try {
170
- _fs2.default.unlinkSync(file);
171
+ _fs2.default.unlinkSync(filepathTmp);
171
172
  } catch (e2) {
172
173
  }
173
174
  }
@@ -266,7 +267,7 @@ function generatePackageJson(pkg, mockDeps) {
266
267
  },
267
268
  dependencies: {
268
269
  connect: "^3.7.0",
269
- ["vite-plugin-mock-dev-server"]: `^${"1.6.1"}`,
270
+ ["vite-plugin-mock-dev-server"]: `^${"1.7.0"}`,
270
271
  cors: "^2.8.5"
271
272
  },
272
273
  pnpm: { peerDependencyRules: { ignoreMissing: ["vite"] } }
package/dist/index.js CHANGED
@@ -160,14 +160,15 @@ async function loadFromCode({
160
160
  }) {
161
161
  filepath = path.resolve(cwd, filepath);
162
162
  const ext = isESM ? ".mjs" : ".cjs";
163
- const file = `${filepath}.timestamp-${Date.now()}${ext}`;
164
- await fsp.writeFile(file, code, "utf8");
163
+ const filepathTmp = `${filepath}.timestamp-${Date.now()}${ext}`;
164
+ const file = pathToFileURL(filepathTmp).toString();
165
+ await fsp.writeFile(filepathTmp, code, "utf8");
165
166
  try {
166
167
  const mod = await import(file);
167
168
  return mod.default || mod;
168
169
  } finally {
169
170
  try {
170
- fs.unlinkSync(file);
171
+ fs.unlinkSync(filepathTmp);
171
172
  } catch {
172
173
  }
173
174
  }
@@ -266,7 +267,7 @@ function generatePackageJson(pkg, mockDeps) {
266
267
  },
267
268
  dependencies: {
268
269
  connect: "^3.7.0",
269
- ["vite-plugin-mock-dev-server"]: `^${"1.6.1"}`,
270
+ ["vite-plugin-mock-dev-server"]: `^${"1.7.0"}`,
270
271
  cors: "^2.8.5"
271
272
  },
272
273
  pnpm: { peerDependencyRules: { ignoreMissing: ["vite"] } }
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.7.0",
4
+ "version": "1.7.1",
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",
@@ -87,7 +87,10 @@
87
87
  },
88
88
  "devDependencies": {
89
89
  "esbuild": "^0.23.0",
90
- "vite": "^5.3.5"
90
+ "vite": "^5.4.0"
91
+ },
92
+ "publishConfig": {
93
+ "access": "public"
91
94
  },
92
95
  "scripts": {
93
96
  "build": "tsup"