brumate 0.2.0 → 0.3.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-D-IdPy7B.d.ts → boot-C25Sa6vq.d.ts} +5 -2
- package/dist/cli.js +2 -2
- package/dist/{client-C0UCNL3J.js → client-BD6XT-s5.js} +435 -110
- package/dist/client-BD6XT-s5.js.map +1 -0
- package/dist/{client-MD0ZmcFR.d.ts → client-D0CqSxoO.d.ts} +114 -8
- package/dist/{cookies-Av5WFmcf.js → cookies-BzllthiF.js} +2 -1
- package/dist/cookies-BzllthiF.js.map +1 -0
- package/dist/{defer-D0bo1Gqx.js → defer-BbD7JQhj.js} +6 -2
- package/dist/defer-BbD7JQhj.js.map +1 -0
- package/dist/devtools-CQgD7NPB.js +623 -0
- package/dist/devtools-CQgD7NPB.js.map +1 -0
- package/dist/devtools-panel-BVB-W5q4.js +1930 -0
- package/dist/devtools-panel-BVB-W5q4.js.map +1 -0
- package/dist/events-CSs7OwIC.js +85 -0
- package/dist/events-CSs7OwIC.js.map +1 -0
- package/dist/{files-Bnn1JqHx.js → files-BXSSrQgc.js} +18 -5
- package/dist/files-BXSSrQgc.js.map +1 -0
- package/dist/forms-Bg-CwGqX.js +406 -0
- package/dist/forms-Bg-CwGqX.js.map +1 -0
- package/dist/forms-Cl21hkHt.d.ts +281 -0
- package/dist/highlight.d.ts +17 -0
- package/dist/highlight.js +269 -0
- package/dist/highlight.js.map +1 -0
- package/dist/{html-y1q7-t7D.d.ts → html-Bq1rFxX_.d.ts} +36 -4
- package/dist/{html-bHZbkK-h.js → html-mNTKzaDD.js} +79 -8
- package/dist/html-mNTKzaDD.js.map +1 -0
- package/dist/index.d.ts +47 -2
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/{inspect-BJtACnQp.js → inspect-BHpOw1LF.js} +625 -48
- package/dist/inspect-BHpOw1LF.js.map +1 -0
- package/dist/{loader-B18i3_-T.js → loader-Dos_3NP0.js} +5 -4
- package/dist/loader-Dos_3NP0.js.map +1 -0
- package/dist/{navigate-BwuZveDF.js → navigate-O78d_zGN.js} +45 -2
- package/dist/navigate-O78d_zGN.js.map +1 -0
- package/dist/{produce-D4K7qpaL.d.ts → produce-D0V0ICkz.d.ts} +45 -3
- package/dist/{produce-CWfJ4byV.js → produce-Doc91GkX.js} +113 -6
- package/dist/produce-Doc91GkX.js.map +1 -0
- package/dist/{rpc-B-Zkn6Ch.js → rpc-ygMRPmN4.js} +20 -10
- package/dist/rpc-ygMRPmN4.js.map +1 -0
- package/dist/runtime/client.d.ts +4 -4
- package/dist/runtime/client.js +4 -4
- package/dist/runtime/devtools.d.ts +188 -3
- package/dist/runtime/devtools.js +1 -1
- package/dist/runtime/events.d.ts +15 -0
- package/dist/runtime/events.js +1 -1
- package/dist/runtime/forms.d.ts +2 -0
- package/dist/runtime/forms.js +1 -0
- package/dist/runtime/gather.d.ts +25 -0
- package/dist/runtime/gather.js +33 -0
- package/dist/runtime/gather.js.map +1 -0
- package/dist/runtime/hot.d.ts +1 -1
- package/dist/runtime/html.d.ts +2 -2
- 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/server.d.ts +5 -4
- package/dist/runtime/server.js +5 -5
- package/dist/runtime/signals.d.ts +38 -2
- package/dist/runtime/signals.js +12 -2
- 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/testing.d.ts +2 -2
- package/dist/runtime/testing.js +2 -2
- package/dist/runtime/values.d.ts +2 -0
- package/dist/runtime/values.js +24 -0
- package/dist/runtime/values.js.map +1 -0
- package/dist/{server-BqfM95r1.js → server-CxVDYE_V.js} +776 -121
- package/dist/server-CxVDYE_V.js.map +1 -0
- package/dist/{server-BA9SJ2Vm.d.ts → server-DuFYRXrd.d.ts} +284 -15
- package/dist/{static-loader-BzE9SRaj.d.ts → static-loader-Drpr0AzI.d.ts} +2 -2
- package/dist/{static-loader-DOygOFj5.js → static-loader-nZssh66R.js} +168 -51
- package/dist/static-loader-nZssh66R.js.map +1 -0
- package/dist/{stream-JaMHMdBD.js → stream-DCYZO4IF.js} +89 -10
- package/dist/stream-DCYZO4IF.js.map +1 -0
- package/dist/values-B8C7CLvG.d.ts +63 -0
- package/dist/vite.d.ts +8 -1
- package/dist/vite.js +170 -20
- package/dist/vite.js.map +1 -1
- package/forms/forms.brm.ts +141 -0
- package/package.json +31 -2
- package/dist/client-C0UCNL3J.js.map +0 -1
- package/dist/cookies-Av5WFmcf.js.map +0 -1
- package/dist/defer-D0bo1Gqx.js.map +0 -1
- package/dist/devtools-C50VH8gZ.js +0 -113
- package/dist/devtools-C50VH8gZ.js.map +0 -1
- package/dist/devtools-panel-AYjfwPhj.js +0 -435
- package/dist/devtools-panel-AYjfwPhj.js.map +0 -1
- package/dist/events-BKWRqtMg.js +0 -52
- package/dist/events-BKWRqtMg.js.map +0 -1
- package/dist/files-Bnn1JqHx.js.map +0 -1
- package/dist/html-bHZbkK-h.js.map +0 -1
- package/dist/inspect-BJtACnQp.js.map +0 -1
- package/dist/loader-B18i3_-T.js.map +0 -1
- package/dist/navigate-BwuZveDF.js.map +0 -1
- package/dist/produce-CWfJ4byV.js.map +0 -1
- package/dist/rpc-B-Zkn6Ch.js.map +0 -1
- package/dist/server-BqfM95r1.js.map +0 -1
- package/dist/static-loader-DOygOFj5.js.map +0 -1
- package/dist/stream-JaMHMdBD.js.map +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { t as Raw } from "./html-
|
|
2
|
-
import { a as
|
|
1
|
+
import { t as Raw } from "./html-Bq1rFxX_.js";
|
|
2
|
+
import { a as PackedState, c as ScopeState, n as Binding, o as PageState, r as ElementReference, s as ScopeId } from "./produce-D0V0ICkz.js";
|
|
3
3
|
import { t as Context$1 } from "./context-btHuB01Z.js";
|
|
4
4
|
import { t as StandardSchemaV1 } from "./standard-schema-BNY82yX3.js";
|
|
5
|
+
import { f as Intent, v as SubmissionResult } from "./forms-Cl21hkHt.js";
|
|
5
6
|
//#region src/runtime/cookies.d.ts
|
|
6
7
|
interface CookieOptions {
|
|
7
8
|
/** Seconds until the cookie expires. Without it, the cookie lasts until the browser closes. */
|
|
@@ -114,6 +115,15 @@ interface RequestEventOptions {
|
|
|
114
115
|
* a page render, or a call of middleware or an endpoint. Its methods read
|
|
115
116
|
* the request and change the response. Get it with `getEvent()`.
|
|
116
117
|
*/
|
|
118
|
+
/** A step of the render of a page, for the Server tab of the devtools. */
|
|
119
|
+
interface TraceEntry {
|
|
120
|
+
kind: "render" | "stream" | "memo" | "call" | "body";
|
|
121
|
+
label: string;
|
|
122
|
+
start: number;
|
|
123
|
+
/** Undefined while it runs. */
|
|
124
|
+
end?: number;
|
|
125
|
+
failed?: boolean;
|
|
126
|
+
}
|
|
117
127
|
declare class RequestEvent {
|
|
118
128
|
readonly request: Request;
|
|
119
129
|
/** What the request is for. */
|
|
@@ -140,6 +150,26 @@ declare class RequestEvent {
|
|
|
140
150
|
refreshed?: Set<unknown>;
|
|
141
151
|
/** Cookies that this request set, or deleted with undefined, so later reads see them. */
|
|
142
152
|
cookies?: Map<string, string | undefined>;
|
|
153
|
+
/**
|
|
154
|
+
* True once the request read its cookies or its `authorization` header, or
|
|
155
|
+
* set a cookie, such as for a session. The answer then depends on the user,
|
|
156
|
+
* so a page with `cache` is not cached for everyone.
|
|
157
|
+
*/
|
|
158
|
+
personal: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* In development, what the render of the page did and when, in
|
|
161
|
+
* milliseconds from its start, for the Server tab of the devtools.
|
|
162
|
+
*/
|
|
163
|
+
trace?: TraceEntry[];
|
|
164
|
+
/** When the trace started, by `performance.now()`. */
|
|
165
|
+
traceStart: number;
|
|
166
|
+
/** Starts an entry of the trace, when there is one, and returns what ends it. */
|
|
167
|
+
traced(kind: TraceEntry["kind"], label: string): (failed?: boolean) => void;
|
|
168
|
+
/**
|
|
169
|
+
* The tags of the `cached` functions that the request called, with the
|
|
170
|
+
* version that each had then, so `revalidate` drops the page that it renders.
|
|
171
|
+
*/
|
|
172
|
+
readonly cacheTags: Map<string, string | undefined>;
|
|
143
173
|
private readonly controller;
|
|
144
174
|
/**
|
|
145
175
|
* Aborts when the request no longer needs an answer: the request's own
|
|
@@ -228,12 +258,6 @@ type EntryMiddleware = (event: RequestEvent, next: () => Promise<Response>) => R
|
|
|
228
258
|
* ```
|
|
229
259
|
*/
|
|
230
260
|
declare function defineMiddleware(middleware: EntryMiddleware): EntryMiddleware;
|
|
231
|
-
/**
|
|
232
|
-
* Wraps a server function, so its calls while a page renders share a result
|
|
233
|
-
* when their arguments are the same. Calls from the browser, which are
|
|
234
|
-
* requests of their own, always run, so a function that changes something
|
|
235
|
-
* runs each time.
|
|
236
|
-
*/
|
|
237
261
|
declare function dedupe<F extends (...args: any[]) => unknown>(fn: F, id: string): F;
|
|
238
262
|
/**
|
|
239
263
|
* An error whose message reaches the client. A server function call that
|
|
@@ -413,6 +437,73 @@ declare function parseForm<S extends StandardSchemaV1>(schema: S, form: FormData
|
|
|
413
437
|
*/
|
|
414
438
|
declare function fieldErrors(issues: readonly (StandardSchemaV1.Issue | ValidationIssue)[]): Record<string, string[]>;
|
|
415
439
|
//#endregion
|
|
440
|
+
//#region src/runtime/submission.d.ts
|
|
441
|
+
/** What a server function adds to the reply of a submission. */
|
|
442
|
+
interface ReplyOptions {
|
|
443
|
+
/** Errors of the whole form, such as "That email is taken". */
|
|
444
|
+
formErrors?: string[];
|
|
445
|
+
/** Errors of fields, by field name, such as `{ email: ['That email is taken'] }`. */
|
|
446
|
+
fieldErrors?: Record<string, string[]>;
|
|
447
|
+
/** Sets the form back to its default values, such as after a save. */
|
|
448
|
+
reset?: boolean;
|
|
449
|
+
}
|
|
450
|
+
/** The options of `parseSubmission`. */
|
|
451
|
+
interface SubmissionOptions {
|
|
452
|
+
/**
|
|
453
|
+
* Field names whose values are never sent back, such as `password`. Files
|
|
454
|
+
* are never sent back either, because a file input cannot be filled.
|
|
455
|
+
*/
|
|
456
|
+
hide?: string[];
|
|
457
|
+
}
|
|
458
|
+
interface SubmissionBase {
|
|
459
|
+
/** The posted values, after the intent, before the schema. */
|
|
460
|
+
payload: Record<string, unknown> | undefined;
|
|
461
|
+
/** The reply for `createForm`, with the errors of the submission and of `options`. */
|
|
462
|
+
reply(options?: ReplyOptions): SubmissionResult;
|
|
463
|
+
}
|
|
464
|
+
/** A submission whose values passed the schema. */
|
|
465
|
+
interface SuccessfulSubmission<T> extends SubmissionBase {
|
|
466
|
+
status: "success";
|
|
467
|
+
/** The output of the schema. */
|
|
468
|
+
value: T;
|
|
469
|
+
intent?: undefined;
|
|
470
|
+
}
|
|
471
|
+
/** A submission whose values did not pass the schema, or whose names or intent were not allowed. */
|
|
472
|
+
interface FailedSubmission extends SubmissionBase {
|
|
473
|
+
status: "error";
|
|
474
|
+
value?: undefined;
|
|
475
|
+
intent?: Intent;
|
|
476
|
+
issues: ValidationIssue[];
|
|
477
|
+
}
|
|
478
|
+
/** A submission of an intent button, such as "Add an item". It is not a save. */
|
|
479
|
+
interface IntentSubmission extends SubmissionBase {
|
|
480
|
+
status: "intent";
|
|
481
|
+
value?: undefined;
|
|
482
|
+
intent: Intent;
|
|
483
|
+
}
|
|
484
|
+
/** A submission of a form: a success, an error, or an intent. */
|
|
485
|
+
type Submission<T> = SuccessfulSubmission<T> | FailedSubmission | IntentSubmission;
|
|
486
|
+
/**
|
|
487
|
+
* Reads the data of a form that `createForm` shows. It turns the entries
|
|
488
|
+
* into an object, as `parseForm` does, applies the intent of the button
|
|
489
|
+
* that was pressed, and validates the values with a Standard Schema when
|
|
490
|
+
* the button was not an intent. It does not throw for data that does not
|
|
491
|
+
* match. `reply()` gives what the function returns, for `createForm` to show.
|
|
492
|
+
*
|
|
493
|
+
* ```ts
|
|
494
|
+
* async function save(form: FormData) {
|
|
495
|
+
* 'use server';
|
|
496
|
+
* const submission = await parseSubmission(Order, form);
|
|
497
|
+
* if (submission.status !== 'success') {
|
|
498
|
+
* return submission.reply();
|
|
499
|
+
* }
|
|
500
|
+
* await db.orders.save(submission.value);
|
|
501
|
+
* return submission.reply({ reset: true });
|
|
502
|
+
* }
|
|
503
|
+
* ```
|
|
504
|
+
*/
|
|
505
|
+
declare function parseSubmission<S extends StandardSchemaV1>(schema: S, form: FormData, options?: SubmissionOptions): Promise<Submission<StandardSchemaV1.InferOutput<S>>>;
|
|
506
|
+
//#endregion
|
|
416
507
|
//#region src/runtime/rate-limit.d.ts
|
|
417
508
|
/**
|
|
418
509
|
* Where a limit keeps its counts. The default counts in memory, per
|
|
@@ -525,7 +616,99 @@ interface RateLimit {
|
|
|
525
616
|
*/
|
|
526
617
|
declare function clientAddress(event: RequestEvent, proxies?: string[]): string | undefined;
|
|
527
618
|
//#endregion
|
|
619
|
+
//#region src/runtime/cache.d.ts
|
|
620
|
+
/**
|
|
621
|
+
* Where cached results live. Values are text. `maxAge` is in seconds, after
|
|
622
|
+
* which the store can drop the value. Each method can return a promise.
|
|
623
|
+
*/
|
|
624
|
+
interface CacheStore {
|
|
625
|
+
get(key: string): Promise<string | null | undefined> | string | null | undefined;
|
|
626
|
+
set(key: string, value: string, maxAge: number): Promise<void> | void;
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* A store in the memory of the server, the default. Each process has its
|
|
630
|
+
* own, and it keeps at most `size` values, dropping the oldest first.
|
|
631
|
+
*/
|
|
632
|
+
declare function memoryStore(size?: number): CacheStore & {
|
|
633
|
+
readonly memory: true;
|
|
634
|
+
};
|
|
635
|
+
/**
|
|
636
|
+
* Sets the store of `cached`, such as one that keeps results in Redis for
|
|
637
|
+
* every process of the app. Set it before the first request.
|
|
638
|
+
*/
|
|
639
|
+
declare function setCacheStore(next: CacheStore): void;
|
|
640
|
+
/** The store of unstorage, which Nitro gives as `useStorage()`. */
|
|
641
|
+
interface Storage {
|
|
642
|
+
getItem(key: string): Promise<unknown>;
|
|
643
|
+
setItem(key: string, value: string, options?: {
|
|
644
|
+
ttl?: number;
|
|
645
|
+
}): Promise<void>;
|
|
646
|
+
getItemRaw?(key: string): Promise<unknown>;
|
|
647
|
+
setItemRaw?(key: string, value: string, options?: {
|
|
648
|
+
ttl?: number;
|
|
649
|
+
}): Promise<void>;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* A store of `cached` from an unstorage storage, such as Nitro's
|
|
653
|
+
* `useStorage('cache')`. It reads and writes the values as they are, since
|
|
654
|
+
* `getItem` would parse text that looks like JSON.
|
|
655
|
+
*/
|
|
656
|
+
declare function storageStore(storage: Storage): CacheStore;
|
|
657
|
+
interface CachedOptions<A extends unknown[]> {
|
|
658
|
+
/** Seconds that a result is used for the same arguments. */
|
|
659
|
+
maxAge: number;
|
|
660
|
+
/** What a result depends on, for `revalidate`. A function gets the arguments. */
|
|
661
|
+
tags?: string[] | ((...args: A) => string[]);
|
|
662
|
+
/**
|
|
663
|
+
* The name of the results in the store. A store that other processes
|
|
664
|
+
* share, such as Redis, needs one, so each process finds the same results.
|
|
665
|
+
*/
|
|
666
|
+
name?: string;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Makes a function that keeps its results for `maxAge` seconds, by its
|
|
670
|
+
* arguments, and returns a kept result in place of running again. Use it for
|
|
671
|
+
* data that every user sees the same, such as a list of products.
|
|
672
|
+
*
|
|
673
|
+
* - The function runs without the request: `getEvent()` throws in it, so a
|
|
674
|
+
* result never holds one user's data. Pass what it needs as arguments.
|
|
675
|
+
* - Arguments and results are values that brumate can send, such as plain
|
|
676
|
+
* objects, arrays, dates and maps.
|
|
677
|
+
* - Calls with the same arguments while one runs share that run.
|
|
678
|
+
* - `revalidate(tag)` drops the results of a tag.
|
|
679
|
+
*/
|
|
680
|
+
declare function cached<A extends unknown[], R>(fn: (...args: A) => Promise<R> | R, options: CachedOptions<A>): (...args: A) => Promise<Awaited<R>>;
|
|
681
|
+
/**
|
|
682
|
+
* Drops the results of `cached` functions with these tags, such as after a
|
|
683
|
+
* server function changes the data. The next call runs the function again.
|
|
684
|
+
* To show the new data on the page, call `refresh` too.
|
|
685
|
+
*/
|
|
686
|
+
declare function revalidate(...tags: string[]): Promise<void>;
|
|
687
|
+
//#endregion
|
|
688
|
+
//#region src/runtime/idempotent.d.ts
|
|
689
|
+
interface IdempotentOptions {
|
|
690
|
+
/** Seconds that the result of a key is kept. Defaults to 600. */
|
|
691
|
+
maxAge?: number;
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Makes a server function that runs once for each form that the server
|
|
695
|
+
* renders for it. A second post of the same form, such as a double click
|
|
696
|
+
* before the page loaded or a post again after a reload, gets the result of
|
|
697
|
+
* the first, or the same redirect, without running the function again.
|
|
698
|
+
*
|
|
699
|
+
* - It works for the exported functions of a `'use server'` file, used as the
|
|
700
|
+
* `action` of a form.
|
|
701
|
+
* - The key is in the URL of the form, so a page with such a form is not
|
|
702
|
+
* cached for everyone. Each render has a new key.
|
|
703
|
+
* - With scripts, the form gets a new key after each answer, so a post that
|
|
704
|
+
* the user means again runs again.
|
|
705
|
+
* - A call without a key, such as from a handler, runs as usual.
|
|
706
|
+
*/
|
|
707
|
+
declare function idempotent<F extends (...args: any[]) => unknown>(fn: F, options?: IdempotentOptions): F;
|
|
708
|
+
//#endregion
|
|
528
709
|
//#region src/runtime/server.d.ts
|
|
710
|
+
/** What `$bind(name)` passes a child: the value of the name, and the scope and slot it writes. */
|
|
711
|
+
declare function binding<T>(value: T, scope: ScopeId, slot: number, set?: unknown): Binding<T>;
|
|
529
712
|
/** The scope and the slot that hold the list of a list item. */
|
|
530
713
|
type ItemSource = readonly [scope: ScopeId, slot: number];
|
|
531
714
|
/** A `#loading` body that renders after the rest of the page. */
|
|
@@ -540,6 +723,35 @@ interface Boundary {
|
|
|
540
723
|
cancelled?: boolean;
|
|
541
724
|
/** A body around the target of a request for a `#defer` body, which renders but is not sent. */
|
|
542
725
|
around?: boolean;
|
|
726
|
+
/** The `#reveal` group that orders it, when it is in one. */
|
|
727
|
+
group?: RevealGroup;
|
|
728
|
+
}
|
|
729
|
+
/** The order of a `#reveal` block. */
|
|
730
|
+
type RevealOrder = "sequential" | "backwards" | "together" | "natural";
|
|
731
|
+
/**
|
|
732
|
+
* The `#loading` bodies of a `#reveal` block, in the order of the markup.
|
|
733
|
+
* When a body is ready, the stream asks the group, which sends the bodies
|
|
734
|
+
* that its order lets show. The data of every body still loads at once.
|
|
735
|
+
*/
|
|
736
|
+
declare class RevealGroup {
|
|
737
|
+
readonly order: RevealOrder;
|
|
738
|
+
readonly collapsed: boolean;
|
|
739
|
+
/** The bodies that stream, each with how to send it once it is ready. */
|
|
740
|
+
private readonly members;
|
|
741
|
+
/** The fallbacks that `collapsed` hides until the body before them shows. */
|
|
742
|
+
readonly hidden: Set<ScopeId>;
|
|
743
|
+
private closed;
|
|
744
|
+
constructor(order: RevealOrder, collapsed: boolean);
|
|
745
|
+
/** True when a body that is ready can render in place, before the bodies that stream. */
|
|
746
|
+
mayShow(): boolean;
|
|
747
|
+
/** True when the fallback of the next body that streams waits, for `collapsed`. */
|
|
748
|
+
hides(): boolean;
|
|
749
|
+
add(id: ScopeId): void;
|
|
750
|
+
/** The body is ready, or failed with nothing to send. `send` writes it, and runs `after` with it. */
|
|
751
|
+
ready(id: ScopeId, send: (after: string) => void): void;
|
|
752
|
+
/** The block ended, so the group knows its last body. */
|
|
753
|
+
close(): void;
|
|
754
|
+
private flush;
|
|
543
755
|
}
|
|
544
756
|
/** The `#defer` body that a render renders, for the request of the browser that asks for it. */
|
|
545
757
|
interface DeferTarget {
|
|
@@ -674,6 +886,10 @@ declare class Context {
|
|
|
674
886
|
readonly calls: Map<string, unknown>;
|
|
675
887
|
/** The event of the page, for `getEvent()` in a component, which the compiler rewrites to this. */
|
|
676
888
|
getEvent(): RequestEvent;
|
|
889
|
+
/** Starts an entry of the trace of the request, in development. */
|
|
890
|
+
traced(kind: TraceEntry["kind"], label: string): ((failed?: boolean) => void) | undefined;
|
|
891
|
+
/** Marks the request of the page as one that depends on the user, so the page is not cached for everyone. */
|
|
892
|
+
personal(): void;
|
|
677
893
|
/** Runs code of the render with its event and its call results, such as a memo's compute. */
|
|
678
894
|
run<T>(callback: () => T): T;
|
|
679
895
|
/** The result of a server function that a form posted to this page. */
|
|
@@ -766,6 +982,12 @@ declare class Context {
|
|
|
766
982
|
*/
|
|
767
983
|
get sources(): Map<ScopeId, ItemSource>;
|
|
768
984
|
slots(scope: ScopeId, values: unknown[], names?: string[]): void;
|
|
985
|
+
/**
|
|
986
|
+
* Records the props that a parent bound with `$bind`, among the props that
|
|
987
|
+
* the component writes: `slots` has the slot of each, by its name. Its
|
|
988
|
+
* writes in the browser go to the parent's slots.
|
|
989
|
+
*/
|
|
990
|
+
bindings(scope: ScopeId, props: Record<string, unknown>, slots: Record<string, number>): void;
|
|
769
991
|
/**
|
|
770
992
|
* Records the item of a list that can change on the client. `source` is
|
|
771
993
|
* the scope and slot that hold the list, when the compiler found one, so
|
|
@@ -776,8 +998,13 @@ declare class Context {
|
|
|
776
998
|
link(scope: ScopeId, anchor: number, child: ScopeId): void;
|
|
777
999
|
/** Returns the reference that a `ref` signal holds on the server. */
|
|
778
1000
|
element(scope: ScopeId, anchor: number): ElementReference;
|
|
779
|
-
/**
|
|
780
|
-
|
|
1001
|
+
/**
|
|
1002
|
+
* Marks a function as a client function, so it serializes as a reference.
|
|
1003
|
+
* `args` are the arguments of a handler that `$handler` made, which go
|
|
1004
|
+
* with the reference. Each call makes a new reference, so a function that
|
|
1005
|
+
* `$handler` marks gets a copy for its arguments.
|
|
1006
|
+
*/
|
|
1007
|
+
fn<T>(value: T, ref: string, scope: ScopeId, args?: unknown[]): T;
|
|
781
1008
|
/** Returns a component's stylesheet the first time the page renders the component. */
|
|
782
1009
|
style(id: string, css: string): string;
|
|
783
1010
|
/** Adds the markup of a `#head` block. */
|
|
@@ -810,6 +1037,20 @@ declare class Context {
|
|
|
810
1037
|
}): void;
|
|
811
1038
|
/** True when the bodies of `#defer` blocks render in place, for a page that renders in order. */
|
|
812
1039
|
inOrder: boolean;
|
|
1040
|
+
/** The `#reveal` blocks that are open in this context, the innermost last. */
|
|
1041
|
+
private readonly reveals;
|
|
1042
|
+
/** Starts a `#reveal` block: the `#loading` bodies until `revealEnd` show in its order. */
|
|
1043
|
+
revealStart(order: RevealOrder, collapsed: boolean): void;
|
|
1044
|
+
/** Ends the `#reveal` block that `revealStart` started. */
|
|
1045
|
+
revealEnd(): void;
|
|
1046
|
+
/** The group of the `#reveal` block around the next body, when the stream orders it. */
|
|
1047
|
+
private get reveal();
|
|
1048
|
+
/** True when a `#loading` body that is ready can render in place, as its `#reveal` allows. */
|
|
1049
|
+
mayShow(): boolean;
|
|
1050
|
+
/** Starts the fallback of a `#loading` body, which `collapsed` hides in a template. */
|
|
1051
|
+
fallbackStart(id: ScopeId): string;
|
|
1052
|
+
/** Ends the fallback that `fallbackStart` started. */
|
|
1053
|
+
fallbackEnd(id: ScopeId): string;
|
|
813
1054
|
/** Returns the ID of a new `#loading` boundary. */
|
|
814
1055
|
boundary(): ScopeId;
|
|
815
1056
|
/** Renders a `#loading` body after the rest of the page, in its own context and ID space. */
|
|
@@ -838,9 +1079,11 @@ interface Memo<T = unknown> {
|
|
|
838
1079
|
value?: unknown;
|
|
839
1080
|
error?: unknown;
|
|
840
1081
|
load?: Promise<unknown>;
|
|
1082
|
+
/** The name of the memo, for the trace of the devtools. */
|
|
1083
|
+
name?: string;
|
|
841
1084
|
}
|
|
842
1085
|
/** Declares a memo. Its value is computed when it is first read. */
|
|
843
|
-
declare function memo<T>(compute: () => T, ctx?: Context): Memo<T>;
|
|
1086
|
+
declare function memo<T>(compute: () => T, ctx?: Context, name?: string): Memo<T>;
|
|
844
1087
|
/**
|
|
845
1088
|
* Reads a memo. A value that is still loading throws `NotReady` with its
|
|
846
1089
|
* load, and a memo that read such a value stays unread, so it computes
|
|
@@ -984,6 +1227,8 @@ interface RenderResult {
|
|
|
984
1227
|
interface RenderOptions {
|
|
985
1228
|
/** The URL prefix of server function calls, for forms that post to one. Defaults to `/_brumate`. */
|
|
986
1229
|
rpc?: string;
|
|
1230
|
+
/** In development: the swaps of `#loading` bodies keep their fallbacks, for the devtools. */
|
|
1231
|
+
dev?: boolean;
|
|
987
1232
|
/**
|
|
988
1233
|
* The first scope and boundary ID. A page that the client loads in place
|
|
989
1234
|
* of another starts above the IDs of the page it keeps parts of.
|
|
@@ -1138,7 +1383,33 @@ declare function isCrossSite(request: Request, options?: RequestOptions): boolea
|
|
|
1138
1383
|
* another site answers 403. See `isCrossSite`.
|
|
1139
1384
|
*/
|
|
1140
1385
|
declare function handleRequest(functions: Record<string, (...args: any[]) => unknown>, request: Request, prefix?: string, options?: RequestOptions): Promise<Response | undefined>;
|
|
1386
|
+
/**
|
|
1387
|
+
* How long a page can be cached for everyone, as a route exports it from
|
|
1388
|
+
* its module script: `export const cache = { maxAge: 60 }`. A layout's
|
|
1389
|
+
* applies to the pages below it, and the nearest one wins.
|
|
1390
|
+
*/
|
|
1391
|
+
interface PageCache {
|
|
1392
|
+
/** Seconds that a cache can serve the page without asking again. */
|
|
1393
|
+
maxAge: number;
|
|
1394
|
+
/** Seconds after `maxAge` that a cache can serve the old page while it gets a new one. */
|
|
1395
|
+
staleWhileRevalidate?: number;
|
|
1396
|
+
}
|
|
1141
1397
|
interface RouteOptions extends DocumentOptions, RequestOptions {
|
|
1398
|
+
/**
|
|
1399
|
+
* The HTML that the build prerendered for the path, for a server that has
|
|
1400
|
+
* the file. The server sends it at once, then renders the `#defer` blocks
|
|
1401
|
+
* with the `load` or `idle` trigger in the same response, in place of a
|
|
1402
|
+
* request for each. Requests for a `#defer` body and client navigation
|
|
1403
|
+
* render the route as usual.
|
|
1404
|
+
*/
|
|
1405
|
+
shell?: string;
|
|
1406
|
+
/**
|
|
1407
|
+
* Keeps the pages that `cache` makes public in the store of `cached`, and
|
|
1408
|
+
* answers the next request for the same URL from it until `maxAge` ends or
|
|
1409
|
+
* `revalidate` drops a tag that the page used. Defaults to true. A CDN in
|
|
1410
|
+
* front of the server can keep them instead.
|
|
1411
|
+
*/
|
|
1412
|
+
pageCache?: boolean;
|
|
1142
1413
|
/**
|
|
1143
1414
|
* Throws errors that are not a `ServerError` instead of rendering
|
|
1144
1415
|
* `_error.brm`, so a dev server can show them, such as with `errorPage`
|
|
@@ -1184,8 +1455,6 @@ declare function handleRoute(tree: RouteNode, request: Request, options?: RouteO
|
|
|
1184
1455
|
* refers to nothing in the browser is left out.
|
|
1185
1456
|
*/
|
|
1186
1457
|
declare function spread(attributes: Record<string, unknown>, on?: string[]): string;
|
|
1187
|
-
/** The `b-on` attribute of an element with spreads: its own handlers, then those of its spreads. */
|
|
1188
|
-
declare function onAttribute(on: string[], own: string): string;
|
|
1189
1458
|
//#endregion
|
|
1190
|
-
export {
|
|
1191
|
-
//# sourceMappingURL=server-
|
|
1459
|
+
export { setCacheStore as $, serializeCookie as $t, isCrossSite as A, RouteMatch as At, stateScript as B, RequestKind as Bt, children as C, parseForm as Ct, handleRoute as D, Loader as Dt, handleRequest as E, Handler as Et, ready as F, Locals as Ft, waitAll as G, isRedirect as Gt, streamParts as H, dedupe as Ht, render as I, Redirect as It, CacheStore as J, CookieOptions as Jt, IdempotentOptions as K, redirect as Kt, renderToStream as L, RequestCall as Lt, memo as M, RouteView as Mt, packState as N, matchRoute as Nt, inlineBodies as O, Middleware as Ot, read as P, EntryMiddleware as Pt, revalidate as Q, parseCookies as Qt, settled as R, RequestEvent as Rt, binding as S, parse as St, dynamic as T, EndpointLoader as Tt, streamState as U, defineMiddleware as Ut, stateValue as V, ServerError as Vt, wait as W, getEvent as Wt, cached as X, SessionOptions as Xt, CachedOptions as Y, Session as Yt, memoryStore as Z, createSession as Zt, StateAttributes as _, parseSubmission as _t, ItemSource as a, RateLimitOptions as at, action as b, ValidationIssue as bt, Memo as c, clientAddress as ct, RenderOptions as d, FailedSubmission as dt, toNodeHeaders as en, storageStore as et, RenderResult as f, IntentSubmission as ft, ScopeEntry as g, SuccessfulSubmission as gt, RouteOptions as h, SubmissionOptions as ht, DocumentOptions as i, RateLimitMiddleware as it, lazy as j, RouteNode as jt, insert as k, MiddlewareLoader as kt, NotReady as l, configureRateLimit as lt, RevealOrder as m, Submission as mt, Context as n, RateLimitConfig as nt, Lazy as o, RateLimitStore as ot, RequestOptions as p, ReplyOptions as pt, idempotent as q, withEvent as qt, DeferTarget as r, RateLimitError as rt, Mark as s, Window as st, Component as t, RateLimit as tt, PageCache as u, rateLimit as ut, StateMap as v, ParseResult as vt, component as w, safeParse as wt, actionResult as x, fieldErrors as xt, StreamOptions as y, ValidationError as yt, spread as z, RequestEventOptions as zt };
|
|
1460
|
+
//# sourceMappingURL=server-DuFYRXrd.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as LoaderOptions } from "./boot-
|
|
1
|
+
import { t as LoaderOptions } from "./boot-C25Sa6vq.js";
|
|
2
2
|
//#region src/runtime/static-loader.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* `start` for a site that loads every page with a full page load, as with
|
|
@@ -8,4 +8,4 @@ import { t as LoaderOptions } from "./boot-D-IdPy7B.js";
|
|
|
8
8
|
declare function startWithoutNavigation(options: LoaderOptions): () => void;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { startWithoutNavigation as t };
|
|
11
|
-
//# sourceMappingURL=static-loader-
|
|
11
|
+
//# sourceMappingURL=static-loader-Drpr0AzI.d.ts.map
|