@real-router/core 0.52.0 → 0.54.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.
Files changed (95) hide show
  1. package/README.md +22 -10
  2. package/dist/cjs/Router-CJihdrWA.d.ts +67 -0
  3. package/dist/cjs/Router-CJihdrWA.d.ts.map +1 -0
  4. package/dist/cjs/Router-D8Awa7bY.js +6 -0
  5. package/dist/cjs/Router-D8Awa7bY.js.map +1 -0
  6. package/dist/cjs/RouterError-Bm9YnZ6e.d.ts +310 -0
  7. package/dist/cjs/RouterError-Bm9YnZ6e.d.ts.map +1 -0
  8. package/dist/cjs/api.d.ts +2 -1
  9. package/dist/cjs/api.d.ts.map +1 -1
  10. package/dist/cjs/api.js +1 -1
  11. package/dist/cjs/api.js.map +1 -1
  12. package/dist/cjs/cloneRouter-q-jHlBiv.js +2 -0
  13. package/dist/cjs/cloneRouter-q-jHlBiv.js.map +1 -0
  14. package/dist/cjs/index-8oPDJBQc.d.ts +306 -0
  15. package/dist/cjs/index-8oPDJBQc.d.ts.map +1 -0
  16. package/dist/cjs/{Router-DrBkBdZ5.d.ts → index-EwbhzRQw.d.ts} +4 -69
  17. package/dist/cjs/index-EwbhzRQw.d.ts.map +1 -0
  18. package/dist/cjs/index.d.ts +4 -197
  19. package/dist/cjs/index.d.ts.map +1 -1
  20. package/dist/cjs/index.js +1 -1
  21. package/dist/cjs/index.js.map +1 -1
  22. package/dist/cjs/{internals-na15rxo_.js → internals-CM6oaz9n.js} +1 -1
  23. package/dist/cjs/internals-CM6oaz9n.js.map +1 -0
  24. package/dist/cjs/utils.d.ts +2 -91
  25. package/dist/cjs/utils.js +1 -1
  26. package/dist/cjs/utils.js.map +1 -1
  27. package/dist/cjs/validation.d.ts +55 -44
  28. package/dist/cjs/validation.d.ts.map +1 -1
  29. package/dist/cjs/validation.js +1 -1
  30. package/dist/esm/Router-BeMyxy_V.mjs +6 -0
  31. package/dist/esm/Router-BeMyxy_V.mjs.map +1 -0
  32. package/dist/esm/Router-BmhiDQUJ.d.mts +67 -0
  33. package/dist/esm/Router-BmhiDQUJ.d.mts.map +1 -0
  34. package/dist/esm/RouterError-hhfSVGtY.d.mts +310 -0
  35. package/dist/esm/RouterError-hhfSVGtY.d.mts.map +1 -0
  36. package/dist/esm/api.d.mts +2 -1
  37. package/dist/esm/api.d.mts.map +1 -1
  38. package/dist/esm/api.mjs +1 -1
  39. package/dist/esm/api.mjs.map +1 -1
  40. package/dist/esm/cloneRouter-C_ULpzHM.mjs +2 -0
  41. package/dist/esm/cloneRouter-C_ULpzHM.mjs.map +1 -0
  42. package/dist/esm/{Router-BeXr2zW4.d.mts → index-DNjaY7KH.d.mts} +4 -69
  43. package/dist/esm/index-DNjaY7KH.d.mts.map +1 -0
  44. package/dist/esm/index-r_JTvSBH.d.mts +306 -0
  45. package/dist/esm/index-r_JTvSBH.d.mts.map +1 -0
  46. package/dist/esm/index.d.mts +4 -197
  47. package/dist/esm/index.d.mts.map +1 -1
  48. package/dist/esm/index.mjs +1 -1
  49. package/dist/esm/index.mjs.map +1 -1
  50. package/dist/esm/{internals-CCymabFj.mjs → internals-C59msvHY.mjs} +1 -1
  51. package/dist/esm/internals-C59msvHY.mjs.map +1 -0
  52. package/dist/esm/utils.d.mts +2 -91
  53. package/dist/esm/utils.mjs +1 -1
  54. package/dist/esm/utils.mjs.map +1 -1
  55. package/dist/esm/validation.d.mts +56 -43
  56. package/dist/esm/validation.d.mts.map +1 -1
  57. package/dist/esm/validation.mjs +1 -1
  58. package/package.json +1 -1
  59. package/src/Router.ts +13 -16
  60. package/src/api/getDependenciesApi.ts +3 -11
  61. package/src/api/getPluginApi.ts +3 -3
  62. package/src/api/getRoutesApi.ts +4 -2
  63. package/src/internals.ts +13 -1
  64. package/src/namespaces/DependenciesNamespace/dependenciesStore.ts +1 -1
  65. package/src/namespaces/NavigationNamespace/NavigationNamespace.ts +8 -4
  66. package/src/namespaces/NavigationNamespace/transition/completeTransition.ts +4 -0
  67. package/src/namespaces/RoutesNamespace/RoutesNamespace.ts +3 -3
  68. package/src/namespaces/StateNamespace/StateNamespace.ts +2 -2
  69. package/src/utils/createRequestScope.ts +174 -0
  70. package/src/utils/hydrateRouter.ts +68 -12
  71. package/src/utils/index.ts +17 -1
  72. package/src/utils/serializeRouterState.ts +51 -4
  73. package/src/utils/serializeState.ts +46 -5
  74. package/dist/cjs/Router-DrBkBdZ5.d.ts.map +0 -1
  75. package/dist/cjs/Router-Pztue5fk.js +0 -6
  76. package/dist/cjs/Router-Pztue5fk.js.map +0 -1
  77. package/dist/cjs/RouterError-BmvAyBlx.js +0 -2
  78. package/dist/cjs/RouterError-BmvAyBlx.js.map +0 -1
  79. package/dist/cjs/RouterValidator-DLy_W2du.d.ts +0 -114
  80. package/dist/cjs/RouterValidator-DLy_W2du.d.ts.map +0 -1
  81. package/dist/cjs/getPluginApi-CUcFDzuA.js +0 -2
  82. package/dist/cjs/getPluginApi-CUcFDzuA.js.map +0 -1
  83. package/dist/cjs/internals-na15rxo_.js.map +0 -1
  84. package/dist/cjs/utils.d.ts.map +0 -1
  85. package/dist/esm/Router-BeXr2zW4.d.mts.map +0 -1
  86. package/dist/esm/Router-CK8U23pP.mjs +0 -6
  87. package/dist/esm/Router-CK8U23pP.mjs.map +0 -1
  88. package/dist/esm/RouterError-D-Zjbdv9.mjs +0 -2
  89. package/dist/esm/RouterError-D-Zjbdv9.mjs.map +0 -1
  90. package/dist/esm/RouterValidator-C-PvV00i.d.mts +0 -114
  91. package/dist/esm/RouterValidator-C-PvV00i.d.mts.map +0 -1
  92. package/dist/esm/getPluginApi-CsTfDB-O.mjs +0 -2
  93. package/dist/esm/getPluginApi-CsTfDB-O.mjs.map +0 -1
  94. package/dist/esm/internals-CCymabFj.mjs.map +0 -1
  95. package/dist/esm/utils.d.mts.map +0 -1
@@ -1,6 +1,7 @@
1
- import { c as RouteConfigUpdate, f as RouteTree, i as GuardFnFactory, n as BuildStateResultWithSegments, o as PluginFactory, s as Route, t as Router } from "./Router-BeXr2zW4.mjs";
2
- import { t as RouterValidator } from "./RouterValidator-C-PvV00i.mjs";
3
- import { Config, DefaultDependencies, DefaultDependencies as DefaultDependencies$1, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventToNameMap, GuardFn, Listener, NavigationOptions, Navigator, Navigator as Navigator$1, Options, Options as Options$1, Params, Plugin, Router as Router$1, SimpleState, State, State as State$1, SubscribeFn, SubscribeState, Subscription, Unsubscribe } from "@real-router/types";
1
+ import { i as RouteTree } from "./index-DNjaY7KH.mjs";
2
+ import { c as RouteConfigUpdate, i as GuardFnFactory, n as BuildStateResultWithSegments, o as PluginFactory, s as Route, t as Router } from "./Router-BmhiDQUJ.mjs";
3
+ import { n as RouterValidator, t as RouterError } from "./RouterError-hhfSVGtY.mjs";
4
+ import { Config, DefaultDependencies, DefaultDependencies as DefaultDependencies$1, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventToNameMap, GuardFn, Listener, NavigationOptions, Navigator, Navigator as Navigator$1, Options, Options as Options$1, Params, Plugin, Router as Router$1, SimpleState, State, SubscribeFn, SubscribeState, Subscription, Unsubscribe } from "@real-router/types";
4
5
 
5
6
  //#region src/constants.d.ts
6
7
  type ConstantsKeys = "UNKNOWN_ROUTE";
@@ -24,200 +25,6 @@ declare const constants: Constants;
24
25
  */
25
26
  declare const events: EventToNameMap;
26
27
  //#endregion
27
- //#region src/RouterError.d.ts
28
- declare class RouterError extends Error {
29
- [key: string]: unknown;
30
- readonly segment: string | undefined;
31
- readonly path: string | undefined;
32
- readonly redirect: State$1 | undefined;
33
- code: string;
34
- /**
35
- * Creates a new RouterError instance.
36
- *
37
- * The options object accepts built-in fields (message, segment, path, redirect)
38
- * and any additional custom fields, which will all be attached to the error instance.
39
- *
40
- * @param code - The error code (e.g., "ROUTE_NOT_FOUND", "CANNOT_ACTIVATE")
41
- * @param options - Optional configuration object
42
- * @param options.message - Custom error message (defaults to code if not provided)
43
- * @param options.segment - The route segment where the error occurred
44
- * @param options.path - The full path where the error occurred
45
- * @param options.redirect - Optional redirect state for navigation errors
46
- *
47
- * @example
48
- * ```typescript
49
- * // Basic error
50
- * const err1 = new RouterError("ROUTE_NOT_FOUND");
51
- *
52
- * // Error with custom message
53
- * const err2 = new RouterError("ERR", { message: "Something went wrong" });
54
- *
55
- * // Error with context and custom fields
56
- * const err3 = new RouterError("CANNOT_ACTIVATE", {
57
- * message: "Insufficient permissions",
58
- * segment: "admin",
59
- * path: "/admin/users",
60
- * userId: "123" // custom field
61
- * });
62
- *
63
- * // Error with redirect
64
- * const err4 = new RouterError("TRANSITION_ERR", {
65
- * redirect: { name: "home", path: "/", params: {} }
66
- * });
67
- * ```
68
- */
69
- constructor(code: string, {
70
- message,
71
- segment,
72
- path,
73
- redirect,
74
- ...rest
75
- }?: {
76
- [key: string]: unknown;
77
- message?: string | undefined;
78
- segment?: string | undefined;
79
- path?: string | undefined;
80
- redirect?: State$1 | undefined;
81
- });
82
- /**
83
- * Updates the error code and conditionally updates the message.
84
- *
85
- * If the current message is one of the standard error code values
86
- * (e.g., "ROUTE_NOT_FOUND", "SAME_STATES"), it will be replaced with the new code.
87
- * This allows keeping error messages in sync with codes when using standard error codes.
88
- *
89
- * If the message is custom (not a standard error code), it will be preserved.
90
- *
91
- * @param newCode - The new error code to set
92
- *
93
- * @example
94
- * // Message follows code (standard error code as message)
95
- * const err = new RouterError("ROUTE_NOT_FOUND", { message: "ROUTE_NOT_FOUND" });
96
- * err.setCode("CUSTOM_ERROR"); // message becomes "CUSTOM_ERROR"
97
- *
98
- * @example
99
- * // Custom message is preserved
100
- * const err = new RouterError("ERR", { message: "Custom error message" });
101
- * err.setCode("NEW_CODE"); // message stays "Custom error message"
102
- */
103
- setCode(newCode: string): void;
104
- /**
105
- * Copies properties from another Error instance to this RouterError.
106
- *
107
- * This method updates the message, cause, and stack trace from the provided error.
108
- * Useful for wrapping native errors while preserving error context.
109
- *
110
- * @param err - The Error instance to copy properties from
111
- * @throws {TypeError} If err is null or undefined
112
- *
113
- * @example
114
- * ```typescript
115
- * const routerErr = new RouterError("TRANSITION_ERR");
116
- * try {
117
- * // some operation that might fail
118
- * } catch (nativeErr) {
119
- * routerErr.setErrorInstance(nativeErr);
120
- * throw routerErr;
121
- * }
122
- * ```
123
- */
124
- setErrorInstance(err: Error): void;
125
- /**
126
- * Adds custom fields to the error object.
127
- *
128
- * This method allows attaching arbitrary data to the error for debugging or logging purposes.
129
- * All fields become accessible as properties on the error instance and are included in JSON serialization.
130
- *
131
- * Reserved method names (setCode, setErrorInstance, setAdditionalFields, hasField, getField, toJSON)
132
- * are automatically filtered out to prevent accidental overwriting of class methods.
133
- *
134
- * @param fields - Object containing custom fields to add to the error
135
- *
136
- * @example
137
- * ```typescript
138
- * const err = new RouterError("CANNOT_ACTIVATE");
139
- * err.setAdditionalFields({
140
- * userId: "123",
141
- * attemptedRoute: "/admin",
142
- * reason: "insufficient permissions"
143
- * });
144
- *
145
- * console.log(err.userId); // "123"
146
- * console.log(JSON.stringify(err)); // includes all custom fields
147
- * ```
148
- */
149
- setAdditionalFields(fields: Record<string, unknown>): void;
150
- /**
151
- * Checks if a custom field exists on the error object.
152
- *
153
- * This method checks for both custom fields added via setAdditionalFields()
154
- * and built-in fields (code, message, segment, etc.).
155
- *
156
- * @param key - The field name to check
157
- * @returns `true` if the field exists, `false` otherwise
158
- *
159
- * @example
160
- * ```typescript
161
- * const err = new RouterError("ERR", { segment: "users" });
162
- * err.setAdditionalFields({ userId: "123" });
163
- *
164
- * err.hasField("userId"); // true
165
- * err.hasField("segment"); // true
166
- * err.hasField("unknown"); // false
167
- * ```
168
- */
169
- hasField(key: string): boolean;
170
- /**
171
- * Retrieves a custom field value from the error object.
172
- *
173
- * This method can access both custom fields and built-in fields.
174
- * Returns `undefined` if the field doesn't exist.
175
- *
176
- * @param key - The field name to retrieve
177
- * @returns The field value, or `undefined` if it doesn't exist
178
- *
179
- * @example
180
- * ```typescript
181
- * const err = new RouterError("ERR");
182
- * err.setAdditionalFields({ userId: "123", role: "admin" });
183
- *
184
- * err.getField("userId"); // "123"
185
- * err.getField("role"); // "admin"
186
- * err.getField("code"); // "ERR" (built-in field)
187
- * err.getField("unknown"); // undefined
188
- * ```
189
- */
190
- getField(key: string): unknown;
191
- /**
192
- * Serializes the error to a JSON-compatible object.
193
- *
194
- * This method is automatically called by JSON.stringify() and includes:
195
- * - Built-in fields: code, message, segment (if set), path (if set), redirect (if set)
196
- * - All custom fields added via setAdditionalFields() or constructor
197
- * - Excludes: stack trace (for security/cleanliness)
198
- *
199
- * @returns A plain object representation of the error, suitable for JSON serialization
200
- *
201
- * @example
202
- * ```typescript
203
- * const err = new RouterError("ROUTE_NOT_FOUND", {
204
- * message: "Route not found",
205
- * path: "/admin/users/123"
206
- * });
207
- * err.setAdditionalFields({ userId: "123" });
208
- *
209
- * JSON.stringify(err);
210
- * // {
211
- * // "code": "ROUTE_NOT_FOUND",
212
- * // "message": "Route not found",
213
- * // "path": "/admin/users/123",
214
- * // "userId": "123"
215
- * // }
216
- * ```
217
- */
218
- toJSON(): Record<string, unknown>;
219
- }
220
- //#endregion
221
28
  //#region src/createRouter.d.ts
222
29
  /**
223
30
  * Creates a new router instance.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/constants.ts","../../src/RouterError.ts","../../src/createRouter.ts","../../src/getNavigator.ts","../../src/namespaces/RoutesNamespace/forwardChain.ts"],"mappings":";;;;;KAWY,aAAA;AAAA,KAEA,SAAA,GAAY,MAAA,CAAO,aAAA;AAAA,KAMnB,UAAA,GAAa,MAAA,CAAO,aAAA,EAAe,eAAA;;AAR/C;;;;cAea,UAAA,EAAY,mBAAA;AAbzB;;;;AAAA,cAgCa,aAAA;AAAA,cAEA,SAAA,EAAW,SAAA;;;;;cAsBX,MAAA,EAAQ,cAAA;;;cC7CR,WAAA,SAAoB,KAAA;EAAA,CAC9B,GAAA;EAAA,SAIQ,OAAA;EAAA,SACA,IAAA;EAAA,SACA,QAAA,EAAU,OAAA;EAInB,IAAA;;;;ADtBF;;;;;AAMA;;;;;;;;;;;;;AAOA;;;;;AAmBA;;;;;AAEA;;;;cC0BI,IAAA;IAEE,OAAA;IACA,OAAA;IACA,IAAA;IACA,QAAA;IAAA,GACG;EAAA;IAAA,CAEF,GAAA;IACD,OAAA;IACA,OAAA;IACA,IAAA;IACA,QAAA,GAAW,OAAA;EAAA;;;AA7DjB;;;;;;;;;;;;;;;;;;;EA4GE,OAAA,CAAQ,OAAA;EArGW;;;;;;;;;;;;;;;;;;;;EAkInB,gBAAA,CAAiB,GAAA,EAAK,KAAA;EAAtB;;;;;;;;;;;;;;;;;AC1IF;;;;;;;ED+KE,mBAAA,CAAoB,MAAA,EAAQ,MAAA;EC3KnB;;;;;;;;;;;;;;;;;;;ED6MT,QAAA,CAAS,GAAA;EC3MW;;;;ACrBtB;;;;;;;;;;;;;;;;EFwPE,QAAA,CAAS,GAAA;EEnOV;;;;;AC3BD;;;;;;;;;;;;;;;;;;;;;;EH6RE,MAAA,CAAA,GAAU,MAAA;AAAA;;;;;ADpRZ;;;;;AAEA;;;;;AAMA;;;;cEIa,YAAA,wBACU,qBAAA,GAAsB,qBAAA,EAE3C,MAAA,GAAQ,KAAA,CAAM,YAAA,KACd,OAAA,GAAS,OAAA,CAAQ,SAAA,GACjB,YAAA,GAAc,YAAA,KACb,MAAA,CAAO,YAAA;;;cCrBG,YAAA,wBACU,qBAAA,GAAsB,qBAAA,EAE3C,MAAA,EAAQ,QAAA,CAAO,YAAA,MACd,WAAA;;;iBCVa,mBAAA,CACd,UAAA,UACA,UAAA,EAAY,MAAA,kBACZ,QAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/constants.ts","../../src/createRouter.ts","../../src/getNavigator.ts","../../src/namespaces/RoutesNamespace/forwardChain.ts"],"mappings":";;;;;;KAWY,aAAA;AAAA,KAEA,SAAA,GAAY,MAAM,CAAC,aAAA;AAAA,KAMnB,UAAA,GAAa,MAAA,CAAO,aAAA,EAAe,eAAA;;;AAR/C;;;cAea,UAAA,EAAY,mBAavB;AA5BuB;AAEzB;;;AAFyB,cAkCZ,aAAA;AAAA,cAEA,SAAA,EAAW,SAEvB;;;;;cAoBY,MAAA,EAAQ,cAQpB;;;;;;AAlED;;;;AAAyB;AAEzB;;;;AAA4C;AAM5C;;;cCIa,YAAA,wBACU,qBAAA,GAAsB,qBAAA,EAE3C,MAAA,GAAQ,KAAA,CAAM,YAAA,KACd,OAAA,GAAS,OAAA,CAAQ,SAAA,GACjB,YAAA,GAAc,YAAA,KACb,MAAA,CAAO,YAAA;;;cCrBG,YAAA,wBACU,qBAAA,GAAsB,qBAAA,EAE3C,MAAA,EAAQ,QAAA,CAAO,YAAA,MACd,WAAA;;;iBCVa,mBAAA,CACd,UAAA,UACA,UAAA,EAAY,MAAM,kBAClB,QAAA"}
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./Router-CK8U23pP.mjs";import{c as n,d as r,l as i,t as a,u as o}from"./RouterError-D-Zjbdv9.mjs";const s=(e=[],n={},r={})=>new t(e,n,r),c=new WeakMap,l=e=>{let t=c.get(e);return t||(t=Object.freeze({navigate:e.navigate,getState:e.getState,isActiveRoute:e.isActiveRoute,canNavigateTo:e.canNavigateTo,subscribe:e.subscribe,subscribeLeave:e.subscribeLeave,isLeaveApproved:e.isLeaveApproved}),c.set(e,t)),t};export{t as Router,a as RouterError,n as UNKNOWN_ROUTE,i as constants,s as createRouter,o as errorCodes,r as events,l as getNavigator,e as resolveForwardChain};
1
+ import{f as e,h as t,m as n,n as r,o as i,p as a,t as o}from"./Router-BeMyxy_V.mjs";const s=(e=[],t={},n={})=>new o(e,t,n),c=new WeakMap,l=e=>{let t=c.get(e);return t||(t=Object.freeze({navigate:e.navigate,getState:e.getState,isActiveRoute:e.isActiveRoute,canNavigateTo:e.canNavigateTo,subscribe:e.subscribe,subscribeLeave:e.subscribeLeave,isLeaveApproved:e.isLeaveApproved}),c.set(e,t)),t};export{o as Router,r as RouterError,e as UNKNOWN_ROUTE,a as constants,s as createRouter,n as errorCodes,t as events,l as getNavigator,i as resolveForwardChain};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/createRouter.ts","../../src/getNavigator.ts"],"sourcesContent":["// packages/core/src/createRouter.ts\n\nimport { Router } from \"./Router\";\n\nimport type { Route } from \"./types\";\nimport type { DefaultDependencies, Options } from \"@real-router/types\";\n\n/**\n * Creates a new router instance.\n *\n * @param routes - Array of route definitions\n * @param options - Router configuration options\n * @param dependencies - Dependencies to inject into the router\n * @returns A new Router instance\n *\n * @example\n * const router = createRouter([\n * { name: 'home', path: '/' },\n * { name: 'users', path: '/users' },\n * ]);\n *\n * router.start('/');\n */\nexport const createRouter = <\n Dependencies extends DefaultDependencies = DefaultDependencies,\n>(\n routes: Route<Dependencies>[] = [],\n options: Partial<Options> = {},\n dependencies: Dependencies = {} as Dependencies,\n): Router<Dependencies> => {\n return new Router<Dependencies>(routes, options, dependencies);\n};\n","import type {\n Navigator,\n DefaultDependencies,\n Router,\n} from \"@real-router/types\";\n\nconst cache = new WeakMap<Router, Navigator>();\n\nexport const getNavigator = <\n Dependencies extends DefaultDependencies = DefaultDependencies,\n>(\n router: Router<Dependencies>,\n): Navigator => {\n let nav = cache.get(router);\n\n if (!nav) {\n nav = Object.freeze({\n navigate: router.navigate,\n getState: router.getState,\n isActiveRoute: router.isActiveRoute,\n canNavigateTo: router.canNavigateTo,\n subscribe: router.subscribe,\n subscribeLeave: router.subscribeLeave,\n isLeaveApproved: router.isLeaveApproved,\n } as Navigator);\n cache.set(router, nav);\n }\n\n return nav;\n};\n"],"mappings":"uHAuBA,MAAa,GAGX,EAAgC,EAAE,CAClC,EAA4B,EAAE,CAC9B,EAA6B,EAAE,GAExB,IAAI,EAAqB,EAAQ,EAAS,EAAa,CCxB1D,EAAQ,IAAI,QAEL,EAGX,GACc,CACd,IAAI,EAAM,EAAM,IAAI,EAAO,CAe3B,OAbK,IACH,EAAM,OAAO,OAAO,CAClB,SAAU,EAAO,SACjB,SAAU,EAAO,SACjB,cAAe,EAAO,cACtB,cAAe,EAAO,cACtB,UAAW,EAAO,UAClB,eAAgB,EAAO,eACvB,gBAAiB,EAAO,gBACzB,CAAc,CACf,EAAM,IAAI,EAAQ,EAAI,EAGjB"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/createRouter.ts","../../src/getNavigator.ts"],"sourcesContent":["// packages/core/src/createRouter.ts\n\nimport { Router } from \"./Router\";\n\nimport type { Route } from \"./types\";\nimport type { DefaultDependencies, Options } from \"@real-router/types\";\n\n/**\n * Creates a new router instance.\n *\n * @param routes - Array of route definitions\n * @param options - Router configuration options\n * @param dependencies - Dependencies to inject into the router\n * @returns A new Router instance\n *\n * @example\n * const router = createRouter([\n * { name: 'home', path: '/' },\n * { name: 'users', path: '/users' },\n * ]);\n *\n * router.start('/');\n */\nexport const createRouter = <\n Dependencies extends DefaultDependencies = DefaultDependencies,\n>(\n routes: Route<Dependencies>[] = [],\n options: Partial<Options> = {},\n dependencies: Dependencies = {} as Dependencies,\n): Router<Dependencies> => {\n return new Router<Dependencies>(routes, options, dependencies);\n};\n","import type {\n Navigator,\n DefaultDependencies,\n Router,\n} from \"@real-router/types\";\n\nconst cache = new WeakMap<Router, Navigator>();\n\nexport const getNavigator = <\n Dependencies extends DefaultDependencies = DefaultDependencies,\n>(\n router: Router<Dependencies>,\n): Navigator => {\n let nav = cache.get(router);\n\n if (!nav) {\n nav = Object.freeze({\n navigate: router.navigate,\n getState: router.getState,\n isActiveRoute: router.isActiveRoute,\n canNavigateTo: router.canNavigateTo,\n subscribe: router.subscribe,\n subscribeLeave: router.subscribeLeave,\n isLeaveApproved: router.isLeaveApproved,\n } as Navigator);\n cache.set(router, nav);\n }\n\n return nav;\n};\n"],"mappings":"oFAuBA,MAAa,GAGX,EAAgC,CAAC,EACjC,EAA4B,CAAC,EAC7B,EAA6B,CAAC,IAEvB,IAAI,EAAqB,EAAQ,EAAS,CAAY,ECxBzD,EAAQ,IAAI,QAEL,EAGX,GACc,CACd,IAAI,EAAM,EAAM,IAAI,CAAM,EAe1B,OAbK,IACH,EAAM,OAAO,OAAO,CAClB,SAAU,EAAO,SACjB,SAAU,EAAO,SACjB,cAAe,EAAO,cACtB,cAAe,EAAO,cACtB,UAAW,EAAO,UAClB,eAAgB,EAAO,eACvB,gBAAiB,EAAO,eAC1B,CAAc,EACd,EAAM,IAAI,EAAQ,CAAG,GAGhB,CACT"}
@@ -1,2 +1,2 @@
1
1
  const e=new WeakMap;function t(t){let n=e.get(t);if(!n)throw TypeError(`[real-router] Invalid router instance — not found in internals registry`);return n}function n(t,n){e.set(t,n)}function r(e,t,n){let r=t;for(let t of e){let e=r;r=(...n)=>t(e,...n)}return r(...n)}function i(e,t,n){return((...i)=>{let a=n.get(e);return!a||a.length===0?t(...i):r(a,t,i)})}function a(e,t,n){return(i,a)=>{let o=n.get(e);return!o||o.length===0?t(i,a):r(o,t,[i,a])}}export{n as i,a as n,t as r,i as t};
2
- //# sourceMappingURL=internals-CCymabFj.mjs.map
2
+ //# sourceMappingURL=internals-C59msvHY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internals-C59msvHY.mjs","names":[],"sources":["../../src/internals.ts"],"sourcesContent":["import type { DependenciesStore } from \"./namespaces\";\nimport type { RoutesStore } from \"./namespaces/RoutesNamespace\";\nimport type { Router as RouterClass } from \"./Router\";\nimport type { EventMethodMap, GuardFnFactory, PluginFactory } from \"./types\";\nimport type { RouterValidator } from \"./types/RouterValidator\";\nimport type { SerializedRouterState } from \"./utils\";\nimport type {\n DefaultDependencies,\n EventName,\n NavigationOptions,\n Options,\n Params,\n Plugin,\n Router as RouterInterface,\n RouteTreeState,\n SimpleState,\n State,\n Unsubscribe,\n} from \"@real-router/types\";\nimport type { RouteTree } from \"route-tree\";\n\nexport interface RouterInternals<\n D extends DefaultDependencies = DefaultDependencies,\n> {\n readonly makeState: <P extends Params = Params>(\n name: string,\n params?: P,\n path?: string,\n meta?: Record<string, Record<string, \"url\" | \"query\">>,\n ) => State<P>;\n\n readonly forwardState: <P extends Params = Params>(\n routeName: string,\n routeParams: P,\n ) => SimpleState<P>;\n\n readonly buildStateResolved: (\n resolvedName: string,\n resolvedParams: Params,\n ) => RouteTreeState | undefined;\n\n readonly matchPath: <P extends Params = Params>(\n path: string,\n options?: Options,\n ) => State<P> | undefined;\n\n readonly getOptions: () => Options;\n\n readonly addEventListener: <E extends EventName>(\n eventName: E,\n cb: Plugin[EventMethodMap[E]],\n ) => Unsubscribe;\n\n readonly buildPath: (route: string, params?: Params) => string;\n\n readonly emitTransitionError: (error: Error) => void;\n\n readonly start: (path: string) => Promise<State>;\n\n /**\n * Plugin-only navigation entry point — delegates to\n * `NavigationNamespace.navigateToState` (`getPluginApi(router).navigateToState`).\n * Hidden from `Router`/`Navigator` to keep the userland surface minimal;\n * see `core-types/src/api.ts` for usage docs.\n */\n readonly navigateToState: (\n state: State,\n options?: NavigationOptions,\n ) => Promise<State>;\n\n /* eslint-disable @typescript-eslint/no-explicit-any -- heterogeneous map: stores different InterceptorFn<M> types under different keys */\n readonly interceptors: Map<\n string,\n ((next: (...args: any[]) => any, ...args: any[]) => any)[]\n >;\n /* eslint-enable @typescript-eslint/no-explicit-any */\n\n readonly setRootPath: (rootPath: string) => void;\n readonly getRootPath: () => string;\n\n readonly getTree: () => RouteTree;\n\n readonly isDisposed: () => boolean;\n\n validator: RouterValidator | null;\n\n // Dependencies (issue #172)\n readonly dependenciesGetStore: () => DependenciesStore<D>;\n\n // Clone support (issue #173)\n readonly cloneOptions: () => Options;\n readonly cloneDependencies: () => Record<string, unknown>;\n readonly getLifecycleFactories: () => [\n Record<string, GuardFnFactory<D>>,\n Record<string, GuardFnFactory<D>>,\n ];\n readonly getPluginFactories: () => PluginFactory<D>[];\n\n // Consolidated route data store (issue #174 Phase 2)\n readonly routeGetStore: () => RoutesStore<D>;\n\n // Cross-namespace state (issue #174)\n readonly getStateName: () => string | undefined;\n readonly isTransitioning: () => boolean;\n readonly clearState: () => void;\n readonly setState: (state: State) => void;\n readonly routerExtensions: { keys: string[] }[];\n readonly contextClaimRecords: Set<string>;\n\n /**\n * One-shot hydration scratchpad populated by `hydrateRouter` immediately\n * before delegating to `router.start(parsed.path)` and cleared in the\n * matching `finally`. SSR loader plugins read this slot directly via\n * `getInternals(router).hydrationState` to short-circuit their own loader\n * call when the server-resolved namespace value is already present in the\n * parsed state (#596). `null` outside of an active `hydrateRouter`\n * invocation.\n */\n hydrationState: SerializedRouterState | null;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- existential type: stores RouterInternals for all Dependencies types\nconst internals = new WeakMap<object, RouterInternals<any>>();\n\nexport function getInternals<D extends DefaultDependencies>(\n router: RouterInterface<D>,\n): RouterInternals<D> {\n const ctx = internals.get(router);\n\n if (!ctx) {\n throw new TypeError(\n \"[real-router] Invalid router instance — not found in internals registry\",\n );\n }\n\n return ctx as RouterInternals<D>;\n}\n\nexport function registerInternals<D extends DefaultDependencies>(\n router: RouterClass<D>,\n ctx: RouterInternals<D>,\n): void {\n internals.set(router, ctx);\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-argument -- internal chain execution: type safety enforced at public API boundary (PluginApi.addInterceptor) */\nfunction executeInterceptorChain<T>(\n interceptors: ((next: (...args: any[]) => any, ...args: any[]) => any)[],\n original: (...args: any[]) => T,\n args: any[],\n): T {\n let chain = original as (...args: any[]) => any;\n\n for (const interceptor of interceptors) {\n const prev = chain;\n\n chain = (...chainArgs: any[]) => interceptor(prev, ...chainArgs);\n }\n\n return chain(...args) as T;\n}\n\nexport function createInterceptable<T extends (...args: any[]) => any>(\n name: string,\n original: T,\n interceptors: Map<\n string,\n ((next: (...args: any[]) => any, ...args: any[]) => any)[]\n >,\n): T {\n return ((...args: any[]) => {\n const chain = interceptors.get(name);\n\n if (!chain || chain.length === 0) {\n return original(...args);\n }\n\n return executeInterceptorChain(chain, original, args);\n }) as T;\n}\n\nexport function createInterceptable2<A, B, R>(\n name: string,\n original: (a: A, b: B) => R,\n interceptors: Map<\n string,\n ((next: (...args: any[]) => any, ...args: any[]) => any)[]\n >,\n): (a: A, b: B) => R {\n return (arg1: A, arg2: B) => {\n const chain = interceptors.get(name);\n\n if (!chain || chain.length === 0) {\n return original(arg1, arg2);\n }\n\n return executeInterceptorChain(chain, original, [arg1, arg2]);\n };\n}\n/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-argument */\n"],"mappings":"AA0HA,MAAM,EAAY,IAAI,QAEtB,SAAgB,EACd,EACoB,CACpB,IAAM,EAAM,EAAU,IAAI,CAAM,EAEhC,GAAI,CAAC,EACH,MAAU,UACR,yEACF,EAGF,OAAO,CACT,CAEA,SAAgB,EACd,EACA,EACM,CACN,EAAU,IAAI,EAAQ,CAAG,CAC3B,CAGA,SAAS,EACP,EACA,EACA,EACG,CACH,IAAI,EAAQ,EAEZ,IAAK,IAAM,KAAe,EAAc,CACtC,IAAM,EAAO,EAEb,GAAS,GAAG,IAAqB,EAAY,EAAM,GAAG,CAAS,CACjE,CAEA,OAAO,EAAM,GAAG,CAAI,CACtB,CAEA,SAAgB,EACd,EACA,EACA,EAIG,CACH,QAAS,GAAG,IAAgB,CAC1B,IAAM,EAAQ,EAAa,IAAI,CAAI,EAMnC,MAJI,CAAC,GAAS,EAAM,SAAW,EACtB,EAAS,GAAG,CAAI,EAGlB,EAAwB,EAAO,EAAU,CAAI,CACtD,EACF,CAEA,SAAgB,EACd,EACA,EACA,EAImB,CACnB,OAAQ,EAAS,IAAY,CAC3B,IAAM,EAAQ,EAAa,IAAI,CAAI,EAMnC,MAJI,CAAC,GAAS,EAAM,SAAW,EACtB,EAAS,EAAM,CAAI,EAGrB,EAAwB,EAAO,EAAU,CAAC,EAAM,CAAI,CAAC,CAC9D,CACF"}
@@ -1,91 +1,2 @@
1
- import { DefaultDependencies, Router, State } from "@real-router/types";
2
-
3
- //#region src/utils/getStaticPaths.d.ts
4
- type StaticPathEntries = Record<string, () => Promise<Record<string, string>[]>>;
5
- declare function getStaticPaths<Dependencies extends DefaultDependencies = DefaultDependencies>(router: Router<Dependencies>, entries?: StaticPathEntries): Promise<string[]>;
6
- //#endregion
7
- //#region src/utils/hydrateRouter.d.ts
8
- /**
9
- * Hydrate a fresh router from server-serialized State (#563).
10
- *
11
- * Accepts either a JSON string (parsed via `JSON.parse`) or a State-shaped
12
- * object. Extracts `state.path` and delegates to `router.start(state.path)` —
13
- * the canonical URL is the source of truth for the router on hydration.
14
- *
15
- * The serialized State (produced by `serializeRouterState`) is still useful
16
- * for application-level concerns: `state.context.<namespace>` payloads (e.g.
17
- * server-side data from `ssr-data-plugin`) can be read separately by app code
18
- * before or after `hydrateRouter` resolves.
19
- *
20
- * @example
21
- * ```typescript
22
- * // Client
23
- * const router = createAppRouter();
24
- * router.usePlugin(browserPluginFactory());
25
- * await hydrateRouter(router, window.__SSR_STATE__);
26
- * ```
27
- */
28
- declare function hydrateRouter(router: Router, source: string | {
29
- path: string;
30
- }): Promise<State>;
31
- //#endregion
32
- //#region src/utils/serializeRouterState.d.ts
33
- interface SerializeRouterStateOptions {
34
- /**
35
- * Plugin context namespaces to strip from the serialized output.
36
- * Use when a plugin populates `state.context.<ns>` with non-JSON-serializable
37
- * values (e.g., RSC payload: ReactNode trees containing functions/symbols).
38
- *
39
- * @default []
40
- */
41
- excludeContext?: readonly string[];
42
- }
43
- /**
44
- * XSS-safe JSON serialization of router State for SSR → client transport (#563).
45
- *
46
- * Strips `state.transition` (per-navigation `TransitionMeta` — meaningless after
47
- * hydration; the client's hydration commit produces its own `transition`).
48
- * Keeps `name`, `params`, `path`, and `context` (plugin context namespaces are
49
- * preserved as-is — server's `state.context.data` from `ssr-data-plugin` and
50
- * any other plugin claims travel to the client untouched).
51
- *
52
- * Pass `options.excludeContext` to strip specific namespaces from the output —
53
- * required for plugins that publish non-JSON-serializable values (e.g., RSC
54
- * `ReactNode` trees from `@real-router/rsc-server-plugin`).
55
- *
56
- * @example
57
- * ```typescript
58
- * // Server
59
- * const state = await router.start(req.url);
60
- * const html = `<script>window.__SSR_STATE__=${serializeRouterState(state)}</script>`;
61
- *
62
- * // Client
63
- * await hydrateRouter(router, window.__SSR_STATE__);
64
- * ```
65
- *
66
- * @example
67
- * ```typescript
68
- * // With RSC plugin: strip the "rsc" namespace before transport
69
- * const state = await router.start(url);
70
- * const json = serializeRouterState(state, { excludeContext: ["rsc"] });
71
- * ```
72
- */
73
- declare function serializeRouterState(state: State, options?: SerializeRouterStateOptions): string;
74
- //#endregion
75
- //#region src/utils/serializeState.d.ts
76
- /**
77
- * XSS-safe JSON serialization for embedding data in HTML `<script>` tags.
78
- *
79
- * Escapes `<`, `>`, and `&` to their Unicode equivalents to prevent
80
- * injection via `</script>` or HTML entities inside inline scripts.
81
- *
82
- * @example
83
- * ```typescript
84
- * const json = serializeState({ name: "home", path: "/" });
85
- * const html = `<script>window.__STATE__=${json}</script>`;
86
- * ```
87
- */
88
- declare function serializeState(data: unknown): string;
89
- //#endregion
90
- export { type SerializeRouterStateOptions, type StaticPathEntries, getStaticPaths, hydrateRouter, serializeRouterState, serializeState };
91
- //# sourceMappingURL=utils.d.mts.map
1
+ import { a as SerializeStateOptions, c as HydrateRouterOptions, d as getStaticPaths, f as IncomingMessageLike, g as createRequestScope, h as RequestScopeSource, i as Serialize, l as hydrateRouter, m as RequestScope, n as SerializedRouterState, o as serializeState, p as RequestLike, r as serializeRouterState, s as Deserialize, t as SerializeRouterStateOptions, u as StaticPathEntries } from "./index-r_JTvSBH.mjs";
2
+ export { type Deserialize, type HydrateRouterOptions, type IncomingMessageLike, type RequestLike, type RequestScope, type RequestScopeSource, type Serialize, type SerializeRouterStateOptions, type SerializeStateOptions, type SerializedRouterState, type StaticPathEntries, createRequestScope, getStaticPaths, hydrateRouter, serializeRouterState, serializeState };
@@ -1,2 +1,2 @@
1
- import{t as e}from"./getPluginApi-CsTfDB-O.mjs";function t(e){let n=[];for(let r of e.children.values())r.children.size===0?n.push(r.fullName):n.push(...t(r));return n}async function n(n,r){let i=t(e(n).getTree()),a=[];for(let e of i){let t=r?.[e];if(t){let r=await t();for(let t of r)a.push(n.buildPath(e,t))}else a.push(n.buildPath(e,{}))}return a}function r(e,t){let n=typeof t==`string`?JSON.parse(t):t;return e.start(n.path)}function i(e){return e===void 0?`null`:JSON.stringify(e).replaceAll(`<`,String.raw`\u003c`).replaceAll(`>`,String.raw`\u003e`).replaceAll(`&`,String.raw`\u0026`)}function a(e,t){let n=t?.excludeContext,r=e.context;if(n?.length){let t={},i=e.context;for(let e of Object.keys(i))n.includes(e)||(t[e]=i[e]);r=t}return i({name:e.name,params:e.params,path:e.path,context:r})}export{n as getStaticPaths,r as hydrateRouter,a as serializeRouterState,i as serializeState};
1
+ import{r as e}from"./internals-C59msvHY.mjs";import{r as t,t as n}from"./cloneRouter-C_ULpzHM.mjs";function r(e){return`signal`in e&&typeof e.signal==`object`&&e.signal!==void 0&&typeof e.signal.aborted==`boolean`}function i(e,t,i){let a,o;if(r(e))o=e.signal;else{let t=new AbortController,n=()=>{t.abort()};e.on(`close`,n),o=t.signal,a=()=>{e.removeListener?.(`close`,n)}}let s=n(t,{...i,abortSignal:o}),c=!1,l=()=>c?Promise.resolve():(c=!0,a?.(),s.dispose(),Promise.resolve());return{router:s,signal:o,dispose:l,[Symbol.asyncDispose]:l}}function a(e){let t=[];for(let n of e.children.values())n.children.size===0?t.push(n.fullName):t.push(...a(n));return t}async function o(e,n){let r=a(t(e).getTree()),i=[];for(let t of r){let r=n?.[t];if(r){let n=await r();for(let r of n)i.push(e.buildPath(t,r))}else i.push(e.buildPath(t,{}))}return i}async function s(t,n,r){let i=r?.deserialize??JSON.parse,a=typeof n==`string`?i(n):n,o=e(t),s=o.hydrationState;o.hydrationState=a;try{return await t.start(a.path)}finally{o.hydrationState=s}}function c(e,t){return((t?.serialize??JSON.stringify)(e)??`null`).replaceAll(`<`,String.raw`\u003c`).replaceAll(`>`,String.raw`\u003e`).replaceAll(`&`,String.raw`\u0026`)}function l(e,t){let n=t?.excludeContext,r=e.context;if(n?.length){let t={},i=e.context;for(let e of Object.keys(i))n.includes(e)||(t[e]=i[e]);r=t}let i={name:e.name,params:e.params,path:e.path,context:r};return t?.serialize?c(i,{serialize:t.serialize}):c(i)}export{i as createRequestScope,o as getStaticPaths,s as hydrateRouter,l as serializeRouterState,c as serializeState};
2
2
  //# sourceMappingURL=utils.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","names":[],"sources":["../../src/utils/getStaticPaths.ts","../../src/utils/hydrateRouter.ts","../../src/utils/serializeState.ts","../../src/utils/serializeRouterState.ts"],"sourcesContent":["import { getPluginApi } from \"../api/getPluginApi\";\n\nimport type { DefaultDependencies, Router } from \"@real-router/types\";\nimport type { RouteTree } from \"route-tree\";\n\nexport type StaticPathEntries = Record<\n string,\n () => Promise<Record<string, string>[]>\n>;\n\nfunction getLeafRouteNames(node: RouteTree): string[] {\n const result: string[] = [];\n\n for (const child of node.children.values()) {\n if (child.children.size === 0) {\n result.push(child.fullName);\n } else {\n result.push(...getLeafRouteNames(child));\n }\n }\n\n return result;\n}\n\nexport async function getStaticPaths<\n Dependencies extends DefaultDependencies = DefaultDependencies,\n>(\n router: Router<Dependencies>,\n entries?: StaticPathEntries,\n): Promise<string[]> {\n const tree = getPluginApi(router).getTree();\n const leafRoutes = getLeafRouteNames(tree);\n const paths: string[] = [];\n\n for (const routeName of leafRoutes) {\n const entryFn = entries?.[routeName];\n\n if (entryFn) {\n const paramSets = await entryFn();\n\n for (const params of paramSets) {\n paths.push(router.buildPath(routeName, params));\n }\n } else {\n paths.push(router.buildPath(routeName, {}));\n }\n }\n\n return paths;\n}\n","import type { Router, State } from \"@real-router/types\";\n\n/**\n * Hydrate a fresh router from server-serialized State (#563).\n *\n * Accepts either a JSON string (parsed via `JSON.parse`) or a State-shaped\n * object. Extracts `state.path` and delegates to `router.start(state.path)` —\n * the canonical URL is the source of truth for the router on hydration.\n *\n * The serialized State (produced by `serializeRouterState`) is still useful\n * for application-level concerns: `state.context.<namespace>` payloads (e.g.\n * server-side data from `ssr-data-plugin`) can be read separately by app code\n * before or after `hydrateRouter` resolves.\n *\n * @example\n * ```typescript\n * // Client\n * const router = createAppRouter();\n * router.usePlugin(browserPluginFactory());\n * await hydrateRouter(router, window.__SSR_STATE__);\n * ```\n */\nexport function hydrateRouter(\n router: Router,\n source: string | { path: string },\n): Promise<State> {\n const parsed =\n typeof source === \"string\"\n ? (JSON.parse(source) as { path: string })\n : source;\n\n return router.start(parsed.path);\n}\n","/**\n * XSS-safe JSON serialization for embedding data in HTML `<script>` tags.\n *\n * Escapes `<`, `>`, and `&` to their Unicode equivalents to prevent\n * injection via `</script>` or HTML entities inside inline scripts.\n *\n * @example\n * ```typescript\n * const json = serializeState({ name: \"home\", path: \"/\" });\n * const html = `<script>window.__STATE__=${json}</script>`;\n * ```\n */\nexport function serializeState(data: unknown): string {\n if (data === undefined) {\n return \"null\";\n }\n\n return JSON.stringify(data)\n .replaceAll(\"<\", String.raw`\\u003c`)\n .replaceAll(\">\", String.raw`\\u003e`)\n .replaceAll(\"&\", String.raw`\\u0026`);\n}\n","import { serializeState } from \"./serializeState\";\n\nimport type { State } from \"@real-router/types\";\n\nexport interface SerializeRouterStateOptions {\n /**\n * Plugin context namespaces to strip from the serialized output.\n * Use when a plugin populates `state.context.<ns>` with non-JSON-serializable\n * values (e.g., RSC payload: ReactNode trees containing functions/symbols).\n *\n * @default []\n */\n excludeContext?: readonly string[];\n}\n\n/**\n * XSS-safe JSON serialization of router State for SSR → client transport (#563).\n *\n * Strips `state.transition` (per-navigation `TransitionMeta` — meaningless after\n * hydration; the client's hydration commit produces its own `transition`).\n * Keeps `name`, `params`, `path`, and `context` (plugin context namespaces are\n * preserved as-is — server's `state.context.data` from `ssr-data-plugin` and\n * any other plugin claims travel to the client untouched).\n *\n * Pass `options.excludeContext` to strip specific namespaces from the output —\n * required for plugins that publish non-JSON-serializable values (e.g., RSC\n * `ReactNode` trees from `@real-router/rsc-server-plugin`).\n *\n * @example\n * ```typescript\n * // Server\n * const state = await router.start(req.url);\n * const html = `<script>window.__SSR_STATE__=${serializeRouterState(state)}</script>`;\n *\n * // Client\n * await hydrateRouter(router, window.__SSR_STATE__);\n * ```\n *\n * @example\n * ```typescript\n * // With RSC plugin: strip the \"rsc\" namespace before transport\n * const state = await router.start(url);\n * const json = serializeRouterState(state, { excludeContext: [\"rsc\"] });\n * ```\n */\nexport function serializeRouterState(\n state: State,\n options?: SerializeRouterStateOptions,\n): string {\n const exclude = options?.excludeContext;\n\n let context = state.context;\n\n if (exclude?.length) {\n const filtered: Record<string, unknown> = {};\n const source = state.context as Record<string, unknown>;\n\n for (const key of Object.keys(source)) {\n if (!exclude.includes(key)) {\n filtered[key] = source[key];\n }\n }\n\n context = filtered;\n }\n\n return serializeState({\n name: state.name,\n params: state.params,\n path: state.path,\n context,\n });\n}\n"],"mappings":"gDAUA,SAAS,EAAkB,EAA2B,CACpD,IAAM,EAAmB,EAAE,CAE3B,IAAK,IAAM,KAAS,EAAK,SAAS,QAAQ,CACpC,EAAM,SAAS,OAAS,EAC1B,EAAO,KAAK,EAAM,SAAS,CAE3B,EAAO,KAAK,GAAG,EAAkB,EAAM,CAAC,CAI5C,OAAO,EAGT,eAAsB,EAGpB,EACA,EACmB,CAEnB,IAAM,EAAa,EADN,EAAa,EAAO,CAAC,SACO,CAAC,CACpC,EAAkB,EAAE,CAE1B,IAAK,IAAM,KAAa,EAAY,CAClC,IAAM,EAAU,IAAU,GAE1B,GAAI,EAAS,CACX,IAAM,EAAY,MAAM,GAAS,CAEjC,IAAK,IAAM,KAAU,EACnB,EAAM,KAAK,EAAO,UAAU,EAAW,EAAO,CAAC,MAGjD,EAAM,KAAK,EAAO,UAAU,EAAW,EAAE,CAAC,CAAC,CAI/C,OAAO,EC1BT,SAAgB,EACd,EACA,EACgB,CAChB,IAAM,EACJ,OAAO,GAAW,SACb,KAAK,MAAM,EAAO,CACnB,EAEN,OAAO,EAAO,MAAM,EAAO,KAAK,CCnBlC,SAAgB,EAAe,EAAuB,CAKpD,OAJI,IAAS,IAAA,GACJ,OAGF,KAAK,UAAU,EAAK,CACxB,WAAW,IAAK,OAAO,GAAG,SAAS,CACnC,WAAW,IAAK,OAAO,GAAG,SAAS,CACnC,WAAW,IAAK,OAAO,GAAG,SAAS,CCyBxC,SAAgB,EACd,EACA,EACQ,CACR,IAAM,EAAU,GAAS,eAErB,EAAU,EAAM,QAEpB,GAAI,GAAS,OAAQ,CACnB,IAAM,EAAoC,EAAE,CACtC,EAAS,EAAM,QAErB,IAAK,IAAM,KAAO,OAAO,KAAK,EAAO,CAC9B,EAAQ,SAAS,EAAI,GACxB,EAAS,GAAO,EAAO,IAI3B,EAAU,EAGZ,OAAO,EAAe,CACpB,KAAM,EAAM,KACZ,OAAQ,EAAM,OACd,KAAM,EAAM,KACZ,UACD,CAAC"}
1
+ {"version":3,"file":"utils.mjs","names":[],"sources":["../../src/utils/createRequestScope.ts","../../src/utils/getStaticPaths.ts","../../src/utils/hydrateRouter.ts","../../src/utils/serializeState.ts","../../src/utils/serializeRouterState.ts"],"sourcesContent":["import { cloneRouter } from \"../api/cloneRouter\";\n\nimport type { Router as RouterClass } from \"../Router\";\nimport type { DefaultDependencies, Router } from \"@real-router/types\";\n\n/**\n * Subset of Node's `http.IncomingMessage` that `createRequestScope` relies on:\n * a `\"close\"` event indicating that the client disconnected (or the response\n * was fully sent) and the standard `removeListener` cleanup hook.\n */\nexport interface IncomingMessageLike {\n on: (event: \"close\", listener: () => void) => unknown;\n removeListener?: (event: \"close\", listener: () => void) => unknown;\n}\n\n/**\n * Web `Request`-shaped object — anything carrying an `AbortSignal`. Web\n * runtimes (Bun, Cloudflare Workers, Vite RSC) surface client-disconnect via\n * `request.signal` directly, so no listener attachment is needed.\n */\nexport interface RequestLike {\n signal: AbortSignal;\n}\n\nexport type RequestScopeSource = IncomingMessageLike | RequestLike;\n\nexport interface RequestScope<\n Dependencies extends DefaultDependencies = DefaultDependencies,\n> extends AsyncDisposable {\n /**\n * Per-request router clone. Carries `abortSignal` injected into its\n * dependencies — loaders can `getDep(\"abortSignal\")` and pass it to fetch /\n * `withTimeout` for cooperative cancellation when the client disconnects.\n */\n readonly router: RouterClass<Dependencies>;\n\n /**\n * Aborts when the request closes (Node `IncomingMessage`'s `\"close\"` event)\n * or when the upstream Web `Request.signal` aborts.\n */\n readonly signal: AbortSignal;\n\n /**\n * Detach the close listener (if attached to a Node `IncomingMessage`) and\n * dispose the cloned router. Idempotent — safe to call multiple times or in\n * combination with `Symbol.asyncDispose`.\n */\n dispose: () => Promise<void>;\n}\n\nfunction isRequestLike(request: RequestScopeSource): request is RequestLike {\n return (\n \"signal\" in request &&\n typeof (request as Partial<RequestLike>).signal === \"object\" &&\n (request as Partial<RequestLike>).signal !== undefined &&\n typeof request.signal.aborted === \"boolean\"\n );\n}\n\n/**\n * Build a per-request router scope: clones `base`, attaches an `AbortSignal`\n * tied to the request's lifetime, and exposes `dispose()` (plus\n * `Symbol.asyncDispose` for `await using` declarations).\n *\n * Replaces the four-step boilerplate that every server entry repeats:\n *\n * 1. `new AbortController()` per request\n * 2. `req.on(\"close\", () => controller.abort())`\n * 3. `cloneRouter(base, { ...deps, abortSignal: signal })`\n * 4. `try { ... } finally { router.dispose() }`\n *\n * The signal is injected into the router clone under `abortSignal` so existing\n * loaders that read `getDep(\"abortSignal\")` keep working without changes.\n *\n * ## `await using` compatibility\n *\n * The scope implements `Symbol.asyncDispose`, so `await using scope = …` is\n * supported on runtimes that ship the well-known `Symbol.asyncDispose`:\n *\n * - **Node.js 24+** (full support; partial in 20.4–20.17 only for `fs`/`stream`)\n * - **Bun 1.0.23+**, **Deno 1.37+**\n * - **Chrome / Edge 127+**, **Firefox 141+**\n * - **Safari**: not yet supported (irrelevant in practice — this helper is\n * server-side only and never reaches the browser)\n *\n * On Node.js 22 LTS the well-known symbol is unavailable, so `await using`\n * fails. **The bundled SSR examples therefore use the explicit\n * `try/finally` + `await scope.dispose()` form**, which works on every\n * runtime. Use `await using` only when you control the deployment target and\n * know it ships the symbol.\n *\n * @example\n * ```typescript\n * // Explicit dispose — works on Node 18+, all browsers, every CI image\n * export async function render(url: string, req: IncomingMessage) {\n * const scope = createRequestScope(req, baseRouter, { currentUser });\n * try {\n * scope.router.usePlugin(ssrDataPluginFactory(loaders));\n * return await renderShell(scope.router, url);\n * } finally {\n * await scope.dispose();\n * }\n * }\n *\n * // `await using` — Node 24+, Bun, Deno, modern browsers\n * export async function render(url: string, req: IncomingMessage) {\n * await using scope = createRequestScope(req, baseRouter, { currentUser });\n * scope.router.usePlugin(ssrDataPluginFactory(loaders));\n * return await renderShell(scope.router, url);\n * }\n *\n * // Web runtime (signal already on the request)\n * async function handler(request: Request) {\n * const scope = createRequestScope(request, baseRouter, { db });\n * try {\n * scope.router.usePlugin(rscServerPluginFactory(loaders));\n * return await render(scope.router, request.url);\n * } finally {\n * await scope.dispose();\n * }\n * }\n * ```\n */\nexport function createRequestScope<\n Dependencies extends DefaultDependencies = DefaultDependencies,\n>(\n request: RequestScopeSource,\n base: Router<Dependencies>,\n deps?: Partial<Dependencies>,\n): RequestScope<Dependencies> {\n let detach: (() => void) | undefined;\n let signal: AbortSignal;\n\n if (isRequestLike(request)) {\n signal = request.signal;\n } else {\n const controller = new AbortController();\n const onClose = (): void => {\n controller.abort();\n };\n\n request.on(\"close\", onClose);\n signal = controller.signal;\n detach = () => {\n request.removeListener?.(\"close\", onClose);\n };\n }\n\n const router = cloneRouter(base, {\n ...deps,\n abortSignal: signal,\n } as Dependencies);\n\n let disposed = false;\n\n const dispose = (): Promise<void> => {\n if (disposed) {\n return Promise.resolve();\n }\n\n disposed = true;\n detach?.();\n router.dispose();\n\n return Promise.resolve();\n };\n\n return {\n router,\n signal,\n dispose,\n [Symbol.asyncDispose]: dispose,\n };\n}\n","import { getPluginApi } from \"../api/getPluginApi\";\n\nimport type { DefaultDependencies, Router } from \"@real-router/types\";\nimport type { RouteTree } from \"route-tree\";\n\nexport type StaticPathEntries = Record<\n string,\n () => Promise<Record<string, string>[]>\n>;\n\nfunction getLeafRouteNames(node: RouteTree): string[] {\n const result: string[] = [];\n\n for (const child of node.children.values()) {\n if (child.children.size === 0) {\n result.push(child.fullName);\n } else {\n result.push(...getLeafRouteNames(child));\n }\n }\n\n return result;\n}\n\nexport async function getStaticPaths<\n Dependencies extends DefaultDependencies = DefaultDependencies,\n>(\n router: Router<Dependencies>,\n entries?: StaticPathEntries,\n): Promise<string[]> {\n const tree = getPluginApi(router).getTree();\n const leafRoutes = getLeafRouteNames(tree);\n const paths: string[] = [];\n\n for (const routeName of leafRoutes) {\n const entryFn = entries?.[routeName];\n\n if (entryFn) {\n const paramSets = await entryFn();\n\n for (const params of paramSets) {\n paths.push(router.buildPath(routeName, params));\n }\n } else {\n paths.push(router.buildPath(routeName, {}));\n }\n }\n\n return paths;\n}\n","import { getInternals } from \"../internals\";\n\nimport type { SerializedRouterState } from \"./serializeRouterState\";\nimport type { Router, State } from \"@real-router/types\";\n\n/**\n * Custom deserializer signature for {@link hydrateRouter} (#606). Compatible\n * with `JSON.parse` (default), `devalue.parse`, `superjson.parse`, or any\n * user-supplied function.\n */\nexport type Deserialize = (json: string) => unknown;\n\nexport interface HydrateRouterOptions {\n /**\n * Custom deserializer (e.g., `devalue.parse` / `superjson.parse`) for\n * matching the `serialize` passed to {@link serializeRouterState}. Defaults\n * to `JSON.parse`. Ignored when `source` is already an object.\n *\n * @default JSON.parse\n *\n * @example\n * ```typescript\n * import * as devalue from \"devalue\";\n * await hydrateRouter(router, ssrJson, { deserialize: devalue.parse });\n * ```\n */\n deserialize?: Deserialize;\n}\n\n/**\n * Hydrate a fresh router from server-serialized State (#563, #596).\n *\n * Accepts either a JSON string (parsed via `JSON.parse` by default, or\n * `options.deserialize` when provided) or a State-shaped object. Extracts\n * `state.path` and delegates to `router.start(state.path)` — the canonical\n * URL is the source of truth for the router on hydration.\n *\n * The full parsed state (incl. `state.context.<namespace>` payloads) is\n * deposited into a one-shot scratchpad on `RouterInternals.hydrationState`\n * before `start()` is invoked and cleared in the matching `finally`. SSR\n * loader plugins (`@real-router/ssr-data-plugin`,\n * `@real-router/rsc-server-plugin`) read this scratchpad to skip their loader\n * call when the server-resolved namespace value is already present — avoiding\n * the post-hydration loader re-run on first paint.\n *\n * Single-shot semantics: the scratchpad is consumed during the first `start()`\n * triggered by `hydrateRouter` regardless of route mismatch; subsequent\n * `start()` calls run loaders normally.\n *\n * @example\n * ```typescript\n * // Client\n * const router = createAppRouter();\n * router.usePlugin(browserPluginFactory());\n * await hydrateRouter(router, window.__SSR_STATE__);\n * ```\n *\n * @example\n * ```typescript\n * // With non-JSON types (Date / Map / Set / RegExp / BigInt) via devalue (#606)\n * import * as devalue from \"devalue\";\n *\n * await hydrateRouter(router, window.__SSR_STATE__, {\n * deserialize: devalue.parse,\n * });\n * ```\n */\nexport async function hydrateRouter(\n router: Router,\n source: string | { path: string },\n options?: HydrateRouterOptions,\n): Promise<State> {\n const deserialize: Deserialize = options?.deserialize ?? JSON.parse;\n const parsed =\n typeof source === \"string\"\n ? (deserialize(source) as SerializedRouterState)\n : (source as SerializedRouterState);\n\n const ctx = getInternals(router);\n const previous = ctx.hydrationState;\n\n ctx.hydrationState = parsed;\n\n try {\n return await router.start(parsed.path);\n } finally {\n ctx.hydrationState = previous;\n }\n}\n","/**\n * Custom serializer signature for {@link serializeState} (#606).\n *\n * Compatible with `JSON.stringify` (default) as well as `devalue.stringify`,\n * `superjson.stringify`, or any user-supplied function that returns a JSON\n * string. The output is run through XSS-safe character escapes regardless\n * of which serializer produced it.\n */\nexport type Serialize = (data: unknown) => string;\n\nexport interface SerializeStateOptions {\n /**\n * Custom serializer (e.g., `devalue.stringify` / `superjson.stringify`) to\n * support non-JSON types (Date / Map / Set / RegExp / BigInt). Defaults to\n * `JSON.stringify`. Output is still XSS-escaped.\n *\n * @default JSON.stringify\n */\n serialize?: Serialize;\n}\n\n/**\n * XSS-safe JSON serialization for embedding data in HTML `<script>` tags.\n *\n * Escapes `<`, `>`, and `&` to their Unicode equivalents to prevent\n * injection via `</script>` or HTML entities inside inline scripts.\n *\n * Pass `options.serialize` to use a custom serializer such as `devalue` or\n * `superjson` for non-JSON types (Date/Map/Set/RegExp/BigInt). The serializer\n * must return a string; XSS-escape is applied to its output.\n *\n * @example\n * ```typescript\n * const json = serializeState({ name: \"home\", path: \"/\" });\n * const html = `<script>window.__STATE__=${json}</script>`;\n * ```\n *\n * @example\n * ```typescript\n * import * as devalue from \"devalue\";\n *\n * const json = serializeState(\n * { date: new Date(), tags: new Set([\"a\", \"b\"]) },\n * { serialize: devalue.stringify },\n * );\n * ```\n */\nexport function serializeState(\n data: unknown,\n options?: SerializeStateOptions,\n): string {\n const serialize = options?.serialize ?? JSON.stringify;\n // JSON.stringify returns undefined for top-level `undefined`, Symbol,\n // function, and other non-serializable values (lib.d.ts types it as\n // `string` but the runtime can return undefined). A custom serializer\n // that returns undefined for unsupported input is normalized the same way.\n const serialized = (serialize(data) as string | undefined) ?? \"null\";\n\n return serialized\n .replaceAll(\"<\", String.raw`\\u003c`)\n .replaceAll(\">\", String.raw`\\u003e`)\n .replaceAll(\"&\", String.raw`\\u0026`);\n}\n","import { serializeState } from \"./serializeState\";\n\nimport type { Serialize } from \"./serializeState\";\nimport type { Params, State } from \"@real-router/types\";\n\n/**\n * Parsed shape produced by {@link serializeRouterState} (after `JSON.parse`).\n *\n * Identical to {@link State} minus `transition` (per-navigation `TransitionMeta`\n * is meaningless after hydration; the client builds its own on commit). Used as\n * the input shape for {@link hydrateRouter} and as the type of the one-shot\n * hydration scratchpad consumed by SSR loader plugins.\n */\nexport type SerializedRouterState<P extends Params = Params> = Omit<\n State<P>,\n \"transition\"\n>;\n\nexport interface SerializeRouterStateOptions {\n /**\n * Plugin context namespaces to strip from the serialized output.\n * Use when a plugin populates `state.context.<ns>` with non-JSON-serializable\n * values (e.g., RSC payload: ReactNode trees containing functions/symbols).\n *\n * @default []\n */\n excludeContext?: readonly string[];\n\n /**\n * Custom serializer (e.g., `devalue.stringify` / `superjson.stringify`) to\n * support non-JSON types in `state.params` and `state.context.<ns>` payloads\n * (Date / Map / Set / RegExp / BigInt). Defaults to `JSON.stringify`.\n *\n * Pair with the matching `deserialize` on `hydrateRouter` to round-trip the\n * extended types on the client.\n *\n * @default JSON.stringify\n *\n * @example\n * ```typescript\n * import * as devalue from \"devalue\";\n *\n * const json = serializeRouterState(state, { serialize: devalue.stringify });\n * ```\n */\n serialize?: Serialize;\n}\n\n/**\n * XSS-safe JSON serialization of router State for SSR → client transport (#563).\n *\n * Strips `state.transition` (per-navigation `TransitionMeta` — meaningless after\n * hydration; the client's hydration commit produces its own `transition`).\n * Keeps `name`, `params`, `path`, and `context` (plugin context namespaces are\n * preserved as-is — server's `state.context.data` from `ssr-data-plugin` and\n * any other plugin claims travel to the client untouched).\n *\n * Pass `options.excludeContext` to strip specific namespaces from the output —\n * required for plugins that publish non-JSON-serializable values (e.g., RSC\n * `ReactNode` trees from `@real-router/rsc-server-plugin`).\n *\n * @example\n * ```typescript\n * // Server\n * const state = await router.start(req.url);\n * const html = `<script>window.__SSR_STATE__=${serializeRouterState(state)}</script>`;\n *\n * // Client\n * await hydrateRouter(router, window.__SSR_STATE__);\n * ```\n *\n * @example\n * ```typescript\n * // With RSC plugin: strip the \"rsc\" namespace before transport\n * const state = await router.start(url);\n * const json = serializeRouterState(state, { excludeContext: [\"rsc\"] });\n * ```\n *\n * @example\n * ```typescript\n * // Non-JSON types (Date / Map / Set / RegExp / BigInt) via devalue (#606)\n * import * as devalue from \"devalue\";\n *\n * const json = serializeRouterState(state, { serialize: devalue.stringify });\n * // On the client:\n * await hydrateRouter(router, json, { deserialize: devalue.parse });\n * ```\n */\nexport function serializeRouterState(\n state: State,\n options?: SerializeRouterStateOptions,\n): string {\n const exclude = options?.excludeContext;\n\n let context = state.context;\n\n if (exclude?.length) {\n const filtered: Record<string, unknown> = {};\n const source = state.context;\n\n for (const key of Object.keys(source)) {\n if (!exclude.includes(key)) {\n filtered[key] = source[key];\n }\n }\n\n context = filtered;\n }\n\n const payload = {\n name: state.name,\n params: state.params,\n path: state.path,\n context,\n };\n\n return options?.serialize\n ? serializeState(payload, { serialize: options.serialize })\n : serializeState(payload);\n}\n"],"mappings":"mGAkDA,SAAS,EAAc,EAAqD,CAC1E,MACE,WAAY,GACZ,OAAQ,EAAiC,QAAW,UACnD,EAAiC,SAAW,IAAA,IAC7C,OAAO,EAAQ,OAAO,SAAY,SAEtC,CAkEA,SAAgB,EAGd,EACA,EACA,EAC4B,CAC5B,IAAI,EACA,EAEJ,GAAI,EAAc,CAAO,EACvB,EAAS,EAAQ,WACZ,CACL,IAAM,EAAa,IAAI,gBACjB,MAAsB,CAC1B,EAAW,MAAM,CACnB,EAEA,EAAQ,GAAG,QAAS,CAAO,EAC3B,EAAS,EAAW,OACpB,MAAe,CACb,EAAQ,iBAAiB,QAAS,CAAO,CAC3C,CACF,CAEA,IAAM,EAAS,EAAY,EAAM,CAC/B,GAAG,EACH,YAAa,CACf,CAAiB,EAEb,EAAW,GAET,MACA,EACK,QAAQ,QAAQ,GAGzB,EAAW,GACX,IAAS,EACT,EAAO,QAAQ,EAER,QAAQ,QAAQ,GAGzB,MAAO,CACL,SACA,SACA,WACC,OAAO,cAAe,CACzB,CACF,CCnKA,SAAS,EAAkB,EAA2B,CACpD,IAAM,EAAmB,CAAC,EAE1B,IAAK,IAAM,KAAS,EAAK,SAAS,OAAO,EACnC,EAAM,SAAS,OAAS,EAC1B,EAAO,KAAK,EAAM,QAAQ,EAE1B,EAAO,KAAK,GAAG,EAAkB,CAAK,CAAC,EAI3C,OAAO,CACT,CAEA,eAAsB,EAGpB,EACA,EACmB,CAEnB,IAAM,EAAa,EADN,EAAa,CAAM,EAAE,QACM,CAAC,EACnC,EAAkB,CAAC,EAEzB,IA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herOptions, o as PluginFactory, r as EventMethodMap, u as Matcher } from "./Router-BeXr2zW4.mjs";
2
- import { t as RouterValidator } from "./RouterValidator-C-PvV00i.mjs";
3
- import { DefaultDependencies, EventName, ForwardToCallback, GuardFn, NavigationOptions, Options, Params, Plugin, RouteTreeState, Router, SimpleState, State, Unsubscribe } from "@real-router/types";
1
+ import { i as RouteTree, n as Matcher, r as RouteDefinition, t as CreateMatcherOptions } from "./index-DNjaY7KH.mjs";
2
+ import { a as Limits, i as GuardFnFactory, o as PluginFactory, r as EventMethodMap } from "./Router-BmhiDQUJ.mjs";
3
+ import { n as RouterValidator } from "./RouterError-hhfSVGtY.mjs";
4
+ import { n as SerializedRouterState } from "./index-r_JTvSBH.mjs";
5
+ import { FSM } from "@real-router/fsm";
6
+ import { DefaultDependencies, EventName, ForwardToCallback, GuardFn, LeaveFn, NavigationOptions, Options, Params, Plugin, RouteTreeState, Router, SimpleState, State, SubscribeFn, Unsubscribe } from "@real-router/types";
4
7
 
5
8
  //#region src/namespaces/DependenciesNamespace/dependenciesStore.d.ts
6
9
  interface DependenciesStore<Dependencies extends DefaultDependencies = DefaultDependencies> {
@@ -8,46 +11,6 @@ interface DependenciesStore<Dependencies extends DefaultDependencies = DefaultDe
8
11
  limits: Limits;
9
12
  }
10
13
  //#endregion
11
- //#region src/namespaces/RoutesNamespace/types.d.ts
12
- /**
13
- * Dependencies injected into RoutesNamespace.
14
- *
15
- * These are function references from the Router facade,
16
- * avoiding the need to pass the entire Router object.
17
- */
18
- interface RoutesDependencies<Dependencies extends DefaultDependencies = DefaultDependencies> {
19
- /** Register canActivate handler for a route */
20
- addActivateGuard: (name: string, handler: GuardFnFactory<Dependencies>) => void;
21
- /** Register canDeactivate handler for a route */
22
- addDeactivateGuard: (name: string, handler: GuardFnFactory<Dependencies>) => void;
23
- /** Create state object */
24
- makeState: <P extends Params = Params>(name: string, params?: P, path?: string, meta?: Record<string, Record<string, "url" | "query">>) => State<P>;
25
- /** Get current router state */
26
- getState: () => State | undefined;
27
- /** Compare two states for equality */
28
- areStatesEqual: (state1: State | undefined, state2: State | undefined, ignoreQueryParams?: boolean) => boolean;
29
- /** Get a dependency by name */
30
- getDependency: <K extends keyof Dependencies>(name: K) => Dependencies[K];
31
- /** Forward state through facade (allows plugin interception) */
32
- forwardState: <P extends Params = Params>(name: string, params: P) => SimpleState<P>;
33
- }
34
- /**
35
- * Configuration storage for routes.
36
- * Stores decoders, encoders, default params, and forward mappings.
37
- */
38
- interface RouteConfig {
39
- /** Custom param decoders per route */
40
- decoders: Record<string, (params: Params) => Params>;
41
- /** Custom param encoders per route */
42
- encoders: Record<string, (params: Params) => Params>;
43
- /** Default params per route */
44
- defaultParams: Record<string, Params>;
45
- /** Forward mappings (source -> target) */
46
- forwardMap: Record<string, string>;
47
- /** Dynamic forward callbacks (source -> callback) */
48
- forwardFnMap: Record<string, ForwardToCallback<any>>;
49
- }
50
- //#endregion
51
14
  //#region src/namespaces/RouteLifecycleNamespace/types.d.ts
52
15
  interface RouteLifecycleDependencies<Dependencies extends DefaultDependencies = DefaultDependencies> {
53
16
  compileFactory: (factory: GuardFnFactory<Dependencies>) => GuardFn;
@@ -128,6 +91,46 @@ declare class RouteLifecycleNamespace<Dependencies extends DefaultDependencies =
128
91
  canNavigateTo(toDeactivate: string[], toActivate: string[], toState: State, fromState: State | undefined): boolean;
129
92
  }
130
93
  //#endregion
94
+ //#region src/namespaces/RoutesNamespace/types.d.ts
95
+ /**
96
+ * Dependencies injected into RoutesNamespace.
97
+ *
98
+ * These are function references from the Router facade,
99
+ * avoiding the need to pass the entire Router object.
100
+ */
101
+ interface RoutesDependencies<Dependencies extends DefaultDependencies = DefaultDependencies> {
102
+ /** Register canActivate handler for a route */
103
+ addActivateGuard: (name: string, handler: GuardFnFactory<Dependencies>) => void;
104
+ /** Register canDeactivate handler for a route */
105
+ addDeactivateGuard: (name: string, handler: GuardFnFactory<Dependencies>) => void;
106
+ /** Create state object */
107
+ makeState: <P extends Params = Params>(name: string, params?: P, path?: string, meta?: Record<string, Record<string, "url" | "query">>) => State<P>;
108
+ /** Get current router state */
109
+ getState: () => State | undefined;
110
+ /** Compare two states for equality */
111
+ areStatesEqual: (state1: State | undefined, state2: State | undefined, ignoreQueryParams?: boolean) => boolean;
112
+ /** Get a dependency by name */
113
+ getDependency: <K extends keyof Dependencies>(name: K) => Dependencies[K];
114
+ /** Forward state through facade (allows plugin interception) */
115
+ forwardState: <P extends Params = Params>(name: string, params: P) => SimpleState<P>;
116
+ }
117
+ /**
118
+ * Configuration storage for routes.
119
+ * Stores decoders, encoders, default params, and forward mappings.
120
+ */
121
+ interface RouteConfig {
122
+ /** Custom param decoders per route */
123
+ decoders: Record<string, (params: Params) => Params>;
124
+ /** Custom param encoders per route */
125
+ encoders: Record<string, (params: Params) => Params>;
126
+ /** Default params per route */
127
+ defaultParams: Record<string, Params>;
128
+ /** Forward mappings (source -> target) */
129
+ forwardMap: Record<string, string>;
130
+ /** Dynamic forward callbacks (source -> callback) */
131
+ forwardFnMap: Record<string, ForwardToCallback<any>>;
132
+ }
133
+ //#endregion
131
134
  //#region src/namespaces/RoutesNamespace/routesStore.d.ts
132
135
  interface RoutesStore<Dependencies extends DefaultDependencies = DefaultDependencies> {
133
136
  readonly definitions: RouteDefinition[];
@@ -187,6 +190,16 @@ interface RouterInternals<D extends DefaultDependencies = DefaultDependencies> {
187
190
  keys: string[];
188
191
  }[];
189
192
  readonly contextClaimRecords: Set<string>;
193
+ /**
194
+ * One-shot hydration scratchpad populated by `hydrateRouter` immediately
195
+ * before delegating to `router.start(parsed.path)` and cleared in the
196
+ * matching `finally`. SSR loader plugins read this slot directly via
197
+ * `getInternals(router).hydrationState` to short-circuit their own loader
198
+ * call when the server-resolved namespace value is already present in the
199
+ * parsed state (#596). `null` outside of an active `hydrateRouter`
200
+ * invocation.
201
+ */
202
+ hydrationState: SerializedRouterState | null;
190
203
  }
191
204
  declare function getInternals<D extends DefaultDependencies>(router: Router<D>): RouterInternals<D>;
192
205
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.mts","names":[],"sources":["../../src/namespaces/DependenciesNamespace/dependenciesStore.ts","../../src/namespaces/RoutesNamespace/types.ts","../../src/namespaces/RouteLifecycleNamespace/types.ts","../../src/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.ts","../../src/namespaces/RoutesNamespace/routesStore.ts","../../src/internals.ts"],"mappings":";;;;;UAKiB,iBAAA,sBACM,mBAAA,GAAsB,mBAAA;EAE3C,YAAA,EAAc,OAAA,CAAQ,YAAA;EACtB,MAAA,EAAQ,MAAA;AAAA;;;;;;AAJV;;;UCYiB,kBAAA,sBACM,mBAAA,GAAsB,mBAAA;EDZA;ECe3C,gBAAA,GACE,IAAA,UACA,OAAA,EAAS,cAAA,CAAe,YAAA;EDfZ;ECmBd,kBAAA,GACE,IAAA,UACA,OAAA,EAAS,cAAA,CAAe,YAAA;EDpBZ;ECwBd,SAAA,aAAsB,MAAA,GAAS,MAAA,EAC7B,IAAA,UACA,MAAA,GAAS,CAAA,EACT,IAAA,WACA,IAAA,GAAO,MAAA,SAAe,MAAA,+BACnB,KAAA,CAAM,CAAA;EDhCX;ECmCA,QAAA,QAAgB,KAAA;EDnC2B;ECsC3C,cAAA,GACE,MAAA,EAAQ,KAAA,cACR,MAAA,EAAQ,KAAA,cACR,iBAAA;EDvCY;EC2Cd,aAAA,mBAAgC,YAAA,EAAc,IAAA,EAAM,CAAA,KAAM,YAAA,CAAa,CAAA;ED1CvE;EC6CA,YAAA,aAAyB,MAAA,GAAS,MAAA,EAChC,IAAA,UACA,MAAA,EAAQ,CAAA,KACL,WAAA,CAAY,CAAA;AAAA;;;;;UAOF,WAAA;EA/CkB;EAiDjC,QAAA,EAAU,MAAA,UAAgB,MAAA,EAAQ,MAAA,KAAW,MAAA;EAhDxB;EAmDrB,QAAA,EAAU,MAAA,UAAgB,MAAA,EAAQ,MAAA,KAAW,MAAA;EA9CnB;EAiD1B,aAAA,EAAe,MAAA,SAAe,MAAA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;;;EAAA,SK0DlC,eAAA,GACP,KAAA,EAAO,KAAA,EACP,OAAA,GAAU,iBAAA,KACP,OAAA,CAAQ,KAAA;EAAA,SAGJ,YAAA,EAAc,GAAA,WAEnB,IAAA,MAAU,IAAA,oBAAwB,IAAA;EAAA,SAI7B,WAAA,GAAc,QAAA;EAAA,SACd,WAAA;EAAA,SAEA,OAAA,QAAe,SAAA;EAAA,SAEf,UAAA;EAET,SAAA,EAAW,eAAA;EAAA,SAGF,oBAAA,QAA4B,iBAAA,CAAkB,CAAA;EAAA,SAG9C,YAAA,QAAoB,OAAA;EAAA,SACpB,iBAAA,QAAyB,MAAA;EAAA,SACzB,qBAAA,SACP,MAAA,SAAe,cAAA,CAAe,CAAA,IAC9B,MAAA,SAAe,cAAA,CAAe,CAAA;EAAA,SAEvB,kBAAA,QAA0B,aAAA,CAAc,CAAA;EAAA,SAGxC,aAAA,QAAqB,WAAA,CAAY,CAAA;EAAA,SAGjC,YAAA;EAAA,SACA,eAAA;EAAA,SACA,UAAA;EAAA,SACA,QAAA,GAAW,KAAA,EAAO,KAAA;EAAA,SAClB,gBAAA;IAAoB,IAAA;EAAA;EAAA,SACpB,mBAAA,EAAqB,GAAA;AAAA;AAAA,iBAMhB,YAAA,WAAuB,mBAAA,CAAA,CACrC,MAAA,EAAQ,MAAA,CAAgB,CAAA,IACvB,eAAA,CAAgB,CAAA"}
1
+ {"version":3,"file":"validation.d.mts","names":[],"sources":["../../src/namespaces/DependenciesNamespace/dependenciesStore.ts","../../src/namespaces/RouteLifecycleNamespace/types.ts","../../src/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.ts","../../src/namespaces/RoutesNamespace/types.ts","../../src/namespaces/RoutesNamespace/routesStore.ts","../../src/internals.ts"],"mappings":";;;;;;;;UAKiB,iBAAA,sBACM,mBAAA,GAAsB,mBAAA;EAE3C,YAAA,EAAc,OAAA,CAAQ,YAAA;EACtB,MAAA,EAAQ,MAAA;AAAA;;;UCJO,0BAAA,sBACM,mB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AAyB,MAAA;EAAA,SACzB,qBAAA,SACP,MAAA,SAAe,cAAA,CAAe,CAAA,IAC9B,MAAA,SAAe,cAAA,CAAe,CAAA;EAAA,SAEvB,kBAAA,QAA0B,aAAA,CAAc,CAAA;EAAA,SAGxC,aAAA,QAAqB,WAAA,CAAY,CAAA;EAAA,SAGjC,YAAA;EAAA,SACA,eAAA;EAAA,SACA,UAAA;EAAA,SACA,QAAA,GAAW,KAAA,EAAO,KAAA;EAAA,SAClB,gBAAA;IAAoB,IAAA;EAAA;EAAA,SACpB,mBAAA,EAAqB,GAAA;EJnG6B;;AAAO;;;;ACmBpE;;;EG2FE,cAAA,EAAgB,qBAAA;AAAA;AAAA,iBAMF,YAAA,WAAuB,mBAAA,CAAA,CACrC,MAAA,EAAQ,MAAA,CAAgB,CAAA,IACvB,eAAA,CAAgB,CAAA"}
@@ -1 +1 @@
1
- import{r as e}from"./internals-CCymabFj.mjs";export{e as getInternals};
1
+ import{r as e}from"./internals-C59msvHY.mjs";export{e as getInternals};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@real-router/core",
3
- "version": "0.52.0",
3
+ "version": "0.54.1",
4
4
  "type": "commonjs",
5
5
  "description": "A simple, powerful, view-agnostic, modular and extensible router",
6
6
  "main": "./dist/cjs/index.js",