@real-router/core 0.171.1 → 0.173.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/dist/cjs/Router-DP-Axjj2.js +2 -0
- package/dist/cjs/Router-DP-Axjj2.js.map +1 -0
- package/dist/cjs/Router.d.ts.map +1 -1
- package/dist/cjs/api.js +1 -1
- package/dist/cjs/api.js.map +1 -1
- package/dist/cjs/engine/createMatcher.d.ts +0 -17
- package/dist/cjs/engine/createMatcher.d.ts.map +1 -1
- package/dist/cjs/engine/index.d.ts +3 -2
- package/dist/cjs/engine/search-params/index.d.ts +2 -2
- package/dist/cjs/engine/search-params/searchParams.d.ts +21 -1
- package/dist/cjs/engine/search-params/searchParams.d.ts.map +1 -0
- package/dist/cjs/helpers-BCSkINAR.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/route-batch-ByWFZwIP.js +2 -0
- package/dist/cjs/route-batch-ByWFZwIP.js.map +1 -0
- package/dist/cjs/types/api.d.ts +3 -6
- package/dist/cjs/types/api.d.ts.map +1 -1
- package/dist/cjs/types/base.d.ts +3 -6
- package/dist/cjs/types/base.d.ts.map +1 -1
- package/dist/cjs/types.d.ts +1 -7
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/validation.d.ts +10 -9
- package/dist/cjs/validation.js +1 -1
- package/dist/esm/Router-BuBcRFcb.mjs +2 -0
- package/dist/esm/Router-BuBcRFcb.mjs.map +1 -0
- package/dist/esm/Router.d.mts.map +1 -1
- package/dist/esm/api.mjs +1 -1
- package/dist/esm/api.mjs.map +1 -1
- package/dist/esm/engine/createMatcher.d.mts +0 -17
- package/dist/esm/engine/createMatcher.d.mts.map +1 -1
- package/dist/esm/engine/index.d.mts +3 -2
- package/dist/esm/engine/search-params/index.d.mts +2 -2
- package/dist/esm/engine/search-params/searchParams.d.mts +21 -1
- package/dist/esm/engine/search-params/searchParams.d.mts.map +1 -0
- package/dist/esm/helpers-LeSZEDaV.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/route-batch-BHxxucx6.mjs +2 -0
- package/dist/esm/route-batch-BHxxucx6.mjs.map +1 -0
- package/dist/esm/types/api.d.mts +3 -6
- package/dist/esm/types/api.d.mts.map +1 -1
- package/dist/esm/types/base.d.mts +3 -6
- package/dist/esm/types/base.d.mts.map +1 -1
- package/dist/esm/types.d.mts +1 -7
- package/dist/esm/types.d.mts.map +1 -1
- package/dist/esm/validation.d.mts +10 -9
- package/dist/esm/validation.mjs +1 -1
- package/package.json +1 -1
- package/dist/cjs/Router-DgiBVYF4.js +0 -2
- package/dist/cjs/Router-DgiBVYF4.js.map +0 -1
- package/dist/cjs/dependenciesStore.d.ts +0 -36
- package/dist/cjs/dependenciesStore.d.ts.map +0 -1
- package/dist/cjs/internals-2KakrCBP.js +0 -2
- package/dist/cjs/internals-2KakrCBP.js.map +0 -1
- package/dist/cjs/internals.d.ts +0 -158
- package/dist/cjs/internals.d.ts.map +0 -1
- package/dist/cjs/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.ts +0 -191
- package/dist/cjs/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.ts.map +0 -1
- package/dist/cjs/namespaces/RouteLifecycleNamespace/index.d.ts +0 -3
- package/dist/cjs/namespaces/RouteLifecycleNamespace/types.d.ts +0 -17
- package/dist/cjs/namespaces/RouteLifecycleNamespace/types.d.ts.map +0 -1
- package/dist/cjs/namespaces/RoutesNamespace/RoutesNamespace.d.ts +0 -7
- package/dist/cjs/namespaces/RoutesNamespace/index.d.ts +0 -4
- package/dist/cjs/namespaces/RoutesNamespace/routesStore.d.ts +0 -105
- package/dist/cjs/namespaces/RoutesNamespace/routesStore.d.ts.map +0 -1
- package/dist/cjs/namespaces/RoutesNamespace/types.d.ts +0 -71
- package/dist/cjs/namespaces/RoutesNamespace/types.d.ts.map +0 -1
- package/dist/cjs/pipeline/buildURL.d.ts +0 -2
- package/dist/cjs/pipeline/canonicalize.d.ts +0 -3
- package/dist/cjs/pipeline/index.d.ts +0 -22
- package/dist/cjs/pipeline/materialize.d.ts +0 -2
- package/dist/cjs/pipeline/port.d.ts +0 -193
- package/dist/cjs/pipeline/port.d.ts.map +0 -1
- package/dist/cjs/pipeline/types.d.ts +0 -1
- package/dist/cjs/transitionPath.d.ts +0 -1
- package/dist/cjs/types/internal.d.ts +0 -23
- package/dist/cjs/types/internal.d.ts.map +0 -1
- package/dist/esm/Router-C4CV__XQ.mjs +0 -2
- package/dist/esm/Router-C4CV__XQ.mjs.map +0 -1
- package/dist/esm/dependenciesStore.d.mts +0 -36
- package/dist/esm/dependenciesStore.d.mts.map +0 -1
- package/dist/esm/internals-D17AclZw.mjs +0 -2
- package/dist/esm/internals-D17AclZw.mjs.map +0 -1
- package/dist/esm/internals.d.mts +0 -158
- package/dist/esm/internals.d.mts.map +0 -1
- package/dist/esm/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.mts +0 -191
- package/dist/esm/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.mts.map +0 -1
- package/dist/esm/namespaces/RouteLifecycleNamespace/index.d.mts +0 -3
- package/dist/esm/namespaces/RouteLifecycleNamespace/types.d.mts +0 -17
- package/dist/esm/namespaces/RouteLifecycleNamespace/types.d.mts.map +0 -1
- package/dist/esm/namespaces/RoutesNamespace/RoutesNamespace.d.mts +0 -7
- package/dist/esm/namespaces/RoutesNamespace/index.d.mts +0 -4
- package/dist/esm/namespaces/RoutesNamespace/routesStore.d.mts +0 -105
- package/dist/esm/namespaces/RoutesNamespace/routesStore.d.mts.map +0 -1
- package/dist/esm/namespaces/RoutesNamespace/types.d.mts +0 -71
- package/dist/esm/namespaces/RoutesNamespace/types.d.mts.map +0 -1
- package/dist/esm/pipeline/buildURL.d.mts +0 -2
- package/dist/esm/pipeline/canonicalize.d.mts +0 -3
- package/dist/esm/pipeline/index.d.mts +0 -22
- package/dist/esm/pipeline/materialize.d.mts +0 -2
- package/dist/esm/pipeline/port.d.mts +0 -193
- package/dist/esm/pipeline/port.d.mts.map +0 -1
- package/dist/esm/pipeline/types.d.mts +0 -1
- package/dist/esm/transitionPath.d.mts +0 -1
- package/dist/esm/types/internal.d.mts +0 -23
- package/dist/esm/types/internal.d.mts.map +0 -1
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { State } from "../../types/base.js";
|
|
2
|
-
import { DefaultDependencies, GuardFn, GuardFnFactory } from "../../types/router.js";
|
|
3
|
-
import { RouteLifecycleDependencies } from "./types.js";
|
|
4
|
-
import "../../types.js";
|
|
5
|
-
/**
|
|
6
|
-
* Origin lane for a guard clear. Every `clearCanActivate` / `clearCanDeactivate`
|
|
7
|
-
* caller names its lane — there is no origin-blind default — so a new call site
|
|
8
|
-
* cannot silently wipe both the route-config and the external guard (#1171):
|
|
9
|
-
*
|
|
10
|
-
* - `"definition"` — clear only the route-config guard (`update(name, {…: null})`, #952).
|
|
11
|
-
* - `"external"` — clear only the external, component-managed guard
|
|
12
|
-
* (`removeXGuard()` and post-leave auto-cleanup — the inverse of `addXGuard()`).
|
|
13
|
-
* - `"both"` — clear both (route removal / router teardown; the route is gone).
|
|
14
|
-
*/
|
|
15
|
-
export type GuardClearScope = "definition" | "external" | "both";
|
|
16
|
-
/**
|
|
17
|
-
* Source of truth for `canActivate` / `canDeactivate` guards.
|
|
18
|
-
*
|
|
19
|
-
* Storage is split by origin into four factory Maps (definition vs external,
|
|
20
|
-
* each ×activate/deactivate); a single compiled-function Map per kind backs
|
|
21
|
-
* navigation ("external wins" — when a route holds both a definition and an
|
|
22
|
-
* external guard, the compiled guard is the external one, regardless of
|
|
23
|
-
* registration order; #1174). `getFunctions()` returns a cached
|
|
24
|
-
* `[deactivate, activate]` tuple for the hot path (stable reference, no
|
|
25
|
-
* per-navigate allocation).
|
|
26
|
-
*
|
|
27
|
-
* All input validation is handled upstream by `getLifecycleApi` and
|
|
28
|
-
* `getRoutesApi` — this class has no static methods.
|
|
29
|
-
*
|
|
30
|
-
* **Ordering convention.** Every paired surface lists **deactivate before
|
|
31
|
-
* activate**: `getFunctions()` / `getFactories()` return `[deactivate,
|
|
32
|
-
* activate]`, `getFactoriesByOrigin()` returns that tuple per origin, and
|
|
33
|
-
* `canNavigateTo(toDeactivate, toActivate, …)` takes deactivate first. Keep
|
|
34
|
-
* any new paired surface consistent with this order.
|
|
35
|
-
*/
|
|
36
|
-
export declare class RouteLifecycleNamespace<Dependencies extends DefaultDependencies = DefaultDependencies> {
|
|
37
|
-
#private;
|
|
38
|
-
setDependencies(deps: RouteLifecycleDependencies<Dependencies>): void;
|
|
39
|
-
getHandlerCount(type: "activate" | "deactivate"): number;
|
|
40
|
-
/**
|
|
41
|
-
* Pre-flights the #961 handler-limit `RangeError` into the route-CRUD PREPARE
|
|
42
|
-
* phase (#1046). `#registerHandler`'s per-slot limit check throws AFTER the
|
|
43
|
-
* tree/config swap, so `add`/`replace`/`update` would tear post-commit when a
|
|
44
|
-
* check stands at the type's count position and the count is at its limit.
|
|
45
|
-
* Asking the same position here — before any store mutation — keeps them
|
|
46
|
-
* atomic (#951/#956/#698): a batch that would exceed the limit aborts before a
|
|
47
|
-
* single write.
|
|
48
|
-
*
|
|
49
|
-
* Only NEW slots count (an overwrite leaves the union count unchanged, mirroring
|
|
50
|
-
* `#registerHandler`). For `replace` (`clearsDefinition = true`) the definition
|
|
51
|
-
* guards are about to be cleared, so the projection runs against the surviving
|
|
52
|
-
* EXTERNAL guards only — exactly the post-clear state the install loop sees.
|
|
53
|
-
* A no-op for a type with no check at its count position (the limit is
|
|
54
|
-
* opt-in), so bare core walks no name.
|
|
55
|
-
*
|
|
56
|
-
* @param activateNames - route names a `canActivate` would be registered for
|
|
57
|
-
* @param deactivateNames - route names a `canDeactivate` would be registered for
|
|
58
|
-
* @param clearsDefinition - true for `replace` (definition guards cleared first)
|
|
59
|
-
*/
|
|
60
|
-
preflightHandlerLimit(activateNames: Iterable<string>, deactivateNames: Iterable<string>, clearsDefinition: boolean): void;
|
|
61
|
-
/**
|
|
62
|
-
* Adds a canActivate guard for a route.
|
|
63
|
-
*
|
|
64
|
-
* @param name - Route name (input-validated by facade)
|
|
65
|
-
* @param handler - Guard function or boolean (input-validated by facade)
|
|
66
|
-
* @param isFromDefinition - True when guard comes from route definition
|
|
67
|
-
* (lands in the definition Map; subject to `clearDefinitionGuards()`).
|
|
68
|
-
* False when added via `getLifecycleApi().addActivateGuard(...)` (lands in
|
|
69
|
-
* the external Map; survives `replace()`).
|
|
70
|
-
*
|
|
71
|
-
* ⚑ REQUIRED, with no default (#1977). The clear side states the rule for
|
|
72
|
-
* itself — "there is no origin-blind default, so every caller commits to a
|
|
73
|
-
* lane and a new call site cannot silently clear both" — and a default here
|
|
74
|
-
* contradicts it, landing on the MINORITY polarity: three of the four
|
|
75
|
-
* in-repo callers are the definition lane and would have to remember `true`.
|
|
76
|
-
* A forgotten argument files a definition guard as EXTERNAL, where
|
|
77
|
-
* `clearDefinitionGuards()` does not reach it, so `replace()` keeps a guard
|
|
78
|
-
* belonging to a tree that no longer exists (measured: 1 surviving guard
|
|
79
|
-
* against 0 for the same call with the argument). An optional parameter
|
|
80
|
-
* gives the type nothing to catch.
|
|
81
|
-
*
|
|
82
|
-
* External wins at runtime (#1174): when a route holds both a definition and
|
|
83
|
-
* an external guard, the compiled function is the external one, regardless of
|
|
84
|
-
* registration order. Within one origin the most recent add overwrites. Origin
|
|
85
|
-
* determines which Map the factory is filed under (relevant for
|
|
86
|
-
* `clearDefinitionGuards()` and `cloneRouter` re-registration).
|
|
87
|
-
*/
|
|
88
|
-
addCanActivate(name: string, handler: GuardFnFactory<Dependencies> | boolean, isFromDefinition: boolean, precompiledFn?: GuardFn): void;
|
|
89
|
-
/**
|
|
90
|
-
* Adds a canDeactivate guard for a route.
|
|
91
|
-
*
|
|
92
|
-
* Symmetric counterpart to {@link addCanActivate}.
|
|
93
|
-
*/
|
|
94
|
-
addCanDeactivate(name: string, handler: GuardFnFactory<Dependencies> | boolean, isFromDefinition: boolean, precompiledFn?: GuardFn): void;
|
|
95
|
-
/**
|
|
96
|
-
* Removes a canActivate guard for a route. `scope` names the origin lane
|
|
97
|
-
* (see {@link GuardClearScope}) — there is no origin-blind default, so every
|
|
98
|
-
* caller commits to a lane and a new call site cannot silently clear both.
|
|
99
|
-
* Delegates to {@link #clearGuard} (mirrors the add side's `#registerHandler`).
|
|
100
|
-
*
|
|
101
|
-
* @param name - Route name (already validated by facade)
|
|
102
|
-
* @param scope - Which origin(s) to clear: `"definition"` / `"external"` / `"both"`
|
|
103
|
-
*/
|
|
104
|
-
clearCanActivate(name: string, scope: GuardClearScope): void;
|
|
105
|
-
/**
|
|
106
|
-
* Removes a canDeactivate guard for a route. Symmetric counterpart to
|
|
107
|
-
* {@link clearCanActivate}.
|
|
108
|
-
*
|
|
109
|
-
* The `"external"` lane is what makes a route-config `canDeactivate` durable:
|
|
110
|
-
* post-leave auto-cleanup (`completeTransition`) and `removeDeactivateGuard()`
|
|
111
|
-
* unregister only the external, component-managed guard (router5 mount/unmount
|
|
112
|
-
* heritage), while a definition guard survives for re-entry — symmetric with
|
|
113
|
-
* definition `canActivate`, which lives as long as the route is in the tree
|
|
114
|
-
* (#1171). Clearing both by default made a config guard one-shot: the first
|
|
115
|
-
* permitted leave erased it, so re-entry was unguarded, `getRoutesApi().get()`
|
|
116
|
-
* lost the field, and a clone taken after the leave never received it
|
|
117
|
-
* (clone invariant #6).
|
|
118
|
-
*
|
|
119
|
-
* @param name - Route name (already validated by facade)
|
|
120
|
-
* @param scope - Which origin(s) to clear: `"definition"` / `"external"` / `"both"`
|
|
121
|
-
*/
|
|
122
|
-
clearCanDeactivate(name: string, scope: GuardClearScope): void;
|
|
123
|
-
/**
|
|
124
|
-
* Clears all lifecycle handlers (canActivate and canDeactivate).
|
|
125
|
-
* Used by clearRoutes to reset all lifecycle state.
|
|
126
|
-
*/
|
|
127
|
-
clearAll(): void;
|
|
128
|
-
/**
|
|
129
|
-
* Clears only lifecycle handlers that were registered from route definitions.
|
|
130
|
-
* Used by HMR `replace()` to remove definition-sourced guards without
|
|
131
|
-
* touching externally-added guards.
|
|
132
|
-
*
|
|
133
|
-
* For a slot where BOTH a definition and an external guard exist, the external
|
|
134
|
-
* factory survives — and the compiled function is RE-DERIVED from it (#1192).
|
|
135
|
-
* Under external-wins (#1174) the compiled slot is already the external guard,
|
|
136
|
-
* so this re-derivation is idempotent — it goes through the same choke point
|
|
137
|
-
* that keeps clearing correct (and stays robust if the compiled slot were ever
|
|
138
|
-
* out of sync). For a definition-only slot, the compiled function is dropped.
|
|
139
|
-
*
|
|
140
|
-
* ⚑ Since #1649 the re-derivation READS the surviving external guard's stored
|
|
141
|
-
* compiled form instead of invoking its factory, which is what stopped this
|
|
142
|
-
* method from running application code mid-`replace()` (the #1627 site).
|
|
143
|
-
*/
|
|
144
|
-
clearDefinitionGuards(): void;
|
|
145
|
-
/**
|
|
146
|
-
* Returns lifecycle factories as a flat `[deactivate, activate]` tuple of
|
|
147
|
-
* `Record<name, factory>` — the effective view where external wins over
|
|
148
|
-
* definition for the same slot. Used by `getRoutesApi` to enrich route
|
|
149
|
-
* objects with their current canActivate / canDeactivate factories and by
|
|
150
|
-
* the route-removal cleanup path.
|
|
151
|
-
*
|
|
152
|
-
* For cloneRouter (which needs to preserve origin on re-registration), use
|
|
153
|
-
* {@link getFactoriesByOrigin} instead.
|
|
154
|
-
*/
|
|
155
|
-
getFactories(): [Record<string, GuardFnFactory<Dependencies>>, Record<string, GuardFnFactory<Dependencies>>];
|
|
156
|
-
/**
|
|
157
|
-
* Returns factories tagged by origin — definition and external as separate
|
|
158
|
-
* `[deactivate, activate]` tuples. Used by `cloneRouter` to re-register
|
|
159
|
-
* guards on the clone with their original origin flag preserved.
|
|
160
|
-
*/
|
|
161
|
-
getFactoriesByOrigin(): {
|
|
162
|
-
definition: [Record<string, GuardFnFactory<Dependencies>>, Record<string, GuardFnFactory<Dependencies>>];
|
|
163
|
-
external: [Record<string, GuardFnFactory<Dependencies>>, Record<string, GuardFnFactory<Dependencies>>];
|
|
164
|
-
};
|
|
165
|
-
/**
|
|
166
|
-
* Returns compiled lifecycle functions for transition execution.
|
|
167
|
-
*
|
|
168
|
-
* @returns Tuple of [canDeactivateFunctions, canActivateFunctions] as Maps
|
|
169
|
-
*/
|
|
170
|
-
getFunctions(): [Map<string, GuardFn>, Map<string, GuardFn>];
|
|
171
|
-
/**
|
|
172
|
-
* `methodName` is the door the caller typed; it names a throwing guard's log
|
|
173
|
-
* and travels with the synchronous ask's diagnostics (#2821).
|
|
174
|
-
*/
|
|
175
|
-
canNavigateTo(toDeactivate: string[], toActivate: string[], toState: State, fromState: State | undefined, methodName: string): boolean;
|
|
176
|
-
/**
|
|
177
|
-
* Compiles a guard factory to its `GuardFn` WITHOUT registering it — surfaces
|
|
178
|
-
* a throwing / non-function factory eagerly. The prepare-then-commit
|
|
179
|
-
* add/replace path (`adoptRouteArtifacts`) calls this for every pending guard
|
|
180
|
-
* BEFORE the store swap (#956), so a malformed factory aborts the mutation
|
|
181
|
-
* with the store untouched. The returned function is then installed via the
|
|
182
|
-
* `precompiledFn` argument of {@link addCanActivate} / {@link addCanDeactivate}
|
|
183
|
-
* — no re-compile, so a factory with compile-time side effects runs exactly
|
|
184
|
-
* once. Same boolean-shorthand handling + compile + non-function check as the
|
|
185
|
-
* inline `#registerHandler` path, so a route-config `canActivate: true`
|
|
186
|
-
* (boolean shorthand, runtime-reachable via the public route type) compiles to
|
|
187
|
-
* the cached `TRUE_GUARD`/`FALSE_GUARD` instead of throwing on a non-callable.
|
|
188
|
-
*/
|
|
189
|
-
compileGuardFactory(handler: GuardFnFactory<Dependencies> | boolean, methodName: string): GuardFn;
|
|
190
|
-
}
|
|
191
|
-
//# sourceMappingURL=RouteLifecycleNamespace.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RouteLifecycleNamespace.d.ts","names":[],"sources":["../../../../src/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.ts"],"mappings":";;;;;;;;;;;;;;YAiFY;;;;;;;;;;;;;;;;;;;;;qBAsBC,wBACX,qBAAqB,sBAAsB;;EAwD3C,gBAAgB,MAAM,2BAA2B;EAIjD,gBAAgB;;;;;;;;;;;;;;;;;;;;;EA+ChB,sBACE,eAAe,kBACf,iBAAiB,kBACjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCF,eACE,cACA,SAAS,eAAe,yBACxB,2BACA,gBAAgB;;;;;;EAiBlB,iBACE,cACA,SAAS,eAAe,yBACxB,2BACA,gBAAgB;;;;;;;;;;EAqBlB,iBAAiB,cAAc,OAAO;;;;;;;;;;;;;;;;;;EAqBtC,mBAAmB,cAAc,OAAO;;;;;EAQxC;;;;;;;;;;;;;;;;;EA6BA;;;;;;;;;;;EAmCA,iBACE,eAAe,eAAe,gBAC9B,eAAe,eAAe;;;;;;EA4ChC;IACE,aACE,eAAe,eAAe,gBAC9B,eAAe,eAAe;IAEhC,WACE,eAAe,eAAe,gBAC9B,eAAe,eAAe;;;;;;;EA+ClC,iBAAiB,YAAY,UAAU,YAAY;;;;;EAQnD,cACE,wBACA,sBACA,SAAS,OACT,WAAW,mBACX;;;;;;;;;;;;;;EA8CF,oBACE,SAAS,eAAe,yBACxB,qBACC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { DefaultDependencies, GuardFn, GuardFnFactory, RouterLogger } from "../../types/router.js";
|
|
2
|
-
import { CheckPositionMap, DiagnosticEventMap } from "../../types/api.js";
|
|
3
|
-
import "../../types.js";
|
|
4
|
-
export interface RouteLifecycleDependencies<Dependencies extends DefaultDependencies = DefaultDependencies> {
|
|
5
|
-
/** Per-router logger instance (from `getInternals(router).logger`) */
|
|
6
|
-
logger: RouterLogger;
|
|
7
|
-
compileFactory: (factory: GuardFnFactory<Dependencies>) => GuardFn;
|
|
8
|
-
/** Runs the checks registered at a position (#2388); a check may only throw. */
|
|
9
|
-
runChecks: <P extends keyof CheckPositionMap>(position: P, ...args: CheckPositionMap[P]) => void;
|
|
10
|
-
/** Whether any check stands at a position — asked before computing its arguments. */
|
|
11
|
-
hasChecks: (position: keyof CheckPositionMap) => boolean;
|
|
12
|
-
/** Reports an internal DIAGNOSTIC (#2388). Core states what happened. */
|
|
13
|
-
emitDiagnostic: <K extends keyof DiagnosticEventMap>(key: K, ...args: DiagnosticEventMap[K]) => void;
|
|
14
|
-
/** How many handlers listen to a kind — asked before computing its arguments. */
|
|
15
|
-
diagnosticListenerCount: (key: keyof DiagnosticEventMap) => number;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/namespaces/RouteLifecycleNamespace/types.ts"],"mappings":";;;iBAWiB,2BACf,qBAAqB,sBAAsB;;EAG3C,QAAQ;EAER,iBAAiB,SAAS,eAAe,kBAAkB;;EAG3D,YAAY,gBAAgB,kBAC1B,UAAU,MACP,MAAM,iBAAiB;;EAI5B,YAAY,gBAAgB;;EAG5B,iBAAiB,gBAAgB,oBAC/B,KAAK,MACF,MAAM,mBAAmB;;EAI9B,0BAA0B,WAAW"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { Unsubscribe } from "../../types/base.js";
|
|
2
|
-
import { DefaultDependencies, GuardFnFactory } from "../../types/router.js";
|
|
3
|
-
import { TreeChangedEvent } from "../../types/tree-changed.js";
|
|
4
|
-
import { RouteConfig, RoutesDependencies } from "./types.js";
|
|
5
|
-
import { RouteDefinition, RouteTree } from "../../engine/builder/types.js";
|
|
6
|
-
import { CreateMatcherOptions, Matcher } from "../../engine/createMatcher.js";
|
|
7
|
-
import "../../engine/index.js";
|
|
8
|
-
import "../../types.js";
|
|
9
|
-
import { RouteLifecycleNamespace } from "../RouteLifecycleNamespace/RouteLifecycleNamespace.js";
|
|
10
|
-
import "../RouteLifecycleNamespace/index.js";
|
|
11
|
-
/**
|
|
12
|
-
* The tree-change channel the routes doors raise and subscribe through.
|
|
13
|
-
* `Router` builds it over its event bus and hands it in with the store.
|
|
14
|
-
*
|
|
15
|
-
* A bridge of its own, because the public `addEventListener` cannot carry it:
|
|
16
|
-
* `"TREE_CHANGED"` is not in the `EventName` union, a duplicate listener throws
|
|
17
|
-
* there, and it exposes neither `emit` nor `listenerCount`.
|
|
18
|
-
*/
|
|
19
|
-
export interface TreeChangedChannel {
|
|
20
|
-
readonly emit: (event: TreeChangedEvent) => void;
|
|
21
|
-
readonly subscribe: (handler: (event: TreeChangedEvent) => void) => Unsubscribe;
|
|
22
|
-
readonly listenerCount: () => number;
|
|
23
|
-
/**
|
|
24
|
-
* True while a `TREE_CHANGED` emit is on the stack — the routes doors read it
|
|
25
|
-
* to reject reentrant route-CRUD from a `subscribeChanges` handler (#1032).
|
|
26
|
-
*/
|
|
27
|
-
readonly isEmitting: () => boolean;
|
|
28
|
-
}
|
|
29
|
-
export interface RoutesStore<Dependencies extends DefaultDependencies = DefaultDependencies> {
|
|
30
|
-
/**
|
|
31
|
-
* DERIVED VIEW, not stored state: reconstructed from `tree` on every access
|
|
32
|
-
* via `routeTreeToDefinitions` (the lossless inverse cloneRouter already
|
|
33
|
-
* relies on — the `~` absolute marker is restored, child order is the
|
|
34
|
-
* definition order). The tree is the single source of truth, so a third
|
|
35
|
-
* retained copy of the route table (~30 B/route) is not kept. Every reader
|
|
36
|
-
* is a cold CRUD/plugin-registration path; the derive is O(N).
|
|
37
|
-
*
|
|
38
|
-
* The returned array is a FRESH snapshot each time — mutating it never
|
|
39
|
-
* affects the store (pass an explicitly-mutated snapshot to
|
|
40
|
-
* `commitTreeChanges` instead, as `remove` does).
|
|
41
|
-
*/
|
|
42
|
-
readonly definitions: RouteDefinition[];
|
|
43
|
-
readonly config: RouteConfig;
|
|
44
|
-
tree: RouteTree;
|
|
45
|
-
matcher: Matcher;
|
|
46
|
-
/**
|
|
47
|
-
* Per-route-name cache of URL (path) param names, derived from `matcher` and
|
|
48
|
-
* read by `RoutesNamespace.getUrlParams` (powers `areStatesEqual` /
|
|
49
|
-
* `isActiveRoute`). Cleared on every `matcher` rebuild so comparisons never
|
|
50
|
-
* stay frozen to a route's pre-mutation param shape (#723).
|
|
51
|
-
*/
|
|
52
|
-
readonly urlParamsCache: Map<string, readonly string[]>;
|
|
53
|
-
/**
|
|
54
|
-
* Per-route-name cache of declared query param names (`?a&b` across the
|
|
55
|
-
* route's segments) MINUS its path slots — read by
|
|
56
|
-
* `RoutesNamespace.getQueryParams`, the registry every channel mechanism
|
|
57
|
-
* classifies through (#1556). The printing view is not cached here: it is the
|
|
58
|
-
* matcher's own array, handed over unchanged (#1932). Same lifecycle as
|
|
59
|
-
* `urlParamsCache`: cleared on every `matcher` rebuild.
|
|
60
|
-
*/
|
|
61
|
-
readonly queryParamsCache: Map<string, readonly string[]>;
|
|
62
|
-
resolvedForwardMap: Record<string, string>;
|
|
63
|
-
/**
|
|
64
|
-
* Is `replace()`'s revalidation window open (#1758 / #1759)?
|
|
65
|
-
*
|
|
66
|
-
* ⚑ Application code runs inside it — the route's `decodeParams`, invoked by
|
|
67
|
-
* the revalidating `matchPath`, and the new route's activation guards — while
|
|
68
|
-
* the router holds a state it has not yet revalidated. Reached from there,
|
|
69
|
-
* route-CRUD committed a bag the route could no longer build and a navigation
|
|
70
|
-
* left the committed state on a route the batch had dropped. Both doors
|
|
71
|
-
* consult this; `revalidation-window-ban-1758-1759.test.ts` owns the cells.
|
|
72
|
-
*/
|
|
73
|
-
revalidating: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Does ANY route in the tree forward? Read by `isActiveRoute` before its
|
|
76
|
-
* `forwardTo` arm's per-route gate, and worth its own field for a reason that
|
|
77
|
-
* is measurable rather than aesthetic (#1595): the two maps behind that gate
|
|
78
|
-
* are `Object.create(null)` dictionaries, which V8 keeps in dictionary mode,
|
|
79
|
-
* and two lookups on them cost ~14 ns — paid by every route in the tree for a
|
|
80
|
-
* feature only forwarding routes use, on every `<Link>` render across six
|
|
81
|
-
* adapters. A tree with no `forwardTo` at all — the common case — answers with
|
|
82
|
-
* one boolean load instead.
|
|
83
|
-
*
|
|
84
|
-
* ⚠ Maintained ONLY through {@link adoptForwardState}, together with
|
|
85
|
-
* `resolvedForwardMap`. The two are views of the same config and a stale
|
|
86
|
-
* `false` here silently switches the arm OFF, which is a correctness bug
|
|
87
|
-
* wearing a performance change's clothes: a `<Link>` to a forwarding route
|
|
88
|
-
* would render inactive again (the defect #1573 shipped the arm to fix).
|
|
89
|
-
* Pinned in `tests/functional/routes/isActiveRoute.test.ts`, describe
|
|
90
|
-
* `"forwardTo arm survives route-CRUD (#1595)"` — and the generative pin in
|
|
91
|
-
* `tests/property/cloneRouter.properties.ts`. ⚠ That describe name is
|
|
92
|
-
* narrower than its contents: `cloneRouter` writes forward config without
|
|
93
|
-
* being route-CRUD (#1800), so a clone case lives there too.
|
|
94
|
-
*/
|
|
95
|
-
hasAnyForward: boolean;
|
|
96
|
-
routeCustomFields: Record<string, Record<string, unknown>>;
|
|
97
|
-
rootPath: string;
|
|
98
|
-
readonly matcherOptions: CreateMatcherOptions | undefined;
|
|
99
|
-
readonly depsStore: RoutesDependencies<Dependencies> | undefined;
|
|
100
|
-
readonly lifecycleNamespace: RouteLifecycleNamespace<Dependencies> | undefined;
|
|
101
|
-
readonly treeChanged: TreeChangedChannel;
|
|
102
|
-
readonly pendingCanActivate: Map<string, GuardFnFactory<Dependencies>>;
|
|
103
|
-
readonly pendingCanDeactivate: Map<string, GuardFnFactory<Dependencies>>;
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=routesStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routesStore.d.ts","names":[],"sources":["../../../../src/namespaces/RoutesNamespace/routesStore.ts"],"mappings":";;;;;;;;;;;;;;;;;;iBAqGiB;WACN,OAAO,OAAO;WACd,YACP,UAAU,OAAO,8BACd;WACI;;;;;WAKA;;iBAGM,YACf,qBAAqB,sBAAsB;;;;;;;;;;;;;WAclC,aAAa;WACb,QAAQ;EACjB,MAAM;EACN,SAAS;;;;;;;WAOA,gBAAgB;;;;;;;;;WAShB,kBAAkB;EAC3B,oBAAoB;;;;;;;;;;;EAYpB;;;;;;;;;;;;;;;;;;;;;;EAuBA;EACA,mBAAmB,eAAe;EAClC;WACS,gBAAgB;WAKhB,WAAW,mBAAmB;WAC9B,oBACP,wBAAwB;WACjB,aAAa;WACb,oBAAoB,YAAY,eAAe;WAC/C,sBAAsB,YAAY,eAAe"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Params, ParamsSearch, SearchParams, State, UrlChannels } from "../../types/base.js";
|
|
2
|
-
import { DefaultDependencies, ForwardToCallback, GuardFn, GuardFnFactory, RouterLogger } from "../../types/router.js";
|
|
3
|
-
import { RouterInternals } from "../../internals.js";
|
|
4
|
-
import { RouteResolver } from "../../pipeline/port.js";
|
|
5
|
-
import "../../pipeline/index.js";
|
|
6
|
-
import "../../types.js";
|
|
7
|
-
/**
|
|
8
|
-
* Dependencies injected into RoutesNamespace.
|
|
9
|
-
*
|
|
10
|
-
* These are function references from the Router facade,
|
|
11
|
-
* avoiding the need to pass the entire Router object.
|
|
12
|
-
*/
|
|
13
|
-
export interface RoutesDependencies<Dependencies extends DefaultDependencies = DefaultDependencies> {
|
|
14
|
-
/** Per-router logger instance (from `getInternals(router).logger`) */
|
|
15
|
-
logger: RouterLogger;
|
|
16
|
-
/**
|
|
17
|
-
* The router's checks (#2388). This namespace asks one position,
|
|
18
|
-
* `matchPath:decoded`, at the one boundary on it where USER code hands back
|
|
19
|
-
* a value core then builds a state from (a route's `decodeParams`).
|
|
20
|
-
*/
|
|
21
|
-
checks: RouterInternals["checks"];
|
|
22
|
-
/**
|
|
23
|
-
* The pipeline's read-model (`RouteResolver`), shared with NavigationNamespace
|
|
24
|
-
* — one instance per router, created in `wireNamespaces`. Entry points on this
|
|
25
|
-
* namespace compose their target state through `canonicalize` / `buildURL` /
|
|
26
|
-
* `materialize` and reach the router's stage ① seam and route config through
|
|
27
|
-
* this port rather than through the namespace's own dependency closures, so
|
|
28
|
-
* every producer reads ONE read-model (nav-pipeline Phase 2).
|
|
29
|
-
*/
|
|
30
|
-
port: RouteResolver;
|
|
31
|
-
/**
|
|
32
|
-
* Register a canActivate handler for a route. `precompiledFn` installs an
|
|
33
|
-
* already-compiled `GuardFn` (from {@link compileGuard}) without re-invoking
|
|
34
|
-
* the factory — used by the #956 prepare-then-commit path so guards compile
|
|
35
|
-
* once, before the store swap.
|
|
36
|
-
*/
|
|
37
|
-
addActivateGuard: (name: string, handler: GuardFnFactory<Dependencies>, precompiledFn?: GuardFn) => void;
|
|
38
|
-
/** Register a canDeactivate handler for a route (see {@link addActivateGuard}). */
|
|
39
|
-
addDeactivateGuard: (name: string, handler: GuardFnFactory<Dependencies>, precompiledFn?: GuardFn) => void;
|
|
40
|
-
/**
|
|
41
|
-
* Compile a guard factory to its `GuardFn` WITHOUT registering it — surfaces a
|
|
42
|
-
* throwing / non-function factory eagerly so the add/replace commit can
|
|
43
|
-
* validate every guard before swapping the store (#956).
|
|
44
|
-
*/
|
|
45
|
-
compileGuard: (handler: GuardFnFactory<Dependencies>, methodName: string) => GuardFn;
|
|
46
|
-
/** Get current router state */
|
|
47
|
-
getState: () => State | undefined;
|
|
48
|
-
/** Compare two states for equality */
|
|
49
|
-
areStatesEqual: (state1: State | undefined, state2: State | undefined, ignoreQueryParams?: boolean) => boolean;
|
|
50
|
-
/** Get a dependency by name */
|
|
51
|
-
getDependency: <K extends keyof Dependencies>(name: K) => Dependencies[K];
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Configuration storage for routes.
|
|
55
|
-
* Stores decoders, encoders, default params, and forward mappings.
|
|
56
|
-
*/
|
|
57
|
-
export interface RouteConfig {
|
|
58
|
-
/** Custom param decoders per route */
|
|
59
|
-
decoders: Record<string, (channels: UrlChannels) => ParamsSearch>;
|
|
60
|
-
/** Custom param encoders per route */
|
|
61
|
-
encoders: Record<string, (channels: ParamsSearch) => ParamsSearch>;
|
|
62
|
-
/** Default params per route */
|
|
63
|
-
defaultParams: Record<string, Params>;
|
|
64
|
-
/** Default search (query) params per route (RFC-4 M2 / #1548) */
|
|
65
|
-
defaultSearch: Record<string, SearchParams>;
|
|
66
|
-
/** Forward mappings (source -> target) */
|
|
67
|
-
forwardMap: Record<string, string>;
|
|
68
|
-
/** Dynamic forward callbacks (source -> callback) */
|
|
69
|
-
forwardFnMap: Record<string, ForwardToCallback<any>>;
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/namespaces/RoutesNamespace/types.ts"],"mappings":";;;;;;;;;;;;iBAuBiB,mBACf,qBAAqB,sBAAsB;;EAG3C,QAAQ;;;;;;EAOR,QAAQ;;;;;;;;;EAUR,MAAM;;;;;;;EAQN,mBACE,cACA,SAAS,eAAe,eACxB,gBAAgB;;EAIlB,qBACE,cACA,SAAS,eAAe,eACxB,gBAAgB;;;;;;EAQlB,eACE,SAAS,eAAe,eACxB,uBACG;;EAML,gBAAgB;;EAGhB,iBACE,QAAQ,mBACR,QAAQ,mBACR;;EAIF,gBAAgB,gBAAgB,cAAc,MAAM,MAAM,aAAa;;;;;;iBAexD;;EAEf,UAAU,gBAAgB,UAAU,gBAAgB;;EAGpD,UAAU,gBAAgB,UAAU,iBAAiB;;EAGrD,eAAe,eAAe;;EAG9B,eAAe,eAAe;;EAG9B,YAAY;;EAIZ,cAAc,eAAe"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The navigation delivery pipeline: three primitives over one opaque type.
|
|
3
|
-
*
|
|
4
|
-
* `canonicalize` (the sole producer of `Canonical`) → `buildURL` (⑤a) /
|
|
5
|
-
* `materialize` (⑤b). The brand symbol is NOT exported, so nothing can reach
|
|
6
|
-
* these two primitives around `canonicalize` — and since Phase 4 that is a
|
|
7
|
-
* guarantee about the ROUTER, not only about this module: every producer of a
|
|
8
|
-
* URL or a State reaches it, in one of two compositional forms.
|
|
9
|
-
*
|
|
10
|
-
* Core-internal: not part of any published subpath. Its consumers are the
|
|
11
|
-
* router's own facade, namespaces and wiring.
|
|
12
|
-
*
|
|
13
|
-
* The two forms and who takes them, the port's wiring facts, the perf notes and
|
|
14
|
-
* the one deliberate exception (`navigateToNotFound`): ./CLAUDE.md
|
|
15
|
-
*
|
|
16
|
-
* @module pipeline
|
|
17
|
-
*/
|
|
18
|
-
import "./canonicalize.js";
|
|
19
|
-
import "./buildURL.js";
|
|
20
|
-
import "./materialize.js";
|
|
21
|
-
import { RouteResolver } from "./port.js";
|
|
22
|
-
export type { RouteResolver };
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { Params, SearchParams, State } from "../types/base.js";
|
|
2
|
-
import "../types.js";
|
|
3
|
-
/**
|
|
4
|
-
* The pipeline's read-model over the routes layer — a narrow port, not a new
|
|
5
|
-
* layer. The module stays pure and mock-testable; the router implements the
|
|
6
|
-
* port at wiring time (`wiring/wireNamespaces.ts`).
|
|
7
|
-
*
|
|
8
|
-
* ⚠ **ONE end is interceptable, and which one is a position, not a taste.** The
|
|
9
|
-
* signatures describe the pipeline's contract, not where the implementation
|
|
10
|
-
* goes:
|
|
11
|
-
*
|
|
12
|
-
* - `resolveForward` is wired to the `forwardState` SEAM (`Router.ts`, the
|
|
13
|
-
* interceptable built at `SEAM.forwardState`),
|
|
14
|
-
* i.e. the interceptable chain PLUS the centralized channel ASSERTION. There
|
|
15
|
-
* is no channel-SEPARATION wrapper behind it: the seam REFUSES a
|
|
16
|
-
* mis-channelled bag (`assertChannelCorrect`, `src/channels/guard.ts`) rather
|
|
17
|
-
* than repairing one behind the producer's back. Channel-correctness is the
|
|
18
|
-
* producer's contract, not something the port quietly restores. Calling
|
|
19
|
-
* the namespace primitive directly would switch off both the interceptors and
|
|
20
|
-
* that check.
|
|
21
|
-
* - `buildPath` is wired STRAIGHT to the namespace primitive — nothing
|
|
22
|
-
* interceptable stands between this port and the engine (#1938). A seam here
|
|
23
|
-
* would sit BELOW the route-default merge, where an injection reaches the URL
|
|
24
|
-
* and not `state.search`; `forwardState` is the seam that sits above it, and
|
|
25
|
-
* every door runs that one, `router.buildPath` included (#2087). One
|
|
26
|
-
* position, one answer.
|
|
27
|
-
*
|
|
28
|
-
* ⚠ It hands over `canonical.query` on every call, so the primitive's
|
|
29
|
-
* `search` is REQUIRED rather than defaulted. This port is its only caller.
|
|
30
|
-
*
|
|
31
|
-
* Accessors arrived with their consumers, as designed — `queryNames` with the
|
|
32
|
-
* channel guard, `admitsUndeclaredQuery` and later `printedQueryNames` with the
|
|
33
|
-
* mode gate (#1575 / #1932), `pathNames` and two sinks with the diagnostics
|
|
34
|
-
* (#1579 / #1584), a third sink with the codec diagnostic (#2905). One
|
|
35
|
-
* member the design (RFC §4.5) listed never arrived at all: `encode`. The route
|
|
36
|
-
* codecs stayed with the entry points that own their direction (`buildPath`
|
|
37
|
-
* calls `config.encoders`, `matchPath` calls `config.decoders`), so the port
|
|
38
|
-
* never grew a stage for them — which is the case for adding a member only
|
|
39
|
-
* together with its caller, since one added early is dead weight nothing
|
|
40
|
-
* detects (knip has no issue type for unused members of an interface).
|
|
41
|
-
*/
|
|
42
|
-
export interface RouteResolver {
|
|
43
|
-
/**
|
|
44
|
-
* Stage ① — resolve the `forwardTo` chain (layering the hops' defaults) and
|
|
45
|
-
* hand back channel-correct bags. Channel-correct by REFUSAL, not by repair:
|
|
46
|
-
* the seam asserts and throws (see the header). `search` flows THROUGH the
|
|
47
|
-
* interceptor zone, not past it: `search-schema` validates the query channel
|
|
48
|
-
* here on the URL→State direction.
|
|
49
|
-
*/
|
|
50
|
-
resolveForward: (name: string, params: Params, search?: SearchParams) => {
|
|
51
|
-
name: string;
|
|
52
|
-
params: Params;
|
|
53
|
-
search?: SearchParams | undefined;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Stage ③ input — the route's per-channel defaults. Split by field, never
|
|
57
|
-
* inferred: `defaultParams` owns the path channel, `defaultSearch` the query
|
|
58
|
-
* channel (RFC-4 M2 / #1548).
|
|
59
|
-
*
|
|
60
|
-
* Two accessors rather than one returning `{ params, search }`: `navigate` is
|
|
61
|
-
* the hot path, and the combined form allocated one throwaway object per
|
|
62
|
-
* navigation. That allocation is the deterministic reason; the bench arm it
|
|
63
|
-
* was measured on also carried a per-call `getInternals`, and the harness's
|
|
64
|
-
* own A/A spread is wider than the delta, so no percentage is attributable to
|
|
65
|
-
* this accessor alone.
|
|
66
|
-
*
|
|
67
|
-
* Also the ROUTE half of the fast-path gate (#1589), which is why these two are
|
|
68
|
-
* the only reads `canonicalize` still makes before it. A dedicated
|
|
69
|
-
* `mergesNothing()` predicate answering the same question in ONE hop was built
|
|
70
|
-
* and measured: it buys the fast path a further ~10 ns but makes the DEFAULTS
|
|
71
|
-
* path re-read both values below the gate — a fourth hop, +6.5 % there. Reading
|
|
72
|
-
* the values themselves regresses nothing, because the slow path was going to
|
|
73
|
-
* need them anyway.
|
|
74
|
-
*/
|
|
75
|
-
defaultParams: (name: string) => Params | undefined;
|
|
76
|
-
defaultSearch: (name: string) => SearchParams | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* Stage ⑤a printer — builds the URL from already-merged channels. Kept in
|
|
79
|
-
* raw-channel form (not `Canonical`) so the port never has to know about the
|
|
80
|
-
* brand and stays mockable on its own; `buildURL` is the primitive that
|
|
81
|
-
* accepts nothing but a `Canonical`.
|
|
82
|
-
*/
|
|
83
|
-
buildPath: (name: string, params: Params, search: SearchParams) => string;
|
|
84
|
-
/**
|
|
85
|
-
* The route's declared `?query` names MINUS its path slots — the registry that
|
|
86
|
-
* decides **which channel owns a key** (#1556 / #843 / #1549). A name that
|
|
87
|
-
* also occupies a path slot (`/items/:id?id`) is absent here by construction:
|
|
88
|
-
* it is legitimately path-owned, so the path value stays in `state.params`
|
|
89
|
-
* and the rebuild's precedence holds.
|
|
90
|
-
*
|
|
91
|
-
* ⚠ This is NOT the list of names the build prints, and the difference is one
|
|
92
|
-
* route shape wide (#1932). The consumers that CLASSIFY read this one — the
|
|
93
|
-
* always-on channel guard, the default withhold, the undeclared-key
|
|
94
|
-
* diagnostic. The mode gate asks the OTHER question and reads
|
|
95
|
-
* {@link RouteResolver.printedQueryNames}.
|
|
96
|
-
*/
|
|
97
|
-
queryNames: (name: string) => readonly string[];
|
|
98
|
-
/**
|
|
99
|
-
* The route's declared `?query` names AS PRINTED — the collision left in
|
|
100
|
-
* (#1932). The matcher keeps path-slot collisions in `declaredQueryParams`
|
|
101
|
-
* and the query-string build reads that same array, so a key is printed iff
|
|
102
|
-
* it appears here.
|
|
103
|
-
*
|
|
104
|
-
* ⚑ The mode gate's registry, and only the gate's. Its question is "will this
|
|
105
|
-
* key survive into `state.path`?", which is what buys
|
|
106
|
-
* `keys(state.search) ⊆ keys(matchPath(state.path).search)` — an invariant the
|
|
107
|
-
* SUBTRACTED list cannot answer for, since it withholds a name the build
|
|
108
|
-
* prints.
|
|
109
|
-
*/
|
|
110
|
-
printedQueryNames: (name: string) => readonly string[];
|
|
111
|
-
/**
|
|
112
|
-
* The mode gate (#1575) — `true` exactly for `queryParamsMode: "loose"`, the
|
|
113
|
-
* one mode whose build prints undeclared query keys. Read as a boolean rather
|
|
114
|
-
* than leaking the mode itself into the pipeline: the pipeline's question is
|
|
115
|
-
* "may an undeclared key be canonical here?", not "which mode is this?".
|
|
116
|
-
*/
|
|
117
|
-
admitsUndeclaredQuery: () => boolean;
|
|
118
|
-
/**
|
|
119
|
-
* The mode gate's opt-in diagnostic sink (#1575) — `undefined` while nothing
|
|
120
|
-
* listens to the router's `DROPPED_QUERY_KEY` kind, so bare core drops
|
|
121
|
-
* silently and the pipeline pays nothing. Resolved per read, not captured: a
|
|
122
|
-
* listener subscribes after wiring.
|
|
123
|
-
*
|
|
124
|
-
* ⚠ Like its sibling below, the absence has to be REAL: the router implements
|
|
125
|
-
* this as a GETTER returning `undefined` while the kind has no listener, not
|
|
126
|
-
* as a closure that forwards to the emitter. A closure is always truthy, so
|
|
127
|
-
* the pipeline's `?.` would read as taken and bare core would pay the
|
|
128
|
-
* `pathNames` existence lookup (#1584) once per dropped key with nothing to
|
|
129
|
-
* feed. The `| undefined` in the type is what lets the getter say so under
|
|
130
|
-
* `exactOptionalPropertyTypes`.
|
|
131
|
-
*
|
|
132
|
-
* Optional on the interface so a MOCK port (the property tests) stays a
|
|
133
|
-
* four-liner: the pipeline's contract is the drop, not the report.
|
|
134
|
-
*/
|
|
135
|
-
reportDroppedQueryKey?: ((routeName: string, key: string) => void) | undefined;
|
|
136
|
-
/**
|
|
137
|
-
* The PATH slot names the route's URL prints, the root's (`setRootPath`)
|
|
138
|
-
* included, or `undefined` when there is NO SUCH ROUTE — the other half of
|
|
139
|
-
* "is this key declared?". Needed only by the undeclared-key
|
|
140
|
-
* diagnostic (#1579), which asks whether a key is declared ANYWHERE;
|
|
141
|
-
* `queryNames` alone cannot answer that.
|
|
142
|
-
*
|
|
143
|
-
* ⚠ The `undefined` arm is load-bearing, not defensive (#1584). An empty array
|
|
144
|
-
* is what an EXISTING route with no path slots returns, so `[]` cannot say
|
|
145
|
-
* "no such route" — and the diagnostic, reading `[]` for both, reported every
|
|
146
|
-
* key in the caller's bag as "declared nowhere on route X" for a route X that
|
|
147
|
-
* has no declarations only because it has no existence. That blames the params
|
|
148
|
-
* for a typo in the ROUTE name, which is the most misleading direction
|
|
149
|
-
* available. The matcher already knows the difference (`getSegmentsByName`
|
|
150
|
-
* answers `undefined`), so this member carries it rather than flattening it
|
|
151
|
-
* to `[]`.
|
|
152
|
-
*
|
|
153
|
-
* `queryNames` is deliberately NOT given the same arm: its consumers — the
|
|
154
|
-
* diagnostic, the default merge and the channel guard — all want `[]` for a
|
|
155
|
-
* missing route, and only this one asks a question that presupposes
|
|
156
|
-
* existence.
|
|
157
|
-
*/
|
|
158
|
-
pathNames: (name: string) => readonly string[] | undefined;
|
|
159
|
-
/**
|
|
160
|
-
* Opt-in sink for a key the route declares NOWHERE (#1579 — the params half
|
|
161
|
-
* of #1553). Absent while nothing listens to the `UNDECLARED_PARAM_KEY`
|
|
162
|
-
* kind, and the absence is what keeps the scan off the hot path: core checks
|
|
163
|
-
* one `undefined` and skips the walk entirely.
|
|
164
|
-
*
|
|
165
|
-
* ⚠ The absence has to be REAL — the router implements this member as a
|
|
166
|
-
* GETTER returning `undefined` while the kind has no listener, not as a
|
|
167
|
-
* closure that forwards to the emitter. A closure is always truthy, so the
|
|
168
|
-
* gate would read as taken and bare core would walk the caller's bag on
|
|
169
|
-
* every commit; the `| undefined` in the type is what lets the getter say so
|
|
170
|
-
* under `exactOptionalPropertyTypes`.
|
|
171
|
-
*
|
|
172
|
-
* A diagnostic, never a gate — core keeps the key in `state.params` as
|
|
173
|
-
* app-level data (wiki `Route.md`). Dropping it was measured and rejected: it
|
|
174
|
-
* retires a shipped capability, and "declared nowhere" cannot tell a typo from
|
|
175
|
-
* `navigate("users", { id })` on a parent whose CHILD declares `:id`.
|
|
176
|
-
*/
|
|
177
|
-
reportUndeclaredParamKey?: ((routeName: string, key: string) => void) | undefined;
|
|
178
|
-
/**
|
|
179
|
-
* Opt-in sink for a route codec's round trip (#2905). Absent while nothing
|
|
180
|
-
* listens to the `CODEC_ROUND_TRIP` kind, so bare core reads one `undefined`
|
|
181
|
-
* per commit and looks up no codec for it.
|
|
182
|
-
*
|
|
183
|
-
* ⚑ Read by the two committing producers, not by `canonicalize`: what is
|
|
184
|
-
* judged is the state they build, which exists only after ⑤. The router's
|
|
185
|
-
* implementation raises the kind with the route's codecs and the path slots
|
|
186
|
-
* its URL prints, and only for a route that has a codec.
|
|
187
|
-
*
|
|
188
|
-
* ⚠ A GETTER on the router's port, like the two sinks above, so the absence
|
|
189
|
-
* is real.
|
|
190
|
-
*/
|
|
191
|
-
reportCodecRoundTrip?: ((state: State) => void) | undefined;
|
|
192
|
-
}
|
|
193
|
-
//# sourceMappingURL=port.d.ts.map
|