@vizejs/marquette 0.813.0 → 0.815.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -202,6 +202,45 @@ Unknown routes and missing, extra, empty, or non-finite parameters are rejected
202
202
  before the target-specific adapter runs. Route identifiers, required parameter
203
203
  names, and the owning environment remain inferred from `app`.
204
204
 
205
+ ### Incoming application links
206
+
207
+ The experimental `@vizejs/marquette/navigation/links` entry resolves incoming
208
+ HTTPS and custom-scheme links against the same authored route contract. Select
209
+ the owning environment and explicitly admit each origin:
210
+
211
+ ```ts
212
+ import { createMarquetteLinkResolver } from "@vizejs/marquette/navigation/links";
213
+
214
+ const links = createMarquetteLinkResolver(app, {
215
+ environment: "native",
216
+ origins: ["https://shop.example", "shop://app"],
217
+ });
218
+
219
+ const result = links.resolve(incomingLink);
220
+ if (result.matched) {
221
+ nativeHost.open(result.target);
222
+ } else {
223
+ console.error(result.code);
224
+ }
225
+ ```
226
+
227
+ Successful targets preserve route and environment literals, infer decoded string
228
+ parameters for each route, and provide a canonical encoded path. Static route
229
+ segments take precedence over parameters, which take precedence over terminal
230
+ `*rest` segments. Equally specific matches fail with `ambiguous-route` rather
231
+ than relying on declaration order. Only routes in the selected environment
232
+ participate in matching.
233
+
234
+ The boundary refuses untrusted origins, credentials, malformed escaping,
235
+ backslashes, control characters, and decoded `.` or `..` segments before URL
236
+ normalization can hide them. Query strings and fragments are not forwarded as
237
+ route parameters. Invalid origin policies and unsupported route templates fail
238
+ at construction. Origins require HTTPS or an explicit custom scheme and host;
239
+ HTTP origins are not admitted. Resolution scans precompiled routes in the
240
+ selected environment. The entry has an enforced 4 KiB gzip budget and adds no
241
+ runtime code to the authoring or programmatic-navigation entries. Device
242
+ launch and operating-system link registration remain host responsibilities.
243
+
205
244
  ## Test-run evidence
206
245
 
207
246
  Release-bound test-run evidence records live in their own lazy entries so
@@ -0,0 +1,52 @@
1
+ import { _ as RouteId, s as EnvironmentId, t as ApplicationMarquette } from "./model-B_mM8AeH.mjs";
2
+ import { NavigationParameters, ResolvedNavigationTarget } from "./navigation.mjs";
3
+
4
+ //#region src/navigation-links.d.ts
5
+ /** Explicit host policy for incoming application links. */
6
+ interface NavigationLinkPolicy<Environment extends string = string> {
7
+ /** Only routes owned by this application environment may be resolved. */
8
+ readonly environment: Environment;
9
+ /** Non-empty HTTPS or custom-scheme origins, including their explicit host. */
10
+ readonly origins: readonly string[];
11
+ }
12
+ /** An incoming link target whose decoded parameters remain tied to its route. */
13
+ type ResolvedNavigationLink<Marquette extends ApplicationMarquette, Environment extends EnvironmentId<Marquette> = EnvironmentId<Marquette>, Id extends RouteId<Marquette> = RouteId<Marquette>> = Id extends RouteId<Marquette> ? Extract<ResolvedNavigationTarget<Marquette, Id>, {
14
+ readonly environment: Environment;
15
+ }> & {
16
+ /** Decoded strings inferred from this route's authored parameter segments. */readonly parameters: { readonly [Name in keyof NavigationParameters<Marquette, Id>]: string };
17
+ } : never;
18
+ /** Stable refusal reason emitted before an incoming link reaches a host. */
19
+ type NavigationLinkRefusal = "invalid-link" | "untrusted-origin" | "invalid-path" | "unknown-route" | "ambiguous-route";
20
+ /** Target-neutral admission result for an untrusted application link. */
21
+ type NavigationLinkResolution<Marquette extends ApplicationMarquette, Environment extends EnvironmentId<Marquette> = EnvironmentId<Marquette>> = {
22
+ /** Whether the link resolved to exactly one route. */readonly matched: true; /** Inferred route, environment, canonical path, and decoded parameters. */
23
+ readonly target: ResolvedNavigationLink<Marquette, Environment>;
24
+ } | {
25
+ /** Whether the link resolved to exactly one route. */readonly matched: false; /** Machine-readable reason why the host must not navigate. */
26
+ readonly code: NavigationLinkRefusal;
27
+ };
28
+ /** Resolves incoming links against a fixed environment and origin policy. */
29
+ interface MarquetteLinkResolver<Marquette extends ApplicationMarquette, Environment extends EnvironmentId<Marquette> = EnvironmentId<Marquette>> {
30
+ /** Admit an absolute application link or return a deterministic refusal. */
31
+ readonly resolve: (link: string) => NavigationLinkResolution<Marquette, Environment>;
32
+ }
33
+ /**
34
+ * Creates an inferred deep-link boundary for web, native, and desktop hosts.
35
+ *
36
+ * Only explicitly admitted HTTPS or custom-scheme origins and routes owned by
37
+ * the selected environment can match. Credentials, malformed escapes, control
38
+ * characters, backslashes, and decoded dot segments are refused before URL
39
+ * normalization can conceal them. Static segments outrank parameters, which
40
+ * outrank a terminal `*rest` segment; equally specific matches are refused.
41
+ *
42
+ * Parameters are decoded exactly once and paths are encoded like programmatic
43
+ * navigation. Query strings and fragments never become route parameters and
44
+ * are not forwarded to the host. Invalid policies, duplicate route identifiers,
45
+ * and unsupported route templates throw during construction. Resolution scans
46
+ * the selected environment's precompiled routes without mutating the marquette.
47
+ * This experimental boundary does not launch a device or register OS links.
48
+ */
49
+ declare function createMarquetteLinkResolver<const Marquette extends ApplicationMarquette, const Environment extends EnvironmentId<Marquette>>(marquette: Marquette, policy: NavigationLinkPolicy<Environment>): MarquetteLinkResolver<Marquette, Environment>;
50
+ //#endregion
51
+ export { MarquetteLinkResolver, NavigationLinkPolicy, NavigationLinkRefusal, NavigationLinkResolution, ResolvedNavigationLink, createMarquetteLinkResolver };
52
+ //# sourceMappingURL=navigation-links.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation-links.d.mts","names":[],"sources":["../src/navigation-links.ts"],"mappings":";;;;;UAIiB,oBAAA;EAAA;EAAA,SAEN,WAAA,EAAa,WAAW;EAFE;EAAA,SAI1B,OAAA;AAAA;;KAIC,sBAAA,mBACQ,oBAAA,sBACE,aAAA,CAAc,SAAA,IAAa,aAAA,CAAc,SAAA,cAClD,OAAA,CAAQ,SAAA,IAAa,OAAA,CAAQ,SAAA,KAExC,EAAA,SAAW,OAAA,CAAQ,SAAA,IACf,OAAA,CAAQ,wBAAA,CAAyB,SAAA,EAAW,EAAA;EAAA,SAAgB,WAAA,EAAa,WAAA;AAAA;EAV7D,uFAYD,UAAA,4BACiB,oBAAA,CAAqB,SAAA,EAAW,EAAA;AAAA;;KAMtD,qBAAA;;KAQA,wBAAA,mBACQ,oBAAA,sBACE,aAAA,CAAc,SAAA,IAAa,aAAA,CAAc,SAAA;EAtB1C,+DA0BN,OAAA,QA1B2B;EAAA,SA4B3B,MAAA,EAAQ,sBAAA,CAAuB,SAAA,EAAW,WAAA;AAAA;EA1BpC,+DA8BN,OAAA,SA7BwB;EAAA,SA+BxB,IAAA,EAAM,qBAAA;AAAA;;UAIJ,qBAAA,mBACG,oBAAA,sBACE,aAAA,CAAc,SAAA,IAAa,aAAA,CAAc,SAAA;EAlCR;EAAA,SAqC5C,OAAA,GAAU,IAAA,aAAiB,wBAAA,CAAyB,SAAA,EAAW,WAAA;AAAA;;;;;;;;;;;;;;;;;iBAmC1D,2BAAA,yBACU,oBAAA,4BACE,aAAA,CAAc,SAAA,GAExC,SAAA,EAAW,SAAA,EACX,MAAA,EAAQ,oBAAA,CAAqB,WAAA,IAC5B,qBAAA,CAAsB,SAAA,EAAW,WAAA"}
@@ -0,0 +1,175 @@
1
+ //#region src/navigation-links.ts
2
+ /**
3
+ * Creates an inferred deep-link boundary for web, native, and desktop hosts.
4
+ *
5
+ * Only explicitly admitted HTTPS or custom-scheme origins and routes owned by
6
+ * the selected environment can match. Credentials, malformed escapes, control
7
+ * characters, backslashes, and decoded dot segments are refused before URL
8
+ * normalization can conceal them. Static segments outrank parameters, which
9
+ * outrank a terminal `*rest` segment; equally specific matches are refused.
10
+ *
11
+ * Parameters are decoded exactly once and paths are encoded like programmatic
12
+ * navigation. Query strings and fragments never become route parameters and
13
+ * are not forwarded to the host. Invalid policies, duplicate route identifiers,
14
+ * and unsupported route templates throw during construction. Resolution scans
15
+ * the selected environment's precompiled routes without mutating the marquette.
16
+ * This experimental boundary does not launch a device or register OS links.
17
+ */
18
+ function createMarquetteLinkResolver(marquette, policy) {
19
+ if (!marquette.environments?.some(({ id }) => id === policy.environment)) throw new TypeError(`Unknown link environment "${policy.environment}".`);
20
+ if (policy.origins.length === 0) throw new TypeError("Link origins must not be empty.");
21
+ const origins = new Set(policy.origins.map(compileOrigin));
22
+ const declaredRoutes = marquette.routes ?? [];
23
+ if (new Set(declaredRoutes.map(({ id }) => id)).size !== declaredRoutes.length) throw new TypeError("Link route identifiers must be unique within the application.");
24
+ const routes = declaredRoutes.filter(({ environment }) => environment === policy.environment).map(compileRoute);
25
+ routes.sort((left, right) => comparePriority(right.priority, left.priority));
26
+ return { resolve(link) {
27
+ const parsed = parseLink(link);
28
+ if (parsed === void 0) return {
29
+ matched: false,
30
+ code: "invalid-link"
31
+ };
32
+ if (!origins.has(originKey(parsed.url))) return {
33
+ matched: false,
34
+ code: "untrusted-origin"
35
+ };
36
+ const segments = decodePath(parsed.path);
37
+ if (segments === void 0) return {
38
+ matched: false,
39
+ code: "invalid-path"
40
+ };
41
+ let best;
42
+ for (const route of routes) {
43
+ if (best && comparePriority(best.route.priority, route.priority) > 0) break;
44
+ const match = matchRoute(route, segments);
45
+ if (!match) continue;
46
+ if (best) return {
47
+ matched: false,
48
+ code: "ambiguous-route"
49
+ };
50
+ best = match;
51
+ }
52
+ if (!best) return {
53
+ matched: false,
54
+ code: "unknown-route"
55
+ };
56
+ return {
57
+ matched: true,
58
+ target: {
59
+ route: best.route.route.id,
60
+ environment: best.route.route.environment,
61
+ path: best.path,
62
+ parameters: best.parameters
63
+ }
64
+ };
65
+ } };
66
+ }
67
+ function compileOrigin(origin) {
68
+ const parsed = parseLink(origin);
69
+ if (parsed === void 0 || parsed.path !== "/" || parsed.url.search !== "" || parsed.url.hash !== "" || /[?#]/.test(origin) || /^(?:http|ws|wss|ftp|file|data|javascript|blob|about|mailto|tel):$/.test(parsed.url.protocol)) throw new TypeError(`Invalid application link origin "${origin}".`);
70
+ return originKey(parsed.url);
71
+ }
72
+ function originKey(url) {
73
+ return `${url.protocol}//${url.host.toLowerCase()}`;
74
+ }
75
+ function parseLink(link) {
76
+ if (typeof link !== "string" || /[\p{Cc}\s\\]/u.test(link)) return void 0;
77
+ const match = /^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)([^?#]*)/i.exec(link);
78
+ if (!match || match[1].includes("@")) return void 0;
79
+ try {
80
+ const url = new URL(link);
81
+ if (!url.host || url.username || url.password) return void 0;
82
+ return {
83
+ url,
84
+ path: match[2] || "/"
85
+ };
86
+ } catch {
87
+ return;
88
+ }
89
+ }
90
+ function decodePath(path) {
91
+ if (!path.startsWith("/") || path.startsWith("//")) return void 0;
92
+ try {
93
+ return path.slice(1).split("/").map((segment) => {
94
+ const decoded = decodeURIComponent(segment);
95
+ if (decoded === "." || decoded === ".." || /[\p{Cc}\\]/u.test(decoded)) throw new TypeError("Invalid path segment.");
96
+ return decoded;
97
+ });
98
+ } catch {
99
+ return;
100
+ }
101
+ }
102
+ function compileRoute(route) {
103
+ const invalid = () => {
104
+ throw new TypeError(`Unsupported application link route "${route.id}".`);
105
+ };
106
+ const decoded = decodePath(route.path);
107
+ if (decoded === void 0 || /[?#]/.test(route.path)) invalid();
108
+ const names = /* @__PURE__ */ new Set();
109
+ const authored = route.path.slice(1).split("/");
110
+ const segments = authored.map((segment, index) => {
111
+ if (segment.startsWith(":") || segment.startsWith("*")) {
112
+ const name = segment.slice(1);
113
+ const rest = segment.startsWith("*");
114
+ if (!name || names.has(name) || rest && index !== authored.length - 1) invalid();
115
+ names.add(name);
116
+ return {
117
+ kind: rest ? "rest" : "parameter",
118
+ name
119
+ };
120
+ }
121
+ return {
122
+ kind: "static",
123
+ authored: encodeURIComponent(decoded[index]),
124
+ decoded: decoded[index]
125
+ };
126
+ });
127
+ return {
128
+ route: { ...route },
129
+ segments,
130
+ priority: segments.map(({ kind }) => kind === "static" ? 2 : kind === "parameter" ? 1 : 0)
131
+ };
132
+ }
133
+ function comparePriority(left, right) {
134
+ for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
135
+ const difference = (left[index] ?? 3) - (right[index] ?? 3);
136
+ if (difference !== 0) return difference;
137
+ }
138
+ return 0;
139
+ }
140
+ function matchRoute(route, input) {
141
+ const parameters = [];
142
+ const encoded = [];
143
+ for (const [index, segment] of route.segments.entries()) {
144
+ const value = input[index];
145
+ if (value === void 0) return void 0;
146
+ if (segment.kind === "static") {
147
+ if (value !== segment.decoded) return void 0;
148
+ encoded.push(segment.authored);
149
+ } else if (segment.kind === "parameter") {
150
+ if (value === "") return void 0;
151
+ parameters.push([segment.name, value]);
152
+ encoded.push(encodeURIComponent(value));
153
+ } else {
154
+ const remaining = input.slice(index);
155
+ if (!remaining[0] || remaining.some((value) => value.includes("/"))) return void 0;
156
+ parameters.push([segment.name, remaining.join("/")]);
157
+ encoded.push(remaining.map(encodeURIComponent).join("/"));
158
+ return {
159
+ route,
160
+ path: `/${encoded.join("/")}`,
161
+ parameters: Object.fromEntries(parameters)
162
+ };
163
+ }
164
+ }
165
+ if (route.segments.length !== input.length) return void 0;
166
+ return {
167
+ route,
168
+ path: `/${encoded.join("/")}`,
169
+ parameters: Object.fromEntries(parameters)
170
+ };
171
+ }
172
+ //#endregion
173
+ export { createMarquetteLinkResolver };
174
+
175
+ //# sourceMappingURL=navigation-links.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation-links.mjs","names":[],"sources":["../src/navigation-links.ts"],"sourcesContent":["import type { ApplicationMarquette, EnvironmentId, MarquetteRoute, RouteId } from \"./model.js\";\nimport type { NavigationParameters, ResolvedNavigationTarget } from \"./navigation.js\";\n\n/** Explicit host policy for incoming application links. */\nexport interface NavigationLinkPolicy<Environment extends string = string> {\n /** Only routes owned by this application environment may be resolved. */\n readonly environment: Environment;\n /** Non-empty HTTPS or custom-scheme origins, including their explicit host. */\n readonly origins: readonly string[];\n}\n\n/** An incoming link target whose decoded parameters remain tied to its route. */\nexport type ResolvedNavigationLink<\n Marquette extends ApplicationMarquette,\n Environment extends EnvironmentId<Marquette> = EnvironmentId<Marquette>,\n Id extends RouteId<Marquette> = RouteId<Marquette>,\n> =\n Id extends RouteId<Marquette>\n ? Extract<ResolvedNavigationTarget<Marquette, Id>, { readonly environment: Environment }> & {\n /** Decoded strings inferred from this route's authored parameter segments. */\n readonly parameters: {\n readonly [Name in keyof NavigationParameters<Marquette, Id>]: string;\n };\n }\n : never;\n\n/** Stable refusal reason emitted before an incoming link reaches a host. */\nexport type NavigationLinkRefusal =\n | \"invalid-link\"\n | \"untrusted-origin\"\n | \"invalid-path\"\n | \"unknown-route\"\n | \"ambiguous-route\";\n\n/** Target-neutral admission result for an untrusted application link. */\nexport type NavigationLinkResolution<\n Marquette extends ApplicationMarquette,\n Environment extends EnvironmentId<Marquette> = EnvironmentId<Marquette>,\n> =\n | {\n /** Whether the link resolved to exactly one route. */\n readonly matched: true;\n /** Inferred route, environment, canonical path, and decoded parameters. */\n readonly target: ResolvedNavigationLink<Marquette, Environment>;\n }\n | {\n /** Whether the link resolved to exactly one route. */\n readonly matched: false;\n /** Machine-readable reason why the host must not navigate. */\n readonly code: NavigationLinkRefusal;\n };\n\n/** Resolves incoming links against a fixed environment and origin policy. */\nexport interface MarquetteLinkResolver<\n Marquette extends ApplicationMarquette,\n Environment extends EnvironmentId<Marquette> = EnvironmentId<Marquette>,\n> {\n /** Admit an absolute application link or return a deterministic refusal. */\n readonly resolve: (link: string) => NavigationLinkResolution<Marquette, Environment>;\n}\n\ntype CompiledSegment =\n | { readonly kind: \"static\"; readonly authored: string; readonly decoded: string }\n | { readonly kind: \"parameter\" | \"rest\"; readonly name: string };\n\ninterface CompiledRoute {\n readonly route: MarquetteRoute;\n readonly segments: readonly CompiledSegment[];\n readonly priority: readonly number[];\n}\n\ninterface RouteMatch {\n readonly route: CompiledRoute;\n readonly path: `/${string}`;\n readonly parameters: Readonly<Record<string, string>>;\n}\n\n/**\n * Creates an inferred deep-link boundary for web, native, and desktop hosts.\n *\n * Only explicitly admitted HTTPS or custom-scheme origins and routes owned by\n * the selected environment can match. Credentials, malformed escapes, control\n * characters, backslashes, and decoded dot segments are refused before URL\n * normalization can conceal them. Static segments outrank parameters, which\n * outrank a terminal `*rest` segment; equally specific matches are refused.\n *\n * Parameters are decoded exactly once and paths are encoded like programmatic\n * navigation. Query strings and fragments never become route parameters and\n * are not forwarded to the host. Invalid policies, duplicate route identifiers,\n * and unsupported route templates throw during construction. Resolution scans\n * the selected environment's precompiled routes without mutating the marquette.\n * This experimental boundary does not launch a device or register OS links.\n */\nexport function createMarquetteLinkResolver<\n const Marquette extends ApplicationMarquette,\n const Environment extends EnvironmentId<Marquette>,\n>(\n marquette: Marquette,\n policy: NavigationLinkPolicy<Environment>,\n): MarquetteLinkResolver<Marquette, Environment> {\n if (!marquette.environments?.some(({ id }) => id === policy.environment)) {\n throw new TypeError(`Unknown link environment \"${policy.environment}\".`);\n }\n if (policy.origins.length === 0) throw new TypeError(\"Link origins must not be empty.\");\n const origins = new Set(policy.origins.map(compileOrigin));\n const declaredRoutes = marquette.routes ?? [];\n if (new Set(declaredRoutes.map(({ id }) => id)).size !== declaredRoutes.length) {\n throw new TypeError(\"Link route identifiers must be unique within the application.\");\n }\n const routes = declaredRoutes\n .filter(({ environment }) => environment === policy.environment)\n .map(compileRoute);\n routes.sort((left, right) => comparePriority(right.priority, left.priority));\n\n return {\n resolve(link) {\n const parsed = parseLink(link);\n if (parsed === undefined) return { matched: false, code: \"invalid-link\" };\n if (!origins.has(originKey(parsed.url))) {\n return { matched: false, code: \"untrusted-origin\" };\n }\n const segments = decodePath(parsed.path);\n if (segments === undefined) return { matched: false, code: \"invalid-path\" };\n let best: RouteMatch | undefined;\n for (const route of routes) {\n if (best && comparePriority(best.route.priority, route.priority) > 0) break;\n const match = matchRoute(route, segments);\n if (!match) continue;\n if (best) return { matched: false, code: \"ambiguous-route\" };\n best = match;\n }\n if (!best) return { matched: false, code: \"unknown-route\" };\n return {\n matched: true,\n target: {\n route: best.route.route.id,\n environment: best.route.route.environment,\n path: best.path,\n parameters: best.parameters,\n } as ResolvedNavigationLink<Marquette, Environment>,\n };\n },\n };\n}\n\nfunction compileOrigin(origin: string): string {\n const parsed = parseLink(origin);\n if (\n parsed === undefined ||\n parsed.path !== \"/\" ||\n parsed.url.search !== \"\" ||\n parsed.url.hash !== \"\" ||\n /[?#]/.test(origin) ||\n /^(?:http|ws|wss|ftp|file|data|javascript|blob|about|mailto|tel):$/.test(parsed.url.protocol)\n ) {\n throw new TypeError(`Invalid application link origin \"${origin}\".`);\n }\n return originKey(parsed.url);\n}\n\nfunction originKey(url: URL): string {\n return `${url.protocol}//${url.host.toLowerCase()}`;\n}\n\nfunction parseLink(link: string): { readonly url: URL; readonly path: string } | undefined {\n if (typeof link !== \"string\" || /[\\p{Cc}\\s\\\\]/u.test(link)) return undefined;\n const match = /^[a-z][a-z0-9+.-]*:\\/\\/([^/?#]+)([^?#]*)/i.exec(link);\n if (!match || match[1]!.includes(\"@\")) return undefined;\n try {\n const url = new URL(link);\n if (!url.host || url.username || url.password) return undefined;\n return { url, path: match[2] || \"/\" };\n } catch {\n return undefined;\n }\n}\n\nfunction decodePath(path: string): string[] | undefined {\n if (!path.startsWith(\"/\") || path.startsWith(\"//\")) return undefined;\n try {\n return path\n .slice(1)\n .split(\"/\")\n .map((segment) => {\n const decoded = decodeURIComponent(segment);\n if (decoded === \".\" || decoded === \"..\" || /[\\p{Cc}\\\\]/u.test(decoded)) {\n throw new TypeError(\"Invalid path segment.\");\n }\n // Also reject malformed UTF-16 that a URL parser would silently replace.\n encodeURIComponent(decoded);\n return decoded;\n });\n } catch {\n return undefined;\n }\n}\n\nfunction compileRoute(route: MarquetteRoute): CompiledRoute {\n const invalid = (): never => {\n throw new TypeError(`Unsupported application link route \"${route.id}\".`);\n };\n const decoded = decodePath(route.path);\n if (decoded === undefined || /[?#]/.test(route.path)) invalid();\n const names = new Set<string>();\n const authored = route.path.slice(1).split(\"/\");\n const segments = authored.map((segment, index): CompiledSegment => {\n if (segment.startsWith(\":\") || segment.startsWith(\"*\")) {\n const name = segment.slice(1);\n const rest = segment.startsWith(\"*\");\n if (!name || names.has(name) || (rest && index !== authored.length - 1)) invalid();\n names.add(name);\n return { kind: rest ? \"rest\" : \"parameter\", name };\n }\n return {\n kind: \"static\",\n authored: encodeURIComponent(decoded![index]!),\n decoded: decoded![index]!,\n };\n });\n return {\n // Snapshot metadata so later caller mutations cannot change the admitted route.\n route: { ...route },\n segments,\n priority: segments.map(({ kind }) => (kind === \"static\" ? 2 : kind === \"parameter\" ? 1 : 0)),\n };\n}\n\nfunction comparePriority(left: readonly number[], right: readonly number[]): number {\n for (let index = 0; index < Math.max(left.length, right.length); index += 1) {\n const difference = (left[index] ?? 3) - (right[index] ?? 3);\n if (difference !== 0) return difference;\n }\n return 0;\n}\n\nfunction matchRoute(route: CompiledRoute, input: readonly string[]): RouteMatch | undefined {\n const parameters: [string, string][] = [];\n const encoded: string[] = [];\n for (const [index, segment] of route.segments.entries()) {\n const value = input[index];\n if (value === undefined) return undefined;\n if (segment.kind === \"static\") {\n if (value !== segment.decoded) return undefined;\n encoded.push(segment.authored);\n } else if (segment.kind === \"parameter\") {\n if (value === \"\") return undefined;\n parameters.push([segment.name, value]);\n encoded.push(encodeURIComponent(value));\n } else {\n const remaining = input.slice(index);\n // Catch-all separators must have come from the path itself. An encoded\n // separator would change meaning when passed back to the navigator.\n if (!remaining[0] || remaining.some((value) => value.includes(\"/\"))) return undefined;\n parameters.push([segment.name, remaining.join(\"/\")]);\n encoded.push(remaining.map(encodeURIComponent).join(\"/\"));\n return { route, path: `/${encoded.join(\"/\")}`, parameters: Object.fromEntries(parameters) };\n }\n }\n if (route.segments.length !== input.length) return undefined;\n return { route, path: `/${encoded.join(\"/\")}`, parameters: Object.fromEntries(parameters) };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA6FA,SAAgB,4BAId,WACA,QAC+C;CAC/C,IAAI,CAAC,UAAU,cAAc,MAAM,EAAE,SAAS,OAAO,OAAO,WAAW,GACrE,MAAM,IAAI,UAAU,6BAA6B,OAAO,YAAY,GAAG;CAEzE,IAAI,OAAO,QAAQ,WAAW,GAAG,MAAM,IAAI,UAAU,iCAAiC;CACtF,MAAM,UAAU,IAAI,IAAI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OAAO,IAAI,QAAQ,SAAS,aAAa;GACvC,IAAI,UAAU,IAAI,OAAO,KAAA;GACzB,WAAW,KAAK,CAAC,QAAQ,MAAM,KAAK,CAAC;GACrC,QAAQ,KAAK,mBAAmB,KAAK,CAAC;EACxC,OAAO;GACL,MAAM,YAAY,MAAM,MAAM,KAAK;GAGnC,IAAI,CAAC,UAAU,MAAM,UAAU,MAAM,UAAU,MAAM,SAAS,GAAG,CAAC,GAAG,OAAO,KAAA;GAC5E,WAAW,KAAK,CAAC,QAAQ,MAAM,UAAU,KAAK,GAAG,CAAC,CAAC;GACnD,QAAQ,KAAK,UAAU,IAAI,kBAAkB,EAAE,KAAK,GAAG,CAAC;GACxD,OAAO;IAAE;IAAO,MAAM,IAAI,QAAQ,KAAK,GAAG;IAAK,YAAY,OAAO,YAAY,UAAU;GAAE;EAC5F;CACF;CACA,IAAI,MAAM,SAAS,WAAW,MAAM,QAAQ,OAAO,KAAA;CACnD,OAAO;EAAE;EAAO,MAAM,IAAI,QAAQ,KAAK,GAAG;EAAK,YAAY,OAAO,YAAY,UAAU;CAAE;AAC5F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/marquette",
3
- "version": "0.813.0",
3
+ "version": "0.815.0",
4
4
  "description": "Typed application marquettes for every Vize target",
5
5
  "keywords": [
6
6
  "application-contract",
@@ -57,6 +57,11 @@
57
57
  "import": "./dist/navigation.mjs",
58
58
  "default": "./dist/navigation.mjs"
59
59
  },
60
+ "./navigation/links": {
61
+ "types": "./dist/navigation-links.d.mts",
62
+ "import": "./dist/navigation-links.mjs",
63
+ "default": "./dist/navigation-links.mjs"
64
+ },
60
65
  "./test-run": {
61
66
  "types": "./dist/test-run.d.mts",
62
67
  "import": "./dist/test-run.mjs",
@@ -110,7 +115,8 @@
110
115
  "metadata": {
111
116
  "vize": {
112
117
  "stability": "experimental",
113
- "stabilityDocs": "https://github.com/ubugeeei-prod/vize/blob/main/docs/content/stability.md#package-support-tiers"
118
+ "stabilityDocs": "https://github.com/ubugeeei-prod/vize/blob/main/docs/content/stability.md#package-support-tiers",
119
+ "channel": "early"
114
120
  }
115
121
  },
116
122
  "scripts": {