vite-node 0.9.4 → 0.10.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.
package/dist/utils.cjs CHANGED
@@ -2,48 +2,16 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var url = require('url');
6
- var pathe = require('pathe');
5
+ var utils = require('./utils-5d86aff6.js');
6
+ require('url');
7
+ require('pathe');
7
8
 
8
- const isWindows = process.platform === "win32";
9
- function slash(str) {
10
- return str.replace(/\\/g, "/");
11
- }
12
- function normalizeRequestId(id, base) {
13
- if (base && id.startsWith(base))
14
- id = `/${id.slice(base.length)}`;
15
- 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
- }
17
- function normalizeModuleId(id) {
18
- return id.replace(/\\/g, "/").replace(/^\/@fs\//, "/").replace(/^file:\//, "/").replace(/^\/+/, "/");
19
- }
20
- function isPrimitive(v) {
21
- return v !== Object(v);
22
- }
23
- function toFilePath(id, root) {
24
- 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
- if (absolute.startsWith("//"))
26
- absolute = absolute.slice(1);
27
- return isWindows && absolute.startsWith("/") ? url.fileURLToPath(url.pathToFileURL(absolute.slice(1)).href) : absolute;
28
- }
29
- let SOURCEMAPPING_URL = "sourceMa";
30
- SOURCEMAPPING_URL += "ppingURL";
31
- async function withInlineSourcemap(result) {
32
- const { code, map } = result;
33
- if (code.includes(`${SOURCEMAPPING_URL}=`))
34
- return result;
35
- if (map)
36
- result.code = `${code}
37
9
 
38
- //# ${SOURCEMAPPING_URL}=data:application/json;charset=utf-8;base64,${Buffer.from(JSON.stringify(map), "utf-8").toString("base64")}
39
- `;
40
- return result;
41
- }
42
10
 
43
- exports.isPrimitive = isPrimitive;
44
- exports.isWindows = isWindows;
45
- exports.normalizeModuleId = normalizeModuleId;
46
- exports.normalizeRequestId = normalizeRequestId;
47
- exports.slash = slash;
48
- exports.toFilePath = toFilePath;
49
- exports.withInlineSourcemap = withInlineSourcemap;
11
+ exports.isPrimitive = utils.isPrimitive;
12
+ exports.isWindows = utils.isWindows;
13
+ exports.normalizeModuleId = utils.normalizeModuleId;
14
+ exports.normalizeRequestId = utils.normalizeRequestId;
15
+ exports.slash = utils.slash;
16
+ exports.toFilePath = utils.toFilePath;
17
+ exports.withInlineSourcemap = utils.withInlineSourcemap;
package/dist/utils.js CHANGED
@@ -1,39 +1,3 @@
1
- import { fileURLToPath, pathToFileURL } from 'url';
2
- import { dirname, resolve } from 'pathe';
3
-
4
- const isWindows = process.platform === "win32";
5
- function slash(str) {
6
- return str.replace(/\\/g, "/");
7
- }
8
- function normalizeRequestId(id, base) {
9
- if (base && id.startsWith(base))
10
- id = `/${id.slice(base.length)}`;
11
- 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(/\?+$/, "");
12
- }
13
- function normalizeModuleId(id) {
14
- return id.replace(/\\/g, "/").replace(/^\/@fs\//, "/").replace(/^file:\//, "/").replace(/^\/+/, "/");
15
- }
16
- function isPrimitive(v) {
17
- return v !== Object(v);
18
- }
19
- function toFilePath(id, root) {
20
- 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;
21
- if (absolute.startsWith("//"))
22
- absolute = absolute.slice(1);
23
- return isWindows && absolute.startsWith("/") ? fileURLToPath(pathToFileURL(absolute.slice(1)).href) : absolute;
24
- }
25
- let SOURCEMAPPING_URL = "sourceMa";
26
- SOURCEMAPPING_URL += "ppingURL";
27
- async function withInlineSourcemap(result) {
28
- const { code, map } = result;
29
- if (code.includes(`${SOURCEMAPPING_URL}=`))
30
- return result;
31
- if (map)
32
- result.code = `${code}
33
-
34
- //# ${SOURCEMAPPING_URL}=data:application/json;charset=utf-8;base64,${Buffer.from(JSON.stringify(map), "utf-8").toString("base64")}
35
- `;
36
- return result;
37
- }
38
-
39
- export { isPrimitive, isWindows, normalizeModuleId, normalizeRequestId, slash, toFilePath, withInlineSourcemap };
1
+ export { i as isPrimitive, b as isWindows, n as normalizeModuleId, a as normalizeRequestId, s as slash, t as toFilePath, w as withInlineSourcemap } from './utils-0290448b.js';
2
+ import 'url';
3
+ import 'pathe';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-node",
3
3
  "type": "module",
4
- "version": "0.9.4",
4
+ "version": "0.10.0",
5
5
  "description": "Vite as Node.js runtime",
6
6
  "homepage": "https://github.com/vitest-dev/vitest/blob/main/packages/vite-node#readme",
7
7
  "bugs": {