vite-node 0.15.0 → 0.16.0

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.
@@ -141,7 +141,8 @@ class ViteNodeServer {
141
141
  async resolveId(id, importer) {
142
142
  if (importer && !importer.startsWith(this.server.config.root))
143
143
  importer = pathe.join(this.server.config.root, importer);
144
- return this.server.pluginContainer.resolveId(id, importer, { ssr: true });
144
+ const mode = importer && this.getTransformMode(importer) || "ssr";
145
+ return this.server.pluginContainer.resolveId(id, importer, { ssr: mode === "ssr" });
145
146
  }
146
147
  async fetchModule(id) {
147
148
  if (!this.fetchPromiseMap.has(id)) {
@@ -135,7 +135,8 @@ class ViteNodeServer {
135
135
  async resolveId(id, importer) {
136
136
  if (importer && !importer.startsWith(this.server.config.root))
137
137
  importer = join(this.server.config.root, importer);
138
- return this.server.pluginContainer.resolveId(id, importer, { ssr: true });
138
+ const mode = importer && this.getTransformMode(importer) || "ssr";
139
+ return this.server.pluginContainer.resolveId(id, importer, { ssr: mode === "ssr" });
139
140
  }
140
141
  async fetchModule(id) {
141
142
  if (!this.fetchPromiseMap.has(id)) {
@@ -13,7 +13,7 @@ function mergeSlashes(str) {
13
13
  function normalizeRequestId(id, base) {
14
14
  if (base && id.startsWith(base))
15
15
  id = `/${id.slice(base.length)}`;
16
- return id.replace(/^\/@id\/__x00__/, "\0").replace(/^\/@id\//, "").replace(/^__vite-browser-external:/, "").replace(/^(node|file):/, "").replace(/^\/+/, "/").replace(/\?v=\w+/, "?").replace(/&v=\w+/, "").replace(/\?t=\w+/, "?").replace(/&t=\w+/, "").replace(/\?import/, "?").replace(/&import/, "").replace(/\?+$/, "");
16
+ return id.replace(/^\/@id\/__x00__/, "\0").replace(/^\/@id\//, "").replace(/^__vite-browser-external:/, "").replace(/^(node|file):/, "").replace(/^\/+/, "/").replace(/\?v=\w+/, "?").replace(/&v=\w+/, "").replace(/\?t=\w+/, "?").replace(/&t=\w+/, "").replace(/\?import/, "?").replace(/&import/, "").replace(/\?&/, "?").replace(/\?+$/, "");
17
17
  }
18
18
  function normalizeModuleId(id) {
19
19
  return id.replace(/\\/g, "/").replace(/^\/@fs\//, "/").replace(/^file:\//, "/").replace(/^\/+/, "/");
@@ -22,7 +22,7 @@ function isPrimitive(v) {
22
22
  return v !== Object(v);
23
23
  }
24
24
  function toFilePath(id, root) {
25
- let absolute = slash(id).startsWith("/@fs/") ? id.slice(4) : id.startsWith(pathe.dirname(root)) && pathe.dirname(root) !== "/" ? id : id.startsWith("/") ? slash(pathe.resolve(root, id.slice(1))) : id;
25
+ let absolute = slash(id).startsWith("/@fs/") ? id.slice(4) : id.startsWith(root) ? id : id.startsWith("/") ? slash(pathe.resolve(root, id.slice(1))) : id;
26
26
  if (absolute.startsWith("//"))
27
27
  absolute = absolute.slice(1);
28
28
  return isWindows && absolute.startsWith("/") ? url.fileURLToPath(url.pathToFileURL(absolute.slice(1)).href) : absolute;
@@ -1,5 +1,5 @@
1
1
  import { fileURLToPath, pathToFileURL } from 'url';
2
- import { dirname, resolve } from 'pathe';
2
+ import { resolve } from 'pathe';
3
3
 
4
4
  const isWindows = process.platform === "win32";
5
5
  function slash(str) {
@@ -11,7 +11,7 @@ function mergeSlashes(str) {
11
11
  function normalizeRequestId(id, base) {
12
12
  if (base && id.startsWith(base))
13
13
  id = `/${id.slice(base.length)}`;
14
- return id.replace(/^\/@id\/__x00__/, "\0").replace(/^\/@id\//, "").replace(/^__vite-browser-external:/, "").replace(/^(node|file):/, "").replace(/^\/+/, "/").replace(/\?v=\w+/, "?").replace(/&v=\w+/, "").replace(/\?t=\w+/, "?").replace(/&t=\w+/, "").replace(/\?import/, "?").replace(/&import/, "").replace(/\?+$/, "");
14
+ return id.replace(/^\/@id\/__x00__/, "\0").replace(/^\/@id\//, "").replace(/^__vite-browser-external:/, "").replace(/^(node|file):/, "").replace(/^\/+/, "/").replace(/\?v=\w+/, "?").replace(/&v=\w+/, "").replace(/\?t=\w+/, "?").replace(/&t=\w+/, "").replace(/\?import/, "?").replace(/&import/, "").replace(/\?&/, "?").replace(/\?+$/, "");
15
15
  }
16
16
  function normalizeModuleId(id) {
17
17
  return id.replace(/\\/g, "/").replace(/^\/@fs\//, "/").replace(/^file:\//, "/").replace(/^\/+/, "/");
@@ -20,7 +20,7 @@ function isPrimitive(v) {
20
20
  return v !== Object(v);
21
21
  }
22
22
  function toFilePath(id, root) {
23
- let absolute = slash(id).startsWith("/@fs/") ? id.slice(4) : id.startsWith(dirname(root)) && dirname(root) !== "/" ? id : id.startsWith("/") ? slash(resolve(root, id.slice(1))) : id;
23
+ let absolute = slash(id).startsWith("/@fs/") ? id.slice(4) : id.startsWith(root) ? id : id.startsWith("/") ? slash(resolve(root, id.slice(1))) : id;
24
24
  if (absolute.startsWith("//"))
25
25
  absolute = absolute.slice(1);
26
26
  return isWindows && absolute.startsWith("/") ? fileURLToPath(pathToFileURL(absolute.slice(1)).href) : absolute;
package/dist/cli.cjs CHANGED
@@ -627,7 +627,7 @@ class CAC extends events.EventEmitter {
627
627
 
628
628
  const cac = (name = "") => new CAC(name);
629
629
 
630
- var version = "0.15.0";
630
+ var version = "0.16.0";
631
631
 
632
632
  var __defProp = Object.defineProperty;
633
633
  var __defProps = Object.defineProperties;
package/dist/cli.mjs CHANGED
@@ -625,7 +625,7 @@ class CAC extends EventEmitter {
625
625
 
626
626
  const cac = (name = "") => new CAC(name);
627
627
 
628
- var version = "0.15.0";
628
+ var version = "0.16.0";
629
629
 
630
630
  var __defProp = Object.defineProperty;
631
631
  var __defProps = Object.defineProperties;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-node",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Vite as Node.js runtime",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -61,14 +61,14 @@
61
61
  "dependencies": {
62
62
  "debug": "^4.3.4",
63
63
  "kolorist": "^1.5.1",
64
- "mlly": "^0.5.2",
64
+ "mlly": "^0.5.3",
65
65
  "pathe": "^0.2.0",
66
66
  "vite": "^2.9.12"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/debug": "^4.1.7",
70
70
  "cac": "^6.7.12",
71
- "rollup": "^2.75.6"
71
+ "rollup": "^2.75.7"
72
72
  },
73
73
  "scripts": {
74
74
  "build": "rimraf dist && rollup -c",