@hansenexus/hud 0.3.0 → 0.5.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.
Files changed (172) hide show
  1. package/README.md +782 -6
  2. package/dist/a11y-B5DUaiCs.js +246 -0
  3. package/dist/a11y-panel-p_t4eD7p.js +207 -0
  4. package/dist/access-C7zlaqj6.js +100 -0
  5. package/dist/access-D_ewAEJG.d.ts +61 -0
  6. package/dist/access-panel-CEfTr9ZI.js +123 -0
  7. package/dist/adapter-BYoxPYTI.d.ts +33 -0
  8. package/dist/adapter-hcwmJtNx.js +65 -0
  9. package/dist/auto/runtime.d.ts +65 -0
  10. package/dist/auto/runtime.js +50 -0
  11. package/dist/auto.d.ts +15 -0
  12. package/dist/auto.js +33 -0
  13. package/dist/capabilities-rDSKjXpq.js +110 -0
  14. package/dist/capture-CwrIwLqi.js +300 -0
  15. package/dist/capture-buffer-Bbbo6omF.d.ts +35 -0
  16. package/dist/cli.d.ts +1 -0
  17. package/dist/cli.js +275 -0
  18. package/dist/data-panel-DhxAmP91.js +817 -0
  19. package/dist/data-store-ChF1td_P.js +164 -0
  20. package/dist/define-hud-CHPedaQ5.d.ts +50 -0
  21. package/dist/design-D0kGgPoP.js +87 -0
  22. package/dist/detect-BxHZ0pxW.d.ts +25 -0
  23. package/dist/detect-CHZiSeZs.js +63 -0
  24. package/dist/dispatch-panel-B-xr_Giy.js +279 -0
  25. package/dist/env-CApnbI0r.d.ts +19 -0
  26. package/dist/env-CaiFPIhF.js +31 -0
  27. package/dist/file-xdSaQ2uR.js +103 -0
  28. package/dist/flags-DVtaJ8pQ.d.ts +58 -0
  29. package/dist/flags.d.ts +2 -0
  30. package/dist/flags.js +82 -0
  31. package/dist/force-state-BaqWsmrf.js +153 -0
  32. package/dist/force-state-CCqoTfVB.d.ts +23 -0
  33. package/dist/force-state-panel-_otVYh9i.js +97 -0
  34. package/dist/generate-C8lQl3Eh.js +53 -0
  35. package/dist/handler-BpVhxEmU.js +106 -0
  36. package/dist/handler-DtYVCZY6.d.ts +39 -0
  37. package/dist/index-BAV_1W8a.d.ts +43 -0
  38. package/dist/index-BJ26pse9.d.ts +70 -0
  39. package/dist/index-BnQ0dTZf.d.ts +19 -0
  40. package/dist/index-CwfX-W87.d.ts +72 -0
  41. package/dist/index-DcH9V3cU.d.ts +48 -0
  42. package/dist/index-DqOyNf1u.d.ts +65 -0
  43. package/dist/index-DstI_ike.d.ts +66 -0
  44. package/dist/index-Dxz4fn4j.d.ts +42 -0
  45. package/dist/index-Hhh7OXzU.d.ts +129 -0
  46. package/dist/index-ReFbhQ9p.d.ts +25 -0
  47. package/dist/index-RgXfMBuW.d.ts +48 -0
  48. package/dist/index-gCZBO53s.d.ts +73 -0
  49. package/dist/index.d.ts +6 -36
  50. package/dist/index.js +798 -240
  51. package/dist/inspect-C9Ft8fqn.js +142 -0
  52. package/dist/inspect-root-BkaupBMp.js +429 -0
  53. package/dist/marker-C66LxOhJ.d.ts +9 -0
  54. package/dist/marker-CMrvxPmS.d.ts +12 -0
  55. package/dist/marker-DjeGvL-F.js +9 -0
  56. package/dist/marker-uZYPOJ4M.js +12 -0
  57. package/dist/markers.d.ts +3 -0
  58. package/dist/markers.js +3 -0
  59. package/dist/meta-Bv0sEao3.js +6 -0
  60. package/dist/meta-C_G7MB5w.d.ts +49 -0
  61. package/dist/mocks-CA-wM2SB.d.ts +109 -0
  62. package/dist/mocks-ESiRqk9o.js +150 -0
  63. package/dist/msw-browser-wjaYgkB7.d.ts +31 -0
  64. package/dist/next/config.d.ts +52 -0
  65. package/dist/next/config.js +78 -0
  66. package/dist/next.d.ts +14 -19
  67. package/dist/next.js +7 -30
  68. package/dist/observe-CdDnDBRP.js +89 -0
  69. package/dist/observe-panel-Cgp1M8oT.js +347 -0
  70. package/dist/ops-panel-CEqDe_UT.js +234 -0
  71. package/dist/payload-MUQ9ciER.d.ts +92 -0
  72. package/dist/plugins/a11y.d.ts +2 -0
  73. package/dist/plugins/a11y.js +2 -0
  74. package/dist/plugins/access/server.d.ts +122 -0
  75. package/dist/plugins/access/server.js +340 -0
  76. package/dist/plugins/access.d.ts +41 -0
  77. package/dist/plugins/access.js +51 -0
  78. package/dist/plugins/agent/server.d.ts +94 -0
  79. package/dist/plugins/agent/server.js +455 -0
  80. package/dist/plugins/agent.d.ts +37 -0
  81. package/dist/plugins/agent.js +69 -0
  82. package/dist/plugins/capture/server.d.ts +92 -0
  83. package/dist/plugins/capture/server.js +248 -0
  84. package/dist/plugins/capture.d.ts +24 -0
  85. package/dist/plugins/capture.js +70 -0
  86. package/dist/plugins/data/msw-browser.d.ts +2 -0
  87. package/dist/plugins/data/msw-browser.js +39 -0
  88. package/dist/plugins/data/msw-node.d.ts +36 -0
  89. package/dist/plugins/data/msw-node.js +68 -0
  90. package/dist/plugins/data/server.d.ts +257 -0
  91. package/dist/plugins/data/server.js +717 -0
  92. package/dist/plugins/data.d.ts +6 -0
  93. package/dist/plugins/data.js +51 -0
  94. package/dist/plugins/design/server.d.ts +54 -0
  95. package/dist/plugins/design/server.js +198 -0
  96. package/dist/plugins/design.d.ts +5 -0
  97. package/dist/plugins/design.js +4 -0
  98. package/dist/plugins/inspect/convex.d.ts +2 -0
  99. package/dist/plugins/inspect/convex.js +486 -0
  100. package/dist/plugins/inspect/react-query.d.ts +2 -0
  101. package/dist/plugins/inspect/react-query.js +225 -0
  102. package/dist/plugins/inspect/sockets.d.ts +51 -0
  103. package/dist/plugins/inspect/sockets.js +397 -0
  104. package/dist/plugins/inspect/swr.d.ts +2 -0
  105. package/dist/plugins/inspect/swr.js +218 -0
  106. package/dist/plugins/inspect.d.ts +4 -0
  107. package/dist/plugins/inspect.js +3 -0
  108. package/dist/plugins/observe.d.ts +4 -0
  109. package/dist/plugins/observe.js +2 -0
  110. package/dist/plugins/ops/server.d.ts +82 -0
  111. package/dist/plugins/ops/server.js +381 -0
  112. package/dist/plugins/ops.d.ts +27 -0
  113. package/dist/plugins/ops.js +41 -0
  114. package/dist/plugins/routes/server.d.ts +88 -0
  115. package/dist/plugins/routes/server.js +62 -0
  116. package/dist/plugins/routes.d.ts +3 -0
  117. package/dist/plugins/routes.js +216 -0
  118. package/dist/plugins/seo.d.ts +2 -0
  119. package/dist/plugins/seo.js +2 -0
  120. package/dist/plugins/vitals.d.ts +2 -25
  121. package/dist/plugins/vitals.js +4 -86
  122. package/dist/plugins-BZvDqGx5.d.ts +144 -0
  123. package/dist/{plugins-CzUiTn_r.js → plugins-DVy_vaYr.js} +3 -1
  124. package/dist/poll-CjKsWZi8.js +89 -0
  125. package/dist/requests-BwD6MKEq.js +282 -0
  126. package/dist/requests-CJrUf465.d.ts +50 -0
  127. package/dist/review.d.ts +181 -0
  128. package/dist/review.js +1017 -0
  129. package/dist/same-origin-BGet22CC.js +21 -0
  130. package/dist/scan-DzJNXqOk.js +165 -0
  131. package/dist/selector-NSYSe7AZ.js +28 -0
  132. package/dist/seo-Dq9q_QkO.js +551 -0
  133. package/dist/seo-panel-CfiY-TnT.js +124 -0
  134. package/dist/server.d.ts +3 -39
  135. package/dist/server.js +2 -105
  136. package/dist/sessions-panel-COvhPAzv.js +98 -0
  137. package/dist/shortcut-s_mjGeU8.js +179 -0
  138. package/dist/state-CjjZPjPJ.js +40 -0
  139. package/dist/state-boundary.d.ts +26 -0
  140. package/dist/state-boundary.js +61 -0
  141. package/dist/store/convex.d.ts +33 -0
  142. package/dist/store/convex.js +52 -0
  143. package/dist/store-CQqIIKTc.js +59 -0
  144. package/dist/store-Ync9eb1G.js +67 -0
  145. package/dist/store.d.ts +76 -0
  146. package/dist/store.js +188 -0
  147. package/dist/styles-BA8ueHoV.js +342 -0
  148. package/dist/styles-DKU_P8MH.js +139 -0
  149. package/dist/styles-DPpDPmzi.js +68 -0
  150. package/dist/tokens-panel-CbMQfasZ.js +142 -0
  151. package/dist/types-B-ulf2Jp.js +8 -0
  152. package/dist/types-BIgGf-0C.d.ts +25 -0
  153. package/dist/types-BIkI-qN8.js +30 -0
  154. package/dist/types-Cxh4twqc.d.ts +50 -0
  155. package/dist/types-DIdPfjtV.js +6 -0
  156. package/dist/types-DaJcsEjO.d.ts +44 -0
  157. package/dist/types-Dn68psVz.d.ts +118 -0
  158. package/dist/types-f3jlNxzw.d.ts +92 -0
  159. package/dist/types-szkr2QOF.d.ts +39 -0
  160. package/dist/unlock-store-4V3vR4Eg.js +96 -0
  161. package/dist/variant-groups-TIfO3NIj.js +137 -0
  162. package/dist/variant-groups-aAIrcNK5.d.ts +36 -0
  163. package/dist/variants-panel-BDoSkwBJ.js +457 -0
  164. package/dist/variants-types-CcRf119M.d.ts +63 -0
  165. package/dist/variants.d.ts +43 -0
  166. package/dist/variants.js +83 -0
  167. package/dist/vitals-panel-BCmMUntW.js +30 -0
  168. package/dist/vite.d.ts +37 -0
  169. package/dist/vite.js +134 -0
  170. package/package.json +85 -5
  171. package/dist/define-hud-BHQR8Lbv.d.ts +0 -31
  172. package/dist/plugins-1QmTmZyL.d.ts +0 -76
@@ -0,0 +1,106 @@
1
+ import { a as resolvePlugins, t as HUD_HTTP_METHODS } from "./plugins-DVy_vaYr.js";
2
+ //#region src/server/handler.ts
3
+ function json(status, body, headers) {
4
+ const res = Response.json(body, { status });
5
+ if (headers) for (const [key, value] of new Headers(headers)) res.headers.set(key, value);
6
+ return res;
7
+ }
8
+ function notFound() {
9
+ return json(404, {
10
+ ok: false,
11
+ error: "not found"
12
+ });
13
+ }
14
+ /**
15
+ * The default guard. Core assumes development, so a deployed build that
16
+ * mounts the route without an `access` guard serves nothing and reveals
17
+ * nothing about which plugins exist.
18
+ */
19
+ const developmentOnly = () => {
20
+ return (typeof process === "undefined" ? void 0 : process.env.NODE_ENV) === "development" ? null : notFound();
21
+ };
22
+ function splitPath(path) {
23
+ return path.split("/").filter(Boolean);
24
+ }
25
+ function compile(plugin) {
26
+ return Object.entries(plugin.routes ?? {}).map(([path, methods]) => ({
27
+ segments: splitPath(path),
28
+ methods
29
+ }));
30
+ }
31
+ function match(route, segments) {
32
+ if (route.segments.length !== segments.length) return null;
33
+ const params = {};
34
+ for (const [i, pattern] of route.segments.entries()) {
35
+ const segment = segments[i] ?? "";
36
+ if (!pattern.startsWith(":")) {
37
+ if (pattern !== segment) return null;
38
+ continue;
39
+ }
40
+ try {
41
+ params[pattern.slice(1)] = decodeURIComponent(segment);
42
+ } catch {
43
+ return null;
44
+ }
45
+ }
46
+ return params;
47
+ }
48
+ function isMethod(method) {
49
+ return HUD_HTTP_METHODS.includes(method);
50
+ }
51
+ /**
52
+ * Serves every plugin's routes from one catch-all route
53
+ * (`app/api/hud/[...hud]/route.ts` in Next). A request to
54
+ * `<basePath>/<plugin id>/<path>` reaches that plugin's `routes[path][method]`;
55
+ * unknown plugin or path answers 404, a known path with another method 405.
56
+ *
57
+ * Pass the server halves (`@hansenexus/hud/plugins/<id>/server`): they carry
58
+ * `routes` and no React.
59
+ */
60
+ function createHudHandler(plugins, options = {}) {
61
+ const basePath = splitPath(options.basePath ?? "/api/hud");
62
+ const guard = options.guard ?? developmentOnly;
63
+ const table = new Map(resolvePlugins(plugins, options.can ?? (() => true)).map((plugin) => [plugin.id, {
64
+ plugin,
65
+ routes: compile(plugin)
66
+ }]));
67
+ const handle = async (request) => {
68
+ const segments = splitPath(new URL(request.url).pathname);
69
+ if (!basePath.every((segment, i) => segments[i] === segment)) return notFound();
70
+ const [pluginId, ...rest] = segments.slice(basePath.length);
71
+ const entry = pluginId === void 0 ? void 0 : table.get(pluginId);
72
+ const refusal = await guard(request, entry?.plugin.capability);
73
+ if (refusal) return refusal;
74
+ if (!entry) return notFound();
75
+ for (const route of entry.routes) {
76
+ const params = match(route, rest);
77
+ if (!params) continue;
78
+ const method = request.method === "HEAD" ? "GET" : request.method;
79
+ const fn = isMethod(method) ? route.methods[method] : void 0;
80
+ if (!fn) return json(405, {
81
+ ok: false,
82
+ error: "method not allowed"
83
+ }, { allow: HUD_HTTP_METHODS.filter((m) => route.methods[m]).join(", ") });
84
+ try {
85
+ return await fn(request, { params });
86
+ } catch (error) {
87
+ console.error(`hud: ${entry.plugin.id} ${request.method} /${rest.join("/")} failed`, error);
88
+ return json(500, {
89
+ ok: false,
90
+ error: "plugin route failed"
91
+ });
92
+ }
93
+ }
94
+ return notFound();
95
+ };
96
+ return {
97
+ handle,
98
+ GET: handle,
99
+ POST: handle,
100
+ PUT: handle,
101
+ PATCH: handle,
102
+ DELETE: handle
103
+ };
104
+ }
105
+ //#endregion
106
+ export { developmentOnly as n, createHudHandler as t };
@@ -0,0 +1,39 @@
1
+ import { a as HudHttpMethod, o as HudPlugin, r as HudCapability } from "./plugins-BZvDqGx5.js";
2
+ //#region src/server/handler.d.ts
3
+ /**
4
+ * Decides whether a request may reach a plugin route. Return a `Response` to
5
+ * refuse it (404, 401, 403 ...) or `null` to let it through. The `access`
6
+ * plugin supplies one for deployed tiers.
7
+ */
8
+ type HudGuard = (request: Request, capability: HudCapability | undefined) => Response | null | Promise<Response | null>;
9
+ interface HudHandlerOptions {
10
+ /** Path the catch-all route is mounted at. Default `/api/hud`. */
11
+ basePath?: string;
12
+ /** Default: `developmentOnly`, which answers 404 unless `NODE_ENV` is `development`. */
13
+ guard?: HudGuard;
14
+ /** Drops plugins server side, like `defineHud({ can })` does client side. Default: grant all. */
15
+ can?: (capability: HudCapability) => boolean;
16
+ }
17
+ type HudRequestHandler = (request: Request) => Promise<Response>;
18
+ /** One function per method, so a Next route can `export const { GET, POST } = createHudHandler(...)`. */
19
+ type HudHandler = {
20
+ handle: HudRequestHandler;
21
+ } & Record<HudHttpMethod, HudRequestHandler>;
22
+ /**
23
+ * The default guard. Core assumes development, so a deployed build that
24
+ * mounts the route without an `access` guard serves nothing and reveals
25
+ * nothing about which plugins exist.
26
+ */
27
+ declare const developmentOnly: HudGuard;
28
+ /**
29
+ * Serves every plugin's routes from one catch-all route
30
+ * (`app/api/hud/[...hud]/route.ts` in Next). A request to
31
+ * `<basePath>/<plugin id>/<path>` reaches that plugin's `routes[path][method]`;
32
+ * unknown plugin or path answers 404, a known path with another method 405.
33
+ *
34
+ * Pass the server halves (`@hansenexus/hud/plugins/<id>/server`): they carry
35
+ * `routes` and no React.
36
+ */
37
+ declare function createHudHandler(plugins: readonly HudPlugin[], options?: HudHandlerOptions): HudHandler;
38
+ //#endregion
39
+ export { createHudHandler as a, HudRequestHandler as i, HudHandler as n, developmentOnly as o, HudHandlerOptions as r, HudGuard as t };
@@ -0,0 +1,43 @@
1
+ import { c as HudPluginProps } from "./plugins-BZvDqGx5.js";
2
+ import { a as CaptureOptions } from "./requests-CJrUf465.js";
3
+ //#region src/plugins/observe/info-tab.d.ts
4
+ /** The signed-in user as the app knows it. Every field is optional. */
5
+ interface HudUserInfo {
6
+ name?: string;
7
+ email?: string;
8
+ id?: string;
9
+ role?: string;
10
+ /** App-specific extras (organization, tier, locale ...). */
11
+ extra?: Record<string, string>;
12
+ }
13
+ //#endregion
14
+ //#region src/plugins/observe/index.d.ts
15
+ interface ObserveOptions extends CaptureOptions {
16
+ /**
17
+ * Values for the Info tab, read at the app's import site so Next can inline
18
+ * them: `{ NODE_ENV: process.env.NODE_ENV, CONVEX_URL: process.env.NEXT_PUBLIC_CONVEX_URL }`.
19
+ * `undefined` shows as "not set".
20
+ */
21
+ env?: Readonly<Record<string, string | undefined>>;
22
+ /** A hook returning the signed-in user, called inside the Info tab. */
23
+ useUser?: () => HudUserInfo | null | undefined;
24
+ }
25
+ /**
26
+ * Console and network capture, an app/build/browser/user snapshot and the
27
+ * page's Web Vitals. The pill counts errors; opening the panel while there are
28
+ * any lands on the console filtered to them.
29
+ */
30
+ declare function observe({ env, useUser, ignore }?: ObserveOptions): {
31
+ readonly id: "observe";
32
+ readonly title: "Observe";
33
+ readonly pill: () => import("react").JSX.Element;
34
+ readonly pillPriority: 20;
35
+ readonly panel: ({ ctx }: HudPluginProps) => import("react").JSX.Element;
36
+ readonly commands: readonly [{
37
+ readonly id: "clear";
38
+ readonly title: "Clear console capture";
39
+ readonly run: () => void;
40
+ }];
41
+ };
42
+ //#endregion
43
+ export { observe as n, HudUserInfo as r, ObserveOptions as t };
@@ -0,0 +1,70 @@
1
+ import { n as Preview, t as InspectAdapter } from "./adapter-BYoxPYTI.js";
2
+ //#region src/plugins/inspect/convex/store.d.ts
3
+ interface ConvexQueryEntry {
4
+ id: number;
5
+ /** `messages:list` */
6
+ name: string;
7
+ /** Name plus serialised args; one entry per distinct subscription. */
8
+ key: string;
9
+ args: Preview;
10
+ subscribedAt: number;
11
+ /** Time from the first subscription to the first result; 0 when it was cached. */
12
+ firstResultMs?: number;
13
+ /** Results received after the first. */
14
+ updates: number;
15
+ updatedAt?: number;
16
+ /** Live `onUpdate` callbacks; 0 once everything unsubscribed. */
17
+ subscribers: number;
18
+ value?: Preview;
19
+ error?: string;
20
+ }
21
+ type ConvexCallKind = "mutation" | "action" | "query";
22
+ interface ConvexCall {
23
+ id: number;
24
+ ts: number;
25
+ kind: ConvexCallKind;
26
+ name: string;
27
+ args: Preview;
28
+ status: "pending" | "ok" | "error";
29
+ durationMs?: number;
30
+ result?: Preview;
31
+ error?: string;
32
+ }
33
+ interface ConvexSnapshot {
34
+ queries: readonly ConvexQueryEntry[];
35
+ calls: readonly ConvexCall[];
36
+ }
37
+ //#endregion
38
+ //#region src/plugins/inspect/convex/index.d.ts
39
+ interface WatchLike {
40
+ onUpdate(callback: () => void): () => void;
41
+ localQueryResult(): unknown;
42
+ }
43
+ /**
44
+ * The surface the adapter wraps, structurally: `ConvexReactClient`
45
+ * (`watchQuery`, behind `useQuery`/`useQueries`/`usePaginatedQuery`),
46
+ * `ConvexClient` (`onUpdate`) and `ConvexHttpClient` (`query`) all fit.
47
+ * Method syntax keeps the generic signatures assignable.
48
+ */
49
+ interface ConvexClientLike {
50
+ watchQuery?(query: any, ...argsAndOptions: any[]): WatchLike;
51
+ onUpdate?(query: any, args: any, callback: (result: any) => unknown, onError?: (error: Error) => unknown): any;
52
+ mutation?(mutation: any, ...args: any[]): Promise<any>;
53
+ action?(action: any, ...args: any[]): Promise<any>;
54
+ query?(query: any, ...args: any[]): Promise<any>;
55
+ }
56
+ interface InspectConvexOptions {
57
+ /** The app's client; its query, mutation and action methods are wrapped in place. */
58
+ client: ConvexClientLike;
59
+ }
60
+ /**
61
+ * Convex tab for the inspect plugin: every live query with its latency to
62
+ * the first result, update count and subscriber count, and every mutation,
63
+ * action and one-shot query with its duration and result. Args and results
64
+ * are redacted like request bodies. Wraps the client's methods when called,
65
+ * so subscriptions made before the HUD mounts are seen; `dispose()` restores
66
+ * the client.
67
+ */
68
+ declare function inspectConvex({ client }: InspectConvexOptions): InspectAdapter;
69
+ //#endregion
70
+ export { ConvexQueryEntry as a, ConvexCall as i, InspectConvexOptions as n, ConvexSnapshot as o, inspectConvex as r, ConvexClientLike as t };
@@ -0,0 +1,19 @@
1
+ import { c as HudPluginProps } from "./plugins-BZvDqGx5.js";
2
+ //#region src/plugins/routes/routes-panel.d.ts
3
+ declare function RoutesPanel({ ctx }: HudPluginProps): import("react").JSX.Element;
4
+ //#endregion
5
+ //#region src/plugins/routes/index.d.ts
6
+ /**
7
+ * Route index: every page of the app's `app/` tree, dynamic segments filled
8
+ * from the fixtures the server half knows, one click away. Client half; the
9
+ * scanner lives in `@hansenexus/hud/plugins/routes/server`, which also feeds
10
+ * the `hud sweep` CLI.
11
+ */
12
+ declare function routes(): {
13
+ readonly id: "routes";
14
+ readonly title: "Routes";
15
+ readonly capability: "routes.read";
16
+ readonly panel: typeof RoutesPanel;
17
+ };
18
+ //#endregion
19
+ export { routes as t };
@@ -0,0 +1,72 @@
1
+ import { a as CaptureOptions, t as InspectRequest } from "./requests-CJrUf465.js";
2
+ import { t as InspectAdapter } from "./adapter-BYoxPYTI.js";
3
+ //#region src/plugins/observe/redact.d.ts
4
+ /**
5
+ * Redaction for captured requests. Runs at capture time, so a secret never
6
+ * sits in the HUD's buffer: `authorization`, `cookie`, `set-cookie` and every
7
+ * header, query parameter, form field or JSON key whose name looks like a
8
+ * token are replaced with `[redacted]`, as are bearer tokens and JWTs found
9
+ * in free text.
10
+ */
11
+ declare const REDACTED = "[redacted]";
12
+ declare function isSensitiveKey(key: string): boolean;
13
+ /** Headers as a plain lower-cased record, sensitive values replaced. */
14
+ declare function redactHeaders(headers: Headers | Record<string, string> | Iterable<[string, string]>): Record<string, string>;
15
+ /** Replaces the value of every sensitive query parameter; the rest of the URL is untouched. */
16
+ declare function redactUrl(url: string): string;
17
+ /**
18
+ * Redacts a captured body by its content type: JSON is walked by key, a URL
19
+ * encoded form by field, anything else gets the free-text pass.
20
+ */
21
+ declare function redactBody(text: string, contentType?: string): string;
22
+ //#endregion
23
+ //#region src/plugins/inspect/replay.d.ts
24
+ /**
25
+ * Why a request cannot be replayed, or `null` when it can. Bodies the capture
26
+ * could only describe (blobs, streams, files) cannot be rebuilt.
27
+ */
28
+ declare function replayBlocker(entry: InspectRequest): string | null;
29
+ /**
30
+ * Sends the request again through the page's `fetch`, so the capture records
31
+ * the replay as a new entry tagged `replayOf`. Redacted headers and fields
32
+ * are not resent (their values are gone); cookies go along with
33
+ * `credentials: "include"`. Resolves once the response has arrived.
34
+ */
35
+ declare function replay(entry: InspectRequest): Promise<Response>;
36
+ //#endregion
37
+ //#region src/plugins/inspect/view.d.ts
38
+ type InspectFilter = "all" | "fetch" | "xhr" | "actions" | "errors";
39
+ //#endregion
40
+ //#region src/plugins/inspect/index.d.ts
41
+ declare const INSPECT_CAPABILITY = "inspect.read";
42
+ interface InspectOptions extends Pick<CaptureOptions, "ignore"> {
43
+ /**
44
+ * Extra tabs, one per data source: `inspectConvex`, `inspectReactQuery`,
45
+ * `inspectSwr`, `inspectSockets`, each from its own subpath export.
46
+ */
47
+ adapters?: readonly InspectAdapter[];
48
+ }
49
+ /**
50
+ * Data inspector on top of the observe capture: every fetch, XHR and Next
51
+ * Server Action with timing, status, headers and bodies, and a replay
52
+ * button. `authorization`, `cookie`, `set-cookie` and known token fields are
53
+ * redacted before anything is stored. Needs `inspect.read`.
54
+ *
55
+ * Capture starts when the HUD mounts, so requests made before the panel
56
+ * opens are already listed. It works with or without the observe plugin.
57
+ * Adapters add a tab each; without them the panel is the request list alone.
58
+ */
59
+ declare function inspect({ ignore, adapters }?: InspectOptions): {
60
+ readonly id: "inspect";
61
+ readonly title: "Inspect";
62
+ readonly capability: "inspect.read";
63
+ readonly pill: () => import("react").JSX.Element;
64
+ readonly panel: () => import("react").JSX.Element;
65
+ readonly commands: readonly [{
66
+ readonly id: "clear";
67
+ readonly title: "Clear captured requests";
68
+ readonly run: () => void;
69
+ }];
70
+ };
71
+ //#endregion
72
+ export { replay as a, isSensitiveKey as c, redactUrl as d, InspectFilter as i, redactBody as l, InspectOptions as n, replayBlocker as o, inspect as r, REDACTED as s, INSPECT_CAPABILITY as t, redactHeaders as u };
@@ -0,0 +1,48 @@
1
+ //#region src/plugins/seo/seo-panel.d.ts
2
+ /** Every check grouped, worst level first in the summary; head changes re-check automatically. */
3
+ declare function SeoPanel(): import("react").JSX.Element;
4
+ //#endregion
5
+ //#region src/plugins/seo/checks.d.ts
6
+ type SeoLevel = "ok" | "warn" | "error";
7
+ type SeoGroup = "title" | "description" | "canonical" | "og" | "json-ld" | "hreflang" | "robots";
8
+ interface SeoCheck {
9
+ /** Unique within one run, e.g. `og:image` or `json-ld#2`. */
10
+ id: string;
11
+ group: SeoGroup;
12
+ label: string;
13
+ level: SeoLevel;
14
+ /** The value found, or what is wrong with it. */
15
+ detail: string;
16
+ }
17
+ /** Every SEO check for `doc`, with `page` as the page's own URL (for canonical and hreflang). */
18
+ declare function runSeoChecks(doc: Document, page: URL): SeoCheck[];
19
+ //#endregion
20
+ //#region src/plugins/seo/store.d.ts
21
+ interface SeoSnapshot {
22
+ checks: SeoCheck[];
23
+ errors: number;
24
+ warnings: number;
25
+ /** `null` until the first check ran (server render, before mount). */
26
+ checkedAt: number | null;
27
+ url: string;
28
+ }
29
+ //#endregion
30
+ //#region src/plugins/seo/index.d.ts
31
+ /**
32
+ * Checks the page's title, description, canonical, Open Graph, JSON-LD,
33
+ * hreflang and robots meta, from mount on and again whenever `<head>` changes.
34
+ * The pill shows the error count. Client only.
35
+ */
36
+ declare function seo(): {
37
+ readonly id: "seo";
38
+ readonly title: "SEO";
39
+ readonly pill: () => import("react").JSX.Element;
40
+ readonly panel: import("react").LazyExoticComponent<typeof SeoPanel>;
41
+ readonly commands: readonly [{
42
+ readonly id: "recheck";
43
+ readonly title: "Re-check SEO meta";
44
+ readonly run: () => undefined;
45
+ }];
46
+ };
47
+ //#endregion
48
+ export { SeoLevel as a, SeoGroup as i, SeoSnapshot as n, runSeoChecks as o, SeoCheck as r, seo as t };
@@ -0,0 +1,65 @@
1
+ import { c as HudPluginProps, s as HudPluginContext } from "./plugins-BZvDqGx5.js";
2
+ import "./index-gCZBO53s.js";
3
+ //#region src/plugins/a11y/axe.d.ts
4
+ type AxeImpact = "critical" | "serious" | "moderate" | "minor";
5
+ /** Element path as axe reports it: selectors per shadow-DOM or frame hop. */
6
+ type AxeTarget = readonly (string | readonly string[])[];
7
+ /** The axe-core release the default `axeUrl` fetches. */
8
+ declare const AXE_VERSION = "4.14.0";
9
+ declare const AXE_URL = "https://cdn.jsdelivr.net/npm/axe-core@4.14.0/axe.min.js";
10
+ /** One finding per offending element, what the panel lists and the pill counts. */
11
+ interface A11yFinding {
12
+ /** Stable within one run: `<rule>#<index>`. */
13
+ key: string;
14
+ rule: string;
15
+ impact: AxeImpact | null;
16
+ help: string;
17
+ helpUrl: string;
18
+ target: AxeTarget;
19
+ html: string;
20
+ summary: string;
21
+ }
22
+ //#endregion
23
+ //#region src/plugins/a11y/store.d.ts
24
+ type A11yStatus = "idle" | "loading" | "running" | "done" | "error";
25
+ interface A11ySnapshot {
26
+ status: A11yStatus;
27
+ findings: A11yFinding[];
28
+ /** Findings per impact, for the summary line. */
29
+ counts: Record<AxeImpact, number>;
30
+ error: string | null;
31
+ ranAt: number | null;
32
+ }
33
+ interface A11yRunOptions {
34
+ /** Where axe-core is fetched from on Run. Default: axe-core pinned on jsDelivr (`AXE_URL`). */
35
+ axeUrl?: string;
36
+ /**
37
+ * Resolves axe-core yourself instead of fetching a URL, e.g.
38
+ * `() => import("axe-core")`, so a bundler serves it as its own chunk.
39
+ */
40
+ load?: () => Promise<unknown>;
41
+ /** Passed to `axe.run` on top of the HUD's own exclusion. */
42
+ runOptions?: Record<string, unknown>;
43
+ }
44
+ //#endregion
45
+ //#region src/plugins/a11y/index.d.ts
46
+ type A11yOptions = A11yRunOptions;
47
+ /**
48
+ * On-demand axe-core audit. Nothing is fetched until Run: axe-core comes from
49
+ * `axeUrl` (jsDelivr, pinned) or your own `load` (`() => import("axe-core")`).
50
+ * Findings list by impact; clicking one outlines the element with the grabber
51
+ * overlay. Client only.
52
+ */
53
+ declare function a11y(options?: A11yOptions): {
54
+ readonly id: "a11y";
55
+ readonly title: "A11y";
56
+ readonly pill: () => import("react").JSX.Element;
57
+ readonly panel: ({ ctx }: HudPluginProps) => import("react").JSX.Element;
58
+ readonly commands: readonly [{
59
+ readonly id: "run";
60
+ readonly title: "Run accessibility audit";
61
+ readonly run: (ctx: HudPluginContext) => void;
62
+ }];
63
+ };
64
+ //#endregion
65
+ export { A11yFinding as a, AxeImpact as c, A11yStatus as i, a11y as n, AXE_URL as o, A11ySnapshot as r, AXE_VERSION as s, A11yOptions as t };
@@ -0,0 +1,66 @@
1
+ import { c as HudPluginProps } from "./plugins-BZvDqGx5.js";
2
+ import { s as HudMockScenario } from "./mocks-CA-wM2SB.js";
3
+ import { n as HudMockWorkerModule, r as MockWorkerOptions } from "./msw-browser-wjaYgkB7.js";
4
+ //#region src/plugins/data/data-panel.d.ts
5
+ /**
6
+ * Data panel: the role switch (pick a fixture user; the page reloads signed
7
+ * in as them), feature-flag overrides (cookie or localStorage scope,
8
+ * persisted through the storage seam until reset), the app's seed functions
9
+ * and its mock scenarios (one per endpoint, in the browser and on the
10
+ * server). Needs `data.write` and `dataServer()` in the HUD route.
11
+ */
12
+ declare function DataPanel({ ctx }: HudPluginProps): import("react").JSX.Element;
13
+ //#endregion
14
+ //#region src/plugins/data/data-pill.d.ts
15
+ /** The pill item: who the page is signed in as, how many flags are overridden and how many endpoints are mocked. */
16
+ declare function DataPill({ ctx }: HudPluginProps): import("react").JSX.Element;
17
+ //#endregion
18
+ //#region src/plugins/data/mocks-client.d.ts
19
+ /** `data({ mocks })`: the scenarios and how to start the browser's MSW worker. */
20
+ interface HudMockClientOptions {
21
+ /** The scenarios, the same list `dataServer({ mocks })` and `startMockServer()` get. */
22
+ scenarios: readonly HudMockScenario[];
23
+ /**
24
+ * Loads the worker module on demand: `() => import("@hansenexus/hud/plugins/data/msw-browser")`,
25
+ * or your own `{ startMockWorker }` over a worker the app already runs. Without it client
26
+ * fetches are not mocked and the panel says so.
27
+ */
28
+ worker?: (() => Promise<HudMockWorkerModule>) | undefined;
29
+ /** Passed to `startMockWorker()`. */
30
+ workerOptions?: MockWorkerOptions | undefined;
31
+ }
32
+ interface HudMockClientStatus {
33
+ /** `unconfigured`: no `mocks` on `data()`. `off`: no `worker` loader. `failed`: it rejected; `hint` says why. */
34
+ status: "unconfigured" | "off" | "starting" | "live" | "failed";
35
+ hint?: string;
36
+ }
37
+ //#endregion
38
+ //#region src/plugins/data/index.d.ts
39
+ interface DataOptions {
40
+ /**
41
+ * Mock scenarios in the browser: the scenario list and a loader for the
42
+ * MSW worker module. Without it the panel still toggles scenarios for
43
+ * server fetches and says client fetches are not mocked.
44
+ */
45
+ mocks?: HudMockClientOptions | undefined;
46
+ }
47
+ /**
48
+ * Role switch, feature-flag overrides, seeds and mock scenarios. The pill
49
+ * shows who the page is signed in as, how many flags are overridden and how
50
+ * many endpoints are mocked; the panel picks a fixture user (the page
51
+ * reloads signed in as them, through the auth seam on the server), sets
52
+ * overrides in cookie or localStorage scope, runs the app's seed functions
53
+ * and toggles one scenario per endpoint, persisted through the storage seam
54
+ * until reset. Client half; the server half is `dataServer()` from
55
+ * `@hansenexus/hud/plugins/data/server`. Needs `data.write`, which `access`
56
+ * hard-denies on production.
57
+ */
58
+ declare function data({ mocks }?: DataOptions): {
59
+ readonly id: "data";
60
+ readonly title: "Data";
61
+ readonly capability: "data.write";
62
+ readonly pill: typeof DataPill;
63
+ readonly panel: import("react").LazyExoticComponent<typeof DataPanel>;
64
+ };
65
+ //#endregion
66
+ export { HudMockClientStatus as i, data as n, HudMockClientOptions as r, DataOptions as t };
@@ -0,0 +1,42 @@
1
+ import { t as InspectAdapter } from "./adapter-BYoxPYTI.js";
2
+ //#region src/plugins/inspect/swr/index.d.ts
3
+ /** A key as SWR accepts it: a string, a tuple, an object, or a falsy value. */
4
+ type SwrKey = string | readonly [unknown, ...unknown[]] | Record<string, unknown> | null | undefined | false;
5
+ /** What SWR stores per serialised key; `_k` is the original key, kept for revalidation. */
6
+ interface SwrStateLike {
7
+ data?: unknown;
8
+ error?: unknown;
9
+ isValidating?: boolean;
10
+ isLoading?: boolean;
11
+ _k?: unknown;
12
+ }
13
+ /** The cache from `useSWRConfig()` (a `Map` by default, or the app's provider). */
14
+ interface SwrCacheLike {
15
+ keys(): IterableIterator<string>;
16
+ get(key: string): SwrStateLike | undefined;
17
+ set(key: string, value: SwrStateLike): void;
18
+ delete(key: string): void;
19
+ }
20
+ interface InspectSwrOptions {
21
+ cache: SwrCacheLike;
22
+ /** `mutate` from `useSWRConfig()` or `import { mutate } from "swr"`; called with one key to revalidate it. */
23
+ mutate: (key: SwrKey) => Promise<unknown>;
24
+ }
25
+ interface Stamp {
26
+ updatedAt?: number;
27
+ validatingSince?: number;
28
+ }
29
+ interface SwrEntry {
30
+ key: string;
31
+ state: SwrStateLike;
32
+ stamp: Stamp;
33
+ }
34
+ /**
35
+ * SWR tab for the inspect plugin: every cache key with its data (redacted),
36
+ * error, validation state and age, and Revalidate per key. Wraps the cache's
37
+ * `set` and `delete` when called, so writes are timestamped and the tab
38
+ * re-renders; `dispose()` restores the cache.
39
+ */
40
+ declare function inspectSwr({ cache, mutate }: InspectSwrOptions): InspectAdapter;
41
+ //#endregion
42
+ export { SwrStateLike as a, SwrKey as i, SwrCacheLike as n, inspectSwr as o, SwrEntry as r, InspectSwrOptions as t };