@plumix/core 0.1.3 → 0.2.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/dist/admin-bar/collect.d.ts.map +1 -1
- package/dist/admin-bar/collect.js +1 -15
- package/dist/admin-bar/collect.js.map +1 -1
- package/dist/admin-bar/i18n.d.ts +6 -0
- package/dist/admin-bar/i18n.d.ts.map +1 -1
- package/dist/admin-bar/i18n.js +1 -1
- package/dist/admin-bar/i18n.js.map +1 -1
- package/dist/admin-bar/styles.d.ts.map +1 -1
- package/dist/admin-bar/styles.js +1 -11
- package/dist/admin-bar/styles.js.map +1 -1
- package/dist/auth/authenticator.d.ts +20 -0
- package/dist/auth/authenticator.d.ts.map +1 -1
- package/dist/auth/authenticator.js +21 -0
- package/dist/auth/authenticator.js.map +1 -1
- package/dist/cli/worker-codegen.d.ts.map +1 -1
- package/dist/cli/worker-codegen.js +3 -5
- package/dist/cli/worker-codegen.js.map +1 -1
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/context/app.d.ts +16 -0
- package/dist/context/app.d.ts.map +1 -1
- package/dist/context/app.js +8 -0
- package/dist/context/app.js.map +1 -1
- package/dist/context/debug.d.ts +25 -0
- package/dist/context/debug.d.ts.map +1 -0
- package/dist/context/debug.js +13 -0
- package/dist/context/debug.js.map +1 -0
- package/dist/context/stores.d.ts +2 -0
- package/dist/context/stores.d.ts.map +1 -1
- package/dist/context/stores.js.map +1 -1
- package/dist/css-tag.d.ts +2 -0
- package/dist/css-tag.d.ts.map +1 -0
- package/dist/css-tag.js +13 -0
- package/dist/css-tag.js.map +1 -0
- package/dist/db/libsql.d.ts.map +1 -1
- package/dist/db/libsql.js +13 -2
- package/dist/db/libsql.js.map +1 -1
- package/dist/debug-bar/collect.d.ts +13 -0
- package/dist/debug-bar/collect.d.ts.map +1 -0
- package/dist/debug-bar/collect.js +22 -0
- package/dist/debug-bar/collect.js.map +1 -0
- package/dist/debug-bar/collector.d.ts +9 -0
- package/dist/debug-bar/collector.d.ts.map +1 -0
- package/dist/debug-bar/collector.js +80 -0
- package/dist/debug-bar/collector.js.map +1 -0
- package/dist/debug-bar/component.d.ts +13 -0
- package/dist/debug-bar/component.d.ts.map +1 -0
- package/dist/debug-bar/component.js +36 -0
- package/dist/debug-bar/component.js.map +1 -0
- package/dist/debug-bar/config.d.ts +17 -0
- package/dist/debug-bar/config.d.ts.map +1 -0
- package/dist/debug-bar/config.js +13 -0
- package/dist/debug-bar/config.js.map +1 -0
- package/dist/debug-bar/core-panels.d.ts +8 -0
- package/dist/debug-bar/core-panels.d.ts.map +1 -0
- package/dist/debug-bar/core-panels.js +21 -0
- package/dist/debug-bar/core-panels.js.map +1 -0
- package/dist/debug-bar/db-query.d.ts +21 -0
- package/dist/debug-bar/db-query.d.ts.map +1 -0
- package/dist/debug-bar/db-query.js +23 -0
- package/dist/debug-bar/db-query.js.map +1 -0
- package/dist/debug-bar/format-param.d.ts +14 -0
- package/dist/debug-bar/format-param.d.ts.map +1 -0
- package/dist/debug-bar/format-param.js +27 -0
- package/dist/debug-bar/format-param.js.map +1 -0
- package/dist/debug-bar/highlight-sql.d.ts +11 -0
- package/dist/debug-bar/highlight-sql.d.ts.map +1 -0
- package/dist/debug-bar/highlight-sql.js +82 -0
- package/dist/debug-bar/highlight-sql.js.map +1 -0
- package/dist/debug-bar/panels/app.d.ts +8 -0
- package/dist/debug-bar/panels/app.d.ts.map +1 -0
- package/dist/debug-bar/panels/app.js +32 -0
- package/dist/debug-bar/panels/app.js.map +1 -0
- package/dist/debug-bar/panels/database.d.ts +9 -0
- package/dist/debug-bar/panels/database.d.ts.map +1 -0
- package/dist/debug-bar/panels/database.js +33 -0
- package/dist/debug-bar/panels/database.js.map +1 -0
- package/dist/debug-bar/panels/request.d.ts +7 -0
- package/dist/debug-bar/panels/request.d.ts.map +1 -0
- package/dist/debug-bar/panels/request.js +35 -0
- package/dist/debug-bar/panels/request.js.map +1 -0
- package/dist/debug-bar/panels/template.d.ts +17 -0
- package/dist/debug-bar/panels/template.d.ts.map +1 -0
- package/dist/debug-bar/panels/template.js +26 -0
- package/dist/debug-bar/panels/template.js.map +1 -0
- package/dist/debug-bar/panels/timeline.d.ts +11 -0
- package/dist/debug-bar/panels/timeline.d.ts.map +1 -0
- package/dist/debug-bar/panels/timeline.js +46 -0
- package/dist/debug-bar/panels/timeline.js.map +1 -0
- package/dist/debug-bar/primitives.d.ts +24 -0
- package/dist/debug-bar/primitives.d.ts.map +1 -0
- package/dist/debug-bar/primitives.js +21 -0
- package/dist/debug-bar/primitives.js.map +1 -0
- package/dist/debug-bar/styles.d.ts +2 -0
- package/dist/debug-bar/styles.d.ts.map +1 -0
- package/dist/debug-bar/styles.js +372 -0
- package/dist/debug-bar/styles.js.map +1 -0
- package/dist/debug-bar/template-node-label.d.ts +6 -0
- package/dist/debug-bar/template-node-label.d.ts.map +1 -0
- package/dist/debug-bar/template-node-label.js +20 -0
- package/dist/debug-bar/template-node-label.js.map +1 -0
- package/dist/debug-bar/timeline-geometry.d.ts +30 -0
- package/dist/debug-bar/timeline-geometry.d.ts.map +1 -0
- package/dist/debug-bar/timeline-geometry.js +26 -0
- package/dist/debug-bar/timeline-geometry.js.map +1 -0
- package/dist/debug-bar/timeline-model.d.ts +23 -0
- package/dist/debug-bar/timeline-model.d.ts.map +1 -0
- package/dist/debug-bar/timeline-model.js +34 -0
- package/dist/debug-bar/timeline-model.js.map +1 -0
- package/dist/debug-bar/trace-libsql.d.ts +18 -0
- package/dist/debug-bar/trace-libsql.d.ts.map +1 -0
- package/dist/debug-bar/trace-libsql.js +42 -0
- package/dist/debug-bar/trace-libsql.js.map +1 -0
- package/dist/debug-bar/types.d.ts +28 -0
- package/dist/debug-bar/types.d.ts.map +1 -0
- package/dist/debug-bar/types.js +1 -0
- package/dist/debug-bar/types.js.map +1 -0
- package/dist/hooks/registry.d.ts +14 -3
- package/dist/hooks/registry.d.ts.map +1 -1
- package/dist/hooks/registry.js +22 -0
- package/dist/hooks/registry.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin/manifest.d.ts +3 -0
- package/dist/plugin/manifest.d.ts.map +1 -1
- package/dist/plugin/manifest.js +1 -0
- package/dist/plugin/manifest.js.map +1 -1
- package/dist/plugin/register.d.ts.map +1 -1
- package/dist/plugin/register.js +1 -0
- package/dist/plugin/register.js.map +1 -1
- package/dist/route/render/render-template.d.ts +1 -1
- package/dist/route/render/render-template.d.ts.map +1 -1
- package/dist/route/render/render-template.js +26 -2
- package/dist/route/render/render-template.js.map +1 -1
- package/dist/runtime/app.d.ts +8 -5
- package/dist/runtime/app.d.ts.map +1 -1
- package/dist/runtime/app.js +8 -1
- package/dist/runtime/app.js.map +1 -1
- package/dist/runtime/dispatcher.d.ts.map +1 -1
- package/dist/runtime/dispatcher.js +4 -2
- package/dist/runtime/dispatcher.js.map +1 -1
- package/dist/runtime/load-user-for-public-request.d.ts.map +1 -1
- package/dist/runtime/load-user-for-public-request.js +5 -2
- package/dist/runtime/load-user-for-public-request.js.map +1 -1
- package/dist/test/dispatcher.d.ts +3 -0
- package/dist/test/dispatcher.d.ts.map +1 -1
- package/dist/test/dispatcher.js +8 -2
- package/dist/test/dispatcher.js.map +1 -1
- package/dist/test/harness.d.ts.map +1 -1
- package/dist/test/harness.js +12 -2
- package/dist/test/harness.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AppContext } from "../context/app.js";
|
|
2
|
+
import type { HookExecutor } from "../hooks/registry.js";
|
|
3
|
+
import type { DebugPanel } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Gathers the request's debug panels: runs the `debug_bar:panels` filter
|
|
6
|
+
* chain — isolating each handler so a throw or non-array return during
|
|
7
|
+
* *collection* can't take down the bar — then drops denylisted ids, dedupes
|
|
8
|
+
* by id (last contributor wins), and returns them ordered by ascending
|
|
9
|
+
* `order`. A panel throwing from its own `render` is a separate concern the
|
|
10
|
+
* collector can't see.
|
|
11
|
+
*/
|
|
12
|
+
export declare function collectDebugPanels(hooks: HookExecutor, ctx: AppContext, disabled: ReadonlySet<string>): readonly DebugPanel[];
|
|
13
|
+
//# sourceMappingURL=collect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../src/debug-bar/collect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAM7C;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,UAAU,EACf,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,GAC5B,SAAS,UAAU,EAAE,CAavB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Unordered panels sort after every explicitly-ordered one. Finite (not
|
|
2
|
+
// Infinity) so two unordered panels compare as 0, not NaN.
|
|
3
|
+
const DEFAULT_PANEL_ORDER = Number.MAX_SAFE_INTEGER;
|
|
4
|
+
/**
|
|
5
|
+
* Gathers the request's debug panels: runs the `debug_bar:panels` filter
|
|
6
|
+
* chain — isolating each handler so a throw or non-array return during
|
|
7
|
+
* *collection* can't take down the bar — then drops denylisted ids, dedupes
|
|
8
|
+
* by id (last contributor wins), and returns them ordered by ascending
|
|
9
|
+
* `order`. A panel throwing from its own `render` is a separate concern the
|
|
10
|
+
* collector can't see.
|
|
11
|
+
*/
|
|
12
|
+
export function collectDebugPanels(hooks, ctx, disabled) {
|
|
13
|
+
const panels = hooks.applyFilterIsolated("debug_bar:panels", [], ctx);
|
|
14
|
+
const byId = new Map();
|
|
15
|
+
for (const p of panels) {
|
|
16
|
+
if (disabled.has(p.id))
|
|
17
|
+
continue;
|
|
18
|
+
byId.set(p.id, p);
|
|
19
|
+
}
|
|
20
|
+
return [...byId.values()].sort((a, b) => (a.order ?? DEFAULT_PANEL_ORDER) - (b.order ?? DEFAULT_PANEL_ORDER));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=collect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect.js","sourceRoot":"","sources":["../../src/debug-bar/collect.ts"],"names":[],"mappings":"AAIA,wEAAwE;AACxE,2DAA2D;AAC3D,MAAM,mBAAmB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAmB,EACnB,GAAe,EACf,QAA6B;IAE7B,MAAM,MAAM,GAAG,KAAK,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IAEtE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC3C,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACvB,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAAE,SAAS;QACjC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACpB,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAC5B,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACP,CAAC,CAAC,CAAC,KAAK,IAAI,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,mBAAmB,CAAC,CACtE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DebugCollector } from "../context/debug.js";
|
|
2
|
+
import type { DebugBarInput } from "./config.js";
|
|
3
|
+
/**
|
|
4
|
+
* The real, dev-only debug collector. Accumulates per-namespace entries and a
|
|
5
|
+
* span tree for the request. Created only under the dev gate; production uses
|
|
6
|
+
* {@link NOOP_DEBUG} instead, so this module tree-shakes out of prod builds.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createDebugCollector(debugBar: DebugBarInput | undefined): DebugCollector;
|
|
9
|
+
//# sourceMappingURL=collector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../src/debug-bar/collector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAWjD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,aAAa,GAAG,SAAS,GAClC,cAAc,CAiEhB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { NOOP_DEBUG } from "../context/debug.js";
|
|
2
|
+
import { traceStore } from "../context/stores.js";
|
|
3
|
+
import { normalizeDebugBar } from "./config.js";
|
|
4
|
+
function isThenable(value) {
|
|
5
|
+
return (value != null && typeof value.then === "function");
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The real, dev-only debug collector. Accumulates per-namespace entries and a
|
|
9
|
+
* span tree for the request. Created only under the dev gate; production uses
|
|
10
|
+
* {@link NOOP_DEBUG} instead, so this module tree-shakes out of prod builds.
|
|
11
|
+
*/
|
|
12
|
+
export function createDebugCollector(debugBar) {
|
|
13
|
+
const { enabled, disabled } = normalizeDebugBar(debugBar);
|
|
14
|
+
// Globally disabled in dev: skip all collection overhead, not just render.
|
|
15
|
+
if (!enabled)
|
|
16
|
+
return NOOP_DEBUG;
|
|
17
|
+
const entries = new Map();
|
|
18
|
+
const roots = [];
|
|
19
|
+
return {
|
|
20
|
+
record(namespace, entry) {
|
|
21
|
+
// A disabled panel stops collecting too (not just rendering): its
|
|
22
|
+
// namespace is its panel id, so denylisted namespaces drop at the source.
|
|
23
|
+
if (disabled.has(namespace))
|
|
24
|
+
return;
|
|
25
|
+
const bucket = entries.get(namespace);
|
|
26
|
+
if (bucket)
|
|
27
|
+
bucket.push(entry);
|
|
28
|
+
else
|
|
29
|
+
entries.set(namespace, [entry]);
|
|
30
|
+
},
|
|
31
|
+
span(name, fn) {
|
|
32
|
+
const startedAt = Date.now();
|
|
33
|
+
const span = {
|
|
34
|
+
name,
|
|
35
|
+
startedAt,
|
|
36
|
+
durationMs: 0,
|
|
37
|
+
children: [],
|
|
38
|
+
annotations: {},
|
|
39
|
+
};
|
|
40
|
+
// Attach to the enclosing span (via AsyncLocalStorage) so nesting
|
|
41
|
+
// reflects call structure; top-level spans become roots.
|
|
42
|
+
const parent = traceStore.getStore();
|
|
43
|
+
if (parent)
|
|
44
|
+
parent.children.push(span);
|
|
45
|
+
else
|
|
46
|
+
roots.push(span);
|
|
47
|
+
const stamp = () => {
|
|
48
|
+
span.durationMs = Date.now() - startedAt;
|
|
49
|
+
};
|
|
50
|
+
let result;
|
|
51
|
+
try {
|
|
52
|
+
result = traceStore.run(span, fn);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
stamp();
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
// Await async work before stamping so I/O time is measured, not just the
|
|
59
|
+
// synchronous prelude. Nesting already survives awaits via ALS.
|
|
60
|
+
if (isThenable(result)) {
|
|
61
|
+
return result.then((value) => {
|
|
62
|
+
stamp();
|
|
63
|
+
return value;
|
|
64
|
+
}, (error) => {
|
|
65
|
+
stamp();
|
|
66
|
+
throw error;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
stamp();
|
|
70
|
+
return result;
|
|
71
|
+
},
|
|
72
|
+
get(namespace) {
|
|
73
|
+
return entries.get(namespace) ?? [];
|
|
74
|
+
},
|
|
75
|
+
getSpans() {
|
|
76
|
+
return roots;
|
|
77
|
+
},
|
|
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
import type { ReactNode } from "react";
|
|
2
|
+
import type { AppContext } from "../context/app.js";
|
|
3
|
+
/**
|
|
4
|
+
* The development-only debug bar. Standalone and auth-independent (unlike the
|
|
5
|
+
* admin bar it does not gate on a user), fully server-rendered and zero-JS:
|
|
6
|
+
* a native <details> toggles it and radio inputs drive the tabs. Rendered
|
|
7
|
+
* only under the dev gate at the injection site, so it — and this whole
|
|
8
|
+
* module — is tree-shaken from production builds.
|
|
9
|
+
*/
|
|
10
|
+
export declare function PlumixDebugBar({ ctx, }: {
|
|
11
|
+
readonly ctx: AppContext;
|
|
12
|
+
}): ReactNode;
|
|
13
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/debug-bar/component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAuBpD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAC7B,GAAG,GACJ,EAAE;IACD,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;CAC1B,GAAG,SAAS,CAkDZ"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
3
|
+
import { labelSourceText } from "../i18n/label.js";
|
|
4
|
+
import { collectDebugPanels } from "./collect.js";
|
|
5
|
+
import { normalizeDebugBar } from "./config.js";
|
|
6
|
+
import { DEBUG_BAR_CSS } from "./styles.js";
|
|
7
|
+
// Render each panel in isolation: a panel that throws (author logic or a child
|
|
8
|
+
// component during SSR) yields a fallback instead of crashing the host page —
|
|
9
|
+
// exactly the page the bar is meant to help debug.
|
|
10
|
+
function renderPaneHtml(panel, ctx) {
|
|
11
|
+
try {
|
|
12
|
+
return renderToStaticMarkup(_jsx(_Fragment, { children: panel.render(ctx) }));
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
console.error(`[plumix] debug panel "${panel.id}" failed to render`, error);
|
|
16
|
+
return renderToStaticMarkup(_jsxs("p", { className: "plumix-debug-bar__error", children: ["Panel \u201C", panel.id, "\u201D failed to render."] }));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The development-only debug bar. Standalone and auth-independent (unlike the
|
|
21
|
+
* admin bar it does not gate on a user), fully server-rendered and zero-JS:
|
|
22
|
+
* a native <details> toggles it and radio inputs drive the tabs. Rendered
|
|
23
|
+
* only under the dev gate at the injection site, so it — and this whole
|
|
24
|
+
* module — is tree-shaken from production builds.
|
|
25
|
+
*/
|
|
26
|
+
export function PlumixDebugBar({ ctx, }) {
|
|
27
|
+
const config = normalizeDebugBar(ctx.debugBar);
|
|
28
|
+
if (!config.enabled)
|
|
29
|
+
return null;
|
|
30
|
+
const panels = collectDebugPanels(ctx.hooks, ctx, config.disabled);
|
|
31
|
+
if (panels.length === 0)
|
|
32
|
+
return null;
|
|
33
|
+
const name = "plumix-debug-tab";
|
|
34
|
+
return (_jsxs(_Fragment, { children: [_jsx("style", { "data-testid": "plumix-debug-bar-style", children: DEBUG_BAR_CSS }), _jsx("div", { className: "plumix-debug-bar", "data-testid": "plumix-debug-bar", "data-position": config.position, dir: "ltr", children: _jsxs("details", { open: config.defaultOpen, children: [_jsx("summary", { children: "Debug" }), panels.map((panel, index) => (_jsx("input", { className: "plumix-debug-bar__radio", type: "radio", name: name, id: `${name}-${panel.id}`, defaultChecked: index === 0 }, panel.id))), _jsx("nav", { className: "plumix-debug-bar__labels", children: panels.map((panel) => (_jsx("label", { htmlFor: `${name}-${panel.id}`, children: labelSourceText(panel.title) }, panel.id))) }), _jsx("div", { className: "plumix-debug-bar__panes", children: panels.map((panel) => (_jsx("section", { className: "plumix-debug-bar__pane", "data-testid": `plumix-debug-panel-${panel.id}`, dangerouslySetInnerHTML: { __html: renderPaneHtml(panel, ctx) } }, panel.id))) })] }) })] }));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../src/debug-bar/component.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAIxD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,+EAA+E;AAC/E,8EAA8E;AAC9E,mDAAmD;AACnD,SAAS,cAAc,CAAC,KAAiB,EAAE,GAAe;IACxD,IAAI,CAAC;QACH,OAAO,oBAAoB,CAAC,4BAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,GAAI,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,yBAAyB,KAAK,CAAC,EAAE,oBAAoB,EAAE,KAAK,CAAC,CAAC;QAC5E,OAAO,oBAAoB,CACzB,aAAG,SAAS,EAAC,yBAAyB,6BAC5B,KAAK,CAAC,EAAE,gCACd,CACL,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,GAAG,GAGJ;IACC,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC/C,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAEjC,MAAM,MAAM,GAAG,kBAAkB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IACn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BarPosition = "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
2
|
+
export type DebugBarInput = boolean | {
|
|
3
|
+
readonly enabled?: boolean;
|
|
4
|
+
readonly disable?: readonly string[];
|
|
5
|
+
readonly position?: DebugBarPosition;
|
|
6
|
+
readonly defaultOpen?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export interface NormalizedDebugBar {
|
|
9
|
+
readonly enabled: boolean;
|
|
10
|
+
/** Denylist of panel ids, as a Set for O(1) `.has(id)` at collect time. */
|
|
11
|
+
readonly disabled: ReadonlySet<string>;
|
|
12
|
+
readonly position: DebugBarPosition;
|
|
13
|
+
readonly defaultOpen: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function normalizeDebugBar(input: DebugBarInput | undefined): NormalizedDebugBar;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/debug-bar/config.ts"],"names":[],"mappings":"AAEA,KAAK,gBAAgB,GACnB,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC;AAE5D,MAAM,MAAM,aAAa,GACrB,OAAO,GACP;IACE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IACrC,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAEN,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,aAAa,GAAG,SAAS,GAC/B,kBAAkB,CAWpB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function normalizeDebugBar(input) {
|
|
2
|
+
const options = typeof input === "object" ? input : {};
|
|
3
|
+
// Default-on: only an explicit `false` (bare or via `enabled`) suppresses
|
|
4
|
+
// the bar. The compile-time dev gate is separate — this resolves intent.
|
|
5
|
+
const enabled = input === false ? false : options.enabled !== false;
|
|
6
|
+
return {
|
|
7
|
+
enabled,
|
|
8
|
+
disabled: new Set(options.disable ?? []),
|
|
9
|
+
position: options.position ?? "bottom-right",
|
|
10
|
+
defaultOpen: options.defaultOpen ?? false,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/debug-bar/config.ts"],"names":[],"mappings":"AAsBA,MAAM,UAAU,iBAAiB,CAC/B,KAAgC;IAEhC,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACvD,0EAA0E;IAC1E,yEAAyE;IACzE,MAAM,OAAO,GAAG,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,KAAK,KAAK,CAAC;IACpE,OAAO;QACL,OAAO;QACP,QAAQ,EAAE,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;QACxC,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,cAAc;QAC5C,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,KAAK;KAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HookRegistry } from "../hooks/registry.js";
|
|
2
|
+
/**
|
|
3
|
+
* Registers core's built-in debug panels. Wired at `buildApp` time behind
|
|
4
|
+
* the dev gate, at low priority so plugin panels (default priority 100)
|
|
5
|
+
* sort after core's. Mirrors `registerCoreAdminBarContributors`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerCoreDebugPanels(hooks: HookRegistry): void;
|
|
8
|
+
//# sourceMappingURL=core-panels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-panels.d.ts","sourceRoot":"","sources":["../../src/debug-bar/core-panels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAQzD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAajE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { appPanel } from "./panels/app.js";
|
|
2
|
+
import { databasePanel } from "./panels/database.js";
|
|
3
|
+
import { requestPanel } from "./panels/request.js";
|
|
4
|
+
import { templatePanel } from "./panels/template.js";
|
|
5
|
+
import { timelinePanel } from "./panels/timeline.js";
|
|
6
|
+
/**
|
|
7
|
+
* Registers core's built-in debug panels. Wired at `buildApp` time behind
|
|
8
|
+
* the dev gate, at low priority so plugin panels (default priority 100)
|
|
9
|
+
* sort after core's. Mirrors `registerCoreAdminBarContributors`.
|
|
10
|
+
*/
|
|
11
|
+
export function registerCoreDebugPanels(hooks) {
|
|
12
|
+
hooks.addFilter("debug_bar:panels", (panels) => [
|
|
13
|
+
...panels,
|
|
14
|
+
requestPanel,
|
|
15
|
+
templatePanel,
|
|
16
|
+
databasePanel,
|
|
17
|
+
timelinePanel,
|
|
18
|
+
appPanel,
|
|
19
|
+
], { plugin: "core", priority: 10 });
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=core-panels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-panels.js","sourceRoot":"","sources":["../../src/debug-bar/core-panels.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAmB;IACzD,KAAK,CAAC,SAAS,CACb,kBAAkB,EAClB,CAAC,MAA6B,EAAE,EAAE,CAAC;QACjC,GAAG,MAAM;QACT,YAAY;QACZ,aAAa;QACb,aAAa;QACb,aAAa;QACb,QAAQ;KACT,EACD,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CACjC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Logger } from "drizzle-orm";
|
|
2
|
+
/** Panel id + collector namespace for database queries. */
|
|
3
|
+
export declare const DB_PANEL_ID = "database";
|
|
4
|
+
export interface DbQueryEntry {
|
|
5
|
+
readonly sql: string;
|
|
6
|
+
readonly params: readonly unknown[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A drizzle `Logger` that feeds the Database panel. Pass it as the `logger`
|
|
10
|
+
* option to `drizzle(...)` (dev-gated) — one uniform mechanism across every
|
|
11
|
+
* driver, giving the `?`-form SQL plus the bound params. It reaches the
|
|
12
|
+
* request's collector via the request-store ALS, so it's a no-op outside a
|
|
13
|
+
* request (and in prod, where `ctx.debug` is the no-op collector). Per-query
|
|
14
|
+
* timing is not part of drizzle's logger contract; the Timeline panel measures
|
|
15
|
+
* it via spans instead.
|
|
16
|
+
*
|
|
17
|
+
* Driver-agnostic and free of any driver type import, so it can be shared with
|
|
18
|
+
* runtime adapters (D1) over a narrow subpath without dragging libsql types in.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createDebugSqlLogger(): Logger;
|
|
21
|
+
//# sourceMappingURL=db-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-query.d.ts","sourceRoot":"","sources":["../../src/debug-bar/db-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAI1C,2DAA2D;AAC3D,eAAO,MAAM,WAAW,aAAa,CAAC;AAEtC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;CACrC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAM7C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { tryGetContext } from "../context/stores.js";
|
|
2
|
+
/** Panel id + collector namespace for database queries. */
|
|
3
|
+
export const DB_PANEL_ID = "database";
|
|
4
|
+
/**
|
|
5
|
+
* A drizzle `Logger` that feeds the Database panel. Pass it as the `logger`
|
|
6
|
+
* option to `drizzle(...)` (dev-gated) — one uniform mechanism across every
|
|
7
|
+
* driver, giving the `?`-form SQL plus the bound params. It reaches the
|
|
8
|
+
* request's collector via the request-store ALS, so it's a no-op outside a
|
|
9
|
+
* request (and in prod, where `ctx.debug` is the no-op collector). Per-query
|
|
10
|
+
* timing is not part of drizzle's logger contract; the Timeline panel measures
|
|
11
|
+
* it via spans instead.
|
|
12
|
+
*
|
|
13
|
+
* Driver-agnostic and free of any driver type import, so it can be shared with
|
|
14
|
+
* runtime adapters (D1) over a narrow subpath without dragging libsql types in.
|
|
15
|
+
*/
|
|
16
|
+
export function createDebugSqlLogger() {
|
|
17
|
+
return {
|
|
18
|
+
logQuery(sql, params) {
|
|
19
|
+
tryGetContext()?.debug.record(DB_PANEL_ID, { sql, params });
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=db-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-query.js","sourceRoot":"","sources":["../../src/debug-bar/db-query.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,2DAA2D;AAC3D,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC;AAOtC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,QAAQ,CAAC,GAAG,EAAE,MAAM;YAClB,aAAa,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;QAC9D,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type SqlParamKind = "string" | "number" | "boolean" | "null" | "blob";
|
|
2
|
+
export interface DescribedParam {
|
|
3
|
+
readonly kind: SqlParamKind;
|
|
4
|
+
readonly text: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Describe a bound SQL parameter for the Database panel: its `kind` (for
|
|
8
|
+
* per-type coloring) and display `text` (strings quoted, numbers/bigints/
|
|
9
|
+
* booleans/null as literals, long strings truncated) — the `?`-form SQL stays
|
|
10
|
+
* copyable. One pass so the kind and text can't drift apart.
|
|
11
|
+
*/
|
|
12
|
+
export declare function describeSqlParam(value: unknown): DescribedParam;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=format-param.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-param.d.ts","sourceRoot":"","sources":["../../src/debug-bar/format-param.ts"],"names":[],"mappings":"AAEA,KAAK,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CAiB/D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const MAX_LEN = 80;
|
|
2
|
+
/**
|
|
3
|
+
* Describe a bound SQL parameter for the Database panel: its `kind` (for
|
|
4
|
+
* per-type coloring) and display `text` (strings quoted, numbers/bigints/
|
|
5
|
+
* booleans/null as literals, long strings truncated) — the `?`-form SQL stays
|
|
6
|
+
* copyable. One pass so the kind and text can't drift apart.
|
|
7
|
+
*/
|
|
8
|
+
export function describeSqlParam(value) {
|
|
9
|
+
if (value === null || value === undefined)
|
|
10
|
+
return { kind: "null", text: "null" };
|
|
11
|
+
if (typeof value === "string") {
|
|
12
|
+
const text = value.length > MAX_LEN ? `${value.slice(0, MAX_LEN)}…` : value;
|
|
13
|
+
return { kind: "string", text: `"${text}"` };
|
|
14
|
+
}
|
|
15
|
+
if (typeof value === "bigint")
|
|
16
|
+
return { kind: "number", text: value.toString() };
|
|
17
|
+
if (typeof value === "number")
|
|
18
|
+
return { kind: "number", text: String(value) };
|
|
19
|
+
if (typeof value === "boolean")
|
|
20
|
+
return { kind: "boolean", text: String(value) };
|
|
21
|
+
if (value instanceof Uint8Array) {
|
|
22
|
+
return { kind: "blob", text: `<blob ${value.byteLength} bytes>` };
|
|
23
|
+
}
|
|
24
|
+
// Objects/dates are unusual as bound params — JSON gives a readable form.
|
|
25
|
+
return { kind: "string", text: JSON.stringify(value) };
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=format-param.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-param.js","sourceRoot":"","sources":["../../src/debug-bar/format-param.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,EAAE,CAAC;AASnB;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,KAAK,KAAK,IAAI,IAAI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
+
}
|
|
6
|
+
export declare function tokenizeSql(sql: string): readonly SqlToken[];
|
|
7
|
+
export type QueryKind = "select" | "insert" | "update" | "delete" | "other";
|
|
8
|
+
/** The leading statement kind, for the per-query badge/color. */
|
|
9
|
+
export declare function queryKind(sql: string): QueryKind;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=highlight-sql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight-sql.d.ts","sourceRoot":"","sources":["../../src/debug-bar/highlight-sql.ts"],"names":[],"mappings":"AAuDA,KAAK,YAAY,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE7D,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;CAC7B;AAQD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,QAAQ,EAAE,CAa5D;AAED,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAI5E,iEAAiE;AACjE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAGhD"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// A small SQL syntax-highlighter for the Database panel (idea borrowed from
|
|
2
|
+
// drizzle-query-logger, adapted from terminal colors to CSS token spans).
|
|
3
|
+
const KEYWORDS = new Set([
|
|
4
|
+
"select",
|
|
5
|
+
"distinct",
|
|
6
|
+
"from",
|
|
7
|
+
"where",
|
|
8
|
+
"and",
|
|
9
|
+
"or",
|
|
10
|
+
"not",
|
|
11
|
+
"in",
|
|
12
|
+
"is",
|
|
13
|
+
"null",
|
|
14
|
+
"like",
|
|
15
|
+
"between",
|
|
16
|
+
"insert",
|
|
17
|
+
"into",
|
|
18
|
+
"values",
|
|
19
|
+
"update",
|
|
20
|
+
"set",
|
|
21
|
+
"delete",
|
|
22
|
+
"join",
|
|
23
|
+
"left",
|
|
24
|
+
"right",
|
|
25
|
+
"inner",
|
|
26
|
+
"outer",
|
|
27
|
+
"cross",
|
|
28
|
+
"on",
|
|
29
|
+
"as",
|
|
30
|
+
"order",
|
|
31
|
+
"by",
|
|
32
|
+
"group",
|
|
33
|
+
"having",
|
|
34
|
+
"limit",
|
|
35
|
+
"offset",
|
|
36
|
+
"asc",
|
|
37
|
+
"desc",
|
|
38
|
+
"union",
|
|
39
|
+
"all",
|
|
40
|
+
"count",
|
|
41
|
+
"sum",
|
|
42
|
+
"avg",
|
|
43
|
+
"min",
|
|
44
|
+
"max",
|
|
45
|
+
"returning",
|
|
46
|
+
"exists",
|
|
47
|
+
"case",
|
|
48
|
+
"when",
|
|
49
|
+
"then",
|
|
50
|
+
"else",
|
|
51
|
+
"end",
|
|
52
|
+
"pragma",
|
|
53
|
+
]);
|
|
54
|
+
// One alternation per token class; the last branch mops up whitespace and
|
|
55
|
+
// punctuation (including `?` placeholders, and a lone unterminated `'`) so
|
|
56
|
+
// tokenization stays lossless for any input.
|
|
57
|
+
const TOKEN = /('(?:[^']|'')*')|(\d+(?:\.\d+)?)|([A-Za-z_][A-Za-z0-9_]*)|(\s+|[^\w'\s]+|')/g;
|
|
58
|
+
export function tokenizeSql(sql) {
|
|
59
|
+
const tokens = [];
|
|
60
|
+
for (const m of sql.matchAll(TOKEN)) {
|
|
61
|
+
if (m[1] !== undefined)
|
|
62
|
+
tokens.push({ text: m[1], kind: "string" });
|
|
63
|
+
else if (m[2] !== undefined)
|
|
64
|
+
tokens.push({ text: m[2], kind: "number" });
|
|
65
|
+
else if (m[3] !== undefined) {
|
|
66
|
+
tokens.push({
|
|
67
|
+
text: m[3],
|
|
68
|
+
kind: KEYWORDS.has(m[3].toLowerCase()) ? "keyword" : "text",
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
else
|
|
72
|
+
tokens.push({ text: m[4] ?? "", kind: "text" });
|
|
73
|
+
}
|
|
74
|
+
return tokens;
|
|
75
|
+
}
|
|
76
|
+
const KNOWN_KINDS = new Set(["select", "insert", "update", "delete"]);
|
|
77
|
+
/** The leading statement kind, for the per-query badge/color. */
|
|
78
|
+
export function queryKind(sql) {
|
|
79
|
+
const first = sql.trimStart().split(/\s/, 1)[0]?.toLowerCase() ?? "";
|
|
80
|
+
return (KNOWN_KINDS.has(first) ? first : "other");
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=highlight-sql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight-sql.js","sourceRoot":"","sources":["../../src/debug-bar/highlight-sql.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,0EAA0E;AAE1E,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACvB,QAAQ;IACR,UAAU;IACV,MAAM;IACN,OAAO;IACP,KAAK;IACL,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,MAAM;IACN,SAAS;IACT,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,KAAK;IACL,OAAO;IACP,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,WAAW;IACX,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,QAAQ;CACT,CAAC,CAAC;AASH,0EAA0E;AAC1E,2EAA2E;AAC3E,6CAA6C;AAC7C,MAAM,KAAK,GACT,8EAA8E,CAAC;AAEjF,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,MAAM,GAAe,EAAE,CA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G,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAc,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DebugPanel } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The App panel: the site's static setup — the same across every page, so it's
|
|
4
|
+
* consolidated into one tab (config, locale, wired slots, installed plugins,
|
|
5
|
+
* and registered content types) rather than a tab each.
|
|
6
|
+
*/
|
|
7
|
+
export declare const appPanel: DebugPanel;
|
|
8
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/debug-bar/panels/app.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAU9C;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,UAgDtB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DebugKV, DebugSection } from "../primitives.js";
|
|
3
|
+
const wired = (slot) => (slot ? "✓" : "—");
|
|
4
|
+
const list = (values) => values.join(", ") || "—";
|
|
5
|
+
const keys = (map) => list([...map.keys()]);
|
|
6
|
+
/**
|
|
7
|
+
* The App panel: the site's static setup — the same across every page, so it's
|
|
8
|
+
* consolidated into one tab (config, locale, wired slots, installed plugins,
|
|
9
|
+
* and registered content types) rather than a tab each.
|
|
10
|
+
*/
|
|
11
|
+
export const appPanel = {
|
|
12
|
+
id: "app",
|
|
13
|
+
title: "App",
|
|
14
|
+
order: 40,
|
|
15
|
+
render: (ctx) => (_jsxs(_Fragment, { children: [_jsx(DebugSection, { title: "Config", children: _jsx(DebugKV, { rows: [
|
|
16
|
+
{ label: "Site name", value: ctx.siteName ?? "—" },
|
|
17
|
+
{ label: "Origin", value: ctx.origin },
|
|
18
|
+
{ label: "Base path", value: ctx.basePath || "/" },
|
|
19
|
+
] }) }), _jsx(DebugSection, { title: "Locale", children: _jsx(DebugKV, { rows: [
|
|
20
|
+
{ label: "Resolved", value: ctx.locale.code },
|
|
21
|
+
{ label: "Direction", value: ctx.locale.direction },
|
|
22
|
+
] }) }), _jsx(DebugSection, { title: "Slots", children: _jsx(DebugKV, { rows: [
|
|
23
|
+
{ label: "Cache", value: wired(ctx.cache) },
|
|
24
|
+
{ label: "Storage", value: wired(ctx.storage) },
|
|
25
|
+
{ label: "Mailer", value: wired(ctx.mailer) },
|
|
26
|
+
{ label: "Images", value: wired(ctx.imageDelivery) },
|
|
27
|
+
] }) }), _jsx(DebugSection, { title: "Plugins", children: _jsx(DebugKV, { rows: [{ label: "Installed", value: list(ctx.plugins.pluginIds) }] }) }), _jsx(DebugSection, { title: "Content types", children: _jsx(DebugKV, { rows: [
|
|
28
|
+
{ label: "Entry types", value: keys(ctx.plugins.entryTypes) },
|
|
29
|
+
{ label: "Taxonomies", value: keys(ctx.plugins.termTaxonomies) },
|
|
30
|
+
] }) })] })),
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/debug-bar/panels/app.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,KAAK,GAAG,CAAC,IAAa,EAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAE5D,MAAM,IAAI,GAAG,CAAC,MAAyB,EAAU,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;AAE7E,MAAM,IAAI,GAAG,CAAC,GAAiC,EAAU,EAAE,CACzD,IAAI,CAAC,CAAC,GAAG,GAAG,CAA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CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;qBACrD,GACD,GACW,EACf,KAAC,YAAY,IAAC,KAAK,EAAC,SAAS,YAC3B,KAAC,OAAO,IACN,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAClE,GACW,EACf,KAAC,YAAY,IAAC,KAAK,EAAC,eAAe,YACjC,KAAC,OAAO,IACN,IAAI,EAAE;wBACJ,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;wBAC7D,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE;qBACjE,GACD,GACW,IACd,CACJ;CACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DebugPanel } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The Database panel: every query recorded for this request (via the drizzle
|
|
4
|
+
* logger), with SQL syntax highlighting, a per-query kind badge, and the bound
|
|
5
|
+
* params shown separately (typed-colored) — the `?`-form SQL stays copyable.
|
|
6
|
+
* Per-query timing arrives with the Timeline slice.
|
|
7
|
+
*/
|
|
8
|
+
export declare const databasePanel: DebugPanel;
|
|
9
|
+
//# sourceMappingURL=database.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../src/debug-bar/panels/database.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAsB9C;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,UAgD3B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DB_PANEL_ID } from "../db-query.js";
|
|
3
|
+
import { describeSqlParam } from "../format-param.js";
|
|
4
|
+
import { queryKind, tokenizeSql } from "../highlight-sql.js";
|
|
5
|
+
import { DebugSection } from "../primitives.js";
|
|
6
|
+
function HighlightedSql({ sql }) {
|
|
7
|
+
return (_jsx("code", { className: "plumix-debug-bar__sql", children: tokenizeSql(sql).map((token, i) => token.kind === "text" ? (token.text) : (_jsx("span", { className: `plumix-debug-bar__tok--${token.kind}`, children: token.text }, i))) }));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The Database panel: every query recorded for this request (via the drizzle
|
|
11
|
+
* logger), with SQL syntax highlighting, a per-query kind badge, and the bound
|
|
12
|
+
* params shown separately (typed-colored) — the `?`-form SQL stays copyable.
|
|
13
|
+
* Per-query timing arrives with the Timeline slice.
|
|
14
|
+
*/
|
|
15
|
+
export const databasePanel = {
|
|
16
|
+
id: DB_PANEL_ID,
|
|
17
|
+
title: "Database",
|
|
18
|
+
order: 20,
|
|
19
|
+
render: (ctx) => {
|
|
20
|
+
const queries = ctx.debug.get(DB_PANEL_ID);
|
|
21
|
+
if (queries.length === 0) {
|
|
22
|
+
return _jsx("p", { className: "plumix-debug-bar__empty", children: "No queries recorded." });
|
|
23
|
+
}
|
|
24
|
+
return (_jsx(DebugSection, { title: `${queries.length} ${queries.length === 1 ? "query" : "queries"}`, children: _jsx("ol", { className: "plumix-debug-bar__queries", children: queries.map((query, i) => {
|
|
25
|
+
const kind = queryKind(query.sql);
|
|
26
|
+
return (_jsxs("li", { className: "plumix-debug-bar__query", children: [_jsxs("div", { className: "plumix-debug-bar__query-head", children: [_jsx("span", { className: `plumix-debug-bar__kind plumix-debug-bar__kind--${kind}`, children: kind }), _jsx(HighlightedSql, { sql: query.sql })] }), query.params.length > 0 ? (_jsx("div", { className: "plumix-debug-bar__params", children: query.params.map((param, j) => {
|
|
27
|
+
const { kind: paramKind, text } = describeSqlParam(param);
|
|
28
|
+
return (_jsx("span", { className: `plumix-debug-bar__param plumix-debug-bar__param--${paramKind}`, children: text }, j));
|
|
29
|
+
}) })) : null] }, i));
|
|
30
|
+
}) }) }));
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=database.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../../src/debug-bar/panels/database.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,SAAS,cAAc,CAAC,EAAE,GAAG,EAA4B;IACvD,OAAO,CACL,eAAM,SAAS,EAAC,uBAAuB,YACpC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CACjC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CACtB,KAAK,CAAC,IAAI,CACX,CAAC,CAAC,CAAC,CACF,eAAc,SAAS,EAAE,0BAA0B,KAAK,CAAC,IAAI,EAAE,YAC5D,KAAK,CAAC,IAAI,IADF,CAAC,CAEL,CACR,CACF,GACI,CACR,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAe;IACvC,EAAE,EAAE,WAAW;IACf,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,CAAC,GAAe,EAAE,EAAE;QAC1B,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAA4B,CAAC;QACtE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,YAAG,SAAS,EAAC,yBAAyB,qCAAyB,CAAC;QACzE,CAAC;QACD,OAAO,CACL,KAAC,YAAY,IACX,KAAK,EAAE,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,YAExE,aAAI,SAAS,EAAC,2BAA2B,YACtC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;oBACxB,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBAClC,OAAO,CACL,cAAY,SAAS,EAAC,yBAAyB,aAC7C,eAAK,SAAS,EAAC,8BAA8B,aAC3C,eACE,SAAS,EAAE,kDAAkD,IAAI,EAAE,YAElE,IAAI,GACA,EACP,KAAC,cAAc,IAAC,GAAG,EAAE,KAAK,CAAC,GAAG,GAAI,IAC9B,EACL,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CACzB,cAAK,SAAS,EAAC,0BAA0B,YACtC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;oCAC7B,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;oCAC1D,OAAO,CACL,eAEE,SAAS,EAAE,oDAAoD,SAAS,EAAE,YAEzE,IAAI,IAHA,CAAC,CAID,CACR,CAAC;gCACJ,CAAC,CAAC,GACE,CACP,CAAC,CAAC,CAAC,IAAI,KAvBD,CAAC,CAwBL,CACN,CAAC;gBACJ,CAAC,CAAC,GACC,GACQ,CAChB,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DebugPanel } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The Request panel: the full context of this request — how the router saw it,
|
|
4
|
+
* and who made it. All read straight off the app context, no instrumentation.
|
|
5
|
+
*/
|
|
6
|
+
export declare const requestPanel: DebugPanel;
|
|
7
|
+
//# sourceMappingURL=request.d.ts.map
|