vite-node 3.0.4 → 3.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/cli.cjs CHANGED
@@ -21,7 +21,7 @@ require('es-module-lexer');
21
21
  require('./constants.cjs');
22
22
  require('node:events');
23
23
 
24
- var version = "3.0.4";
24
+ var version = "3.0.5";
25
25
 
26
26
  const cli = cac("vite-node");
27
27
  cli.option("-r, --root <path>", "Use specified root directory").option("-c, --config <path>", "Use specified config file").option("-m, --mode <mode>", "Set env mode").option("-w, --watch", 'Restart on file changes, similar to "nodemon"').option("--script", "Use vite-node as a script runner").option("--options <options>", "Use specified Vite server options").option("-v, --version", "Output the version number").option("-h, --help", "Display help for command");
package/dist/cli.mjs CHANGED
@@ -19,7 +19,7 @@ import 'es-module-lexer';
19
19
  import './constants.mjs';
20
20
  import 'node:events';
21
21
 
22
- var version = "3.0.4";
22
+ var version = "3.0.5";
23
23
 
24
24
  const cli = cac("vite-node");
25
25
  cli.option("-r, --root <path>", "Use specified root directory").option("-c, --config <path>", "Use specified config file").option("-m, --mode <mode>", "Set env mode").option("-w, --watch", 'Restart on file changes, similar to "nodemon"').option("--script", "Use vite-node as a script runner").option("--options <options>", "Use specified Vite server options").option("-v, --version", "Output the version number").option("-h, --help", "Display help for command");
package/dist/utils.cjs CHANGED
@@ -22,7 +22,8 @@ function normalizeRequestId(id, base) {
22
22
  id = id.replace(driveOppositeRegext, `${drive}$1`);
23
23
  }
24
24
  if (id.startsWith("file://")) {
25
- return node_url.fileURLToPath(id);
25
+ const { file, postfix } = splitFileAndPostfix(id);
26
+ return node_url.fileURLToPath(file) + postfix;
26
27
  }
27
28
  return id.replace(/^\/@id\/__x00__/, "\0").replace(/^\/@id\//, "").replace(/^__vite-browser-external:/, "").replace(/\?v=\w+/, "?").replace(/&v=\w+/, "").replace(/\?t=\w+/, "?").replace(/&t=\w+/, "").replace(/\?import/, "?").replace(/&import/, "").replace(/\?&/, "?").replace(/\?+$/, "");
28
29
  }
@@ -30,6 +31,10 @@ const postfixRE = /[?#].*$/;
30
31
  function cleanUrl(url) {
31
32
  return url.replace(postfixRE, "");
32
33
  }
34
+ function splitFileAndPostfix(path) {
35
+ const file = cleanUrl(path);
36
+ return { file, postfix: path.slice(file.length) };
37
+ }
33
38
  const internalRequests = ["@vite/client", "@vite/env"];
34
39
  const internalRequestRegexp = new RegExp(
35
40
  `^/?(?:${internalRequests.join("|")})$`
package/dist/utils.mjs CHANGED
@@ -20,7 +20,8 @@ function normalizeRequestId(id, base) {
20
20
  id = id.replace(driveOppositeRegext, `${drive}$1`);
21
21
  }
22
22
  if (id.startsWith("file://")) {
23
- return fileURLToPath(id);
23
+ const { file, postfix } = splitFileAndPostfix(id);
24
+ return fileURLToPath(file) + postfix;
24
25
  }
25
26
  return id.replace(/^\/@id\/__x00__/, "\0").replace(/^\/@id\//, "").replace(/^__vite-browser-external:/, "").replace(/\?v=\w+/, "?").replace(/&v=\w+/, "").replace(/\?t=\w+/, "?").replace(/&t=\w+/, "").replace(/\?import/, "?").replace(/&import/, "").replace(/\?&/, "?").replace(/\?+$/, "");
26
27
  }
@@ -28,6 +29,10 @@ const postfixRE = /[?#].*$/;
28
29
  function cleanUrl(url) {
29
30
  return url.replace(postfixRE, "");
30
31
  }
32
+ function splitFileAndPostfix(path) {
33
+ const file = cleanUrl(path);
34
+ return { file, postfix: path.slice(file.length) };
35
+ }
31
36
  const internalRequests = ["@vite/client", "@vite/env"];
32
37
  const internalRequestRegexp = new RegExp(
33
38
  `^/?(?:${internalRequests.join("|")})$`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-node",
3
3
  "type": "module",
4
- "version": "3.0.4",
4
+ "version": "3.0.5",
5
5
  "description": "Vite as Node.js runtime",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",