@real-router/core 0.78.0 → 0.79.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 (378) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/Router-DGUed2F4.js +2 -0
  3. package/dist/cjs/Router-DGUed2F4.js.map +1 -0
  4. package/dist/cjs/{Router-BG5yNYUG.d.ts → Router.d.ts} +5 -4
  5. package/dist/cjs/Router.d.ts.map +1 -0
  6. package/dist/cjs/Router.js +2 -0
  7. package/dist/cjs/Router.js.map +1 -0
  8. package/dist/cjs/RouterError.d.ts +182 -0
  9. package/dist/cjs/RouterError.d.ts.map +1 -0
  10. package/dist/cjs/RouterError.js +2 -0
  11. package/dist/cjs/RouterError.js.map +1 -0
  12. package/dist/cjs/api/cloneRouter.d.ts +86 -0
  13. package/dist/cjs/api/cloneRouter.d.ts.map +1 -0
  14. package/dist/cjs/api/cloneRouter.js +2 -0
  15. package/dist/cjs/api/cloneRouter.js.map +1 -0
  16. package/dist/cjs/api/getDependenciesApi.d.ts +7 -0
  17. package/dist/cjs/api/getDependenciesApi.d.ts.map +1 -0
  18. package/dist/cjs/api/getDependenciesApi.js +2 -0
  19. package/dist/cjs/api/getDependenciesApi.js.map +1 -0
  20. package/dist/cjs/api/getLifecycleApi.d.ts +7 -0
  21. package/dist/cjs/api/getLifecycleApi.d.ts.map +1 -0
  22. package/dist/cjs/api/getLifecycleApi.js +2 -0
  23. package/dist/cjs/api/getLifecycleApi.js.map +1 -0
  24. package/dist/cjs/api/getPluginApi.d.ts +7 -0
  25. package/dist/cjs/api/getPluginApi.d.ts.map +1 -0
  26. package/dist/cjs/api/getPluginApi.js +2 -0
  27. package/dist/cjs/api/getPluginApi.js.map +1 -0
  28. package/dist/cjs/api/getRoutesApi.d.ts +7 -0
  29. package/dist/cjs/api/getRoutesApi.d.ts.map +1 -0
  30. package/dist/cjs/api/getRoutesApi.js +2 -0
  31. package/dist/cjs/api/getRoutesApi.js.map +1 -0
  32. package/dist/cjs/api/helpers.js +2 -0
  33. package/dist/cjs/api/helpers.js.map +1 -0
  34. package/dist/cjs/api/types.d.ts +9 -0
  35. package/dist/cjs/api/types.d.ts.map +1 -0
  36. package/dist/cjs/api.d.ts +8 -105
  37. package/dist/cjs/api.js +1 -1
  38. package/dist/cjs/api.js.map +1 -1
  39. package/dist/cjs/buildParamMeta-DniluAIV.js +2 -0
  40. package/dist/cjs/buildParamMeta-DniluAIV.js.map +1 -0
  41. package/dist/cjs/{cloneRouter-a6LJt-zh.js → cloneRouter-Ch25z3Z2.js} +2 -2
  42. package/dist/cjs/{cloneRouter-a6LJt-zh.js.map → cloneRouter-Ch25z3Z2.js.map} +1 -1
  43. package/dist/cjs/constants.d.ts +25 -0
  44. package/dist/cjs/constants.d.ts.map +1 -0
  45. package/dist/cjs/constants.js +2 -0
  46. package/dist/cjs/constants.js.map +1 -0
  47. package/dist/cjs/createRouter.d.ts +23 -0
  48. package/dist/cjs/createRouter.d.ts.map +1 -0
  49. package/dist/cjs/createRouter.js +2 -0
  50. package/dist/cjs/createRouter.js.map +1 -0
  51. package/dist/cjs/engine/builder/buildTree.js +2 -0
  52. package/dist/cjs/engine/builder/buildTree.js.map +1 -0
  53. package/dist/cjs/engine/builder/computeCaches.js +2 -0
  54. package/dist/cjs/engine/builder/computeCaches.js.map +1 -0
  55. package/dist/cjs/engine/builder/createRouteTree.js +2 -0
  56. package/dist/cjs/engine/builder/createRouteTree.js.map +1 -0
  57. package/dist/cjs/engine/builder/types.d.ts +48 -0
  58. package/dist/cjs/engine/builder/types.d.ts.map +1 -0
  59. package/dist/cjs/engine/createMatcher.d.ts +29 -0
  60. package/dist/cjs/engine/createMatcher.d.ts.map +1 -0
  61. package/dist/cjs/engine/createMatcher.js +2 -0
  62. package/dist/cjs/engine/createMatcher.js.map +1 -0
  63. package/dist/cjs/engine/operations/routeTreeToDefinitions.js +2 -0
  64. package/dist/cjs/engine/operations/routeTreeToDefinitions.js.map +1 -0
  65. package/dist/cjs/engine/path-matcher/SegmentMatcher.d.ts +16 -0
  66. package/dist/cjs/engine/path-matcher/SegmentMatcher.d.ts.map +1 -0
  67. package/dist/cjs/engine/path-matcher/SegmentMatcher.js +2 -0
  68. package/dist/cjs/engine/path-matcher/SegmentMatcher.js.map +1 -0
  69. package/dist/cjs/engine/path-matcher/buildParamMeta.js +2 -0
  70. package/dist/cjs/engine/path-matcher/buildParamMeta.js.map +1 -0
  71. package/dist/cjs/engine/path-matcher/encoding.js +2 -0
  72. package/dist/cjs/engine/path-matcher/encoding.js.map +1 -0
  73. package/dist/cjs/engine/path-matcher/parseSegment.js +2 -0
  74. package/dist/cjs/engine/path-matcher/parseSegment.js.map +1 -0
  75. package/dist/cjs/engine/path-matcher/pathUtils.js +2 -0
  76. package/dist/cjs/engine/path-matcher/pathUtils.js.map +1 -0
  77. package/dist/cjs/engine/path-matcher/percentEncoding.js +2 -0
  78. package/dist/cjs/engine/path-matcher/percentEncoding.js.map +1 -0
  79. package/dist/cjs/engine/path-matcher/registration/buildParts.js +2 -0
  80. package/dist/cjs/engine/path-matcher/registration/buildParts.js.map +1 -0
  81. package/dist/cjs/engine/path-matcher/registration/context.js +2 -0
  82. package/dist/cjs/engine/path-matcher/registration/context.js.map +1 -0
  83. package/dist/cjs/engine/path-matcher/registration/errors.js +2 -0
  84. package/dist/cjs/engine/path-matcher/registration/errors.js.map +1 -0
  85. package/dist/cjs/engine/path-matcher/registration/index.js +2 -0
  86. package/dist/cjs/engine/path-matcher/registration/index.js.map +1 -0
  87. package/dist/cjs/engine/path-matcher/registration/trie.js +2 -0
  88. package/dist/cjs/engine/path-matcher/registration/trie.js.map +1 -0
  89. package/dist/cjs/engine/path-matcher/registration/trieNodes.js +2 -0
  90. package/dist/cjs/engine/path-matcher/registration/trieNodes.js.map +1 -0
  91. package/dist/cjs/{types-xg2zHVF6.d.ts → engine/path-matcher/types.d.ts} +2 -80
  92. package/dist/cjs/engine/path-matcher/types.d.ts.map +1 -0
  93. package/dist/cjs/engine/search-params/decode.js +2 -0
  94. package/dist/cjs/engine/search-params/decode.js.map +1 -0
  95. package/dist/cjs/engine/search-params/encode.js +2 -0
  96. package/dist/cjs/engine/search-params/encode.js.map +1 -0
  97. package/dist/cjs/engine/search-params/searchParams.js +2 -0
  98. package/dist/cjs/engine/search-params/searchParams.js.map +1 -0
  99. package/dist/cjs/engine/search-params/strategies/array.js +2 -0
  100. package/dist/cjs/engine/search-params/strategies/array.js.map +1 -0
  101. package/dist/cjs/engine/search-params/strategies/boolean.js +2 -0
  102. package/dist/cjs/engine/search-params/strategies/boolean.js.map +1 -0
  103. package/dist/cjs/engine/search-params/strategies/index.js +2 -0
  104. package/dist/cjs/engine/search-params/strategies/index.js.map +1 -0
  105. package/dist/cjs/engine/search-params/strategies/null.js +2 -0
  106. package/dist/cjs/engine/search-params/strategies/null.js.map +1 -0
  107. package/dist/cjs/engine/search-params/strategies/number.js +2 -0
  108. package/dist/cjs/engine/search-params/strategies/number.js.map +1 -0
  109. package/dist/cjs/engine/search-params/types.d.ts +72 -0
  110. package/dist/cjs/engine/search-params/types.d.ts.map +1 -0
  111. package/dist/cjs/engine/search-params/utils.js +2 -0
  112. package/dist/cjs/engine/search-params/utils.js.map +1 -0
  113. package/dist/cjs/engine/validation/route-batch.d.ts +38 -0
  114. package/dist/cjs/engine/validation/route-batch.d.ts.map +1 -0
  115. package/dist/cjs/engine/validation/route-batch.js +2 -0
  116. package/dist/cjs/engine/validation/route-batch.js.map +1 -0
  117. package/dist/cjs/engine/validation/routes.js +2 -0
  118. package/dist/cjs/engine/validation/routes.js.map +1 -0
  119. package/dist/cjs/foundation/event-emitter/EventEmitter.js +2 -0
  120. package/dist/cjs/foundation/event-emitter/EventEmitter.js.map +1 -0
  121. package/dist/cjs/foundation/fsm/fsm.js +2 -0
  122. package/dist/cjs/foundation/fsm/fsm.js.map +1 -0
  123. package/dist/cjs/foundation/logger/RouterLogger.js +2 -0
  124. package/dist/cjs/foundation/logger/RouterLogger.js.map +1 -0
  125. package/dist/cjs/foundation/logger/constants.js +2 -0
  126. package/dist/cjs/foundation/logger/constants.js.map +1 -0
  127. package/dist/cjs/getNavigator.d.ts +6 -0
  128. package/dist/cjs/getNavigator.d.ts.map +1 -0
  129. package/dist/cjs/getNavigator.js +2 -0
  130. package/dist/cjs/getNavigator.js.map +1 -0
  131. package/dist/cjs/guards.js +2 -0
  132. package/dist/cjs/guards.js.map +1 -0
  133. package/dist/cjs/helpers.js +2 -0
  134. package/dist/cjs/helpers.js.map +1 -0
  135. package/dist/cjs/index.d.ts +17 -239
  136. package/dist/cjs/index.js +1 -1
  137. package/dist/cjs/internals.d.ts +99 -0
  138. package/dist/cjs/internals.d.ts.map +1 -0
  139. package/dist/cjs/internals.js +2 -0
  140. package/dist/cjs/internals.js.map +1 -0
  141. package/dist/cjs/namespaces/DependenciesNamespace/dependenciesStore.d.ts +10 -0
  142. package/dist/cjs/namespaces/DependenciesNamespace/dependenciesStore.d.ts.map +1 -0
  143. package/dist/cjs/namespaces/DependenciesNamespace/dependenciesStore.js +2 -0
  144. package/dist/cjs/namespaces/DependenciesNamespace/dependenciesStore.js.map +1 -0
  145. package/dist/cjs/namespaces/EventBusNamespace/EventBusNamespace.js +2 -0
  146. package/dist/cjs/namespaces/EventBusNamespace/EventBusNamespace.js.map +1 -0
  147. package/dist/cjs/namespaces/NavigationNamespace/NavigationNamespace.js +2 -0
  148. package/dist/cjs/namespaces/NavigationNamespace/NavigationNamespace.js.map +1 -0
  149. package/dist/cjs/namespaces/NavigationNamespace/constants.js +2 -0
  150. package/dist/cjs/namespaces/NavigationNamespace/constants.js.map +1 -0
  151. package/dist/cjs/namespaces/NavigationNamespace/transition/completeTransition.js +2 -0
  152. package/dist/cjs/namespaces/NavigationNamespace/transition/completeTransition.js.map +1 -0
  153. package/dist/cjs/namespaces/NavigationNamespace/transition/errorHandling.js +2 -0
  154. package/dist/cjs/namespaces/NavigationNamespace/transition/errorHandling.js.map +1 -0
  155. package/dist/cjs/namespaces/NavigationNamespace/transition/guardPhase.js +2 -0
  156. package/dist/cjs/namespaces/NavigationNamespace/transition/guardPhase.js.map +1 -0
  157. package/dist/cjs/namespaces/OptionsNamespace/OptionsNamespace.js +2 -0
  158. package/dist/cjs/namespaces/OptionsNamespace/OptionsNamespace.js.map +1 -0
  159. package/dist/cjs/namespaces/OptionsNamespace/constants.js +2 -0
  160. package/dist/cjs/namespaces/OptionsNamespace/constants.js.map +1 -0
  161. package/dist/cjs/namespaces/OptionsNamespace/helpers.js +2 -0
  162. package/dist/cjs/namespaces/OptionsNamespace/helpers.js.map +1 -0
  163. package/dist/cjs/namespaces/OptionsNamespace/validators.js +2 -0
  164. package/dist/cjs/namespaces/OptionsNamespace/validators.js.map +1 -0
  165. package/dist/cjs/namespaces/PluginsNamespace/PluginsNamespace.js +2 -0
  166. package/dist/cjs/namespaces/PluginsNamespace/PluginsNamespace.js.map +1 -0
  167. package/dist/cjs/namespaces/PluginsNamespace/constants.js +2 -0
  168. package/dist/cjs/namespaces/PluginsNamespace/constants.js.map +1 -0
  169. package/dist/cjs/namespaces/PluginsNamespace/validators.js +2 -0
  170. package/dist/cjs/namespaces/PluginsNamespace/validators.js.map +1 -0
  171. package/dist/cjs/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.ts +174 -0
  172. package/dist/cjs/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.ts.map +1 -0
  173. package/dist/cjs/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.js +2 -0
  174. package/dist/cjs/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.js.map +1 -0
  175. package/dist/cjs/namespaces/RouteLifecycleNamespace/types.d.ts +17 -0
  176. package/dist/cjs/namespaces/RouteLifecycleNamespace/types.d.ts.map +1 -0
  177. package/dist/cjs/namespaces/RouterLifecycleNamespace/RouterLifecycleNamespace.js +2 -0
  178. package/dist/cjs/namespaces/RouterLifecycleNamespace/RouterLifecycleNamespace.js.map +1 -0
  179. package/dist/cjs/namespaces/RouterLifecycleNamespace/constants.js +2 -0
  180. package/dist/cjs/namespaces/RouterLifecycleNamespace/constants.js.map +1 -0
  181. package/dist/cjs/namespaces/RoutesNamespace/RoutesNamespace.js +2 -0
  182. package/dist/cjs/namespaces/RoutesNamespace/RoutesNamespace.js.map +1 -0
  183. package/dist/cjs/namespaces/RoutesNamespace/constants.js +2 -0
  184. package/dist/cjs/namespaces/RoutesNamespace/constants.js.map +1 -0
  185. package/dist/cjs/namespaces/RoutesNamespace/forwardChain.d.ts +5 -0
  186. package/dist/cjs/namespaces/RoutesNamespace/forwardChain.d.ts.map +1 -0
  187. package/dist/cjs/namespaces/RoutesNamespace/forwardChain.js +2 -0
  188. package/dist/cjs/namespaces/RoutesNamespace/forwardChain.js.map +1 -0
  189. package/dist/cjs/namespaces/RoutesNamespace/helpers.js +2 -0
  190. package/dist/cjs/namespaces/RoutesNamespace/helpers.js.map +1 -0
  191. package/dist/cjs/namespaces/RoutesNamespace/routeGuards.js +2 -0
  192. package/dist/cjs/namespaces/RoutesNamespace/routeGuards.js.map +1 -0
  193. package/dist/cjs/namespaces/RoutesNamespace/routesStore.d.ts +42 -0
  194. package/dist/cjs/namespaces/RoutesNamespace/routesStore.d.ts.map +1 -0
  195. package/dist/cjs/namespaces/RoutesNamespace/routesStore.js +2 -0
  196. package/dist/cjs/namespaces/RoutesNamespace/routesStore.js.map +1 -0
  197. package/dist/cjs/namespaces/RoutesNamespace/types.d.ts +57 -0
  198. package/dist/cjs/namespaces/RoutesNamespace/types.d.ts.map +1 -0
  199. package/dist/cjs/namespaces/StateNamespace/StateNamespace.js +2 -0
  200. package/dist/cjs/namespaces/StateNamespace/StateNamespace.js.map +1 -0
  201. package/dist/cjs/namespaces/StateNamespace/helpers.js +2 -0
  202. package/dist/cjs/namespaces/StateNamespace/helpers.js.map +1 -0
  203. package/dist/cjs/routerFSM.js +2 -0
  204. package/dist/cjs/routerFSM.js.map +1 -0
  205. package/dist/cjs/stateMetaStore.js +2 -0
  206. package/dist/cjs/stateMetaStore.js.map +1 -0
  207. package/dist/cjs/transitionPath.js +2 -0
  208. package/dist/cjs/transitionPath.js.map +1 -0
  209. package/dist/cjs/{RouterValidator-CZ8kPkrI.d.ts → types/RouterValidator.d.ts} +2 -2
  210. package/dist/cjs/types/RouterValidator.d.ts.map +1 -0
  211. package/dist/cjs/types/api.d.ts +184 -0
  212. package/dist/cjs/types/api.d.ts.map +1 -0
  213. package/dist/cjs/types/base.d.ts +86 -0
  214. package/dist/cjs/types/base.d.ts.map +1 -0
  215. package/dist/cjs/types/constants.d.ts +72 -0
  216. package/dist/cjs/types/constants.d.ts.map +1 -0
  217. package/dist/cjs/types/internal.d.ts +9 -0
  218. package/dist/cjs/types/internal.d.ts.map +1 -0
  219. package/dist/cjs/types/limits.d.ts +45 -0
  220. package/dist/cjs/types/limits.d.ts.map +1 -0
  221. package/dist/cjs/types/route-node-types.d.ts +46 -0
  222. package/dist/cjs/types/route-node-types.d.ts.map +1 -0
  223. package/dist/cjs/types/router.d.ts +313 -0
  224. package/dist/cjs/types/router.d.ts.map +1 -0
  225. package/dist/cjs/types/tree-changed.d.ts +55 -0
  226. package/dist/cjs/types/tree-changed.d.ts.map +1 -0
  227. package/dist/cjs/types.d.ts +208 -2
  228. package/dist/cjs/types.d.ts.map +1 -0
  229. package/dist/cjs/utils/createRequestScope.d.ts +111 -0
  230. package/dist/cjs/utils/createRequestScope.d.ts.map +1 -0
  231. package/dist/cjs/utils/createRequestScope.js +2 -0
  232. package/dist/cjs/utils/createRequestScope.js.map +1 -0
  233. package/dist/cjs/utils/getStaticPaths.d.ts +7 -0
  234. package/dist/cjs/utils/getStaticPaths.d.ts.map +1 -0
  235. package/dist/cjs/utils/getStaticPaths.js +2 -0
  236. package/dist/cjs/utils/getStaticPaths.js.map +1 -0
  237. package/dist/cjs/utils/hydrateRouter.d.ts +69 -0
  238. package/dist/cjs/utils/hydrateRouter.d.ts.map +1 -0
  239. package/dist/cjs/utils/hydrateRouter.js +2 -0
  240. package/dist/cjs/utils/hydrateRouter.js.map +1 -0
  241. package/dist/cjs/utils/serializeRouterState.d.ts +84 -0
  242. package/dist/cjs/utils/serializeRouterState.d.ts.map +1 -0
  243. package/dist/cjs/utils/serializeRouterState.js +2 -0
  244. package/dist/cjs/utils/serializeRouterState.js.map +1 -0
  245. package/dist/cjs/utils/serializeState.d.ts +50 -0
  246. package/dist/cjs/utils/serializeState.d.ts.map +1 -0
  247. package/dist/cjs/utils/serializeState.js +2 -0
  248. package/dist/cjs/utils/serializeState.js.map +1 -0
  249. package/dist/cjs/utils.d.ts +5 -1
  250. package/dist/cjs/utils.js +1 -1
  251. package/dist/cjs/validation.d.ts +6 -518
  252. package/dist/cjs/validation.js +1 -1
  253. package/dist/cjs/validation.js.map +1 -1
  254. package/dist/cjs/wiring/wireNamespaces.js +2 -0
  255. package/dist/cjs/wiring/wireNamespaces.js.map +1 -0
  256. package/dist/esm/Router-Bk6PfSE8.mjs +2 -0
  257. package/dist/esm/Router-Bk6PfSE8.mjs.map +1 -0
  258. package/dist/esm/{Router-Cy75qbgU.d.mts → Router.d.mts} +5 -4
  259. package/dist/esm/Router.d.mts.map +1 -0
  260. package/dist/esm/RouterError.d.mts +182 -0
  261. package/dist/esm/RouterError.d.mts.map +1 -0
  262. package/dist/esm/api/cloneRouter.d.mts +86 -0
  263. package/dist/esm/api/cloneRouter.d.mts.map +1 -0
  264. package/dist/esm/api/getDependenciesApi.d.mts +7 -0
  265. package/dist/esm/api/getDependenciesApi.d.mts.map +1 -0
  266. package/dist/esm/api/getLifecycleApi.d.mts +7 -0
  267. package/dist/esm/api/getLifecycleApi.d.mts.map +1 -0
  268. package/dist/esm/api/getPluginApi.d.mts +7 -0
  269. package/dist/esm/api/getPluginApi.d.mts.map +1 -0
  270. package/dist/esm/api/getRoutesApi.d.mts +7 -0
  271. package/dist/esm/api/getRoutesApi.d.mts.map +1 -0
  272. package/dist/esm/api/types.d.mts +9 -0
  273. package/dist/esm/api/types.d.mts.map +1 -0
  274. package/dist/esm/api.d.mts +8 -105
  275. package/dist/esm/api.mjs +1 -1
  276. package/dist/esm/api.mjs.map +1 -1
  277. package/dist/esm/buildParamMeta-bOLhLF9h.mjs +2 -0
  278. package/dist/esm/buildParamMeta-bOLhLF9h.mjs.map +1 -0
  279. package/dist/esm/{cloneRouter-CqS4kTs8.mjs → cloneRouter-D4rnqmi9.mjs} +2 -2
  280. package/dist/esm/{cloneRouter-CqS4kTs8.mjs.map → cloneRouter-D4rnqmi9.mjs.map} +1 -1
  281. package/dist/esm/constants.d.mts +25 -0
  282. package/dist/esm/constants.d.mts.map +1 -0
  283. package/dist/esm/createRouter.d.mts +23 -0
  284. package/dist/esm/createRouter.d.mts.map +1 -0
  285. package/dist/esm/engine/builder/types.d.mts +48 -0
  286. package/dist/esm/engine/builder/types.d.mts.map +1 -0
  287. package/dist/esm/engine/createMatcher.d.mts +29 -0
  288. package/dist/esm/engine/createMatcher.d.mts.map +1 -0
  289. package/dist/esm/engine/path-matcher/SegmentMatcher.d.mts +16 -0
  290. package/dist/esm/engine/path-matcher/SegmentMatcher.d.mts.map +1 -0
  291. package/dist/esm/{types-xg2zHVF6.d.mts → engine/path-matcher/types.d.mts} +2 -80
  292. package/dist/esm/engine/path-matcher/types.d.mts.map +1 -0
  293. package/dist/esm/engine/search-params/types.d.mts +72 -0
  294. package/dist/esm/engine/search-params/types.d.mts.map +1 -0
  295. package/dist/esm/engine/validation/route-batch.d.mts +38 -0
  296. package/dist/esm/engine/validation/route-batch.d.mts.map +1 -0
  297. package/dist/esm/getNavigator.d.mts +6 -0
  298. package/dist/esm/getNavigator.d.mts.map +1 -0
  299. package/dist/esm/index.d.mts +17 -239
  300. package/dist/esm/index.mjs +1 -1
  301. package/dist/esm/internals.d.mts +99 -0
  302. package/dist/esm/internals.d.mts.map +1 -0
  303. package/dist/esm/namespaces/DependenciesNamespace/dependenciesStore.d.mts +10 -0
  304. package/dist/esm/namespaces/DependenciesNamespace/dependenciesStore.d.mts.map +1 -0
  305. package/dist/esm/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.mts +174 -0
  306. package/dist/esm/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.mts.map +1 -0
  307. package/dist/esm/namespaces/RouteLifecycleNamespace/types.d.mts +17 -0
  308. package/dist/esm/namespaces/RouteLifecycleNamespace/types.d.mts.map +1 -0
  309. package/dist/esm/namespaces/RoutesNamespace/forwardChain.d.mts +5 -0
  310. package/dist/esm/namespaces/RoutesNamespace/forwardChain.d.mts.map +1 -0
  311. package/dist/esm/namespaces/RoutesNamespace/routesStore.d.mts +42 -0
  312. package/dist/esm/namespaces/RoutesNamespace/routesStore.d.mts.map +1 -0
  313. package/dist/esm/namespaces/RoutesNamespace/types.d.mts +57 -0
  314. package/dist/esm/namespaces/RoutesNamespace/types.d.mts.map +1 -0
  315. package/dist/esm/{RouterValidator-CZ8kPkrI.d.mts → types/RouterValidator.d.mts} +2 -2
  316. package/dist/esm/types/RouterValidator.d.mts.map +1 -0
  317. package/dist/esm/types/api.d.mts +184 -0
  318. package/dist/esm/types/api.d.mts.map +1 -0
  319. package/dist/esm/types/base.d.mts +86 -0
  320. package/dist/esm/types/base.d.mts.map +1 -0
  321. package/dist/esm/types/constants.d.mts +72 -0
  322. package/dist/esm/types/constants.d.mts.map +1 -0
  323. package/dist/esm/types/internal.d.mts +9 -0
  324. package/dist/esm/types/internal.d.mts.map +1 -0
  325. package/dist/esm/types/limits.d.mts +45 -0
  326. package/dist/esm/types/limits.d.mts.map +1 -0
  327. package/dist/esm/types/route-node-types.d.mts +46 -0
  328. package/dist/esm/types/route-node-types.d.mts.map +1 -0
  329. package/dist/esm/types/router.d.mts +313 -0
  330. package/dist/esm/types/router.d.mts.map +1 -0
  331. package/dist/esm/types/tree-changed.d.mts +55 -0
  332. package/dist/esm/types/tree-changed.d.mts.map +1 -0
  333. package/dist/esm/types.d.mts +208 -2
  334. package/dist/esm/types.d.mts.map +1 -0
  335. package/dist/esm/utils/createRequestScope.d.mts +111 -0
  336. package/dist/esm/utils/createRequestScope.d.mts.map +1 -0
  337. package/dist/esm/utils/getStaticPaths.d.mts +7 -0
  338. package/dist/esm/utils/getStaticPaths.d.mts.map +1 -0
  339. package/dist/esm/utils/hydrateRouter.d.mts +69 -0
  340. package/dist/esm/utils/hydrateRouter.d.mts.map +1 -0
  341. package/dist/esm/utils/serializeRouterState.d.mts +84 -0
  342. package/dist/esm/utils/serializeRouterState.d.mts.map +1 -0
  343. package/dist/esm/utils/serializeState.d.mts +50 -0
  344. package/dist/esm/utils/serializeState.d.mts.map +1 -0
  345. package/dist/esm/utils.d.mts +5 -1
  346. package/dist/esm/utils.mjs +1 -1
  347. package/dist/esm/validation.d.mts +6 -518
  348. package/dist/esm/validation.mjs +1 -1
  349. package/dist/esm/validation.mjs.map +1 -1
  350. package/package.json +2 -2
  351. package/dist/cjs/Router-BG5yNYUG.d.ts.map +0 -1
  352. package/dist/cjs/Router-D6NzRxBA.js +0 -2
  353. package/dist/cjs/Router-D6NzRxBA.js.map +0 -1
  354. package/dist/cjs/RouterValidator-CZ8kPkrI.d.ts.map +0 -1
  355. package/dist/cjs/api.d.ts.map +0 -1
  356. package/dist/cjs/buildParamMeta-CkG6cUIl.js +0 -2
  357. package/dist/cjs/buildParamMeta-CkG6cUIl.js.map +0 -1
  358. package/dist/cjs/index-CAnGQpnz.d.ts +0 -974
  359. package/dist/cjs/index-CAnGQpnz.d.ts.map +0 -1
  360. package/dist/cjs/index-DDrryY2U.d.ts +0 -309
  361. package/dist/cjs/index-DDrryY2U.d.ts.map +0 -1
  362. package/dist/cjs/index.d.ts.map +0 -1
  363. package/dist/cjs/types-xg2zHVF6.d.ts.map +0 -1
  364. package/dist/cjs/validation.d.ts.map +0 -1
  365. package/dist/esm/Router-Cy75qbgU.d.mts.map +0 -1
  366. package/dist/esm/Router-De0Gr9Ll.mjs +0 -2
  367. package/dist/esm/Router-De0Gr9Ll.mjs.map +0 -1
  368. package/dist/esm/RouterValidator-CZ8kPkrI.d.mts.map +0 -1
  369. package/dist/esm/api.d.mts.map +0 -1
  370. package/dist/esm/buildParamMeta-Bl0uORu6.mjs +0 -2
  371. package/dist/esm/buildParamMeta-Bl0uORu6.mjs.map +0 -1
  372. package/dist/esm/index-CAnGQpnz.d.mts +0 -974
  373. package/dist/esm/index-CAnGQpnz.d.mts.map +0 -1
  374. package/dist/esm/index-DnSU6huX.d.mts +0 -309
  375. package/dist/esm/index-DnSU6huX.d.mts.map +0 -1
  376. package/dist/esm/index.d.mts.map +0 -1
  377. package/dist/esm/types-xg2zHVF6.d.mts.map +0 -1
  378. package/dist/esm/validation.d.mts.map +0 -1
@@ -1,518 +1,6 @@
1
- import { a as MatcherInputNode, i as MatchResult, n as RouteTree, o as ResolvedMatcherOptions, r as BuildPathOptions, s as SegmentMatcherOptions, t as RouteDefinition } from "./types-xg2zHVF6.mjs";
2
- import { $ as State, B as PluginFactory, D as ForwardToCallback, I as LoggerConfig, J as LimitsConfig, O as GuardFn, Q as SimpleState, R as Options$1, U as Router, W as RouterLogger, X as Params, Y as NavigationOptions, at as Unsubscribe, k as GuardFnFactory, lt as RouteTreeState, u as TreeChangedEvent, v as EventMethodMap, w as DefaultDependencies, y as EventName, z as Plugin } from "./index-CAnGQpnz.mjs";
3
- import { t as RouterValidator } from "./RouterValidator-CZ8kPkrI.mjs";
4
- import { n as SerializedRouterState } from "./index-DnSU6huX.mjs";
5
-
6
- //#region src/engine/search-params/types.d.ts
7
- /**
8
- * Search Params Type Definitions.
9
- *
10
- * Consolidated interfaces and type aliases for the search-params module.
11
- *
12
- * @module search-params/types
13
- */
14
- /**
15
- * Array parameter encoding format.
16
- *
17
- * @remarks
18
- * - `none` - repeated keys: `a=1&a=2`
19
- * - `brackets` - bracket notation: `a[]=1&a[]=2`
20
- * - `index` - indexed notation: `a[0]=1&a[1]=2`
21
- * - `comma` - comma-separated: `a=1,2`
22
- */
23
- type ArrayFormat = "none" | "brackets" | "index" | "comma";
24
- /**
25
- * Boolean parameter encoding format.
26
- *
27
- * @remarks
28
- * - `none` - no special handling
29
- * - `auto` - auto-detect "true"/"false" strings as boolean values
30
- * - `empty-true` - true values have no value: `?flag` instead of `?flag=true`
31
- *
32
- * @remarks
33
- * Under `empty-true` the bare-key wire form (`?flag`) is reserved for `true`, so
34
- * a `null` value with `nullFormat: "default"` (which also encodes to a bare key)
35
- * is **not representable**: it round-trips back as `true`, not `null`. Both null
36
- * and true collapse to the same token and only `true` decodes back. Pair
37
- * `empty-true` with `nullFormat: "hidden"`, or avoid null query values.
38
- */
39
- type BooleanFormat = "none" | "auto" | "empty-true";
40
- /**
41
- * Null parameter encoding format.
42
- *
43
- * @remarks
44
- * - `default` - key only: `?key` (collides with `booleanFormat: "empty-true"`,
45
- * which reserves the bare-key form for `true` — null then decodes as `true`)
46
- * - `hidden` - omit from query string
47
- */
48
- type NullFormat = "default" | "hidden";
49
- /**
50
- * Number parameter encoding format.
51
- *
52
- * @remarks
53
- * - `none` - no special handling
54
- * - `auto` - decode canonical decimal numbers (`/^-?(0|[1-9]\d*)(\.\d+)?$/`) to
55
- * `Number()`. Recognizes negatives so the parsed type matches what
56
- * `build`/`navigate` produce; rejects leading zeros (`"007"`), exponent
57
- * notation, unsafe integers, and negative zero (`"-0"` — the grammar matches
58
- * it, but an `Object.is` guard rejects it since `build(-0)` emits `"0"`, #898)
59
- * — those keep their exact text as strings.
60
- */
61
- type NumberFormat = "none" | "auto";
62
- /**
63
- * Options for search-params parsing and building.
64
- */
65
- interface Options {
66
- /** Array parameter encoding format. @default "none" */
67
- arrayFormat?: ArrayFormat;
68
- /** Boolean parameter encoding format. @default "auto" */
69
- booleanFormat?: BooleanFormat;
70
- /** Null parameter encoding format. @default "default" */
71
- nullFormat?: NullFormat;
72
- /** Number parameter encoding format. @default "auto" */
73
- numberFormat?: NumberFormat;
74
- }
75
- //#endregion
76
- //#region src/engine/path-matcher/SegmentMatcher.d.ts
77
- declare class SegmentMatcher {
78
- #private;
79
- get options(): ResolvedMatcherOptions;
80
- constructor(options: SegmentMatcherOptions);
81
- registerTree(node: MatcherInputNode): void;
82
- match(path: string): MatchResult | undefined;
83
- buildPath(name: string, params?: Record<string, unknown>, options?: BuildPathOptions): string;
84
- getSegmentsByName(name: string): readonly MatcherInputNode[] | undefined;
85
- getMetaByName(name: string): Readonly<Record<string, Record<string, "url" | "query">>> | undefined;
86
- hasRoute(name: string): boolean;
87
- }
88
- //#endregion
89
- //#region src/engine/createMatcher.d.ts
90
- /**
91
- * Query string formatting options.
92
- *
93
- * Controls how arrays, booleans, nulls, and numbers are serialized in query strings.
94
- */
95
- type QueryParamsConfig = Readonly<Options>;
96
- /**
97
- * Options for creating a path matcher.
98
- */
99
- interface CreateMatcherOptions {
100
- readonly caseSensitive?: boolean;
101
- readonly strictTrailingSlash?: boolean;
102
- readonly strictQueryParams?: boolean;
103
- readonly urlParamsEncoding?: "default" | "uri" | "uriComponent" | "none";
104
- readonly queryParams?: QueryParamsConfig;
105
- }
106
- /**
107
- * Path matcher instance type.
108
- *
109
- * Opaque type — consumers use methods (match, buildPath, hasRoute, etc.)
110
- * without knowing the underlying SegmentMatcher implementation.
111
- */
112
- type Matcher = SegmentMatcher;
113
- //#endregion
114
- //#region src/engine/validation/route-batch.d.ts
115
- /**
116
- * Validates route structure for add operations.
117
- *
118
- * Performs comprehensive validation including:
119
- * - Type check (must be object)
120
- * - Name validation
121
- * - Path validation
122
- * - Duplicate name detection (in tree and batch)
123
- * - Duplicate path detection (in tree and batch)
124
- * - Recursive children validation
125
- *
126
- * @param route - Route to validate
127
- * @param methodName - Calling method for error context
128
- * @param rootNode - Optional root node for duplicate checking
129
- * @param parentName - Parent route name for building full path (used in recursion)
130
- * @param seenNames - Set of names already seen in this batch
131
- * @param seenPathsByParent - Map of paths by parent for path duplicate detection
132
- * @throws {TypeError} If route structure is invalid
133
- * @throws {Error} If route already exists (duplicate)
134
- * @throws {Error} If path already defined (duplicate)
135
- *
136
- * @example
137
- * ```typescript
138
- * const seenNames = new Set<string>();
139
- * const seenPaths = new Map<string, Set<string>>();
140
- *
141
- * // Validate routes before adding
142
- * for (const route of routes) {
143
- * validateRoute(route, "add", rootNode, "", seenNames, seenPaths);
144
- * }
145
- * ```
146
- */
147
- declare function validateRoute(route: unknown, methodName: string, rootNode?: RouteTree, parentName?: string, seenNames?: Set<string>, seenPathsByParent?: Map<string, Set<string>>): asserts route is RouteDefinition;
148
- //#endregion
149
- //#region src/types/internal.d.ts
150
- /**
151
- * Immutable limits configuration type.
152
- */
153
- type Limits = Readonly<LimitsConfig>;
154
- //#endregion
155
- //#region src/namespaces/DependenciesNamespace/dependenciesStore.d.ts
156
- interface DependenciesStore<Dependencies extends DefaultDependencies = DefaultDependencies> {
157
- dependencies: Partial<Dependencies>;
158
- limits: Limits;
159
- }
160
- //#endregion
161
- //#region src/namespaces/RouteLifecycleNamespace/types.d.ts
162
- interface RouteLifecycleDependencies<Dependencies extends DefaultDependencies = DefaultDependencies> {
163
- /** Per-router logger instance (from `getInternals(router).logger`) */
164
- logger: RouterLogger;
165
- compileFactory: (factory: GuardFnFactory<Dependencies>) => GuardFn;
166
- /**
167
- * Returns the opt-in DX validator, or `null` when no validation-plugin is
168
- * installed. A plain deps field (#1331) — internals are registered before
169
- * wiring, so `getInternals(router)` never throws and no try/catch is needed.
170
- */
171
- getValidator: () => RouterValidator | null;
172
- }
173
- //#endregion
174
- //#region src/namespaces/RouteLifecycleNamespace/RouteLifecycleNamespace.d.ts
175
- /**
176
- * Origin lane for a guard clear. Every `clearCanActivate` / `clearCanDeactivate`
177
- * caller names its lane — there is no origin-blind default — so a new call site
178
- * cannot silently wipe both the route-config and the external guard (#1171):
179
- *
180
- * - `"definition"` — clear only the route-config guard (`update(name, {…: null})`, #952).
181
- * - `"external"` — clear only the external, component-managed guard
182
- * (`removeXGuard()` and post-leave auto-cleanup — the inverse of `addXGuard()`).
183
- * - `"both"` — clear both (route removal / router teardown; the route is gone).
184
- */
185
- type GuardClearScope = "definition" | "external" | "both";
186
- /**
187
- * Source of truth for `canActivate` / `canDeactivate` guards.
188
- *
189
- * Storage is split by origin into four factory Maps (definition vs external,
190
- * each ×activate/deactivate); a single compiled-function Map per kind backs
191
- * navigation ("external wins" — when a route holds both a definition and an
192
- * external guard, the compiled guard is the external one, regardless of
193
- * registration order; #1174). `getFunctions()` returns a cached
194
- * `[deactivate, activate]` tuple for the hot path (stable reference, no
195
- * per-navigate allocation).
196
- *
197
- * All input validation is handled upstream by `getLifecycleApi` and
198
- * `getRoutesApi` — this class has no static methods.
199
- *
200
- * **Ordering convention.** Every paired surface lists **deactivate before
201
- * activate**: `getFunctions()` / `getFactories()` return `[deactivate,
202
- * activate]`, `getFactoriesByOrigin()` returns that tuple per origin, and
203
- * `canNavigateTo(toDeactivate, toActivate, …)` takes deactivate first. Keep
204
- * any new paired surface consistent with this order.
205
- */
206
- declare class RouteLifecycleNamespace<Dependencies extends DefaultDependencies = DefaultDependencies> {
207
- #private;
208
- setDependencies(deps: RouteLifecycleDependencies<Dependencies>): void;
209
- getHandlerCount(type: "activate" | "deactivate"): number;
210
- /**
211
- * Pre-flights the #961 handler-limit `RangeError` into the route-CRUD PREPARE
212
- * phase (#1046). `#registerHandler`'s per-slot limit check throws AFTER the
213
- * tree/config swap, so `add`/`replace`/`update` tore post-commit when the
214
- * validator was installed and the per-type count was at `maxLifecycleHandlers`.
215
- * Running the same check here — before any store mutation — restores atomicity
216
- * (#951/#956/#698): a batch that would exceed the limit aborts before a single
217
- * write.
218
- *
219
- * Only NEW slots count (an overwrite leaves the union count unchanged, mirroring
220
- * `#registerHandler`). For `replace` (`clearsDefinition = true`) the definition
221
- * guards are about to be cleared, so the projection runs against the surviving
222
- * EXTERNAL guards only — exactly the post-clear state the install loop sees.
223
- * Plugin-gated: a no-op without the validator (the limit is opt-in).
224
- *
225
- * @param activateNames - route names a `canActivate` would be registered for
226
- * @param deactivateNames - route names a `canDeactivate` would be registered for
227
- * @param clearsDefinition - true for `replace` (definition guards cleared first)
228
- */
229
- preflightHandlerLimit(activateNames: Iterable<string>, deactivateNames: Iterable<string>, clearsDefinition: boolean): void;
230
- /**
231
- * Adds a canActivate guard for a route.
232
- *
233
- * @param name - Route name (input-validated by facade)
234
- * @param handler - Guard function or boolean (input-validated by facade)
235
- * @param isFromDefinition - True when guard comes from route definition
236
- * (lands in the definition Map; subject to `clearDefinitionGuards()`).
237
- * False (default) when added via `getLifecycleApi().addActivateGuard(...)`
238
- * (lands in the external Map; survives `replace()`).
239
- *
240
- * External wins at runtime (#1174): when a route holds both a definition and
241
- * an external guard, the compiled function is the external one, regardless of
242
- * registration order. Within one origin the most recent add overwrites. Origin
243
- * determines which Map the factory is filed under (relevant for
244
- * `clearDefinitionGuards()` and `cloneRouter` re-registration).
245
- */
246
- addCanActivate(name: string, handler: GuardFnFactory<Dependencies> | boolean, isFromDefinition?: boolean, precompiledFn?: GuardFn): void;
247
- /**
248
- * Adds a canDeactivate guard for a route.
249
- *
250
- * Symmetric counterpart to {@link addCanActivate}.
251
- */
252
- addCanDeactivate(name: string, handler: GuardFnFactory<Dependencies> | boolean, isFromDefinition?: boolean, precompiledFn?: GuardFn): void;
253
- /**
254
- * Removes a canActivate guard for a route. `scope` names the origin lane
255
- * (see {@link GuardClearScope}) — there is no origin-blind default, so every
256
- * caller commits to a lane and a new call site cannot silently clear both.
257
- * Delegates to {@link #clearGuard} (mirrors the add side's `#registerHandler`).
258
- *
259
- * @param name - Route name (already validated by facade)
260
- * @param scope - Which origin(s) to clear: `"definition"` / `"external"` / `"both"`
261
- */
262
- clearCanActivate(name: string, scope: GuardClearScope): void;
263
- /**
264
- * Removes a canDeactivate guard for a route. Symmetric counterpart to
265
- * {@link clearCanActivate}.
266
- *
267
- * The `"external"` lane is what makes a route-config `canDeactivate` durable:
268
- * post-leave auto-cleanup (`completeTransition`) and `removeDeactivateGuard()`
269
- * unregister only the external, component-managed guard (router5 mount/unmount
270
- * heritage), while a definition guard survives for re-entry — symmetric with
271
- * definition `canActivate`, which lives as long as the route is in the tree
272
- * (#1171). Clearing both by default made a config guard one-shot: the first
273
- * permitted leave erased it, so re-entry was unguarded, `getRoutesApi().get()`
274
- * lost the field, and a clone taken after the leave never received it
275
- * (clone invariant #6).
276
- *
277
- * @param name - Route name (already validated by facade)
278
- * @param scope - Which origin(s) to clear: `"definition"` / `"external"` / `"both"`
279
- */
280
- clearCanDeactivate(name: string, scope: GuardClearScope): void;
281
- /**
282
- * Clears all lifecycle handlers (canActivate and canDeactivate).
283
- * Used by clearRoutes to reset all lifecycle state.
284
- */
285
- clearAll(): void;
286
- /**
287
- * Clears only lifecycle handlers that were registered from route definitions.
288
- * Used by HMR `replace()` to remove definition-sourced guards without
289
- * touching externally-added guards.
290
- *
291
- * For a slot where BOTH a definition and an external guard exist, the external
292
- * factory survives — and the compiled function is RECOMPILED from it (#1192).
293
- * Under external-wins (#1174) the compiled slot is already the external guard,
294
- * so this recompile is idempotent — it re-derives the surviving external factory
295
- * through the same choke point that keeps clearing correct (and stays robust if
296
- * the compiled slot were ever out of sync). For a definition-only slot, the
297
- * compiled function is dropped.
298
- */
299
- clearDefinitionGuards(): void;
300
- /**
301
- * Returns lifecycle factories as a flat `[deactivate, activate]` tuple of
302
- * `Record<name, factory>` — the effective view where external wins over
303
- * definition for the same slot. Used by `getRoutesApi` to enrich route
304
- * objects with their current canActivate / canDeactivate factories and by
305
- * the route-removal cleanup path.
306
- *
307
- * For cloneRouter (which needs to preserve origin on re-registration), use
308
- * {@link getFactoriesByOrigin} instead.
309
- */
310
- getFactories(): [Record<string, GuardFnFactory<Dependencies>>, Record<string, GuardFnFactory<Dependencies>>];
311
- /**
312
- * Returns factories tagged by origin — definition and external as separate
313
- * `[deactivate, activate]` tuples. Used by `cloneRouter` to re-register
314
- * guards on the clone with their original origin flag preserved.
315
- */
316
- getFactoriesByOrigin(): {
317
- definition: [Record<string, GuardFnFactory<Dependencies>>, Record<string, GuardFnFactory<Dependencies>>];
318
- external: [Record<string, GuardFnFactory<Dependencies>>, Record<string, GuardFnFactory<Dependencies>>];
319
- };
320
- /**
321
- * Returns compiled lifecycle functions for transition execution.
322
- *
323
- * @returns Tuple of [canDeactivateFunctions, canActivateFunctions] as Maps
324
- */
325
- getFunctions(): [Map<string, GuardFn>, Map<string, GuardFn>];
326
- canNavigateTo(toDeactivate: string[], toActivate: string[], toState: State, fromState: State | undefined): boolean;
327
- /**
328
- * Compiles a guard factory to its `GuardFn` WITHOUT registering it — surfaces
329
- * a throwing / non-function factory eagerly. The prepare-then-commit
330
- * add/replace path (`adoptRouteArtifacts`) calls this for every pending guard
331
- * BEFORE the store swap (#956), so a malformed factory aborts the mutation
332
- * with the store untouched. The returned function is then installed via the
333
- * `precompiledFn` argument of {@link addCanActivate} / {@link addCanDeactivate}
334
- * — no re-compile, so a factory with compile-time side effects runs exactly
335
- * once. Same boolean-shorthand handling + compile + non-function check as the
336
- * inline `#registerHandler` path, so a route-config `canActivate: true`
337
- * (boolean shorthand, runtime-reachable via the public route type) compiles to
338
- * the cached `TRUE_GUARD`/`FALSE_GUARD` instead of throwing on a non-callable.
339
- */
340
- compileGuardFactory(handler: GuardFnFactory<Dependencies> | boolean, methodName: string): GuardFn;
341
- }
342
- //#endregion
343
- //#region src/namespaces/RoutesNamespace/types.d.ts
344
- /**
345
- * Dependencies injected into RoutesNamespace.
346
- *
347
- * These are function references from the Router facade,
348
- * avoiding the need to pass the entire Router object.
349
- */
350
- interface RoutesDependencies<Dependencies extends DefaultDependencies = DefaultDependencies> {
351
- /** Per-router logger instance (from `getInternals(router).logger`) */
352
- logger: RouterLogger;
353
- /**
354
- * Register a canActivate handler for a route. `precompiledFn` installs an
355
- * already-compiled `GuardFn` (from {@link compileGuard}) without re-invoking
356
- * the factory — used by the #956 prepare-then-commit path so guards compile
357
- * once, before the store swap.
358
- */
359
- addActivateGuard: (name: string, handler: GuardFnFactory<Dependencies>, precompiledFn?: GuardFn) => void;
360
- /** Register a canDeactivate handler for a route (see {@link addActivateGuard}). */
361
- addDeactivateGuard: (name: string, handler: GuardFnFactory<Dependencies>, precompiledFn?: GuardFn) => void;
362
- /**
363
- * Compile a guard factory to its `GuardFn` WITHOUT registering it — surfaces a
364
- * throwing / non-function factory eagerly so the add/replace commit can
365
- * validate every guard before swapping the store (#956).
366
- */
367
- compileGuard: (handler: GuardFnFactory<Dependencies>, methodName: string) => GuardFn;
368
- /** Create state object */
369
- makeState: <P extends Params = Params>(name: string, params?: P, path?: string, meta?: Record<string, Record<string, "url" | "query">>) => State<P>;
370
- /** Get current router state */
371
- getState: () => State | undefined;
372
- /** Compare two states for equality */
373
- areStatesEqual: (state1: State | undefined, state2: State | undefined, ignoreQueryParams?: boolean) => boolean;
374
- /** Get a dependency by name */
375
- getDependency: <K extends keyof Dependencies>(name: K) => Dependencies[K];
376
- /** Forward state through facade (allows plugin interception) */
377
- forwardState: <P extends Params = Params>(name: string, params: P) => SimpleState<P>;
378
- }
379
- /**
380
- * Configuration storage for routes.
381
- * Stores decoders, encoders, default params, and forward mappings.
382
- */
383
- interface RouteConfig {
384
- /** Custom param decoders per route */
385
- decoders: Record<string, (params: Params) => Params>;
386
- /** Custom param encoders per route */
387
- encoders: Record<string, (params: Params) => Params>;
388
- /** Default params per route */
389
- defaultParams: Record<string, Params>;
390
- /** Forward mappings (source -> target) */
391
- forwardMap: Record<string, string>;
392
- /** Dynamic forward callbacks (source -> callback) */
393
- forwardFnMap: Record<string, ForwardToCallback<any>>;
394
- }
395
- //#endregion
396
- //#region src/namespaces/RoutesNamespace/routesStore.d.ts
397
- interface RoutesStore<Dependencies extends DefaultDependencies = DefaultDependencies> {
398
- /**
399
- * DERIVED VIEW, not stored state: reconstructed from `tree` on every access
400
- * via `routeTreeToDefinitions` (the lossless inverse cloneRouter already
401
- * relies on — the `~` absolute marker is restored, child order is the
402
- * definition order). The tree is the single source of truth, so a third
403
- * retained copy of the route table (~30 B/route) is not kept. Every reader
404
- * is a cold CRUD/plugin-registration path; the derive is O(N).
405
- *
406
- * The returned array is a FRESH snapshot each time — mutating it never
407
- * affects the store (pass an explicitly-mutated snapshot to
408
- * `commitTreeChanges` instead, as `remove` does).
409
- */
410
- readonly definitions: RouteDefinition[];
411
- readonly config: RouteConfig;
412
- tree: RouteTree;
413
- matcher: Matcher;
414
- /**
415
- * Per-route-name cache of URL (path) param names, derived from `matcher` and
416
- * read by `RoutesNamespace.getUrlParams` (powers `areStatesEqual` /
417
- * `isActiveRoute`). Cleared on every `matcher` rebuild so comparisons never
418
- * stay frozen to a route's pre-mutation param shape (#723).
419
- */
420
- readonly urlParamsCache: Map<string, string[]>;
421
- resolvedForwardMap: Record<string, string>;
422
- routeCustomFields: Record<string, Record<string, unknown>>;
423
- rootPath: string;
424
- readonly matcherOptions: CreateMatcherOptions | undefined;
425
- depsStore: RoutesDependencies<Dependencies> | undefined;
426
- lifecycleNamespace: RouteLifecycleNamespace<Dependencies> | undefined;
427
- readonly pendingCanActivate: Map<string, GuardFnFactory<Dependencies>>;
428
- readonly pendingCanDeactivate: Map<string, GuardFnFactory<Dependencies>>;
429
- }
430
- //#endregion
431
- //#region src/internals.d.ts
432
- interface RouterInternals<D extends DefaultDependencies = DefaultDependencies> {
433
- readonly makeState: <P extends Params = Params>(name: string, params?: P, path?: string, meta?: Record<string, Record<string, "url" | "query">>) => State<P>;
434
- readonly forwardState: <P extends Params = Params>(routeName: string, routeParams: P) => SimpleState<P>;
435
- readonly buildStateResolved: (resolvedName: string, resolvedParams: Params) => RouteTreeState | undefined;
436
- readonly matchPath: <P extends Params = Params>(path: string, options?: Options$1) => State<P> | undefined;
437
- readonly getOptions: () => Options$1;
438
- readonly addEventListener: <E extends EventName>(eventName: E, cb: Plugin[EventMethodMap[E]]) => Unsubscribe;
439
- /**
440
- * Route-tree mutation channel — internal access for the `getRoutesApi`
441
- * wrapper. A dedicated bridge is required because the public
442
- * `addEventListener<E extends EventName>` structurally rejects
443
- * `"TREE_CHANGED"` (it is not in the public `EventName` union), is strict on
444
- * duplicates, and exposes neither `emit` nor `listenerCount`.
445
- */
446
- readonly treeChanged: {
447
- readonly emit: (event: TreeChangedEvent) => void;
448
- readonly subscribe: (handler: (event: TreeChangedEvent) => void) => Unsubscribe;
449
- readonly listenerCount: () => number;
450
- /**
451
- * True while a `TREE_CHANGED` emit is on the stack — `getRoutesApi` reads it
452
- * to reject reentrant route-CRUD from a `subscribeChanges` handler (#1032).
453
- */
454
- readonly isEmitting: () => boolean;
455
- };
456
- readonly buildPath: (route: string, params?: Params) => string;
457
- readonly emitTransitionError: (error: Error) => void;
458
- /**
459
- * Emits `TRANSITION_SUCCESS` directly (no FSM transition) — used by
460
- * `getRoutesApi().replace()` to notify `router.subscribe` listeners when a
461
- * structural replace revalidates the active state (#950). Mirrors the success
462
- * emission `completeTransition` / `navigateToNotFound` perform.
463
- */
464
- readonly emitTransitionSuccess: (toState: State, fromState: State | undefined, opts?: NavigationOptions) => void;
465
- /**
466
- * Commits the not-found (`UNKNOWN_ROUTE`) state for `path` and emits
467
- * `TRANSITION_SUCCESS` — the `NavigationNamespace.navigateToNotFound`
468
- * primitive. `replace()` uses it when a structural replace drops the active
469
- * route, so subscribers are notified instead of the state silently clearing
470
- * (#950).
471
- */
472
- readonly navigateToNotFound: (path: string) => State;
473
- readonly start: (path: string) => Promise<State>;
474
- /**
475
- * Plugin-only navigation entry point — delegates to
476
- * `NavigationNamespace.navigateToState` (`getPluginApi(router).navigateToState`).
477
- * Hidden from `Router`/`Navigator` to keep the userland surface minimal;
478
- * see `core-types/src/api.ts` for usage docs.
479
- */
480
- readonly navigateToState: (state: State, options?: NavigationOptions) => Promise<State>;
481
- readonly interceptors: Map<string, ((next: (...args: any[]) => any, ...args: any[]) => any)[]>;
482
- readonly setRootPath: (rootPath: string) => void;
483
- readonly getRootPath: () => string;
484
- readonly getTree: () => RouteTree;
485
- readonly isDisposed: () => boolean;
486
- validator: RouterValidator | null;
487
- readonly logger: RouterLogger;
488
- readonly dependenciesGetStore: () => DependenciesStore<D>;
489
- readonly getCloneState: () => {
490
- options: Options$1;
491
- dependencies: Record<string, unknown>;
492
- pluginFactories: PluginFactory<D>[];
493
- loggerConfig: LoggerConfig;
494
- };
495
- readonly routeGetStore: () => RoutesStore<D>;
496
- readonly getStateName: () => string | undefined;
497
- readonly isTransitioning: () => boolean;
498
- readonly clearState: () => void;
499
- readonly setState: (state: State) => void;
500
- readonly routerExtensions: {
501
- keys: string[];
502
- }[];
503
- readonly contextClaimRecords: Set<string>;
504
- /**
505
- * One-shot hydration scratchpad populated by `hydrateRouter` immediately
506
- * before delegating to `router.start(parsed.path)` and cleared in the
507
- * matching `finally`. SSR loader plugins read this slot directly via
508
- * `getInternals(router).hydrationState` to short-circuit their own loader
509
- * call when the server-resolved namespace value is already present in the
510
- * parsed state (#596). `null` outside of an active `hydrateRouter`
511
- * invocation.
512
- */
513
- hydrationState: SerializedRouterState | null;
514
- }
515
- declare function getInternals<D extends DefaultDependencies>(router: Router<D>): RouterInternals<D>;
516
- //#endregion
517
- export { type Matcher, type RouteTree, type RouterInternals, type RouterValidator, getInternals, validateRoute };
518
- //# sourceMappingURL=validation.d.mts.map
1
+ import { RouteTree } from "./engine/builder/types.mjs";
2
+ import { Matcher } from "./engine/createMatcher.mjs";
3
+ import { validateRoute } from "./engine/validation/route-batch.mjs";
4
+ import { RouterValidator } from "./types/RouterValidator.mjs";
5
+ import { RouterInternals, getInternals } from "./internals.mjs";
6
+ export { type Matcher, type RouteTree, type RouterInternals, type RouterValidator, getInternals, validateRoute };
@@ -1,2 +1,2 @@
1
- import{c as e,f as t,i as n,l as r,n as i,r as a}from"./buildParamMeta-Bl0uORu6.mjs";function o(e,t){return TypeError(`[router.${e}] ${t}`)}function s(e,t,n){if(!r(e))throw o(n,`Invalid path for route "${t}": unbalanced constraint delimiter ('<' or '>') in "${e}"`);if(e.includes(`<>`))throw o(n,`Invalid path for route "${t}": empty constraint '<>' in "${e}" (a constraint body must be non-empty, e.g. '<[0-9]+>')`)}function c(e,t,n,r){let i=new Set;for(let a of e){if(i.has(a))throw o(n,`Invalid path for route "${t}": duplicate parameter name ':${a}' in "${r}" (a param name must be unique within a route — the second binding would overwrite the first)`);i.add(a)}}function l(t,n,r,i,a){let s=new Set(t);for(let t of n){if(e.test(t))throw o(i,`Invalid path for route "${r}": invalid query-param name "${t}" in "${a}" (a query-param name cannot contain '<' or '>' — a reverse-order modifier typo that leaked a constraint into the query; put the optional '?' after the constraint, ':id<...>?')`);if(s.has(t))throw o(i,`Invalid path for route "${r}": "${t}" is declared as both a path param and a query param in "${a}" — buildPath would emit its value twice (rename one)`)}}function u(e){let t=!0,n=!1,r=!1;for(let i of e){if(r){r=i!==`>`;continue}if(i===`<`){r=!0;continue}if(i===`/`){t=!0;continue}if(t&&=(n=i===`:`||i===`*`,!1),!n&&i.codePointAt(0)>=128)return!0}return!1}function d(e){for(let t=1;t<e.length;t++)if(e[t]===`?`&&e[t-1]!==`>`&&e[t+1]===`/`&&e[t+2]===`*`)return!0;return!1}function f(e,t,r,i){if(n(e))throw o(i,`Invalid path for route "${t}": two optional params directly before a splat are not supported in "${r}" — a single trie slot carries one optional→splat fork, so the omit-outer/take-inner form would silently reshape into the splat. Split into two routes, or drop the '?' on one`);if(d(e))throw o(i,`Invalid path for route "${t}": an unconstrained optional param before a splat is not supported in "${r}" — it is ambiguous (every multi-segment value has two readings). Add a constraint (e.g. ':lang<[a-z]+>?') or model it as two routes`)}function p(e,t,n){switch(e){case`name-less`:case`trailing-marker`:return`Invalid path for route "${t}": parameter marker (':' or '*') without a name in "${n}"`;case`fused-marker`:return`Invalid path for route "${t}": parameter marker (':' or '*') must begin a segment, but "${n}" fuses one to a static prefix (use a boundary marker like "/a/:b")`;case`fused-constraint-suffix`:return`Invalid path for route "${t}": text fused to a constraint '>' in "${n}" (a '<...>' must end its segment or be followed by '/' or an optional '?' — use "/:id<...>/rest", not "/:id<...>rest")`;case`constraint-in-static`:return`Invalid path for route "${t}": constraint '<...>' in a static segment in "${n}" (a '<...>' must follow a parameter marker ':' or '*' — attach it to a param like "/:id<...>", or drop it)`;case`optional-splat`:return`Invalid path for route "${t}": optional splat ('*name?') is not supported in "${n}" a splat cannot be optional (use a required splat '*name')`;case`unbalanced-constraint`:case`empty-constraint`:return`Invalid path for route "${t}": invalid constraint in "${n}"`}}function m(e,t,n){try{return i(e)}catch(r){throw o(n,`Invalid path for route "${t}": ${(r instanceof Error?r.message:String(r)).replace(/^\[buildParamMeta] /,``)} (in "${e}")`)}}function h(e,t,n,r){if(typeof e!=`string`){let t;throw t=e===null?`null`:Array.isArray(e)?`array`:typeof e,o(n,`Route path must be a string, got ${t}`)}if(e===``)return;if(/\s/.test(e))throw o(n,`Invalid path for route "${t}": whitespace not allowed in "${e}"`);if(!/^([/?~]|[^/]+$)/.test(e))throw o(n,`Route "${t}" has invalid path format: "${e}". Path should start with '/', '~', '?' or be a relative segment.`);if(e.includes(`//`))throw o(n,`Invalid path for route "${t}": double slashes not allowed in "${e}"`);s(e,t,n);let{pathPattern:i,urlParams:d,queryParams:h}=m(e,t,n);c(d,t,n,e),l(d,h,t,n,e);let g=a(i);if(g!==void 0)throw o(n,p(g,t,e));if(f(i,t,e,n),u(i))throw o(n,`Invalid path for route "${t}": non-ASCII static segment in "${e}" — match compares static segments raw and rejects non-ASCII input, so this route would never match. Percent-encode it (e.g. '/caf%C3%A9') or use a param`);let _=r&&r.paramMeta.urlParams.length>0;if(e.startsWith(`~`)&&_)throw o(n,`Absolute path "${e}" cannot be used under parent route with URL parameters`)}const g=/^[A-Z_a-z][\w-]*$/,_=/\S/,v=1e4;function y(e){if(e===null)return`null`;if(typeof e==`object`){try{let t=e.constructor;if(typeof t==`function`&&t.name!==`Object`)return t.name||`object`}catch{}return`object`}return typeof e}function b(e){for(let t of Object.keys(e)){let n=Object.getOwnPropertyDescriptor(e,t);if(n&&(n.get||n.set))return!0}return!1}function x(e,t){if(!e||typeof e!=`object`)throw TypeError(`[router.${t}] Route must be an object, got ${y(e)}`);let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)throw TypeError(`[router.${t}] Route must be a plain object, got ${y(e)}`);if(b(e))throw TypeError(`[router.${t}] Route must not have getters or setters`)}function S(e,t){if(e.encodeParams!==void 0&&typeof e.encodeParams!=`function`)throw TypeError(`[router.${t}] Route "${String(e.name)}" encodeParams must be a function`)}function C(e,t){if(e.decodeParams!==void 0&&typeof e.decodeParams!=`function`)throw TypeError(`[router.${t}] Route "${String(e.name)}" decodeParams must be a function`)}function w(e,t){if(typeof e.name!=`string`)throw TypeError(`[router.${t}] Route name must be a string, got ${y(e.name)}`);let n=e.name;if(n===``)throw TypeError(`[router.${t}] Route name cannot be empty`);if(!_.test(n))throw TypeError(`[router.${t}] Route name cannot contain only whitespace`);if(n.length>v)throw TypeError(`[router.${t}] Route name exceeds maximum length of ${v} characters`);if(!n.startsWith(`@@`)){if(n.includes(`.`))throw TypeError(`[router.${t}] Route name "${n}" cannot contain dots. Use children array or { parent } option in addRoute() instead.`);if(!g.test(n))throw TypeError(`[router.${t}] Invalid route name "${n}". Name must start with a letter or underscore, followed by letters, numbers, underscores, or hyphens.`)}}function T(e,t){if(!t.includes(`.`))return e.children.get(t);let n=e;for(let e of t.split(`.`))if(n=n.children.get(e),!n)return;return n}function E(e,t,n){if(T(e,t))throw Error(`[router.${n}] Route "${t}" already exists`)}function D(e,t,n){if(e.has(t))throw Error(`[router.${n}] Duplicate route "${t}" in batch`);e.add(t)}function O(e,t,n,r){let i=t===``?e:T(e,t);if(i){for(let e of i.children.values())if(e.path===n)throw Error(`[router.${r}] Path "${n}" is already defined`)}}function k(e,t,n,r){let i=e.get(t);if(i?.has(n))throw Error(`[router.${r}] Path "${n}" is already defined`);i?i.add(n):e.set(t,new Set([n]))}function A(e,t,n,r=``,i,a){x(e,t);let o=e;w(o,t),h(o.path,o.name,t,n),S(o,t),C(o,t);let s=o.name,c=r?`${r}.${s}`:s;n&&c&&E(n,c,t),i&&D(i,c,t);let l=o.path,u=r;if(n&&O(n,u,l,t),a&&k(a,u,l,t),o.children!==void 0){if(!Array.isArray(o.children))throw TypeError(`[router.${t}] Route "${s}" children must be an array, got ${y(o.children)}`);for(let e of o.children)A(e,t,n,c,i,a)}}export{t as getInternals,A as validateRoute};
1
+ import{a as e,i as t,n,r,u as i}from"./buildParamMeta-bOLhLF9h.mjs";function a(e,t){return TypeError(`[router.${e}] ${t}`)}function o(e,t,n,r){let i=new Set;for(let o of e){if(i.has(o))throw a(n,`Invalid path for route "${t}": duplicate parameter name ':${o}' in "${r}" (a param name must be unique within a route — the second binding would overwrite the first)`);i.add(o)}}function s(e,t,r,i,o){let s=new Set(e);for(let e of t){if(n.test(e))throw a(i,`Invalid path for route "${r}": invalid query-param name "${e}" in "${o}" (a query-param name cannot contain '<' or '>' — it would never round-trip; rename the query param)`);if(s.has(e))throw a(i,`Invalid path for route "${r}": "${e}" is declared as both a path param and a query param in "${o}" — buildPath would emit its value twice (rename one)`)}}function c(e){let t=!0,n=!1;for(let r of e){if(r===`/`){t=!0;continue}if(t&&=(n=r===`:`||r===`*`,!1),!n&&r.codePointAt(0)>=128)return!0}return!1}function l(e,t,n){switch(e){case`name-less`:case`trailing-marker`:return`Invalid path for route "${t}": parameter marker (':' or '*') without a name in "${n}"`;case`fused-marker`:return`Invalid path for route "${t}": parameter marker (':' or '*') must begin a segment, but "${n}" fuses one to a static prefix (use a boundary marker like "/a/:b")`}}function u(e,t){return e.code===`optional-removed`?`Invalid path for route "${t}": optional params are not supported "${e.segment}". Declare two sibling routes instead: "${e.withoutSegment}" and "${e.requiredForm}" (the route hierarchy already expresses optionality)`:`Invalid path for route "${t}": regex constraints are not supported — '<' and '>' are reserved in path segments ("${e.segment}"). Match the segment as a plain string and validate the value in a guard (canActivate) or app code`}function d(n,i,d,f){if(typeof n!=`string`){let e;throw e=n===null?`null`:Array.isArray(n)?`array`:typeof n,a(d,`Route path must be a string, got ${e}`)}if(n===``)return;if(/\s/.test(n))throw a(d,`Invalid path for route "${i}": whitespace not allowed in "${n}"`);if(!/^([/?~]|[^/]+$)/.test(n))throw a(d,`Route "${i}" has invalid path format: "${n}". Path should start with '/', '~', '?' or be a relative segment.`);if(n.includes(`//`))throw a(d,`Invalid path for route "${i}": double slashes not allowed in "${n}"`);let{pathPattern:p,urlParams:m,queryParams:h}=r(n);o(m,i,d,n),s(m,h,i,d,n);let g=t(p);if(g!==void 0)throw a(d,u(g,i));let _=e(p);if(_!==void 0)throw a(d,l(_,i,n));if(c(p))throw a(d,`Invalid path for route "${i}": non-ASCII static segment in "${n}" — match compares static segments raw and rejects non-ASCII input, so this route would never match. Percent-encode it (e.g. '/caf%C3%A9') or use a param`);let v=f&&f.paramMeta.urlParams.length>0;if(n.startsWith(`~`)&&v)throw a(d,`Absolute path "${n}" cannot be used under parent route with URL parameters`)}const f=/^[A-Z_a-z][\w-]*$/,p=/\S/,m=1e4;function h(e){if(e===null)return`null`;if(typeof e==`object`){try{let t=e.constructor;if(typeof t==`function`&&t.name!==`Object`)return t.name||`object`}catch{}return`object`}return typeof e}function g(e){for(let t of Object.keys(e)){let n=Object.getOwnPropertyDescriptor(e,t);if(n&&(n.get||n.set))return!0}return!1}function _(e,t){if(!e||typeof e!=`object`)throw TypeError(`[router.${t}] Route must be an object, got ${h(e)}`);let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)throw TypeError(`[router.${t}] Route must be a plain object, got ${h(e)}`);if(g(e))throw TypeError(`[router.${t}] Route must not have getters or setters`)}function v(e,t){if(e.encodeParams!==void 0&&typeof e.encodeParams!=`function`)throw TypeError(`[router.${t}] Route "${String(e.name)}" encodeParams must be a function`)}function y(e,t){if(e.decodeParams!==void 0&&typeof e.decodeParams!=`function`)throw TypeError(`[router.${t}] Route "${String(e.name)}" decodeParams must be a function`)}function b(e,t){if(typeof e.name!=`string`)throw TypeError(`[router.${t}] Route name must be a string, got ${h(e.name)}`);let n=e.name;if(n===``)throw TypeError(`[router.${t}] Route name cannot be empty`);if(!p.test(n))throw TypeError(`[router.${t}] Route name cannot contain only whitespace`);if(n.length>m)throw TypeError(`[router.${t}] Route name exceeds maximum length of ${m} characters`);if(!n.startsWith(`@@`)){if(n.includes(`.`))throw TypeError(`[router.${t}] Route name "${n}" cannot contain dots. Use children array or { parent } option in addRoute() instead.`);if(!f.test(n))throw TypeError(`[router.${t}] Invalid route name "${n}". Name must start with a letter or underscore, followed by letters, numbers, underscores, or hyphens.`)}}function x(e,t){if(!t.includes(`.`))return e.children.get(t);let n=e;for(let e of t.split(`.`))if(n=n.children.get(e),!n)return;return n}function S(e,t,n){if(x(e,t))throw Error(`[router.${n}] Route "${t}" already exists`)}function C(e,t,n){if(e.has(t))throw Error(`[router.${n}] Duplicate route "${t}" in batch`);e.add(t)}function w(e,t,n,r){let i=t===``?e:x(e,t);if(i){for(let e of i.children.values())if(e.path===n)throw Error(`[router.${r}] Path "${n}" is already defined`)}}function T(e,t,n,r){let i=e.get(t);if(i?.has(n))throw Error(`[router.${r}] Path "${n}" is already defined`);i?i.add(n):e.set(t,new Set([n]))}function E(e,t,n,r=``,i,a){_(e,t);let o=e;b(o,t),d(o.path,o.name,t,n),v(o,t),y(o,t);let s=o.name,c=r?`${r}.${s}`:s;n&&c&&S(n,c,t),i&&C(i,c,t);let l=o.path,u=r;if(n&&w(n,u,l,t),a&&T(a,u,l,t),o.children!==void 0){if(!Array.isArray(o.children))throw TypeError(`[router.${t}] Route "${s}" children must be an array, got ${h(o.children)}`);for(let e of o.children)E(e,t,n,c,i,a)}}export{i as getInternals,E as validateRoute};
2
2
  //# sourceMappingURL=validation.mjs.map