@real-router/core 0.172.0 → 0.173.1
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-CENrI5VW.js +2 -0
- package/dist/cjs/Router-CENrI5VW.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 +2 -2
- package/dist/cjs/engine/search-params/index.d.ts +1 -1
- package/dist/cjs/helpers-BCSkINAR.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/route-batch-k_yzIZTV.js +2 -0
- package/dist/cjs/route-batch-k_yzIZTV.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 +9 -11
- package/dist/cjs/validation.js +1 -1
- package/dist/esm/Router-CFnIWPT3.mjs +2 -0
- package/dist/esm/Router-CFnIWPT3.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 +2 -2
- package/dist/esm/engine/search-params/index.d.mts +1 -1
- package/dist/esm/helpers-LeSZEDaV.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/route-batch-LdEAJqGb.mjs +2 -0
- package/dist/esm/route-batch-LdEAJqGb.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 +9 -11
- package/dist/esm/validation.mjs +1 -1
- package/package.json +1 -1
- package/dist/cjs/Router-CbpheBEo.js +0 -2
- package/dist/cjs/Router-CbpheBEo.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-C0q224rS.js +0 -2
- package/dist/cjs/internals-C0q224rS.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-DYuv6lN0.mjs +0 -2
- package/dist/esm/Router-DYuv6lN0.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-JRDAPvLO.mjs +0 -2
- package/dist/esm/internals-JRDAPvLO.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,193 +0,0 @@
|
|
|
1
|
-
import { Params, SearchParams, State } from "../types/base.mjs";
|
|
2
|
-
import "../types.mjs";
|
|
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.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"port.d.mts","names":[],"sources":["../../../src/pipeline/port.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2CiB;;;;;;;;EAQf,iBACE,cACA,QAAQ,QACR,SAAS;IAET;IACA,QAAQ;IAIR,SAAS;;;;;;;;;;;;;;;;;;;;;;EAuBX,gBAAgB,iBAAiB;EACjC,gBAAgB,iBAAiB;;;;;;;EAQjC,YAAY,cAAc,QAAQ,QAAQ,QAAQ;;;;;;;;;;;;;;EAelD,aAAa;;;;;;;;;;;;;EAcb,oBAAoB;;;;;;;EAQpB;;;;;;;;;;;;;;;;;;EAmBA,0BACI,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;EAwBvB,YAAY;;;;;;;;;;;;;;;;;;;EAoBZ,6BACI,mBAAmB;;;;;;;;;;;;;;EAevB,yBAAyB,OAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "../types.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./types.mjs";
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core-internal types. NOT part of the public `@real-router/core/types` surface
|
|
3
|
-
* (the `./index` barrel deliberately does not re-export these), so they never
|
|
4
|
-
* leak onto the subpath or the package root. Core modules import them directly
|
|
5
|
-
* from `./types/internal`.
|
|
6
|
-
*
|
|
7
|
-
* Imports pull from the sibling declaration files (not `./index`) to keep
|
|
8
|
-
* `internal.ts` off the barrel's re-export cycle (`import-x/no-cycle`).
|
|
9
|
-
* Exception: the augmentation-target interfaces (`NavigationOptions`,
|
|
10
|
-
* `StateContext`) are declared lexically IN `./index` (#1540) and can only be
|
|
11
|
-
* imported from there — acyclic here, since the barrel never re-exports
|
|
12
|
-
* `internal.ts`.
|
|
13
|
-
*/
|
|
14
|
-
import "./api.mjs";
|
|
15
|
-
import "./base.mjs";
|
|
16
|
-
import "../types.mjs";
|
|
17
|
-
import { LimitsConfig } from "./limits.mjs";
|
|
18
|
-
import "./tree-changed.mjs";
|
|
19
|
-
/**
|
|
20
|
-
* Immutable limits configuration type.
|
|
21
|
-
*/
|
|
22
|
-
export type Limits = Readonly<LimitsConfig>;
|
|
23
|
-
//# sourceMappingURL=internal.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.mts","names":[],"sources":["../../../src/types/internal.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;YAyDY,SAAS,SAAS"}
|