@askrjs/askr 0.0.85 → 0.0.87
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 +60 -0
- package/capabilities.json +25 -0
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.js +2 -2
- package/dist/{activity-Jd9CgEa3.js → activity-BnkhdIXm.js} +3 -3
- package/dist/{activity-B1I5HJQI.d.ts → activity-DNYL__cW.d.ts} +1 -1
- package/dist/benchmark.js +5 -5
- package/dist/boot/index.d.ts +3 -3
- package/dist/boot/index.js +1 -1
- package/dist/{boot-DWe880Et.js → boot-Bd-j_BL5.js} +15 -14
- package/dist/{component-internal-DcrLymUJ.js → component-internal-uVCJAre6.js} +1 -1
- package/dist/control/index.js +1 -1
- package/dist/{control-oLADku43.js → control-BF3geQKh.js} +1 -1
- package/dist/{csp-nonce-Bc52OIVc.js → csp-nonce-CUscoNF1.js} +1 -1
- package/dist/data/index.d.ts +1 -1
- package/dist/data/index.js +3 -3
- package/dist/{data-Dkqb8_QP.js → data-CXZ-FOa7.js} +6 -3
- package/dist/{data-runtime-D68YOo9L.js → data-runtime-CnVeSvJz.js} +7 -5
- package/dist/default-portal-runtime-DvMvWJVp.js +20 -0
- package/dist/{authoring-DdQ3pHqt.js → deferred-_DaSfpsr.js} +81 -4
- package/dist/{for-internal-B_mnQhan.js → for-internal-Dxf3iZ9E.js} +1 -1
- package/dist/foundations/index.d.ts +1 -1
- package/dist/foundations/index.js +1 -2
- package/dist/foundations/structures/index.d.ts +1 -1
- package/dist/foundations/structures/index.js +1 -2
- package/dist/{index-pIgGaXvS.d.ts → index-BvNkcegT.d.ts} +1 -1
- package/dist/{index-Bkh9S9-t.d.ts → index-DflhL1h8.d.ts} +15 -15
- package/dist/{index-5S-fi2xy.d.ts → index-SGxMZLAc.d.ts} +3 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -7
- package/dist/{lifecycle-operations-BrYrBsXY.js → lifecycle-operations-DTO93Hrl.js} +1 -1
- package/dist/manifest-D1P9uTlz.js +53 -0
- package/dist/{navigate-NyIjQUwI.d.ts → navigate-B_fcLDAG.d.ts} +1 -1
- package/dist/{navigate-b4GGxO_l.js → navigate-DSATWfHh.js} +8 -8
- package/dist/{query-registry-BL6rjGsO.js → query-registry-p_0kkieE.js} +1 -1
- package/dist/render-context-D0Hoj9dW.js +161 -0
- package/dist/{renderer-CZzNtoj2.js → renderer-BGMaUrVj.js} +10 -7
- package/dist/{deferred-vUOy-awa.js → resolution-BRmiFYvw.js} +61 -231
- package/dist/resource-operation-B94oj6xT.js +304 -0
- package/dist/resources/index.d.ts +2 -2
- package/dist/resources/index.js +4 -4
- package/dist/{route-matching-DHduNiGk.js → route-matching-DqULzZtC.js} +2 -276
- package/dist/router/index.d.ts +8 -6
- package/dist/router/index.js +7 -6
- package/dist/ssg/index.d.ts +1 -1
- package/dist/ssg/index.js +5 -4
- package/dist/ssr/index.d.ts +2 -2
- package/dist/ssr/index.js +2 -2
- package/dist/{ssr-CpiBHMNv.js → ssr-q250YlKo.js} +36 -18
- package/dist/{portal-BVWjAhNQ.js → structures-DsOm-clq.js} +232 -3
- package/dist/testing/index.d.ts +17 -3
- package/dist/testing/index.js +42 -4
- package/dist/{verify-hydration-C3QBBQqR.js → verify-hydration-DkISyZCo.js} +4 -3
- package/package.json +3 -2
- package/dist/render-context-D-DFk2WN.js +0 -73
- package/dist/structures-DSLF_iis.js +0 -223
|
@@ -1,278 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { f as getCurrentComponentInstance } from "./component-scope-DzJEbYGE.js";
|
|
3
|
-
import { c as registerCommitOperationForInstance, d as getCurrentContextFrame, v as withAsyncResourceContext } from "./component-internal-DcrLymUJ.js";
|
|
4
|
-
import { p as isPromiseLike } from "./lifecycle-batch-Dfpid9-A.js";
|
|
5
|
-
import { t as brandSnapshotSource } from "./snapshot-source-BB42xgwb.js";
|
|
6
|
-
import { d as SSRDataMissingError, i as getNextRenderKey, n as getActiveRenderContext, r as getCurrentRenderData, u as throwSSRDataMissing } from "./render-context-D-DFk2WN.js";
|
|
7
|
-
import { t as state } from "./state-DCjONcHK.js";
|
|
8
|
-
//#region src/runtime/resource-cell.ts
|
|
9
|
-
/**
|
|
10
|
-
* Pure, component-agnostic ResourceCell state machine.
|
|
11
|
-
* - Holds value/pending/error/generation/controller
|
|
12
|
-
* - Exposes a stable `snapshot` object: { value, pending, error, refresh }
|
|
13
|
-
* - Uses `withAsyncResourceContext` to bind the synchronous execution step
|
|
14
|
-
* to a captured frame. Continuations after await do not see the frame.
|
|
15
|
-
*/
|
|
16
|
-
var ResourceCell = class {
|
|
17
|
-
constructor(fn, deps, resourceFrame) {
|
|
18
|
-
this.value = null;
|
|
19
|
-
this.pending = true;
|
|
20
|
-
this.error = null;
|
|
21
|
-
this.generation = 0;
|
|
22
|
-
this.controller = null;
|
|
23
|
-
this.deps = null;
|
|
24
|
-
this.resourceFrame = null;
|
|
25
|
-
this.subscribers = /* @__PURE__ */ new Set();
|
|
26
|
-
this.disposed = false;
|
|
27
|
-
this.fn = fn;
|
|
28
|
-
this.deps = deps ? deps.slice() : null;
|
|
29
|
-
this.resourceFrame = resourceFrame;
|
|
30
|
-
this.snapshot = brandSnapshotSource({
|
|
31
|
-
value: null,
|
|
32
|
-
pending: true,
|
|
33
|
-
error: null,
|
|
34
|
-
refresh: () => this.refresh()
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
setLoader(fn) {
|
|
38
|
-
this.fn = fn;
|
|
39
|
-
}
|
|
40
|
-
subscribe(cb) {
|
|
41
|
-
this.subscribers.add(cb);
|
|
42
|
-
return () => this.subscribers.delete(cb);
|
|
43
|
-
}
|
|
44
|
-
notifySubscribers() {
|
|
45
|
-
this.snapshot.value = this.value;
|
|
46
|
-
this.snapshot.pending = this.pending;
|
|
47
|
-
this.snapshot.error = this.error;
|
|
48
|
-
for (const cb of this.subscribers) cb();
|
|
49
|
-
}
|
|
50
|
-
start(ssr = false, notify = true) {
|
|
51
|
-
if (this.disposed) return;
|
|
52
|
-
const generation = this.generation;
|
|
53
|
-
this.controller?.abort();
|
|
54
|
-
const controller = new AbortController();
|
|
55
|
-
this.controller = controller;
|
|
56
|
-
this.pending = true;
|
|
57
|
-
this.error = null;
|
|
58
|
-
if (notify) this.notifySubscribers();
|
|
59
|
-
let result;
|
|
60
|
-
try {
|
|
61
|
-
result = withAsyncResourceContext(this.resourceFrame, () => this.fn({ signal: controller.signal }));
|
|
62
|
-
} catch (err) {
|
|
63
|
-
this.pending = false;
|
|
64
|
-
this.error = err instanceof Error ? err : new Error(String(err));
|
|
65
|
-
if (notify) this.notifySubscribers();
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (!isPromiseLike(result)) {
|
|
69
|
-
this.value = result;
|
|
70
|
-
this.pending = false;
|
|
71
|
-
this.error = null;
|
|
72
|
-
if (notify) this.notifySubscribers();
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (ssr) throwSSRDataMissing();
|
|
76
|
-
Promise.resolve(result).then((val) => {
|
|
77
|
-
if (this.generation !== generation) return;
|
|
78
|
-
if (this.controller !== controller) return;
|
|
79
|
-
if (controller.signal.aborted) return;
|
|
80
|
-
this.value = val;
|
|
81
|
-
this.pending = false;
|
|
82
|
-
this.error = null;
|
|
83
|
-
this.notifySubscribers();
|
|
84
|
-
}).catch((err) => {
|
|
85
|
-
if (this.generation !== generation) return;
|
|
86
|
-
if (this.controller !== controller) return;
|
|
87
|
-
if (controller.signal.aborted || err instanceof Error && err.name === "AbortError" || typeof DOMException !== "undefined" && err instanceof DOMException && err.name === "AbortError") return;
|
|
88
|
-
this.pending = false;
|
|
89
|
-
this.error = err instanceof Error ? err : new Error(String(err));
|
|
90
|
-
try {
|
|
91
|
-
if (this.ownerName) logger.error(`[Askr] Async resource error in ${this.ownerName}:`, err);
|
|
92
|
-
else logger.error("[Askr] Async resource error:", err);
|
|
93
|
-
} catch {}
|
|
94
|
-
this.notifySubscribers();
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
refresh() {
|
|
98
|
-
if (this.disposed) return;
|
|
99
|
-
this.generation++;
|
|
100
|
-
this.controller?.abort();
|
|
101
|
-
this.start();
|
|
102
|
-
}
|
|
103
|
-
abort() {
|
|
104
|
-
this.controller?.abort();
|
|
105
|
-
}
|
|
106
|
-
dispose() {
|
|
107
|
-
if (this.disposed) return;
|
|
108
|
-
this.disposed = true;
|
|
109
|
-
this.controller?.abort();
|
|
110
|
-
this.subscribers.clear();
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
//#endregion
|
|
114
|
-
//#region src/runtime/resource-operation.ts
|
|
115
|
-
/**
|
|
116
|
-
* Resource primitive — simple, deterministic async primitive
|
|
117
|
-
* Usage: resource(fn, deps)
|
|
118
|
-
* - fn receives { signal }
|
|
119
|
-
* - captures execution context once at creation (synchronous step only)
|
|
120
|
-
* - executes at most once per generation; stale async results are ignored
|
|
121
|
-
* - refresh() cancels in-flight execution, increments generation and re-runs
|
|
122
|
-
* - exposes { value, pending, error, refresh }
|
|
123
|
-
* - during SSR, async results are disallowed and will throw synchronously
|
|
124
|
-
*/
|
|
125
|
-
function resource(fn, deps = []) {
|
|
126
|
-
const instance = getCurrentComponentInstance();
|
|
127
|
-
const inst = instance;
|
|
128
|
-
if (!instance) {
|
|
129
|
-
const renderData = getCurrentRenderData()?.resources;
|
|
130
|
-
if (renderData && (getActiveRenderContext()?.resourceDataProvided || Object.keys(renderData).some((key) => key.startsWith("r:")))) {
|
|
131
|
-
const key = getNextRenderKey();
|
|
132
|
-
if (!(key in renderData)) throwSSRDataMissing();
|
|
133
|
-
const val = renderData[key];
|
|
134
|
-
return brandSnapshotSource({
|
|
135
|
-
value: val,
|
|
136
|
-
pending: false,
|
|
137
|
-
error: null,
|
|
138
|
-
refresh: () => {}
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
if (getActiveRenderContext()) throwSSRDataMissing();
|
|
142
|
-
throw new Error("[Askr] resource() must be called during component render inside an app. Do not create resources at module scope or outside render.");
|
|
143
|
-
}
|
|
144
|
-
const renderData = getCurrentRenderData()?.resources;
|
|
145
|
-
if (renderData && (getActiveRenderContext()?.resourceDataProvided || Object.keys(renderData).some((key) => key.startsWith("r:")))) {
|
|
146
|
-
const key = getNextRenderKey();
|
|
147
|
-
if (!(key in renderData)) throwSSRDataMissing();
|
|
148
|
-
const val = renderData[key];
|
|
149
|
-
const h = state({
|
|
150
|
-
cell: void 0,
|
|
151
|
-
snapshot: brandSnapshotSource({
|
|
152
|
-
value: val,
|
|
153
|
-
pending: false,
|
|
154
|
-
error: null,
|
|
155
|
-
refresh: () => {}
|
|
156
|
-
})
|
|
157
|
-
})();
|
|
158
|
-
h.snapshot.value = val;
|
|
159
|
-
h.snapshot.pending = false;
|
|
160
|
-
h.snapshot.error = null;
|
|
161
|
-
return h.snapshot;
|
|
162
|
-
}
|
|
163
|
-
const holder = state({
|
|
164
|
-
cell: void 0,
|
|
165
|
-
snapshot: brandSnapshotSource({
|
|
166
|
-
value: null,
|
|
167
|
-
pending: true,
|
|
168
|
-
error: null,
|
|
169
|
-
refresh: () => {}
|
|
170
|
-
})
|
|
171
|
-
});
|
|
172
|
-
const h = holder();
|
|
173
|
-
if (!h.cell) {
|
|
174
|
-
const cell = new ResourceCell(fn, deps, getCurrentContextFrame());
|
|
175
|
-
cell.ownerName = inst.fn?.name || "<anonymous>";
|
|
176
|
-
h.cell = cell;
|
|
177
|
-
h.snapshot = cell.snapshot;
|
|
178
|
-
const unsubscribe = cell.subscribe(() => {
|
|
179
|
-
const cur = holder();
|
|
180
|
-
cur.snapshot.value = cell.snapshot.value;
|
|
181
|
-
cur.snapshot.pending = cell.snapshot.pending;
|
|
182
|
-
cur.snapshot.error = cell.snapshot.error;
|
|
183
|
-
holder.set(cur);
|
|
184
|
-
try {
|
|
185
|
-
inst.notifyUpdate?.();
|
|
186
|
-
} catch {}
|
|
187
|
-
});
|
|
188
|
-
(inst.cleanupFns ??= []).push(() => {
|
|
189
|
-
unsubscribe();
|
|
190
|
-
cell.dispose();
|
|
191
|
-
});
|
|
192
|
-
if (inst.ssr) {
|
|
193
|
-
cell.start(true, false);
|
|
194
|
-
if (!cell.pending) {
|
|
195
|
-
const cur = holder();
|
|
196
|
-
cur.snapshot.value = cell.value;
|
|
197
|
-
cur.snapshot.pending = cell.pending;
|
|
198
|
-
cur.snapshot.error = cell.error;
|
|
199
|
-
}
|
|
200
|
-
} else {
|
|
201
|
-
const scheduledGeneration = cell.generation;
|
|
202
|
-
registerCommitOperationForInstance(inst, () => {
|
|
203
|
-
enqueueRuntimeLane("post", () => {
|
|
204
|
-
if (!inst.notifyUpdate || cell.generation !== scheduledGeneration) return;
|
|
205
|
-
try {
|
|
206
|
-
cell.start(false, false);
|
|
207
|
-
} catch (err) {
|
|
208
|
-
const cur = holder();
|
|
209
|
-
cur.snapshot.value = cell.value;
|
|
210
|
-
cur.snapshot.pending = cell.pending;
|
|
211
|
-
cur.snapshot.error = err ?? null;
|
|
212
|
-
holder.set(cur);
|
|
213
|
-
inst.notifyUpdate?.();
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
if (!cell.pending) {
|
|
217
|
-
const cur = holder();
|
|
218
|
-
cur.snapshot.value = cell.value;
|
|
219
|
-
cur.snapshot.pending = cell.pending;
|
|
220
|
-
cur.snapshot.error = cell.error;
|
|
221
|
-
holder.set(cur);
|
|
222
|
-
inst.notifyUpdate?.();
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
const cell = h.cell;
|
|
229
|
-
cell.setLoader(fn);
|
|
230
|
-
if (!cell.deps || cell.deps.length !== deps.length || cell.deps.some((d, i) => !Object.is(d, deps[i]))) {
|
|
231
|
-
cell.deps = deps.slice();
|
|
232
|
-
cell.generation++;
|
|
233
|
-
cell.pending = true;
|
|
234
|
-
cell.error = null;
|
|
235
|
-
h.snapshot.pending = true;
|
|
236
|
-
h.snapshot.error = null;
|
|
237
|
-
try {
|
|
238
|
-
if (inst.ssr) {
|
|
239
|
-
cell.start(true, false);
|
|
240
|
-
if (!cell.pending) {
|
|
241
|
-
const cur = holder();
|
|
242
|
-
cur.snapshot.value = cell.value;
|
|
243
|
-
cur.snapshot.pending = cell.pending;
|
|
244
|
-
cur.snapshot.error = cell.error;
|
|
245
|
-
}
|
|
246
|
-
} else {
|
|
247
|
-
const scheduledGeneration = cell.generation;
|
|
248
|
-
registerCommitOperationForInstance(inst, () => {
|
|
249
|
-
enqueueRuntimeLane("post", () => {
|
|
250
|
-
if (!inst.notifyUpdate || cell.generation !== scheduledGeneration) return;
|
|
251
|
-
cell.start(false, false);
|
|
252
|
-
if (!cell.pending) {
|
|
253
|
-
const cur = holder();
|
|
254
|
-
cur.snapshot.value = cell.value;
|
|
255
|
-
cur.snapshot.pending = cell.pending;
|
|
256
|
-
cur.snapshot.error = cell.error;
|
|
257
|
-
holder.set(cur);
|
|
258
|
-
inst.notifyUpdate?.();
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
} catch (err) {
|
|
264
|
-
if (err instanceof SSRDataMissingError) throw err;
|
|
265
|
-
cell.error = err;
|
|
266
|
-
cell.pending = false;
|
|
267
|
-
const cur = holder();
|
|
268
|
-
cur.snapshot.value = cell.value;
|
|
269
|
-
cur.snapshot.pending = cell.pending;
|
|
270
|
-
cur.snapshot.error = cell.error;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
return h.snapshot;
|
|
274
|
-
}
|
|
275
|
-
//#endregion
|
|
1
|
+
import { n as getActiveRenderContext } from "./render-context-D0Hoj9dW.js";
|
|
276
2
|
//#region src/router/match.ts
|
|
277
3
|
function splitPathSegments(path) {
|
|
278
4
|
const normalized = path.endsWith("/") && path !== "/" ? path.slice(0, -1) : path;
|
|
@@ -827,4 +553,4 @@ function _resolveRouteMatchFromRoutes(pathname, routeList) {
|
|
|
827
553
|
return findBestResolvedRouteFromRoutes(pathname, routeList);
|
|
828
554
|
}
|
|
829
555
|
//#endregion
|
|
830
|
-
export { getDefaultRouteBasePath as A, setDefaultRouteBasePath as B, getCurrentInheritedPolicies as C, getCurrentPathPrefix as D, getCurrentPageScope as E, insertRecordSorted as F,
|
|
556
|
+
export { getDefaultRouteBasePath as A, setDefaultRouteBasePath as B, getCurrentInheritedPolicies as C, getCurrentPathPrefix as D, getCurrentPageScope as E, insertRecordSorted as F, computeRank as H, lockRouteRegistration as I, pushRegistrationScope as L, getRouteRecords as M, hasActivePageScope as N, getCurrentScopeKind as O, hasRegisteredRoutes as P, restoreRouteState as R, getCurrentInheritedMeta as S, getCurrentPageChain as T, normalizeRouteSegmentName as U, snapshotRouteState as V, parseSegments as W, clearRouteState as _, resolveRouteFromRoutes as a, getActiveRoutes as b, removeRouteBasePath as c, deepFreeze as d, makeQuery as f, assertRouteRegistrationUnlocked as g, addRouteToStores as h, getMatchingRouteRecord as i, getRouteList as j, getDefaultRouteAuthOptions as k, buildRouteContext as l, _setActiveRouteAuthOptions as m, computeMatchesFromRoutes as n, addRouteBasePath as o, parseLocation as p, computeRouteActivityMatches as r, normalizeRouteBasePath as s, _resolveRouteMatchFromRoutes as t, buildRouteContextBase as u, getActiveRouteAuthOptions as v, getCurrentLayoutChain as w, getCurrentInheritedAuthRequirements as x, getActiveRouteBasePath as y, setDefaultRouteAuthOptions as z };
|
package/dist/router/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { u as RenderableChild } from "../control-DhUZU4_V.js";
|
|
2
2
|
import { r as JSXElement, s as Props } from "../jsx-Dvr2SGRG.js";
|
|
3
|
-
import { A as RouteHandler, B as RouteQuery, C as Route, D as RouteContext, E as RouteComponent, F as RouteMode, G as RouteRegistryOptions, H as RouteRef, I as RouteOptions, J as RouteRequestResult, K as RouteRenderResult, L as RouteParams, M as RouteMatch, N as RouteMeta, O as RouteDefinition, P as RouteMetaSource, R as RoutePathParams, S as ParsedSegment, T as RouteAuthResolver, U as RouteRefSearch, V as RouteRecord, W as RouteRegistry, X as RouteSearchValue, Y as RouteSearch, Z as RouteSnapshot, _ as AccessRedirectStatus, b as PageHelperOptions, f as AccessAllowDecision, g as AccessRedirectDecision, h as AccessDenyStatus, j as RouteManifest, k as RouteDestination, m as AccessDenyDecision, p as AccessDecision, q as RouteRequestOptions, v as GroupHelperOptions, w as RouteAuthOptions, x as PageScopeRecord, y as LayoutScopeRecord, z as RoutePolicy } from "../index-
|
|
3
|
+
import { A as RouteHandler, B as RouteQuery, C as Route, D as RouteContext, E as RouteComponent, F as RouteMode, G as RouteRegistryOptions, H as RouteRef, I as RouteOptions, J as RouteRequestResult, K as RouteRenderResult, L as RouteParams, M as RouteMatch, N as RouteMeta, O as RouteDefinition, P as RouteMetaSource, R as RoutePathParams, S as ParsedSegment, T as RouteAuthResolver, U as RouteRefSearch, V as RouteRecord, W as RouteRegistry, X as RouteSearchValue, Y as RouteSearch, Z as RouteSnapshot, _ as AccessRedirectStatus, b as PageHelperOptions, f as AccessAllowDecision, g as AccessRedirectDecision, h as AccessDenyStatus, j as RouteManifest, k as RouteDestination, m as AccessDenyDecision, p as AccessDecision, q as RouteRequestOptions, v as GroupHelperOptions, w as RouteAuthOptions, x as PageScopeRecord, y as LayoutScopeRecord, z as RoutePolicy } from "../index-BvNkcegT.js";
|
|
4
4
|
import "../types-C9YcqVpk.js";
|
|
5
|
-
import { a as ScrollRestorationOptions, i as NavigationScrollBehavior, n as NavigateOptions, r as HistoryScrollBehavior, t as navigate } from "../navigate-
|
|
6
|
-
import { i as onRouteChange, n as RouteChangeOptions, r as currentRoute, t as RouteChangeCleanup } from "../activity-
|
|
5
|
+
import { a as ScrollRestorationOptions, i as NavigationScrollBehavior, n as NavigateOptions, r as HistoryScrollBehavior, t as navigate } from "../navigate-B_fcLDAG.js";
|
|
6
|
+
import { i as onRouteChange, n as RouteChangeOptions, r as currentRoute, t as RouteChangeCleanup } from "../activity-DNYL__cW.js";
|
|
7
7
|
import { AuthContext, AuthContext as AuthContext$1, AuthRequirement, AuthRequirement as AuthRequirement$1 } from "@askrjs/auth";
|
|
8
8
|
import { ObjectSchema } from "@askrjs/schema";
|
|
9
9
|
//#region src/router/route-query.d.ts
|
|
@@ -81,7 +81,7 @@ declare function resolveRouteMeta(record: RouteRecord, context: RouteContext): P
|
|
|
81
81
|
declare function reconcileRouteMeta(meta: Readonly<RouteMeta>, target?: Document): void;
|
|
82
82
|
declare function serializeRouteMeta(meta: RouteMeta): string;
|
|
83
83
|
//#endregion
|
|
84
|
-
//#region src/
|
|
84
|
+
//#region src/common/deferred-value.d.ts
|
|
85
85
|
declare const DEFERRED_VALUE: unique symbol;
|
|
86
86
|
type DeferredState = 'pending' | 'fulfilled' | 'rejected';
|
|
87
87
|
interface Deferred<T> {
|
|
@@ -91,14 +91,16 @@ interface Deferred<T> {
|
|
|
91
91
|
readonly promise: Promise<T>;
|
|
92
92
|
readonly [DEFERRED_VALUE]: true;
|
|
93
93
|
}
|
|
94
|
+
declare function defer<T>(promise: PromiseLike<T>): Deferred<T>;
|
|
95
|
+
declare function isDeferred<T = unknown>(value: unknown): value is Deferred<T>;
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/router/deferred.d.ts
|
|
94
98
|
interface ResolveProps<T> {
|
|
95
99
|
value: Deferred<T>;
|
|
96
100
|
pending?: RenderableChild;
|
|
97
101
|
rejected?: RenderableChild | ((error: unknown) => RenderableChild);
|
|
98
102
|
children: (value: T) => RenderableChild;
|
|
99
103
|
}
|
|
100
|
-
declare function defer<T>(promise: PromiseLike<T>): Deferred<T>;
|
|
101
|
-
declare function isDeferred<T = unknown>(value: unknown): value is Deferred<T>;
|
|
102
104
|
declare function resolveDeferredValues<T>(input: T, signal?: AbortSignal): Promise<T>;
|
|
103
105
|
declare function routeData<T>(): T;
|
|
104
106
|
declare function Resolve<T>(props: ResolveProps<T>): JSXElement;
|
package/dist/router/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as isSafeHref } from "../csp-nonce-Bc52OIVc.js";
|
|
1
|
+
import { n as createRouteRegistry } from "../manifest-D1P9uTlz.js";
|
|
2
|
+
import { a as isSafeHref } from "../csp-nonce-CUscoNF1.js";
|
|
4
3
|
import { jsx } from "../jsx-runtime.js";
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
7
|
-
import { a as
|
|
4
|
+
import { o as addRouteBasePath, y as getActiveRouteBasePath } from "../route-matching-DqULzZtC.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-_DaSfpsr.js";
|
|
6
|
+
import { a as resolveRouteRequest, b as lazy, f as defer, g as Outlet, h as currentAuth, p as isDeferred } from "../resolution-BRmiFYvw.js";
|
|
7
|
+
import { n as onRouteChange, t as currentRoute } from "../activity-BnkhdIXm.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-DSATWfHh.js";
|
|
8
9
|
import { o as mergeProps } from "../compose-ref-Cc_YkUpM.js";
|
|
9
10
|
import { t as applyInteractionPolicy } from "../interactions-DgGQyUQv.js";
|
|
10
11
|
//#region src/router/route-query.ts
|
package/dist/ssg/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as SSRStyleRegistrationValidation, f as DocumentRenderArgs, m as DocumentRenderer, p as DocumentRenderContext } from "../control-DhUZU4_V.js";
|
|
2
|
-
import { A as RouteHandler, I as RouteOptions, R as RoutePathParams, W as RouteRegistry, z as RoutePolicy } from "../index-
|
|
2
|
+
import { A as RouteHandler, I as RouteOptions, R as RoutePathParams, W as RouteRegistry, z as RoutePolicy } from "../index-BvNkcegT.js";
|
|
3
3
|
import { AuthRequirement } from "@askrjs/auth";
|
|
4
4
|
import "node:fs/promises";
|
|
5
5
|
//#region src/ssg/types.d.ts
|
package/dist/ssg/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import "../access-Dpfoi4cA.js";
|
|
2
|
-
import {
|
|
3
|
-
import { o as addRouteBasePath } from "../route-matching-
|
|
4
|
-
import {
|
|
2
|
+
import { n as createRouteRegistry } from "../manifest-D1P9uTlz.js";
|
|
3
|
+
import { o as addRouteBasePath } from "../route-matching-DqULzZtC.js";
|
|
4
|
+
import { c as route, n as resolveDeferredValues } from "../deferred-_DaSfpsr.js";
|
|
5
|
+
import { c as prepareRouteHydrationData, t as bindResolvedRouteData, v as getRenderHandler, y as _preloadRouteHandler } from "../resolution-BRmiFYvw.js";
|
|
5
6
|
import { n as renderDocument } from "../ssr-DSHd_Q9K.js";
|
|
6
|
-
import { n as renderToString } from "../ssr-
|
|
7
|
+
import { n as renderToString } from "../ssr-q250YlKo.js";
|
|
7
8
|
import * as fs from "node:fs/promises";
|
|
8
9
|
import * as pathModule from "node:path";
|
|
9
10
|
import * as os from "node:os";
|
package/dist/ssr/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as SSRStyleRegistrationValidation, f as DocumentRenderArgs, g as SSRStyleRegistration, h as SSRData, m as DocumentRenderer, p as DocumentRenderContext } from "../control-DhUZU4_V.js";
|
|
2
2
|
import { r as JSXElement, s as Props } from "../jsx-Dvr2SGRG.js";
|
|
3
|
-
import { A as RouteHandler, C as Route, J as RouteRequestResult, V as RouteRecord, W as RouteRegistry, g as AccessRedirectDecision, l as DeferredBoundaryRegistration, m as AccessDenyDecision, u as SSRPortalState, w as RouteAuthOptions } from "../index-
|
|
4
|
-
import { D as QueryPrefetchContext, _ as CoreTelemetry, n as ServerQueryRegistry, v as DataRuntime } from "../index-
|
|
3
|
+
import { A as RouteHandler, C as Route, J as RouteRequestResult, V as RouteRecord, W as RouteRegistry, g as AccessRedirectDecision, l as DeferredBoundaryRegistration, m as AccessDenyDecision, u as SSRPortalState, w as RouteAuthOptions } from "../index-BvNkcegT.js";
|
|
4
|
+
import { D as QueryPrefetchContext, _ as CoreTelemetry, n as ServerQueryRegistry, v as DataRuntime } from "../index-SGxMZLAc.js";
|
|
5
5
|
import { AuthContext } from "@askrjs/auth";
|
|
6
6
|
//#region src/common/page-render-envelope.d.ts
|
|
7
7
|
declare const PAGE_RENDER_ENVELOPE_VERSION: 1;
|
package/dist/ssr/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
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-
|
|
1
|
+
import { x as SSRDataMissingError } from "../render-context-D0Hoj9dW.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-q250YlKo.js";
|
|
3
3
|
export { SSRDataMissingError, createRenderContext, getRenderContext, renderResolvedToStringSync, renderRouteRequest, renderRouteRequestToString, renderToStream, renderToString, renderToStringSync, resolveRequest, withRenderContext, withRenderContextAsync };
|
|
@@ -3,20 +3,19 @@ import { t as __ERROR_BOUNDARY__ } from "./vnode-D24p6IW2.js";
|
|
|
3
3
|
import { v as logger } from "./access-Dpfoi4cA.js";
|
|
4
4
|
import { f as getCurrentComponentInstance, w as setCurrentComponentInstance } from "./component-scope-DzJEbYGE.js";
|
|
5
5
|
import { i as isFragmentType, n as Fragment, t as ELEMENT_TYPE } from "./jsx-C3IECePB.js";
|
|
6
|
-
import { f as getExecutionContextFrame, h as markVNodeTreeWithContextFrame, l as callWithContext, n as createComponentInstance, p as getVNodeContextFrame } from "./component-internal-
|
|
6
|
+
import { f as getExecutionContextFrame, h as markVNodeTreeWithContextFrame, l as callWithContext, n as createComponentInstance, p as getVNodeContextFrame } from "./component-internal-uVCJAre6.js";
|
|
7
7
|
import { t as cleanupComponent } from "./component-cleanup-BUfUleGZ.js";
|
|
8
8
|
import { p as isPromiseLike } from "./lifecycle-batch-Dfpid9-A.js";
|
|
9
|
-
import { _ as setControlBoundaryContextFrame, g as evaluateShowState, h as evaluateCaseState, i as evaluateForState, o as rollbackForStateTransaction, r as commitForStateTransaction } from "./for-internal-
|
|
10
|
-
import { _ as
|
|
11
|
-
import { d as SSRDataMissingError, l as stopRenderPhase$1, s as startRenderPhase$1, t as configureRenderContextProvider } from "./render-context-D-DFk2WN.js";
|
|
12
|
-
import { a as resolveRouteFromRoutes, c as removeRouteBasePath, s as normalizeRouteBasePath, t as _resolveRouteMatchFromRoutes } from "./route-matching-DHduNiGk.js";
|
|
13
|
-
import { n as SSR_PORTAL_HOST, t as SSR_PORTAL_ANCHOR } from "./portal-w3oQ6oQU.js";
|
|
14
|
-
import { a as disposeDefaultPortalScope, t as DefaultPortal } from "./portal-BVWjAhNQ.js";
|
|
9
|
+
import { _ as setControlBoundaryContextFrame, g as evaluateShowState, h as evaluateCaseState, i as evaluateForState, o as rollbackForStateTransaction, r as commitForStateTransaction } from "./for-internal-Dxf3iZ9E.js";
|
|
10
|
+
import { _ as isPageRenderEnvelope, f as stopRenderPhase$1, g as isEmptyPageRenderEnvelope, h as createPageRenderEnvelope, t as configureRenderContextProvider, u as startRenderPhase$1, x as SSRDataMissingError } from "./render-context-D0Hoj9dW.js";
|
|
15
11
|
import { n as getPublicAttributeName, t as sanitizeCssValue } from "./css-BuPaTOfe.js";
|
|
16
|
-
import { o as isUnsafeUrlAttribute, r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-
|
|
17
|
-
import { t as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
12
|
+
import { o as isUnsafeUrlAttribute, r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-CUscoNF1.js";
|
|
13
|
+
import { n as SSR_PORTAL_HOST, t as SSR_PORTAL_ANCHOR } from "./portal-w3oQ6oQU.js";
|
|
14
|
+
import { t as createDataRuntime } from "./data-runtime-CnVeSvJz.js";
|
|
15
|
+
import { c as withTelemetry, i as dehydrateDataRuntime, t as createQueryPrefetchContext } from "./query-registry-p_0kkieE.js";
|
|
16
|
+
import { a as resolveRouteFromRoutes, c as removeRouteBasePath, s as normalizeRouteBasePath, t as _resolveRouteMatchFromRoutes } from "./route-matching-DqULzZtC.js";
|
|
17
|
+
import { a as resolveRouteRequest, d as DEFERRED_BOUNDARY, l as validateRouteHydrationData, o as getRouteHydrationMetadata, p as isDeferred } from "./resolution-BRmiFYvw.js";
|
|
18
|
+
import { n as disposeRegisteredDefaultPortalScope, r as getDefaultPortalHost } from "./default-portal-runtime-DvMvWJVp.js";
|
|
20
19
|
import { n as renderDocument, t as SSR_RENDER_DATA_ATTR } from "./ssr-DSHd_Q9K.js";
|
|
21
20
|
//#region src/ssr/escape.ts
|
|
22
21
|
/**
|
|
@@ -556,7 +555,7 @@ function executeComponentSync(component, props, ctx, ownerFrame = null) {
|
|
|
556
555
|
cleanupError = error;
|
|
557
556
|
}
|
|
558
557
|
try {
|
|
559
|
-
|
|
558
|
+
disposeRegisteredDefaultPortalScope(temp);
|
|
560
559
|
} catch (error) {
|
|
561
560
|
if (cleanupError) throw new AggregateError([cleanupError, error], "SSR temporary owner cleanup failed");
|
|
562
561
|
throw error;
|
|
@@ -597,7 +596,7 @@ function wrapWithDefaultPortal(out) {
|
|
|
597
596
|
if (isPromiseLike(out)) throwSSRDataMissing();
|
|
598
597
|
const portalVNode = {
|
|
599
598
|
$$typeof: ELEMENT_TYPE,
|
|
600
|
-
type:
|
|
599
|
+
type: getDefaultPortalHost(),
|
|
601
600
|
props: { __askrAutoDefaultPortal: true },
|
|
602
601
|
key: "__default_portal"
|
|
603
602
|
};
|
|
@@ -743,6 +742,9 @@ const escapedAttrValueCache = /* @__PURE__ */ new Map();
|
|
|
743
742
|
function isEventHandler(key) {
|
|
744
743
|
return key.length >= 2 && key.slice(0, 2).toLowerCase() === "on";
|
|
745
744
|
}
|
|
745
|
+
function isAriaAttribute(key) {
|
|
746
|
+
return key.length > 5 && key.slice(0, 5).toLowerCase() === "aria-";
|
|
747
|
+
}
|
|
746
748
|
function assertAttributeName(name) {
|
|
747
749
|
if (!/^[A-Za-z_:][A-Za-z0-9_.:-]*$/.test(name)) throw new TypeError(`Invalid SSR attribute name: ${JSON.stringify(name)}`);
|
|
748
750
|
}
|
|
@@ -784,7 +786,7 @@ function renderAttrsDirect(props, sink) {
|
|
|
784
786
|
sink.write(attrName);
|
|
785
787
|
continue;
|
|
786
788
|
}
|
|
787
|
-
if (value ===
|
|
789
|
+
if (value === null || value === void 0 || value === false && !isAriaAttribute(attrName)) continue;
|
|
788
790
|
const strValue = String(value);
|
|
789
791
|
if (isUnsafeUrlAttribute(attrName, strValue)) continue;
|
|
790
792
|
sink.write(" ");
|
|
@@ -818,7 +820,7 @@ function renderAttrs(props, opts) {
|
|
|
818
820
|
continue;
|
|
819
821
|
}
|
|
820
822
|
if (value === true) attrParts.push(` ${attrName}`);
|
|
821
|
-
else if (value ===
|
|
823
|
+
else if (value === null || value === void 0 || value === false && !isAriaAttribute(attrName)) continue;
|
|
822
824
|
else {
|
|
823
825
|
const strValue = String(value);
|
|
824
826
|
if (isUnsafeUrlAttribute(attrName, strValue)) continue;
|
|
@@ -1258,11 +1260,27 @@ function renderResolvedToStringSync(opts) {
|
|
|
1258
1260
|
...route,
|
|
1259
1261
|
handler
|
|
1260
1262
|
} : route);
|
|
1263
|
+
const matchedRoute = routes[matchedIndex];
|
|
1261
1264
|
return renderToString({
|
|
1262
1265
|
url,
|
|
1263
|
-
registry:
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
+
registry: {
|
|
1267
|
+
manifest: {
|
|
1268
|
+
records: registry.manifest.records.map((record) => {
|
|
1269
|
+
const effectiveHandler = record.path === matchedRoute.path && record.handler === matchedRoute.handler && record.options.namespace === matchedRoute.namespace ? handler : record.handler;
|
|
1270
|
+
return {
|
|
1271
|
+
...record,
|
|
1272
|
+
component: effectiveHandler,
|
|
1273
|
+
handler: effectiveHandler,
|
|
1274
|
+
layoutChain: [],
|
|
1275
|
+
pageChain: [],
|
|
1276
|
+
options: record.options.namespace ? { namespace: record.options.namespace } : {},
|
|
1277
|
+
metaChain: void 0
|
|
1278
|
+
};
|
|
1279
|
+
}),
|
|
1280
|
+
...registry.manifest.basePath ? { basePath: registry.manifest.basePath } : {}
|
|
1281
|
+
},
|
|
1282
|
+
routes: effectiveRoutes
|
|
1283
|
+
},
|
|
1266
1284
|
seed: options?.seed,
|
|
1267
1285
|
data: options?.data,
|
|
1268
1286
|
dataRuntime: options?.dataRuntime,
|