@vitejs/devtools 0.1.3 → 0.1.4

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.
Files changed (43) hide show
  1. package/dist/{DockIcon-BtMEW4VE.js → DockIcon-DNt-Vqy4.js} +29 -29
  2. package/dist/{ToastOverlay-DdeglpI8.js → DockStandalone-CL8hrIeb.js} +449 -267
  3. package/dist/{LogItem-BTrEubKY.js → LogItem-CZM2G41b.js} +9 -7
  4. package/dist/{ViewBuiltinLogs-BL373XPJ.js → ViewBuiltinLogs-1ABRTwzd.js} +5 -5
  5. package/dist/{ViewBuiltinTerminals-DdpE1Ftb.js → ViewBuiltinTerminals-Co7G-321.js} +6 -6
  6. package/dist/{ViewJsonRender-coidkW9b.js → ViewJsonRender-ByPfpKFM.js} +4 -7
  7. package/dist/{cli-commands-BDDMPsV-.js → cli-commands-D6M9N3th.js} +2 -2
  8. package/dist/cli-commands.js +2 -2
  9. package/dist/cli.js +2 -2
  10. package/dist/client/inject.js +4 -3
  11. package/dist/client/standalone/assets/DockStandalone-C8ChyZLh.js +1 -0
  12. package/dist/client/standalone/assets/{LogItem-CKbVrExA.js → LogItem-Mx4UyReX.js} +1 -1
  13. package/dist/client/standalone/assets/{ViewBuiltinLogs-9oWDdl1G.js → ViewBuiltinLogs-C4j4vgSn.js} +1 -1
  14. package/dist/client/standalone/assets/{ViewBuiltinTerminals-DEFrt9ot.js → ViewBuiltinTerminals-UrMq7UXM.js} +2 -2
  15. package/dist/client/standalone/assets/{ViewJsonRender-CKPzRgqQ.js → ViewJsonRender-BURuu55Z.js} +1 -1
  16. package/dist/client/standalone/assets/{dist-JpCJ4ieR.js → dist-DIlAYcjk.js} +1 -1
  17. package/dist/client/standalone/assets/index-BEyoIK7m.css +1 -0
  18. package/dist/client/standalone/assets/index-Rpv7PwRD.js +4 -0
  19. package/dist/client/standalone/assets/runtime-core.esm-bundler-CJlaYmKv.js +1 -0
  20. package/dist/client/standalone/index.html +5 -6
  21. package/dist/client/webcomponents.d.ts +6 -1
  22. package/dist/client/webcomponents.js +297 -83
  23. package/dist/config.d.ts +7 -0
  24. package/dist/config.js +2 -1
  25. package/dist/context-internal-CvIHbZq4.js +74 -0
  26. package/dist/context-internal-Du6FuGIu.d.ts +25 -0
  27. package/dist/{dist-Cgqg5_oP.js → dist-D2Z6bwqJ.js} +1 -1
  28. package/dist/index.d.ts +4 -2
  29. package/dist/index.js +1 -1
  30. package/dist/internal.d.ts +2 -0
  31. package/dist/internal.js +2 -0
  32. package/dist/{plugins-CsDUv5C2.js → plugins-BHefDofV.js} +230 -73
  33. package/dist/{popup-BZ5jBcoC.js → popup-DzgY0boj.js} +11 -3
  34. package/package.json +26 -24
  35. package/dist/DockStandalone-Ca7ix29I.js +0 -78
  36. package/dist/client/standalone/assets/DockStandalone-HVyKJVMX.js +0 -1
  37. package/dist/client/standalone/assets/iconify-C-CPDXMf.js +0 -2
  38. package/dist/client/standalone/assets/index-Mte4BnZO.css +0 -1
  39. package/dist/client/standalone/assets/index-ndsYhKrn.js +0 -3
  40. package/dist/client/standalone/assets/runtime-core.esm-bundler-oO31W4LZ.js +0 -1
  41. /package/dist/{iconify-YyqAMHKf.js → iconify-BW79QmbD.js} +0 -0
  42. /package/dist/{utils-Csuu5uNf.js → utils-DaaVwEUH.js} +0 -0
  43. /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-D2MZbyFr.js";
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
- authId: string;
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-CsDUv5C2.js";
1
+ import { a as createDevToolsContext, r as createDevToolsMiddleware, t as DevTools } from "./plugins-BHefDofV.js";
2
2
  export { DevTools, createDevToolsContext, createDevToolsMiddleware };
@@ -0,0 +1,2 @@
1
+ import { n as InternalAnonymousAuthStorage, r as getInternalContext, t as DevToolsInternalContext } from "./context-internal-Du6FuGIu.js";
2
+ export { type DevToolsInternalContext, type InternalAnonymousAuthStorage, getInternalContext };
@@ -0,0 +1,2 @@
1
+ import { t as getInternalContext } from "./context-internal-CvIHbZq4.js";
2
+ export { getInternalContext };
@@ -1,4 +1,5 @@
1
- import { t as isObject } from "./utils-Csuu5uNf.js";
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 { dirname, join } from "pathe";
10
- import fs, { existsSync } from "node:fs";
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/context-internal.ts
1310
- const internalContextMap = /* @__PURE__ */ new WeakMap();
1311
- function getInternalContext(context) {
1312
- if (!internalContextMap.has(context)) {
1313
- const internalContext = { storage: { auth: createStorage({
1314
- filepath: join(context.workspaceRoot, "node_modules/.vite/devtools/auth.json"),
1315
- initialValue: { trusted: {} }
1316
- }) } };
1317
- internalContextMap.set(context, internalContext);
1318
- }
1319
- return internalContextMap.get(context);
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,99 @@ 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.authId]) {
1332
- session.meta.clientAuthId = query.authId;
1362
+ if (session.meta.isTrusted || storage.value().trusted[query.authToken]) {
1363
+ console.log("trusted", {
1364
+ isTrusted: session.meta.isTrusted,
1365
+ trusted: storage.value().trusted[query.authToken]
1366
+ });
1367
+ session.meta.clientAuthToken = query.authToken;
1333
1368
  session.meta.isTrusted = true;
1334
1369
  return { isTrusted: true };
1335
1370
  }
1336
- const message = [
1337
- `A browser is requesting permissions to connect to the Vite DevTools.`,
1338
- "",
1339
- `User Agent: ${ansis_default.yellow(ansis_default.bold(query.ua || "Unknown"))}`,
1340
- `Origin : ${ansis_default.cyan(ansis_default.bold(query.origin || "Unknown"))}`,
1341
- `Identifier: ${ansis_default.green(ansis_default.bold(query.authId))}`,
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
- })) {
1371
+ if (((context.viteConfig.devtools?.config)?.clientAuthTokens ?? []).includes(query.authToken)) {
1372
+ session.meta.clientAuthToken = query.authToken;
1373
+ session.meta.isTrusted = true;
1374
+ return { isTrusted: true };
1375
+ }
1376
+ if (query.authToken === getTempAuthToken()) {
1351
1377
  storage.mutate((state) => {
1352
- state.trusted[query.authId] = {
1353
- authId: query.authId,
1378
+ state.trusted[query.authToken] = {
1379
+ authToken: query.authToken,
1354
1380
  ua: query.ua,
1355
1381
  origin: query.origin,
1356
1382
  timestamp: Date.now()
1357
1383
  };
1358
1384
  });
1359
- session.meta.clientAuthId = query.authId;
1385
+ session.meta.clientAuthToken = query.authToken;
1360
1386
  session.meta.isTrusted = true;
1361
- Gt(ansis_default.green(ansis_default.bold(`You have granted permissions to ${ansis_default.bold(query.authId)}`)));
1387
+ refreshTempAuthToken();
1362
1388
  return { isTrusted: true };
1363
1389
  }
1364
- Gt(ansis_default.red(ansis_default.bold(`You have denied permissions to ${ansis_default.bold(query.authId)}`)));
1365
- return { isTrusted: false };
1390
+ abortPendingAuth();
1391
+ const tempId = getTempAuthToken();
1392
+ const authUrl = `${context.viteServer?.resolvedUrls?.local?.[0]?.replace(/\/$/, "") ?? `http://localhost:${context.viteConfig.server.port}`}/.devtools/auth?id=${encodeURIComponent(tempId)}`;
1393
+ const message = [
1394
+ `A browser is requesting permissions to connect to the Vite DevTools.`,
1395
+ "",
1396
+ `User Agent : ${ansis_default.yellow(ansis_default.bold(query.ua || "Unknown"))}`,
1397
+ `Origin : ${ansis_default.yellow(ansis_default.bold(query.origin || "Unknown"))}`,
1398
+ `Client Token : ${ansis_default.green(ansis_default.bold(query.authToken))}`,
1399
+ "",
1400
+ `Manual Auth URL : ${ansis_default.cyan(ansis_default.underline(authUrl))}`,
1401
+ `Manual Auth Token : ${ansis_default.cyan(ansis_default.bold(tempId))}`,
1402
+ "",
1403
+ "This will allow the browser to interact with the server, make file changes and run commands.",
1404
+ ansis_default.red(ansis_default.bold("You should only trust your local development browsers."))
1405
+ ];
1406
+ Vt(ansis_default.reset(message.join("\n")), ansis_default.bold(ansis_default.yellow(" Vite DevTools Permission Request ")));
1407
+ if (!process$1.stdout.isTTY) return { isTrusted: false };
1408
+ const abortController = new AbortController();
1409
+ return new Promise((resolve) => {
1410
+ const timeout = setTimeout(() => {
1411
+ abortController.abort();
1412
+ setPendingAuth(null);
1413
+ console.log(ansis_default.yellow`${MARK_INFO} Auth request timed out for ${ansis_default.bold(query.authToken)}`);
1414
+ resolve({ isTrusted: false });
1415
+ }, AUTH_TIMEOUT_MS);
1416
+ setPendingAuth({
1417
+ clientAuthToken: query.authToken,
1418
+ session,
1419
+ ua: query.ua,
1420
+ origin: query.origin,
1421
+ resolve,
1422
+ abortController,
1423
+ timeout
1424
+ });
1425
+ Rt({
1426
+ message: ansis_default.bold(`Do you trust this client (${ansis_default.green(ansis_default.bold(query.authToken))})?`),
1427
+ initialValue: false,
1428
+ signal: abortController.signal
1429
+ }).then((answer) => {
1430
+ clearTimeout(timeout);
1431
+ setPendingAuth(null);
1432
+ if (Ct$1(answer)) return;
1433
+ if (answer) {
1434
+ storage.mutate((state) => {
1435
+ state.trusted[query.authToken] = {
1436
+ authToken: query.authToken,
1437
+ ua: query.ua,
1438
+ origin: query.origin,
1439
+ timestamp: Date.now()
1440
+ };
1441
+ });
1442
+ session.meta.clientAuthToken = query.authToken;
1443
+ session.meta.isTrusted = true;
1444
+ Gt(ansis_default.green(ansis_default.bold(`You have granted permissions to ${ansis_default.bold(query.authToken)}`)));
1445
+ resolve({ isTrusted: true });
1446
+ } else {
1447
+ Gt(ansis_default.red(ansis_default.bold(`You have denied permissions to ${ansis_default.bold(query.authToken)}`)));
1448
+ resolve({ isTrusted: false });
1449
+ }
1450
+ }).catch(() => {
1451
+ clearTimeout(timeout);
1452
+ setPendingAuth(null);
1453
+ });
1454
+ });
1366
1455
  } };
1367
1456
  }
1368
1457
  });
@@ -1964,9 +2053,6 @@ async function checkPort(port, host = process.env.HOST, verbose) {
1964
2053
  }
1965
2054
  return port;
1966
2055
  }
1967
- ansis_default.green("✔");
1968
- const MARK_INFO = ansis_default.blue("ℹ");
1969
- ansis_default.red("✖");
1970
2056
  //#endregion
1971
2057
  //#region src/node/ws.ts
1972
2058
  const debugInvoked = createDebug("vite:devtools:rpc:invoked");
@@ -1990,15 +2076,19 @@ async function createWsServer(options) {
1990
2076
  host,
1991
2077
  https,
1992
2078
  onConnected: (ws, req, meta) => {
1993
- const authId = new URL(req.url ?? "", "http://localhost").searchParams.get("vite_devtools_auth_id") ?? void 0;
2079
+ const authToken = new URL(req.url ?? "", "http://localhost").searchParams.get("vite_devtools_auth_token") ?? void 0;
1994
2080
  if (isClientAuthDisabled) meta.isTrusted = true;
1995
- else if (authId && contextInternal.storage.auth.value().trusted[authId]) {
2081
+ else if (authToken && contextInternal.storage.auth.value().trusted[authToken]) {
1996
2082
  meta.isTrusted = true;
1997
- meta.clientAuthId = authId;
2083
+ meta.clientAuthToken = authToken;
2084
+ } else if (authToken && ((context.viteConfig.devtools?.config)?.clientAuthTokens ?? []).includes(authToken)) {
2085
+ meta.isTrusted = true;
2086
+ meta.clientAuthToken = authToken;
1998
2087
  }
1999
2088
  wsClients.add(ws);
2000
2089
  const color = meta.isTrusted ? ansis_default.green : ansis_default.yellow;
2001
- console.log(color`${MARK_INFO} Websocket client connected. [${meta.id}] [${meta.clientAuthId}] (${meta.isTrusted ? "trusted" : "untrusted"})`);
2090
+ const trustedKeys = Object.keys(contextInternal.storage.auth.value().trusted);
2091
+ 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
2092
  },
2003
2093
  onDisconnected: (ws, meta) => {
2004
2094
  wsClients.delete(ws);
@@ -2052,13 +2142,80 @@ async function createWsServer(options) {
2052
2142
  }
2053
2143
  //#endregion
2054
2144
  //#region src/node/server.ts
2145
+ function generateAuthPageHtml() {
2146
+ return `<!DOCTYPE html>
2147
+ <html>
2148
+ <head>
2149
+ <title>Vite DevTools Authorization</title>
2150
+ <style>
2151
+ html { font-family: system-ui, sans-serif; padding: 2rem; }
2152
+ body { height: 80vh; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1rem; }
2153
+ #message { font-size: 1.2rem; }
2154
+ @media (prefers-color-scheme: dark) { html { background: #1a1a1a; color: #e0e0e0; } }
2155
+ </style>
2156
+ </head>
2157
+ <body>
2158
+ <div id="message">Verifying...</div>
2159
+ <script>
2160
+ const query = new URLSearchParams(location.search)
2161
+ const id = query.get('id')
2162
+ const el = document.getElementById('message')
2163
+
2164
+ if (!id) {
2165
+ el.textContent = '\\u26a0\\ufe0f No auth token found. Please check your URL.'
2166
+ el.style.color = '#df513f'
2167
+ } else {
2168
+ fetch(location.pathname.replace(/\\/$/, '') + '-verify?id=' + encodeURIComponent(id))
2169
+ .then(async (r) => {
2170
+ if (r.status !== 200) throw new Error(await r.text())
2171
+ const data = await r.json()
2172
+ const authToken = data.authToken
2173
+
2174
+ localStorage.setItem('__VITE_DEVTOOLS_CONNECTION_AUTH_TOKEN__', authToken)
2175
+
2176
+ try {
2177
+ const bc = new BroadcastChannel('vite-devtools-auth')
2178
+ bc.postMessage({ type: 'auth-update', authToken: authToken })
2179
+ } catch {}
2180
+
2181
+ el.textContent = '\\u2705 Authorized! You can close this window now.'
2182
+ window.close()
2183
+ })
2184
+ .catch((err) => {
2185
+ el.textContent = '\\u26a0\\ufe0f Failed to authorize: ' + err.message
2186
+ el.style.color = '#df513f'
2187
+ })
2188
+ }
2189
+ <\/script>
2190
+ </body>
2191
+ </html>`;
2192
+ }
2055
2193
  async function createDevToolsMiddleware(options) {
2056
2194
  const h3 = createApp();
2195
+ const contextInternal = getInternalContext(options.context);
2057
2196
  const { rpc, getConnectionMeta } = await createWsServer(options);
2058
2197
  h3.use(`/${DEVTOOLS_CONNECTION_META_FILENAME}`, eventHandler(async (event) => {
2059
2198
  event.node.res.setHeader("Content-Type", "application/json");
2060
2199
  return event.node.res.end(JSON.stringify(await getConnectionMeta()));
2061
2200
  }));
2201
+ h3.use("/auth-verify", eventHandler((event) => {
2202
+ const { id } = getQuery(event);
2203
+ if (!id) {
2204
+ event.node.res.statusCode = 400;
2205
+ return event.node.res.end("Missing id parameter");
2206
+ }
2207
+ const clientAuthToken = consumeTempAuthToken(id, contextInternal.storage.auth);
2208
+ if (!clientAuthToken) {
2209
+ event.node.res.statusCode = 403;
2210
+ return event.node.res.end("Invalid or expired auth token");
2211
+ }
2212
+ event.node.res.setHeader("Content-Type", "application/json");
2213
+ return event.node.res.end(JSON.stringify({ authToken: clientAuthToken }));
2214
+ }));
2215
+ h3.use("/auth", eventHandler((event) => {
2216
+ event.node.res.setHeader("Content-Type", "text/html");
2217
+ return event.node.res.end(generateAuthPageHtml());
2218
+ }));
2062
2219
  h3.use(fromNodeMiddleware(sirv(dirClientStandalone, {
2063
2220
  dev: true,
2064
2221
  single: true
@@ -2125,4 +2282,4 @@ async function DevTools(options = {}) {
2125
2282
  return plugins;
2126
2283
  }
2127
2284
  //#endregion
2128
- export { createDevToolsContext as a, getPort as i, renderDockImportsMap as n, ansis_default as o, createDevToolsMiddleware as r, DevTools as t };
2285
+ 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-D2MZbyFr.js";
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-Ca7ix29I.js").then((m) => m.DockStandalone);
173
+ return await import("./DockStandalone-CL8hrIeb.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 { docksGroupByCategories as _, triggerMainFrameDockAction as a, BUILTIN_ENTRY_CLIENT_AUTH_NOTICE as b, setDocksOverflowPanel as c, useDocksOverflowPanel as d, useFloatingTooltip as f, useDocksEntries as g, sharedStateToRef as h, requestDockPopupOpen as i, setFloatingTooltip as l, createDockEntryState as m, isDockPopupSupported as n, useIsDockPopupOpen as o, DEFAULT_DOCK_PANEL_STORE as p, registerMainFrameDockActionHandler as r, setDockContextMenu as s, closeDockPopup as t, useDockContextMenu as u, docksSplitGroupsWithCapacity as v, BUILTIN_ENTRIES as y };
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.3",
4
+ "version": "0.1.4",
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.6",
47
+ "h3": "^1.15.9",
47
48
  "immer": "^11.1.4",
48
49
  "launch-editor": "^2.13.1",
49
- "mlly": "^1.8.1",
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.2",
56
+ "tinyexec": "^1.0.4",
56
57
  "ws": "^8.19.0",
57
- "@vitejs/devtools-kit": "0.1.3",
58
- "@vitejs/devtools-rpc": "0.1.3",
59
- "@vitejs/devtools-rolldown": "0.1.3"
58
+ "@vitejs/devtools-rpc": "0.1.4",
59
+ "@vitejs/devtools-kit": "0.1.4",
60
+ "@vitejs/devtools-rolldown": "0.1.4"
60
61
  },
61
62
  "devDependencies": {
62
63
  "@clack/prompts": "^1.1.0",
@@ -64,36 +65,37 @@
64
65
  "@xterm/addon-fit": "^0.11.0",
65
66
  "@xterm/xterm": "^6.0.0",
66
67
  "dompurify": "^3.3.3",
67
- "tsdown": "^0.21.2",
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
72
  "unplugin-vue-router": "^0.19.2",
71
- "vite": "^8.0.0",
73
+ "vite": "^8.0.1",
72
74
  "vue": "^3.5.30",
73
- "vue-router": "^5.0.3",
74
- "vue-tsc": "^3.2.5",
75
- "@vitejs/devtools-rolldown": "0.1.3"
75
+ "vue-router": "^5.0.4",
76
+ "vue-tsc": "^3.2.6",
77
+ "@vitejs/devtools-rolldown": "0.1.4"
76
78
  },
77
79
  "inlinedDependencies": {
78
- "@vue/shared": "3.5.30",
80
+ "@clack/core": "1.1.0",
81
+ "@clack/prompts": "1.1.0",
82
+ "@json-render/core": "0.13.0",
83
+ "@json-render/vue": "0.13.0",
79
84
  "@vue/reactivity": "3.5.30",
80
85
  "@vue/runtime-core": "3.5.30",
81
- "csstype": "3.2.3",
82
86
  "@vue/runtime-dom": "3.5.30",
83
- "vue": "3.5.30",
87
+ "@vue/shared": "3.5.30",
88
+ "@vueuse/core": "14.2.1",
89
+ "@vueuse/shared": "14.2.1",
84
90
  "@xterm/addon-fit": "0.11.0",
85
91
  "@xterm/xterm": "6.0.0",
86
- "zod": "4.3.6",
87
- "@json-render/core": "0.13.0",
88
- "@json-render/vue": "0.13.0",
89
- "@vueuse/shared": "14.2.1",
90
- "@vueuse/core": "14.2.1",
92
+ "ansis": "4.2.0",
93
+ "csstype": "3.2.3",
91
94
  "dompurify": "3.3.3",
95
+ "get-port-please": "3.2.0",
92
96
  "sisteransi": "1.0.5",
93
- "@clack/core": "1.1.0",
94
- "@clack/prompts": "1.1.0",
95
- "ansis": "4.2.0",
96
- "get-port-please": "3.2.0"
97
+ "vue": "3.5.30",
98
+ "zod": "4.3.6"
97
99
  },
98
100
  "scripts": {
99
101
  "build": "pnpm build:js && pnpm build:standalone",