@omniaura/solid-pulse 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -0
- package/dist/bridge.d.ts +202 -0
- package/dist/bridge.js +10 -0
- package/dist/bridge.js.map +1 -0
- package/dist/chunk-4QA2G6S3.js +15 -0
- package/dist/chunk-4QA2G6S3.js.map +1 -0
- package/dist/chunk-5FYH2KEZ.js +66 -0
- package/dist/chunk-5FYH2KEZ.js.map +1 -0
- package/dist/chunk-C72EYM65.js +462 -0
- package/dist/chunk-C72EYM65.js.map +1 -0
- package/dist/chunk-IXNWEUNF.js +114 -0
- package/dist/chunk-IXNWEUNF.js.map +1 -0
- package/dist/chunk-TVSI7G5S.js +414 -0
- package/dist/chunk-TVSI7G5S.js.map +1 -0
- package/dist/chunk-WIMCBTHZ.js +21 -0
- package/dist/chunk-WIMCBTHZ.js.map +1 -0
- package/dist/cli.js +229 -0
- package/dist/cli.js.map +1 -0
- package/dist/controller-3akN6Qi0.d.ts +210 -0
- package/dist/core.d.ts +76 -0
- package/dist/core.js +41 -0
- package/dist/core.js.map +1 -0
- package/dist/index.d.ts +175 -0
- package/dist/index.js +987 -0
- package/dist/index.js.map +1 -0
- package/dist/panel.d.ts +34 -0
- package/dist/panel.js +408 -0
- package/dist/panel.js.map +1 -0
- package/dist/query.d.ts +93 -0
- package/dist/query.js +164 -0
- package/dist/query.js.map +1 -0
- package/dist/vite.d.ts +41 -0
- package/dist/vite.js +76 -0
- package/dist/vite.js.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/panel/index.ts"],"sourcesContent":["/**\n * The panel: a raw-DOM floating drawer (no Solid, so it never shows up in the\n * events it displays). Every control carries `data-command=\"<name>\"` and calls\n * `controller.run(name, args)` — exactly what the CLI does. The parity test\n * asserts that every command that declares a `ui` location has a control here\n * and that every control maps to a registered command.\n */\n\nimport type { Pulse } from \"../index.js\";\nimport type { PulseEvent } from \"../core/events.js\";\nimport { OWN_ATTR } from \"../overlay/flash.js\";\nimport { FEATURES, type Feature } from \"../core/controller.js\";\n\nexport interface PanelTab {\n id: string;\n title: string;\n /** Called once when the tab body is created; return a cleanup. */\n mount: (el: HTMLElement, pulse: Pulse) => void | (() => void);\n}\n\nexport interface PanelOptions {\n tabs?: PanelTab[];\n /** Start open (default false). Opening never moves focus. */\n open?: boolean;\n position?: \"bottom-left\" | \"bottom-right\";\n /** Max rows in the live list (default 150). */\n rows?: number;\n}\n\ntype Attrs = Record<string, string | boolean | ((e: Event) => void) | undefined>;\n\nfunction h<K extends keyof HTMLElementTagNameMap>(tag: K, attrs: Attrs = {}, ...children: (Node | string | null | undefined)[]): HTMLElementTagNameMap[K] {\n const el = document.createElement(tag);\n for (const [k, v] of Object.entries(attrs)) {\n if (v === undefined || v === false) continue;\n if (typeof v === \"function\") el.addEventListener(k.replace(/^on/, \"\").toLowerCase(), v as EventListener);\n else if (k === \"class\") el.className = String(v);\n else if (k === \"text\") el.textContent = String(v);\n else el.setAttribute(k, v === true ? \"\" : String(v));\n }\n for (const c of children) if (c != null) el.append(c);\n return el;\n}\n\nconst CSS = `\n[${OWN_ATTR}=\"panel-root\"]{position:fixed;z-index:2147483647;font:12px/1.35 ui-monospace,SFMono-Regular,Menlo,monospace;color:#e5e7eb;pointer-events:none}\n[${OWN_ATTR}=\"panel-root\"] *{box-sizing:border-box}\n.sp-fab{pointer-events:auto;position:fixed;bottom:12px;width:auto;padding:6px 10px;border-radius:999px;border:1px solid #f59e0b;background:rgba(17,24,39,.92);color:#fbbf24;cursor:pointer;font:inherit;box-shadow:0 4px 14px rgba(0,0,0,.35)}\n.sp-fab[data-rec=\"1\"]{border-color:#ef4444;color:#fca5a5}\n.sp-drawer{pointer-events:auto;position:fixed;bottom:0;left:0;right:0;height:42vh;min-height:220px;background:rgba(17,24,39,.97);border-top:1px solid #374151;display:flex;flex-direction:column;box-shadow:0 -8px 30px rgba(0,0,0,.4)}\n.sp-head{display:flex;align-items:center;gap:8px;padding:6px 10px;border-bottom:1px solid #374151}\n.sp-head b{color:#fbbf24}\n.sp-tabs{display:flex;gap:2px}\n.sp-tab{background:transparent;border:1px solid transparent;color:#9ca3af;padding:3px 8px;border-radius:6px;cursor:pointer;font:inherit}\n.sp-tab[aria-selected=\"true\"]{color:#fff;border-color:#4b5563;background:#1f2937}\n.sp-body{flex:1;overflow:auto;padding:8px 10px}\n.sp-body[hidden]{display:none}\n.sp-row{display:flex;flex-wrap:wrap;gap:6px 10px;align-items:center;margin-bottom:6px}\n.sp-btn{background:#1f2937;border:1px solid #4b5563;color:#e5e7eb;padding:3px 8px;border-radius:6px;cursor:pointer;font:inherit}\n.sp-btn:hover{border-color:#9ca3af}\n.sp-in{background:#111827;border:1px solid #4b5563;color:#e5e7eb;padding:3px 6px;border-radius:6px;font:inherit;min-width:120px}\n.sp-list{font-size:11px;white-space:pre-wrap;word-break:break-word}\n.sp-ev{padding:2px 4px;border-left:3px solid transparent;cursor:pointer}\n.sp-ev:hover{background:#1f2937}\n.sp-ev[data-g=\"solid\"]{border-color:#22c55e}.sp-ev[data-g=\"dom\"]{border-color:#f59e0b}.sp-ev[data-g=\"net\"]{border-color:#a78bfa}.sp-ev[data-g=\"query\"]{border-color:#3b82f6}.sp-ev[data-g=\"pulse\"]{border-color:#6b7280}\n.sp-ev[data-warn=\"1\"]{background:rgba(239,68,68,.15)}\n.sp-ev pre{margin:4px 0 6px 10px;color:#9ca3af;max-height:220px;overflow:auto}\n.sp-dim{color:#9ca3af}\n.sp-status{margin-left:auto;display:flex;gap:8px;color:#9ca3af}\n.sp-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:#6b7280;margin-right:4px}\n.sp-dot[data-on=\"1\"]{background:#22c55e}\n`;\n\nfunction group(kind: string) {\n return kind.split(\".\")[0] ?? \"pulse\";\n}\n\nfunction isWarn(e: PulseEvent) {\n if (e.kind === \"dom.reattach\") {\n const d = e.data as { scrollReset?: Array<{ reset: boolean }>; focusLost?: boolean };\n return Boolean(d.focusLost || d.scrollReset?.some((s) => s.reset));\n }\n return e.kind === \"focus.lost\" || e.kind.endsWith(\".error\") || e.kind === \"solid.component.remount\";\n}\n\nfunction oneLine(e: PulseEvent): string {\n const d = e.data;\n const comp = e.component?.name ? `<${e.component.name}> ` : \"\";\n switch (e.kind) {\n case \"solid.flush\":\n return `${comp}${d.computations} computations ${JSON.stringify(d.byKind)}`;\n case \"solid.component.mount\":\n case \"solid.component.remount\":\n case \"solid.component.dispose\":\n return `${d.name}${d.hydrated ? \" (hydrated)\" : \"\"}${d.gapMs !== undefined ? ` gap ${d.gapMs}ms` : \"\"}${d.lifetimeMs !== undefined ? ` lived ${d.lifetimeMs}ms` : \"\"}`;\n case \"dom.mutation\":\n return `${comp}${d.targets} targets · ${(d.summary as Array<{ tag: string; types: string[] }>).slice(0, 3).map((s) => `${s.tag}(${s.types.join(\"+\")})`).join(\" \")} · ${d.attributedTo}`;\n case \"dom.detach\":\n return `${comp}${(d.element as { tag: string }).tag} detached · ${(d.scrollers as unknown[]).length} scrollers${d.hadFocus ? \" · had focus\" : \"\"}`;\n case \"dom.reattach\": {\n const resets = (d.scrollReset as Array<{ reset: boolean; before: number; after: number }>).filter((s) => s.reset);\n return `${comp}${(d.element as { tag: string }).tag} reattached after ${d.gapMs}ms${resets.length ? ` · SCROLL RESET ${resets.map((r) => `${r.before}→${r.after}`).join(\",\")}` : \"\"}${d.focusLost ? \" · FOCUS LOST\" : \"\"}${d.suspenseInChain ? \" · Suspense\" : \"\"}`;\n }\n case \"focus.lost\":\n return `${(d.element as { tag: string }).tag} — ${d.cause}`;\n default:\n if (e.kind.startsWith(\"net.\")) return `${comp}${d.method ?? \"\"} ${d.url ?? \"\"} ${d.status ?? d.state ?? d.dir ?? d.event ?? \"\"}${d.ms !== undefined ? ` ${d.ms}ms` : \"\"}${d.message ? ` ✗ ${d.message}` : \"\"}`.trim();\n if (e.kind.startsWith(\"query\") || e.kind.startsWith(\"mutation\")) return `${comp}${d.label ?? \"\"} ${d.role ?? d.trigger ?? d.action ?? \"\"}${d.ms != null ? ` ${d.ms}ms` : \"\"}${d.message ? ` ✗ ${d.message}` : \"\"}`.trim();\n return JSON.stringify(d).slice(0, 140);\n }\n}\n\nexport function mountPanel(pulse: Pulse, options: PanelOptions = {}) {\n const { controller } = pulse;\n const rows = options.rows ?? 150;\n const root = h(\"div\", { [OWN_ATTR]: \"panel-root\" });\n const style = h(\"style\");\n style.textContent = CSS;\n root.append(style);\n const fab = h(\"button\", { class: \"sp-fab\", type: \"button\", title: \"solid-pulse panel (also: solid-pulse panel.toggle)\", \"data-command\": \"panel.toggle\", onclick: () => void controller.run(\"panel.toggle\") }, \"◉ pulse\");\n fab.style[options.position === \"bottom-right\" ? \"right\" : \"left\"] = \"12px\";\n root.append(fab);\n\n let open = false;\n let drawer: HTMLDivElement | null = null;\n let activeTab = \"pulse\";\n const bodies = new Map<string, HTMLElement>();\n const tabButtons = new Map<string, HTMLButtonElement>();\n const cleanups: Array<() => void> = [];\n\n const run = (name: string, args: Record<string, unknown> = {}) => controller.run(name, args);\n const val = (r: Awaited<ReturnType<typeof run>>) => (r.ok ? r.value : { error: r.error });\n\n // ── Pulse tab ────────────────────────────────────────────────────\n const pulseBody = h(\"div\", { class: \"sp-body\" });\n const toggles = h(\"div\", { class: \"sp-row\", \"data-command\": \"features.list\" });\n const featureBoxes = new Map<Feature, HTMLInputElement>();\n for (const f of FEATURES) {\n const box = h(\"input\", { type: \"checkbox\", \"data-command\": \"features.set\", \"data-feature\": f, onchange: (e) => void run(\"features.set\", { name: f, on: (e.target as HTMLInputElement).checked }) });\n box.checked = controller.isOn(f);\n featureBoxes.set(f, box);\n toggles.append(h(\"label\", {}, box, ` ${f}`));\n }\n const kindsIn = h(\"input\", { class: \"sp-in\", placeholder: \"kinds: dom,query,net.ws.*\", \"data-command\": \"filters.set\", \"data-arg\": \"kinds\", onchange: (e) => void run(\"filters.set\", { kinds: (e.target as HTMLInputElement).value }) });\n const compIn = h(\"input\", { class: \"sp-in\", placeholder: \"component contains…\", \"data-command\": \"filters.set\", \"data-arg\": \"component\", onchange: (e) => void run(\"filters.set\", { component: (e.target as HTMLInputElement).value }) });\n const textIn = h(\"input\", { class: \"sp-in\", placeholder: \"text contains…\", \"data-command\": \"filters.set\", \"data-arg\": \"text\", onchange: (e) => void run(\"filters.set\", { text: (e.target as HTMLInputElement).value }) });\n const pauseBtn = h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"events.pause\", onclick: () => void run(controller.bus.paused ? \"events.resume\" : \"events.pause\").then(refreshStatus) }, \"Pause\");\n const list = h(\"div\", { class: \"sp-list\" });\n pulseBody.append(\n toggles,\n h(\"div\", { class: \"sp-row\" }, kindsIn, compIn, textIn,\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"filters.get\", onclick: () => void run(\"filters.get\").then((r) => showResult(pulseBody, val(r))) }, \"Filters\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"events.clear\", onclick: () => void run(\"events.clear\").then(() => (list.textContent = \"\")) }, \"Clear\"),\n pauseBtn,\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"inspect.components\", onclick: () => void run(\"inspect.components\").then((r) => showResult(pulseBody, val(r))) }, \"Components\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"inspect.solid\", onclick: () => void run(\"inspect.solid\").then((r) => showResult(pulseBody, val(r))) }, \"Solid\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"inspect.focus\", onclick: () => void run(\"inspect.focus\").then((r) => showResult(pulseBody, val(r))) }, \"Focus\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"inspect.scrollers\", onclick: () => void run(\"inspect.scrollers\").then((r) => showResult(pulseBody, val(r))) }, \"Scrollers\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"events.list\", onclick: () => void run(\"events.list\", { limit: rows }).then((r) => renderList(r.ok ? (r.value as PulseEvent[]) : [])) }, \"Reload\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"status\", onclick: () => void run(\"status\").then((r) => showResult(pulseBody, val(r))) }, \"Status\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"commands\", onclick: () => void run(\"commands\").then((r) => showResult(pulseBody, val(r))) }, \"Commands\"),\n ),\n list,\n );\n bodies.set(\"pulse\", pulseBody);\n\n const resultBoxes = new WeakMap<HTMLElement, HTMLPreElement>();\n function showResult(body: HTMLElement, value: unknown) {\n let pre = resultBoxes.get(body);\n if (!pre) {\n pre = h(\"pre\", { class: \"sp-dim\" });\n pre.style.cssText = \"max-height:40%;overflow:auto;margin:0 0 6px;border:1px solid #374151;padding:6px;border-radius:6px\";\n body.insertBefore(pre, body.children[body === pulseBody ? 2 : 1] ?? null);\n resultBoxes.set(body, pre);\n }\n pre.textContent = JSON.stringify(value, null, 2);\n }\n\n function rowFor(e: PulseEvent) {\n const row = h(\"div\", { class: \"sp-ev\", \"data-g\": group(e.kind), \"data-warn\": isWarn(e) ? \"1\" : undefined, \"data-seq\": String(e.seq) });\n row.append(h(\"span\", { class: \"sp-dim\" }, `${(e.t / 1000).toFixed(3)}s `), h(\"span\", {}, `${e.kind} `), h(\"span\", { class: \"sp-dim\" }, oneLine(e)));\n row.addEventListener(\"click\", () => {\n const existing = row.querySelector(\"pre\");\n if (existing) existing.remove();\n else row.append(h(\"pre\", {}, JSON.stringify(e, null, 2)));\n });\n return row;\n }\n\n function renderList(events: PulseEvent[]) {\n list.textContent = \"\";\n for (const e of events.slice(-rows)) list.append(rowFor(e));\n list.lastElementChild?.scrollIntoView({ block: \"nearest\" });\n }\n\n let autoScroll = true;\n list.addEventListener(\"scroll\", () => {\n autoScroll = list.scrollTop + list.clientHeight >= list.scrollHeight - 24;\n });\n cleanups.push(\n controller.bus.subscribe((e) => {\n if (!open || activeTab !== \"pulse\") return;\n if (!controller.matchesFilters(e)) return;\n list.append(rowFor(e));\n while (list.children.length > rows) list.firstElementChild?.remove();\n if (autoScroll) list.scrollTop = list.scrollHeight;\n }),\n );\n cleanups.push(controller.onFeature((f, on) => {\n const box = featureBoxes.get(f);\n if (box) box.checked = on;\n }));\n cleanups.push(controller.onFilters((f) => {\n kindsIn.value = f.kinds.join(\",\");\n compIn.value = f.component;\n textIn.value = f.text;\n }));\n\n // ── Query tab ────────────────────────────────────────────────────\n const queryBody = h(\"div\", { class: \"sp-body\" });\n const querySlot = h(\"div\", { \"data-slot\": \"query-devtools\" });\n const queryHint = h(\"span\", { class: \"sp-dim\" });\n const refreshQueryHint = () => {\n queryHint.textContent = controller.has(\"inspect.queries\") ? \"solid-query adapter attached\" : \"attach with attachQueryClient(pulse, queryClient) to enable\";\n };\n refreshQueryHint();\n queryBody.append(\n h(\"div\", { class: \"sp-row\" },\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"inspect.queries\", onclick: () => void run(\"inspect.queries\", { active: true }).then((r) => showResult(queryBody, r.ok ? r.value : r.error)) }, \"Active queries\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"query.invalidate\", onclick: () => void run(\"query.invalidate\").then((r) => showResult(queryBody, r.ok ? r.value : r.error)) }, \"Invalidate all\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"query.reset\", onclick: () => void run(\"query.reset\").then((r) => showResult(queryBody, r.ok ? r.value : r.error)) }, \"Reset all\"),\n queryHint,\n ),\n querySlot,\n );\n bodies.set(\"query\", queryBody);\n\n // ── Grab tab ─────────────────────────────────────────────────────\n const grabBody = h(\"div\", { class: \"sp-body\" });\n const selIn = h(\"input\", { class: \"sp-in\", placeholder: \"CSS selector\", \"data-arg\": \"selector\" });\n const hasGrab = Boolean((window as unknown as { __SOLID_GRAB__?: unknown }).__SOLID_GRAB__);\n grabBody.append(\n h(\"div\", { class: \"sp-row\" },\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"inspect.element\", onclick: () => pickElement() }, \"Pick element (click)\"),\n selIn,\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"inspect.element\", \"data-arg\": \"selector\", onclick: () => void run(\"inspect.element\", { selector: selIn.value }).then((r) => showResult(grabBody, r.ok ? r.value : r.error)) }, \"Inspect selector\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"dom.highlight\", onclick: () => void run(\"dom.highlight\", { selector: selIn.value, all: true }).then((r) => showResult(grabBody, r.ok ? r.value : r.error)) }, \"Highlight\"),\n h(\"span\", { class: \"sp-dim\" }, hasGrab ? \"solid-grab detected: Alt+click anywhere copies source context\" : \"solid-grab not detected (source attributes need its Vite plugin)\"),\n ),\n );\n bodies.set(\"grab\", grabBody);\n\n function pickElement() {\n const onClick = (ev: MouseEvent) => {\n ev.preventDefault();\n ev.stopPropagation();\n document.removeEventListener(\"click\", onClick, true);\n void run(\"inspect.element\", { x: ev.clientX, y: ev.clientY }).then((r) => {\n showResult(grabBody, r.ok ? r.value : r.error);\n if (r.ok) void run(\"dom.highlight\", { selector: (r.value as { selector: string }).selector });\n });\n };\n document.addEventListener(\"click\", onClick, true);\n }\n\n // ── Scenarios tab (present when a scenario client registered commands) ──\n const scenBody = h(\"div\", { class: \"sp-body\" });\n const scenSelect = h(\"select\", { class: \"sp-in\", \"data-command\": \"scenario.select\", onchange: (e) => void run(\"scenario.select\", { name: (e.target as HTMLSelectElement).value }).then(refreshScenario) });\n const seedIn = h(\"input\", { class: \"sp-in\", placeholder: \"seed (optional)\", \"data-arg\": \"seed\" });\n const stepIn = h(\"input\", { class: \"sp-in\", placeholder: \"step ms (default 1000)\", \"data-arg\": \"ms\" });\n const scenStatus = h(\"pre\", { class: \"sp-dim\" });\n scenBody.append(\n h(\"div\", { class: \"sp-row\" },\n h(\"span\", {}, \"scenario\"), scenSelect, seedIn,\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"scenario.reset\", onclick: () => void run(\"scenario.reset\", { seed: seedIn.value || undefined }).then(refreshScenario) }, \"Reset\"),\n stepIn,\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"scenario.step\", onclick: () => void run(\"scenario.step\", { ms: stepIn.value ? Number(stepIn.value) : 1000 }).then(refreshScenario) }, \"Step clock\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"scenario.status\", onclick: () => void refreshScenario() }, \"Status\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"scenario.state\", onclick: () => void run(\"scenario.state\").then((r) => showResult(scenBody, r.ok ? r.value : r.error)) }, \"State\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"scenario.events\", onclick: () => void run(\"scenario.events\", { limit: 100 }).then((r) => showResult(scenBody, r.ok ? r.value : r.error)) }, \"Sim events\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"scenario.streams\", onclick: () => void run(\"scenario.streams\").then((r) => showResult(scenBody, r.ok ? r.value : r.error)) }, \"Streams\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"scenario.list\", onclick: () => void refreshScenario() }, \"Reload list\"),\n ),\n scenStatus,\n );\n bodies.set(\"scenarios\", scenBody);\n\n async function refreshScenario() {\n if (!controller.has(\"scenario.list\")) {\n scenStatus.textContent = \"no scenario simulator attached (attach @omniaura/scenario-sim's pulse adapter)\";\n return;\n }\n const listRes = await run(\"scenario.list\");\n const status = await run(\"scenario.status\");\n if (listRes.ok) {\n const scenarios = listRes.value as Array<{ name: string; label?: string }>;\n const current = status.ok ? (status.value as { scenario?: string }).scenario : undefined;\n scenSelect.textContent = \"\";\n for (const s of scenarios) {\n const opt = h(\"option\", { value: s.name }, s.label ? `${s.name} — ${s.label}` : s.name);\n if (s.name === current) opt.selected = true;\n scenSelect.append(opt);\n }\n }\n scenStatus.textContent = JSON.stringify(status.ok ? status.value : status.error, null, 2);\n }\n\n // ── Record tab ───────────────────────────────────────────────────\n const recBody = h(\"div\", { class: \"sp-body\" });\n const noteIn = h(\"input\", { class: \"sp-in\", placeholder: \"note text\", \"data-arg\": \"text\" });\n const recList = h(\"pre\", { class: \"sp-dim\" });\n recBody.append(\n h(\"div\", { class: \"sp-row\" },\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"record.start\", onclick: () => void run(\"record.start\").then(() => refreshRecordings()) }, \"Start recording\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"record.stop\", onclick: () => void run(\"record.stop\").then(() => refreshRecordings()) }, \"Stop\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"record.list\", onclick: () => void refreshRecordings() }, \"List\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"export\", onclick: () => void exportJson() }, \"Export JSON\"),\n noteIn,\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"note\", onclick: () => void run(\"note\", { text: noteIn.value }).then(() => (noteIn.value = \"\")) }, \"Add note\"),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"events.resume\", onclick: () => void run(\"events.resume\").then(refreshStatus) }, \"Resume\"),\n ),\n recList,\n );\n bodies.set(\"record\", recBody);\n\n async function refreshRecordings() {\n const r = await run(\"record.list\");\n recList.textContent = JSON.stringify(val(r), null, 2);\n refreshStatus();\n }\n async function exportJson() {\n const active = controller.bus.currentRecording();\n const last = controller.bus.listRecordings().filter((r) => !r.active).at(-1);\n const r = await run(\"export\", active || !last ? { filtered: false } : { recording: last.id });\n if (!r.ok) return showResult(recBody, r.error);\n const blob = new Blob([JSON.stringify(r.value)], { type: \"application/json\" });\n const a = h(\"a\", { href: URL.createObjectURL(blob), download: `solid-pulse-${Date.now()}.json` });\n a.click();\n setTimeout(() => URL.revokeObjectURL(a.href), 1000);\n }\n\n for (const tab of options.tabs ?? []) {\n const body = h(\"div\", { class: \"sp-body\" });\n const cleanup = tab.mount(body, pulse);\n if (cleanup) cleanups.push(cleanup);\n bodies.set(tab.id, body);\n }\n\n // ── Drawer ───────────────────────────────────────────────────────\n const bridgeDot = h(\"span\", { class: \"sp-dot\" });\n const recDot = h(\"span\", { class: \"sp-dot\" });\n const statusText = h(\"span\", { \"data-command\": \"panel.status\" });\n function refreshStatus() {\n bridgeDot.dataset.on = pulse.bridge?.connected ? \"1\" : \"0\";\n recDot.dataset.on = controller.bus.currentRecording() ? \"1\" : \"0\";\n fab.dataset.rec = controller.bus.currentRecording() ? \"1\" : \"0\";\n pauseBtn.textContent = controller.bus.paused ? \"Resume\" : \"Pause\";\n statusText.textContent = `${controller.bus.buffer.size}/${controller.bus.buffer.capacity} buffered · ${controller.bus.buffer.dropped} dropped${pulse.bridge ? ` · ${pulse.bridge.clientId}` : \"\"}`;\n }\n const statusTimer = setInterval(() => open && refreshStatus(), 1000);\n cleanups.push(() => clearInterval(statusTimer));\n\n function buildDrawer() {\n const tabs = h(\"div\", { class: \"sp-tabs\", role: \"tablist\" });\n const titles: Record<string, string> = { pulse: \"Pulse\", query: \"Query\", grab: \"Grab\", scenarios: \"Scenarios\", record: \"Record\" };\n for (const t of options.tabs ?? []) titles[t.id] = t.title;\n for (const [id, body] of bodies) {\n const btn = h(\"button\", { class: \"sp-tab\", type: \"button\", role: \"tab\", \"data-command\": \"panel.tab\", \"data-tab\": id, onclick: () => void run(\"panel.tab\", { name: id }) }, titles[id] ?? id);\n tabButtons.set(id, btn);\n tabs.append(btn);\n body.hidden = id !== activeTab;\n }\n const head = h(\"div\", { class: \"sp-head\" },\n h(\"b\", {}, \"◉ solid-pulse\"),\n tabs,\n h(\"span\", { class: \"sp-status\" }, h(\"span\", {}, bridgeDot, \"bridge\"), h(\"span\", {}, recDot, \"rec\"), statusText),\n h(\"button\", { class: \"sp-btn\", type: \"button\", \"data-command\": \"panel.close\", onclick: () => void run(\"panel.close\") }, \"✕\"),\n );\n const d = h(\"div\", { class: \"sp-drawer\", role: \"region\", \"aria-label\": \"solid-pulse\" }, head, ...bodies.values());\n return d;\n }\n\n function setTab(id: string) {\n if (!bodies.has(id)) throw new Error(`unknown tab: ${id} (${[...bodies.keys()].join(\", \")})`);\n activeTab = id;\n for (const [tid, body] of bodies) body.hidden = tid !== id;\n for (const [tid, btn] of tabButtons) btn.setAttribute(\"aria-selected\", tid === id ? \"true\" : \"false\");\n if (id === \"pulse\") void run(\"events.list\", { limit: rows }).then((r) => renderList(r.ok ? (r.value as PulseEvent[]) : []));\n if (id === \"query\") refreshQueryHint();\n if (id === \"scenarios\") void refreshScenario();\n if (id === \"record\") void refreshRecordings();\n }\n\n function setOpen(next: boolean) {\n if (next === open) return;\n open = next;\n if (open) {\n drawer ??= buildDrawer();\n root.append(drawer);\n fab.hidden = true;\n setTab(activeTab);\n refreshStatus();\n } else {\n drawer?.remove();\n fab.hidden = false;\n }\n }\n\n controller.register({ name: \"panel.open\", summary: \"Open the panel (never moves focus). Alias of panel.toggle/panel.tab for agents.\", args: { tab: \"pulse|query|grab|scenarios|record|<custom>\" } }, (a) => {\n setOpen(true);\n if (a.tab !== undefined) setTab(String(a.tab));\n return { open: true, tab: activeTab };\n });\n controller.register({ name: \"panel.close\", summary: \"Close the panel.\", ui: \"✕\" }, () => {\n setOpen(false);\n return { open: false };\n });\n controller.register({ name: \"panel.toggle\", summary: \"Toggle the panel.\", ui: \"◉ pulse button\" }, () => {\n setOpen(!open);\n return { open, tab: activeTab };\n });\n controller.register({ name: \"panel.tab\", summary: \"Switch the panel tab.\", args: { name: \"tab id\" }, ui: \"tab strip\" }, (a) => {\n setOpen(true);\n setTab(String(a.name ?? \"pulse\"));\n return { open, tab: activeTab };\n });\n controller.register({ name: \"panel.status\", summary: \"Is the panel open, which tab, which tabs exist.\", ui: \"panel header\" }, () => ({ open, tab: activeTab, tabs: [...bodies.keys()] }));\n\n (document.body ?? document.documentElement).append(root);\n if (options.open) setOpen(true);\n\n return {\n root,\n querySlot,\n open: () => setOpen(true),\n close: () => setOpen(false),\n destroy() {\n for (const c of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M,MAAM,QAAQ,IAAI;AAAA,IACxB,OAAO,MAAM,QAAQ,KAAK;AAAA,IAC1B,UAAU;AACR,iBAAW,KAAK,SAAU,GAAE;AAC5B,iBAAW,KAAK,CAAC,cAAc,eAAe,gBAAgB,aAAa,cAAc,EAAG,YAAW,WAAW,CAAC;AACnH,WAAK,OAAO;AAAA,IACd;AAAA,EACF;AACF;","names":["r"]}
|
package/dist/query.d.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Pulse } from './index.js';
|
|
2
|
+
import './controller-3akN6Qi0.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Solid Query adapter (optional). Subscribes to the QueryCache and
|
|
6
|
+
* MutationCache — read-only, never changes query behaviour — and turns cache
|
|
7
|
+
* notifications into precise events:
|
|
8
|
+
*
|
|
9
|
+
* query.observe an observer subscribed. `role` is "initiating" when it
|
|
10
|
+
* is the query's first observer (its mount triggers the
|
|
11
|
+
* fetch) or "sharing" when the query already had
|
|
12
|
+
* observers (no new fetch is caused by this observer).
|
|
13
|
+
* query.fetch.start the query started fetching; `trigger` says whether the
|
|
14
|
+
* cause was an observer mount in this tick, an
|
|
15
|
+
* invalidation, or a background refetch.
|
|
16
|
+
* query.fetch.success / query.fetch.error / query.invalidate / query.update
|
|
17
|
+
* query.unobserve / query.added / query.removed
|
|
18
|
+
* mutation.start / mutation.success / mutation.error
|
|
19
|
+
*
|
|
20
|
+
* Component attribution works because TanStack notifies synchronously inside
|
|
21
|
+
* the subscribing component's reactive owner, where `getOwner()` still points
|
|
22
|
+
* at it. The overlay badge is centred on the component's DOM when known.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
interface QueryStateLike {
|
|
26
|
+
status: string;
|
|
27
|
+
fetchStatus: string;
|
|
28
|
+
data: unknown;
|
|
29
|
+
dataUpdatedAt: number;
|
|
30
|
+
isInvalidated: boolean;
|
|
31
|
+
errorUpdateCount: number;
|
|
32
|
+
}
|
|
33
|
+
interface QueryObserverLike {
|
|
34
|
+
options: {
|
|
35
|
+
staleTime?: unknown;
|
|
36
|
+
enabled?: unknown;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
interface QueryLike {
|
|
40
|
+
queryKey: readonly unknown[];
|
|
41
|
+
queryHash: string;
|
|
42
|
+
state: QueryStateLike;
|
|
43
|
+
observers: QueryObserverLike[];
|
|
44
|
+
getObserversCount(): number;
|
|
45
|
+
}
|
|
46
|
+
interface QueryCacheNotifyEventLike {
|
|
47
|
+
type: string;
|
|
48
|
+
query: QueryLike;
|
|
49
|
+
observer?: QueryObserverLike;
|
|
50
|
+
action?: {
|
|
51
|
+
type: string;
|
|
52
|
+
error?: unknown;
|
|
53
|
+
manual?: boolean;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
interface MutationCacheNotifyEventLike {
|
|
57
|
+
type: string;
|
|
58
|
+
mutation?: {
|
|
59
|
+
mutationId: number;
|
|
60
|
+
options: {
|
|
61
|
+
mutationKey?: readonly unknown[];
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
action?: {
|
|
65
|
+
type: string;
|
|
66
|
+
error?: unknown;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
interface QueryClientLike {
|
|
70
|
+
getQueryCache(): {
|
|
71
|
+
subscribe(listener: (event: QueryCacheNotifyEventLike) => void): () => void;
|
|
72
|
+
getAll(): QueryLike[];
|
|
73
|
+
};
|
|
74
|
+
getMutationCache(): {
|
|
75
|
+
subscribe(listener: (event: MutationCacheNotifyEventLike) => void): () => void;
|
|
76
|
+
};
|
|
77
|
+
invalidateQueries(filters?: {
|
|
78
|
+
queryKey?: readonly unknown[];
|
|
79
|
+
exact?: boolean;
|
|
80
|
+
}): Promise<unknown>;
|
|
81
|
+
resetQueries(filters?: {
|
|
82
|
+
queryKey?: readonly unknown[];
|
|
83
|
+
}): Promise<unknown>;
|
|
84
|
+
}
|
|
85
|
+
interface QueryAdapterOptions {
|
|
86
|
+
/** Badge duration in ms (default 1200). */
|
|
87
|
+
badgeMs?: number;
|
|
88
|
+
/** Show badges for "sharing" observers too (default true). */
|
|
89
|
+
badgeSharing?: boolean;
|
|
90
|
+
}
|
|
91
|
+
declare function attachQueryClient(pulse: Pulse, client: QueryClientLike, options?: QueryAdapterOptions): () => void;
|
|
92
|
+
|
|
93
|
+
export { type MutationCacheNotifyEventLike, type QueryAdapterOptions, type QueryCacheNotifyEventLike, type QueryClientLike, type QueryLike, type QueryObserverLike, type QueryStateLike, attachQueryClient };
|
package/dist/query.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import {
|
|
2
|
+
redactValue
|
|
3
|
+
} from "./chunk-5FYH2KEZ.js";
|
|
4
|
+
|
|
5
|
+
// src/query/index.ts
|
|
6
|
+
function keyLabel(key) {
|
|
7
|
+
try {
|
|
8
|
+
const s = JSON.stringify(redactValue(key));
|
|
9
|
+
return s.length > 160 ? s.slice(0, 157) + "..." : s;
|
|
10
|
+
} catch {
|
|
11
|
+
return String(key);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function attachQueryClient(pulse, client, options = {}) {
|
|
15
|
+
const { controller, bus, overlay } = pulse;
|
|
16
|
+
const observers = /* @__PURE__ */ new WeakMap();
|
|
17
|
+
const fetchStarts = /* @__PURE__ */ new Map();
|
|
18
|
+
let pendingInitiator = null;
|
|
19
|
+
const badge = (title, body, component) => {
|
|
20
|
+
if (!overlay || !controller.isOn("queryOverlay")) return;
|
|
21
|
+
const rect = component && pulse.solid ? pulse.solid.rectFor(component) : null;
|
|
22
|
+
overlay.badge({ title, body }, rect, { ms: options.badgeMs ?? 1200, kind: "query" });
|
|
23
|
+
if (rect && controller.isOn("flash")) overlay.flash([rect], "query", { ms: 700 });
|
|
24
|
+
};
|
|
25
|
+
const onQuery = (e) => {
|
|
26
|
+
if (!controller.isOn("query")) return;
|
|
27
|
+
const q = e.query;
|
|
28
|
+
const key = q.queryKey;
|
|
29
|
+
const hash = q.queryHash;
|
|
30
|
+
const label = keyLabel(key);
|
|
31
|
+
switch (e.type) {
|
|
32
|
+
case "added":
|
|
33
|
+
bus.emit("query.added", { hash, key: redactValue(key), label, state: q.state.status });
|
|
34
|
+
break;
|
|
35
|
+
case "removed":
|
|
36
|
+
bus.emit("query.removed", { hash, key: redactValue(key), label });
|
|
37
|
+
break;
|
|
38
|
+
case "observerAdded": {
|
|
39
|
+
if (!e.observer) break;
|
|
40
|
+
const component = pulse.solid?.currentComponent() ?? null;
|
|
41
|
+
observers.set(e.observer, component);
|
|
42
|
+
const count = q.getObserversCount();
|
|
43
|
+
const role = count <= 1 ? "initiating" : "sharing";
|
|
44
|
+
pendingInitiator = { hash, component };
|
|
45
|
+
queueMicrotask(() => {
|
|
46
|
+
if (pendingInitiator?.hash === hash) pendingInitiator = null;
|
|
47
|
+
});
|
|
48
|
+
bus.emit(
|
|
49
|
+
"query.observe",
|
|
50
|
+
{ hash, key: redactValue(key), label, role, observers: count, status: q.state.status, fetchStatus: q.state.fetchStatus, staleTime: e.observer.options.staleTime ?? null, enabled: e.observer.options.enabled ?? true },
|
|
51
|
+
{ component }
|
|
52
|
+
);
|
|
53
|
+
if (role === "initiating" || options.badgeSharing !== false) {
|
|
54
|
+
badge(`${component?.name ?? "(no component)"} ${role === "initiating" ? "\u26A1 initiates" : "\u{1F441} observes"}`, label, component);
|
|
55
|
+
}
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
case "observerRemoved": {
|
|
59
|
+
if (!e.observer) break;
|
|
60
|
+
const component = observers.get(e.observer) ?? null;
|
|
61
|
+
observers.delete(e.observer);
|
|
62
|
+
bus.emit("query.unobserve", { hash, key: redactValue(key), label, observers: q.getObserversCount() }, { component });
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
case "updated": {
|
|
66
|
+
if (!e.action) break;
|
|
67
|
+
const action = e.action;
|
|
68
|
+
if (action.type === "fetch") {
|
|
69
|
+
fetchStarts.set(hash, performance.now());
|
|
70
|
+
const recent = pendingInitiator && pendingInitiator.hash === hash ? pendingInitiator : null;
|
|
71
|
+
if (recent) pendingInitiator = null;
|
|
72
|
+
const trigger = recent ? "observer-mount" : q.state.isInvalidated ? "invalidation" : q.state.dataUpdatedAt ? "background-refetch" : "initial";
|
|
73
|
+
bus.emit(
|
|
74
|
+
"query.fetch.start",
|
|
75
|
+
{ hash, key: redactValue(key), label, trigger, observers: q.getObserversCount(), hadData: q.state.data !== void 0 },
|
|
76
|
+
{ component: recent?.component ?? null }
|
|
77
|
+
);
|
|
78
|
+
if (trigger !== "observer-mount") badge(`\u21BB fetching (${trigger})`, label, null);
|
|
79
|
+
} else if (action.type === "success") {
|
|
80
|
+
const started = fetchStarts.get(hash);
|
|
81
|
+
fetchStarts.delete(hash);
|
|
82
|
+
bus.emit("query.fetch.success", { hash, key: redactValue(key), label, ms: started ? Math.round(performance.now() - started) : null, manual: action.manual ?? false, observers: q.getObserversCount() });
|
|
83
|
+
} else if (action.type === "error") {
|
|
84
|
+
const started = fetchStarts.get(hash);
|
|
85
|
+
fetchStarts.delete(hash);
|
|
86
|
+
const err = action.error;
|
|
87
|
+
bus.emit("query.fetch.error", { hash, key: redactValue(key), label, ms: started ? Math.round(performance.now() - started) : null, name: err?.name ?? "Error", message: String(err?.message ?? err ?? ""), observers: q.getObserversCount(), hadData: q.state.data !== void 0 });
|
|
88
|
+
} else if (action.type === "invalidate") {
|
|
89
|
+
bus.emit("query.invalidate", { hash, key: redactValue(key), label, observers: q.getObserversCount() });
|
|
90
|
+
} else {
|
|
91
|
+
bus.emit("query.update", { hash, key: redactValue(key), label, action: action.type });
|
|
92
|
+
}
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
default:
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const unsubQuery = client.getQueryCache().subscribe(onQuery);
|
|
100
|
+
const unsubMutation = client.getMutationCache().subscribe((e) => {
|
|
101
|
+
if (!controller.isOn("query")) return;
|
|
102
|
+
if (e.type !== "updated" || !e.action || !e.mutation) return;
|
|
103
|
+
const action = e.action;
|
|
104
|
+
const key = e.mutation.options.mutationKey ?? null;
|
|
105
|
+
const data = { id: e.mutation.mutationId, key: redactValue(key), label: key ? keyLabel(key) : null };
|
|
106
|
+
if (action.type === "pending") bus.emit("mutation.start", data);
|
|
107
|
+
else if (action.type === "success") bus.emit("mutation.success", data);
|
|
108
|
+
else if (action.type === "error") {
|
|
109
|
+
const err = action.error;
|
|
110
|
+
bus.emit("mutation.error", { ...data, message: String(err?.message ?? err ?? "") });
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
controller.register(
|
|
114
|
+
{
|
|
115
|
+
name: "inspect.queries",
|
|
116
|
+
summary: "Queries in the cache with observers, status, fetch status, data age and the components observing them.",
|
|
117
|
+
args: { text: "substring on the key", active: "true = only queries with observers" },
|
|
118
|
+
ui: "Query tab \u203A list"
|
|
119
|
+
},
|
|
120
|
+
(a) => {
|
|
121
|
+
const needle = a.text === void 0 ? "" : String(a.text).toLowerCase();
|
|
122
|
+
const activeOnly = a.active === true || a.active === "true";
|
|
123
|
+
return client.getQueryCache().getAll().filter((q) => (!needle || keyLabel(q.queryKey).toLowerCase().includes(needle)) && (!activeOnly || q.getObserversCount() > 0)).map((q) => ({
|
|
124
|
+
hash: q.queryHash,
|
|
125
|
+
key: redactValue(q.queryKey),
|
|
126
|
+
status: q.state.status,
|
|
127
|
+
fetchStatus: q.state.fetchStatus,
|
|
128
|
+
observers: q.getObserversCount(),
|
|
129
|
+
components: q.observers.map((o) => observers.get(o)?.name ?? null),
|
|
130
|
+
dataAgeMs: q.state.dataUpdatedAt ? Date.now() - q.state.dataUpdatedAt : null,
|
|
131
|
+
isInvalidated: q.state.isInvalidated,
|
|
132
|
+
errorUpdateCount: q.state.errorUpdateCount
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
controller.register(
|
|
137
|
+
{ name: "query.invalidate", summary: "Invalidate queries matching a key prefix (JSON array) \u2014 same as the Query tab's Invalidate button.", args: { key: 'JSON array, e.g. ["conversations"]', exact: "true = exact key" }, ui: "Query tab \u203A Invalidate" },
|
|
138
|
+
async (a) => {
|
|
139
|
+
const key = a.key === void 0 ? void 0 : typeof a.key === "string" ? JSON.parse(String(a.key)) : a.key;
|
|
140
|
+
await client.invalidateQueries(key ? { queryKey: key, exact: a.exact === true || a.exact === "true" } : void 0);
|
|
141
|
+
return { invalidated: true, key: key ?? "*" };
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
controller.register(
|
|
145
|
+
{ name: "query.reset", summary: "Reset queries matching a key prefix to their initial state (clears data \u2192 next fetch is a first load).", args: { key: "JSON array" }, ui: "Query tab \u203A Reset" },
|
|
146
|
+
async (a) => {
|
|
147
|
+
const key = a.key === void 0 ? void 0 : typeof a.key === "string" ? JSON.parse(String(a.key)) : a.key;
|
|
148
|
+
await client.resetQueries(key ? { queryKey: key } : void 0);
|
|
149
|
+
return { reset: true, key: key ?? "*" };
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
bus.emit("pulse.note", { note: "solid-query adapter attached" });
|
|
153
|
+
return () => {
|
|
154
|
+
unsubQuery();
|
|
155
|
+
unsubMutation();
|
|
156
|
+
controller.unregister("inspect.queries");
|
|
157
|
+
controller.unregister("query.invalidate");
|
|
158
|
+
controller.unregister("query.reset");
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
export {
|
|
162
|
+
attachQueryClient
|
|
163
|
+
};
|
|
164
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/query/index.ts"],"sourcesContent":["/**\n * Solid Query adapter (optional). Subscribes to the QueryCache and\n * MutationCache — read-only, never changes query behaviour — and turns cache\n * notifications into precise events:\n *\n * query.observe an observer subscribed. `role` is \"initiating\" when it\n * is the query's first observer (its mount triggers the\n * fetch) or \"sharing\" when the query already had\n * observers (no new fetch is caused by this observer).\n * query.fetch.start the query started fetching; `trigger` says whether the\n * cause was an observer mount in this tick, an\n * invalidation, or a background refetch.\n * query.fetch.success / query.fetch.error / query.invalidate / query.update\n * query.unobserve / query.added / query.removed\n * mutation.start / mutation.success / mutation.error\n *\n * Component attribution works because TanStack notifies synchronously inside\n * the subscribing component's reactive owner, where `getOwner()` still points\n * at it. The overlay badge is centred on the component's DOM when known.\n */\n\nimport type { Pulse } from \"../index.js\";\nimport type { ComponentRef } from \"../core/events.js\";\nimport { redactValue } from \"../core/redact.js\";\n\n/*\n * Structural views of TanStack Query's client/cache/query/observer. Typed this\n * way (instead of importing the classes) so an app's own @tanstack/query-core\n * 5.x — any patch level, with its nominal `#private` fields — is accepted\n * without a version-for-version match with ours.\n */\nexport interface QueryStateLike {\n status: string;\n fetchStatus: string;\n data: unknown;\n dataUpdatedAt: number;\n isInvalidated: boolean;\n errorUpdateCount: number;\n}\nexport interface QueryObserverLike {\n options: { staleTime?: unknown; enabled?: unknown };\n}\nexport interface QueryLike {\n queryKey: readonly unknown[];\n queryHash: string;\n state: QueryStateLike;\n observers: QueryObserverLike[];\n getObserversCount(): number;\n}\nexport interface QueryCacheNotifyEventLike {\n type: string;\n query: QueryLike;\n observer?: QueryObserverLike;\n action?: { type: string; error?: unknown; manual?: boolean };\n}\nexport interface MutationCacheNotifyEventLike {\n type: string;\n mutation?: { mutationId: number; options: { mutationKey?: readonly unknown[] } };\n action?: { type: string; error?: unknown };\n}\nexport interface QueryClientLike {\n getQueryCache(): { subscribe(listener: (event: QueryCacheNotifyEventLike) => void): () => void; getAll(): QueryLike[] };\n getMutationCache(): { subscribe(listener: (event: MutationCacheNotifyEventLike) => void): () => void };\n invalidateQueries(filters?: { queryKey?: readonly unknown[]; exact?: boolean }): Promise<unknown>;\n resetQueries(filters?: { queryKey?: readonly unknown[] }): Promise<unknown>;\n}\n\nexport interface QueryAdapterOptions {\n /** Badge duration in ms (default 1200). */\n badgeMs?: number;\n /** Show badges for \"sharing\" observers too (default true). */\n badgeSharing?: boolean;\n}\n\nfunction keyLabel(key: readonly unknown[]): string {\n try {\n const s = JSON.stringify(redactValue(key));\n return s.length > 160 ? s.slice(0, 157) + \"...\" : s;\n } catch {\n return String(key);\n }\n}\n\nexport function attachQueryClient(pulse: Pulse, client: QueryClientLike, options: QueryAdapterOptions = {}): () => void {\n const { controller, bus, overlay } = pulse;\n const observers = new WeakMap<QueryObserverLike, ComponentRef | null>();\n const fetchStarts = new Map<string, number>();\n // The fetch an observer's mount triggers is dispatched synchronously, right\n // after `observerAdded`, so the initiator is only valid for the current tick.\n let pendingInitiator: { hash: string; component: ComponentRef | null } | null = null;\n\n const badge = (title: string, body: string, component: ComponentRef | null) => {\n if (!overlay || !controller.isOn(\"queryOverlay\")) return;\n const rect = component && pulse.solid ? pulse.solid.rectFor(component) : null;\n overlay.badge({ title, body }, rect, { ms: options.badgeMs ?? 1200, kind: \"query\" });\n if (rect && controller.isOn(\"flash\")) overlay.flash([rect], \"query\", { ms: 700 });\n };\n\n const onQuery = (e: QueryCacheNotifyEventLike) => {\n if (!controller.isOn(\"query\")) return;\n const q = e.query;\n const key = q.queryKey as readonly unknown[];\n const hash = q.queryHash;\n const label = keyLabel(key);\n switch (e.type) {\n case \"added\":\n bus.emit(\"query.added\", { hash, key: redactValue(key), label, state: q.state.status });\n break;\n case \"removed\":\n bus.emit(\"query.removed\", { hash, key: redactValue(key), label });\n break;\n case \"observerAdded\": {\n if (!e.observer) break;\n const component = pulse.solid?.currentComponent() ?? null;\n observers.set(e.observer, component);\n const count = q.getObserversCount();\n const role = count <= 1 ? \"initiating\" : \"sharing\";\n pendingInitiator = { hash, component };\n queueMicrotask(() => {\n if (pendingInitiator?.hash === hash) pendingInitiator = null;\n });\n bus.emit(\n \"query.observe\",\n { hash, key: redactValue(key), label, role, observers: count, status: q.state.status, fetchStatus: q.state.fetchStatus, staleTime: e.observer.options.staleTime ?? null, enabled: e.observer.options.enabled ?? true },\n { component },\n );\n if (role === \"initiating\" || options.badgeSharing !== false) {\n badge(`${component?.name ?? \"(no component)\"} ${role === \"initiating\" ? \"⚡ initiates\" : \"👁 observes\"}`, label, component);\n }\n break;\n }\n case \"observerRemoved\": {\n if (!e.observer) break;\n const component = observers.get(e.observer) ?? null;\n observers.delete(e.observer);\n bus.emit(\"query.unobserve\", { hash, key: redactValue(key), label, observers: q.getObserversCount() }, { component });\n break;\n }\n case \"updated\": {\n if (!e.action) break;\n const action = e.action;\n if (action.type === \"fetch\") {\n fetchStarts.set(hash, performance.now());\n const recent = pendingInitiator && pendingInitiator.hash === hash ? pendingInitiator : null;\n if (recent) pendingInitiator = null;\n const trigger = recent ? \"observer-mount\" : q.state.isInvalidated ? \"invalidation\" : q.state.dataUpdatedAt ? \"background-refetch\" : \"initial\";\n bus.emit(\n \"query.fetch.start\",\n { hash, key: redactValue(key), label, trigger, observers: q.getObserversCount(), hadData: q.state.data !== undefined },\n { component: recent?.component ?? null },\n );\n if (trigger !== \"observer-mount\") badge(`↻ fetching (${trigger})`, label, null);\n } else if (action.type === \"success\") {\n const started = fetchStarts.get(hash);\n fetchStarts.delete(hash);\n bus.emit(\"query.fetch.success\", { hash, key: redactValue(key), label, ms: started ? Math.round(performance.now() - started) : null, manual: action.manual ?? false, observers: q.getObserversCount() });\n } else if (action.type === \"error\") {\n const started = fetchStarts.get(hash);\n fetchStarts.delete(hash);\n const err = action.error as { name?: string; message?: string } | undefined;\n bus.emit(\"query.fetch.error\", { hash, key: redactValue(key), label, ms: started ? Math.round(performance.now() - started) : null, name: err?.name ?? \"Error\", message: String(err?.message ?? err ?? \"\"), observers: q.getObserversCount(), hadData: q.state.data !== undefined });\n } else if (action.type === \"invalidate\") {\n bus.emit(\"query.invalidate\", { hash, key: redactValue(key), label, observers: q.getObserversCount() });\n } else {\n bus.emit(\"query.update\", { hash, key: redactValue(key), label, action: action.type });\n }\n break;\n }\n default:\n break;\n }\n };\n\n const unsubQuery = client.getQueryCache().subscribe(onQuery);\n const unsubMutation = client.getMutationCache().subscribe((e) => {\n if (!controller.isOn(\"query\")) return;\n if (e.type !== \"updated\" || !e.action || !e.mutation) return;\n const action = e.action;\n const key = e.mutation.options.mutationKey ?? null;\n const data = { id: e.mutation.mutationId, key: redactValue(key), label: key ? keyLabel(key as readonly unknown[]) : null };\n if (action.type === \"pending\") bus.emit(\"mutation.start\", data);\n else if (action.type === \"success\") bus.emit(\"mutation.success\", data);\n else if (action.type === \"error\") {\n const err = action.error as { message?: string } | undefined;\n bus.emit(\"mutation.error\", { ...data, message: String(err?.message ?? err ?? \"\") });\n }\n });\n\n controller.register(\n {\n name: \"inspect.queries\",\n summary: \"Queries in the cache with observers, status, fetch status, data age and the components observing them.\",\n args: { text: \"substring on the key\", active: \"true = only queries with observers\" },\n ui: \"Query tab › list\",\n },\n (a) => {\n const needle = a.text === undefined ? \"\" : String(a.text).toLowerCase();\n const activeOnly = a.active === true || a.active === \"true\";\n return client\n .getQueryCache()\n .getAll()\n .filter((q) => (!needle || keyLabel(q.queryKey).toLowerCase().includes(needle)) && (!activeOnly || q.getObserversCount() > 0))\n .map((q) => ({\n hash: q.queryHash,\n key: redactValue(q.queryKey),\n status: q.state.status,\n fetchStatus: q.state.fetchStatus,\n observers: q.getObserversCount(),\n components: q.observers.map((o) => observers.get(o)?.name ?? null),\n dataAgeMs: q.state.dataUpdatedAt ? Date.now() - q.state.dataUpdatedAt : null,\n isInvalidated: q.state.isInvalidated,\n errorUpdateCount: q.state.errorUpdateCount,\n }));\n },\n );\n controller.register(\n { name: \"query.invalidate\", summary: \"Invalidate queries matching a key prefix (JSON array) — same as the Query tab's Invalidate button.\", args: { key: 'JSON array, e.g. [\"conversations\"]', exact: \"true = exact key\" }, ui: \"Query tab › Invalidate\" },\n async (a) => {\n const key = a.key === undefined ? undefined : typeof a.key === \"string\" ? (JSON.parse(String(a.key)) as unknown[]) : (a.key as unknown[]);\n await client.invalidateQueries(key ? { queryKey: key, exact: a.exact === true || a.exact === \"true\" } : undefined);\n return { invalidated: true, key: key ?? \"*\" };\n },\n );\n controller.register(\n { name: \"query.reset\", summary: \"Reset queries matching a key prefix to their initial state (clears data → next fetch is a first load).\", args: { key: \"JSON array\" }, ui: \"Query tab › Reset\" },\n async (a) => {\n const key = a.key === undefined ? undefined : typeof a.key === \"string\" ? (JSON.parse(String(a.key)) as unknown[]) : (a.key as unknown[]);\n await client.resetQueries(key ? { queryKey: key } : undefined);\n return { reset: true, key: key ?? \"*\" };\n },\n );\n\n bus.emit(\"pulse.note\", { note: \"solid-query adapter attached\" });\n return () => {\n unsubQuery();\n unsubMutation();\n controller.unregister(\"inspect.queries\");\n controller.unregister(\"query.invalidate\");\n controller.unregister(\"query.reset\");\n };\n}\n"],"mappings":";;;;;AA0EA,SAAS,SAAS,KAAiC;AACjD,MAAI;AACF,UAAM,IAAI,KAAK,UAAU,YAAY,GAAG,CAAC;AACzC,WAAO,EAAE,SAAS,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,QAAQ;AAAA,EACpD,QAAQ;AACN,WAAO,OAAO,GAAG;AAAA,EACnB;AACF;AAEO,SAAS,kBAAkB,OAAc,QAAyB,UAA+B,CAAC,GAAe;AACtH,QAAM,EAAE,YAAY,KAAK,QAAQ,IAAI;AACrC,QAAM,YAAY,oBAAI,QAAgD;AACtE,QAAM,cAAc,oBAAI,IAAoB;AAG5C,MAAI,mBAA4E;AAEhF,QAAM,QAAQ,CAAC,OAAe,MAAc,cAAmC;AAC7E,QAAI,CAAC,WAAW,CAAC,WAAW,KAAK,cAAc,EAAG;AAClD,UAAM,OAAO,aAAa,MAAM,QAAQ,MAAM,MAAM,QAAQ,SAAS,IAAI;AACzE,YAAQ,MAAM,EAAE,OAAO,KAAK,GAAG,MAAM,EAAE,IAAI,QAAQ,WAAW,MAAM,MAAM,QAAQ,CAAC;AACnF,QAAI,QAAQ,WAAW,KAAK,OAAO,EAAG,SAAQ,MAAM,CAAC,IAAI,GAAG,SAAS,EAAE,IAAI,IAAI,CAAC;AAAA,EAClF;AAEA,QAAM,UAAU,CAAC,MAAiC;AAChD,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AAM,KAAK,OAAO,IAAI;AAAA,IAC9C;AAAA,EACF;AACA,aAAW;AAAA,IACT,EAAE,MAAM,eAAe,SAAS,+GAA0G,MAAM,EAAE,KAAK,aAAa,GAAG,IAAI,yBAAoB;AAAA,IAC/L,OAAO,MAAM;AACX,YAAM,MAAM,EAAE,QAAQ,SAAY,SAAY,OAAO,EAAE,QAAQ,WAAY,KAAK,MAAM,OAAO,EAAE,GAAG,CAAC,IAAmB,EAAE;AACxH,YAAM,OAAO,aAAa,MAAM,EAAE,UAAU,IAAI,IAAI,MAAS;AAC7D,aAAO,EAAE,OAAO,MAAM,KAAK,OAAO,IAAI;AAAA,IACxC;AAAA,EACF;AAEA,MAAI,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,SAAO,MAAM;AACX,eAAW;AACX,kBAAc;AACd,eAAW,WAAW,iBAAiB;AACvC,eAAW,WAAW,kBAAkB;AACxC,eAAW,WAAW,aAAa;AAAA,EACrC;AACF;","names":[]}
|
package/dist/vite.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @omniaura/solid-pulse/vite
|
|
5
|
+
*
|
|
6
|
+
* import solidPulse from "@omniaura/solid-pulse/vite";
|
|
7
|
+
* export default defineConfig({ plugins: [solidPulse(), solidGrab(), solid()] });
|
|
8
|
+
*
|
|
9
|
+
* Dev server only (`apply: "serve"`): production builds never see this
|
|
10
|
+
* plugin, the runtime import or the bridge. In dev it
|
|
11
|
+
* 1. injects the runtime as the *first* module script so Solid's dev hooks
|
|
12
|
+
* are installed before the app's first render,
|
|
13
|
+
* 2. mounts the bridge (WebSocket ingest + HTTP/SSE API) on the Vite dev
|
|
14
|
+
* server under `/__pulse`, loopback-only,
|
|
15
|
+
* 3. writes `node_modules/.vite/solid-pulse.json` so the `solid-pulse` CLI
|
|
16
|
+
* finds the bridge without flags.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
interface SolidPulseVitePluginOptions {
|
|
20
|
+
/** Inject the runtime automatically (default true). */
|
|
21
|
+
autoImport?: boolean;
|
|
22
|
+
/** Mount the bridge on the dev server (default true). */
|
|
23
|
+
bridge?: boolean;
|
|
24
|
+
/** URL prefix for the bridge (default `/__pulse`). */
|
|
25
|
+
path?: string;
|
|
26
|
+
/** Accept non-loopback connections (default false). */
|
|
27
|
+
allowRemote?: boolean;
|
|
28
|
+
/** Also mount the raw-DOM panel (default true). */
|
|
29
|
+
panel?: boolean;
|
|
30
|
+
/** Options forwarded to `initPulse` (JSON-serialisable). */
|
|
31
|
+
runtimeOptions?: Record<string, unknown>;
|
|
32
|
+
/**
|
|
33
|
+
* Module that `export default (pulse) => void`, imported before the app's
|
|
34
|
+
* entry so adapters (attachQueryClient, attachScenarioCommands) are in
|
|
35
|
+
* place for the first render. E.g. "/src/pulse-setup.ts".
|
|
36
|
+
*/
|
|
37
|
+
setupModule?: string;
|
|
38
|
+
}
|
|
39
|
+
declare function solidPulse(options?: SolidPulseVitePluginOptions): Plugin;
|
|
40
|
+
|
|
41
|
+
export { type SolidPulseVitePluginOptions, solidPulse as default };
|
package/dist/vite.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BridgeServer
|
|
3
|
+
} from "./chunk-TVSI7G5S.js";
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_PATH
|
|
6
|
+
} from "./chunk-4QA2G6S3.js";
|
|
7
|
+
|
|
8
|
+
// src/vite.ts
|
|
9
|
+
import { mkdirSync, writeFileSync } from "fs";
|
|
10
|
+
import { join } from "path";
|
|
11
|
+
var VIRTUAL_INIT = "virtual:solid-pulse-init";
|
|
12
|
+
var RESOLVED_VIRTUAL_INIT = "\0" + VIRTUAL_INIT;
|
|
13
|
+
var SERVE_URL = "/@solid-pulse/init";
|
|
14
|
+
function solidPulse(options = {}) {
|
|
15
|
+
const { autoImport = true, bridge = true, path = DEFAULT_PATH, allowRemote = false, panel = true, runtimeOptions = {}, setupModule } = options;
|
|
16
|
+
let config;
|
|
17
|
+
return {
|
|
18
|
+
name: "solid-pulse",
|
|
19
|
+
enforce: "pre",
|
|
20
|
+
apply: "serve",
|
|
21
|
+
configResolved(resolved) {
|
|
22
|
+
config = resolved;
|
|
23
|
+
},
|
|
24
|
+
resolveId(id) {
|
|
25
|
+
if (id === VIRTUAL_INIT) return RESOLVED_VIRTUAL_INIT;
|
|
26
|
+
return null;
|
|
27
|
+
},
|
|
28
|
+
load(id) {
|
|
29
|
+
if (id !== RESOLVED_VIRTUAL_INIT) return null;
|
|
30
|
+
const opts = { bridge, ...runtimeOptions };
|
|
31
|
+
return [
|
|
32
|
+
`import { initPulse } from "@omniaura/solid-pulse";`,
|
|
33
|
+
panel ? `import { mountPanel } from "@omniaura/solid-pulse/panel";` : "",
|
|
34
|
+
setupModule ? `import setup from ${JSON.stringify(setupModule)};` : "",
|
|
35
|
+
`const pulse = initPulse(${JSON.stringify(opts)});`,
|
|
36
|
+
setupModule ? `try { if (typeof setup === "function") setup(pulse); else console.warn("[solid-pulse] setup module must export default (pulse) => void"); } catch (e) { console.warn("[solid-pulse] setup module failed", e); }` : "",
|
|
37
|
+
panel ? `mountPanel(pulse);` : "",
|
|
38
|
+
`export default pulse;`
|
|
39
|
+
].filter(Boolean).join("\n");
|
|
40
|
+
},
|
|
41
|
+
configureServer(server) {
|
|
42
|
+
server.middlewares.use((req, _res, next) => {
|
|
43
|
+
if (req.url === SERVE_URL) req.url = `/@id/${VIRTUAL_INIT}`;
|
|
44
|
+
next();
|
|
45
|
+
});
|
|
46
|
+
if (!bridge) return;
|
|
47
|
+
const bridgeServer = new BridgeServer({ path, allowRemote, log: (m) => config.logger.info(` \u25C9 solid-pulse: ${m}`) });
|
|
48
|
+
if (server.httpServer) {
|
|
49
|
+
bridgeServer.attach(server.httpServer);
|
|
50
|
+
server.httpServer.once("listening", () => {
|
|
51
|
+
const addr = server.httpServer.address();
|
|
52
|
+
const port = typeof addr === "object" && addr ? addr.port : config.server.port ?? 5173;
|
|
53
|
+
const url = `http://localhost:${port}${path}`;
|
|
54
|
+
try {
|
|
55
|
+
mkdirSync(config.cacheDir, { recursive: true });
|
|
56
|
+
writeFileSync(join(config.cacheDir, "solid-pulse.json"), JSON.stringify({ url, pid: process.pid, wall: Date.now() }));
|
|
57
|
+
} catch {
|
|
58
|
+
}
|
|
59
|
+
config.logger.info(` \u25C9 solid-pulse bridge: ${url}/api/status (CLI: npx solid-pulse status)`);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
server.middlewares.use((req, res, next) => {
|
|
63
|
+
if (!bridgeServer.handleHttp(req, res)) next();
|
|
64
|
+
});
|
|
65
|
+
server.httpServer?.once("close", () => bridgeServer.close());
|
|
66
|
+
},
|
|
67
|
+
transformIndexHtml() {
|
|
68
|
+
if (!autoImport) return;
|
|
69
|
+
return [{ tag: "script", attrs: { type: "module", src: SERVE_URL }, injectTo: "head-prepend" }];
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
solidPulse as default
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=vite.js.map
|
package/dist/vite.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vite.ts"],"sourcesContent":["/**\n * @omniaura/solid-pulse/vite\n *\n * import solidPulse from \"@omniaura/solid-pulse/vite\";\n * export default defineConfig({ plugins: [solidPulse(), solidGrab(), solid()] });\n *\n * Dev server only (`apply: \"serve\"`): production builds never see this\n * plugin, the runtime import or the bridge. In dev it\n * 1. injects the runtime as the *first* module script so Solid's dev hooks\n * are installed before the app's first render,\n * 2. mounts the bridge (WebSocket ingest + HTTP/SSE API) on the Vite dev\n * server under `/__pulse`, loopback-only,\n * 3. writes `node_modules/.vite/solid-pulse.json` so the `solid-pulse` CLI\n * finds the bridge without flags.\n */\n\nimport { mkdirSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { Plugin, ResolvedConfig, ViteDevServer } from \"vite\";\nimport { BridgeServer } from \"./bridge/server.js\";\nimport { DEFAULT_PATH } from \"./core/protocol.js\";\n\nexport interface SolidPulseVitePluginOptions {\n /** Inject the runtime automatically (default true). */\n autoImport?: boolean;\n /** Mount the bridge on the dev server (default true). */\n bridge?: boolean;\n /** URL prefix for the bridge (default `/__pulse`). */\n path?: string;\n /** Accept non-loopback connections (default false). */\n allowRemote?: boolean;\n /** Also mount the raw-DOM panel (default true). */\n panel?: boolean;\n /** Options forwarded to `initPulse` (JSON-serialisable). */\n runtimeOptions?: Record<string, unknown>;\n /**\n * Module that `export default (pulse) => void`, imported before the app's\n * entry so adapters (attachQueryClient, attachScenarioCommands) are in\n * place for the first render. E.g. \"/src/pulse-setup.ts\".\n */\n setupModule?: string;\n}\n\nconst VIRTUAL_INIT = \"virtual:solid-pulse-init\";\nconst RESOLVED_VIRTUAL_INIT = \"\\0\" + VIRTUAL_INIT;\nconst SERVE_URL = \"/@solid-pulse/init\";\n\nexport default function solidPulse(options: SolidPulseVitePluginOptions = {}): Plugin {\n const { autoImport = true, bridge = true, path = DEFAULT_PATH, allowRemote = false, panel = true, runtimeOptions = {}, setupModule } = options;\n let config: ResolvedConfig;\n\n return {\n name: \"solid-pulse\",\n enforce: \"pre\",\n apply: \"serve\",\n\n configResolved(resolved) {\n config = resolved;\n },\n\n resolveId(id) {\n if (id === VIRTUAL_INIT) return RESOLVED_VIRTUAL_INIT;\n return null;\n },\n\n load(id) {\n if (id !== RESOLVED_VIRTUAL_INIT) return null;\n const opts = { bridge: bridge, ...runtimeOptions };\n // The setup module is imported statically so it is evaluated before the\n // app's entry module runs (and before the first render): adapters such as\n // attachQueryClient must exist when the first observers subscribe. It\n // must `export default (pulse) => { ... }`.\n return [\n `import { initPulse } from \"@omniaura/solid-pulse\";`,\n panel ? `import { mountPanel } from \"@omniaura/solid-pulse/panel\";` : \"\",\n setupModule ? `import setup from ${JSON.stringify(setupModule)};` : \"\",\n `const pulse = initPulse(${JSON.stringify(opts)});`,\n setupModule ? `try { if (typeof setup === \"function\") setup(pulse); else console.warn(\"[solid-pulse] setup module must export default (pulse) => void\"); } catch (e) { console.warn(\"[solid-pulse] setup module failed\", e); }` : \"\",\n panel ? `mountPanel(pulse);` : \"\",\n `export default pulse;`,\n ]\n .filter(Boolean)\n .join(\"\\n\");\n },\n\n configureServer(server: ViteDevServer) {\n server.middlewares.use((req, _res, next) => {\n if (req.url === SERVE_URL) req.url = `/@id/${VIRTUAL_INIT}`;\n next();\n });\n if (!bridge) return;\n const bridgeServer = new BridgeServer({ path, allowRemote, log: (m) => config.logger.info(` ◉ solid-pulse: ${m}`) });\n if (server.httpServer) {\n bridgeServer.attach(server.httpServer as import(\"node:http\").Server);\n server.httpServer.once(\"listening\", () => {\n const addr = server.httpServer!.address();\n const port = typeof addr === \"object\" && addr ? addr.port : config.server.port ?? 5173;\n const url = `http://localhost:${port}${path}`;\n try {\n mkdirSync(config.cacheDir, { recursive: true });\n writeFileSync(join(config.cacheDir, \"solid-pulse.json\"), JSON.stringify({ url, pid: process.pid, wall: Date.now() }));\n } catch {\n // cache dir may be read-only; the CLI still accepts --url\n }\n config.logger.info(` ◉ solid-pulse bridge: ${url}/api/status (CLI: npx solid-pulse status)`);\n });\n }\n server.middlewares.use((req, res, next) => {\n if (!bridgeServer.handleHttp(req, res)) next();\n });\n server.httpServer?.once(\"close\", () => bridgeServer.close());\n },\n\n transformIndexHtml() {\n if (!autoImport) return;\n return [{ tag: \"script\", attrs: { type: \"module\", src: SERVE_URL }, injectTo: \"head-prepend\" as const }];\n },\n };\n}\n"],"mappings":";;;;;;;;AAgBA,SAAS,WAAW,qBAAqB;AACzC,SAAS,YAAY;AA0BrB,IAAM,eAAe;AACrB,IAAM,wBAAwB,OAAO;AACrC,IAAM,YAAY;AAEH,SAAR,WAA4B,UAAuC,CAAC,GAAW;AACpF,QAAM,EAAE,aAAa,MAAM,SAAS,MAAM,OAAO,cAAc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