brumate 0.8.1 → 0.9.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/{boot-DQuAhAd5.d.ts → boot-ej-9NRT3.d.ts} +20 -2
- package/dist/cli.js +88 -82
- package/dist/cli.js.map +1 -1
- package/dist/{client-CwVcmymi.js → client-B-ww-PQ7.js} +304 -48
- package/dist/client-B-ww-PQ7.js.map +1 -0
- package/dist/{client-4eabQtYJ.d.ts → client-Do6IBIhI.d.ts} +35 -9
- package/dist/{defer-BaXWydb0.js → defer-JD2FK9mV.js} +5 -3
- package/dist/defer-JD2FK9mV.js.map +1 -0
- package/dist/{devtools-calls-DGW6nLZ2.js → devtools-calls-DCjuSkim.js} +3 -3
- package/dist/{devtools-calls-DGW6nLZ2.js.map → devtools-calls-DCjuSkim.js.map} +1 -1
- package/dist/{devtools-panel-Cq8LpsyW.js → devtools-panel-DLeWTPhU.js} +4 -4
- package/dist/{devtools-panel-Cq8LpsyW.js.map → devtools-panel-DLeWTPhU.js.map} +1 -1
- package/dist/{devtools-CMuj12yR.js → devtools-tuq7ATGN.js} +10 -7
- package/dist/devtools-tuq7ATGN.js.map +1 -0
- package/dist/{error-catalog-DakxjSgj.js → error-catalog-BBWB7w-E.js} +11 -4
- package/dist/error-catalog-BBWB7w-E.js.map +1 -0
- package/dist/{error-catalog-VxLbz-6p.js → error-catalog-CbmQqfat.js} +1 -1
- package/dist/{events-LgLdp1R7.js → events-BDVITj3P.js} +3 -5
- package/dist/events-BDVITj3P.js.map +1 -0
- package/dist/{features-DwMYKBIC.js → features-Cte5aj20.js} +8 -2
- package/dist/features-Cte5aj20.js.map +1 -0
- package/dist/{files-DXS8RAtZ.js → files-Bz0lAQzD.js} +2 -2
- package/dist/{files-DXS8RAtZ.js.map → files-Bz0lAQzD.js.map} +1 -1
- package/dist/{html-Cf5uKhLs.js → html-BYuHDvxy.js} +10 -3
- package/dist/html-BYuHDvxy.js.map +1 -0
- package/dist/index.d.ts +71 -19
- package/dist/index.js +3 -3
- package/dist/{inspect-B5AoHh5O.js → inspect-fpaBJ5pm.js} +1247 -62
- package/dist/inspect-fpaBJ5pm.js.map +1 -0
- package/dist/{loader-CTeT6ie9.js → loader-DMxuZ6He.js} +14 -6
- package/dist/loader-DMxuZ6He.js.map +1 -0
- package/dist/{navigate-Bj73X4ZS.js → navigate-C5PjwYMh.js} +101 -20
- package/dist/navigate-C5PjwYMh.js.map +1 -0
- package/dist/{produce-CLABZ8k2.d.ts → produce-BDkCsGH7.d.ts} +3 -3
- package/dist/{rpc-kVB0Ujdx.js → rpc-DOdrekhP.js} +23 -13
- package/dist/rpc-DOdrekhP.js.map +1 -0
- package/dist/runtime/bundles.d.ts +1 -1
- package/dist/runtime/bundles.js +6 -2
- package/dist/runtime/bundles.js.map +1 -1
- package/dist/runtime/client.d.ts +4 -3
- package/dist/runtime/client.js +5 -5
- package/dist/runtime/devtools.d.ts +3 -1
- package/dist/runtime/devtools.js +1 -1
- package/dist/runtime/events.js +1 -1
- package/dist/runtime/hot.d.ts +1 -1
- package/dist/runtime/html.js +1 -1
- package/dist/runtime/loader.d.ts +2 -2
- package/dist/runtime/loader.js +2 -2
- package/dist/runtime/otel.d.ts +18 -0
- package/dist/runtime/otel.js +127 -0
- package/dist/runtime/otel.js.map +1 -0
- package/dist/runtime/server.d.ts +4 -3
- package/dist/runtime/server.js +5 -5
- package/dist/runtime/signals.d.ts +2 -2
- package/dist/runtime/signals.js +4 -1
- package/dist/runtime/signals.js.map +1 -1
- package/dist/runtime/static-loader.d.ts +2 -2
- package/dist/runtime/static-loader.js +1 -1
- package/dist/runtime/store.d.ts +2 -2
- package/dist/runtime/store.js +1 -1
- package/dist/runtime/testing.d.ts +2 -2
- package/dist/runtime/testing.js +2 -2
- package/dist/search-params-qGERTLi3.js +382 -0
- package/dist/search-params-qGERTLi3.js.map +1 -0
- package/dist/{serial-ribg9NAj.js → serial-B2AJ9VGx.js} +1 -1
- package/dist/{serial-ioa17MuY.js → serial-Cj6pDGOq.js} +6 -6
- package/dist/{serial-ioa17MuY.js.map → serial-Cj6pDGOq.js.map} +1 -1
- package/dist/{server-DesBZv5g.d.ts → server-2-LS_KFo.d.ts} +125 -9
- package/dist/{server-BUuf7XPZ.js → server-CRGZMWnK.js} +545 -236
- package/dist/server-CRGZMWnK.js.map +1 -0
- package/dist/{shared-CX_YacDm.js → shared-CUBWrbiM.js} +4 -4
- package/dist/{shared-CX_YacDm.js.map → shared-CUBWrbiM.js.map} +1 -1
- package/dist/sheets-B9Zr50mf.js +105 -0
- package/dist/sheets-B9Zr50mf.js.map +1 -0
- package/dist/{signals-7VVD9C_H.d.ts → signals-BgsJK-uT.d.ts} +16 -6
- package/dist/{static-loader-BM0-wdIc.js → static-loader-BDBtWsdg.js} +107 -19
- package/dist/static-loader-BDBtWsdg.js.map +1 -0
- package/dist/{static-loader-BSAyFqG0.d.ts → static-loader-CAFn6p0l.d.ts} +2 -2
- package/dist/{store-9_oa0HG1.d.ts → store-BwWg-Iei.d.ts} +79 -2
- package/dist/store-DNr24Z8L.js +950 -0
- package/dist/store-DNr24Z8L.js.map +1 -0
- package/dist/{stream-read-BTsYstJY.js → stream-read-CiLDH60b.js} +2 -2
- package/dist/{stream-read-BTsYstJY.js.map → stream-read-CiLDH60b.js.map} +1 -1
- package/dist/{stream-read-Dek3HnqO.js → stream-read-DVoregpA.js} +1 -1
- package/dist/trace-DT7RGRAV.d.ts +52 -0
- package/dist/trace-browser-C7MFMove.js +170 -0
- package/dist/trace-browser-C7MFMove.js.map +1 -0
- package/dist/trace-flag-Dy267snx.js +7 -0
- package/dist/trace-flag-Dy267snx.js.map +1 -0
- package/dist/{trusted-g_zUJbh2.js → trusted-Bmwg4_hf.js} +12 -5
- package/dist/trusted-Bmwg4_hf.js.map +1 -0
- package/dist/view-transitions-BpnVwtS4.js +141 -0
- package/dist/view-transitions-BpnVwtS4.js.map +1 -0
- package/dist/vite.d.ts +8 -1
- package/dist/vite.js +356 -46
- package/dist/vite.js.map +1 -1
- package/elements.d.ts +8 -0
- package/package.json +13 -1
- package/skills/brumate/SKILL.md +9 -5
- package/skills/brumate/references/errors.md +95 -14
- package/skills/brumate/references/events.md +27 -1
- package/skills/brumate/references/signals.md +4 -4
- package/skills/brumate/references/state.md +79 -4
- package/skills/brumate/references/syntax.md +58 -9
- package/dist/client-CwVcmymi.js.map +0 -1
- package/dist/defer-BaXWydb0.js.map +0 -1
- package/dist/devtools-CMuj12yR.js.map +0 -1
- package/dist/error-catalog-DakxjSgj.js.map +0 -1
- package/dist/events-LgLdp1R7.js.map +0 -1
- package/dist/features-DwMYKBIC.js.map +0 -1
- package/dist/html-Cf5uKhLs.js.map +0 -1
- package/dist/inspect-B5AoHh5O.js.map +0 -1
- package/dist/loader-CTeT6ie9.js.map +0 -1
- package/dist/navigate-Bj73X4ZS.js.map +0 -1
- package/dist/rpc-kVB0Ujdx.js.map +0 -1
- package/dist/search-params-Wg-0FsMj.js +0 -148
- package/dist/search-params-Wg-0FsMj.js.map +0 -1
- package/dist/server-BUuf7XPZ.js.map +0 -1
- package/dist/static-loader-BM0-wdIc.js.map +0 -1
- package/dist/store-Cy4EEyZ7.js +0 -439
- package/dist/store-Cy4EEyZ7.js.map +0 -1
- package/dist/trusted-g_zUJbh2.js.map +0 -1
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { t as Context } from "./context-BNgBXVUQ.js";
|
|
2
2
|
import { a as PageState, c as ScopeId, m as Raw, n as ElementReference, t as Binding } from "./shared-CuJdWifz.js";
|
|
3
|
-
import {
|
|
3
|
+
import { d as Store, f as StoreLike } from "./store-BwWg-Iei.js";
|
|
4
4
|
import { r as SerialEntry } from "./values-B8C7CLvG.js";
|
|
5
|
-
import {
|
|
5
|
+
import { N as SearchParamOptions } from "./signals-BgsJK-uT.js";
|
|
6
|
+
//#region src/runtime/trace-browser.d.ts
|
|
7
|
+
/** The spans of one event handler. `boot` makes it, and the core calls it. */
|
|
8
|
+
interface EventTrace {
|
|
9
|
+
/** True when the handler waits for code, set by the loader and the core. */
|
|
10
|
+
waits: boolean;
|
|
11
|
+
/** The code of the handler has loaded, or failed to. Ends `brumate.load` when it waited. */
|
|
12
|
+
ready: (failed?: boolean, error?: unknown) => void;
|
|
13
|
+
/** Runs the handler inside `brumate.run`. Ends `brumate.event` when its result settles. */
|
|
14
|
+
run: <T>(call: () => T) => T;
|
|
15
|
+
/** Ends the event with an error, such as a handler whose code did not load. */
|
|
16
|
+
fail: (error: unknown) => void;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
6
19
|
//#region src/runtime/navigate.d.ts
|
|
7
20
|
/** What the devtools learn of a navigation. See `DevtoolsHooks.navigated`. */
|
|
8
21
|
interface NavigationReport {
|
|
@@ -323,9 +336,10 @@ interface DevtoolsHooks {
|
|
|
323
336
|
write?(scope: Scope, slot: number, value: unknown): void;
|
|
324
337
|
/**
|
|
325
338
|
* An effect or a `$client` callback, by its name in the update code, ran
|
|
326
|
-
* and took `time` milliseconds, or its cleanup ran.
|
|
339
|
+
* and took `time` milliseconds, or its cleanup ran. An async callback reports `pending` when a
|
|
340
|
+
* run starts, and `run` or `skip` when it settles.
|
|
327
341
|
*/
|
|
328
|
-
effect?(scope: Scope, name: string, kind: "run" | "cleanup", time: number): void;
|
|
342
|
+
effect?(scope: Scope, name: string, kind: "run" | "cleanup" | "pending" | "skip", time: number): void;
|
|
329
343
|
/** A client navigation changed the page: the routes that stayed, and those it replaced. */
|
|
330
344
|
navigated?(report: NavigationReport): void;
|
|
331
345
|
}
|
|
@@ -374,7 +388,7 @@ declare function spread(attributes: Record<string, unknown>, on?: string[], name
|
|
|
374
388
|
*/
|
|
375
389
|
declare function handle(element: Element, entry: string, event?: Event, typed?: {
|
|
376
390
|
value: unknown;
|
|
377
|
-
}): Promise<unknown>;
|
|
391
|
+
}, trace?: EventTrace): Promise<unknown>;
|
|
378
392
|
/** Renders the attributes of a form or button that posts to a server function. */
|
|
379
393
|
declare function action(name: string, id: string, method?: string, result?: string): string;
|
|
380
394
|
/**
|
|
@@ -554,6 +568,13 @@ declare function loading(body: () => Out, fallback?: () => Out): DocumentFragmen
|
|
|
554
568
|
declare function guess<T>(scope: Scope, slot: number, ...rest: [value: T] | [sourceScope: Scope, sourceSlot: number, value: T]): T;
|
|
555
569
|
/** Counts a server call, and puts guesses back when the last one finishes. */
|
|
556
570
|
declare function track<T>(request: Promise<T>): Promise<T>;
|
|
571
|
+
/**
|
|
572
|
+
* The store of `$optimistic(source)` at the top level of a module: it follows the store `source`,
|
|
573
|
+
* and an exported function writes a guess with `set`. The guess goes back to the source when the
|
|
574
|
+
* source changes, or when every server call of the page finishes. On the server a write is
|
|
575
|
+
* dropped, as the server holds no guess.
|
|
576
|
+
*/
|
|
577
|
+
declare function optimisticStore<T>(source: StoreLike<T>): StoreLike<T>;
|
|
557
578
|
//#endregion
|
|
558
579
|
//#region src/runtime/client/inserts.d.ts
|
|
559
580
|
/**
|
|
@@ -640,8 +661,6 @@ declare function spreadProps(scope: Scope, anchor: number, value: Record<string,
|
|
|
640
661
|
declare function prop(scope: Scope, anchor: number, name: string, value: unknown): void;
|
|
641
662
|
//#endregion
|
|
642
663
|
//#region src/runtime/client/scopes.d.ts
|
|
643
|
-
/** Returns the instance of a scope by its ID. */
|
|
644
|
-
declare function getScope(id: ScopeId): Scope | undefined;
|
|
645
664
|
declare function descendants(scope: Scope, kind: number, result?: Scope[]): Scope[];
|
|
646
665
|
/**
|
|
647
666
|
* Removes a scope from the page: its cleanups run, and its memo state goes,
|
|
@@ -736,6 +755,13 @@ declare function setOn(element: Element, on: string[], own: string): void;
|
|
|
736
755
|
/** Writes the content of an element of cloned markup, as `insert` writes it in HTML. */
|
|
737
756
|
declare function setContent(element: Element, value: unknown, at?: ScopeId | Scope): void;
|
|
738
757
|
//#endregion
|
|
758
|
+
//#region src/runtime/client/async-effect.d.ts
|
|
759
|
+
/**
|
|
760
|
+
* Runs an async effect, or a `$client` callback when `client` is set. One run goes at a time: a
|
|
761
|
+
* change while it is busy makes one run after it, and after its cleanup, has settled.
|
|
762
|
+
*/
|
|
763
|
+
declare function asyncEffect(scope: Scope, name: string, callback: () => unknown, client?: boolean): void;
|
|
764
|
+
//#endregion
|
|
739
765
|
//#region src/runtime/client/search.d.ts
|
|
740
766
|
/** `$searchParam` in the browser: the parameter of the URL of the page. */
|
|
741
767
|
declare function searchParam(name: string, options?: SearchParamOptions<unknown>): unknown;
|
|
@@ -851,5 +877,5 @@ declare const loader: {
|
|
|
851
877
|
updateRoute: typeof updateRoute;
|
|
852
878
|
};
|
|
853
879
|
//#endregion
|
|
854
|
-
export { setVar as $,
|
|
855
|
-
//# sourceMappingURL=client-
|
|
880
|
+
export { setVar as $, DevtoolsHooks as $t, listNodes as A, NavigationReport as An, dispose as At, afterInsert as B, rpc as Bt, appendText as C, branch as Cn, loading as Ct, fillList as D, rekey as Dn, fail as Dt, fillBranch as E, offscreen as En, wait as Et, setAttrText as F, remount as Ft, setOwner as G, provideValue as Gt, descendants as H, submitAction as Ht, setContent as I, removeRoot as It, spreadProps as J, toStore as Jt, sink as K, setGlobal as Kt, setOn as L, action as Lt, nodes as M, init as Mt, putText as N, leavePage as Nt, keep as O, reset as On, loadModule as Ot, setAttr as P, leaveRoutes as Pt, deferInBrowser as Q, DEVTOOLS as Qt, setSpread as R, handle as Rt, asyncEffect as S, HiddenBody as Sn, keepValue as St, clone as T, held as Tn, started as Tt, makeId as U, consumeContext as Ut, createScope as V, spread as Vt, removeScope as W, consumeStore as Wt, addPortal as X, ClientModule as Xt, addHead as Y, updateRoute as Yt, addStyle as Z, CoreOptions as Zt, update as _, setItem as _n, fillAttrs as _t, cells as a, skew as an, attrs as at, paramEffect as b, insert as bn, fillSpread as bt, get as c, componentNodes as cn, restRef as ct, pend as d, elementAt as dn, guess as dt, Scope as en, list as et, pending as f, foreignNodes as fn, optimisticStore as ft, unreadMemo as g, renderMemo as gn, countLoads as gt, timed as h, readMemo as hn, attempt as ht, bindings as i, scopes as in, attr as it, markBlock as j, forget as jt, keepText as k, retag as kn, nameComment as kt, isBound as l, dynamic as ln, text as lt, set as m, place as mn, after as mt, asyncMemo as n, hooks as nn, windowList as nt, effect as o, Component as on, content as ot, resolve as p, memoNow as pn, track as pt, prop as q, storeUpdate as qt, binding as r, rpcPrefix as rn, windowStart as rt, gate as s, component as sn, portalTo as st, loader as t, build as tn, toList as tt, memo as u, dynamicNodes as un, writeText as ut, updated as v, setSlots as vn, fillPend as vt, branchNodes as w, fill as wn, reveal as wt, searchParam as x, templateCall as xn, fillValue as xt, title as y, children as yn, fillSettled as yt, template as z, handlerProp as zt };
|
|
881
|
+
//# sourceMappingURL=client-Do6IBIhI.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as trustedScript, t as trustedHTML } from "./trusted-
|
|
1
|
+
import { Cn as skew, yn as build } from "./client-B-ww-PQ7.js";
|
|
2
|
+
import { n as trustedScript, t as trustedHTML } from "./trusted-Bmwg4_hf.js";
|
|
3
|
+
import { s as preloadSheets } from "./sheets-B9Zr50mf.js";
|
|
3
4
|
//#region src/runtime/defer.ts
|
|
4
5
|
/** The nonce of a script. Browsers hide the attribute once the page loads, and keep the property. */
|
|
5
6
|
function readNonce(script) {
|
|
@@ -36,6 +37,7 @@ async function loadDeferred(template) {
|
|
|
36
37
|
if (!response.ok || response.headers.get("x-brumate-defer") !== boundary) return;
|
|
37
38
|
const parsed = document.createElement("template");
|
|
38
39
|
parsed.innerHTML = trustedHTML(await response.text());
|
|
40
|
+
await preloadSheets(parsed.content);
|
|
39
41
|
const nonce = pageNonce();
|
|
40
42
|
for (const node of Array.from(parsed.content.childNodes)) {
|
|
41
43
|
if (node.nodeName !== "SCRIPT") {
|
|
@@ -53,4 +55,4 @@ async function loadDeferred(template) {
|
|
|
53
55
|
//#endregion
|
|
54
56
|
export { loadDeferred };
|
|
55
57
|
|
|
56
|
-
//# sourceMappingURL=defer-
|
|
58
|
+
//# sourceMappingURL=defer-JD2FK9mV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defer-JD2FK9mV.js","names":[],"sources":["../src/runtime/defer.ts"],"sourcesContent":["// Loads the body of a `#defer` block. The loader imports this module when\n// the block's trigger fires, so a page without `#defer` does not load it.\n//\n// The server renders the route again for the request and answers with what\n// it streams for a `#loading` body that is ready: the body in a\n// `<template b-l>`, the script that swaps it in, and its state records.\n// This module adds that markup to the page and runs its scripts, in order.\n\nimport { build, skew } from './client.ts';\nimport { preloadSheets } from './sheets.ts';\nimport { trustedHTML, trustedScript } from './trusted.ts';\n/** The nonce of a script. Browsers hide the attribute once the page loads, and keep the property. */\nfunction readNonce(script: HTMLScriptElement): string | null {\n return script.nonce || script.getAttribute('nonce');\n}\n\n/** The Content Security Policy nonce of the page, which the scripts of the answer need to run. */\nfunction pageNonce(): string | undefined {\n for (const script of document.querySelectorAll('script')) {\n const nonce = readNonce(script);\n if (nonce) {\n return nonce;\n }\n }\n return undefined;\n}\n\n/** The templates whose bodies were asked for. */\nconst requested = new WeakSet<Element>();\n\n/**\n * Asks the server for the body of the `#defer` block of a `<template\n * b-defer>`, and puts it in place of the fallback. When the server cannot\n * render it, such as a page that changed since it loaded, or a static host\n * that answers with the whole page, the fallback stays.\n */\nexport async function loadDeferred(template: Element): Promise<void> {\n // Once, so the devtools can fire the trigger before the loader does.\n if (requested.has(template)) {\n return;\n }\n requested.add(template);\n const [, boundary, base] = template.getAttribute('b-defer')!.split(':') as [\n string,\n string,\n string,\n ];\n const response = await fetch(location.href, {\n headers: {\n 'x-brumate-defer': `${boundary} ${template.getAttribute('b-b')}`,\n 'x-brumate-base': base,\n ...(build === undefined ? {} : { 'x-brumate-build': build }),\n },\n });\n if (response.status === 409 && response.headers.get('x-brumate-build')) {\n // The site changed since the page loaded. The fallback stays, and the next page loads in full.\n skew('defer');\n return;\n }\n if (!response.ok || response.headers.get('x-brumate-defer') !== boundary) {\n return;\n }\n const parsed = document.createElement('template');\n parsed.innerHTML = trustedHTML(await response.text());\n // The links of the body load before it comes in, so it does not show unstyled.\n await preloadSheets(parsed.content);\n const nonce = pageNonce();\n // A copy, because appending moves nodes out of the live list.\n for (const node of Array.from(parsed.content.childNodes)) {\n if (node.nodeName !== 'SCRIPT') {\n document.body.append(node);\n continue;\n }\n // A script from `innerHTML` does not run, so a copy goes in its place.\n const script = node as HTMLScriptElement;\n const copy = document.createElement('script');\n for (const attribute of script.attributes) {\n if (attribute.name !== 'nonce') {\n copy.setAttribute(attribute.name, attribute.value);\n }\n }\n if (nonce) {\n copy.nonce = nonce;\n }\n copy.textContent = trustedScript(script.textContent ?? '');\n document.body.append(copy);\n }\n}\n"],"mappings":";;;;;AAYA,SAAS,UAAU,QAA0C;CAC3D,OAAO,OAAO,SAAS,OAAO,aAAa,OAAO;AACpD;;AAGA,SAAS,YAAgC;CACvC,KAAK,MAAM,UAAU,SAAS,iBAAiB,QAAQ,GAAG;EACxD,MAAM,QAAQ,UAAU,MAAM;EAC9B,IAAI,OACF,OAAO;CAEX;AAEF;;AAGA,MAAM,4BAAY,IAAI,QAAiB;;;;;;;AAQvC,eAAsB,aAAa,UAAkC;CAEnE,IAAI,UAAU,IAAI,QAAQ,GACxB;CAEF,UAAU,IAAI,QAAQ;CACtB,MAAM,GAAG,UAAU,QAAQ,SAAS,aAAa,SAAS,CAAC,CAAE,MAAM,GAAG;CAKtE,MAAM,WAAW,MAAM,MAAM,SAAS,MAAM,EAC1C,SAAS;EACP,mBAAmB,GAAG,SAAS,GAAG,SAAS,aAAa,KAAK;EAC7D,kBAAkB;EAClB,GAAI,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,mBAAmB,MAAM;CAC5D,EACF,CAAC;CACD,IAAI,SAAS,WAAW,OAAO,SAAS,QAAQ,IAAI,iBAAiB,GAAG;EAEtE,KAAK,OAAO;EACZ;CACF;CACA,IAAI,CAAC,SAAS,MAAM,SAAS,QAAQ,IAAI,iBAAiB,MAAM,UAC9D;CAEF,MAAM,SAAS,SAAS,cAAc,UAAU;CAChD,OAAO,YAAY,YAAY,MAAM,SAAS,KAAK,CAAC;CAEpD,MAAM,cAAc,OAAO,OAAO;CAClC,MAAM,QAAQ,UAAU;CAExB,KAAK,MAAM,QAAQ,MAAM,KAAK,OAAO,QAAQ,UAAU,GAAG;EACxD,IAAI,KAAK,aAAa,UAAU;GAC9B,SAAS,KAAK,OAAO,IAAI;GACzB;EACF;EAEA,MAAM,SAAS;EACf,MAAM,OAAO,SAAS,cAAc,QAAQ;EAC5C,KAAK,MAAM,aAAa,OAAO,YAC7B,IAAI,UAAU,SAAS,SACrB,KAAK,aAAa,UAAU,MAAM,UAAU,KAAK;EAGrD,IAAI,OACF,KAAK,QAAQ;EAEf,KAAK,cAAc,cAAc,OAAO,eAAe,EAAE;EACzD,SAAS,KAAK,OAAO,IAAI;CAC3B;AACF"}
|
|
@@ -209,8 +209,8 @@ async function readCall(input) {
|
|
|
209
209
|
};
|
|
210
210
|
const [{ fromJSON }, { callPlugins, serialOptions }, { fromChunkStream }] = await Promise.all([
|
|
211
211
|
import("seroval/read"),
|
|
212
|
-
import("./serial-
|
|
213
|
-
import("./stream-read-
|
|
212
|
+
import("./serial-B2AJ9VGx.js"),
|
|
213
|
+
import("./stream-read-DVoregpA.js")
|
|
214
214
|
]);
|
|
215
215
|
try {
|
|
216
216
|
const body = init?.body;
|
|
@@ -246,4 +246,4 @@ async function readCall(input) {
|
|
|
246
246
|
//#endregion
|
|
247
247
|
export { DEV_HEADER, TEXT_LIMIT, createRecorder, cutText, cutValue, decodeServerRecord, describeError, encodeServerRecord, readCall };
|
|
248
248
|
|
|
249
|
-
//# sourceMappingURL=devtools-calls-
|
|
249
|
+
//# sourceMappingURL=devtools-calls-DCjuSkim.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools-calls-DGW6nLZ2.js","names":[],"sources":["../src/runtime/devtools-calls.ts"],"sourcesContent":["// The record of a server function call for the dock, in development only.\n//\n// The dev server runs each call inside a collector: it gathers the `console.*` output of the call,\n// the server functions it called, the error with its stack, and sends them back in the\n// `x-brumate-dev` header of the answer. The browser decodes the arguments and the result itself and\n// joins both into a `CallRecord`. Nothing here is imported by a production build: the dev server\n// and the devtools load it. No cookies and no headers are recorded, and values are cut at a length.\n\nimport type { CallRecord, DevAnswer, ServerRecord } from './devtools.ts';\n\nexport type { CallRecord, DevAnswer, ServerRecord } from './devtools.ts';\n\n/** The header that the dev server answers with. A production server never sets it. */\nexport const DEV_HEADER = 'x-brumate-dev';\n\n/** The longest text of a value, a log line or a stack, in characters. */\nexport const TEXT_LIMIT = 1000;\nconst STACK_LIMIT = 2000;\nconst ITEM_LIMIT = 50;\nconst DEPTH_LIMIT = 5;\n/** The longest header, once encoded. Servers refuse headers of about 8 kB and more. */\nconst HEADER_LIMIT = 6000;\n\n/** The hook of `dedupe` in the server core, under a symbol of the registry. */\nconst CALL_HOOK = Symbol.for('brumate.callHook');\nconst LOG_SINK = Symbol.for('brumate.devLogSink');\nconst LEVELS = ['log', 'info', 'warn', 'error', 'debug'] as const;\n\n/** Cuts a text at a length, and marks the cut. */\nexport function cutText(text: string, limit: number = TEXT_LIMIT): string {\n return text.length > limit ? `${text.slice(0, limit)}… (${text.length - limit} more)` : text;\n}\n\n/**\n * A copy of a value that is safe to keep and show: text cut, at most 50 items in a list or an\n * object, 5 levels deep, no cycles. Functions, symbols, files and errors become text.\n */\nexport function cutValue(\n value: unknown,\n depth: number = 0,\n seen: Set<object> = new Set<object>(),\n): unknown {\n switch (typeof value) {\n case 'string':\n return cutText(value);\n case 'bigint':\n return `${value}n`;\n case 'symbol':\n return value.toString();\n case 'function':\n return `[Function ${value.name || 'anonymous'}]`;\n case 'object':\n break;\n default:\n return value;\n }\n if (value === null || value instanceof Date) {\n return value;\n }\n if (value instanceof Error) {\n return cutText(`[${value.name}: ${value.message}]`);\n }\n if (typeof Blob !== 'undefined' && value instanceof Blob) {\n const name = (value as Partial<File>).name;\n return `[${name === undefined ? 'Blob' : `File ${name}`}, ${value.size} bytes, ${value.type}]`;\n }\n if (seen.has(value)) {\n return '[Circular]';\n }\n if (depth >= DEPTH_LIMIT) {\n return Array.isArray(value) ? '[Array]' : '[Object]';\n }\n seen.add(value);\n let result: unknown;\n if (Array.isArray(value) || value instanceof Set) {\n const items: unknown[] = [];\n for (const item of value) {\n if (items.length === ITEM_LIMIT) {\n items.push(`… ${(Array.isArray(value) ? value.length : value.size) - ITEM_LIMIT} more`);\n break;\n }\n items.push(cutValue(item, depth + 1, seen));\n }\n result = value instanceof Set ? new Set(items) : items;\n } else if (value instanceof Map) {\n const entries: [unknown, unknown][] = [];\n for (const [key, item] of value) {\n if (entries.length === ITEM_LIMIT) {\n break;\n }\n entries.push([cutValue(key, depth + 1, seen), cutValue(item, depth + 1, seen)]);\n }\n result = new Map(entries);\n } else if (typeof FormData !== 'undefined' && value instanceof FormData) {\n result = cutValue(Object.fromEntries(value), depth, seen);\n } else {\n const copy: Record<string, unknown> = {};\n let count = 0;\n for (const key of Object.keys(value)) {\n if (count === ITEM_LIMIT) {\n copy['…'] = `${Object.keys(value).length - ITEM_LIMIT} more`;\n break;\n }\n copy[key] = cutValue((value as Record<string, unknown>)[key], depth + 1, seen);\n count++;\n }\n result = copy;\n }\n seen.delete(value);\n return result;\n}\n\n/** What went wrong in a call, with a stack that is cut. */\nexport function describeError(error: unknown): { message: string; stack?: string } {\n if (error instanceof Error) {\n return {\n message: cutText(error.message),\n ...(error.stack ? { stack: cutText(error.stack, STACK_LIMIT) } : {}),\n };\n }\n return { message: cutText(String(error)) };\n}\n\n/** Writes the server part of a record for the header. It shrinks the record to fit. */\nexport function encodeServerRecord(record: DevAnswer): string {\n const copy: DevAnswer = {\n ...record,\n logs: [...record.logs],\n ...(record.error ? { error: { ...record.error } } : {}),\n };\n let text = encodeURIComponent(JSON.stringify(copy));\n while (text.length > HEADER_LIMIT && copy.logs.length > 0) {\n copy.logs.length = Math.floor(copy.logs.length / 2);\n copy.truncated = true;\n text = encodeURIComponent(JSON.stringify(copy));\n }\n if (text.length > HEADER_LIMIT && copy.error?.stack) {\n delete copy.error.stack;\n text = encodeURIComponent(JSON.stringify(copy));\n }\n if (text.length > HEADER_LIMIT) {\n copy.calls = [];\n copy.reads = [];\n text = encodeURIComponent(JSON.stringify(copy));\n }\n // A long message is cut until the header fits.\n let limit = TEXT_LIMIT;\n while (text.length > HEADER_LIMIT && copy.error && limit > 20) {\n limit = Math.floor(limit / 2);\n copy.error.message = cutText(copy.error.message, limit);\n text = encodeURIComponent(JSON.stringify(copy));\n }\n return text;\n}\n\n/** Reads the header of the dev server, or undefined when the answer has none. */\nexport function decodeServerRecord(header: string | null): DevAnswer | undefined {\n if (!header) {\n return undefined;\n }\n try {\n return JSON.parse(decodeURIComponent(header)) as DevAnswer;\n } catch {\n return undefined;\n }\n}\n\n// The dev server.\n\n/** The part of `AsyncLocalStorage` that the collector needs, so this module imports no Node module. */\ninterface Storage {\n run<R>(store: Collector, callback: () => R): R;\n getStore(): Collector | undefined;\n}\n\ninterface Collector {\n top?: string;\n calls: string[];\n logs: { level: string; text: string }[];\n error?: { message: string; stack?: string };\n}\n\ntype Hook = (id: string, run: () => unknown) => unknown;\ntype Globals = { [CALL_HOOK]?: Hook; [LOG_SINK]?: (level: string, args: unknown[]) => void };\n\n/**\n * Sets up the recording of calls on the dev server. `storage` is an `AsyncLocalStorage`, and\n * `format` is `util.format`. Returns what wraps the handling of one call: it runs the handler,\n * and adds the header to the answer. `console.*` is patched once for the process.\n */\nexport function createRecorder(\n storage: Storage,\n format: (...args: unknown[]) => string,\n): (run: () => Promise<Response>) => Promise<Response> {\n const globals = globalThis as Globals;\n // The server core calls this around every server function that is not part of a page render.\n globals[CALL_HOOK] = (id, run) => {\n const collector = storage.getStore();\n if (!collector) {\n return run();\n }\n if (collector.top !== undefined) {\n if (collector.calls.length < ITEM_LIMIT) {\n collector.calls.push(id);\n }\n return run();\n }\n // The first call is the one the browser made. Its error is recorded, and passes on.\n collector.top = id;\n let result: unknown;\n try {\n result = run();\n } catch (error) {\n collector.error = describeError(error);\n throw error;\n }\n if (result && typeof (result as PromiseLike<unknown>).then === 'function') {\n (result as Promise<unknown>).catch((error: unknown) => {\n collector.error = describeError(error);\n });\n }\n return result;\n };\n const wasPatched = globals[LOG_SINK] !== undefined;\n globals[LOG_SINK] = (level, args) => {\n const collector = storage.getStore();\n if (collector && collector.logs.length < ITEM_LIMIT) {\n collector.logs.push({ level, text: cutText(format(...args)) });\n }\n };\n if (!wasPatched) {\n for (const level of LEVELS) {\n const original = console[level].bind(console);\n console[level] = (...args: unknown[]) => {\n (globalThis as Globals)[LOG_SINK]?.(level, args);\n original(...args);\n };\n }\n }\n return async (run) => {\n const collector: Collector = { calls: [], logs: [] };\n const answer = await storage.run(collector, run);\n // A redirect is not an error.\n const redirected = answer.headers.has('x-brumate-redirect');\n const refreshed = answer.headers.get('x-brumate-refresh');\n const record: DevAnswer = {\n reads: refreshed ? refreshed.split(',') : [],\n calls: collector.calls,\n logs: collector.logs,\n };\n if (collector.error && !redirected) {\n record.error = collector.error;\n }\n answer.headers.set(DEV_HEADER, encodeServerRecord(record));\n return answer;\n };\n}\n\n// The browser.\n\n/** What the browser knows of a call when its answer arrives. */\nexport interface CallInput {\n name: string;\n /** The `init` of the `fetch`: its body holds the arguments. */\n init?: RequestInit;\n response: Response;\n /** When `fetch` was called, by `performance.now()`. */\n started: number;\n /** When the headers arrived. */\n arrived: number;\n /** How long the page took to get to the call, such as to load the code and write the arguments. */\n module: number;\n}\n\n/**\n * Makes the record of a call: decodes its arguments and its result, and joins them with the part\n * that the dev server sent. `response` must be a clone, since this reads its body.\n */\nexport async function readCall(input: CallInput): Promise<CallRecord> {\n const { name, init, response, started, arrived } = input;\n const { error, ...server }: Partial<DevAnswer> =\n decodeServerRecord(response.headers.get(DEV_HEADER)) ?? {};\n const took = /brumate;dur=([\\d.]+)/.exec(response.headers.get('server-timing') ?? '');\n const serverTime = took ? Number(took[1]) : 0;\n const record: CallRecord = {\n name,\n args: [],\n timing: {\n module: Math.round(input.module),\n network: Math.max(0, Math.round(arrived - started - serverTime)),\n server: Math.round(serverTime),\n decode: 0,\n },\n ...(server.logs ? { server: server as ServerRecord } : {}),\n ...(error ? { error } : {}),\n };\n const [{ fromJSON }, { callPlugins, serialOptions }, { fromChunkStream }] = await Promise.all([\n import('seroval/read'),\n import('./serial.ts'),\n import('./stream-read.ts'),\n ]);\n // The arguments: seroval JSON, or form data that holds it, or the fields of a form.\n try {\n const body = init?.body;\n if (typeof body === 'string') {\n const args = fromJSON(JSON.parse(body), {\n plugins: callPlugins(),\n ...serialOptions(),\n }) as unknown[];\n record.args = cutValue(args) as unknown[];\n } else if (body instanceof FormData) {\n if (body.has('args')) {\n const args = fromJSON(JSON.parse(String(body.get('args'))), {\n plugins: callPlugins(undefined, body),\n ...serialOptions(),\n }) as unknown[];\n record.args = cutValue(args) as unknown[];\n } else {\n record.args = [cutValue(body)];\n }\n }\n } catch {\n // The arguments cannot be read, such as ones of a plugin that is not loaded: none are shown.\n }\n // The result, or the message of the error that the server answered with.\n const decoding = performance.now();\n try {\n if (response.ok && !response.headers.has('x-brumate-redirect') && response.body) {\n record.result = cutValue(await fromChunkStream(response.body));\n } else if (!response.ok) {\n const text = await response.text();\n let message = text;\n try {\n message = (JSON.parse(text) as { error: string }).error;\n } catch {\n // The body is not the error of a server function.\n }\n record.error ??= { message: cutText(message) };\n }\n } catch (failure) {\n record.error ??= {\n message: cutText(failure instanceof Error ? failure.message : String(failure)),\n };\n }\n record.timing.decode = Math.round(performance.now() - decoding);\n return record;\n}\n"],"mappings":";;AAaA,MAAa,aAAa;;AAG1B,MAAa,aAAa;AAC1B,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,cAAc;;AAEpB,MAAM,eAAe;;AAGrB,MAAM,YAAY,OAAO,IAAI,kBAAkB;AAC/C,MAAM,WAAW,OAAO,IAAI,oBAAoB;AAChD,MAAM,SAAS;CAAC;CAAO;CAAQ;CAAQ;CAAS;A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AAQ,OAAO,EAAE;EAC/C;CACF,SAAS,SAAS;EAChB,OAAO,UAAU,EACf,SAAS,QAAQ,mBAAmB,QAAQ,QAAQ,UAAU,OAAO,OAAO,CAAC,EAC/E;CACF;CACA,OAAO,OAAO,SAAS,KAAK,MAAM,YAAY,IAAI,IAAI,QAAQ;CAC9D,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"devtools-calls-DCjuSkim.js","names":[],"sources":["../src/runtime/devtools-calls.ts"],"sourcesContent":["// The record of a server function call for the dock, in development only.\n//\n// The dev server runs each call inside a collector: it gathers the `console.*` output of the call,\n// the server functions it called, the error with its stack, and sends them back in the\n// `x-brumate-dev` header of the answer. The browser decodes the arguments and the result itself and\n// joins both into a `CallRecord`. Nothing here is imported by a production build: the dev server\n// and the devtools load it. No cookies and no headers are recorded, and values are cut at a length.\n\nimport type { CallRecord, DevAnswer, ServerRecord } from './devtools.ts';\n\nexport type { CallRecord, DevAnswer, ServerRecord } from './devtools.ts';\n\n/** The header that the dev server answers with. A production server never sets it. */\nexport const DEV_HEADER = 'x-brumate-dev';\n\n/** The longest text of a value, a log line or a stack, in characters. */\nexport const TEXT_LIMIT = 1000;\nconst STACK_LIMIT = 2000;\nconst ITEM_LIMIT = 50;\nconst DEPTH_LIMIT = 5;\n/** The longest header, once encoded. Servers refuse headers of about 8 kB and more. */\nconst HEADER_LIMIT = 6000;\n\n/** The hook of `dedupe` in the server core, under a symbol of the registry. */\nconst CALL_HOOK = Symbol.for('brumate.callHook');\nconst LOG_SINK = Symbol.for('brumate.devLogSink');\nconst LEVELS = ['log', 'info', 'warn', 'error', 'debug'] as const;\n\n/** Cuts a text at a length, and marks the cut. */\nexport function cutText(text: string, limit: number = TEXT_LIMIT): string {\n return text.length > limit ? `${text.slice(0, limit)}… (${text.length - limit} more)` : text;\n}\n\n/**\n * A copy of a value that is safe to keep and show: text cut, at most 50 items in a list or an\n * object, 5 levels deep, no cycles. Functions, symbols, files and errors become text.\n */\nexport function cutValue(\n value: unknown,\n depth: number = 0,\n seen: Set<object> = new Set<object>(),\n): unknown {\n switch (typeof value) {\n case 'string':\n return cutText(value);\n case 'bigint':\n return `${value}n`;\n case 'symbol':\n return value.toString();\n case 'function':\n return `[Function ${value.name || 'anonymous'}]`;\n case 'object':\n break;\n default:\n return value;\n }\n if (value === null || value instanceof Date) {\n return value;\n }\n if (value instanceof Error) {\n return cutText(`[${value.name}: ${value.message}]`);\n }\n if (typeof Blob !== 'undefined' && value instanceof Blob) {\n const name = (value as Partial<File>).name;\n return `[${name === undefined ? 'Blob' : `File ${name}`}, ${value.size} bytes, ${value.type}]`;\n }\n if (seen.has(value)) {\n return '[Circular]';\n }\n if (depth >= DEPTH_LIMIT) {\n return Array.isArray(value) ? '[Array]' : '[Object]';\n }\n seen.add(value);\n let result: unknown;\n if (Array.isArray(value) || value instanceof Set) {\n const items: unknown[] = [];\n for (const item of value) {\n if (items.length === ITEM_LIMIT) {\n items.push(`… ${(Array.isArray(value) ? value.length : value.size) - ITEM_LIMIT} more`);\n break;\n }\n items.push(cutValue(item, depth + 1, seen));\n }\n result = value instanceof Set ? new Set(items) : items;\n } else if (value instanceof Map) {\n const entries: [unknown, unknown][] = [];\n for (const [key, item] of value) {\n if (entries.length === ITEM_LIMIT) {\n break;\n }\n entries.push([cutValue(key, depth + 1, seen), cutValue(item, depth + 1, seen)]);\n }\n result = new Map(entries);\n } else if (typeof FormData !== 'undefined' && value instanceof FormData) {\n result = cutValue(Object.fromEntries(value), depth, seen);\n } else {\n const copy: Record<string, unknown> = {};\n let count = 0;\n for (const key of Object.keys(value)) {\n if (count === ITEM_LIMIT) {\n copy['…'] = `${Object.keys(value).length - ITEM_LIMIT} more`;\n break;\n }\n copy[key] = cutValue((value as Record<string, unknown>)[key], depth + 1, seen);\n count++;\n }\n result = copy;\n }\n seen.delete(value);\n return result;\n}\n\n/** What went wrong in a call, with a stack that is cut. */\nexport function describeError(error: unknown): { message: string; stack?: string } {\n if (error instanceof Error) {\n return {\n message: cutText(error.message),\n ...(error.stack ? { stack: cutText(error.stack, STACK_LIMIT) } : {}),\n };\n }\n return { message: cutText(String(error)) };\n}\n\n/** Writes the server part of a record for the header. It shrinks the record to fit. */\nexport function encodeServerRecord(record: DevAnswer): string {\n const copy: DevAnswer = {\n ...record,\n logs: [...record.logs],\n ...(record.error ? { error: { ...record.error } } : {}),\n };\n let text = encodeURIComponent(JSON.stringify(copy));\n while (text.length > HEADER_LIMIT && copy.logs.length > 0) {\n copy.logs.length = Math.floor(copy.logs.length / 2);\n copy.truncated = true;\n text = encodeURIComponent(JSON.stringify(copy));\n }\n if (text.length > HEADER_LIMIT && copy.error?.stack) {\n delete copy.error.stack;\n text = encodeURIComponent(JSON.stringify(copy));\n }\n if (text.length > HEADER_LIMIT) {\n copy.calls = [];\n copy.reads = [];\n text = encodeURIComponent(JSON.stringify(copy));\n }\n // A long message is cut until the header fits.\n let limit = TEXT_LIMIT;\n while (text.length > HEADER_LIMIT && copy.error && limit > 20) {\n limit = Math.floor(limit / 2);\n copy.error.message = cutText(copy.error.message, limit);\n text = encodeURIComponent(JSON.stringify(copy));\n }\n return text;\n}\n\n/** Reads the header of the dev server, or undefined when the answer has none. */\nexport function decodeServerRecord(header: string | null): DevAnswer | undefined {\n if (!header) {\n return undefined;\n }\n try {\n return JSON.parse(decodeURIComponent(header)) as DevAnswer;\n } catch {\n return undefined;\n }\n}\n\n// The dev server.\n\n/** The part of `AsyncLocalStorage` that the collector needs, so this module imports no Node module. */\ninterface Storage {\n run<R>(store: Collector, callback: () => R): R;\n getStore(): Collector | undefined;\n}\n\ninterface Collector {\n top?: string;\n calls: string[];\n logs: { level: string; text: string }[];\n error?: { message: string; stack?: string };\n}\n\ntype Hook = (id: string, run: () => unknown) => unknown;\ntype Globals = { [CALL_HOOK]?: Hook; [LOG_SINK]?: (level: string, args: unknown[]) => void };\n\n/**\n * Sets up the recording of calls on the dev server. `storage` is an `AsyncLocalStorage`, and\n * `format` is `util.format`. Returns what wraps the handling of one call: it runs the handler,\n * and adds the header to the answer. `console.*` is patched once for the process.\n */\nexport function createRecorder(\n storage: Storage,\n format: (...args: unknown[]) => string,\n): (run: () => Promise<Response>) => Promise<Response> {\n const globals = globalThis as Globals;\n // The server core calls this around every server function that is not part of a page render.\n globals[CALL_HOOK] = (id, run) => {\n const collector = storage.getStore();\n if (!collector) {\n return run();\n }\n if (collector.top !== undefined) {\n if (collector.calls.length < ITEM_LIMIT) {\n collector.calls.push(id);\n }\n return run();\n }\n // The first call is the one the browser made. Its error is recorded, and passes on.\n collector.top = id;\n let result: unknown;\n try {\n result = run();\n } catch (error) {\n collector.error = describeError(error);\n throw error;\n }\n if (result && typeof (result as PromiseLike<unknown>).then === 'function') {\n (result as Promise<unknown>).catch((error: unknown) => {\n collector.error = describeError(error);\n });\n }\n return result;\n };\n const wasPatched = globals[LOG_SINK] !== undefined;\n globals[LOG_SINK] = (level, args) => {\n const collector = storage.getStore();\n if (collector && collector.logs.length < ITEM_LIMIT) {\n collector.logs.push({ level, text: cutText(format(...args)) });\n }\n };\n if (!wasPatched) {\n for (const level of LEVELS) {\n const original = console[level].bind(console);\n console[level] = (...args: unknown[]) => {\n (globalThis as Globals)[LOG_SINK]?.(level, args);\n original(...args);\n };\n }\n }\n return async (run) => {\n const collector: Collector = { calls: [], logs: [] };\n const answer = await storage.run(collector, run);\n // A redirect is not an error.\n const redirected = answer.headers.has('x-brumate-redirect');\n const refreshed = answer.headers.get('x-brumate-refresh');\n const record: DevAnswer = {\n reads: refreshed ? refreshed.split(',') : [],\n calls: collector.calls,\n logs: collector.logs,\n };\n if (collector.error && !redirected) {\n record.error = collector.error;\n }\n answer.headers.set(DEV_HEADER, encodeServerRecord(record));\n return answer;\n };\n}\n\n// The browser.\n\n/** What the browser knows of a call when its answer arrives. */\nexport interface CallInput {\n name: string;\n /** The `init` of the `fetch`: its body holds the arguments. */\n init?: RequestInit;\n response: Response;\n /** When `fetch` was called, by `performance.now()`. */\n started: number;\n /** When the headers arrived. */\n arrived: number;\n /** How long the page took to get to the call, such as to load the code and write the arguments. */\n module: number;\n}\n\n/**\n * Makes the record of a call: decodes its arguments and its result, and joins them with the part\n * that the dev server sent. `response` must be a clone, since this reads its body.\n */\nexport async function readCall(input: CallInput): Promise<CallRecord> {\n const { name, init, response, started, arrived } = input;\n const { error, ...server }: Partial<DevAnswer> =\n decodeServerRecord(response.headers.get(DEV_HEADER)) ?? {};\n const took = /brumate;dur=([\\d.]+)/.exec(response.headers.get('server-timing') ?? '');\n const serverTime = took ? Number(took[1]) : 0;\n const record: CallRecord = {\n name,\n args: [],\n timing: {\n module: Math.round(input.module),\n network: Math.max(0, Math.round(arrived - started - serverTime)),\n server: Math.round(serverTime),\n decode: 0,\n },\n ...(server.logs ? { server: server as ServerRecord } : {}),\n ...(error ? { error } : {}),\n };\n const [{ fromJSON }, { callPlugins, serialOptions }, { fromChunkStream }] = await Promise.all([\n import('seroval/read'),\n import('./serial.ts'),\n import('./stream-read.ts'),\n ]);\n // The arguments: seroval JSON, or form data that holds it, or the fields of a form.\n try {\n const body = init?.body;\n if (typeof body === 'string') {\n const args = fromJSON(JSON.parse(body), {\n plugins: callPlugins(),\n ...serialOptions(),\n }) as unknown[];\n record.args = cutValue(args) as unknown[];\n } else if (body instanceof FormData) {\n if (body.has('args')) {\n const args = fromJSON(JSON.parse(String(body.get('args'))), {\n plugins: callPlugins(undefined, body),\n ...serialOptions(),\n }) as unknown[];\n record.args = cutValue(args) as unknown[];\n } else {\n record.args = [cutValue(body)];\n }\n }\n } catch {\n // The arguments cannot be read, such as ones of a plugin that is not loaded: none are shown.\n }\n // The result, or the message of the error that the server answered with.\n const decoding = performance.now();\n try {\n if (response.ok && !response.headers.has('x-brumate-redirect') && response.body) {\n record.result = cutValue(await fromChunkStream(response.body));\n } else if (!response.ok) {\n const text = await response.text();\n let message = text;\n try {\n message = (JSON.parse(text) as { error: string }).error;\n } catch {\n // The body is not the error of a server function.\n }\n record.error ??= { message: cutText(message) };\n }\n } catch (failure) {\n record.error ??= {\n message: cutText(failure instanceof Error ? failure.message : String(failure)),\n };\n }\n record.timing.decode = Math.round(performance.now() - decoding);\n return record;\n}\n"],"mappings":";;AAaA,MAAa,aAAa;;AAG1B,MAAa,aAAa;AAC1B,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,cAAc;;AAEpB,MAAM,eAAe;;AAGrB,MAAM,YAAY,OAAO,IAAI,kBAAkB;AAC/C,MAAM,WAAW,OAAO,IAAI,oBAAoB;AAChD,MAAM,SAAS;CAAC;CAAO;CAAQ;CAAQ;CAAS;AAAO;;AAGvD,SAAgB,QAAQ,MAAc,QAAgB,YAAoB;CACxE,OAAO,KAAK,SAAS,QAAQ,GAAG,KAAK,MAAM,GAAG,KAAK,EAAE,KAAK,KAAK,SAAS,MAAM,UAAU;AAC1F;;;;;AAMA,SAAgB,SACd,OACA,QAAgB,GAChB,uBAAoB,IAAI,IAAY,GAC3B;CACT,QAAQ,OAAO,OAAf;EACE,KAAK,UACH,OAAO,QAAQ,KAAK;EACtB,KAAK,UACH,OAAO,GAAG,MAAM;EAClB,KAAK,UACH,OAAO,MAAM,SAAS;EACxB,KAAK,YACH,OAAO,aAAa,MAAM,QAAQ,YAAY;EAChD,KAAK,UACH;EACF,SACE,OAAO;CACX;CACA,IAAI,UAAU,QAAQ,iBAAiB,MACrC,OAAO;CAET,IAAI,iBAAiB,OACnB,OAAO,QAAQ,IAAI,MAAM,KAAK,IAAI,MAAM,QAAQ,EAAE;CAEpD,IAAI,OAAO,SAAS,eAAe,iBAAiB,MAAM;EACxD,MAAM,OAAQ,MAAwB;EACtC,OAAO,IAAI,SAAS,KAAA,IAAY,SAAS,QAAQ,OAAO,IAAI,MAAM,KAAK,UAAU,MAAM,KAAK;CAC9F;CACA,IAAI,KAAK,IAAI,KAAK,GAChB,OAAO;CAET,IAAI,SAAS,aACX,OAAO,MAAM,QAAQ,KAAK,IAAI,YAAY;CAE5C,KAAK,IAAI,KAAK;CACd,IAAI;CACJ,IAAI,MAAM,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AAM,WAAW,YAAY,IAAI;CACjC,IAAI;EACF,IAAI,SAAS,MAAM,CAAC,SAAS,QAAQ,IAAI,oBAAoB,KAAK,SAAS,MACzE,OAAO,SAAS,SAAS,MAAM,gBAAgB,SAAS,IAAI,CAAC;OACxD,IAAI,CAAC,SAAS,IAAI;GACvB,MAAM,OAAO,MAAM,SAAS,KAAK;GACjC,IAAI,UAAU;GACd,IAAI;IACF,UAAW,KAAK,MAAM,IAAI,CAAC,CAAuB;GACpD,QAAQ,CAER;GACA,OAAO,UAAU,EAAE,SAAS,QAAQ,OAAO,EAAE;EAC/C;CACF,SAAS,SAAS;EAChB,OAAO,UAAU,EACf,SAAS,QAAQ,mBAAmB,QAAQ,QAAQ,UAAU,OAAO,OAAO,CAAC,EAC/E;CACF;CACA,OAAO,OAAO,SAAS,KAAK,MAAM,YAAY,IAAI,IAAI,QAAQ;CAC9D,OAAO;AACT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as trustedHTML } from "./trusted-
|
|
2
|
-
import { a as preview, t as findRootScope } from "./devtools-
|
|
1
|
+
import { t as trustedHTML } from "./trusted-Bmwg4_hf.js";
|
|
2
|
+
import { a as preview, t as findRootScope } from "./devtools-tuq7ATGN.js";
|
|
3
3
|
import { t as LOGO } from "./logo-DQ_OYhBi.js";
|
|
4
4
|
//#region src/runtime/devtools-panel/dom.ts
|
|
5
5
|
function element(tag, attributes = {}, ...children) {
|
|
@@ -2530,7 +2530,7 @@ async function drawErrors(ctx, into) {
|
|
|
2530
2530
|
box.classList.add("issues");
|
|
2531
2531
|
let found;
|
|
2532
2532
|
try {
|
|
2533
|
-
found = await (catalog ??= import("./error-catalog-
|
|
2533
|
+
found = await (catalog ??= import("./error-catalog-CbmQqfat.js"));
|
|
2534
2534
|
} catch {
|
|
2535
2535
|
catalog = void 0;
|
|
2536
2536
|
}
|
|
@@ -3975,4 +3975,4 @@ function togglePanel(root, state, initial) {
|
|
|
3975
3975
|
//#endregion
|
|
3976
3976
|
export { layoutGraph, openPanel, togglePanel };
|
|
3977
3977
|
|
|
3978
|
-
//# sourceMappingURL=devtools-panel-
|
|
3978
|
+
//# sourceMappingURL=devtools-panel-DLeWTPhU.js.map
|