svelte-router: Svelte 3–5 SPA Routing Without SvelteKit2026-08-05 · 8 min svelte-router candidate merge Four candidate sources each expose their next match with its declaration order; the matcher repeatedly takes the lowest order until one matches. Lowest declaration order wins each source offers its next candidate; the matcher merges them by array index static Map get(path) order 0 keyed dynamic segs 2 · users order 3 fallback dyn. :param first order 5 wildcard * /^.*$/ order 9 take the lowest order that still matches a regex only runs when its route is the current front-runner { component, params } Dashed: early exit — when the static hit already outranks every dynamic route, no bucket is consulted and no regex runs at all.
alpinejs-router: HTML-first Client-side Routing for Alpine.js2026-08-05 · 7 min alpinejs-router path resolution Five stages from an incoming path to route params, with the fallback at each stage noted on the right. Resolving one path each stage falls through to the next; the right column is what happens on a miss /teams/42/projects/9 1 · staticRoutes.has(path) a Set — paths with no “:” never compile hit → {} params 2 · dynamicRoutes[depth] bucket by segment count — here 4 no bucket → notfound 3 · keyed["teams"] + wildcard Map on first segment, then “:param” first both lists may run 4 · RegExp test, score order static 3 · regex param 2 · bare param 1 all miss → notfound 5 · named groups → params $router.params.projectId Declaration order is not consulted — specificity decides. is() and notfound() walk the same index.