@vitejs/devtools 0.1.3 → 0.1.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/{DockIcon-BtMEW4VE.js → DockIcon-DNt-Vqy4.js} +29 -29
- package/dist/{ToastOverlay-DdeglpI8.js → DockStandalone-DxFEMDp2.js} +449 -267
- package/dist/{LogItem-BTrEubKY.js → LogItem-CZM2G41b.js} +9 -7
- package/dist/{ViewBuiltinLogs-BL373XPJ.js → ViewBuiltinLogs-1ABRTwzd.js} +5 -5
- package/dist/{ViewBuiltinTerminals-DdpE1Ftb.js → ViewBuiltinTerminals-Co7G-321.js} +6 -6
- package/dist/{ViewJsonRender-coidkW9b.js → ViewJsonRender-ByPfpKFM.js} +4 -7
- package/dist/{cli-commands-BDDMPsV-.js → cli-commands-CnJ4eqDp.js} +2 -2
- package/dist/cli-commands.js +2 -2
- package/dist/cli.js +2 -2
- package/dist/client/inject.js +4 -3
- package/dist/client/standalone/assets/DockStandalone-C8ChyZLh.js +1 -0
- package/dist/client/standalone/assets/{LogItem-CKbVrExA.js → LogItem-Mx4UyReX.js} +1 -1
- package/dist/client/standalone/assets/{ViewBuiltinLogs-9oWDdl1G.js → ViewBuiltinLogs-C4j4vgSn.js} +1 -1
- package/dist/client/standalone/assets/{ViewBuiltinTerminals-DEFrt9ot.js → ViewBuiltinTerminals-UrMq7UXM.js} +2 -2
- package/dist/client/standalone/assets/{ViewJsonRender-CKPzRgqQ.js → ViewJsonRender-BURuu55Z.js} +1 -1
- package/dist/client/standalone/assets/{dist-JpCJ4ieR.js → dist-DIlAYcjk.js} +1 -1
- package/dist/client/standalone/assets/index-BEyoIK7m.css +1 -0
- package/dist/client/standalone/assets/index-Rpv7PwRD.js +4 -0
- package/dist/client/standalone/assets/runtime-core.esm-bundler-CJlaYmKv.js +1 -0
- package/dist/client/standalone/index.html +5 -6
- package/dist/client/webcomponents.d.ts +6 -1
- package/dist/client/webcomponents.js +297 -83
- package/dist/config.d.ts +7 -0
- package/dist/config.js +2 -1
- package/dist/context-internal-CvIHbZq4.js +74 -0
- package/dist/context-internal-Du6FuGIu.d.ts +25 -0
- package/dist/{dist-Cgqg5_oP.js → dist-D2Z6bwqJ.js} +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1 -1
- package/dist/internal.d.ts +2 -0
- package/dist/internal.js +2 -0
- package/dist/{plugins-CsDUv5C2.js → plugins-DiuKIPkS.js} +226 -73
- package/dist/{popup-BZ5jBcoC.js → popup-BUPO6e0I.js} +11 -3
- package/package.json +27 -25
- package/dist/DockStandalone-Ca7ix29I.js +0 -78
- package/dist/client/standalone/assets/DockStandalone-HVyKJVMX.js +0 -1
- package/dist/client/standalone/assets/iconify-C-CPDXMf.js +0 -2
- package/dist/client/standalone/assets/index-Mte4BnZO.css +0 -1
- package/dist/client/standalone/assets/index-ndsYhKrn.js +0 -3
- package/dist/client/standalone/assets/runtime-core.esm-bundler-oO31W4LZ.js +0 -1
- /package/dist/{iconify-YyqAMHKf.js → iconify-BW79QmbD.js} +0 -0
- /package/dist/{utils-Csuu5uNf.js → utils-DaaVwEUH.js} +0 -0
- /package/dist/{vue.runtime.esm-bundler-D2MZbyFr.js → vue.runtime.esm-bundler-CS1wMbap.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as onScopeDispose, C as nextTick, G as shallowRef, H as readonly, I as customRef, J as toValue, K as toRef$1, L as getCurrentScope, M as watch, N as watchEffect, R as isRef, S as inject, T as onMounted, U as ref, W as shallowReadonly, Y as unref, l as computed, x as hasInjectionContext, y as getCurrentInstance } from "./vue.runtime.esm-bundler-
|
|
1
|
+
import { B as onScopeDispose, C as nextTick, G as shallowRef, H as readonly, I as customRef, J as toValue, K as toRef$1, L as getCurrentScope, M as watch, N as watchEffect, R as isRef, S as inject, T as onMounted, U as ref, W as shallowReadonly, Y as unref, l as computed, x as hasInjectionContext, y as getCurrentInstance } from "./vue.runtime.esm-bundler-CS1wMbap.js";
|
|
2
2
|
//#region ../../node_modules/.pnpm/@vueuse+shared@14.2.1_vue@3.5.30_typescript@5.9.3_/node_modules/@vueuse/shared/dist/index.js
|
|
3
3
|
/**
|
|
4
4
|
* Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as InternalAnonymousAuthStorage, t as DevToolsInternalContext } from "./context-internal-Du6FuGIu.js";
|
|
1
2
|
import { Plugin, ResolvedConfig, ViteDevServer } from "vite";
|
|
2
3
|
import { SharedStatePatch } from "@vitejs/devtools-kit/utils/shared-state";
|
|
3
4
|
import * as _vitejs_devtools_rpc0 from "@vitejs/devtools-rpc";
|
|
@@ -13,7 +14,7 @@ declare function createDevToolsContext(viteConfig: ResolvedConfig, viteServer?:
|
|
|
13
14
|
//#endregion
|
|
14
15
|
//#region src/node/rpc/anonymous/auth.d.ts
|
|
15
16
|
interface DevToolsAuthInput {
|
|
16
|
-
|
|
17
|
+
authToken: string;
|
|
17
18
|
ua: string;
|
|
18
19
|
origin: string;
|
|
19
20
|
}
|
|
@@ -246,6 +247,7 @@ type BuiltinServerFunctions = RpcDefinitionsToFunctions<typeof builtinRpcDeclara
|
|
|
246
247
|
declare module '@vitejs/devtools-kit' {
|
|
247
248
|
interface DevToolsRpcServerFunctions extends BuiltinServerFunctions {}
|
|
248
249
|
interface DevToolsRpcClientFunctions {
|
|
250
|
+
'devtoolskit:internal:auth:revoked': () => Promise<void>;
|
|
249
251
|
'devtoolskit:internal:logs:updated': () => Promise<void>;
|
|
250
252
|
'devtoolskit:internal:rpc:client-state:patch': (key: string, patches: SharedStatePatch[], syncId: string) => Promise<void>;
|
|
251
253
|
'devtoolskit:internal:rpc:client-state:updated': (key: string, fullState: any, syncId: string) => Promise<void>;
|
|
@@ -286,4 +288,4 @@ declare function createDevToolsMiddleware(options: CreateWsServerOptions): Promi
|
|
|
286
288
|
getConnectionMeta: () => Promise<_vitejs_devtools_kit0.ConnectionMeta>;
|
|
287
289
|
}>;
|
|
288
290
|
//#endregion
|
|
289
|
-
export { DevTools, createDevToolsContext, createDevToolsMiddleware };
|
|
291
|
+
export { DevTools, type DevToolsInternalContext, type InternalAnonymousAuthStorage, createDevToolsContext, createDevToolsMiddleware };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createDevToolsContext, r as createDevToolsMiddleware, t as DevTools } from "./plugins-
|
|
1
|
+
import { a as createDevToolsContext, r as createDevToolsMiddleware, t as DevTools } from "./plugins-DiuKIPkS.js";
|
|
2
2
|
export { DevTools, createDevToolsContext, createDevToolsMiddleware };
|
package/dist/internal.js
ADDED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { n as createStorage, t as getInternalContext } from "./context-internal-CvIHbZq4.js";
|
|
2
|
+
import { t as isObject } from "./utils-DaaVwEUH.js";
|
|
2
3
|
import { dirClientStandalone, dirDist } from "./dirs.js";
|
|
3
4
|
import { createDebug } from "obug";
|
|
4
5
|
import { debounce } from "perfect-debounce";
|
|
@@ -6,8 +7,8 @@ import { normalizePath, searchForWorkspaceRoot } from "vite";
|
|
|
6
7
|
import { toDataURL } from "mlly";
|
|
7
8
|
import { DEFAULT_STATE_USER_SETTINGS, DEVTOOLS_CONNECTION_META_FILENAME, DEVTOOLS_DOCK_IMPORTS_VIRTUAL_ID, DEVTOOLS_MOUNT_PATH } from "@vitejs/devtools-kit/constants";
|
|
8
9
|
import { createEventEmitter } from "@vitejs/devtools-kit/utils/events";
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
10
|
+
import { join } from "pathe";
|
|
11
|
+
import { existsSync } from "node:fs";
|
|
11
12
|
import { createSharedState } from "@vitejs/devtools-kit/utils/shared-state";
|
|
12
13
|
import { RpcFunctionsCollectorBase } from "@vitejs/devtools-rpc";
|
|
13
14
|
import { nanoid } from "@vitejs/devtools-kit/utils/nanoid";
|
|
@@ -19,12 +20,13 @@ import ot from "node:readline";
|
|
|
19
20
|
import "node:tty";
|
|
20
21
|
import { join as join$1 } from "node:path";
|
|
21
22
|
import { defineRpcFunction } from "@vitejs/devtools-kit";
|
|
23
|
+
import { humanId } from "@vitejs/devtools-kit/utils/human-id";
|
|
24
|
+
import { networkInterfaces } from "node:os";
|
|
22
25
|
import { createServer } from "node:net";
|
|
23
|
-
import { createApp, eventHandler, fromNodeMiddleware, toNodeListener } from "h3";
|
|
26
|
+
import { createApp, eventHandler, fromNodeMiddleware, getQuery, toNodeListener } from "h3";
|
|
24
27
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
25
28
|
import { createWsRpcPreset } from "@vitejs/devtools-rpc/presets/ws/server";
|
|
26
29
|
import { createRpcServer } from "@vitejs/devtools-rpc/server";
|
|
27
|
-
import { networkInterfaces } from "node:os";
|
|
28
30
|
import "node:fs/promises";
|
|
29
31
|
//#region \0rolldown/runtime.js
|
|
30
32
|
var __create = Object.create;
|
|
@@ -34,6 +36,15 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
34
36
|
var __getProtoOf = Object.getPrototypeOf;
|
|
35
37
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
36
38
|
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
39
|
+
var __exportAll = (all, no_symbols) => {
|
|
40
|
+
let target = {};
|
|
41
|
+
for (var name in all) __defProp(target, name, {
|
|
42
|
+
get: all[name],
|
|
43
|
+
enumerable: true
|
|
44
|
+
});
|
|
45
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
46
|
+
return target;
|
|
47
|
+
};
|
|
37
48
|
var __copyProps = (to, from, except, desc) => {
|
|
38
49
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
39
50
|
key = keys[i];
|
|
@@ -57,32 +68,6 @@ const ContextUtils = { createSimpleClientScript(fn) {
|
|
|
57
68
|
};
|
|
58
69
|
} };
|
|
59
70
|
//#endregion
|
|
60
|
-
//#region src/node/storage.ts
|
|
61
|
-
function createStorage(options) {
|
|
62
|
-
const { mergeInitialValue = (initialValue, savedValue) => ({
|
|
63
|
-
...initialValue,
|
|
64
|
-
...savedValue
|
|
65
|
-
}), debounce: debounceTime = 100 } = options;
|
|
66
|
-
let initialValue = options.initialValue;
|
|
67
|
-
if (fs.existsSync(options.filepath)) try {
|
|
68
|
-
const savedValue = JSON.parse(fs.readFileSync(options.filepath, "utf-8"));
|
|
69
|
-
initialValue = mergeInitialValue ? mergeInitialValue(options.initialValue, savedValue) : savedValue;
|
|
70
|
-
} catch (error) {
|
|
71
|
-
console.warn(`[Vite DevTools] Failed to parse storage file: ${options.filepath}, falling back to defaults.`);
|
|
72
|
-
console.warn(error);
|
|
73
|
-
initialValue = options.initialValue;
|
|
74
|
-
}
|
|
75
|
-
const state = createSharedState({
|
|
76
|
-
initialValue,
|
|
77
|
-
enablePatches: false
|
|
78
|
-
});
|
|
79
|
-
state.on("updated", debounce((newState) => {
|
|
80
|
-
fs.mkdirSync(dirname(options.filepath), { recursive: true });
|
|
81
|
-
fs.writeFileSync(options.filepath, `${JSON.stringify(newState, null, 2)}\n`);
|
|
82
|
-
}, debounceTime));
|
|
83
|
-
return state;
|
|
84
|
-
}
|
|
85
|
-
//#endregion
|
|
86
71
|
//#region src/node/host-docks.ts
|
|
87
72
|
var DevToolsDockHost = class {
|
|
88
73
|
views = /* @__PURE__ */ new Map();
|
|
@@ -724,6 +709,9 @@ function _t$1(t, e) {
|
|
|
724
709
|
}
|
|
725
710
|
globalThis.process.platform.startsWith("win");
|
|
726
711
|
const z$1 = Symbol("clack:cancel");
|
|
712
|
+
function Ct$1(t) {
|
|
713
|
+
return t === z$1;
|
|
714
|
+
}
|
|
727
715
|
function W$1(t, e) {
|
|
728
716
|
const s = t;
|
|
729
717
|
s.isTTY && s.setRawMode(e);
|
|
@@ -1306,20 +1294,63 @@ var import_ansis = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((expo
|
|
|
1306
1294
|
var ansis_default = import_ansis.default;
|
|
1307
1295
|
const { Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = import_ansis.default;
|
|
1308
1296
|
//#endregion
|
|
1309
|
-
//#region src/node/
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
return
|
|
1297
|
+
//#region src/node/auth-state.ts
|
|
1298
|
+
let pendingAuth = null;
|
|
1299
|
+
let tempAuthToken = generateTempId();
|
|
1300
|
+
function generateTempId() {
|
|
1301
|
+
return humanId({
|
|
1302
|
+
separator: "-",
|
|
1303
|
+
capitalize: false
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
function getTempAuthToken() {
|
|
1307
|
+
return tempAuthToken;
|
|
1308
|
+
}
|
|
1309
|
+
function refreshTempAuthToken() {
|
|
1310
|
+
tempAuthToken = generateTempId();
|
|
1311
|
+
return tempAuthToken;
|
|
1312
|
+
}
|
|
1313
|
+
function setPendingAuth(request) {
|
|
1314
|
+
pendingAuth = request;
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Abort and clean up any existing pending auth request.
|
|
1318
|
+
*/
|
|
1319
|
+
function abortPendingAuth() {
|
|
1320
|
+
if (pendingAuth) {
|
|
1321
|
+
pendingAuth.abortController.abort();
|
|
1322
|
+
clearTimeout(pendingAuth.timeout);
|
|
1323
|
+
pendingAuth = null;
|
|
1324
|
+
}
|
|
1320
1325
|
}
|
|
1326
|
+
/**
|
|
1327
|
+
* Consume the temp auth ID: verify it matches, trust the pending client, and clean up.
|
|
1328
|
+
* Returns the client's authToken if successful, null otherwise.
|
|
1329
|
+
*/
|
|
1330
|
+
function consumeTempAuthToken(id, storage) {
|
|
1331
|
+
if (id !== tempAuthToken || !pendingAuth) return null;
|
|
1332
|
+
const { clientAuthToken, session, ua, origin, resolve } = pendingAuth;
|
|
1333
|
+
storage.mutate((state) => {
|
|
1334
|
+
state.trusted[clientAuthToken] = {
|
|
1335
|
+
authToken: clientAuthToken,
|
|
1336
|
+
ua,
|
|
1337
|
+
origin,
|
|
1338
|
+
timestamp: Date.now()
|
|
1339
|
+
};
|
|
1340
|
+
});
|
|
1341
|
+
session.meta.clientAuthToken = clientAuthToken;
|
|
1342
|
+
session.meta.isTrusted = true;
|
|
1343
|
+
resolve({ isTrusted: true });
|
|
1344
|
+
abortPendingAuth();
|
|
1345
|
+
refreshTempAuthToken();
|
|
1346
|
+
return clientAuthToken;
|
|
1347
|
+
}
|
|
1348
|
+
ansis_default.green("✔");
|
|
1349
|
+
const MARK_INFO = ansis_default.blue("ℹ");
|
|
1350
|
+
ansis_default.red("✖");
|
|
1321
1351
|
//#endregion
|
|
1322
1352
|
//#region src/node/rpc/anonymous/auth.ts
|
|
1353
|
+
const AUTH_TIMEOUT_MS = 6e4;
|
|
1323
1354
|
const anonymousAuth = defineRpcFunction({
|
|
1324
1355
|
name: "vite:anonymous:auth",
|
|
1325
1356
|
type: "action",
|
|
@@ -1328,41 +1359,95 @@ const anonymousAuth = defineRpcFunction({
|
|
|
1328
1359
|
return { handler: async (query) => {
|
|
1329
1360
|
const session = context.rpc.getCurrentRpcSession();
|
|
1330
1361
|
if (!session) throw new Error("Failed to retrieve the current RPC session");
|
|
1331
|
-
if (session.meta.isTrusted || storage.value().trusted[query.
|
|
1332
|
-
session.meta.
|
|
1362
|
+
if (session.meta.isTrusted || storage.value().trusted[query.authToken]) {
|
|
1363
|
+
session.meta.clientAuthToken = query.authToken;
|
|
1333
1364
|
session.meta.isTrusted = true;
|
|
1334
1365
|
return { isTrusted: true };
|
|
1335
1366
|
}
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
"",
|
|
1343
|
-
"This will allow the browser to interact with the server, make file changes and run commands.",
|
|
1344
|
-
ansis_default.red(ansis_default.bold("You should only trust your local development browsers."))
|
|
1345
|
-
];
|
|
1346
|
-
Vt(ansis_default.reset(message.join("\n")), ansis_default.bold(ansis_default.yellow(" Vite DevTools Permission Request ")));
|
|
1347
|
-
if (await Rt({
|
|
1348
|
-
message: ansis_default.bold(`Do you trust this client (${ansis_default.green(ansis_default.bold(query.authId))})?`),
|
|
1349
|
-
initialValue: false
|
|
1350
|
-
})) {
|
|
1367
|
+
if (((context.viteConfig.devtools?.config)?.clientAuthTokens ?? []).includes(query.authToken)) {
|
|
1368
|
+
session.meta.clientAuthToken = query.authToken;
|
|
1369
|
+
session.meta.isTrusted = true;
|
|
1370
|
+
return { isTrusted: true };
|
|
1371
|
+
}
|
|
1372
|
+
if (query.authToken === getTempAuthToken()) {
|
|
1351
1373
|
storage.mutate((state) => {
|
|
1352
|
-
state.trusted[query.
|
|
1353
|
-
|
|
1374
|
+
state.trusted[query.authToken] = {
|
|
1375
|
+
authToken: query.authToken,
|
|
1354
1376
|
ua: query.ua,
|
|
1355
1377
|
origin: query.origin,
|
|
1356
1378
|
timestamp: Date.now()
|
|
1357
1379
|
};
|
|
1358
1380
|
});
|
|
1359
|
-
session.meta.
|
|
1381
|
+
session.meta.clientAuthToken = query.authToken;
|
|
1360
1382
|
session.meta.isTrusted = true;
|
|
1361
|
-
|
|
1383
|
+
refreshTempAuthToken();
|
|
1362
1384
|
return { isTrusted: true };
|
|
1363
1385
|
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1386
|
+
abortPendingAuth();
|
|
1387
|
+
const tempId = getTempAuthToken();
|
|
1388
|
+
const authUrl = `${context.viteServer?.resolvedUrls?.local?.[0]?.replace(/\/$/, "") ?? `http://localhost:${context.viteConfig.server.port}`}/.devtools/auth?id=${encodeURIComponent(tempId)}`;
|
|
1389
|
+
const message = [
|
|
1390
|
+
`A browser is requesting permissions to connect to the Vite DevTools.`,
|
|
1391
|
+
"",
|
|
1392
|
+
`User Agent : ${ansis_default.yellow(ansis_default.bold(query.ua || "Unknown"))}`,
|
|
1393
|
+
`Origin : ${ansis_default.yellow(ansis_default.bold(query.origin || "Unknown"))}`,
|
|
1394
|
+
`Client Token : ${ansis_default.green(ansis_default.bold(query.authToken))}`,
|
|
1395
|
+
"",
|
|
1396
|
+
`Manual Auth URL : ${ansis_default.cyan(ansis_default.underline(authUrl))}`,
|
|
1397
|
+
`Manual Auth Token : ${ansis_default.cyan(ansis_default.bold(tempId))}`,
|
|
1398
|
+
"",
|
|
1399
|
+
"This will allow the browser to interact with the server, make file changes and run commands.",
|
|
1400
|
+
ansis_default.red(ansis_default.bold("You should only trust your local development browsers."))
|
|
1401
|
+
];
|
|
1402
|
+
Vt(ansis_default.reset(message.join("\n")), ansis_default.bold(ansis_default.yellow(" Vite DevTools Permission Request ")));
|
|
1403
|
+
if (!process$1.stdout.isTTY) return { isTrusted: false };
|
|
1404
|
+
const abortController = new AbortController();
|
|
1405
|
+
return new Promise((resolve) => {
|
|
1406
|
+
const timeout = setTimeout(() => {
|
|
1407
|
+
abortController.abort();
|
|
1408
|
+
setPendingAuth(null);
|
|
1409
|
+
console.log(ansis_default.yellow`${MARK_INFO} Auth request timed out for ${ansis_default.bold(query.authToken)}`);
|
|
1410
|
+
resolve({ isTrusted: false });
|
|
1411
|
+
}, AUTH_TIMEOUT_MS);
|
|
1412
|
+
setPendingAuth({
|
|
1413
|
+
clientAuthToken: query.authToken,
|
|
1414
|
+
session,
|
|
1415
|
+
ua: query.ua,
|
|
1416
|
+
origin: query.origin,
|
|
1417
|
+
resolve,
|
|
1418
|
+
abortController,
|
|
1419
|
+
timeout
|
|
1420
|
+
});
|
|
1421
|
+
Rt({
|
|
1422
|
+
message: ansis_default.bold(`Do you trust this client (${ansis_default.green(ansis_default.bold(query.authToken))})?`),
|
|
1423
|
+
initialValue: false,
|
|
1424
|
+
signal: abortController.signal
|
|
1425
|
+
}).then((answer) => {
|
|
1426
|
+
clearTimeout(timeout);
|
|
1427
|
+
setPendingAuth(null);
|
|
1428
|
+
if (Ct$1(answer)) return;
|
|
1429
|
+
if (answer) {
|
|
1430
|
+
storage.mutate((state) => {
|
|
1431
|
+
state.trusted[query.authToken] = {
|
|
1432
|
+
authToken: query.authToken,
|
|
1433
|
+
ua: query.ua,
|
|
1434
|
+
origin: query.origin,
|
|
1435
|
+
timestamp: Date.now()
|
|
1436
|
+
};
|
|
1437
|
+
});
|
|
1438
|
+
session.meta.clientAuthToken = query.authToken;
|
|
1439
|
+
session.meta.isTrusted = true;
|
|
1440
|
+
Gt(ansis_default.green(ansis_default.bold(`You have granted permissions to ${ansis_default.bold(query.authToken)}`)));
|
|
1441
|
+
resolve({ isTrusted: true });
|
|
1442
|
+
} else {
|
|
1443
|
+
Gt(ansis_default.red(ansis_default.bold(`You have denied permissions to ${ansis_default.bold(query.authToken)}`)));
|
|
1444
|
+
resolve({ isTrusted: false });
|
|
1445
|
+
}
|
|
1446
|
+
}).catch(() => {
|
|
1447
|
+
clearTimeout(timeout);
|
|
1448
|
+
setPendingAuth(null);
|
|
1449
|
+
});
|
|
1450
|
+
});
|
|
1366
1451
|
} };
|
|
1367
1452
|
}
|
|
1368
1453
|
});
|
|
@@ -1964,9 +2049,6 @@ async function checkPort(port, host = process.env.HOST, verbose) {
|
|
|
1964
2049
|
}
|
|
1965
2050
|
return port;
|
|
1966
2051
|
}
|
|
1967
|
-
ansis_default.green("✔");
|
|
1968
|
-
const MARK_INFO = ansis_default.blue("ℹ");
|
|
1969
|
-
ansis_default.red("✖");
|
|
1970
2052
|
//#endregion
|
|
1971
2053
|
//#region src/node/ws.ts
|
|
1972
2054
|
const debugInvoked = createDebug("vite:devtools:rpc:invoked");
|
|
@@ -1990,15 +2072,19 @@ async function createWsServer(options) {
|
|
|
1990
2072
|
host,
|
|
1991
2073
|
https,
|
|
1992
2074
|
onConnected: (ws, req, meta) => {
|
|
1993
|
-
const
|
|
2075
|
+
const authToken = new URL(req.url ?? "", "http://localhost").searchParams.get("vite_devtools_auth_token") ?? void 0;
|
|
1994
2076
|
if (isClientAuthDisabled) meta.isTrusted = true;
|
|
1995
|
-
else if (
|
|
2077
|
+
else if (authToken && contextInternal.storage.auth.value().trusted[authToken]) {
|
|
1996
2078
|
meta.isTrusted = true;
|
|
1997
|
-
meta.
|
|
2079
|
+
meta.clientAuthToken = authToken;
|
|
2080
|
+
} else if (authToken && ((context.viteConfig.devtools?.config)?.clientAuthTokens ?? []).includes(authToken)) {
|
|
2081
|
+
meta.isTrusted = true;
|
|
2082
|
+
meta.clientAuthToken = authToken;
|
|
1998
2083
|
}
|
|
1999
2084
|
wsClients.add(ws);
|
|
2000
2085
|
const color = meta.isTrusted ? ansis_default.green : ansis_default.yellow;
|
|
2001
|
-
|
|
2086
|
+
const trustedKeys = Object.keys(contextInternal.storage.auth.value().trusted);
|
|
2087
|
+
console.log(color`${MARK_INFO} Websocket client connected. [${meta.id}] [${meta.clientAuthToken}] (${meta.isTrusted ? "trusted" : "untrusted"}) authToken=${authToken} trustedKeys=${JSON.stringify(trustedKeys)} isClientAuthDisabled=${isClientAuthDisabled}`);
|
|
2002
2088
|
},
|
|
2003
2089
|
onDisconnected: (ws, meta) => {
|
|
2004
2090
|
wsClients.delete(ws);
|
|
@@ -2052,13 +2138,80 @@ async function createWsServer(options) {
|
|
|
2052
2138
|
}
|
|
2053
2139
|
//#endregion
|
|
2054
2140
|
//#region src/node/server.ts
|
|
2141
|
+
function generateAuthPageHtml() {
|
|
2142
|
+
return `<!DOCTYPE html>
|
|
2143
|
+
<html>
|
|
2144
|
+
<head>
|
|
2145
|
+
<title>Vite DevTools Authorization</title>
|
|
2146
|
+
<style>
|
|
2147
|
+
html { font-family: system-ui, sans-serif; padding: 2rem; }
|
|
2148
|
+
body { height: 80vh; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1rem; }
|
|
2149
|
+
#message { font-size: 1.2rem; }
|
|
2150
|
+
@media (prefers-color-scheme: dark) { html { background: #1a1a1a; color: #e0e0e0; } }
|
|
2151
|
+
</style>
|
|
2152
|
+
</head>
|
|
2153
|
+
<body>
|
|
2154
|
+
<div id="message">Verifying...</div>
|
|
2155
|
+
<script>
|
|
2156
|
+
const query = new URLSearchParams(location.search)
|
|
2157
|
+
const id = query.get('id')
|
|
2158
|
+
const el = document.getElementById('message')
|
|
2159
|
+
|
|
2160
|
+
if (!id) {
|
|
2161
|
+
el.textContent = '\\u26a0\\ufe0f No auth token found. Please check your URL.'
|
|
2162
|
+
el.style.color = '#df513f'
|
|
2163
|
+
} else {
|
|
2164
|
+
fetch(location.pathname.replace(/\\/$/, '') + '-verify?id=' + encodeURIComponent(id))
|
|
2165
|
+
.then(async (r) => {
|
|
2166
|
+
if (r.status !== 200) throw new Error(await r.text())
|
|
2167
|
+
const data = await r.json()
|
|
2168
|
+
const authToken = data.authToken
|
|
2169
|
+
|
|
2170
|
+
localStorage.setItem('__VITE_DEVTOOLS_CONNECTION_AUTH_TOKEN__', authToken)
|
|
2171
|
+
|
|
2172
|
+
try {
|
|
2173
|
+
const bc = new BroadcastChannel('vite-devtools-auth')
|
|
2174
|
+
bc.postMessage({ type: 'auth-update', authToken: authToken })
|
|
2175
|
+
} catch {}
|
|
2176
|
+
|
|
2177
|
+
el.textContent = '\\u2705 Authorized! You can close this window now.'
|
|
2178
|
+
window.close()
|
|
2179
|
+
})
|
|
2180
|
+
.catch((err) => {
|
|
2181
|
+
el.textContent = '\\u26a0\\ufe0f Failed to authorize: ' + err.message
|
|
2182
|
+
el.style.color = '#df513f'
|
|
2183
|
+
})
|
|
2184
|
+
}
|
|
2185
|
+
<\/script>
|
|
2186
|
+
</body>
|
|
2187
|
+
</html>`;
|
|
2188
|
+
}
|
|
2055
2189
|
async function createDevToolsMiddleware(options) {
|
|
2056
2190
|
const h3 = createApp();
|
|
2191
|
+
const contextInternal = getInternalContext(options.context);
|
|
2057
2192
|
const { rpc, getConnectionMeta } = await createWsServer(options);
|
|
2058
2193
|
h3.use(`/${DEVTOOLS_CONNECTION_META_FILENAME}`, eventHandler(async (event) => {
|
|
2059
2194
|
event.node.res.setHeader("Content-Type", "application/json");
|
|
2060
2195
|
return event.node.res.end(JSON.stringify(await getConnectionMeta()));
|
|
2061
2196
|
}));
|
|
2197
|
+
h3.use("/auth-verify", eventHandler((event) => {
|
|
2198
|
+
const { id } = getQuery(event);
|
|
2199
|
+
if (!id) {
|
|
2200
|
+
event.node.res.statusCode = 400;
|
|
2201
|
+
return event.node.res.end("Missing id parameter");
|
|
2202
|
+
}
|
|
2203
|
+
const clientAuthToken = consumeTempAuthToken(id, contextInternal.storage.auth);
|
|
2204
|
+
if (!clientAuthToken) {
|
|
2205
|
+
event.node.res.statusCode = 403;
|
|
2206
|
+
return event.node.res.end("Invalid or expired auth token");
|
|
2207
|
+
}
|
|
2208
|
+
event.node.res.setHeader("Content-Type", "application/json");
|
|
2209
|
+
return event.node.res.end(JSON.stringify({ authToken: clientAuthToken }));
|
|
2210
|
+
}));
|
|
2211
|
+
h3.use("/auth", eventHandler((event) => {
|
|
2212
|
+
event.node.res.setHeader("Content-Type", "text/html");
|
|
2213
|
+
return event.node.res.end(generateAuthPageHtml());
|
|
2214
|
+
}));
|
|
2062
2215
|
h3.use(fromNodeMiddleware(sirv(dirClientStandalone, {
|
|
2063
2216
|
dev: true,
|
|
2064
2217
|
single: true
|
|
@@ -2125,4 +2278,4 @@ async function DevTools(options = {}) {
|
|
|
2125
2278
|
return plugins;
|
|
2126
2279
|
}
|
|
2127
2280
|
//#endregion
|
|
2128
|
-
export { createDevToolsContext as a, getPort as i, renderDockImportsMap as n, ansis_default as o, createDevToolsMiddleware as r, DevTools as t };
|
|
2281
|
+
export { createDevToolsContext as a, getPort as i, renderDockImportsMap as n, ansis_default as o, createDevToolsMiddleware as r, __exportAll as s, DevTools as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as shallowRef, M as watch, V as reactive, z as markRaw } from "./vue.runtime.esm-bundler-
|
|
1
|
+
import { G as shallowRef, M as watch, V as reactive, z as markRaw } from "./vue.runtime.esm-bundler-CS1wMbap.js";
|
|
2
2
|
import { createEventEmitter } from "@vitejs/devtools-kit/utils/events";
|
|
3
3
|
//#region src/client/webcomponents/constants.ts
|
|
4
4
|
const BUILTIN_ENTRY_CLIENT_AUTH_NOTICE = Object.freeze({
|
|
@@ -79,6 +79,7 @@ function docksSplitGroupsWithCapacity(groups, capacity) {
|
|
|
79
79
|
//#region src/client/webcomponents/state/docks.ts
|
|
80
80
|
function DEFAULT_DOCK_PANEL_STORE() {
|
|
81
81
|
return {
|
|
82
|
+
mode: "float",
|
|
82
83
|
width: 80,
|
|
83
84
|
height: 80,
|
|
84
85
|
top: 0,
|
|
@@ -147,6 +148,13 @@ function setDockContextMenu(info) {
|
|
|
147
148
|
function useDockContextMenu() {
|
|
148
149
|
return dockContextMenu;
|
|
149
150
|
}
|
|
151
|
+
const edgePositionDropdown = shallowRef(null);
|
|
152
|
+
function setEdgePositionDropdown(info) {
|
|
153
|
+
edgePositionDropdown.value = info;
|
|
154
|
+
}
|
|
155
|
+
function useEdgePositionDropdown() {
|
|
156
|
+
return edgePositionDropdown;
|
|
157
|
+
}
|
|
150
158
|
//#endregion
|
|
151
159
|
//#region src/client/webcomponents/state/popup.ts
|
|
152
160
|
const PANEL_MIN_SIZE = 20;
|
|
@@ -162,7 +170,7 @@ let detachColorModeSync;
|
|
|
162
170
|
let popupDockElement;
|
|
163
171
|
let popupContext;
|
|
164
172
|
let loadDockStandalone = async () => {
|
|
165
|
-
return await import("./DockStandalone-
|
|
173
|
+
return await import("./DockStandalone-DxFEMDp2.js").then((n) => n.n).then((m) => m.DockStandalone);
|
|
166
174
|
};
|
|
167
175
|
popupEvents.on("popup:open-requested", (context) => {
|
|
168
176
|
openDockPopup(context);
|
|
@@ -353,4 +361,4 @@ async function openDockPopup(context) {
|
|
|
353
361
|
}
|
|
354
362
|
}
|
|
355
363
|
//#endregion
|
|
356
|
-
export {
|
|
364
|
+
export { BUILTIN_ENTRY_CLIENT_AUTH_NOTICE as S, sharedStateToRef as _, triggerMainFrameDockAction as a, docksSplitGroupsWithCapacity as b, setDocksOverflowPanel as c, useDockContextMenu as d, useDocksOverflowPanel as f, createDockEntryState as g, DEFAULT_DOCK_PANEL_STORE as h, requestDockPopupOpen as i, setEdgePositionDropdown as l, useFloatingTooltip as m, isDockPopupSupported as n, useIsDockPopupOpen as o, useEdgePositionDropdown as p, registerMainFrameDockActionHandler as r, setDockContextMenu as s, closeDockPopup as t, setFloatingTooltip as u, useDocksEntries as v, BUILTIN_ENTRIES as x, docksGroupByCategories as y };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitejs/devtools",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.5",
|
|
5
5
|
"description": "Vite DevTools",
|
|
6
6
|
"author": "VoidZero Inc.",
|
|
7
7
|
"license": "MIT",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"./client/webcomponents": "./dist/client/webcomponents.js",
|
|
28
28
|
"./config": "./dist/config.js",
|
|
29
29
|
"./dirs": "./dist/dirs.js",
|
|
30
|
+
"./internal": "./dist/internal.js",
|
|
30
31
|
"./package.json": "./package.json"
|
|
31
32
|
},
|
|
32
33
|
"types": "./dist/index.d.ts",
|
|
@@ -43,20 +44,20 @@
|
|
|
43
44
|
"dependencies": {
|
|
44
45
|
"birpc": "^4.0.0",
|
|
45
46
|
"cac": "^7.0.0",
|
|
46
|
-
"h3": "^1.15.
|
|
47
|
+
"h3": "^1.15.9",
|
|
47
48
|
"immer": "^11.1.4",
|
|
48
49
|
"launch-editor": "^2.13.1",
|
|
49
|
-
"mlly": "^1.8.
|
|
50
|
+
"mlly": "^1.8.2",
|
|
50
51
|
"obug": "^2.1.1",
|
|
51
52
|
"open": "^11.0.0",
|
|
52
53
|
"pathe": "^2.0.3",
|
|
53
54
|
"perfect-debounce": "^2.1.0",
|
|
54
55
|
"sirv": "^3.0.2",
|
|
55
|
-
"tinyexec": "^1.0.
|
|
56
|
+
"tinyexec": "^1.0.4",
|
|
56
57
|
"ws": "^8.19.0",
|
|
57
|
-
"@vitejs/devtools-
|
|
58
|
-
"@vitejs/devtools-
|
|
59
|
-
"@vitejs/devtools-
|
|
58
|
+
"@vitejs/devtools-rolldown": "0.1.5",
|
|
59
|
+
"@vitejs/devtools-kit": "0.1.5",
|
|
60
|
+
"@vitejs/devtools-rpc": "0.1.5"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
63
|
"@clack/prompts": "^1.1.0",
|
|
@@ -64,36 +65,36 @@
|
|
|
64
65
|
"@xterm/addon-fit": "^0.11.0",
|
|
65
66
|
"@xterm/xterm": "^6.0.0",
|
|
66
67
|
"dompurify": "^3.3.3",
|
|
67
|
-
"
|
|
68
|
+
"human-id": "^4.1.3",
|
|
69
|
+
"tsdown": "^0.21.4",
|
|
68
70
|
"typescript": "^5.9.3",
|
|
69
71
|
"unplugin-vue": "^7.1.1",
|
|
70
|
-
"
|
|
71
|
-
"vite": "^8.0.0",
|
|
72
|
+
"vite": "^8.0.1",
|
|
72
73
|
"vue": "^3.5.30",
|
|
73
|
-
"vue-router": "^5.0.
|
|
74
|
-
"vue-tsc": "^3.2.
|
|
75
|
-
"@vitejs/devtools-rolldown": "0.1.
|
|
74
|
+
"vue-router": "^5.0.4",
|
|
75
|
+
"vue-tsc": "^3.2.6",
|
|
76
|
+
"@vitejs/devtools-rolldown": "0.1.5"
|
|
76
77
|
},
|
|
77
78
|
"inlinedDependencies": {
|
|
78
|
-
"@
|
|
79
|
+
"@clack/core": "1.1.0",
|
|
80
|
+
"@clack/prompts": "1.1.0",
|
|
81
|
+
"@json-render/core": "0.13.0",
|
|
82
|
+
"@json-render/vue": "0.13.0",
|
|
79
83
|
"@vue/reactivity": "3.5.30",
|
|
80
84
|
"@vue/runtime-core": "3.5.30",
|
|
81
|
-
"csstype": "3.2.3",
|
|
82
85
|
"@vue/runtime-dom": "3.5.30",
|
|
83
|
-
"vue": "3.5.30",
|
|
86
|
+
"@vue/shared": "3.5.30",
|
|
87
|
+
"@vueuse/core": "14.2.1",
|
|
88
|
+
"@vueuse/shared": "14.2.1",
|
|
84
89
|
"@xterm/addon-fit": "0.11.0",
|
|
85
90
|
"@xterm/xterm": "6.0.0",
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"@json-render/vue": "0.13.0",
|
|
89
|
-
"@vueuse/shared": "14.2.1",
|
|
90
|
-
"@vueuse/core": "14.2.1",
|
|
91
|
+
"ansis": "4.2.0",
|
|
92
|
+
"csstype": "3.2.3",
|
|
91
93
|
"dompurify": "3.3.3",
|
|
94
|
+
"get-port-please": "3.2.0",
|
|
92
95
|
"sisteransi": "1.0.5",
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"ansis": "4.2.0",
|
|
96
|
-
"get-port-please": "3.2.0"
|
|
96
|
+
"vue": "3.5.30",
|
|
97
|
+
"zod": "4.3.6"
|
|
97
98
|
},
|
|
98
99
|
"scripts": {
|
|
99
100
|
"build": "pnpm build:js && pnpm build:standalone",
|
|
@@ -102,6 +103,7 @@
|
|
|
102
103
|
"watch": "tsdown --watch --config-loader=tsx",
|
|
103
104
|
"dev:standalone": "cd src/client/standalone && vite dev",
|
|
104
105
|
"play": "DEBUG='vite:devtools:*' pnpm -C playground run dev",
|
|
106
|
+
"play:debug": "pnpm -C playground run dev:debug",
|
|
105
107
|
"play:standalone": "DEBUG='vite:devtools:*' pnpm -C playground run dev:standalone",
|
|
106
108
|
"cli": "DEBUG='vite:devtools:*' tsx src/node/cli.ts",
|
|
107
109
|
"play:build": "pnpm -C playground run build"
|