@askrjs/askr 0.0.92 → 0.0.94
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/CHANGELOG.md +3 -0
- package/dist/{access-DSkccuEI.js → access-d_DCdwqn.js} +3 -0
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.js +3 -2
- package/dist/{activity-DodHdC0L.js → activity-BshyLB3_.js} +4 -2
- package/dist/{activity-DxUcygE5.d.ts → activity-CJIQyo5X.d.ts} +5 -1
- package/dist/benchmark.d.ts +1 -1
- package/dist/benchmark.js +8 -8
- package/dist/boot/index.d.ts +12 -3
- package/dist/boot/index.js +1 -1
- package/dist/{boot-D71bjP4r.js → boot-BsMB_ySP.js} +21 -15
- package/dist/{cleanup-DAAhJjx5.js → cleanup-DefafSjG.js} +4 -4
- package/dist/{component-cleanup-CJCfu5ed.js → component-cleanup-hrqSikl2.js} +2 -2
- package/dist/{component-internal-DlAkCgBE.js → component-internal-DOVVMjG7.js} +7 -5
- package/dist/components/index.d.ts +7 -2
- package/dist/components/index.js +1 -1
- package/dist/{compose-ref-Cc_YkUpM.js → compose-ref-1Fhs7mbF.js} +13 -0
- package/dist/{compose-ref-Cizq72-x.d.ts → compose-ref-DOJHoW5X.d.ts} +3 -0
- package/dist/control/index.d.ts +1 -1
- package/dist/control/index.js +1 -1
- package/dist/{control-CdzY49Q2.d.ts → control-DdFw-Caz.d.ts} +1 -1
- package/dist/{control-Dv540XtV.js → control-DqOzkgc7.js} +9 -5
- package/dist/{csp-nonce-ByMbWv8s.js → csp-nonce-BBxq1zq4.js} +8 -1
- package/dist/data/index.d.ts +1 -1
- package/dist/data/index.js +3 -3
- package/dist/{data-DcikEH9N.js → data-DYqokZzc.js} +15 -4
- package/dist/{data-runtime-oIdQWnPW.js → data-runtime-JxoRgrrt.js} +2 -0
- package/dist/{deferred-B6CafO5u.js → deferred-BS0Xpstg.js} +8 -3
- package/dist/{effect-BdZcHblj.js → effect-BdvdgMvV.js} +2 -2
- package/dist/{fastlane-B2s24fWt.js → fastlane-DGo7SxBQ.js} +3 -3
- package/dist/{for-internal-T1C7jd7x.js → for-internal-jrliHZmF.js} +5 -5
- package/dist/foundations/icon/index.d.ts +14 -2
- package/dist/foundations/icon/index.js +8 -0
- package/dist/foundations/index.d.ts +2 -2
- package/dist/foundations/index.js +1 -1
- package/dist/foundations/interactions/index.d.ts +18 -2
- package/dist/foundations/interactions/index.js +1 -1
- package/dist/foundations/state/index.d.ts +8 -1
- package/dist/foundations/state/index.js +7 -1
- package/dist/foundations/structures/index.d.ts +2 -2
- package/dist/foundations/structures/index.js +1 -1
- package/dist/foundations/utilities/index.d.ts +2 -2
- package/dist/foundations/utilities/index.js +1 -1
- package/dist/fx/index.d.ts +10 -1
- package/dist/fx/index.js +7 -1
- package/dist/{index-oswRaMn6.d.ts → index-C29SEGIv.d.ts} +30 -2
- package/dist/{index-BnU0NPwM.d.ts → index-CzH-0LcA.d.ts} +18 -0
- package/dist/{index-DA3g8lm8.d.ts → index-KQ7Vl4-8.d.ts} +414 -5
- package/dist/index.d.ts +3 -4
- package/dist/index.js +13 -12
- package/dist/{interactions-CWkNEq_C.js → interactions-B4XaFxt1.js} +6 -1
- package/dist/{jsx-C3IECePB.js → jsx-DRS-qjiN.js} +2 -0
- package/dist/jsx-dev-runtime.d.ts +2 -2
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime-BTzDdBJ_.d.ts +2 -0
- package/dist/{jsx-runtime-Cfb2umb4.d.ts → jsx-runtime-Cdd6Gkb0.d.ts} +4 -2
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/jsx-runtime.js +1 -1
- package/dist/{lifecycle-batch-Cyfd07rf.js → lifecycle-batch-BH0fax4F.js} +2 -2
- package/dist/{lifecycle-operations-CQ8fsc94.js → lifecycle-operations-Qxq6ABrC.js} +6 -1
- package/dist/{manifest-Dv0bO6kg.js → manifest-D6rfj_jC.js} +4 -0
- package/dist/{navigate-CZHPEUC4.d.ts → navigate-BL_FIIJ6.d.ts} +6 -1
- package/dist/{navigate-BbWj-QU-.js → navigate-CECCMPAr.js} +13 -10
- package/dist/{query-registry-qm13pEdK.js → query-registry-CimB1YeW.js} +11 -1
- package/dist/{readable-B99wh5Z_.js → readable-BsdGWsDE.js} +1 -1
- package/dist/{renderer-C6jz9nIN.js → renderer-CLvq458M.js} +10 -10
- package/dist/{resolution-B21kmOkp.js → resolution-D8PgnTzh.js} +11 -5
- package/dist/{resource-operation-CaAttQqz.js → resource-operation-CLQXCn1p.js} +4 -4
- package/dist/resources/index.d.ts +15 -2
- package/dist/resources/index.js +6 -5
- package/dist/router/index.d.ts +46 -4
- package/dist/router/index.js +15 -8
- package/dist/{selector-BLWwI55m.js → selector-CyK-sDwB.js} +4 -3
- package/dist/ssg/index.d.ts +5 -1
- package/dist/ssg/index.js +5 -5
- package/dist/ssr/index.d.ts +16 -3
- package/dist/ssr/index.js +1 -1
- package/dist/{ssr-CaZfvQWn.js → ssr-8_vHDWqV.js} +18 -10
- package/dist/{state-XPZYUzHL.js → state-DmkGM_LN.js} +3 -3
- package/dist/{structures-DKjkAmM5.js → structures-umvVUD-M.js} +19 -5
- package/dist/testing/index.d.ts +31 -2
- package/dist/testing/index.js +23 -5
- package/dist/{types-BA9FJtfR.d.ts → types-DkVJhVs9.d.ts} +4 -0
- package/dist/{verify-hydration-CcF-HJil.js → verify-hydration-jf8X2V3x.js} +1 -1
- package/package.json +1 -1
- package/dist/index-2bk8nldG.d.ts +0 -241
- package/dist/jsx-runtime-C_0v1pMN.d.ts +0 -2
- package/dist/scheduler-CmLO4Dfm.d.ts +0 -65
package/dist/router/index.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { r as JSXElement, s as Props } from "../types-
|
|
3
|
-
import { a as ScrollRestorationOptions, i as NavigationScrollBehavior, n as NavigateOptions, r as HistoryScrollBehavior, t as navigate } from "../navigate-
|
|
4
|
-
import { i as onRouteChange, n as RouteChangeOptions, r as currentRoute, t as RouteChangeCleanup } from "../activity-
|
|
1
|
+
import { $ as AccessDecision, At as RouteRegistry, Ct as RouteParams, Dt as RouteRecord, Et as RouteQuery, Ft as RouteSearch, It as RouteSearchValue, Lt as RouteSnapshot, Mt as RouteRenderResult, Nt as RouteRequestOptions, Ot as RouteRef, Pt as RouteRequestResult, Q as AccessAllowDecision, St as RouteOptions, Tt as RoutePolicy, _t as RouteManifest, at as LayoutScopeRecord, bt as RouteMetaSource, ct as ParsedSegment, dt as RouteAuthResolver, et as AccessDenyDecision, ft as RouteComponent, gt as RouteHandler, ht as RouteDestination, it as GroupHelperOptions, jt as RouteRegistryOptions, kt as RouteRefSearch, lt as Route, mt as RouteDefinition, nt as AccessRedirectDecision, ot as PageHelperOptions, pt as RouteContext, rn as RenderableChild, rt as AccessRedirectStatus, st as PageScopeRecord, tt as AccessDenyStatus, ut as RouteAuthOptions, vt as RouteMatch, wt as RoutePathParams, xt as RouteMode, yt as RouteMeta } from "../index-KQ7Vl4-8.js";
|
|
2
|
+
import { r as JSXElement, s as Props } from "../types-DkVJhVs9.js";
|
|
3
|
+
import { a as ScrollRestorationOptions, i as NavigationScrollBehavior, n as NavigateOptions, r as HistoryScrollBehavior, t as navigate } from "../navigate-BL_FIIJ6.js";
|
|
4
|
+
import { i as onRouteChange, n as RouteChangeOptions, r as currentRoute, t as RouteChangeCleanup } from "../activity-CJIQyo5X.js";
|
|
5
5
|
import { AuthContext, AuthContext as AuthContext$1, AuthRequirement, AuthRequirement as AuthRequirement$1 } from "@askrjs/auth";
|
|
6
6
|
import { ObjectSchema } from "@askrjs/schema";
|
|
7
7
|
//#region src/router/route-query.d.ts
|
|
8
|
+
/** A single query-string value accepted by {@link updateRouteQuery}. */
|
|
8
9
|
type RouteQueryParamValue = string | number | boolean | null | undefined;
|
|
10
|
+
/** A query-string value, or an array of them for a repeated param. */
|
|
9
11
|
type RouteQueryParamInput = RouteQueryParamValue | readonly RouteQueryParamValue[];
|
|
12
|
+
/** A map of query param updates for {@link updateRouteQuery}; `null`/`undefined` removes the key. */
|
|
10
13
|
type RouteQueryUpdates = Record<string, RouteQueryParamInput>;
|
|
14
|
+
/** A function that mutates a `URLSearchParams` directly, for {@link updateRouteQuery}. */
|
|
11
15
|
type RouteQueryUpdater = (searchParams: URLSearchParams) => void;
|
|
16
|
+
/** Options for {@link updateRouteQuery}. */
|
|
12
17
|
type UpdateRouteQueryOptions = {
|
|
13
18
|
/**
|
|
14
19
|
* Defaults to replace so high-frequency controls such as search inputs do not
|
|
@@ -28,13 +33,21 @@ type CompatibleAbsoluteRouteComponent<Path extends string, TComponent extends An
|
|
|
28
33
|
type CompatibleRelativeRouteComponent<Path extends string, TComponent extends AnyRouteComponent> = Parameters<TComponent> extends [] ? TComponent : RouteComponentParam<TComponent> extends Record<keyof RoutePathParams<Path>, string> ? TComponent : never;
|
|
29
34
|
type CompatibleRouteComponent<Path extends string, TComponent extends AnyRouteComponent> = Path extends `/${string}` ? CompatibleAbsoluteRouteComponent<Path, TComponent> : CompatibleRelativeRouteComponent<Path, TComponent>;
|
|
30
35
|
type RouteOptionsForComponent<Path extends string, TComponent extends AnyRouteComponent, TSearchSchema extends ObjectSchema<RouteSearch> | undefined = ObjectSchema<RouteSearch> | undefined, TLoaderData = unknown, TDehydratedData = TLoaderData> = Parameters<TComponent> extends [] ? RouteOptions<RoutePathParams<Path>, TSearchSchema, TLoaderData, TDehydratedData> : RouteComponentParam<TComponent> extends RouteParams ? RouteOptions<RouteComponentParam<TComponent>, TSearchSchema, TLoaderData, TDehydratedData> : RouteOptions<RoutePathParams<Path>, TSearchSchema, TLoaderData, TDehydratedData>;
|
|
36
|
+
/** Declare a group of routes sharing `options` (auth, policies, layout, meta). */
|
|
31
37
|
declare function group(options: GroupHelperOptions, fn: RouteDefinition): void;
|
|
38
|
+
/**
|
|
39
|
+
* Declare a route page at `path`, nesting a sub-scope for `index`/`page`/`fallback`
|
|
40
|
+
* declarations and options like `preload`/`meta`/`auth`.
|
|
41
|
+
*/
|
|
32
42
|
declare function page<const TPath extends string>(path: TPath, Component: RouteComponent<RoutePathParams<TPath>>, fn: RouteDefinition): void;
|
|
33
43
|
declare function page<const TPath extends string, TComponent extends AnyRouteComponent>(path: TPath, Component: CompatibleRouteComponent<TPath, TComponent>, fn: RouteDefinition): void;
|
|
34
44
|
declare function page<const TPath extends string>(path: TPath, Component: RouteComponent<RoutePathParams<TPath>>, options: PageHelperOptions, fn: RouteDefinition): void;
|
|
35
45
|
declare function page<const TPath extends string, TComponent extends AnyRouteComponent>(path: TPath, Component: CompatibleRouteComponent<TPath, TComponent>, options: PageHelperOptions, fn: RouteDefinition): void;
|
|
46
|
+
/** Declare the index route for the enclosing `page()` scope. */
|
|
36
47
|
declare function index(Component: RouteComponent, options?: RouteOptions): void;
|
|
48
|
+
/** Declare the catch-all `/*` fallback route for the enclosing scope. */
|
|
37
49
|
declare function fallback(Component: RouteComponent): void;
|
|
50
|
+
/** Declare a route at `path` rendering `Component`, returning a typed {@link RouteRef} for building destinations. */
|
|
38
51
|
declare function route<const TPath extends string, const TSearchSchema extends ObjectSchema<RouteSearch> | undefined = undefined, TLoaderData = unknown, TDehydratedData = TLoaderData>(path: TPath, Component: RouteComponent<RoutePathParams<TPath>>, options?: RouteOptions<RoutePathParams<TPath>, TSearchSchema, TLoaderData, TDehydratedData>): RouteRef<RoutePathParams<TPath>, RouteRefSearch<TSearchSchema>>;
|
|
39
52
|
declare function route<const TPath extends string, TComponent extends AnyRouteComponent, const TSearchSchema extends ObjectSchema<RouteSearch> | undefined = undefined, TLoaderData = unknown, TDehydratedData = TLoaderData>(path: TPath, Component: CompatibleRouteComponent<TPath, TComponent>, options?: RouteOptionsForComponent<TPath, TComponent, TSearchSchema, TLoaderData, TDehydratedData>): RouteRef<RoutePathParams<TPath>, RouteRefSearch<TSearchSchema>>;
|
|
40
53
|
//#endregion
|
|
@@ -43,20 +56,28 @@ declare function route<const TPath extends string, TComponent extends AnyRouteCo
|
|
|
43
56
|
declare function currentAuth(): AuthContext$1;
|
|
44
57
|
//#endregion
|
|
45
58
|
//#region src/router/resolution.d.ts
|
|
59
|
+
/** Resolve `target` against a route registry, applying auth/policies to produce a render/redirect/deny result. */
|
|
46
60
|
declare function resolveRouteRequest(target: string, options: RouteRequestOptions): RouteRequestResult | Promise<RouteRequestResult>;
|
|
47
61
|
//#endregion
|
|
48
62
|
//#region src/router/manifest.d.ts
|
|
63
|
+
/**
|
|
64
|
+
* Run `definition` to declare routes (via `route`/`page`/`group`/`fallback`)
|
|
65
|
+
* and build a {@link RouteRegistry} to pass to `createSPA`/`hydrateSPA`.
|
|
66
|
+
*/
|
|
49
67
|
declare function createRouteRegistry(definition: RouteDefinition, options?: RouteRegistryOptions): RouteRegistry;
|
|
50
68
|
//#endregion
|
|
51
69
|
//#region src/router/lazy.d.ts
|
|
70
|
+
/** A route component loaded on demand via {@link lazy}, with an explicit `preload()`. */
|
|
52
71
|
type LazyRouteComponent<TComponent extends AnyRouteComponent> = TComponent & {
|
|
53
72
|
preload(): Promise<void>;
|
|
54
73
|
};
|
|
74
|
+
/** A route data loader loaded on demand via {@link lazyRouteData}, with an explicit `preload()`. */
|
|
55
75
|
type LazyRouteDataLoader<TModule, TData = TModule> = ((context: RouteContext & {
|
|
56
76
|
request?: Request;
|
|
57
77
|
}) => Promise<TData>) & {
|
|
58
78
|
preload(): Promise<void>;
|
|
59
79
|
};
|
|
80
|
+
/** Wrap a dynamic-import factory as a {@link LazyRouteComponent}, loaded on first use. */
|
|
60
81
|
declare function lazy<TComponent extends AnyRouteComponent>(factory: () => Promise<{
|
|
61
82
|
default: TComponent;
|
|
62
83
|
} | TComponent>): LazyRouteComponent<TComponent>;
|
|
@@ -69,10 +90,13 @@ declare function lazyRouteData<TModule, TData = TModule>(factory: () => PromiseL
|
|
|
69
90
|
}) => TData | PromiseLike<TData>): LazyRouteDataLoader<TModule, TData>;
|
|
70
91
|
//#endregion
|
|
71
92
|
//#region src/router/rendering.d.ts
|
|
93
|
+
/** Renders the nested route content for the enclosing layout or page scope. */
|
|
72
94
|
declare function Outlet(): JSXElement;
|
|
73
95
|
//#endregion
|
|
74
96
|
//#region src/router/route-data-loader.d.ts
|
|
97
|
+
/** Which environment a route's data loader ran (or failed) in. */
|
|
75
98
|
type RouteDataLoadPhase = 'client' | 'server' | 'ssg';
|
|
99
|
+
/** Thrown when a route's `loader` rejects; wraps the original `cause`. */
|
|
76
100
|
declare class RouteDataLoadError extends Error {
|
|
77
101
|
readonly route: string;
|
|
78
102
|
readonly phase: RouteDataLoadPhase;
|
|
@@ -81,28 +105,39 @@ declare class RouteDataLoadError extends Error {
|
|
|
81
105
|
}
|
|
82
106
|
//#endregion
|
|
83
107
|
//#region src/router/policy.d.ts
|
|
108
|
+
/** Policy decision: allow the route to render. */
|
|
84
109
|
declare function allow(): AccessAllowDecision;
|
|
110
|
+
/** Policy decision: redirect the visitor to `to`. */
|
|
85
111
|
declare function redirect(to: string, init?: {
|
|
86
112
|
status?: AccessRedirectStatus;
|
|
87
113
|
replace?: boolean;
|
|
88
114
|
}): AccessRedirectDecision;
|
|
115
|
+
/** Policy decision: deny the request with the given HTTP status. */
|
|
89
116
|
declare function deny(status: AccessDenyStatus): AccessDenyDecision;
|
|
117
|
+
/** Policy decision: deny with 401 Unauthorized. */
|
|
90
118
|
declare function unauthorized(): AccessDenyDecision;
|
|
119
|
+
/** Policy decision: deny with 403 Forbidden. */
|
|
91
120
|
declare function forbidden(): AccessDenyDecision;
|
|
121
|
+
/** Policy decision: deny with 404 Not Found. */
|
|
92
122
|
declare function notFound(): AccessDenyDecision;
|
|
93
123
|
//#endregion
|
|
94
124
|
//#region src/router/destination.d.ts
|
|
125
|
+
/** Build a {@link RouteDestination} (with a computed `href`) for a {@link RouteRef} and params/search. */
|
|
95
126
|
declare function to$1<TParams extends RouteParams, TSearch extends RouteSearch = RouteSearch>(route: RouteRef<TParams, TSearch>, params: TParams, search?: TSearch): RouteDestination;
|
|
96
127
|
//#endregion
|
|
97
128
|
//#region src/router/metadata.d.ts
|
|
129
|
+
/** Resolve a route's merged {@link RouteMeta} by running its metadata chain against `context`. */
|
|
98
130
|
declare function resolveRouteMeta(record: RouteRecord, context: RouteContext): Promise<Readonly<RouteMeta>>;
|
|
99
131
|
/** Replace only Askr-owned head nodes after a successful client navigation. */
|
|
100
132
|
declare function reconcileRouteMeta(meta: Readonly<RouteMeta>, target?: Document): void;
|
|
133
|
+
/** Render a {@link RouteMeta} to the `<title>`/`<meta>`/`<link>`/JSON-LD markup for the document `<head>`. */
|
|
101
134
|
declare function serializeRouteMeta(meta: RouteMeta): string;
|
|
102
135
|
//#endregion
|
|
103
136
|
//#region src/common/deferred-value.d.ts
|
|
104
137
|
declare const DEFERRED_VALUE: unique symbol;
|
|
138
|
+
/** Lifecycle state of a {@link Deferred} value. */
|
|
105
139
|
type DeferredState = 'pending' | 'fulfilled' | 'rejected';
|
|
140
|
+
/** A promise-backed value that can be read synchronously once settled, produced by {@link defer}. */
|
|
106
141
|
interface Deferred<T> {
|
|
107
142
|
readonly state: DeferredState;
|
|
108
143
|
readonly value: T | undefined;
|
|
@@ -110,18 +145,24 @@ interface Deferred<T> {
|
|
|
110
145
|
readonly promise: Promise<T>;
|
|
111
146
|
readonly [DEFERRED_VALUE]: true;
|
|
112
147
|
}
|
|
148
|
+
/** Wrap a promise as a {@link Deferred} value that tracks its settled state and result. */
|
|
113
149
|
declare function defer<T>(promise: PromiseLike<T>): Deferred<T>;
|
|
150
|
+
/** Check whether `value` is a {@link Deferred} produced by {@link defer}. */
|
|
114
151
|
declare function isDeferred<T = unknown>(value: unknown): value is Deferred<T>;
|
|
115
152
|
//#endregion
|
|
116
153
|
//#region src/router/deferred.d.ts
|
|
154
|
+
/** Props for {@link Resolve}. */
|
|
117
155
|
interface ResolveProps<T> {
|
|
118
156
|
value: Deferred<T>;
|
|
119
157
|
pending?: RenderableChild;
|
|
120
158
|
rejected?: RenderableChild | ((error: unknown) => RenderableChild);
|
|
121
159
|
children: (value: T) => RenderableChild;
|
|
122
160
|
}
|
|
161
|
+
/** Recursively await any {@link Deferred} values nested within `input`, returning it once fully resolved. */
|
|
123
162
|
declare function resolveDeferredValues<T>(input: T, signal?: AbortSignal): Promise<T>;
|
|
163
|
+
/** Read the current route's server loader data during render or hydration. */
|
|
124
164
|
declare function routeData<T>(): T;
|
|
165
|
+
/** Render a {@link Deferred} value's fulfilled state, a pending placeholder, or a rejected fallback. */
|
|
125
166
|
declare function Resolve<T>(props: ResolveProps<T>): JSXElement;
|
|
126
167
|
//#endregion
|
|
127
168
|
//#region src/components/link.d.ts
|
|
@@ -150,6 +191,7 @@ type LinkBaseProps = Omit<Props, 'children' | 'href' | 'class' | 'rel' | 'target
|
|
|
150
191
|
onPress?: (event: Event) => void;
|
|
151
192
|
onClick?: (event: MouseEvent) => void;
|
|
152
193
|
};
|
|
194
|
+
/** Props for {@link Link}: either a raw `href` or a typed route `to` destination. */
|
|
153
195
|
type LinkProps = LinkBaseProps & ({
|
|
154
196
|
href: string;
|
|
155
197
|
to?: never;
|
package/dist/router/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { n as createRouteRegistry } from "../manifest-
|
|
2
|
-
import { a as isSafeHref } from "../csp-nonce-
|
|
1
|
+
import { n as createRouteRegistry } from "../manifest-D6rfj_jC.js";
|
|
2
|
+
import { a as isSafeHref } from "../csp-nonce-BBxq1zq4.js";
|
|
3
3
|
import { jsx } from "../jsx-runtime.js";
|
|
4
4
|
import { o as addRouteBasePath, y as getActiveRouteBasePath } from "../route-matching-Bo6UqG-5.js";
|
|
5
|
-
import { a as group, c as route, i as fallback, n as resolveDeferredValues, o as index, r as routeData, s as page, t as Resolve } from "../deferred-
|
|
6
|
-
import { S as RouteDataLoadError, a as resolveRouteRequest, b as lazy, f as defer, g as Outlet, h as currentAuth, p as isDeferred, x as lazyRouteData } from "../resolution-
|
|
7
|
-
import { n as onRouteChange, t as currentRoute } from "../activity-
|
|
8
|
-
import { a as serializeRouteMeta, c as getCurrentHref, d as parseTargetUrl, h as syncRegisteredRouteSnapshot, i as resolveRouteMeta, l as getRegisteredAppsSnapshot, m as syncAppRegistrationLocation, n as navigate, p as setCurrentRouteLocation, r as reconcileRouteMeta, s as saveScrollPosition, u as getWindowHref } from "../navigate-
|
|
9
|
-
import { o as mergeProps } from "../compose-ref-
|
|
10
|
-
import { t as applyInteractionPolicy } from "../interactions-
|
|
5
|
+
import { a as group, c as route, i as fallback, n as resolveDeferredValues, o as index, r as routeData, s as page, t as Resolve } from "../deferred-BS0Xpstg.js";
|
|
6
|
+
import { S as RouteDataLoadError, a as resolveRouteRequest, b as lazy, f as defer, g as Outlet, h as currentAuth, p as isDeferred, x as lazyRouteData } from "../resolution-D8PgnTzh.js";
|
|
7
|
+
import { n as onRouteChange, t as currentRoute } from "../activity-BshyLB3_.js";
|
|
8
|
+
import { a as serializeRouteMeta, c as getCurrentHref, d as parseTargetUrl, h as syncRegisteredRouteSnapshot, i as resolveRouteMeta, l as getRegisteredAppsSnapshot, m as syncAppRegistrationLocation, n as navigate, p as setCurrentRouteLocation, r as reconcileRouteMeta, s as saveScrollPosition, u as getWindowHref } from "../navigate-CECCMPAr.js";
|
|
9
|
+
import { o as mergeProps } from "../compose-ref-1Fhs7mbF.js";
|
|
10
|
+
import { t as applyInteractionPolicy } from "../interactions-B4XaFxt1.js";
|
|
11
11
|
//#region src/router/route-query.ts
|
|
12
12
|
function getRouteQueryHistoryMode(options) {
|
|
13
13
|
if (options.history) return options.history;
|
|
@@ -51,9 +51,11 @@ function updateRouteQuery(updates, options = {}) {
|
|
|
51
51
|
}
|
|
52
52
|
//#endregion
|
|
53
53
|
//#region src/router/policy.ts
|
|
54
|
+
/** Policy decision: allow the route to render. */
|
|
54
55
|
function allow() {
|
|
55
56
|
return { kind: "allow" };
|
|
56
57
|
}
|
|
58
|
+
/** Policy decision: redirect the visitor to `to`. */
|
|
57
59
|
function redirect(to, init = {}) {
|
|
58
60
|
return {
|
|
59
61
|
kind: "redirect",
|
|
@@ -62,18 +64,22 @@ function redirect(to, init = {}) {
|
|
|
62
64
|
...init.replace !== void 0 ? { replace: init.replace } : {}
|
|
63
65
|
};
|
|
64
66
|
}
|
|
67
|
+
/** Policy decision: deny the request with the given HTTP status. */
|
|
65
68
|
function deny(status) {
|
|
66
69
|
return {
|
|
67
70
|
kind: "deny",
|
|
68
71
|
status
|
|
69
72
|
};
|
|
70
73
|
}
|
|
74
|
+
/** Policy decision: deny with 401 Unauthorized. */
|
|
71
75
|
function unauthorized() {
|
|
72
76
|
return deny(401);
|
|
73
77
|
}
|
|
78
|
+
/** Policy decision: deny with 403 Forbidden. */
|
|
74
79
|
function forbidden() {
|
|
75
80
|
return deny(403);
|
|
76
81
|
}
|
|
82
|
+
/** Policy decision: deny with 404 Not Found. */
|
|
77
83
|
function notFound() {
|
|
78
84
|
return deny(404);
|
|
79
85
|
}
|
|
@@ -117,6 +123,7 @@ function appendSearchValue(query, key, value) {
|
|
|
117
123
|
function formatSearchIssues(issues) {
|
|
118
124
|
return issues.map((issue) => `${issue.path.length ? issue.path.join(".") : "search"}: ${issue.message}`).join("; ");
|
|
119
125
|
}
|
|
126
|
+
/** Build a {@link RouteDestination} (with a computed `href`) for a {@link RouteRef} and params/search. */
|
|
120
127
|
function to(route, params, search) {
|
|
121
128
|
const path = addRouteBasePath(buildPath(route, params), route.basePath ?? "");
|
|
122
129
|
const parsedSearch = route.searchSchema?.safeParse(search ?? {});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as enqueueRuntimeLane } from "./access-
|
|
1
|
+
import { t as enqueueRuntimeLane } from "./access-d_DCdwqn.js";
|
|
2
2
|
import { i as claimHookIndex, p as getCurrentInstance } from "./component-scope-4I3yEMkb.js";
|
|
3
|
-
import { c as markReadableUsage, f as syncDerivedDependencySubscriptions, l as notifyReadableReaders, o as markReactivePropsDirtySource, p as withDerivedReadTracking, r as clearDerivedDependencySubscriptions, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-
|
|
3
|
+
import { c as markReadableUsage, f as syncDerivedDependencySubscriptions, l as notifyReadableReaders, o as markReactivePropsDirtySource, p as withDerivedReadTracking, r as clearDerivedDependencySubscriptions, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-BsdGWsDE.js";
|
|
4
4
|
//#region src/runtime/selector-store.ts
|
|
5
5
|
const dirtySelectorRecords = /* @__PURE__ */ new Set();
|
|
6
6
|
let hasPendingSelectorFlush = false;
|
|
@@ -170,8 +170,8 @@ function notifySelectorLaneValueChange(lane, prevValue, nextValue) {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
function recomputeSelectorSourceRecord(record, notifyDownstream) {
|
|
173
|
-
if (!record._dirty && record._hasValue) return record._value;
|
|
174
173
|
if (record._evaluating) throw new Error("selector() cannot read itself recursively");
|
|
174
|
+
if (!record._dirty && record._hasValue) return record._value;
|
|
175
175
|
record._evaluating = true;
|
|
176
176
|
record._dirty = false;
|
|
177
177
|
record._pendingDependencySources = /* @__PURE__ */ new Set();
|
|
@@ -236,6 +236,7 @@ function createSelectorHook(instance, generation, store, hookIndex, source, equa
|
|
|
236
236
|
if (!lane) throw new Error("selector() binding could not be established.");
|
|
237
237
|
const sourceRef = getCandidateSource(lane, candidate);
|
|
238
238
|
recordReadableRead(sourceRef);
|
|
239
|
+
if (record._evaluating) throw new Error("selector() cannot read itself recursively");
|
|
239
240
|
const current = record._dirty || !record._hasValue ? recomputeSelectorSourceRecord(record, record._scheduled) : record._value;
|
|
240
241
|
return lane._equals(current, candidate);
|
|
241
242
|
};
|
package/dist/ssg/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { At as RouteRegistry, St as RouteOptions, Tt as RoutePolicy, an as DocumentRenderArgs, gt as RouteHandler, on as DocumentRenderContext, sn as DocumentRenderer, un as SSRStyleRegistrationValidation, wt as RoutePathParams } from "../index-KQ7Vl4-8.js";
|
|
2
2
|
import { AuthRequirement } from "@askrjs/auth";
|
|
3
3
|
import "node:fs/promises";
|
|
4
4
|
//#region src/ssg/types.d.ts
|
|
5
|
+
/** Whether an SSG run rebuilds every route (`full`) or only changed ones (`incremental`). */
|
|
5
6
|
type SSGMode = 'full' | 'incremental';
|
|
7
|
+
/** Outcome of generating a single route's static HTML. */
|
|
6
8
|
type RouteRenderStatus = 'success' | 'error' | 'skipped' | 'removed';
|
|
9
|
+
/** Why a route was rendered, skipped, or removed during generation. */
|
|
7
10
|
type RouteRenderReason = 'full' | 'changed-key' | 'changed-route' | 'new-route' | 'no-keys' | 'unchanged' | 'deleted' | 'runtime-only';
|
|
8
11
|
type RouteConfigParams<Path extends string> = string extends Path ? Record<string, string> : RoutePathParams<Path>;
|
|
9
12
|
/**
|
|
@@ -66,6 +69,7 @@ interface SSGBaseOptions {
|
|
|
66
69
|
/** Preferred render parallelism. `'auto'` resolves from the host machine. */
|
|
67
70
|
parallelism?: number | 'auto';
|
|
68
71
|
}
|
|
72
|
+
/** A static file or directory to copy alongside generated routes. */
|
|
69
73
|
interface SSGAssetSource {
|
|
70
74
|
/** Source file or directory. Relative paths resolve from the current working directory. */
|
|
71
75
|
from: string;
|
package/dist/ssg/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "../access-
|
|
2
|
-
import { n as createRouteRegistry } from "../manifest-
|
|
1
|
+
import "../access-d_DCdwqn.js";
|
|
2
|
+
import { n as createRouteRegistry } from "../manifest-D6rfj_jC.js";
|
|
3
3
|
import { o as addRouteBasePath } from "../route-matching-Bo6UqG-5.js";
|
|
4
|
-
import { c as route, n as resolveDeferredValues } from "../deferred-
|
|
5
|
-
import { S as RouteDataLoadError, c as prepareRouteHydrationData, t as bindResolvedRouteData, v as getRenderHandler, y as _preloadRouteHandler } from "../resolution-
|
|
4
|
+
import { c as route, n as resolveDeferredValues } from "../deferred-BS0Xpstg.js";
|
|
5
|
+
import { S as RouteDataLoadError, c as prepareRouteHydrationData, t as bindResolvedRouteData, v as getRenderHandler, y as _preloadRouteHandler } from "../resolution-D8PgnTzh.js";
|
|
6
6
|
import { n as renderDocument } from "../ssr-DSHd_Q9K.js";
|
|
7
|
-
import { n as renderToString } from "../ssr-
|
|
7
|
+
import { n as renderToString } from "../ssr-8_vHDWqV.js";
|
|
8
8
|
import * as fs from "node:fs/promises";
|
|
9
9
|
import * as pathModule from "node:path";
|
|
10
10
|
import * as os from "node:os";
|
package/dist/ssr/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as JSXElement, s as Props } from "../types-
|
|
3
|
-
import { O as QueryPrefetchContext, _ as CoreTelemetry, n as ServerQueryRegistry, v as DataRuntime } from "../index-2bk8nldG.js";
|
|
1
|
+
import { At as RouteRegistry, Dt as RouteRecord, E as SSRPortalState, Pt as RouteRequestResult, Rt as CoreTelemetry, T as DeferredBoundaryRegistration, Yt as QueryPrefetchContext, an as DocumentRenderArgs, c as ServerQueryRegistry, cn as SSRData, et as AccessDenyDecision, gt as RouteHandler, ln as SSRStyleRegistration, lt as Route, nt as AccessRedirectDecision, on as DocumentRenderContext, sn as DocumentRenderer, un as SSRStyleRegistrationValidation, ut as RouteAuthOptions, zt as DataRuntime } from "../index-KQ7Vl4-8.js";
|
|
2
|
+
import { r as JSXElement, s as Props } from "../types-DkVJhVs9.js";
|
|
4
3
|
import { AuthContext } from "@askrjs/auth";
|
|
5
4
|
//#region src/common/page-render-envelope.d.ts
|
|
6
5
|
declare const PAGE_RENDER_ENVELOPE_VERSION: 1;
|
|
@@ -45,6 +44,7 @@ interface RenderContext {
|
|
|
45
44
|
ssrPortals: SSRPortalState;
|
|
46
45
|
cspNonce?: string;
|
|
47
46
|
}
|
|
47
|
+
/** Build a fresh SSR render context (data cache, routes, seed) for a render pass. */
|
|
48
48
|
declare function createRenderContext(seed?: number, opts?: {
|
|
49
49
|
url?: string;
|
|
50
50
|
data?: SSRData;
|
|
@@ -65,6 +65,7 @@ declare function createRenderContext(seed?: number, opts?: {
|
|
|
65
65
|
* Concurrency-safe in Node.js via AsyncLocalStorage.
|
|
66
66
|
*/
|
|
67
67
|
declare function withRenderContext<T>(ctx: RenderContext, fn: () => T): T;
|
|
68
|
+
/** Run `fn` with `ctx` as the active SSR render context, using async-local storage. */
|
|
68
69
|
declare function withRenderContextAsync<T>(ctx: RenderContext, fn: () => T | PromiseLike<T>): Promise<T>;
|
|
69
70
|
/**
|
|
70
71
|
* Get the current render context.
|
|
@@ -73,6 +74,7 @@ declare function withRenderContextAsync<T>(ctx: RenderContext, fn: () => T | Pro
|
|
|
73
74
|
declare function getRenderContext(): RenderContext | null;
|
|
74
75
|
//#endregion
|
|
75
76
|
//#region src/ssr/route-render.d.ts
|
|
77
|
+
/** A single path-to-handler route binding accepted by low-level SSR route rendering. */
|
|
76
78
|
type SSRRoute = {
|
|
77
79
|
path: string;
|
|
78
80
|
handler: RouteHandler;
|
|
@@ -100,6 +102,7 @@ type RouteStreamOptions = RouteRenderOptions & {
|
|
|
100
102
|
onChunk(html: string): void;
|
|
101
103
|
onComplete(): void;
|
|
102
104
|
};
|
|
105
|
+
/** Resolve a URL against a route registry for SSR, applying auth/policies before render. */
|
|
103
106
|
declare function resolveRequest(opts: {
|
|
104
107
|
url: string;
|
|
105
108
|
registry: RouteRegistry;
|
|
@@ -127,6 +130,7 @@ type SSRComponent = (props: Props, context?: {
|
|
|
127
130
|
}) => VNode | JSXElement | string | number | boolean | null | undefined;
|
|
128
131
|
//#endregion
|
|
129
132
|
//#region src/ssr/render-sync.d.ts
|
|
133
|
+
/** Synchronously render a component to an HTML string, without route resolution. */
|
|
130
134
|
declare function renderToStringSync(component: (props?: Record<string, unknown>) => VNode | JSXElement | string | number | boolean | null | undefined, props?: Record<string, unknown>, options?: {
|
|
131
135
|
seed?: number;
|
|
132
136
|
data?: SSRData;
|
|
@@ -138,6 +142,7 @@ declare function renderToStringSync(component: (props?: Record<string, unknown>)
|
|
|
138
142
|
}): string;
|
|
139
143
|
//#endregion
|
|
140
144
|
//#region src/ssr/render-resolved.d.ts
|
|
145
|
+
/** Synchronously render an already-resolved route handler to an HTML string. */
|
|
141
146
|
declare function renderResolvedToStringSync(opts: {
|
|
142
147
|
url: string;
|
|
143
148
|
registry: RouteRegistry;
|
|
@@ -153,6 +158,7 @@ declare function renderResolvedToStringSync(opts: {
|
|
|
153
158
|
}): string;
|
|
154
159
|
//#endregion
|
|
155
160
|
//#region src/ssr/route-request-render.d.ts
|
|
161
|
+
/** Options for {@link renderRouteRequest} and {@link renderRouteRequestToString}. */
|
|
156
162
|
interface RenderRouteRequestOptions {
|
|
157
163
|
url: string;
|
|
158
164
|
registry: RouteRegistry;
|
|
@@ -170,6 +176,7 @@ interface RenderRouteRequestOptions {
|
|
|
170
176
|
telemetry?: CoreTelemetry;
|
|
171
177
|
cspNonce?: string;
|
|
172
178
|
}
|
|
179
|
+
/** Outcome of rendering a route request for SSR: a render, redirect, deny, or no-match. */
|
|
173
180
|
type RenderRouteRequestResult = {
|
|
174
181
|
kind: 'render';
|
|
175
182
|
html: string;
|
|
@@ -180,12 +187,18 @@ type RenderRouteRequestResult = {
|
|
|
180
187
|
} | AccessRedirectDecision | AccessDenyDecision | {
|
|
181
188
|
kind: 'no-match';
|
|
182
189
|
};
|
|
190
|
+
/** Resolve and render a route request for SSR, streaming the body when possible. */
|
|
183
191
|
declare function renderRouteRequest(options: RenderRouteRequestOptions): Promise<RenderRouteRequestResult>;
|
|
192
|
+
/** Resolve and render a route request for SSR, always fully buffering the HTML. */
|
|
184
193
|
declare function renderRouteRequestToString(options: RenderRouteRequestOptions): Promise<RenderRouteRequestResult>;
|
|
185
194
|
//#endregion
|
|
186
195
|
//#region src/ssr/index-internal.d.ts
|
|
196
|
+
/**
|
|
197
|
+
* Render a component or route request to a complete HTML string, synchronously.
|
|
198
|
+
*/
|
|
187
199
|
declare function renderToString(component: (props?: Record<string, unknown>) => VNode | JSXElement | string | number | null): string;
|
|
188
200
|
declare function renderToString(opts: RouteRenderOptions): string;
|
|
201
|
+
/** Stream a route request's rendered HTML to the response sink described by `opts`. */
|
|
189
202
|
declare function renderToStream(opts: RouteStreamOptions): void;
|
|
190
203
|
//#endregion
|
|
191
204
|
export { type DocumentRenderArgs, type DocumentRenderContext, type DocumentRenderer, type RenderRouteRequestOptions, type RenderRouteRequestResult, type SSRComponent, SSRDataMissingError, type SSRRoute, type SSRStyleRegistration, type SSRStyleRegistrationValidation, type VNode, createRenderContext, getRenderContext, renderResolvedToStringSync, renderRouteRequest, renderRouteRequestToString, renderToStream, renderToString, renderToStringSync, resolveRequest, withRenderContext, withRenderContextAsync };
|
package/dist/ssr/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { C as SSRDataMissingError } from "../render-context-B7ohlh6t.js";
|
|
2
|
-
import { a as renderResolvedToStringSync, c as createRenderContext, d as withRenderContextAsync, i as renderRouteRequestToString, l as getRenderContext, n as renderToString, o as renderToStringSync, r as renderRouteRequest, s as resolveRequest, t as renderToStream, u as withRenderContext } from "../ssr-
|
|
2
|
+
import { a as renderResolvedToStringSync, c as createRenderContext, d as withRenderContextAsync, i as renderRouteRequestToString, l as getRenderContext, n as renderToString, o as renderToStringSync, r as renderRouteRequest, s as resolveRequest, t as renderToStream, u as withRenderContext } from "../ssr-8_vHDWqV.js";
|
|
3
3
|
export { SSRDataMissingError, createRenderContext, getRenderContext, renderResolvedToStringSync, renderRouteRequest, renderRouteRequestToString, renderToStream, renderToString, renderToStringSync, resolveRequest, withRenderContext, withRenderContextAsync };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { t as __CONTROL_BOUNDARY__ } from "./control-C-ApnFs1.js";
|
|
2
2
|
import { t as __ERROR_BOUNDARY__ } from "./vnode-D24p6IW2.js";
|
|
3
|
-
import { y as logger } from "./access-
|
|
3
|
+
import { y as logger } from "./access-d_DCdwqn.js";
|
|
4
4
|
import { f as getCurrentComponentInstance, w as setCurrentComponentInstance } from "./component-scope-4I3yEMkb.js";
|
|
5
|
-
import { i as isFragmentType, n as Fragment, t as ELEMENT_TYPE } from "./jsx-
|
|
6
|
-
import { g as markVNodeTreeWithContextFrame, m as getVNodeContextFrame, n as createComponentInstance, p as getExecutionContextFrame, u as callWithContext } from "./component-internal-
|
|
7
|
-
import { t as cleanupComponent } from "./component-cleanup-
|
|
8
|
-
import { p as isPromiseLike } from "./lifecycle-batch-
|
|
9
|
-
import { _ as setControlBoundaryContextFrame, g as evaluateShowState, h as evaluateCaseState, i as evaluateForState, o as rollbackForStateTransaction, r as commitForStateTransaction } from "./for-internal-
|
|
5
|
+
import { i as isFragmentType, n as Fragment, t as ELEMENT_TYPE } from "./jsx-DRS-qjiN.js";
|
|
6
|
+
import { g as markVNodeTreeWithContextFrame, m as getVNodeContextFrame, n as createComponentInstance, p as getExecutionContextFrame, u as callWithContext } from "./component-internal-DOVVMjG7.js";
|
|
7
|
+
import { t as cleanupComponent } from "./component-cleanup-hrqSikl2.js";
|
|
8
|
+
import { p as isPromiseLike } from "./lifecycle-batch-BH0fax4F.js";
|
|
9
|
+
import { _ as setControlBoundaryContextFrame, g as evaluateShowState, h as evaluateCaseState, i as evaluateForState, o as rollbackForStateTransaction, r as commitForStateTransaction } from "./for-internal-jrliHZmF.js";
|
|
10
10
|
import { C as SSRDataMissingError, _ as isEmptyPageRenderEnvelope, f as stopRenderPhase$1, h as createPageRenderEnvelope, t as configureRenderContextProvider, u as startRenderPhase$1, v as isPageRenderEnvelope, x as withHydrationRenderUrl } from "./render-context-B7ohlh6t.js";
|
|
11
11
|
import { n as getPublicAttributeName, t as sanitizeCssValue } from "./css-BuPaTOfe.js";
|
|
12
|
-
import { o as isUnsafeUrlAttribute, r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-
|
|
12
|
+
import { o as isUnsafeUrlAttribute, r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-BBxq1zq4.js";
|
|
13
13
|
import { n as SSR_PORTAL_HOST, t as SSR_PORTAL_ANCHOR } from "./portal-w3oQ6oQU.js";
|
|
14
|
-
import { t as createDataRuntime } from "./data-runtime-
|
|
15
|
-
import { c as withTelemetry, i as dehydrateDataRuntime, t as createQueryPrefetchContext } from "./query-registry-
|
|
14
|
+
import { t as createDataRuntime } from "./data-runtime-JxoRgrrt.js";
|
|
15
|
+
import { c as withTelemetry, i as dehydrateDataRuntime, t as createQueryPrefetchContext } from "./query-registry-CimB1YeW.js";
|
|
16
16
|
import { a as resolveRouteFromRoutes, c as removeRouteBasePath, s as normalizeRouteBasePath, t as _resolveRouteMatchFromRoutes } from "./route-matching-Bo6UqG-5.js";
|
|
17
|
-
import { a as resolveRouteRequest, d as DEFERRED_BOUNDARY, l as validateRouteHydrationData, o as getRouteHydrationMetadata, p as isDeferred } from "./resolution-
|
|
17
|
+
import { a as resolveRouteRequest, d as DEFERRED_BOUNDARY, l as validateRouteHydrationData, o as getRouteHydrationMetadata, p as isDeferred } from "./resolution-D8PgnTzh.js";
|
|
18
18
|
import { n as disposeRegisteredDefaultPortalScope, r as getDefaultPortalHost } from "./default-portal-runtime-DvMvWJVp.js";
|
|
19
19
|
import { n as renderDocument, t as SSR_RENDER_DATA_ATTR } from "./ssr-DSHd_Q9K.js";
|
|
20
20
|
//#region src/ssr/escape.ts
|
|
@@ -182,6 +182,7 @@ function ensureRenderContextAccessor() {
|
|
|
182
182
|
}
|
|
183
183
|
} catch {}
|
|
184
184
|
}
|
|
185
|
+
/** Build a fresh SSR render context (data cache, routes, seed) for a render pass. */
|
|
185
186
|
function createRenderContext(seed = 12345, opts = {}) {
|
|
186
187
|
clearEscapeCache();
|
|
187
188
|
const queryCache = /* @__PURE__ */ new Map();
|
|
@@ -257,6 +258,7 @@ async function getAsyncRenderContextAccessor() {
|
|
|
257
258
|
})();
|
|
258
259
|
return asyncRenderContextAccessor;
|
|
259
260
|
}
|
|
261
|
+
/** Run `fn` with `ctx` as the active SSR render context, using async-local storage. */
|
|
260
262
|
async function withRenderContextAsync(ctx, fn) {
|
|
261
263
|
const accessor = await getAsyncRenderContextAccessor();
|
|
262
264
|
if (accessor) return accessor.run(ctx, () => Promise.resolve(fn()));
|
|
@@ -428,6 +430,7 @@ var StreamSink = class {
|
|
|
428
430
|
};
|
|
429
431
|
//#endregion
|
|
430
432
|
//#region src/ssr/route-render.ts
|
|
433
|
+
/** Resolve a URL against a route registry for SSR, applying auth/policies before render. */
|
|
431
434
|
async function resolveRequest(opts) {
|
|
432
435
|
if (!opts?.registry) throw new TypeError("resolveRequest requires opts.registry.");
|
|
433
436
|
const { url, auth, authContext, request, signal } = opts;
|
|
@@ -1184,6 +1187,7 @@ function renderNodeSyncToSink(node, sink, ctx) {
|
|
|
1184
1187
|
renderChildrenSyncToSink(children, sink, ctx);
|
|
1185
1188
|
sinkWrite3(sink, "</", typeStr, ">");
|
|
1186
1189
|
}
|
|
1190
|
+
/** Synchronously render a component to an HTML string, without route resolution. */
|
|
1187
1191
|
function renderToStringSync(component, props, options) {
|
|
1188
1192
|
const seed = options?.seed ?? 12345;
|
|
1189
1193
|
const nonce = validateCspNonce(options?.cspNonce);
|
|
@@ -1250,6 +1254,7 @@ function sameRouteParams(left, right) {
|
|
|
1250
1254
|
for (const key of leftKeys) if (left[key] !== right[key]) return false;
|
|
1251
1255
|
return true;
|
|
1252
1256
|
}
|
|
1257
|
+
/** Synchronously render an already-resolved route handler to an HTML string. */
|
|
1253
1258
|
function renderResolvedToStringSync(opts) {
|
|
1254
1259
|
const { url, registry, handler, params, options } = opts;
|
|
1255
1260
|
const routes = registry.routes;
|
|
@@ -1402,9 +1407,11 @@ function createDeferredRenderStream(initialHtml, boundaries, signal, seed, data,
|
|
|
1402
1407
|
}
|
|
1403
1408
|
});
|
|
1404
1409
|
}
|
|
1410
|
+
/** Resolve and render a route request for SSR, streaming the body when possible. */
|
|
1405
1411
|
async function renderRouteRequest(options) {
|
|
1406
1412
|
return renderRouteRequestInternal(options);
|
|
1407
1413
|
}
|
|
1414
|
+
/** Resolve and render a route request for SSR, always fully buffering the HTML. */
|
|
1408
1415
|
async function renderRouteRequestToString(options) {
|
|
1409
1416
|
const result = await renderRouteRequestInternal(options);
|
|
1410
1417
|
if (result.kind !== "render" || !result.stream) return result;
|
|
@@ -1490,6 +1497,7 @@ function renderToString(arg) {
|
|
|
1490
1497
|
if (typeof arg === "function") return renderToStringSync(arg);
|
|
1491
1498
|
return renderRouteToString(arg, routeRenderHost);
|
|
1492
1499
|
}
|
|
1500
|
+
/** Stream a route request's rendered HTML to the response sink described by `opts`. */
|
|
1493
1501
|
function renderToStream(opts) {
|
|
1494
1502
|
renderRouteToStream(opts, routeRenderHost);
|
|
1495
1503
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as isProductionEnvironment } from "./access-
|
|
2
|
-
import { n as isBulkCommitActive, t as deferBulkCommitReadableNotification } from "./fastlane-
|
|
1
|
+
import { S as isProductionEnvironment } from "./access-d_DCdwqn.js";
|
|
2
|
+
import { n as isBulkCommitActive, t as deferBulkCommitReadableNotification } from "./fastlane-DGo7SxBQ.js";
|
|
3
3
|
import { i as claimHookIndex, p as getCurrentInstance } from "./component-scope-4I3yEMkb.js";
|
|
4
|
-
import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-
|
|
4
|
+
import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-BsdGWsDE.js";
|
|
5
5
|
//#region src/runtime/state.ts
|
|
6
6
|
/**
|
|
7
7
|
* State primitive for Askr components
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { o as getRuntimeRenderer } from "./access-
|
|
1
|
+
import { o as getRuntimeRenderer } from "./access-d_DCdwqn.js";
|
|
2
2
|
import { f as getCurrentComponentInstance, m as getCurrentPortalScope } from "./component-scope-4I3yEMkb.js";
|
|
3
|
-
import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-
|
|
4
|
-
import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-
|
|
5
|
-
import { t as cleanupComponent } from "./component-cleanup-
|
|
6
|
-
import { c as getCurrentLifecycleCommitBatch, u as registerLifecycleTransaction } from "./lifecycle-batch-
|
|
3
|
+
import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-DRS-qjiN.js";
|
|
4
|
+
import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-BsdGWsDE.js";
|
|
5
|
+
import { t as cleanupComponent } from "./component-cleanup-hrqSikl2.js";
|
|
6
|
+
import { c as getCurrentLifecycleCommitBatch, u as registerLifecycleTransaction } from "./lifecycle-batch-BH0fax4F.js";
|
|
7
7
|
import { n as getActiveRenderContext } from "./render-context-B7ohlh6t.js";
|
|
8
8
|
import { i as createSSRPortalHostToken, n as SSR_PORTAL_HOST, r as createSSRPortalAnchorToken, t as SSR_PORTAL_ANCHOR } from "./portal-w3oQ6oQU.js";
|
|
9
9
|
import { i as registerDefaultPortalRuntime } from "./default-portal-runtime-DvMvWJVp.js";
|
|
10
10
|
//#region src/jsx/utils.ts
|
|
11
|
+
/** Check whether `value` is a JSX element vnode. */
|
|
11
12
|
function isElement(value) {
|
|
12
13
|
return typeof value === "object" && value !== null && value.$$typeof === ELEMENT_TYPE;
|
|
13
14
|
}
|
|
15
|
+
/** Clone a JSX element, shallow-merging `props` over its existing props. */
|
|
14
16
|
function cloneElement(element, props) {
|
|
15
17
|
return {
|
|
16
18
|
$$typeof: element.$$typeof,
|
|
@@ -24,6 +26,10 @@ function cloneElement(element, props) {
|
|
|
24
26
|
}
|
|
25
27
|
//#endregion
|
|
26
28
|
//#region src/foundations/structures/layout.tsx
|
|
29
|
+
/**
|
|
30
|
+
* Wrap a {@link LayoutComponent} so it can be invoked as `(children, props)`,
|
|
31
|
+
* matching route layout conventions.
|
|
32
|
+
*/
|
|
27
33
|
function layout(Layout) {
|
|
28
34
|
return (children, props) => {
|
|
29
35
|
return Layout({
|
|
@@ -171,6 +177,7 @@ function createPortalSlot() {
|
|
|
171
177
|
}
|
|
172
178
|
};
|
|
173
179
|
}
|
|
180
|
+
/** Create a new named {@link Portal} channel with its own host and content. */
|
|
174
181
|
function definePortal() {
|
|
175
182
|
const ssrPortalKey = {};
|
|
176
183
|
if (typeof createPortalSlot === "function") {
|
|
@@ -456,6 +463,10 @@ function clearDefaultPortalForInstance(instance) {
|
|
|
456
463
|
state.owner = null;
|
|
457
464
|
detachDefaultPortalHostOutput(state);
|
|
458
465
|
}
|
|
466
|
+
/**
|
|
467
|
+
* The implicit portal channel that {@link Portal} writes to and that any
|
|
468
|
+
* host rendered without an explicit portal falls back to.
|
|
469
|
+
*/
|
|
459
470
|
const DefaultPortal = (() => {
|
|
460
471
|
function Host(props) {
|
|
461
472
|
const serverHost = createSSRPortalHost(DEFAULT_SSR_PORTAL_KEY, props?.__askrAutoDefaultPortal === true);
|
|
@@ -481,6 +492,7 @@ const DefaultPortal = (() => {
|
|
|
481
492
|
};
|
|
482
493
|
return Host;
|
|
483
494
|
})();
|
|
495
|
+
/** Write children to the {@link DefaultPortal} host wherever it is rendered. */
|
|
484
496
|
function Portal(props) {
|
|
485
497
|
if (writeSSRPortal(DEFAULT_SSR_PORTAL_KEY, props.children)) return createSSRPortalAnchor();
|
|
486
498
|
const owner = getCurrentComponentInstance();
|
|
@@ -497,6 +509,7 @@ registerDefaultPortalRuntime({
|
|
|
497
509
|
});
|
|
498
510
|
//#endregion
|
|
499
511
|
//#region src/foundations/structures/collection.ts
|
|
512
|
+
/** Create an empty, insertion-ordered {@link Collection} registry. */
|
|
500
513
|
function createCollection() {
|
|
501
514
|
const registry = /* @__PURE__ */ new Map();
|
|
502
515
|
function register(node, metadata) {
|
|
@@ -545,6 +558,7 @@ function createCollection() {
|
|
|
545
558
|
*/
|
|
546
559
|
//#endregion
|
|
547
560
|
//#region src/foundations/structures/layer.ts
|
|
561
|
+
/** Create a new, empty {@link LayerManager} for coordinating overlay stacking. */
|
|
548
562
|
function createLayer() {
|
|
549
563
|
const stack = [];
|
|
550
564
|
let nextId = 1;
|