@askrjs/askr 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/fx.js +636 -0
  2. package/dist/fx.js.map +1 -0
  3. package/dist/index.js +3709 -42
  4. package/dist/index.js.map +1 -1
  5. package/dist/{jsx/jsx-dev-runtime.d.ts → jsx-dev-runtime.d.ts} +3 -3
  6. package/dist/jsx-dev-runtime.js +17 -0
  7. package/dist/jsx-dev-runtime.js.map +1 -0
  8. package/dist/jsx-runtime.d.ts +14 -0
  9. package/dist/{chunk-SALJX5PZ.js → jsx-runtime.js} +6 -9
  10. package/dist/jsx-runtime.js.map +1 -0
  11. package/dist/{fx/index.cjs → resources.js} +45 -453
  12. package/dist/resources.js.map +1 -0
  13. package/dist/{router/index.d.ts → router.d.ts} +2 -2
  14. package/dist/{router/index.cjs → router.js} +14 -116
  15. package/dist/router.js.map +1 -0
  16. package/dist/{ssr/index.d.ts → ssr.d.ts} +2 -2
  17. package/dist/{ssr/index.cjs → ssr.js} +17 -150
  18. package/dist/ssr.js.map +1 -0
  19. package/dist/{types-CZHOAiC1.d.ts → types-uOPfcrdz.d.ts} +3 -1
  20. package/dist/vite/index.d.ts +17 -0
  21. package/dist/vite/index.js +2306 -0
  22. package/dist/vite/index.js.map +1 -0
  23. package/package.json +19 -23
  24. package/dist/chunk-64C7W2AE.js +0 -43
  25. package/dist/chunk-64C7W2AE.js.map +0 -1
  26. package/dist/chunk-6FLMH4EL.js +0 -124
  27. package/dist/chunk-6FLMH4EL.js.map +0 -1
  28. package/dist/chunk-FJUXFA72.js +0 -16
  29. package/dist/chunk-FJUXFA72.js.map +0 -1
  30. package/dist/chunk-SALJX5PZ.js.map +0 -1
  31. package/dist/chunk-VRAEBIJ3.js +0 -82
  32. package/dist/chunk-VRAEBIJ3.js.map +0 -1
  33. package/dist/chunk-WTFWRSHB.js +0 -98
  34. package/dist/chunk-WTFWRSHB.js.map +0 -1
  35. package/dist/chunk-XHKZGJE3.js +0 -2907
  36. package/dist/chunk-XHKZGJE3.js.map +0 -1
  37. package/dist/chunk-Z5ZSTLYF.js +0 -420
  38. package/dist/chunk-Z5ZSTLYF.js.map +0 -1
  39. package/dist/fx/index.cjs.map +0 -1
  40. package/dist/fx/index.d.ts +0 -186
  41. package/dist/fx/index.js +0 -418
  42. package/dist/fx/index.js.map +0 -1
  43. package/dist/index.cjs +0 -4035
  44. package/dist/index.cjs.map +0 -1
  45. package/dist/index.d.cts +0 -168
  46. package/dist/jsx/jsx-dev-runtime.cjs +0 -46
  47. package/dist/jsx/jsx-dev-runtime.cjs.map +0 -1
  48. package/dist/jsx/jsx-dev-runtime.d.cts +0 -12
  49. package/dist/jsx/jsx-dev-runtime.js +0 -19
  50. package/dist/jsx/jsx-dev-runtime.js.map +0 -1
  51. package/dist/jsx/jsx-runtime.cjs +0 -54
  52. package/dist/jsx/jsx-runtime.cjs.map +0 -1
  53. package/dist/jsx/jsx-runtime.d.cts +0 -21
  54. package/dist/jsx/jsx-runtime.d.ts +0 -21
  55. package/dist/jsx/jsx-runtime.js +0 -16
  56. package/dist/jsx/jsx-runtime.js.map +0 -1
  57. package/dist/jsx-AzPM8gMS.d.cts +0 -35
  58. package/dist/navigate-LUVYHYZZ.js +0 -17
  59. package/dist/navigate-LUVYHYZZ.js.map +0 -1
  60. package/dist/resources/index.cjs +0 -1200
  61. package/dist/resources/index.cjs.map +0 -1
  62. package/dist/resources/index.d.ts +0 -21
  63. package/dist/resources/index.js +0 -278
  64. package/dist/resources/index.js.map +0 -1
  65. package/dist/route-BCND6MPK.js +0 -32
  66. package/dist/route-BCND6MPK.js.map +0 -1
  67. package/dist/router/index.cjs.map +0 -1
  68. package/dist/router/index.d.cts +0 -64
  69. package/dist/router/index.js +0 -49
  70. package/dist/router/index.js.map +0 -1
  71. package/dist/router-DaGtH1Sq.d.cts +0 -36
  72. package/dist/ssr/index.cjs.map +0 -1
  73. package/dist/ssr/index.d.cts +0 -123
  74. package/dist/ssr/index.js +0 -666
  75. package/dist/ssr/index.js.map +0 -1
  76. package/dist/types-CZ5sWur5.d.cts +0 -23
  77. package/src/jsx/index.ts +0 -4
  78. package/src/jsx/jsx-dev-runtime.ts +0 -23
  79. package/src/jsx/jsx-runtime.ts +0 -48
  80. package/src/jsx/types.ts +0 -33
  81. package/src/jsx/utils.ts +0 -19
  82. /package/dist/{fx/index.d.cts → fx.d.ts} +0 -0
  83. /package/dist/{resources/index.d.cts → resources.d.ts} +0 -0
@@ -1,420 +0,0 @@
1
- import {
2
- getCurrentComponentInstance
3
- } from "./chunk-XHKZGJE3.js";
4
- import {
5
- __export
6
- } from "./chunk-FJUXFA72.js";
7
-
8
- // src/router/route.ts
9
- var route_exports = {};
10
- __export(route_exports, {
11
- _lockRouteRegistrationForTests: () => _lockRouteRegistrationForTests,
12
- _unlockRouteRegistrationForTests: () => _unlockRouteRegistrationForTests,
13
- clearRoutes: () => clearRoutes,
14
- getLoadedNamespaces: () => getLoadedNamespaces,
15
- getNamespaceRoutes: () => getNamespaceRoutes,
16
- getRoutes: () => getRoutes,
17
- lockRouteRegistration: () => lockRouteRegistration,
18
- registerRoute: () => registerRoute,
19
- resolveRoute: () => resolveRoute,
20
- route: () => route,
21
- setServerLocation: () => setServerLocation,
22
- unloadNamespace: () => unloadNamespace
23
- });
24
-
25
- // src/router/match.ts
26
- function match(path, pattern) {
27
- const normalizedPath = path.endsWith("/") && path !== "/" ? path.slice(0, -1) : path;
28
- const normalizedPattern = pattern.endsWith("/") && pattern !== "/" ? pattern.slice(0, -1) : pattern;
29
- const pathSegments = normalizedPath.split("/").filter(Boolean);
30
- const patternSegments = normalizedPattern.split("/").filter(Boolean);
31
- if (patternSegments.length === 1 && patternSegments[0] === "*") {
32
- return {
33
- matched: true,
34
- params: {
35
- "*": pathSegments.length > 1 ? normalizedPath : pathSegments[0]
36
- }
37
- };
38
- }
39
- if (pathSegments.length !== patternSegments.length) {
40
- return { matched: false, params: {} };
41
- }
42
- const params = {};
43
- for (let i = 0; i < patternSegments.length; i++) {
44
- const patternSegment = patternSegments[i];
45
- const pathSegment = pathSegments[i];
46
- if (patternSegment.startsWith("{") && patternSegment.endsWith("}")) {
47
- const paramName = patternSegment.slice(1, -1);
48
- params[paramName] = decodeURIComponent(pathSegment);
49
- } else if (patternSegment === "*") {
50
- params["*"] = pathSegment;
51
- } else if (patternSegment !== pathSegment) {
52
- return { matched: false, params: {} };
53
- }
54
- }
55
- return { matched: true, params };
56
- }
57
-
58
- // src/runtime/execution-model.ts
59
- var EXECUTION_MODEL_KEY = /* @__PURE__ */ Symbol.for("__ASKR_EXECUTION_MODEL__");
60
- function getExecutionModel() {
61
- const g = globalThis;
62
- return g[EXECUTION_MODEL_KEY];
63
- }
64
- function assertExecutionModel(model) {
65
- const g = globalThis;
66
- const cur = g[EXECUTION_MODEL_KEY];
67
- if (cur && cur !== model) {
68
- throw new Error(
69
- `[Askr] mixing execution models is not allowed (current: ${cur}, attempted: ${model}). Choose exactly one: createSPA, createSSR, or createIslands.`
70
- );
71
- }
72
- if (!cur) g[EXECUTION_MODEL_KEY] = model;
73
- }
74
-
75
- // src/router/route.ts
76
- var routes = [];
77
- var namespaces = /* @__PURE__ */ new Set();
78
- var HAS_ROUTES_KEY = /* @__PURE__ */ Symbol.for("__ASKR_HAS_ROUTES__");
79
- function setHasRoutes(value) {
80
- try {
81
- const g = globalThis;
82
- g[HAS_ROUTES_KEY] = value;
83
- } catch {
84
- }
85
- }
86
- setHasRoutes(false);
87
- var routesByDepth = /* @__PURE__ */ new Map();
88
- function getDepth(path) {
89
- const normalized = path.endsWith("/") && path !== "/" ? path.slice(0, -1) : path;
90
- return normalized === "/" ? 0 : normalized.split("/").filter(Boolean).length;
91
- }
92
- function getSpecificity(path) {
93
- const normalized = path.endsWith("/") && path !== "/" ? path.slice(0, -1) : path;
94
- if (normalized === "/*") {
95
- return 0;
96
- }
97
- const segments = normalized.split("/").filter(Boolean);
98
- let score = 0;
99
- for (const segment of segments) {
100
- if (segment.startsWith("{") && segment.endsWith("}")) {
101
- score += 2;
102
- } else if (segment === "*") {
103
- score += 1;
104
- } else {
105
- score += 3;
106
- }
107
- }
108
- return score;
109
- }
110
- var serverLocation = null;
111
- function setServerLocation(url) {
112
- serverLocation = url;
113
- }
114
- function parseLocation(url) {
115
- try {
116
- const u = new URL(url, "http://localhost");
117
- return { pathname: u.pathname, search: u.search, hash: u.hash };
118
- } catch {
119
- return { pathname: "/", search: "", hash: "" };
120
- }
121
- }
122
- function deepFreeze(obj) {
123
- if (obj && typeof obj === "object" && !Object.isFrozen(obj)) {
124
- Object.freeze(obj);
125
- for (const key of Object.keys(obj)) {
126
- const value = obj[key];
127
- if (value && typeof value === "object") deepFreeze(value);
128
- }
129
- }
130
- return obj;
131
- }
132
- function makeQuery(search) {
133
- const usp = new URLSearchParams(search || "");
134
- const mapping = /* @__PURE__ */ new Map();
135
- for (const [k, v] of usp.entries()) {
136
- const existing = mapping.get(k);
137
- if (existing) existing.push(v);
138
- else mapping.set(k, [v]);
139
- }
140
- const obj = {
141
- get(key) {
142
- const arr = mapping.get(key);
143
- return arr ? arr[0] : null;
144
- },
145
- getAll(key) {
146
- const arr = mapping.get(key);
147
- return arr ? [...arr] : [];
148
- },
149
- has(key) {
150
- return mapping.has(key);
151
- },
152
- toJSON() {
153
- const out = {};
154
- for (const [k, arr] of mapping.entries()) {
155
- out[k] = arr.length > 1 ? [...arr] : arr[0];
156
- }
157
- return out;
158
- }
159
- };
160
- return deepFreeze(obj);
161
- }
162
- function computeMatches(pathname) {
163
- const routesList = getRoutes();
164
- const matches = [];
165
- function getSpecificity2(path) {
166
- const normalized = path.endsWith("/") && path !== "/" ? path.slice(0, -1) : path;
167
- if (normalized === "/*") return 0;
168
- const segments = normalized.split("/").filter(Boolean);
169
- let score = 0;
170
- for (const segment of segments) {
171
- if (segment.startsWith("{") && segment.endsWith("}")) score += 2;
172
- else if (segment === "*") score += 1;
173
- else score += 3;
174
- }
175
- return score;
176
- }
177
- for (const r of routesList) {
178
- const result = match(pathname, r.path);
179
- if (result.matched) {
180
- matches.push({
181
- pattern: r.path,
182
- params: result.params,
183
- name: r.name,
184
- namespace: r.namespace,
185
- specificity: getSpecificity2(r.path)
186
- });
187
- }
188
- }
189
- matches.sort((a, b) => b.specificity - a.specificity);
190
- return matches.map((m) => ({
191
- path: m.pattern,
192
- params: deepFreeze({ ...m.params }),
193
- name: m.name,
194
- namespace: m.namespace
195
- }));
196
- }
197
- var registrationLocked = false;
198
- function lockRouteRegistration() {
199
- registrationLocked = true;
200
- }
201
- function _lockRouteRegistrationForTests() {
202
- registrationLocked = true;
203
- }
204
- function _unlockRouteRegistrationForTests() {
205
- registrationLocked = false;
206
- }
207
- function route(path, handler, namespace) {
208
- if (getExecutionModel() === "islands") {
209
- throw new Error(
210
- "Routes are not supported with islands. Use createSPA (client) or createSSR (server) instead."
211
- );
212
- }
213
- if (typeof path === "undefined") {
214
- const instance = getCurrentComponentInstance();
215
- if (!instance) {
216
- throw new Error(
217
- "route() can only be called during component render execution. Call route() from inside your component function."
218
- );
219
- }
220
- let pathname = "/";
221
- let search = "";
222
- let hash = "";
223
- if (typeof window !== "undefined" && window.location) {
224
- pathname = window.location.pathname || "/";
225
- search = window.location.search || "";
226
- hash = window.location.hash || "";
227
- } else if (serverLocation) {
228
- const parsed = parseLocation(serverLocation);
229
- pathname = parsed.pathname;
230
- search = parsed.search;
231
- hash = parsed.hash;
232
- }
233
- const params = deepFreeze({
234
- ...instance.props || {}
235
- });
236
- const query = makeQuery(search);
237
- const matches = computeMatches(pathname);
238
- const snapshot = Object.freeze({
239
- path: pathname,
240
- params,
241
- query,
242
- hash: hash || null,
243
- matches: Object.freeze(matches)
244
- });
245
- return snapshot;
246
- }
247
- const currentInst = getCurrentComponentInstance();
248
- if (currentInst && currentInst.ssr) {
249
- throw new Error(
250
- "route() cannot be called during SSR rendering. Register routes at module load time instead."
251
- );
252
- }
253
- if (registrationLocked) {
254
- throw new Error(
255
- "Route registration is locked after app startup. Register routes at module load time before calling createSPA or createSSR."
256
- );
257
- }
258
- if (typeof handler !== "function") {
259
- throw new Error(
260
- "route(path, handler) requires a function handler that returns a VNode (e.g. () => <Page />). Passing JSX elements or VNodes directly is not supported."
261
- );
262
- }
263
- const routeObj = { path, handler, namespace };
264
- routes.push(routeObj);
265
- setHasRoutes(true);
266
- const depth = getDepth(path);
267
- let depthRoutes = routesByDepth.get(depth);
268
- if (!depthRoutes) {
269
- depthRoutes = [];
270
- routesByDepth.set(depth, depthRoutes);
271
- }
272
- depthRoutes.push(routeObj);
273
- if (namespace) {
274
- namespaces.add(namespace);
275
- }
276
- }
277
- function getRoutes() {
278
- return [...routes];
279
- }
280
- function getNamespaceRoutes(namespace) {
281
- return routes.filter((r) => r.namespace === namespace);
282
- }
283
- function unloadNamespace(namespace) {
284
- const before = routes.length;
285
- for (let i = routes.length - 1; i >= 0; i--) {
286
- if (routes[i].namespace === namespace) {
287
- const removed = routes[i];
288
- routes.splice(i, 1);
289
- const depth = getDepth(removed.path);
290
- const depthRoutes = routesByDepth.get(depth);
291
- if (depthRoutes) {
292
- const idx = depthRoutes.indexOf(removed);
293
- if (idx >= 0) {
294
- depthRoutes.splice(idx, 1);
295
- }
296
- }
297
- }
298
- }
299
- namespaces.delete(namespace);
300
- return before - routes.length;
301
- }
302
- function clearRoutes() {
303
- routes.length = 0;
304
- namespaces.clear();
305
- routesByDepth.clear();
306
- registrationLocked = false;
307
- setHasRoutes(false);
308
- }
309
- function normalizeHandler(handler) {
310
- if (handler == null) return void 0;
311
- if (typeof handler === "function") {
312
- return (params, ctx) => {
313
- try {
314
- return handler(params, ctx);
315
- } catch {
316
- return handler(params);
317
- }
318
- };
319
- }
320
- return void 0;
321
- }
322
- function registerRoute(path, handler, ...children) {
323
- const isRelative = !path.startsWith("/");
324
- const descriptor = {
325
- path,
326
- handler,
327
- children: children.filter(Boolean),
328
- _isDescriptor: true
329
- };
330
- if (!isRelative) {
331
- const normalized = normalizeHandler(handler);
332
- if (handler != null && !normalized) {
333
- throw new Error(
334
- "registerRoute(path, handler) requires a function handler. Passing JSX elements or VNodes directly is not supported."
335
- );
336
- }
337
- if (normalized) route(path, normalized);
338
- for (const child of descriptor.children || []) {
339
- const base = path === "/" ? "" : path.replace(/\/$/, "");
340
- const childPath = `${base}/${child.path.replace(/^\//, "")}`.replace(
341
- /\/\//g,
342
- "/"
343
- );
344
- if (child.handler) {
345
- const childNormalized = normalizeHandler(child.handler);
346
- if (!childNormalized) {
347
- throw new Error(
348
- "registerRoute child handler must be a function. Passing JSX elements directly is not supported."
349
- );
350
- }
351
- if (childNormalized) route(childPath, childNormalized);
352
- }
353
- if (child.children && child.children.length) {
354
- registerRoute(
355
- childPath,
356
- null,
357
- ...child.children
358
- );
359
- }
360
- }
361
- return descriptor;
362
- }
363
- return descriptor;
364
- }
365
- function getLoadedNamespaces() {
366
- return Array.from(namespaces);
367
- }
368
- function resolveRoute(pathname) {
369
- const normalized = pathname.endsWith("/") && pathname !== "/" ? pathname.slice(0, -1) : pathname;
370
- const depth = normalized === "/" ? 0 : normalized.split("/").filter(Boolean).length;
371
- const candidates = [];
372
- const depthRoutes = routesByDepth.get(depth);
373
- if (depthRoutes) {
374
- for (const r of depthRoutes) {
375
- const result = match(pathname, r.path);
376
- if (result.matched) {
377
- candidates.push({
378
- route: r,
379
- specificity: getSpecificity(r.path),
380
- params: result.params
381
- });
382
- }
383
- }
384
- }
385
- for (const r of routes) {
386
- if (depthRoutes?.includes(r)) continue;
387
- const result = match(pathname, r.path);
388
- if (result.matched) {
389
- candidates.push({
390
- route: r,
391
- specificity: getSpecificity(r.path),
392
- params: result.params
393
- });
394
- }
395
- }
396
- candidates.sort((a, b) => b.specificity - a.specificity);
397
- if (candidates.length > 0) {
398
- const best = candidates[0];
399
- return { handler: best.route.handler, params: best.params };
400
- }
401
- return null;
402
- }
403
-
404
- export {
405
- assertExecutionModel,
406
- setServerLocation,
407
- lockRouteRegistration,
408
- _lockRouteRegistrationForTests,
409
- _unlockRouteRegistrationForTests,
410
- route,
411
- getRoutes,
412
- getNamespaceRoutes,
413
- unloadNamespace,
414
- clearRoutes,
415
- registerRoute,
416
- getLoadedNamespaces,
417
- resolveRoute,
418
- route_exports
419
- };
420
- //# sourceMappingURL=chunk-Z5ZSTLYF.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/router/route.ts","../src/router/match.ts","../src/runtime/execution-model.ts"],"sourcesContent":["/**\n * Route definition and matching\n * Supports dynamic route registration for micro frontends\n *\n * Optimization: Index by depth but maintain insertion order within each depth\n */\n\nimport { match as matchPath } from './match';\nimport { getCurrentComponentInstance } from '../runtime/component';\nimport { getExecutionModel } from '../runtime/execution-model';\n\nexport type {\n RouteHandler,\n Route,\n ResolvedRoute,\n RouteMatch,\n RouteQuery,\n RouteSnapshot,\n} from '../common/router';\n\nimport type {\n RouteHandler,\n Route,\n ResolvedRoute,\n RouteMatch,\n RouteQuery,\n RouteSnapshot,\n} from '../common/router';\n\nconst routes: Route[] = [];\nconst namespaces = new Set<string>();\n\nconst HAS_ROUTES_KEY = Symbol.for('__ASKR_HAS_ROUTES__');\n\nfunction setHasRoutes(value: boolean): void {\n try {\n const g = globalThis as unknown as Record<string | symbol, unknown>;\n g[HAS_ROUTES_KEY] = value;\n } catch {\n // ignore\n }\n}\n\n// Initialize to false at module load.\nsetHasRoutes(false);\n\n// Route index by depth - maintains insertion order\nconst routesByDepth = new Map<number, Route[]>();\n\n/**\n * Parse route path depth\n */\nfunction getDepth(path: string): number {\n const normalized =\n path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n return normalized === '/' ? 0 : normalized.split('/').filter(Boolean).length;\n}\n\n/**\n * Calculate route specificity for priority matching\n * Higher score = more specific\n * - Literal segments: 3 points each\n * - Parameter segments ({id}): 2 points each\n * - Wildcard segments (*): 1 point each\n * - Catch-all (/*): 0 points\n */\nfunction getSpecificity(path: string): number {\n const normalized =\n path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n\n // Special case: catch-all pattern\n if (normalized === '/*') {\n return 0;\n }\n\n const segments = normalized.split('/').filter(Boolean);\n let score = 0;\n\n for (const segment of segments) {\n if (segment.startsWith('{') && segment.endsWith('}')) {\n score += 2; // Parameter\n } else if (segment === '*') {\n score += 1; // Wildcard\n } else {\n score += 3; // Literal\n }\n }\n\n return score;\n}\n\n// SSR helper: when rendering on the server, callers may set a location so that\n// render-time route() returns deterministic server values that match client\n// hydration. This is deliberately an opt-in escape for SSR and tests.\nlet serverLocation: string | null = null;\n\nexport function setServerLocation(url: string | null): void {\n serverLocation = url;\n}\n\n// Helper: parse a URL string into components\nfunction parseLocation(url: string) {\n try {\n const u = new URL(url, 'http://localhost');\n return { pathname: u.pathname, search: u.search, hash: u.hash };\n } catch {\n return { pathname: '/', search: '', hash: '' };\n }\n}\n\n// Deep freeze utility for small objects\nfunction deepFreeze<T>(obj: T): T {\n if (obj && typeof obj === 'object' && !Object.isFrozen(obj)) {\n Object.freeze(obj as Record<string, unknown>);\n for (const key of Object.keys(obj as Record<string, unknown>)) {\n const value = (obj as Record<string, unknown>)[key];\n if (value && typeof value === 'object') deepFreeze(value);\n }\n }\n return obj;\n}\n\n// Build an immutable query helper from a search string\nfunction makeQuery(search: string): RouteQuery {\n const usp = new URLSearchParams(search || '');\n const mapping = new Map<string, string[]>();\n for (const [k, v] of usp.entries()) {\n const existing = mapping.get(k);\n if (existing) existing.push(v);\n else mapping.set(k, [v]);\n }\n\n const obj: RouteQuery = {\n get(key: string) {\n const arr = mapping.get(key);\n return arr ? arr[0] : null;\n },\n getAll(key: string) {\n const arr = mapping.get(key);\n return arr ? [...arr] : [];\n },\n has(key: string) {\n return mapping.has(key);\n },\n toJSON() {\n const out: Record<string, string | string[]> = {};\n for (const [k, arr] of mapping.entries()) {\n out[k] = arr.length > 1 ? [...arr] : arr[0];\n }\n return out;\n },\n };\n\n return deepFreeze(obj);\n}\n\n// Compute matches by scanning registered routes (public API: getRoutes)\nfunction computeMatches(pathname: string): RouteMatch[] {\n const routesList = getRoutes();\n const matches: Array<{\n pattern: string;\n params: Record<string, string>;\n name?: string;\n namespace?: string;\n specificity: number;\n }> = [];\n\n function getSpecificity(path: string) {\n // Reuse same heuristic as above\n const normalized =\n path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n if (normalized === '/*') return 0;\n const segments = normalized.split('/').filter(Boolean);\n let score = 0;\n for (const segment of segments) {\n if (segment.startsWith('{') && segment.endsWith('}')) score += 2;\n else if (segment === '*') score += 1;\n else score += 3;\n }\n return score;\n }\n\n for (const r of routesList) {\n const result = matchPath(pathname, r.path);\n if (result.matched) {\n matches.push({\n pattern: r.path,\n params: result.params,\n name: (r as { name?: string }).name,\n namespace: r.namespace,\n specificity: getSpecificity(r.path),\n });\n }\n }\n\n matches.sort((a, b) => b.specificity - a.specificity);\n\n return matches.map((m) => ({\n path: m.pattern,\n params: deepFreeze({ ...m.params }),\n name: m.name,\n namespace: m.namespace,\n }));\n}\n\n/**\n * Dual-purpose `route` function:\n * - route() → returns a read-only, deeply frozen RouteSnapshot (render-time)\n * - route(path, handler, namespace?) → registers a route handler (existing semantics)\n */\n// Prevent runtime registrations after the app has started\nlet registrationLocked = false;\n\nexport function lockRouteRegistration(): void {\n registrationLocked = true;\n}\n\n// Internal test helpers\nexport function _lockRouteRegistrationForTests(): void {\n registrationLocked = true;\n}\n\nexport function _unlockRouteRegistrationForTests(): void {\n registrationLocked = false;\n}\n\nexport function route(): RouteSnapshot;\nexport function route(\n path: string,\n handler?: RouteHandler,\n namespace?: string\n): void;\nexport function route(\n path?: string,\n handler?: RouteHandler,\n namespace?: string\n): void | RouteSnapshot {\n if (getExecutionModel() === 'islands') {\n throw new Error(\n 'Routes are not supported with islands. Use createSPA (client) or createSSR (server) instead.'\n );\n }\n\n // If called with no args, act as render-time accessor\n if (typeof path === 'undefined') {\n // Access the current component instance to ensure route() is only\n // called during render.\n const instance = getCurrentComponentInstance();\n if (!instance) {\n throw new Error(\n 'route() can only be called during component render execution. ' +\n 'Call route() from inside your component function.'\n );\n }\n\n // Determine location source: client window if present; otherwise SSR override\n let pathname = '/';\n let search = '';\n let hash = '';\n\n if (typeof window !== 'undefined' && window.location) {\n pathname = window.location.pathname || '/';\n search = window.location.search || '';\n hash = window.location.hash || '';\n } else if (serverLocation) {\n const parsed = parseLocation(serverLocation);\n pathname = parsed.pathname;\n search = parsed.search;\n hash = parsed.hash;\n }\n\n const params = deepFreeze({\n ...((instance.props as Record<string, string>) || {}),\n });\n const query = makeQuery(search);\n const matches = computeMatches(pathname);\n\n const snapshot: RouteSnapshot = Object.freeze({\n path: pathname,\n params,\n query,\n hash: hash || null,\n matches: Object.freeze(matches),\n });\n\n return snapshot;\n }\n\n // Disallow route registration during SSR render\n const currentInst = getCurrentComponentInstance();\n if (currentInst && currentInst.ssr) {\n throw new Error(\n 'route() cannot be called during SSR rendering. Register routes at module load time instead.'\n );\n }\n\n // Disallow registrations after app startup\n if (registrationLocked) {\n throw new Error(\n 'Route registration is locked after app startup. Register routes at module load time before calling createSPA or createSSR.'\n );\n }\n\n // Otherwise register a route (backwards compatible behavior)\n if (typeof handler !== 'function') {\n throw new Error(\n 'route(path, handler) requires a function handler that returns a VNode (e.g. () => <Page />). ' +\n 'Passing JSX elements or VNodes directly is not supported.'\n );\n }\n\n const routeObj: Route = { path, handler: handler as RouteHandler, namespace };\n routes.push(routeObj);\n setHasRoutes(true);\n\n // Index by depth (maintains insertion order within depth)\n const depth = getDepth(path);\n\n let depthRoutes = routesByDepth.get(depth);\n if (!depthRoutes) {\n depthRoutes = [];\n routesByDepth.set(depth, depthRoutes);\n }\n\n depthRoutes.push(routeObj);\n\n if (namespace) {\n namespaces.add(namespace);\n }\n}\n\n/**\n * Get all registered routes\n */\nexport function getRoutes(): Route[] {\n return [...routes];\n}\n\n/**\n * Get routes for a specific namespace\n */\nexport function getNamespaceRoutes(namespace: string): Route[] {\n return routes.filter((r) => r.namespace === namespace);\n}\n\n/**\n * Unload all routes from a namespace (for MFE unmounting)\n */\nexport function unloadNamespace(namespace: string): number {\n const before = routes.length;\n\n // Remove from main array\n for (let i = routes.length - 1; i >= 0; i--) {\n if (routes[i].namespace === namespace) {\n const removed = routes[i];\n routes.splice(i, 1);\n\n // Remove from depth index\n const depth = getDepth(removed.path);\n const depthRoutes = routesByDepth.get(depth);\n if (depthRoutes) {\n const idx = depthRoutes.indexOf(removed);\n if (idx >= 0) {\n depthRoutes.splice(idx, 1);\n }\n }\n }\n }\n\n namespaces.delete(namespace);\n return before - routes.length;\n}\n\n/**\n * Clear all registered routes (mainly for testing)\n */\nexport function clearRoutes(): void {\n routes.length = 0;\n namespaces.clear();\n routesByDepth.clear();\n registrationLocked = false;\n setHasRoutes(false);\n}\n\n/**\n * RouteDescriptor type — used by `registerRoute` for nested descriptors.\n *\n * Note: `registerRouteTree` helper was removed; prefer explicit `route()` registrations.\n */\nexport type RouteDescriptor = {\n path: string;\n handler?: RouteHandler | unknown;\n children?: RouteDescriptor[];\n _isDescriptor?: true;\n};\n\n// `registerRouteTree` was removed — register explicit absolute paths with `route(path, handler)` instead.\n// If you need a helper to register descriptor trees, add a small wrapper in userland that\n// calls `route()` recursively.\n\n// Helper: normalize common handler shapes\n// NOTE: Only function handlers are accepted — passing raw JSX/VNodes at register\n// time is not allowed. This keeps registration data-only and avoids surprising\n// semantics between module-load-time and render-time.\nfunction normalizeHandler(handler: unknown): RouteHandler | undefined {\n if (handler == null) return undefined;\n if (typeof handler === 'function') {\n // Accept both (params) => ... handlers and component functions that take no args / props\n return (params: Record<string, string>, ctx?: { signal?: AbortSignal }) => {\n // Call with params and ctx; component functions can ignore them\n // Allow handler to return JSX element, VNode, Promise, etc.\n // If the function expects only props, passing params is safe (extra args ignored)\n try {\n return handler(params, ctx);\n } catch {\n return handler(params);\n }\n };\n }\n return undefined;\n}\n\n// Register route with flexible handler shapes and optional nested descriptors.\n// Usage patterns supported:\n// - Absolute flat registration: registerRoute('/pages', () => List())\n// - Nested descriptors: registerRoute('/', () => Home(), registerRoute('pages', () => List(), registerRoute('{id}', () => Detail())))\n// Note: child descriptors should use relative paths (no leading '/').\nexport function registerRoute(\n path: string,\n handler?: unknown,\n ...children: Array<RouteDescriptor | undefined>\n): RouteDescriptor {\n const isRelative = !path.startsWith('/');\n\n // Build descriptor that can be used for nesting\n const descriptor: RouteDescriptor = {\n path,\n handler,\n children: children.filter(Boolean) as RouteDescriptor[],\n _isDescriptor: true,\n };\n\n // If path is absolute, perform registration immediately and recurse into children\n if (!isRelative) {\n const normalized = normalizeHandler(handler);\n if (handler != null && !normalized) {\n throw new Error(\n 'registerRoute(path, handler) requires a function handler. Passing JSX elements or VNodes directly is not supported.'\n );\n }\n if (normalized) route(path, normalized);\n\n for (const child of descriptor.children || []) {\n // Compute child full path\n const base = path === '/' ? '' : path.replace(/\\/$/, '');\n const childPath = `${base}/${child.path.replace(/^\\//, '')}`.replace(\n /\\/\\//g,\n '/'\n );\n // Recurse: if child.handler is provided, register it\n if (child.handler) {\n const childNormalized = normalizeHandler(child.handler);\n if (!childNormalized) {\n throw new Error(\n 'registerRoute child handler must be a function. Passing JSX elements directly is not supported.'\n );\n }\n if (childNormalized) route(childPath, childNormalized);\n }\n // Recurse into grandchildren\n if (child.children && child.children.length) {\n // Convert child.children into descriptors and register them\n // Use registerRoute recursively with absolute childPath\n registerRoute(\n childPath,\n null,\n ...(child.children as RouteDescriptor[])\n );\n }\n }\n\n return descriptor;\n }\n\n // If relative, return descriptor for nesting (do not register yet)\n return descriptor;\n}\n\n/**\n * Get all loaded namespaces (MFE identifiers)\n */\nexport function getLoadedNamespaces(): string[] {\n return Array.from(namespaces);\n}\n\n/**\n * Resolve a path to a route handler with optimized lookup\n * Routes are matched by specificity: literals > parameters > wildcards > catch-all\n */\nexport function resolveRoute(pathname: string): ResolvedRoute | null {\n const normalized =\n pathname.endsWith('/') && pathname !== '/'\n ? pathname.slice(0, -1)\n : pathname;\n const depth =\n normalized === '/' ? 0 : normalized.split('/').filter(Boolean).length;\n\n // Collect all matching routes with their specificity\n const candidates: Array<{\n route: Route;\n specificity: number;\n params: Record<string, string>;\n }> = [];\n\n // Try routes at this depth first (most likely match)\n const depthRoutes = routesByDepth.get(depth);\n if (depthRoutes) {\n for (const r of depthRoutes) {\n const result = matchPath(pathname, r.path);\n if (result.matched) {\n candidates.push({\n route: r,\n specificity: getSpecificity(r.path),\n params: result.params,\n });\n }\n }\n }\n\n // Fallback: scan all routes for different depths\n // (handles edge cases like wildcard routes)\n for (const r of routes) {\n // Skip if already checked in depth routes\n if (depthRoutes?.includes(r)) continue;\n\n const result = matchPath(pathname, r.path);\n if (result.matched) {\n candidates.push({\n route: r,\n specificity: getSpecificity(r.path),\n params: result.params,\n });\n }\n }\n\n // Sort by specificity (highest first)\n candidates.sort((a, b) => b.specificity - a.specificity);\n\n // Return most specific match\n if (candidates.length > 0) {\n const best = candidates[0];\n return { handler: best.route.handler, params: best.params };\n }\n\n return null;\n}\n","/**\n * Path matching and parameter extraction\n */\n\nexport interface MatchResult {\n matched: boolean;\n params: Record<string, string>;\n}\n\n/**\n * Match a path against a route pattern and extract params\n *\n * @example\n * match('/users/123', '/users/{id}')\n * // → { matched: true, params: { id: '123' } }\n *\n * match('/posts/hello-world/edit', '/posts/{slug}/{action}')\n * // → { matched: true, params: { slug: 'hello-world', action: 'edit' } }\n *\n * match('/users', '/posts/{id}')\n * // → { matched: false, params: {} }\n */\nexport function match(path: string, pattern: string): MatchResult {\n // Normalize trailing slashes\n const normalizedPath =\n path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;\n const normalizedPattern =\n pattern.endsWith('/') && pattern !== '/' ? pattern.slice(0, -1) : pattern;\n\n // Split into segments\n const pathSegments = normalizedPath.split('/').filter(Boolean);\n const patternSegments = normalizedPattern.split('/').filter(Boolean);\n\n // Support catch-all route: /* matches any path at any depth\n if (patternSegments.length === 1 && patternSegments[0] === '*') {\n // For multi-segment paths, preserve the leading slash\n // For single-segment paths, return just the segment\n return {\n matched: true,\n params: {\n '*': pathSegments.length > 1 ? normalizedPath : pathSegments[0],\n },\n };\n }\n\n // Check if lengths match (wildcard segments still need to match one segment)\n if (pathSegments.length !== patternSegments.length) {\n return { matched: false, params: {} };\n }\n\n const params: Record<string, string> = {};\n\n // Match each segment\n for (let i = 0; i < patternSegments.length; i++) {\n const patternSegment = patternSegments[i];\n const pathSegment = pathSegments[i];\n\n // Parameter: {paramName}\n if (patternSegment.startsWith('{') && patternSegment.endsWith('}')) {\n const paramName = patternSegment.slice(1, -1);\n params[paramName] = decodeURIComponent(pathSegment);\n } else if (patternSegment === '*') {\n // Wildcard: match single segment\n params['*'] = pathSegment;\n } else if (patternSegment !== pathSegment) {\n // Literal segment mismatch\n return { matched: false, params: {} };\n }\n }\n\n return { matched: true, params };\n}\n","export type ExecutionModel = 'spa' | 'islands' | 'ssr';\n\nconst EXECUTION_MODEL_KEY = Symbol.for('__ASKR_EXECUTION_MODEL__');\n\nexport function getExecutionModel(): ExecutionModel | undefined {\n const g = globalThis as unknown as Record<string | symbol, unknown>;\n return g[EXECUTION_MODEL_KEY] as ExecutionModel | undefined;\n}\n\nexport function assertExecutionModel(model: ExecutionModel): void {\n // Mixing execution models is forbidden: once an app starts in one model,\n // attempting to start another is an invariant violation.\n const g = globalThis as unknown as Record<string | symbol, unknown>;\n const cur = g[EXECUTION_MODEL_KEY] as ExecutionModel | undefined;\n if (cur && cur !== model) {\n throw new Error(\n `[Askr] mixing execution models is not allowed (current: ${cur}, attempted: ${model}). ` +\n `Choose exactly one: createSPA, createSSR, or createIslands.`\n );\n }\n if (!cur) g[EXECUTION_MODEL_KEY] = model;\n}\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACsBO,SAAS,MAAM,MAAc,SAA8B;AAEhE,QAAM,iBACJ,KAAK,SAAS,GAAG,KAAK,SAAS,MAAM,KAAK,MAAM,GAAG,EAAE,IAAI;AAC3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