brumate 0.8.0 → 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.
Files changed (122) hide show
  1. package/dist/{boot-BkUdiYOF.d.ts → boot-ej-9NRT3.d.ts} +20 -2
  2. package/dist/cli.js +88 -82
  3. package/dist/cli.js.map +1 -1
  4. package/dist/{client-B0FXW5Kw.js → client-B-ww-PQ7.js} +402 -63
  5. package/dist/client-B-ww-PQ7.js.map +1 -0
  6. package/dist/{client-Cq6aTiDs.d.ts → client-Do6IBIhI.d.ts} +58 -14
  7. package/dist/{defer-BMIMP4Hq.js → defer-JD2FK9mV.js} +5 -3
  8. package/dist/defer-JD2FK9mV.js.map +1 -0
  9. package/dist/{devtools-calls-DGW6nLZ2.js → devtools-calls-DCjuSkim.js} +3 -3
  10. package/dist/{devtools-calls-DGW6nLZ2.js.map → devtools-calls-DCjuSkim.js.map} +1 -1
  11. package/dist/{devtools-panel-B1nF1KB7.js → devtools-panel-DLeWTPhU.js} +4 -4
  12. package/dist/{devtools-panel-B1nF1KB7.js.map → devtools-panel-DLeWTPhU.js.map} +1 -1
  13. package/dist/{devtools-B4prrxht.js → devtools-tuq7ATGN.js} +10 -7
  14. package/dist/devtools-tuq7ATGN.js.map +1 -0
  15. package/dist/{error-catalog-DakxjSgj.js → error-catalog-BBWB7w-E.js} +11 -4
  16. package/dist/error-catalog-BBWB7w-E.js.map +1 -0
  17. package/dist/{error-catalog-VxLbz-6p.js → error-catalog-CbmQqfat.js} +1 -1
  18. package/dist/{events-LgLdp1R7.js → events-BDVITj3P.js} +3 -5
  19. package/dist/events-BDVITj3P.js.map +1 -0
  20. package/dist/{features-DwMYKBIC.js → features-Cte5aj20.js} +8 -2
  21. package/dist/features-Cte5aj20.js.map +1 -0
  22. package/dist/{files-D5GtxwEQ.js → files-Bz0lAQzD.js} +2 -2
  23. package/dist/{files-D5GtxwEQ.js.map → files-Bz0lAQzD.js.map} +1 -1
  24. package/dist/{html-Cf5uKhLs.js → html-BYuHDvxy.js} +10 -3
  25. package/dist/html-BYuHDvxy.js.map +1 -0
  26. package/dist/index.d.ts +71 -19
  27. package/dist/index.js +3 -3
  28. package/dist/{inspect-CGl5Y8q6.js → inspect-fpaBJ5pm.js} +1305 -75
  29. package/dist/inspect-fpaBJ5pm.js.map +1 -0
  30. package/dist/{loader-BsaSuIoG.js → loader-DMxuZ6He.js} +14 -6
  31. package/dist/loader-DMxuZ6He.js.map +1 -0
  32. package/dist/{navigate-BlowKvhB.js → navigate-C5PjwYMh.js} +108 -20
  33. package/dist/navigate-C5PjwYMh.js.map +1 -0
  34. package/dist/{produce-CLABZ8k2.d.ts → produce-BDkCsGH7.d.ts} +3 -3
  35. package/dist/{rpc-C1jYVNAe.js → rpc-DOdrekhP.js} +23 -13
  36. package/dist/rpc-DOdrekhP.js.map +1 -0
  37. package/dist/runtime/bundles.d.ts +3 -2
  38. package/dist/runtime/bundles.js +20 -5
  39. package/dist/runtime/bundles.js.map +1 -1
  40. package/dist/runtime/client.d.ts +4 -3
  41. package/dist/runtime/client.js +5 -5
  42. package/dist/runtime/devtools.d.ts +3 -1
  43. package/dist/runtime/devtools.js +1 -1
  44. package/dist/runtime/events.js +1 -1
  45. package/dist/runtime/hot.d.ts +1 -1
  46. package/dist/runtime/html.js +1 -1
  47. package/dist/runtime/loader.d.ts +2 -2
  48. package/dist/runtime/loader.js +2 -2
  49. package/dist/runtime/otel.d.ts +18 -0
  50. package/dist/runtime/otel.js +127 -0
  51. package/dist/runtime/otel.js.map +1 -0
  52. package/dist/runtime/server.d.ts +4 -3
  53. package/dist/runtime/server.js +5 -5
  54. package/dist/runtime/signals.d.ts +2 -2
  55. package/dist/runtime/signals.js +4 -1
  56. package/dist/runtime/signals.js.map +1 -1
  57. package/dist/runtime/static-loader.d.ts +2 -2
  58. package/dist/runtime/static-loader.js +1 -1
  59. package/dist/runtime/store.d.ts +2 -2
  60. package/dist/runtime/store.js +1 -1
  61. package/dist/runtime/testing.d.ts +2 -2
  62. package/dist/runtime/testing.js +2 -2
  63. package/dist/search-params-qGERTLi3.js +382 -0
  64. package/dist/search-params-qGERTLi3.js.map +1 -0
  65. package/dist/{serial-ribg9NAj.js → serial-B2AJ9VGx.js} +1 -1
  66. package/dist/{serial-ioa17MuY.js → serial-Cj6pDGOq.js} +6 -6
  67. package/dist/{serial-ioa17MuY.js.map → serial-Cj6pDGOq.js.map} +1 -1
  68. package/dist/{server-DesBZv5g.d.ts → server-2-LS_KFo.d.ts} +125 -9
  69. package/dist/{server-BUuf7XPZ.js → server-CRGZMWnK.js} +545 -236
  70. package/dist/server-CRGZMWnK.js.map +1 -0
  71. package/dist/{shared-CX_YacDm.js → shared-CUBWrbiM.js} +4 -4
  72. package/dist/{shared-CX_YacDm.js.map → shared-CUBWrbiM.js.map} +1 -1
  73. package/dist/sheets-B9Zr50mf.js +105 -0
  74. package/dist/sheets-B9Zr50mf.js.map +1 -0
  75. package/dist/{signals-7VVD9C_H.d.ts → signals-BgsJK-uT.d.ts} +16 -6
  76. package/dist/{static-loader-C_en-4v8.js → static-loader-BDBtWsdg.js} +107 -19
  77. package/dist/static-loader-BDBtWsdg.js.map +1 -0
  78. package/dist/{static-loader-UKnK11Em.d.ts → static-loader-CAFn6p0l.d.ts} +2 -2
  79. package/dist/{store-9_oa0HG1.d.ts → store-BwWg-Iei.d.ts} +79 -2
  80. package/dist/store-DNr24Z8L.js +950 -0
  81. package/dist/store-DNr24Z8L.js.map +1 -0
  82. package/dist/{stream-read-BTsYstJY.js → stream-read-CiLDH60b.js} +2 -2
  83. package/dist/{stream-read-BTsYstJY.js.map → stream-read-CiLDH60b.js.map} +1 -1
  84. package/dist/{stream-read-Dek3HnqO.js → stream-read-DVoregpA.js} +1 -1
  85. package/dist/trace-DT7RGRAV.d.ts +52 -0
  86. package/dist/trace-browser-C7MFMove.js +170 -0
  87. package/dist/trace-browser-C7MFMove.js.map +1 -0
  88. package/dist/trace-flag-Dy267snx.js +7 -0
  89. package/dist/trace-flag-Dy267snx.js.map +1 -0
  90. package/dist/{trusted-g_zUJbh2.js → trusted-Bmwg4_hf.js} +12 -5
  91. package/dist/trusted-Bmwg4_hf.js.map +1 -0
  92. package/dist/view-transitions-BpnVwtS4.js +141 -0
  93. package/dist/view-transitions-BpnVwtS4.js.map +1 -0
  94. package/dist/vite.d.ts +8 -1
  95. package/dist/vite.js +356 -46
  96. package/dist/vite.js.map +1 -1
  97. package/elements.d.ts +8 -0
  98. package/package.json +13 -1
  99. package/skills/brumate/SKILL.md +9 -5
  100. package/skills/brumate/references/errors.md +95 -14
  101. package/skills/brumate/references/events.md +27 -1
  102. package/skills/brumate/references/signals.md +4 -4
  103. package/skills/brumate/references/state.md +79 -4
  104. package/skills/brumate/references/syntax.md +58 -9
  105. package/dist/client-B0FXW5Kw.js.map +0 -1
  106. package/dist/defer-BMIMP4Hq.js.map +0 -1
  107. package/dist/devtools-B4prrxht.js.map +0 -1
  108. package/dist/error-catalog-DakxjSgj.js.map +0 -1
  109. package/dist/events-LgLdp1R7.js.map +0 -1
  110. package/dist/features-DwMYKBIC.js.map +0 -1
  111. package/dist/html-Cf5uKhLs.js.map +0 -1
  112. package/dist/inspect-CGl5Y8q6.js.map +0 -1
  113. package/dist/loader-BsaSuIoG.js.map +0 -1
  114. package/dist/navigate-BlowKvhB.js.map +0 -1
  115. package/dist/rpc-C1jYVNAe.js.map +0 -1
  116. package/dist/search-params-Wg-0FsMj.js +0 -148
  117. package/dist/search-params-Wg-0FsMj.js.map +0 -1
  118. package/dist/server-BUuf7XPZ.js.map +0 -1
  119. package/dist/static-loader-C_en-4v8.js.map +0 -1
  120. package/dist/store-Cy4EEyZ7.js +0 -439
  121. package/dist/store-Cy4EEyZ7.js.map +0 -1
  122. 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 { a as Store } from "./store-9_oa0HG1.js";
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 { M as SearchParamOptions } from "./signals-7VVD9C_H.js";
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 {
@@ -71,9 +84,9 @@ interface HiddenBody {
71
84
  //#region src/runtime/client/children.d.ts
72
85
  /**
73
86
  * A call of a `#template` of the file, which an insert can update in place. `render` is the
74
- * template's code, and `owner` the scope that holds the template. The call finds its contexts
75
- * where the template is written, as the output of a template does, so it does not render as
76
- * children of the owner.
87
+ * template's code, and `owner` the scope that holds the template. The call renders as children
88
+ * of its owner, where the component that gets it inserts it, so it reads the contexts there, as
89
+ * on the server.
77
90
  */
78
91
  declare function templateCall(ref: string, owner: Scope | undefined, render: (...args: unknown[]) => unknown, args: unknown[]): TemplateCall;
79
92
  /** Renders a value inserted in markup. Children render here, at `scope`, for their contexts. */
@@ -97,7 +110,7 @@ declare class TemplateCall extends Children {
97
110
  /** The scope of the component that wrote the template. */
98
111
  readonly owner: Scope | undefined;
99
112
  readonly args: unknown[];
100
- constructor(ref: string, owner: Scope | undefined, args: unknown[], html: (at?: Scope) => string, lexical?: boolean);
113
+ constructor(ref: string, owner: Scope | undefined, args: unknown[], html: (at?: Scope) => string);
101
114
  }
102
115
  /** The children of a component that the client renders. See `Children`. */
103
116
  declare function children(from: Scope | ScopeId | undefined, html: () => string | DocumentFragment): Children;
@@ -132,7 +145,10 @@ declare function memoNow(value: unknown): unknown;
132
145
  * of a memo until a read.
133
146
  */
134
147
  declare function renderMemo(compute: () => unknown): unknown;
135
- /** Reads a memo of a render: the error that a throw held is thrown at the read. */
148
+ /**
149
+ * Reads a memo of a render: the error that a throw held is thrown at the read. A memo that is
150
+ * still loading stops the code that reads it, which waits for the memo.
151
+ */
136
152
  declare function readMemo(value: unknown): unknown;
137
153
  declare function setSlots(id: ScopeId, values: unknown[]): void;
138
154
  declare function setItem(id: ScopeId, value: unknown): void;
@@ -178,6 +194,8 @@ interface Scope {
178
194
  /** The component ID, for a component's root scope. */
179
195
  m?: string;
180
196
  s: unknown[];
197
+ /** True once the scope is removed, so a wait that ends later computes nothing. */
198
+ gone?: boolean;
181
199
  /** The item of a list item scope. */
182
200
  i?: unknown;
183
201
  c?: Record<number, ScopeId>;
@@ -318,9 +336,10 @@ interface DevtoolsHooks {
318
336
  write?(scope: Scope, slot: number, value: unknown): void;
319
337
  /**
320
338
  * An effect or a `$client` callback, by its name in the update code, ran
321
- * 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.
322
341
  */
323
- 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;
324
343
  /** A client navigation changed the page: the routes that stayed, and those it replaced. */
325
344
  navigated?(report: NavigationReport): void;
326
345
  }
@@ -369,7 +388,7 @@ declare function spread(attributes: Record<string, unknown>, on?: string[], name
369
388
  */
370
389
  declare function handle(element: Element, entry: string, event?: Event, typed?: {
371
390
  value: unknown;
372
- }): Promise<unknown>;
391
+ }, trace?: EventTrace): Promise<unknown>;
373
392
  /** Renders the attributes of a form or button that posts to a server function. */
374
393
  declare function action(name: string, id: string, method?: string, result?: string): string;
375
394
  /**
@@ -460,6 +479,12 @@ declare function attempt(body: () => Out): DocumentFragment;
460
479
  * A scope that goes during the wait ends it with `leave`.
461
480
  */
462
481
  declare function fillSettled(id: ScopeId | Scope, values: unknown[], write: (...values: unknown[]) => void): void;
482
+ /**
483
+ * A write of cloned markup whose values come from code that can read a memo that is still
484
+ * loading, such as a block header or a prop that calls a function. The write waits for the memo,
485
+ * and runs again with its value. It counts in the boundary of the render, as `fillSettled` does.
486
+ */
487
+ declare function fillPend(id: ScopeId | Scope, write: () => void): void;
463
488
  /**
464
489
  * A value of markup that the browser writes, in text or an attribute, which can be a promise.
465
490
  * A value that is not one is written at once. A promise counts in the boundary of the render, as
@@ -543,6 +568,13 @@ declare function loading(body: () => Out, fallback?: () => Out): DocumentFragmen
543
568
  declare function guess<T>(scope: Scope, slot: number, ...rest: [value: T] | [sourceScope: Scope, sourceSlot: number, value: T]): T;
544
569
  /** Counts a server call, and puts guesses back when the last one finishes. */
545
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>;
546
578
  //#endregion
547
579
  //#region src/runtime/client/inserts.d.ts
548
580
  /**
@@ -629,8 +661,6 @@ declare function spreadProps(scope: Scope, anchor: number, value: Record<string,
629
661
  declare function prop(scope: Scope, anchor: number, name: string, value: unknown): void;
630
662
  //#endregion
631
663
  //#region src/runtime/client/scopes.d.ts
632
- /** Returns the instance of a scope by its ID. */
633
- declare function getScope(id: ScopeId): Scope | undefined;
634
664
  declare function descendants(scope: Scope, kind: number, result?: Scope[]): Scope[];
635
665
  /**
636
666
  * Removes a scope from the page: its cleanups run, and its memo state goes,
@@ -725,6 +755,13 @@ declare function setOn(element: Element, on: string[], own: string): void;
725
755
  /** Writes the content of an element of cloned markup, as `insert` writes it in HTML. */
726
756
  declare function setContent(element: Element, value: unknown, at?: ScopeId | Scope): void;
727
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
728
765
  //#region src/runtime/client/search.d.ts
729
766
  /** `$searchParam` in the browser: the parameter of the URL of the page. */
730
767
  declare function searchParam(name: string, options?: SearchParamOptions<unknown>): unknown;
@@ -779,6 +816,13 @@ declare function unreadMemo(scope: Scope | ScopeId, value: unknown): void;
779
816
  * keeps its value, and `pending` is true. Only the latest load is written.
780
817
  */
781
818
  declare function asyncMemo(scope: Scope, slot: number, promise: Promise<unknown>): number;
819
+ /**
820
+ * Computes a value of a render that can read a memo that is still loading, as an update does:
821
+ * the value is a promise that computes again once the memo settles, so what reads it waits.
822
+ * A second stop at the same wait is no wait for it, so it throws. A scope that goes, `owner`,
823
+ * computes nothing more. The scopes and the work that a stopped compute started are dropped.
824
+ */
825
+ declare function pend(compute: () => unknown, owner?: Scope | ScopeId, last?: PromiseLike<unknown>): unknown;
782
826
  /**
783
827
  * `$resolve(memo, { timeout, signal })`: resolves with the value of the memo once it is no longer
784
828
  * pending, also after a load that its inputs started. `isLoading` tells whether the memo or a
@@ -833,5 +877,5 @@ declare const loader: {
833
877
  updateRoute: typeof updateRoute;
834
878
  };
835
879
  //#endregion
836
- export { list as $, hooks as $t, nodes as A, leavePage as At, descendants as B, consumeContext as Bt, clone as C, offscreen as Cn, wait as Ct, keepText as D, NavigationReport as Dn, dispose as Dt, keep as E, retag as En, nameComment as Et, setOn as F, handle as Ft, sink as G, toStore as Gt, makeId as H, provideValue as Ht, setSpread as I, handlerProp as It, addHead as J, CoreOptions as Jt, prop as K, updateRoute as Kt, template as L, rpc as Lt, setAttr as M, remount as Mt, setAttrText as N, removeRoot as Nt, listNodes as O, forget as Ot, setContent as P, action as Pt, setVar as Q, build as Qt, afterInsert as R, spread as Rt, branchNodes as S, held as Sn, started as St, fillList as T, reset as Tn, loadModule as Tt, removeScope as U, setGlobal as Ut, getScope as V, consumeStore as Vt, setOwner as W, storeUpdate as Wt, addStyle as X, DevtoolsHooks as Xt, addPortal as Y, DEVTOOLS as Yt, deferInBrowser as Z, Scope as Zt, updated as _, insert as _n, fillSpread as _t, cells as a, componentNodes as an, content as at, searchParam as b, branch as bn, loading as bt, get as c, elementAt as cn, text as ct, pending as d, place as dn, track as dt, rpcPrefix as en, toList as et, resolve as f, readMemo as fn, after as ft, update as g, children as gn, fillSettled as gt, unreadMemo as h, setSlots as hn, fillAttrs as ht, bindings as i, component as in, attrs as it, putText as j, leaveRoutes as jt, markBlock as k, init as kt, isBound as l, foreignNodes as ln, writeText as lt, timed as m, setItem as mn, countLoads as mt, asyncMemo as n, skew as nn, windowStart as nt, effect as o, dynamic as on, portalTo as ot, set as p, renderMemo as pn, attempt as pt, spreadProps as q, ClientModule as qt, binding as r, Component as rn, attr as rt, gate as s, dynamicNodes as sn, restRef as st, loader as t, scopes as tn, windowList as tt, memo as u, memoNow as un, guess as ut, title as v, templateCall as vn, fillValue as vt, fillBranch as w, rekey as wn, fail as wt, appendText as x, fill as xn, reveal as xt, paramEffect as y, HiddenBody as yn, keepValue as yt, createScope as z, submitAction as zt };
837
- //# sourceMappingURL=client-Cq6aTiDs.d.ts.map
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 { bn as skew, gn as build } from "./client-B0FXW5Kw.js";
2
- import { n as trustedScript, t as trustedHTML } from "./trusted-g_zUJbh2.js";
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-BMIMP4Hq.js.map
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-ribg9NAj.js"),
213
- import("./stream-read-Dek3HnqO.js")
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-DGW6nLZ2.js.map
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;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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OAAO,CAAC,SAAS,IAAI,CAAC;EAEjC;CACF,QAAQ,CAER;CAEA,MAAM,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
+ {"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,IA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KlB,OAAO,OAAO,SAJD,SAAS,KAAK,MAAM,IAAI,GAAG;GACtC,SAAS,YAAY;GACrB,GAAG,cAAc;EACnB,CAC0B,CAAC;OACtB,IAAI,gBAAgB,UAAU;GACnC,IAAI,KAAK,IAAI,MAAM,GAKjB,OAAO,OAAO,SAJD,SAAS,KAAK,MAAM,OAAO,KAAK,IAAI,MAAM,CAAC,CAAC,GAAG;IAC1D,SAAS,YAAY,KAAA,GAAW,IAAI;IACpC,GAAG,cAAc;GACnB,CAC0B,CAAC;QAE3B,OAAO,OAAO,CAAC,SAAS,IAAI,CAAC;EAEjC;CACF,QAAQ,CAER;CAEA,MAAM,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-g_zUJbh2.js";
2
- import { a as preview, t as findRootScope } from "./devtools-B4prrxht.js";
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-VxLbz-6p.js"));
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-B1nF1KB7.js.map
3978
+ //# sourceMappingURL=devtools-panel-DLeWTPhU.js.map