@xmachines/play-router 2.1.0 → 2.2.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 +270 -11
- package/dist/base-path.d.ts +209 -0
- package/dist/base-path.d.ts.map +1 -0
- package/dist/base-path.js +418 -0
- package/dist/base-path.js.map +1 -0
- package/dist/base-route-map.d.ts.map +1 -1
- package/dist/base-route-map.js +5 -0
- package/dist/base-route-map.js.map +1 -1
- package/dist/errors.d.ts +87 -4
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +97 -4
- package/dist/errors.js.map +1 -1
- package/dist/framework-params.d.ts +144 -0
- package/dist/framework-params.d.ts.map +1 -0
- package/dist/framework-params.js +291 -0
- package/dist/framework-params.js.map +1 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/provider-lifecycle.d.ts +179 -0
- package/dist/provider-lifecycle.d.ts.map +1 -0
- package/dist/provider-lifecycle.js +153 -0
- package/dist/provider-lifecycle.js.map +1 -0
- package/dist/query.d.ts +49 -0
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +59 -0
- package/dist/query.js.map +1 -1
- package/dist/router-bridge-base.d.ts +353 -15
- package/dist/router-bridge-base.d.ts.map +1 -1
- package/dist/router-bridge-base.js +998 -83
- package/dist/router-bridge-base.js.map +1 -1
- package/dist/types.d.ts +44 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/url-pattern-utils.d.ts +0 -30
- package/dist/url-pattern-utils.d.ts.map +1 -1
- package/dist/url-pattern-utils.js +52 -1
- package/dist/url-pattern-utils.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The base-path support — it mounts the routes of a machine under a URL prefix.
|
|
3
|
+
*
|
|
4
|
+
* A host application often owns a part of its own URL space, and it wants a machine
|
|
5
|
+
* to own the rest of that space, inside the SAME router. A URL such as
|
|
6
|
+
* `/:machineId/play/dashboard` has two halves: `/:machineId/play` belongs to the
|
|
7
|
+
* host, which resolves `:machineId` in a loader, and `/dashboard` belongs to the
|
|
8
|
+
* `meta.route` tree of the machine.
|
|
9
|
+
*
|
|
10
|
+
* This module is the boundary between those two halves:
|
|
11
|
+
* - {@link resolveBasePath} makes the concrete prefix that the browser URL carries,
|
|
12
|
+
* from a base-path pattern and its params.
|
|
13
|
+
* - {@link stripBasePath} removes that prefix from an inbound location of the router,
|
|
14
|
+
* and it reports a location OUTSIDE the prefix as foreign, so that the bridge stays
|
|
15
|
+
* out of it.
|
|
16
|
+
* - {@link joinBasePath} adds the prefix again to an outbound path of the machine.
|
|
17
|
+
*
|
|
18
|
+
* The prefix lives on the BRIDGE, and not on the `RouteMap`. A route map is static,
|
|
19
|
+
* it is shared, and it holds an LRU cache inside, while a mount point is dynamic. One
|
|
20
|
+
* route map therefore serves every `machineId` without a rebuild.
|
|
21
|
+
*
|
|
22
|
+
* @internal The package exports these primitives for an adapter and for a host, but
|
|
23
|
+
* a consumer normally uses the `basePath` option of a bridge instead.
|
|
24
|
+
*/
|
|
25
|
+
import { InvalidBasePathError, MissingBasePathParamError } from "./errors.js";
|
|
26
|
+
/**
|
|
27
|
+
* The base path of a bridge that has no `basePath` option.
|
|
28
|
+
*
|
|
29
|
+
* The object is FROZEN, and both levels of it: {@link resolveBasePath} returns this
|
|
30
|
+
* exact instance for every bridge with no mount, and
|
|
31
|
+
* `RouterBridgeBase.basePathParams` hands its `params` to the caller.
|
|
32
|
+
* `Readonly<Record<string, string>>` is gone at run time, so without the freeze one
|
|
33
|
+
* write in consumer code would leak that key into every other unmounted bridge in
|
|
34
|
+
* the process.
|
|
35
|
+
*/
|
|
36
|
+
export const NO_BASE_PATH = Object.freeze({
|
|
37
|
+
path: "",
|
|
38
|
+
params: Object.freeze({}),
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Normalizes a base path, and it substitutes no `:param` segment of that path.
|
|
42
|
+
*
|
|
43
|
+
* Use this function when you want the form of the pattern, for example to declare
|
|
44
|
+
* the routes of a machine in a route config of a host that substitutes each param
|
|
45
|
+
* itself. {@link resolveBasePath} gives the form that a bridge needs.
|
|
46
|
+
*
|
|
47
|
+
* @param basePath - The prefix, as a pattern or as a concrete path. An absent value,
|
|
48
|
+
* `""`, and `"/"` all give `""`.
|
|
49
|
+
* @returns The normalized prefix. It starts with `/`, and it carries no trailing `/`.
|
|
50
|
+
* @throws {InvalidBasePathError} For a wildcard segment, for an optional `:param?`
|
|
51
|
+
* segment, for a `$param` segment, for a query string or a hash fragment, for a URL
|
|
52
|
+
* scheme, for a dot segment (`.`, `..`, and their percent-encoded forms), and for any
|
|
53
|
+
* segment that a browser rewrites — one that holds whitespace, a backslash, or a
|
|
54
|
+
* character that a URL percent-encodes.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* normalizeBasePath("/:machineId/play/"); // "/:machineId/play"
|
|
59
|
+
* normalizeBasePath("admin"); // "/admin"
|
|
60
|
+
* normalizeBasePath("/"); // ""
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function normalizeBasePath(basePath) {
|
|
64
|
+
if (basePath === undefined || basePath === null || basePath === "")
|
|
65
|
+
return "";
|
|
66
|
+
// A base path is a PATHNAME, so refuse a whole URL before the slash collapse hides
|
|
67
|
+
// the mistake. "https://host/admin" collapses to "/https:/host/admin", whose every
|
|
68
|
+
// segment passes the segment guards below. The bridge would take that mount, then
|
|
69
|
+
// strip no real router location under it: the machine would go permanently silent,
|
|
70
|
+
// exactly as it does for a query or a hash.
|
|
71
|
+
assertNoScheme(basePath);
|
|
72
|
+
// Collapse each duplicate slash, add the leading slash, and drop the trailing one.
|
|
73
|
+
// The result therefore concatenates cleanly with a machine path, which always
|
|
74
|
+
// starts with "/", and it compares cleanly with a sanitized router location, which
|
|
75
|
+
// sanitizePathname() has already collapsed.
|
|
76
|
+
const collapsed = `/${basePath}`.replace(/\/+/g, "/").replace(/\/$/, "");
|
|
77
|
+
if (collapsed === "")
|
|
78
|
+
return "";
|
|
79
|
+
for (const segment of collapsed.slice(1).split("/")) {
|
|
80
|
+
assertBasePathSegment(segment, basePath);
|
|
81
|
+
}
|
|
82
|
+
return collapsed;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Resolves a base path and its params to the concrete prefix that a browser URL
|
|
86
|
+
* carries.
|
|
87
|
+
*
|
|
88
|
+
* A bridge calls this function one time, and again on each `setBasePath()` call. The
|
|
89
|
+
* result is always concrete. {@link stripBasePath} therefore compares a literal
|
|
90
|
+
* prefix, and no URLPattern match runs on the hot path of a navigation.
|
|
91
|
+
*
|
|
92
|
+
* @param basePath - The prefix, as a pattern or as a concrete path.
|
|
93
|
+
* @param params - The values of the `:param` segments of `basePath`.
|
|
94
|
+
* @returns The concrete prefix, and the values of each param for a `play.route` event.
|
|
95
|
+
* @throws {InvalidBasePathError} For a wildcard segment, for an optional `:param?`
|
|
96
|
+
* segment, for a `$param` segment, for a query string or a hash fragment, for a URL
|
|
97
|
+
* scheme, for a dot segment (`.`, `..`, and their percent-encoded forms), and for any
|
|
98
|
+
* segment that a browser rewrites — one that holds whitespace, a backslash, or a
|
|
99
|
+
* character that a URL percent-encodes.
|
|
100
|
+
* @throws {MissingBasePathParamError} When a `:param` of the prefix has no value.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* resolveBasePath("/:machineId/play", { machineId: "abc123" });
|
|
105
|
+
* // → { path: "/abc123/play", params: { machineId: "abc123" } }
|
|
106
|
+
*
|
|
107
|
+
* resolveBasePath("/admin");
|
|
108
|
+
* // → { path: "/admin", params: {} }
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export function resolveBasePath(basePath, params) {
|
|
112
|
+
const normalized = normalizeBasePath(basePath);
|
|
113
|
+
if (normalized === "")
|
|
114
|
+
return NO_BASE_PATH;
|
|
115
|
+
if (!normalized.includes(":")) {
|
|
116
|
+
return Object.freeze({
|
|
117
|
+
path: normalized,
|
|
118
|
+
params: Object.freeze({}),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
// A null prototype, for both directions of the lookup. A plain `{}` accumulator
|
|
122
|
+
// turns `resolvedParams["__proto__"] = value` into a write of the PROTOTYPE, so a
|
|
123
|
+
// param of that name would vanish from the result.
|
|
124
|
+
const resolvedParams = Object.create(null);
|
|
125
|
+
const segments = normalized
|
|
126
|
+
.slice(1)
|
|
127
|
+
.split("/")
|
|
128
|
+
.map((segment) => {
|
|
129
|
+
if (!segment.startsWith(":"))
|
|
130
|
+
return segment;
|
|
131
|
+
const name = segment.slice(1);
|
|
132
|
+
// `Object.hasOwn`, and not a bare read: `params[name]` walks the prototype
|
|
133
|
+
// chain, so ":constructor" with no value of its own found
|
|
134
|
+
// `Object.prototype.constructor` and resolved the prefix to the source text of
|
|
135
|
+
// a function. `stripBasePath` then read EVERY location as foreign, and the
|
|
136
|
+
// machine went silent for ever instead of failing loudly here.
|
|
137
|
+
const value = params !== undefined && Object.hasOwn(params, name)
|
|
138
|
+
? params[name] // nosemgrep: gitlab.eslint.detect-object-injection
|
|
139
|
+
: undefined;
|
|
140
|
+
if (value === undefined || value === null || value === "") {
|
|
141
|
+
throw new MissingBasePathParamError(name, basePath ?? "");
|
|
142
|
+
}
|
|
143
|
+
const text = String(value);
|
|
144
|
+
const encoded = encodeBasePathValue(text);
|
|
145
|
+
// The guards of `assertBasePathSegment` run on the PATTERN, before this
|
|
146
|
+
// substitution, so they see ":id" and never the value that replaces it. A value
|
|
147
|
+
// of "." or ".." therefore passed every one of them and resolved away in the
|
|
148
|
+
// browser: "/m/../play" comes back as "/play", `stripBasePath` reads every
|
|
149
|
+
// location as foreign, and the machine goes permanently silent with no error —
|
|
150
|
+
// the exact failure the dot-segment guard exists to prevent. Test the RESOLVED
|
|
151
|
+
// segment here.
|
|
152
|
+
if (!isStableSegment(encoded)) {
|
|
153
|
+
throw new InvalidBasePathError(basePath ?? "", `the value "${text}" of ":${name}" resolves to the segment "${encoded}", which a browser rewrites, so the prefix that comes back is not the prefix that went out.`);
|
|
154
|
+
}
|
|
155
|
+
resolvedParams[name] = text; // nosemgrep: gitlab.eslint.detect-object-injection
|
|
156
|
+
return encoded;
|
|
157
|
+
});
|
|
158
|
+
// FROZEN, both levels, for the same reason NO_BASE_PATH is: `RouterBridgeBase`
|
|
159
|
+
// returns `this.mount.params` BY REFERENCE from its accessor, and
|
|
160
|
+
// `Readonly<Record<string, string>>` is gone at run time. One write in consumer code
|
|
161
|
+
// would change what the bridge reports for the rest of its life, while `basePath`
|
|
162
|
+
// still holds the real prefix — the staleness the accessor promises cannot happen.
|
|
163
|
+
// Spread, and not the null-prototype record itself: a spread creates OWN properties,
|
|
164
|
+
// so a param named "__proto__" stays a key AND the value keeps a normal prototype.
|
|
165
|
+
// Handing the bare record out made `bridge.basePathParams.hasOwnProperty(…)` throw,
|
|
166
|
+
// on a value the docs describe as a `Readonly<Record<string, string>>`.
|
|
167
|
+
return Object.freeze({
|
|
168
|
+
path: `/${segments.join("/")}`,
|
|
169
|
+
params: Object.freeze({ ...resolvedParams }),
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Removes the base path from an inbound location of the router.
|
|
174
|
+
*
|
|
175
|
+
* The return value separates the two cases that make a shared router work:
|
|
176
|
+
* - A string is the MACHINE half of the location, for example `"/dashboard"` of
|
|
177
|
+
* `"/abc123/play/dashboard"`. The bridge matches it against the route map.
|
|
178
|
+
* - `null` means that the location is FOREIGN: it lies outside the mount, so it
|
|
179
|
+
* belongs to the host. The bridge sends no `play.route` event, AND it runs no
|
|
180
|
+
* corrective navigation. A correction here would drag the user off a page of the
|
|
181
|
+
* host.
|
|
182
|
+
*
|
|
183
|
+
* The match is exact, and it respects each segment boundary. `"/abc/playground"` is
|
|
184
|
+
* therefore foreign to the mount `"/abc/play"`.
|
|
185
|
+
*
|
|
186
|
+
* @param pathname - A sanitized pathname of the router, with no query and no duplicate slash.
|
|
187
|
+
* @param basePath - The concrete prefix of {@link resolveBasePath}. `""` removes nothing.
|
|
188
|
+
* @returns The machine half of the path, or `null` when the location is foreign.
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* stripBasePath("/abc123/play/dashboard", "/abc123/play"); // "/dashboard"
|
|
193
|
+
* stripBasePath("/abc123/play", "/abc123/play"); // "/"
|
|
194
|
+
* stripBasePath("/settings", "/abc123/play"); // null — the host owns it
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
export function stripBasePath(pathname, basePath) {
|
|
198
|
+
if (basePath === "")
|
|
199
|
+
return pathname;
|
|
200
|
+
if (pathname === basePath)
|
|
201
|
+
return "/";
|
|
202
|
+
if (pathname.startsWith(`${basePath}/`))
|
|
203
|
+
return pathname.slice(basePath.length);
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Adds the base path to an outbound path of the machine.
|
|
208
|
+
*
|
|
209
|
+
* The function joins the PATHNAME only. A query string and a hash fragment of the
|
|
210
|
+
* path of the machine stay at the end, because the prefix belongs in front of the
|
|
211
|
+
* path.
|
|
212
|
+
*
|
|
213
|
+
* @param basePath - The concrete prefix of {@link resolveBasePath}. `""` adds nothing.
|
|
214
|
+
* @param path - The path of the machine, for example `"/dashboard"` or `"/dates?trip=one-way"`.
|
|
215
|
+
* @returns The location for the router of the host.
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* joinBasePath("/abc123/play", "/dashboard"); // "/abc123/play/dashboard"
|
|
220
|
+
* joinBasePath("/abc123/play", "/"); // "/abc123/play"
|
|
221
|
+
* joinBasePath("/abc123/play", "/x?tab=a"); // "/abc123/play/x?tab=a"
|
|
222
|
+
* joinBasePath("", "/dashboard"); // "/dashboard"
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
export function joinBasePath(basePath, path) {
|
|
226
|
+
if (basePath === "")
|
|
227
|
+
return path;
|
|
228
|
+
const mark = firstMarkIndex(path);
|
|
229
|
+
const pathname = mark === -1 ? path : path.slice(0, mark);
|
|
230
|
+
const suffix = mark === -1 ? "" : path.slice(mark);
|
|
231
|
+
// The root of the machine IS the mount point: "/" must not append a trailing slash,
|
|
232
|
+
// because the router callback reports "/abc123/play" and a mismatch there would
|
|
233
|
+
// defeat the echo suppression of the bridge.
|
|
234
|
+
const joined = pathname === "" || pathname === "/"
|
|
235
|
+
? basePath
|
|
236
|
+
: `${basePath}${pathname.startsWith("/") ? "" : "/"}${pathname}`;
|
|
237
|
+
return `${joined}${suffix}`;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Gives the index of the first query mark or fragment mark of a path, or `-1`.
|
|
241
|
+
*
|
|
242
|
+
* The names say `At`, because both values are an INDEX. A name such as `hash` reads
|
|
243
|
+
* as a digest to a reader and to a scanner both: `gitlab.eslint.detect-possible-timing-attacks`
|
|
244
|
+
* fires on a `===` test against an identifier of that name, and it cannot see that
|
|
245
|
+
* the operands here are two numbers.
|
|
246
|
+
*
|
|
247
|
+
* @internal `RouterBridgeBase` splits a location on the same boundary, to read the
|
|
248
|
+
* pathname half of an actor route. One function, so the two sides cannot disagree
|
|
249
|
+
* about where a pathname ends.
|
|
250
|
+
*/
|
|
251
|
+
export function firstMarkIndex(path) {
|
|
252
|
+
const queryAt = path.indexOf("?");
|
|
253
|
+
const fragmentAt = path.indexOf("#");
|
|
254
|
+
if (queryAt === -1)
|
|
255
|
+
return fragmentAt;
|
|
256
|
+
if (fragmentAt === -1)
|
|
257
|
+
return queryAt;
|
|
258
|
+
return Math.min(queryAt, fragmentAt);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Refuses each segment of a base path that resolves to ONE concrete prefix never.
|
|
262
|
+
*
|
|
263
|
+
* A bridge writes a real browser URL from its prefix. A wildcard and an optional
|
|
264
|
+
* segment each describe a SET of prefixes, so neither of them holds a value to write,
|
|
265
|
+
* and a silent pass would put a literal `*` or `:section?` into the address bar.
|
|
266
|
+
*/
|
|
267
|
+
function assertBasePathSegment(segment, basePath) {
|
|
268
|
+
if (segment.includes("*")) {
|
|
269
|
+
throw new InvalidBasePathError(basePath, 'a wildcard segment cannot resolve to one concrete prefix. Drop the splat segment: mount on the prefix itself, for example "/:machineId/play" for the route "/$machineId/play/$".');
|
|
270
|
+
}
|
|
271
|
+
if (segment.startsWith("$")) {
|
|
272
|
+
throw new InvalidBasePathError(basePath, `"${segment}" looks like a route param of TanStack Router. A base path declares a param as ":${segment.slice(1)}", and its value goes in basePathParams.`);
|
|
273
|
+
}
|
|
274
|
+
if (segment.startsWith(":") && segment.endsWith("?")) {
|
|
275
|
+
throw new InvalidBasePathError(basePath, `the optional segment "${segment}" cannot resolve to one concrete prefix. Give a required ":${segment.slice(1, -1)}" param, or mount on the shorter prefix.`);
|
|
276
|
+
}
|
|
277
|
+
if (segment === ":") {
|
|
278
|
+
throw new InvalidBasePathError(basePath, "a param segment needs a name.");
|
|
279
|
+
}
|
|
280
|
+
// A browser resolves "." and ".." out of a location, so the prefix that
|
|
281
|
+
// `navigateRouter` writes is not the prefix that comes back: "/../admin/about"
|
|
282
|
+
// becomes "/admin/about", which no longer starts with the mount. Every later location
|
|
283
|
+
// would read as foreign and the machine would go permanently silent.
|
|
284
|
+
//
|
|
285
|
+
// The PERCENT-ENCODED forms resolve away exactly the same. The WHATWG URL standard
|
|
286
|
+
// reads "%2e" as a single-dot segment and ".%2e", "%2e." and "%2e%2e" as double-dot
|
|
287
|
+
// segments, each test case-insensitive, so "/a/%2e%2e/admin" also comes back as
|
|
288
|
+
// "/admin". A guard on the two literal forms alone let that mount through.
|
|
289
|
+
if (isDotSegment(segment)) {
|
|
290
|
+
throw new InvalidBasePathError(basePath, `the segment "${segment}" resolves away in a browser, so the prefix that comes back is not the prefix that went out. Give the path that it resolves to.`);
|
|
291
|
+
}
|
|
292
|
+
// A browser percent-encodes a space, a tab and a newline of a pathname, so the prefix
|
|
293
|
+
// that comes back is not the prefix that went out — the same failure as a dot segment,
|
|
294
|
+
// and the same silence. `assertNoScheme` also reads the RAW value, and a leading space
|
|
295
|
+
// hid a whole URL from it: " https://host/admin" collapsed to "/ https:/host/admin".
|
|
296
|
+
if (/\s/.test(segment)) {
|
|
297
|
+
throw new InvalidBasePathError(basePath, `the segment "${segment}" holds whitespace, which a browser percent-encodes, so the prefix that comes back is not the prefix that went out. Give the path with no whitespace in it.`);
|
|
298
|
+
}
|
|
299
|
+
// A base path is a PATHNAME. A query or a hash in it would survive normalization,
|
|
300
|
+
// then never match a router location — `sanitizePathname` has already removed both
|
|
301
|
+
// by the time `stripBasePath` compares — so every location would read as foreign
|
|
302
|
+
// and the machine would go permanently silent. Refuse it here instead.
|
|
303
|
+
if (segment.includes("?") || segment.includes("#")) {
|
|
304
|
+
throw new InvalidBasePathError(basePath, "a base path is a pathname only: it can carry no query string and no hash fragment. Put a query on the machine's own route instead.");
|
|
305
|
+
}
|
|
306
|
+
// The general form of the three guards above, and the one that catches the rest. A
|
|
307
|
+
// browser reads a "\" as a "/", so "/adm\in" arrives as two segments and "/a\..\x"
|
|
308
|
+
// arrives as "/x"; it percent-encodes a non-ASCII character and the characters '"',
|
|
309
|
+
// '<', '>', '{', '}', '^' and '`', so "/café" arrives as "/caf%C3%A9". Each one gives
|
|
310
|
+
// the same silence as a dot segment: no location matches the mount, and no error says
|
|
311
|
+
// so. The guards above stay, because each one names the mistake it found.
|
|
312
|
+
if (!isStableSegment(segment)) {
|
|
313
|
+
throw new InvalidBasePathError(basePath, `a browser rewrites the segment "${segment}", so the prefix that comes back is not the prefix that went out. Give the segment in the form that a URL carries, for example "caf%C3%A9" for "café".`);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/** The origin of the probe of {@link isStableSegment}. It reaches no network. */
|
|
317
|
+
const PROBE_ORIGIN = "http://probe.invalid";
|
|
318
|
+
/**
|
|
319
|
+
* Tells you whether a browser writes a path segment back exactly as it went out.
|
|
320
|
+
*
|
|
321
|
+
* The WHATWG URL parser rewrites a segment in several ways: it resolves "." and ".."
|
|
322
|
+
* away, it reads a "\" as a "/", and it percent-encodes whitespace, a non-ASCII
|
|
323
|
+
* character, and the characters '"', '<', '>', '{', '}', '^' and '`'. Every one of them
|
|
324
|
+
* gives one failure: the prefix that `navigateRouter` writes is not the prefix that
|
|
325
|
+
* comes back, so `stripBasePath` reads every location as foreign and the machine goes
|
|
326
|
+
* permanently silent, with no error raised.
|
|
327
|
+
*
|
|
328
|
+
* The function asks the URL parser, and it lists no character, because that list
|
|
329
|
+
* belongs to the standard and not to this file.
|
|
330
|
+
*/
|
|
331
|
+
function isStableSegment(segment) {
|
|
332
|
+
try {
|
|
333
|
+
return new URL(`/${segment}`, PROBE_ORIGIN).pathname === `/${segment}`;
|
|
334
|
+
}
|
|
335
|
+
catch {
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Tells you whether a segment is a single-dot or a double-dot path segment.
|
|
341
|
+
*
|
|
342
|
+
* The WHATWG URL standard names six forms, and a browser resolves every one of them out
|
|
343
|
+
* of a location: "." and "%2e" for the single dot, and "..", ".%2e", "%2e." and "%2e%2e"
|
|
344
|
+
* for the double dot. Each percent test is case-insensitive.
|
|
345
|
+
*/
|
|
346
|
+
function isDotSegment(segment) {
|
|
347
|
+
const decoded = segment.toLowerCase().replaceAll("%2e", ".");
|
|
348
|
+
return decoded === "." || decoded === "..";
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Refuses a base path that carries a URL scheme.
|
|
352
|
+
*
|
|
353
|
+
* The test runs on the RAW value, because the slash collapse of
|
|
354
|
+
* {@link normalizeBasePath} turns the form into a path that looks legal. It also runs
|
|
355
|
+
* on the TRIMMED value, because a browser drops the leading whitespace of a URL: a
|
|
356
|
+
* scheme behind a space is still a scheme. And it runs at every segment boundary,
|
|
357
|
+
* because a scheme that a caller joined behind a prefix of its own is still a scheme.
|
|
358
|
+
*
|
|
359
|
+
* A protocol-relative `//host/path` is NOT refused: it is indistinguishable from a
|
|
360
|
+
* sloppy `//a//b`, which the collapse deliberately forgives.
|
|
361
|
+
*
|
|
362
|
+
* @throws {InvalidBasePathError} For `scheme://host/path`.
|
|
363
|
+
*/
|
|
364
|
+
function assertNoScheme(basePath) {
|
|
365
|
+
// RFC 3986: a scheme starts with a letter, then holds letters, digits, "+", "-"
|
|
366
|
+
// and ".". A leading "//" with no scheme is the protocol-relative form.
|
|
367
|
+
// The test runs at EVERY segment boundary, and not at the start alone. A caller that
|
|
368
|
+
// joins a prefix onto a base writes "/https://app.example.com/admin", and also
|
|
369
|
+
// "/tenant/https://app.example.com/admin": the collapse then makes
|
|
370
|
+
// "/tenant/https:/app.example.com/admin", whose every segment is legal, so the bridge
|
|
371
|
+
// mounts where no real location starts and the machine goes permanently silent. A
|
|
372
|
+
// guard that stripped the LEADING slashes alone caught the first form and missed the
|
|
373
|
+
// second.
|
|
374
|
+
if (/(?:^|\/)[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(basePath.trim())) {
|
|
375
|
+
throw new InvalidBasePathError(basePath, 'a base path is a pathname only: it can carry no scheme and no host. Give the path part alone, for example "/admin" for "https://app.example.com/admin".');
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Escapes the value of a base-path param for a URL segment.
|
|
380
|
+
*
|
|
381
|
+
* `encodeURIComponent` leaves a `*` alone, and that is correct here: a `*` is a legal
|
|
382
|
+
* path character, and a browser reports it literally. An escape to `%2A` resolved a
|
|
383
|
+
* mount that no real location matches, so `stripBasePath` read every location as
|
|
384
|
+
* foreign and the machine went permanently silent, with no error raised.
|
|
385
|
+
*
|
|
386
|
+
* The `*` of "a pattern of no navigation" never reaches this value.
|
|
387
|
+
* `resolveNavigationPath` tests the MACHINE half of the route, and `joinBasePath` adds
|
|
388
|
+
* the prefix after that test — see the one `navigateRouter` call in
|
|
389
|
+
* `pushResolvedRoute`.
|
|
390
|
+
*/
|
|
391
|
+
function encodeBasePathValue(value) {
|
|
392
|
+
// `encodeURIComponent` encodes for a QUERY component, so it escapes eight characters
|
|
393
|
+
// that RFC 3986 lets a path segment hold raw: the sub-delims "$&+,;=" and ":" and
|
|
394
|
+
// "@". Every router reports those raw in a pathname, so an escape resolves a mount
|
|
395
|
+
// that no real location matches — `stripBasePath` reads every location as foreign and
|
|
396
|
+
// the machine goes permanently silent, with no error raised.
|
|
397
|
+
//
|
|
398
|
+
// Escape for a segment instead: put those characters back, and keep the escape of
|
|
399
|
+
// everything that would change the SHAPE of the path — "/", "?", "#" and "%" among
|
|
400
|
+
// them — because a value must forge no path and no query.
|
|
401
|
+
return encodeURIComponent(value).replace(/%(?:24|26|2B|2C|3A|3B|3D|40)/g, (escaped) => PATH_SEGMENT_SAFE.get(escaped) ?? escaped);
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* The escapes that {@link encodeBasePathValue} undoes: the characters a path segment
|
|
405
|
+
* holds raw, which `encodeURIComponent` escapes because it encodes for a query.
|
|
406
|
+
*/
|
|
407
|
+
/** A Map, and not an object: a dynamic key reaches no prototype through one. */
|
|
408
|
+
const PATH_SEGMENT_SAFE = new Map([
|
|
409
|
+
["%24", "$"],
|
|
410
|
+
["%26", "&"],
|
|
411
|
+
["%2B", "+"],
|
|
412
|
+
["%2C", ","],
|
|
413
|
+
["%3A", ":"],
|
|
414
|
+
["%3B", ";"],
|
|
415
|
+
["%3D", "="],
|
|
416
|
+
["%40", "@"],
|
|
417
|
+
]);
|
|
418
|
+
//# sourceMappingURL=base-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-path.js","sourceRoot":"","sources":["../src/base-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAA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S,CAAC,EAAE,MAAM,CAAA;KAAO;
|
|
1
|
+
{"version":3,"file":"base-route-map.d.ts","sourceRoot":"","sources":["../src/base-route-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA0BH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,YAAY;IAC5B,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,uGAAuG;IACvG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,qBAAa,QAAQ;IACpB,8EAA8E;IAC9E,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,cAAc,CAGpB;IACF,OAAO,CAAC,cAAc,CAAkC;IAExD;;;;;;;;;;;;;;;;;OAiBG;gBACS,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAE,SAAe,EAAE,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO;IAwCtF;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAuB7C;;;;;;;;;;;;;;;;OAgBG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAGhD"}
|
package/dist/base-route-map.js
CHANGED
|
@@ -119,6 +119,11 @@ export class RouteMap {
|
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
catch (err) {
|
|
122
|
+
// `getCompiledPattern` reports an invalid pattern itself, and with the REASON
|
|
123
|
+
// when it knows one. A second wrap here replaced that message with the
|
|
124
|
+
// generic one, so the explanation reached the caller never.
|
|
125
|
+
if (err instanceof InvalidRoutePatternError)
|
|
126
|
+
throw err;
|
|
122
127
|
throw new InvalidRoutePatternError(path, { cause: err });
|
|
123
128
|
}
|
|
124
129
|
this.patternBuck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AU,GAAG,aAAa,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;QAC9E,KAAK,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,UAAU,EAAE,CAAC;YAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;YACpD,IAAI,KAAK,EAAE,CAAC;gBACX,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;gBAC5C,OAAO,OAAO,CAAC;YAChB,CAAC;QACF,CAAC;QAED,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,gBAAgB,CAAC,OAAe;QAC/B,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC;IACrE,CAAC;CACD"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -123,13 +123,20 @@ export declare class UnknownStateTypeError extends PlayError {
|
|
|
123
123
|
constructor(stateType: string, nodeId: string, validTypes: string[]);
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
|
-
* The
|
|
127
|
-
*
|
|
128
|
-
*
|
|
126
|
+
* The library throws this error when `URLPattern` cannot compile the string of a route
|
|
127
|
+
* pattern. The `pattern` field holds the string in question, and `cause` holds the
|
|
128
|
+
* original error of the `URLPattern` constructor.
|
|
129
|
+
*
|
|
130
|
+
* Every compilation reports through this error, so `extractRouteParams` raises it for a
|
|
131
|
+
* pattern that no `RouteMap` ever held, and not a bare `TypeError`.
|
|
129
132
|
*
|
|
130
133
|
* The common causes:
|
|
131
134
|
* - A parenthesis or a bracket without its pair in the string of the pattern
|
|
132
135
|
* - A character that a URL pathname pattern does not permit
|
|
136
|
+
* - Two params of one pattern that land on the same URLPattern group. A name with a
|
|
137
|
+
* hyphen compiles with an underscore, so `:cat-id` and `:cat_id` are one group. The
|
|
138
|
+
* message names the two params and the group, and `cause` is absent: the library
|
|
139
|
+
* refuses the pattern before URLPattern sees it.
|
|
133
140
|
*
|
|
134
141
|
* **Error code:** `PLAY_ROUTE_MAP_INVALID_PATTERN`
|
|
135
142
|
*
|
|
@@ -149,6 +156,82 @@ export declare class UnknownStateTypeError extends PlayError {
|
|
|
149
156
|
export declare class InvalidRoutePatternError extends PlayError {
|
|
150
157
|
/** The string of the route pattern. URLPattern could not compile it. */
|
|
151
158
|
readonly pattern: string;
|
|
152
|
-
|
|
159
|
+
/**
|
|
160
|
+
* @param pattern - The route pattern that URLPattern could not compile.
|
|
161
|
+
* @param options - The standard `cause`, and an optional `reason` that says WHY. Give
|
|
162
|
+
* a reason whenever the library knows it: the pattern alone shows a caller nothing
|
|
163
|
+
* when the fault is a rewrite that the library made, and not the text they wrote.
|
|
164
|
+
*/
|
|
165
|
+
constructor(pattern: string, options?: ErrorOptions & {
|
|
166
|
+
reason?: string;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Thrown when a `basePath` option resolves to one concrete URL prefix never.
|
|
171
|
+
*
|
|
172
|
+
* A bridge writes a real browser URL from its prefix, so every segment must hold
|
|
173
|
+
* exactly one value. A wildcard segment (`*`), an optional segment (`:section?`), a
|
|
174
|
+
* nameless `:` segment, a query string, and a hash fragment each describe a SET of
|
|
175
|
+
* prefixes instead, or no prefix at all. A `$param` segment is the route-param
|
|
176
|
+
* syntax of TanStack Router: a base path writes a param as `:param`, and it takes
|
|
177
|
+
* the value of that param from `basePathParams`.
|
|
178
|
+
*
|
|
179
|
+
* **How to fix it:** mount on the prefix itself, and let the machine own the rest.
|
|
180
|
+
* For the splat route `/$machineId/play/$` of TanStack, the base path is
|
|
181
|
+
* `"/:machineId/play"` with `basePathParams: { machineId }`.
|
|
182
|
+
*
|
|
183
|
+
* **Error code:** `PLAY_ROUTER_INVALID_BASE_PATH`
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```typescript
|
|
187
|
+
* import { InvalidBasePathError } from "@xmachines/play-router/errors";
|
|
188
|
+
*
|
|
189
|
+
* try {
|
|
190
|
+
* bridge.setBasePath("/:machineId/play/*");
|
|
191
|
+
* } catch (err) {
|
|
192
|
+
* if (err instanceof InvalidBasePathError) {
|
|
193
|
+
* console.error(`Bad base path: "${err.basePath}"`, err.message);
|
|
194
|
+
* }
|
|
195
|
+
* }
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
export declare class InvalidBasePathError extends PlayError {
|
|
199
|
+
/** The `basePath` option of the refusal, exactly as the caller gave it. */
|
|
200
|
+
readonly basePath: string;
|
|
201
|
+
constructor(basePath: string, reason: string);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Thrown when a `:param` segment of a `basePath` has no value in `basePathParams`.
|
|
205
|
+
*
|
|
206
|
+
* A base path can be a pattern, so a host keeps one string that mirrors its own
|
|
207
|
+
* route config. The bridge must still resolve that pattern to a concrete prefix,
|
|
208
|
+
* because it writes a real browser URL, and it removes a literal prefix from every
|
|
209
|
+
* inbound location. Every `:param` therefore needs a value.
|
|
210
|
+
*
|
|
211
|
+
* **How to fix it:** give the value that the host resolved already — a loader of
|
|
212
|
+
* TanStack, or a `useParams()` call, holds it — as `basePathParams: { machineId }`.
|
|
213
|
+
* An empty string counts as an absent value, because it would collapse the segment.
|
|
214
|
+
*
|
|
215
|
+
* **Error code:** `PLAY_ROUTER_MISSING_BASE_PATH_PARAM`
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* import { MissingBasePathParamError } from "@xmachines/play-router/errors";
|
|
220
|
+
*
|
|
221
|
+
* try {
|
|
222
|
+
* connectRouter({ actor, router, routeMap, basePath: "/:machineId/play" });
|
|
223
|
+
* } catch (err) {
|
|
224
|
+
* if (err instanceof MissingBasePathParamError) {
|
|
225
|
+
* console.error(`basePath needs a value for :${err.param}`);
|
|
226
|
+
* }
|
|
227
|
+
* }
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
export declare class MissingBasePathParamError extends PlayError {
|
|
231
|
+
/** The name of the `:param` segment without a value, and without its `:`. */
|
|
232
|
+
readonly param: string;
|
|
233
|
+
/** The `basePath` option that declares the param. */
|
|
234
|
+
readonly basePath: string;
|
|
235
|
+
constructor(param: string, basePath: string);
|
|
153
236
|
}
|
|
154
237
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,eAAgB,SAAQ,SAAS;gBACjC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAInD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,oBAAqB,SAAQ,SAAS;;CAUlD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,0BAA2B,SAAQ,SAAS;;CASxD;AAED;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,SAAS;IACjD,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAEb,OAAO,EAAE,MAAM;CAS3B;AAED;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,SAAS;IACjD,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAEb,OAAO,EAAE,MAAM;CAS3B;AAED;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,SAAS;IACrD,sFAAsF;IACtF,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;gBAElB,UAAU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