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/cli.cjs +3 -3
- package/dist/cli.js +3 -3
- package/dist/client-89d820eb.js +238 -0
- package/dist/client-900fb7db.js +212 -0
- package/dist/client.cjs +10 -233
- package/dist/client.js +7 -212
- package/dist/server-4791181c.js +195 -0
- package/dist/server-d9fc65e0.js +191 -0
- package/dist/server.cjs +8 -190
- package/dist/server.js +5 -191
- package/dist/utils-0290448b.js +39 -0
- package/dist/utils-5d86aff6.js +47 -0
- package/dist/utils.cjs +10 -42
- package/dist/utils.js +3 -39
- package/package.json +1 -1
package/dist/utils.cjs
CHANGED
|
@@ -2,48 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
|
|
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
|
-
|
|
2
|
-
import
|
|
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';
|