@vitest/browser 0.19.0 → 0.19.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/client/__vitest__/assets/index.0e6de9cd.js +33 -0
- package/dist/client/__vitest__/assets/index.dea02184.css +1 -0
- package/dist/client/__vitest__/bg.png +0 -0
- package/dist/client/__vitest__/favicon.svg +5 -0
- package/dist/client/__vitest__/index.html +26 -0
- package/dist/client/assets/index.6fe36f2b.js +462 -0
- package/dist/client/favicon.svg +5 -0
- package/dist/client/index.html +30 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +66 -0
- package/package.json +3 -3
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { fileURLToPath } from 'url';
|
|
2
|
+
import { resolve } from 'path';
|
|
3
|
+
import { builtinModules } from 'module';
|
|
4
|
+
import { polyfillPath } from 'modern-node-polyfills';
|
|
5
|
+
import sirv from 'sirv';
|
|
6
|
+
import { resolvePath } from 'mlly';
|
|
7
|
+
|
|
8
|
+
const stubs = [
|
|
9
|
+
"fs",
|
|
10
|
+
"local-pkg",
|
|
11
|
+
"module",
|
|
12
|
+
"noop",
|
|
13
|
+
"perf_hooks"
|
|
14
|
+
];
|
|
15
|
+
const polyfills = [
|
|
16
|
+
"util",
|
|
17
|
+
"tty",
|
|
18
|
+
"process",
|
|
19
|
+
"path",
|
|
20
|
+
"buffer"
|
|
21
|
+
];
|
|
22
|
+
var index = (base = "/") => {
|
|
23
|
+
const pkgRoot = resolve(fileURLToPath(import.meta.url), "../..");
|
|
24
|
+
const distRoot = resolve(pkgRoot, "dist");
|
|
25
|
+
return [
|
|
26
|
+
{
|
|
27
|
+
enforce: "pre",
|
|
28
|
+
name: "vitest:browser",
|
|
29
|
+
async resolveId(id, _, ctx) {
|
|
30
|
+
if (ctx.ssr)
|
|
31
|
+
return;
|
|
32
|
+
if (id === "/__vitest_index__") {
|
|
33
|
+
const result = await resolvePath("vitest/browser");
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
if (stubs.includes(id))
|
|
37
|
+
return resolve(pkgRoot, "stubs", id);
|
|
38
|
+
if (polyfills.includes(id))
|
|
39
|
+
return polyfillPath(normalizeId(id));
|
|
40
|
+
return null;
|
|
41
|
+
},
|
|
42
|
+
async configureServer(server) {
|
|
43
|
+
server.middlewares.use(base, sirv(resolve(distRoot, "client"), {
|
|
44
|
+
single: false,
|
|
45
|
+
dev: true
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "modern-node-polyfills",
|
|
51
|
+
async resolveId(id, _, ctx) {
|
|
52
|
+
if (ctx.ssr || !builtinModules.includes(id))
|
|
53
|
+
return;
|
|
54
|
+
id = normalizeId(id);
|
|
55
|
+
return { id: await polyfillPath(id), moduleSideEffects: false };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
};
|
|
60
|
+
function normalizeId(id, base) {
|
|
61
|
+
if (base && id.startsWith(base))
|
|
62
|
+
id = `/${id.slice(base.length)}`;
|
|
63
|
+
return id.replace(/^\/@id\/__x00__/, "\0").replace(/^\/@id\//, "").replace(/^__vite-browser-external:/, "").replace(/^node:/, "").replace(/[?&]v=\w+/, "?").replace(/\?$/, "");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { index as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/browser",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.19.
|
|
4
|
+
"version": "0.19.1",
|
|
5
5
|
"description": "Browser running for Vitest",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/ws": "^8.2.2",
|
|
35
|
-
"@vitest/ws-client": "0.19.
|
|
35
|
+
"@vitest/ws-client": "0.19.1",
|
|
36
36
|
"picocolors": "^1.0.0",
|
|
37
37
|
"rollup": "^2.67.2",
|
|
38
|
-
"vitest": "0.19.
|
|
38
|
+
"vitest": "0.19.1"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "rimraf dist && pnpm build:node && pnpm build:client && pnpm copy",
|