@poveste/vendors 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/dist/client/b-floating-vue.js +1 -1
  2. package/dist/client/b-iconify.js +1429 -1416
  3. package/dist/client/b-pinia.js +1359 -1936
  4. package/dist/client/b-vue-router.js +787 -502
  5. package/dist/client/b-vue-use.js +497 -367
  6. package/dist/client/b-vue.js +1 -1
  7. package/dist/client/devtools-api.js +6568 -0
  8. package/dist/client/index.js +178 -162
  9. package/dist/client/node_modules/@iconify/vue/dist/iconify.d.ts +17 -72
  10. package/dist/client/node_modules/@iconify/vue/dist/offline.d.ts +7 -12
  11. package/dist/client/node_modules/@iconify/vue/offline/package.json +2 -2
  12. package/dist/client/node_modules/@iconify/vue/package.json +13 -16
  13. package/dist/client/node_modules/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts +88 -0
  14. package/dist/client/node_modules/@jridgewell/gen-mapping/dist/types/set-array.d.ts +32 -0
  15. package/dist/client/node_modules/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts +12 -0
  16. package/dist/client/node_modules/@jridgewell/gen-mapping/dist/types/types.d.ts +43 -0
  17. package/dist/client/node_modules/@jridgewell/gen-mapping/package.json +67 -0
  18. package/dist/client/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.mts +89 -0
  19. package/dist/client/node_modules/@jridgewell/gen-mapping/types/set-array.d.mts +33 -0
  20. package/dist/client/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.mts +13 -0
  21. package/dist/client/node_modules/@jridgewell/gen-mapping/types/types.d.mts +44 -0
  22. package/dist/client/node_modules/@jridgewell/remapping/package.json +71 -0
  23. package/dist/client/node_modules/@jridgewell/remapping/types/build-source-map-tree.d.mts +15 -0
  24. package/dist/client/node_modules/@jridgewell/remapping/types/remapping.d.mts +21 -0
  25. package/dist/client/node_modules/@jridgewell/remapping/types/source-map-tree.d.mts +46 -0
  26. package/dist/client/node_modules/@jridgewell/remapping/types/source-map.d.mts +19 -0
  27. package/dist/client/node_modules/@jridgewell/remapping/types/types.d.mts +16 -0
  28. package/dist/client/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts +4 -0
  29. package/dist/client/node_modules/@jridgewell/resolve-uri/package.json +69 -0
  30. package/dist/client/node_modules/@jridgewell/trace-mapping/package.json +67 -0
  31. package/dist/client/node_modules/@jridgewell/trace-mapping/types/binary-search.d.mts +33 -0
  32. package/dist/client/node_modules/@jridgewell/trace-mapping/types/by-source.d.mts +4 -0
  33. package/dist/client/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.mts +9 -0
  34. package/dist/client/node_modules/@jridgewell/trace-mapping/types/resolve.d.mts +4 -0
  35. package/dist/client/node_modules/@jridgewell/trace-mapping/types/sort.d.mts +4 -0
  36. package/dist/client/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.mts +17 -0
  37. package/dist/client/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.mts +5 -0
  38. package/dist/client/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.mts +80 -0
  39. package/dist/client/node_modules/@jridgewell/trace-mapping/types/types.d.mts +107 -0
  40. package/dist/client/node_modules/@vue/devtools-api/dist/index-node.d.ts +11 -0
  41. package/dist/client/node_modules/@vue/devtools-api/dist/index.d.ts +2 -0
  42. package/dist/client/node_modules/@vue/devtools-api/package.json +25 -24
  43. package/dist/client/node_modules/@vue/devtools-kit/dist/index.d.ts +1170 -0
  44. package/dist/client/node_modules/@vue/devtools-kit/global.d.ts +20 -0
  45. package/dist/client/node_modules/@vue/devtools-kit/package.json +44 -0
  46. package/dist/client/node_modules/@vue/devtools-kit/types.d.ts +2 -0
  47. package/dist/client/node_modules/@vue/devtools-shared/dist/index.d.ts +40 -0
  48. package/dist/client/node_modules/@vue/devtools-shared/package.json +33 -0
  49. package/dist/client/node_modules/@vue-macros/common/dist/index.d.ts +124 -0
  50. package/dist/client/node_modules/@vue-macros/common/package.json +63 -0
  51. package/dist/client/node_modules/@vueuse/core/dist/index.d.ts +223 -111
  52. package/dist/client/node_modules/@vueuse/core/package.json +10 -3
  53. package/dist/client/node_modules/@vueuse/metadata/package.json +4 -1
  54. package/dist/client/node_modules/@vueuse/shared/dist/index.d.ts +2 -2
  55. package/dist/client/node_modules/@vueuse/shared/package.json +4 -1
  56. package/dist/client/node_modules/acorn/dist/acorn.d.mts +897 -0
  57. package/dist/client/node_modules/acorn/dist/acorn.d.ts +897 -0
  58. package/dist/client/node_modules/acorn/package.json +50 -0
  59. package/dist/client/node_modules/ast-kit/dist/index.d.ts +380 -0
  60. package/dist/client/node_modules/ast-kit/package.json +63 -0
  61. package/dist/client/node_modules/ast-walker-scope/dist/index.d.mts +51 -0
  62. package/dist/client/node_modules/ast-walker-scope/package.json +60 -0
  63. package/dist/client/node_modules/birpc/dist/index.d.mts +215 -0
  64. package/dist/client/node_modules/birpc/dist/index.d.ts +215 -0
  65. package/dist/client/node_modules/birpc/package.json +57 -0
  66. package/dist/client/node_modules/chokidar/handler.d.ts +90 -0
  67. package/dist/client/node_modules/chokidar/index.d.ts +217 -0
  68. package/dist/client/node_modules/chokidar/package.json +63 -0
  69. package/dist/client/node_modules/confbox/dist/_chunks/_format.d.mts +25 -0
  70. package/dist/client/node_modules/confbox/dist/index.d.mts +34 -0
  71. package/dist/client/node_modules/confbox/dist/ini.d.mts +62 -0
  72. package/dist/client/node_modules/confbox/dist/json5.d.mts +59 -0
  73. package/dist/client/node_modules/confbox/dist/jsonc.d.mts +41 -0
  74. package/dist/client/node_modules/confbox/dist/toml.d.mts +23 -0
  75. package/dist/client/node_modules/confbox/dist/yaml.d.mts +96 -0
  76. package/dist/client/node_modules/confbox/package.json +67 -0
  77. package/dist/client/node_modules/exsolve/dist/index.d.mts +66 -0
  78. package/dist/client/node_modules/exsolve/package.json +42 -0
  79. package/dist/client/node_modules/fdir/dist/index.d.mts +155 -0
  80. package/dist/client/node_modules/fdir/package.json +103 -0
  81. package/dist/client/node_modules/hookable/dist/index.d.ts +103 -0
  82. package/dist/client/node_modules/hookable/package.json +49 -0
  83. package/dist/client/node_modules/local-pkg/dist/index.d.mts +42 -0
  84. package/dist/client/node_modules/local-pkg/dist/index.d.ts +42 -0
  85. package/dist/client/node_modules/local-pkg/package.json +65 -0
  86. package/dist/client/node_modules/magic-string-ast/dist/index.d.ts +67 -0
  87. package/dist/client/node_modules/magic-string-ast/package.json +64 -0
  88. package/dist/client/node_modules/mlly/dist/index.d.mts +564 -0
  89. package/dist/client/node_modules/mlly/dist/index.d.ts +564 -0
  90. package/dist/client/node_modules/mlly/node_modules/confbox/dist/index.d.mts +32 -0
  91. package/dist/client/node_modules/mlly/node_modules/confbox/dist/index.d.ts +32 -0
  92. package/dist/client/node_modules/mlly/node_modules/confbox/dist/json5.d.mts +58 -0
  93. package/dist/client/node_modules/mlly/node_modules/confbox/dist/json5.d.ts +58 -0
  94. package/dist/client/node_modules/mlly/node_modules/confbox/dist/jsonc.d.mts +41 -0
  95. package/dist/client/node_modules/mlly/node_modules/confbox/dist/jsonc.d.ts +41 -0
  96. package/dist/client/node_modules/mlly/node_modules/confbox/dist/shared/confbox.9745c98f.d.mts +24 -0
  97. package/dist/client/node_modules/mlly/node_modules/confbox/dist/shared/confbox.9745c98f.d.ts +24 -0
  98. package/dist/client/node_modules/mlly/node_modules/confbox/dist/toml.d.mts +22 -0
  99. package/dist/client/node_modules/mlly/node_modules/confbox/dist/toml.d.ts +22 -0
  100. package/dist/client/node_modules/mlly/node_modules/confbox/dist/yaml.d.mts +95 -0
  101. package/dist/client/node_modules/mlly/node_modules/confbox/dist/yaml.d.ts +95 -0
  102. package/dist/client/node_modules/mlly/node_modules/confbox/json5.d.ts +2 -0
  103. package/dist/client/node_modules/mlly/node_modules/confbox/jsonc.d.ts +2 -0
  104. package/dist/client/node_modules/mlly/node_modules/confbox/package.json +86 -0
  105. package/dist/client/node_modules/mlly/node_modules/confbox/toml.d.ts +2 -0
  106. package/dist/client/node_modules/mlly/node_modules/confbox/yaml.d.ts +2 -0
  107. package/dist/client/node_modules/mlly/node_modules/pkg-types/dist/index.d.mts +411 -0
  108. package/dist/client/node_modules/mlly/node_modules/pkg-types/dist/index.d.ts +411 -0
  109. package/dist/client/node_modules/mlly/node_modules/pkg-types/package.json +47 -0
  110. package/dist/client/node_modules/mlly/package.json +55 -0
  111. package/dist/client/node_modules/muggle-string/out/base.d.ts +6 -0
  112. package/dist/client/node_modules/muggle-string/out/basic.d.ts +6 -0
  113. package/dist/client/node_modules/muggle-string/out/binarySearch.d.ts +1 -0
  114. package/dist/client/node_modules/muggle-string/out/common.d.ts +9 -0
  115. package/dist/client/node_modules/muggle-string/out/getLength.d.ts +2 -0
  116. package/dist/client/node_modules/muggle-string/out/index.d.ts +10 -0
  117. package/dist/client/node_modules/muggle-string/out/map.d.ts +3 -0
  118. package/dist/client/node_modules/muggle-string/out/overwriteSource.d.ts +3 -0
  119. package/dist/client/node_modules/muggle-string/out/replace.d.ts +3 -0
  120. package/dist/client/node_modules/muggle-string/out/segment.d.ts +6 -0
  121. package/dist/client/node_modules/muggle-string/out/sourceBased.d.ts +3 -0
  122. package/dist/client/node_modules/muggle-string/out/toString.d.ts +2 -0
  123. package/dist/client/node_modules/muggle-string/out/track.d.ts +6 -0
  124. package/dist/client/node_modules/muggle-string/out/types.d.ts +16 -0
  125. package/dist/client/node_modules/muggle-string/package.json +22 -0
  126. package/dist/client/node_modules/nostics/dist/diagnostic-wduO7saY.d.mts +295 -0
  127. package/dist/client/node_modules/nostics/dist/formatters/ansi.d.mts +15 -0
  128. package/dist/client/node_modules/nostics/dist/formatters/json.d.mts +7 -0
  129. package/dist/client/node_modules/nostics/dist/index.d.mts +51 -0
  130. package/dist/client/node_modules/nostics/dist/reporters/dev.d.mts +13 -0
  131. package/dist/client/node_modules/nostics/dist/reporters/fetch.d.mts +11 -0
  132. package/dist/client/node_modules/nostics/dist/reporters/node.d.mts +43 -0
  133. package/dist/client/node_modules/nostics/package.json +125 -0
  134. package/dist/client/node_modules/pathe/dist/index.d.mts +47 -0
  135. package/dist/client/node_modules/pathe/dist/index.d.ts +47 -0
  136. package/dist/client/node_modules/pathe/dist/utils.d.mts +32 -0
  137. package/dist/client/node_modules/pathe/dist/utils.d.ts +32 -0
  138. package/dist/client/node_modules/pathe/package.json +61 -0
  139. package/dist/client/node_modules/pathe/utils.d.ts +1 -0
  140. package/dist/client/node_modules/perfect-debounce/dist/index.d.mts +49 -0
  141. package/dist/client/node_modules/perfect-debounce/package.json +41 -0
  142. package/dist/client/node_modules/picomatch/package.json +83 -0
  143. package/dist/client/node_modules/pinia/dist/pinia.d.ts +937 -1056
  144. package/dist/client/node_modules/pinia/package.json +53 -67
  145. package/dist/client/node_modules/pkg-types/dist/index.d.mts +695 -0
  146. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/_chunks/_format.d.mts +22 -0
  147. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/_chunks/libs/js-yaml.d.mts +33 -0
  148. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/index.d.mts +7 -0
  149. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/ini.d.mts +59 -0
  150. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/json.d.mts +25 -0
  151. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/json5.d.mts +55 -0
  152. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/jsonc.d.mts +29 -0
  153. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/toml.d.mts +20 -0
  154. package/dist/client/node_modules/pkg-types/node_modules/confbox/dist/yaml.d.mts +101 -0
  155. package/dist/client/node_modules/pkg-types/node_modules/confbox/package.json +68 -0
  156. package/dist/client/node_modules/pkg-types/package.json +47 -0
  157. package/dist/client/node_modules/quansync/dist/index.d.mts +22 -0
  158. package/dist/client/node_modules/quansync/dist/index.d.ts +22 -0
  159. package/dist/client/node_modules/quansync/dist/macro.d.mts +18 -0
  160. package/dist/client/node_modules/quansync/dist/macro.d.ts +18 -0
  161. package/dist/client/node_modules/quansync/dist/types.d.mts +27 -0
  162. package/dist/client/node_modules/quansync/dist/types.d.ts +27 -0
  163. package/dist/client/node_modules/quansync/package.json +95 -0
  164. package/dist/client/node_modules/readdirp/index.d.ts +117 -0
  165. package/dist/client/node_modules/readdirp/package.json +62 -0
  166. package/dist/client/node_modules/scule/dist/index.d.mts +57 -0
  167. package/dist/client/node_modules/scule/dist/index.d.ts +57 -0
  168. package/dist/client/node_modules/scule/package.json +43 -0
  169. package/dist/client/node_modules/tinyglobby/dist/index.d.mts +148 -0
  170. package/dist/client/node_modules/tinyglobby/package.json +70 -0
  171. package/dist/client/node_modules/ufo/dist/index.d.mts +714 -0
  172. package/dist/client/node_modules/ufo/dist/index.d.ts +714 -0
  173. package/dist/client/node_modules/ufo/package.json +48 -0
  174. package/dist/client/node_modules/unplugin/dist/index.d.mts +241 -0
  175. package/dist/client/node_modules/unplugin/dist/rspack/loaders/load.d.mts +4 -0
  176. package/dist/client/node_modules/unplugin/dist/rspack/loaders/transform.d.mts +4 -0
  177. package/dist/client/node_modules/unplugin/dist/webpack/loaders/load.d.mts +4 -0
  178. package/dist/client/node_modules/unplugin/dist/webpack/loaders/transform.d.mts +4 -0
  179. package/dist/client/node_modules/unplugin/package.json +146 -0
  180. package/dist/client/node_modules/unplugin-utils/dist/index.d.ts +31 -0
  181. package/dist/client/node_modules/unplugin-utils/package.json +61 -0
  182. package/dist/client/node_modules/vue-router/dist/experimental/index.d.ts +7 -0
  183. package/dist/client/node_modules/vue-router/dist/experimental/pinia-colada.d.ts +151 -0
  184. package/dist/client/node_modules/vue-router/dist/{router-CWoNjPRp.d.mts → index-D7ja2BKs.d.ts} +2480 -1160
  185. package/dist/client/node_modules/vue-router/dist/options-CwYZKRl4.d.mts +2923 -0
  186. package/dist/client/node_modules/vue-router/dist/unplugin/esbuild.d.mts +10 -0
  187. package/dist/client/node_modules/vue-router/dist/unplugin/index.d.mts +62 -0
  188. package/dist/client/node_modules/vue-router/dist/unplugin/options.d.mts +7 -0
  189. package/dist/client/node_modules/vue-router/dist/unplugin/rolldown.d.mts +10 -0
  190. package/dist/client/node_modules/vue-router/dist/unplugin/rollup.d.mts +10 -0
  191. package/dist/client/node_modules/vue-router/dist/unplugin/types.d.mts +7 -0
  192. package/dist/client/node_modules/vue-router/dist/unplugin/vite.d.mts +10 -0
  193. package/dist/client/node_modules/vue-router/dist/unplugin/webpack.d.mts +10 -0
  194. package/dist/client/node_modules/vue-router/dist/vue-router.d.ts +7 -0
  195. package/dist/client/node_modules/vue-router/package.json +153 -95
  196. package/dist/client/node_modules/vue-router/vue-router-auto-resolver.d.mts +22 -17
  197. package/dist/client/node_modules/vue-router/vue-router-auto-routes.d.mts +53 -0
  198. package/dist/client/node_modules/vue-router/vue-router-auto.d.ts +2 -1
  199. package/dist/client/node_modules/webpack-virtual-modules/lib/index.d.ts +15 -0
  200. package/dist/client/node_modules/webpack-virtual-modules/lib/virtual-stats.d.ts +11 -0
  201. package/dist/client/node_modules/webpack-virtual-modules/package.json +82 -0
  202. package/dist/client/vue.runtime.esm-bundler.js +1 -176
  203. package/package.json +8 -7
  204. package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/api.d.ts +0 -108
  205. package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/app.d.ts +0 -1
  206. package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/component.d.ts +0 -78
  207. package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/context.d.ts +0 -5
  208. package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/hooks.d.ts +0 -180
  209. package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/index.d.ts +0 -6
  210. package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/util.d.ts +0 -4
  211. package/dist/client/node_modules/@vue/devtools-api/lib/esm/const.d.ts +0 -2
  212. package/dist/client/node_modules/@vue/devtools-api/lib/esm/env.d.ts +0 -15
  213. package/dist/client/node_modules/@vue/devtools-api/lib/esm/index.d.ts +0 -18
  214. package/dist/client/node_modules/@vue/devtools-api/lib/esm/plugin.d.ts +0 -47
  215. package/dist/client/node_modules/@vue/devtools-api/lib/esm/proxy.d.ts +0 -20
  216. package/dist/client/node_modules/@vue/devtools-api/lib/esm/time.d.ts +0 -2
  217. package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/index.d.ts +0 -22
  218. package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/v2/index.d.ts +0 -33
  219. package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/v2.7/index.d.ts +0 -38
  220. package/dist/client/node_modules/pinia/node_modules/vue-demi/lib/v3/index.d.ts +0 -22
  221. package/dist/client/node_modules/pinia/node_modules/vue-demi/package.json +0 -47
  222. package/dist/client/node_modules/vue-router/dist/experimental/index.d.mts +0 -38
  223. package/dist/client/node_modules/vue-router/dist/vue-router.d.mts +0 -361
  224. package/dist/client/node_modules/vue-router/vue-router-auto-routes.d.ts +0 -4
@@ -0,0 +1,2923 @@
1
+ /*!
2
+ * vue-router v5.3.1
3
+ * (c) 2026 Eduardo San Martin Morote
4
+ * @license MIT
5
+ */
6
+ import { AllowedComponentProps, AnchorHTMLAttributes, App, Component as Component$1, ComponentCustomProps, ComponentPublicInstance, ComputedRef, DefineComponent, EffectScope, MaybeRef, ShallowRef, UnwrapRef, VNode, VNodeProps } from "vue";
7
+ //#region src/config.d.ts
8
+ /**
9
+ * Allows customizing existing types of the router that are used globally like `$router`, `<RouterLink>`, etc. **ONLY FOR INTERNAL USAGE**.
10
+ *
11
+ * - `Router` - swaps the public {@link Router} type (e.g. to `EXPERIMENTAL_Router`)
12
+ * - `$router` - the router instance
13
+ * - `$route` - the current route location
14
+ * - `beforeRouteEnter` - Page component option
15
+ * - `beforeRouteUpdate` - Page component option
16
+ * - `beforeRouteLeave` - Page component option
17
+ * - `RouterLink` - RouterLink Component
18
+ * - `RouterView` - RouterView Component
19
+ *
20
+ * @internal
21
+ */
22
+ interface TypesConfig {}
23
+ //#endregion
24
+ //#region src/query.d.ts
25
+ /**
26
+ * Possible values in normalized {@link LocationQuery}. `null` renders the query
27
+ * param but without an `=`.
28
+ *
29
+ * @example
30
+ * ```
31
+ * ?isNull&isEmpty=&other=other
32
+ * gives
33
+ * `{ isNull: null, isEmpty: '', other: 'other' }`.
34
+ * ```
35
+ *
36
+ * @internal
37
+ */
38
+ type LocationQueryValue$1 = string | null;
39
+ /**
40
+ * Possible values when defining a query. `undefined` allows to remove a value.
41
+ *
42
+ * @internal
43
+ */
44
+ type LocationQueryValueRaw = LocationQueryValue$1 | number | undefined;
45
+ /**
46
+ * Normalized query object that appears in {@link RouteLocationNormalized}
47
+ *
48
+ * @public
49
+ */
50
+ type LocationQuery$1 = Record<string, LocationQueryValue$1 | LocationQueryValue$1[]>;
51
+ /**
52
+ * Loose {@link LocationQuery} object that can be passed to functions like
53
+ * {@link Router.push} and {@link Router.replace} or anywhere when creating a
54
+ * {@link RouteLocationRaw}
55
+ *
56
+ * @public
57
+ */
58
+ type LocationQueryRaw = Record<string | number, LocationQueryValueRaw | LocationQueryValueRaw[]>;
59
+ /**
60
+ * Stringifies a {@link LocationQueryRaw} object. Like `URLSearchParams`, it
61
+ * doesn't prepend a `?`
62
+ *
63
+ * @internal
64
+ *
65
+ * @param query - query object to stringify
66
+ * @returns string version of the query without the leading `?`
67
+ */
68
+ declare function stringifyQuery(query: LocationQueryRaw | undefined): string;
69
+ //#endregion
70
+ //#region src/typed-routes/route-map.d.ts
71
+ /**
72
+ * Helper type to define a Typed `RouteRecord`
73
+ * @see {@link RouteRecord}
74
+ */
75
+ interface RouteRecordInfo<Name extends string | symbol = string, Path extends string = string, ParamsRaw extends RouteParamsRawGeneric = RouteParamsRawGeneric, Params extends RouteParamsGeneric = RouteParamsGeneric, ChildrenNames extends string | symbol = never> {
76
+ name: Name;
77
+ path: Path;
78
+ paramsRaw: ParamsRaw;
79
+ params: Params;
80
+ childrenNames: ChildrenNames;
81
+ }
82
+ type RouteRecordInfoGeneric = RouteRecordInfo<string | symbol, string, RouteParamsRawGeneric, RouteParamsGeneric, string | symbol>;
83
+ /**
84
+ * Convenience type to get the typed RouteMap or a generic one if not provided.
85
+ * It is extracted from the {@link TypesConfig} if it exists, it becomes
86
+ * {@link RouteMapGeneric} otherwise.
87
+ */
88
+ type RouteMap = TypesConfig extends Record<'RouteNamedMap', infer RouteNamedMap> ? RouteNamedMap : RouteMapGeneric;
89
+ /**
90
+ * Generic version of the `RouteMap`.
91
+ */
92
+ type RouteMapGeneric = Record<string | symbol, RouteRecordInfoGeneric>;
93
+ //#endregion
94
+ //#region src/types/utils.d.ts
95
+ /**
96
+ * Creates a union type that still allows autocompletion for strings.
97
+ * @internal
98
+ */
99
+ type _LiteralUnion<LiteralType, BaseType extends string = string> = LiteralType | (BaseType & Record<never, never>);
100
+ /**
101
+ * Maybe a promise maybe not
102
+ * @internal
103
+ */
104
+ type _Awaitable$1<T> = T | PromiseLike<T>;
105
+ //#endregion
106
+ //#region src/typed-routes/route-records.d.ts
107
+ /**
108
+ * @internal
109
+ */
110
+ type RouteRecordRedirectOption = RouteLocationRaw | ((to: RouteLocation, from: RouteLocationNormalizedLoaded) => RouteLocationRaw);
111
+ /**
112
+ * Generic version of {@link RouteRecordName}.
113
+ */
114
+ type RouteRecordNameGeneric = string | symbol | undefined;
115
+ /**
116
+ * @internal
117
+ */
118
+ type _RouteRecordProps<Name extends keyof RouteMap = keyof RouteMap> = boolean | Record<string, any> | ((to: RouteLocationNormalized<Name>) => Record<string, any>);
119
+ //#endregion
120
+ //#region src/typed-routes/route-location.d.ts
121
+ /**
122
+ * Generic version of {@link RouteLocation}. It is used when no {@link RouteMap} is provided.
123
+ */
124
+ interface RouteLocationGeneric extends _RouteLocationBase, RouteLocationOptions {
125
+ /**
126
+ * Array of {@link RouteRecord} containing components as they were
127
+ * passed when adding records. It can also contain redirect records. This
128
+ * can't be used directly. **This property is non-enumerable**.
129
+ */
130
+ matched: RouteRecord[];
131
+ }
132
+ /**
133
+ * Helper to generate a type safe version of the {@link RouteLocation} type.
134
+ */
135
+ interface RouteLocationTyped<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric; }, Name extends keyof RouteMap> extends RouteLocationGeneric {
136
+ name: Extract<Name, string | symbol>;
137
+ params: RouteMap[Name]['params'];
138
+ }
139
+ /**
140
+ * List of all possible {@link RouteLocation} indexed by the route name.
141
+ * @internal
142
+ */
143
+ type RouteLocationTypedList<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric; } = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationTyped<RouteMap, N>; };
144
+ /**
145
+ * Generic version of {@link RouteLocationNormalized} that is used when no {@link RouteMap} is provided.
146
+ */
147
+ interface RouteLocationNormalizedGeneric extends _RouteLocationBase {
148
+ name: RouteRecordNameGeneric;
149
+ /**
150
+ * Array of {@link RouteRecordNormalized}
151
+ */
152
+ matched: RouteRecordNormalized[];
153
+ }
154
+ /**
155
+ * Helper to generate a type safe version of the {@link RouteLocationNormalized} type.
156
+ */
157
+ interface RouteLocationNormalizedTyped<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric; } = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationNormalizedGeneric {
158
+ name: Extract<Name, string | symbol>;
159
+ params: RouteMap[Name]['params'];
160
+ /**
161
+ * Array of {@link RouteRecordNormalized}
162
+ */
163
+ matched: RouteRecordNormalized[];
164
+ }
165
+ /**
166
+ * List of all possible {@link RouteLocationNormalized} indexed by the route name.
167
+ * @internal
168
+ */
169
+ type RouteLocationNormalizedTypedList<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric; } = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationNormalizedTyped<RouteMap, N>; };
170
+ /**
171
+ * Generic version of {@link RouteLocationNormalizedLoaded} that is used when no {@link RouteMap} is provided.
172
+ */
173
+ interface RouteLocationNormalizedLoadedGeneric extends RouteLocationNormalizedGeneric {
174
+ /**
175
+ * Array of {@link RouteLocationMatched} containing only plain components (any
176
+ * lazy-loaded components have been loaded and were replaced inside the
177
+ * `components` object) so it can be directly used to display routes. It
178
+ * cannot contain redirect records either. **This property is non-enumerable**.
179
+ */
180
+ matched: RouteLocationMatched[];
181
+ }
182
+ /**
183
+ * Helper to generate a type safe version of the {@link RouteLocationNormalizedLoaded} type.
184
+ */
185
+ interface RouteLocationNormalizedLoadedTyped<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric; } = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationNormalizedLoadedGeneric {
186
+ name: Extract<Name, string | symbol>;
187
+ params: RouteMap[Name]['params'];
188
+ }
189
+ /**
190
+ * List of all possible {@link RouteLocationNormalizedLoaded} indexed by the route name.
191
+ * @internal
192
+ */
193
+ type RouteLocationNormalizedLoadedTypedList<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric; } = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationNormalizedLoadedTyped<RouteMap, N>; };
194
+ /**
195
+ * Generic version of {@link RouteLocationAsRelative}. It is used when no {@link RouteMap} is provided.
196
+ */
197
+ interface RouteLocationAsRelativeGeneric extends RouteQueryAndHash, RouteLocationOptions {
198
+ name?: RouteRecordNameGeneric;
199
+ params?: RouteParamsRawGeneric;
200
+ /**
201
+ * A relative path to the current location. This property should be removed
202
+ */
203
+ path?: undefined;
204
+ }
205
+ /**
206
+ * Helper to generate a type safe version of the {@link RouteLocationAsRelative} type.
207
+ */
208
+ interface RouteLocationAsRelativeTyped<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric; } = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationAsRelativeGeneric {
209
+ name?: Extract<Name, string | symbol>;
210
+ params?: RouteMap[Name]['paramsRaw'];
211
+ }
212
+ /**
213
+ * List of all possible {@link RouteLocationAsRelative} indexed by the route name.
214
+ * @internal
215
+ */
216
+ type RouteLocationAsRelativeTypedList<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric; } = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationAsRelativeTyped<RouteMap, N>; };
217
+ /**
218
+ * Generic version of {@link RouteLocationAsPath}. It is used when no {@link RouteMap} is provided.
219
+ */
220
+ interface RouteLocationAsPathGeneric extends RouteQueryAndHash, RouteLocationOptions {
221
+ /**
222
+ * Percentage encoded pathname section of the URL.
223
+ */
224
+ path: string;
225
+ }
226
+ /**
227
+ * Helper to generate a type safe version of the {@link RouteLocationAsPath} type.
228
+ */
229
+ interface RouteLocationAsPathTyped<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric; } = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> extends RouteLocationAsPathGeneric {
230
+ path: _LiteralUnion<RouteMap[Name]['path']>;
231
+ }
232
+ /**
233
+ * List of all possible {@link RouteLocationAsPath} indexed by the route name.
234
+ * @internal
235
+ */
236
+ type RouteLocationAsPathTypedList<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric; } = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationAsPathTyped<RouteMap, N>; };
237
+ /**
238
+ * Helper to generate a type safe version of the {@link RouteLocationAsString} type.
239
+ */
240
+ type RouteLocationAsStringTyped<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric; } = RouteMapGeneric, Name extends keyof RouteMap = keyof RouteMap> = RouteMap[Name]['path'];
241
+ /**
242
+ * List of all possible {@link RouteLocationAsString} indexed by the route name.
243
+ * @internal
244
+ */
245
+ type RouteLocationAsStringTypedList<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric; } = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationAsStringTyped<RouteMap, N>; };
246
+ /**
247
+ * Generic version of {@link RouteLocationResolved}. It is used when no {@link RouteMap} is provided.
248
+ */
249
+ interface RouteLocationResolvedGeneric extends RouteLocationGeneric {
250
+ /**
251
+ * Resolved `href` for the route location that will be set on the `<a href="...">`.
252
+ */
253
+ href: string;
254
+ }
255
+ /**
256
+ * Helper to generate a type safe version of the {@link RouteLocationResolved} type.
257
+ */
258
+ interface RouteLocationResolvedTyped<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric; }, Name extends keyof RouteMap> extends RouteLocationTyped<RouteMap, Name> {
259
+ /**
260
+ * Resolved `href` for the route location that will be set on the `<a href="...">`.
261
+ */
262
+ href: string;
263
+ }
264
+ /**
265
+ * List of all possible {@link RouteLocationResolved} indexed by the route name.
266
+ * @internal
267
+ */
268
+ type RouteLocationResolvedTypedList<RouteMap extends { [K in keyof RouteMap]: RouteRecordInfoGeneric; } = RouteMapGeneric> = { [N in keyof RouteMap]: RouteLocationResolvedTyped<RouteMap, N>; };
269
+ /**
270
+ * Type safe versions of types that are exposed by vue-router. We have to use a generic check to allow for names to be `undefined` when no `RouteMap` is provided.
271
+ */
272
+ /**
273
+ * {@link RouteLocationRaw} resolved using the matcher
274
+ */
275
+ type RouteLocation<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationGeneric : RouteLocationTypedList<RouteMap>[Name];
276
+ /**
277
+ * Similar to {@link RouteLocation} but its
278
+ * {@link RouteLocationNormalizedTyped.matched | `matched` property} cannot contain redirect records
279
+ */
280
+ type RouteLocationNormalized<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedGeneric : RouteLocationNormalizedTypedList<RouteMap>[Name];
281
+ /**
282
+ * Similar to {@link RouteLocationNormalized} but its `components` do not contain any function to lazy load components.
283
+ * In other words, it's ready to be rendered by `<RouterView>`.
284
+ */
285
+ type RouteLocationNormalizedLoaded<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedLoadedGeneric : RouteLocationNormalizedLoadedTypedList<RouteMap>[Name];
286
+ /**
287
+ * Route location relative to the current location. It accepts other properties than `path` like `params`, `query` and
288
+ * `hash` to conveniently change them.
289
+ */
290
+ type RouteLocationAsRelative<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsRelativeGeneric : RouteLocationAsRelativeTypedList<RouteMap>[Name];
291
+ /**
292
+ * Route location resolved with {@link Router | `router.resolve()`}.
293
+ */
294
+ type RouteLocationResolved<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationResolvedGeneric : RouteLocationResolvedTypedList<RouteMap>[Name];
295
+ /**
296
+ * Same as {@link RouteLocationAsPath} but as a string literal.
297
+ */
298
+ type RouteLocationAsString<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? string : _LiteralUnion<RouteLocationAsStringTypedList<RouteMap>[Name], string>;
299
+ /**
300
+ * Route location as an object with a `path` property.
301
+ */
302
+ type RouteLocationAsPath<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsPathGeneric : RouteLocationAsPathTypedList<RouteMap>[Name];
303
+ /**
304
+ * Route location that can be passed to `router.push()` and other user-facing APIs.
305
+ */
306
+ type RouteLocationRaw<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsString | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric : _LiteralUnion<RouteLocationAsStringTypedList<RouteMap>[Name], string> | RouteLocationAsRelativeTypedList<RouteMap>[Name] | RouteLocationAsPathTypedList<RouteMap>[Name];
307
+ //#endregion
308
+ //#region src/errors.d.ts
309
+ /**
310
+ * Flags so we can combine them when checking for multiple errors. This is the internal version of
311
+ * {@link NavigationFailureType}.
312
+ *
313
+ * @internal
314
+ */
315
+ declare const enum ErrorTypes {
316
+ MATCHER_NOT_FOUND = 1,
317
+ NAVIGATION_GUARD_REDIRECT = 2,
318
+ NAVIGATION_ABORTED = 4,
319
+ NAVIGATION_CANCELLED = 8,
320
+ NAVIGATION_DUPLICATED = 16
321
+ }
322
+ /**
323
+ * Extended Error that contains extra information regarding a failed navigation.
324
+ */
325
+ interface NavigationFailure extends Error {
326
+ /**
327
+ * Type of the navigation. One of {@link NavigationFailureType}
328
+ */
329
+ type: ErrorTypes.NAVIGATION_CANCELLED | ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_DUPLICATED;
330
+ /**
331
+ * Route location we were navigating from
332
+ */
333
+ from: RouteLocationNormalized;
334
+ /**
335
+ * Route location we were navigating to
336
+ */
337
+ to: RouteLocationNormalized;
338
+ }
339
+ /**
340
+ * Internal type to define an ErrorHandler
341
+ *
342
+ * @param error - error thrown
343
+ * @param to - location we were navigating to when the error happened
344
+ * @param from - location we were navigating from when the error happened
345
+ * @internal
346
+ */
347
+ interface _ErrorListener {
348
+ (error: any, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded): any;
349
+ }
350
+ //#endregion
351
+ //#region src/typed-routes/navigation-guards.d.ts
352
+ /**
353
+ * Return types for a Navigation Guard. Based on `TypesConfig`
354
+ *
355
+ * @see {@link TypesConfig}
356
+ */
357
+ type NavigationGuardReturn = void | Error | boolean | RouteLocationRaw;
358
+ /**
359
+ * Navigation Guard with a type parameter for `this`.
360
+ * @see {@link TypesConfig}
361
+ */
362
+ interface NavigationGuardWithThis<T> {
363
+ (this: T, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded,
364
+ /**
365
+ * @deprecated Return a value from the guard instead of calling `next(value)`.
366
+ * The callback will be removed in a future version of Vue Router.
367
+ */
368
+ next: NavigationGuardNext): _Awaitable$1<NavigationGuardReturn>;
369
+ }
370
+ /**
371
+ * In `router.beforeResolve((to) => {})`, the `to` is typed as `RouteLocationNormalizedLoaded`, not
372
+ * `RouteLocationNormalized` like in `router.beforeEach()`. In practice it doesn't change much as users do not rely on
373
+ * the difference between them but if we update the type in vue-router, we will have to update this type too.
374
+ * @internal
375
+ */
376
+ interface _NavigationGuardResolved {
377
+ (this: undefined, to: RouteLocationNormalizedLoaded, from: RouteLocationNormalizedLoaded,
378
+ /**
379
+ * @deprecated Return a value from the guard instead of calling `next(value)`.
380
+ * The callback will be removed in a future version of Vue Router.
381
+ */
382
+ next: NavigationGuardNext): _Awaitable$1<NavigationGuardReturn>;
383
+ }
384
+ /**
385
+ * Navigation Guard.
386
+ */
387
+ interface NavigationGuard {
388
+ (to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded,
389
+ /**
390
+ * @deprecated Return a value from the guard instead of calling `next(value)`.
391
+ * The callback will be removed in a future version of Vue Router.
392
+ */
393
+ next: NavigationGuardNext): _Awaitable$1<NavigationGuardReturn>;
394
+ }
395
+ /**
396
+ * Navigation hook triggered after a navigation is settled.
397
+ */
398
+ interface NavigationHookAfter {
399
+ (to: RouteLocationNormalizedLoaded, from: RouteLocationNormalizedLoaded, failure?: NavigationFailure | void): unknown;
400
+ }
401
+ /**
402
+ * Callback passed to navigation guards to continue or abort the navigation.
403
+ *
404
+ * @deprecated Prefer returning a value from the guard instead of calling
405
+ * `next(value)`. The callback will be removed in a future version of Vue Router.
406
+ */
407
+ interface NavigationGuardNext {
408
+ (): void;
409
+ (error: Error): void;
410
+ (location: RouteLocationRaw): void;
411
+ (valid: boolean | undefined): void;
412
+ (cb: NavigationGuardNextCallback): void;
413
+ }
414
+ /**
415
+ * Callback that can be passed to `next()` in `beforeRouteEnter()` guards.
416
+ */
417
+ type NavigationGuardNextCallback = (vm: ComponentPublicInstance) => unknown;
418
+ //#endregion
419
+ //#region src/matcher/types.d.ts
420
+ /**
421
+ * Normalized version of a {@link RouteRecord | route record}.
422
+ */
423
+ interface RouteRecordNormalized {
424
+ /**
425
+ * {@inheritDoc _RouteRecordBase.path}
426
+ */
427
+ path: _RouteRecordBase['path'];
428
+ /**
429
+ * {@inheritDoc _RouteRecordBase.redirect}
430
+ */
431
+ redirect: _RouteRecordBase['redirect'] | undefined;
432
+ /**
433
+ * {@inheritDoc _RouteRecordBase.name}
434
+ */
435
+ name: _RouteRecordBase['name'];
436
+ /**
437
+ * {@inheritDoc RouteRecordMultipleViews.components}
438
+ */
439
+ components: RouteRecordMultipleViews['components'] | null | undefined;
440
+ /**
441
+ * Contains the original modules for lazy loaded components.
442
+ * @internal
443
+ */
444
+ mods: Record<string, unknown>;
445
+ /**
446
+ * Nested route records.
447
+ */
448
+ children: RouteRecordRaw[];
449
+ /**
450
+ * {@inheritDoc _RouteRecordBase.meta}
451
+ */
452
+ meta: Exclude<_RouteRecordBase['meta'], void>;
453
+ /**
454
+ * {@inheritDoc RouteRecordMultipleViews.props}
455
+ */
456
+ props: Record<string, _RouteRecordProps>;
457
+ /**
458
+ * Registered beforeEnter guards
459
+ */
460
+ beforeEnter: _RouteRecordBase['beforeEnter'];
461
+ /**
462
+ * Registered leave guards
463
+ *
464
+ * @internal
465
+ */
466
+ leaveGuards: Set<NavigationGuard>;
467
+ /**
468
+ * Registered update guards
469
+ *
470
+ * @internal
471
+ */
472
+ updateGuards: Set<NavigationGuard>;
473
+ /**
474
+ * Registered beforeRouteEnter callbacks passed to `next` or returned in guards
475
+ *
476
+ * @internal
477
+ */
478
+ enterCallbacks: Record<string, NavigationGuardNextCallback[]>;
479
+ /**
480
+ * Mounted route component instances
481
+ * Having the instances on the record mean beforeRouteUpdate and
482
+ * beforeRouteLeave guards can only be invoked with the latest mounted app
483
+ * instance if there are multiple application instances rendering the same
484
+ * view, basically duplicating the content on the page, which shouldn't happen
485
+ * in practice. It will work if multiple apps are rendering different named
486
+ * views.
487
+ */
488
+ instances: Record<string, ComponentPublicInstance | undefined | null>;
489
+ /**
490
+ * Defines if this record is the alias of another one. This property is
491
+ * `undefined` if the record is the original one.
492
+ */
493
+ aliasOf: RouteRecordNormalized | undefined;
494
+ }
495
+ /**
496
+ * {@inheritDoc RouteRecordNormalized}
497
+ */
498
+ type RouteRecord = RouteRecordNormalized;
499
+ //#endregion
500
+ //#region src/matcher/pathParserRanker.d.ts
501
+ /**
502
+ * @internal
503
+ */
504
+ interface _PathParserOptions {
505
+ /**
506
+ * Makes the RegExp case-sensitive.
507
+ *
508
+ * @defaultValue `false`
509
+ */
510
+ sensitive?: boolean;
511
+ /**
512
+ * Whether to disallow a trailing slash or not.
513
+ *
514
+ * @defaultValue `false`
515
+ */
516
+ strict?: boolean;
517
+ /**
518
+ * Should the RegExp match from the beginning by prepending a `^` to it.
519
+ * @internal
520
+ *
521
+ * @defaultValue `true`
522
+ */
523
+ start?: boolean;
524
+ /**
525
+ * Should the RegExp match until the end by appending a `$` to it.
526
+ *
527
+ * @deprecated this option will alsways be `true` in the future. Open a discussion in vuejs/router if you need this to be `false`
528
+ *
529
+ * @defaultValue `true`
530
+ */
531
+ end?: boolean;
532
+ }
533
+ type PathParserOptions = Pick<_PathParserOptions, 'end' | 'sensitive' | 'strict'>;
534
+ //#endregion
535
+ //#region src/history/common.d.ts
536
+ type HistoryLocation = string;
537
+ /**
538
+ * Allowed variables in HTML5 history state. Note that pushState clones the state
539
+ * passed and does not accept everything: e.g.: it doesn't accept symbols, nor
540
+ * functions as values. It also ignores Symbols as keys.
541
+ *
542
+ * @internal
543
+ */
544
+ type HistoryStateValue = string | number | boolean | null | undefined | HistoryState | HistoryStateArray;
545
+ /**
546
+ * Allowed HTML history.state
547
+ */
548
+ interface HistoryState {
549
+ [x: number]: HistoryStateValue;
550
+ [x: string]: HistoryStateValue;
551
+ }
552
+ /**
553
+ * Allowed arrays for history.state.
554
+ *
555
+ * @internal
556
+ */
557
+ interface HistoryStateArray extends Array<HistoryStateValue> {}
558
+ declare enum NavigationType {
559
+ pop = "pop",
560
+ push = "push"
561
+ }
562
+ declare enum NavigationDirection {
563
+ back = "back",
564
+ forward = "forward",
565
+ unknown = ""
566
+ }
567
+ interface NavigationInformation {
568
+ type: NavigationType;
569
+ direction: NavigationDirection;
570
+ delta: number;
571
+ }
572
+ interface NavigationCallback {
573
+ (to: HistoryLocation, from: HistoryLocation, information: NavigationInformation): void;
574
+ }
575
+ /**
576
+ * Interface implemented by History implementations that can be passed to the
577
+ * router as {@link Router.history}
578
+ *
579
+ * @alpha
580
+ */
581
+ interface RouterHistory {
582
+ /**
583
+ * Base path that is prepended to every url. This allows hosting an SPA at a
584
+ * sub-folder of a domain like `example.com/sub-folder` by having a `base` of
585
+ * `/sub-folder`
586
+ */
587
+ readonly base: string;
588
+ /**
589
+ * Current History location
590
+ */
591
+ readonly location: HistoryLocation;
592
+ /**
593
+ * Current History state
594
+ */
595
+ readonly state: HistoryState;
596
+ /**
597
+ * Navigates to a location. In the case of an HTML5 History implementation,
598
+ * this will call `history.pushState` to effectively change the URL.
599
+ *
600
+ * @param to - location to push
601
+ * @param data - optional {@link HistoryState} to be associated with the
602
+ * navigation entry
603
+ */
604
+ push(to: HistoryLocation, data?: HistoryState): void;
605
+ /**
606
+ * Same as {@link RouterHistory.push} but performs a `history.replaceState`
607
+ * instead of `history.pushState`
608
+ *
609
+ * @param to - location to set
610
+ * @param data - optional {@link HistoryState} to be associated with the
611
+ * navigation entry
612
+ */
613
+ replace(to: HistoryLocation, data?: HistoryState): void;
614
+ /**
615
+ * Traverses history in a given direction.
616
+ *
617
+ * @example
618
+ * ```js
619
+ * myHistory.go(-1) // equivalent to window.history.back()
620
+ * myHistory.go(1) // equivalent to window.history.forward()
621
+ * ```
622
+ *
623
+ * @param delta - distance to travel. If delta is \< 0, it will go back,
624
+ * if it's \> 0, it will go forward by that amount of entries.
625
+ * @param triggerListeners - whether this should trigger listeners attached to
626
+ * the history
627
+ */
628
+ go(delta: number, triggerListeners?: boolean): void;
629
+ /**
630
+ * Attach a listener to the History implementation that is triggered when the
631
+ * navigation is triggered from outside (like the Browser back and forward
632
+ * buttons) or when passing `true` to {@link RouterHistory.back} and
633
+ * {@link RouterHistory.forward}
634
+ *
635
+ * @param callback - listener to attach
636
+ * @returns a callback to remove the listener
637
+ */
638
+ listen(callback: NavigationCallback): () => void;
639
+ /**
640
+ * Generates the corresponding href to be used in an anchor tag.
641
+ *
642
+ * @param location - history location that should create an href
643
+ */
644
+ createHref(location: HistoryLocation): string;
645
+ /**
646
+ * Clears any event listener attached by the history implementation.
647
+ */
648
+ destroy(): void;
649
+ }
650
+ //#endregion
651
+ //#region src/experimental/query.d.ts
652
+ /**
653
+ * NOTE: some types here are duplicated from ../query.ts
654
+ * because they will change to always have (string | null)[] values
655
+ */
656
+ /**
657
+ * Possible values in normalized {@link LocationQuery}. `null` renders the query
658
+ * param but without an `=`.
659
+ *
660
+ * @internal
661
+ */
662
+ type LocationQueryValue = string | null;
663
+ /**
664
+ * Normalized query object that appears in {@link RouteLocationNormalized}
665
+ *
666
+ * @public
667
+ */
668
+ type LocationQuery = Record<string, LocationQueryValue | LocationQueryValue[]>;
669
+ /**
670
+ * Transforms a queryString into a {@link LocationQuery} object. Accept both, a
671
+ * version with the leading `?` and without. Uses `Object.create(null)` so the
672
+ * returned object cannot be exploited via prototype pollution.
673
+ *
674
+ * @internal
675
+ *
676
+ * @param search - search string to parse
677
+ * @returns a query object
678
+ */
679
+ declare function experimental_parseQuery(search: string): LocationQuery;
680
+ //#endregion
681
+ //#region src/scrollBehavior.d.ts
682
+ /**
683
+ * Scroll position similar to
684
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/ScrollToOptions | `ScrollToOptions`}.
685
+ * Note that not all browsers support `behavior`.
686
+ */
687
+ type ScrollPositionCoordinates = {
688
+ behavior?: ScrollOptions['behavior'];
689
+ left?: number;
690
+ top?: number;
691
+ };
692
+ /**
693
+ * Internal normalized version of {@link ScrollPositionCoordinates} that always
694
+ * has `left` and `top` coordinates. Must be a type to be assignable to HistoryStateValue.
695
+ *
696
+ * @internal
697
+ */
698
+ type _ScrollPositionNormalized = {
699
+ behavior?: ScrollOptions['behavior'];
700
+ left: number;
701
+ top: number;
702
+ };
703
+ /**
704
+ * Type of the `scrollBehavior` option that can be passed to `createRouter`.
705
+ */
706
+ interface RouterScrollBehavior {
707
+ /**
708
+ * @param to - Route location where we are navigating to
709
+ * @param from - Route location where we are navigating from
710
+ * @param savedPosition - saved position if it exists, `null` otherwise
711
+ */
712
+ (to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, savedPosition: _ScrollPositionNormalized | null): Awaitable<ScrollPosition | false | void>;
713
+ }
714
+ interface ScrollPositionElement extends ScrollToOptions {
715
+ /**
716
+ * A valid CSS selector. Note some characters must be escaped in id selectors (https://mathiasbynens.be/notes/css-escapes).
717
+ * @example
718
+ * Here are a few examples:
719
+ *
720
+ * - `.title`
721
+ * - `.content:first-child`
722
+ * - `#marker`
723
+ * - `#marker\~with\~symbols`
724
+ * - `#marker.with.dot`: selects `class="with dot" id="marker"`, not `id="marker.with.dot"`
725
+ *
726
+ */
727
+ el: string | Element;
728
+ }
729
+ type ScrollPosition = ScrollPositionCoordinates | ScrollPositionElement;
730
+ type Awaitable<T> = T | PromiseLike<T>;
731
+ //#endregion
732
+ //#region src/router.d.ts
733
+ /**
734
+ * Options to initialize a {@link Router} instance.
735
+ */
736
+ interface RouterOptions extends EXPERIMENTAL_RouterOptions_Base {
737
+ /**
738
+ * Initial list of routes that should be added to the router.
739
+ */
740
+ routes: Readonly<RouteRecordRaw[]>;
741
+ }
742
+ /**
743
+ * Router instance.
744
+ */
745
+ interface RouterClassic extends EXPERIMENTAL_Router_Base<RouteRecordNormalized> {
746
+ /**
747
+ * Original options object passed to create the Router
748
+ */
749
+ readonly options: RouterOptions;
750
+ /**
751
+ * Add a new {@link RouteRecordRaw | route record} as the child of an existing route.
752
+ *
753
+ * @param parentName - Parent Route Record where `route` should be appended at
754
+ * @param route - Route Record to add
755
+ */
756
+ addRoute(parentName: NonNullable<RouteRecordNameGeneric>, route: RouteRecordRaw): () => void;
757
+ /**
758
+ * Add a new {@link RouteRecordRaw | route record} to the router.
759
+ *
760
+ * @param route - Route Record to add
761
+ */
762
+ addRoute(route: RouteRecordRaw): () => void;
763
+ /**
764
+ * Remove an existing route by its name.
765
+ *
766
+ * @param name - Name of the route to remove
767
+ */
768
+ removeRoute(name: NonNullable<RouteRecordNameGeneric>): void;
769
+ /**
770
+ * Delete all routes from the router.
771
+ */
772
+ clearRoutes(): void;
773
+ }
774
+ /**
775
+ * Router instance.
776
+ *
777
+ * By default this resolves to the classic {@link RouterClassic}. Augment
778
+ * {@link TypesConfig} with a `Router` slot to swap the public type.
779
+ *
780
+ * ```ts
781
+ * import { router } from './router'
782
+ * declare module 'vue-router' {
783
+ * interface TypesConfig {
784
+ * Router: typeof router
785
+ * }
786
+ * }
787
+ * ```
788
+ */
789
+ type Router = TypesConfig extends Record<'Router', infer T> ? T : RouterClassic;
790
+ //#endregion
791
+ //#region src/RouterLink.d.ts
792
+ interface RouterLinkOptions {
793
+ /**
794
+ * Route Location the link should navigate to when clicked on.
795
+ */
796
+ to: RouteLocationRaw;
797
+ /**
798
+ * Calls `router.replace` instead of `router.push`.
799
+ */
800
+ replace?: boolean;
801
+ }
802
+ interface RouterLinkProps extends RouterLinkOptions {
803
+ /**
804
+ * Whether RouterLink should not wrap its content in an `a` tag. Useful when
805
+ * using `v-slot` to create a custom RouterLink
806
+ */
807
+ custom?: boolean;
808
+ /**
809
+ * Class to apply when the link is active
810
+ */
811
+ activeClass?: string;
812
+ /**
813
+ * Class to apply when the link is exact active
814
+ */
815
+ exactActiveClass?: string;
816
+ /**
817
+ * Value passed to the attribute `aria-current` when the link is exact active.
818
+ *
819
+ * @defaultValue `'page'`
820
+ */
821
+ ariaCurrentValue?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';
822
+ /**
823
+ * Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
824
+ */
825
+ viewTransition?: boolean;
826
+ }
827
+ /**
828
+ * Options passed to {@link useLink}.
829
+ */
830
+ interface UseLinkOptions<Name extends keyof RouteMap = keyof RouteMap> {
831
+ to: MaybeRef<RouteLocationAsString | RouteLocationAsRelativeTyped<RouteMap, Name> | RouteLocationAsPath | RouteLocationRaw>;
832
+ replace?: MaybeRef<boolean | undefined>;
833
+ /**
834
+ * Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
835
+ */
836
+ viewTransition?: boolean;
837
+ }
838
+ /**
839
+ * Return type of {@link useLink}.
840
+ * @internal
841
+ */
842
+ interface UseLinkReturn<Name extends keyof RouteMap = keyof RouteMap> {
843
+ route: ComputedRef<RouteLocationResolved<Name>>;
844
+ href: ComputedRef<string>;
845
+ isActive: ComputedRef<boolean>;
846
+ isExactActive: ComputedRef<boolean>;
847
+ navigate(e?: MouseEvent): Promise<void | NavigationFailure>;
848
+ }
849
+ /**
850
+ * Returns the internal behavior of a {@link RouterLink} without the rendering part.
851
+ *
852
+ * @param props - a `to` location and an optional `replace` flag
853
+ */
854
+ declare function useLink<Name extends keyof RouteMap = keyof RouteMap>(props: UseLinkOptions<Name>): UseLinkReturn<Name>;
855
+ /**
856
+ * Component to render a link that triggers a navigation on click.
857
+ */
858
+ declare const RouterLink: _RouterLinkI;
859
+ /**
860
+ * @internal
861
+ */
862
+ type _RouterLinkPropsTypedBase = AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterLinkProps;
863
+ /**
864
+ * @internal
865
+ */
866
+ type RouterLinkPropsTyped<Custom extends boolean | undefined> = Custom extends true ? _RouterLinkPropsTypedBase & {
867
+ custom: true;
868
+ } : _RouterLinkPropsTypedBase & {
869
+ custom?: false | undefined;
870
+ } & Omit<AnchorHTMLAttributes, 'href'>;
871
+ /**
872
+ * Typed version of the `RouterLink` component. Its generic defaults to the typed router, so it can be inferred
873
+ * automatically for JSX.
874
+ *
875
+ * @internal
876
+ */
877
+ interface _RouterLinkI {
878
+ new <Custom extends boolean | undefined = boolean | undefined>(): {
879
+ $props: RouterLinkPropsTyped<Custom>;
880
+ $slots: {
881
+ default?: ({ route, href, isActive, isExactActive, navigate }: UnwrapRef<UseLinkReturn>) => VNode[];
882
+ };
883
+ };
884
+ /**
885
+ * Access to `useLink()` without depending on using vue-router
886
+ *
887
+ * @internal
888
+ */
889
+ useLink: typeof useLink;
890
+ }
891
+ //#endregion
892
+ //#region src/RouterView.d.ts
893
+ interface RouterViewProps {
894
+ name?: string;
895
+ route?: RouteLocationNormalized;
896
+ }
897
+ /**
898
+ * Component to display the current route the user is at.
899
+ */
900
+ declare const RouterView: {
901
+ new (): {
902
+ $props: AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterViewProps;
903
+ $slots: {
904
+ default?: ({ Component, route }: {
905
+ Component: VNode;
906
+ route: RouteLocationNormalizedLoaded;
907
+ }) => VNode[];
908
+ };
909
+ };
910
+ };
911
+ //#endregion
912
+ //#region src/index.d.ts
913
+ declare module 'vue' {
914
+ interface ComponentCustomOptions {
915
+ /**
916
+ * Guard called when the router is navigating to the route that is rendering
917
+ * this component from a different route. Differently from `beforeRouteUpdate`
918
+ * and `beforeRouteLeave`, `beforeRouteEnter` does not have access to the
919
+ * component instance through `this` because it triggers before the component
920
+ * is even mounted.
921
+ *
922
+ * @param to - RouteLocationRaw we are navigating to
923
+ * @param from - RouteLocationRaw we are navigating from
924
+ * @param next - function to validate, cancel or modify (by redirecting) the
925
+ * navigation
926
+ */
927
+ beforeRouteEnter?: TypesConfig extends Record<'beforeRouteEnter', infer T> ? T : NavigationGuardWithThis<undefined>;
928
+ /**
929
+ * Guard called whenever the route that renders this component has changed, but
930
+ * it is reused for the new route. This allows you to guard for changes in
931
+ * params, the query or the hash.
932
+ *
933
+ * @param to - RouteLocationRaw we are navigating to
934
+ * @param from - RouteLocationRaw we are navigating from
935
+ * @param next - function to validate, cancel or modify (by redirecting) the
936
+ * navigation
937
+ */
938
+ beforeRouteUpdate?: TypesConfig extends Record<'beforeRouteUpdate', infer T> ? T : NavigationGuard;
939
+ /**
940
+ * Guard called when the router is navigating away from the current route that
941
+ * is rendering this component.
942
+ *
943
+ * @param to - RouteLocationRaw we are navigating to
944
+ * @param from - RouteLocationRaw we are navigating from
945
+ * @param next - function to validate, cancel or modify (by redirecting) the
946
+ * navigation
947
+ */
948
+ beforeRouteLeave?: TypesConfig extends Record<'beforeRouteLeave', infer T> ? T : NavigationGuard;
949
+ }
950
+ interface ComponentCustomProperties {
951
+ /**
952
+ * Normalized current location. See {@link RouteLocationNormalizedLoaded}.
953
+ */
954
+ $route: TypesConfig extends Record<'$route', infer T> ? T : RouteLocationNormalizedLoaded;
955
+ /**
956
+ * {@link Router} instance used by the application.
957
+ */
958
+ $router: TypesConfig extends Record<'$router', infer T> ? T : Router;
959
+ }
960
+ interface GlobalComponents {
961
+ RouterView: TypesConfig extends Record<'RouterView', infer T> ? T : typeof RouterView;
962
+ RouterLink: TypesConfig extends Record<'RouterLink', infer T> ? T : typeof RouterLink;
963
+ }
964
+ }
965
+ //#endregion
966
+ //#region src/experimental/data-loaders/utils.d.ts
967
+ /**
968
+ * Object and promise of the object itself. Used when we can await some of the properties of an object to be loaded.
969
+ * @internal
970
+ */
971
+ type _PromiseMerged<PromiseType, RawType = PromiseType> = RawType & Promise<PromiseType>;
972
+ //#endregion
973
+ //#region src/experimental/data-loaders/navigation-guard.d.ts
974
+ /**
975
+ * Possible values to change the result of a navigation within a loader
976
+ * @internal
977
+ */
978
+ type _DataLoaderRedirectResult = Exclude<ReturnType<NavigationGuard>, Promise<unknown> | Function | true | void | undefined>;
979
+ /**
980
+ * Allows data loaders to change navigation. Called by {@link reroute}.
981
+ *
982
+ * @internal
983
+ */
984
+ declare class NavigationResult {
985
+ readonly value: _DataLoaderRedirectResult;
986
+ constructor(value: _DataLoaderRedirectResult);
987
+ }
988
+ //#endregion
989
+ //#region src/experimental/data-loaders/types-config.d.ts
990
+ /**
991
+ * The default error type used for data loaders. Can be customized via {@link TypesConfig}.
992
+ *
993
+ * @example
994
+ * ```ts
995
+ * // types-extension.d.ts
996
+ * import 'vue-router/experimental'
997
+ * export {}
998
+ * declare module 'vue-router/experimental' {
999
+ * interface TypesConfig {
1000
+ * Error: MyCustomError
1001
+ * }
1002
+ * }
1003
+ * ```
1004
+ *
1005
+ * @internal
1006
+ */
1007
+ type ErrorDefault = TypesConfig extends Record<'Error', infer E> ? E : Error;
1008
+ //#endregion
1009
+ //#region src/experimental/data-loaders/createDataLoader.d.ts
1010
+ /**
1011
+ * Base type for a data loader entry. Each Data Loader has its own entry in the `loaderEntries` (accessible via `[LOADER_ENTRIES_KEY]`) map.
1012
+ */
1013
+ interface DataLoaderEntryBase<TData = unknown, TError = unknown, TDataInitial extends TData | undefined = TData | undefined> {
1014
+ /**
1015
+ * Data stored in the entry.
1016
+ */
1017
+ data: ShallowRef<TData | TDataInitial>;
1018
+ /**
1019
+ * Error if there was an error.
1020
+ */
1021
+ error: ShallowRef<TError | null>;
1022
+ /**
1023
+ * Location the data was loaded for or `null` if the data is not loaded.
1024
+ */
1025
+ to: RouteLocationNormalizedLoaded | null;
1026
+ /**
1027
+ * Whether there is an ongoing request.
1028
+ */
1029
+ isLoading: ShallowRef<boolean>;
1030
+ options: DefineDataLoaderOptionsBase_LaxData;
1031
+ /**
1032
+ * Called by the navigation guard when the navigation is duplicated. Should be used to reset pendingTo and pendingLoad and any other property that should be reset.
1033
+ */
1034
+ resetPending: () => void;
1035
+ /**
1036
+ * The latest pending load. Allows to verify if the load is still valid when it resolves.
1037
+ */
1038
+ pendingLoad: Promise<void> | null;
1039
+ /**
1040
+ * The latest pending navigation's `to` route. Used to verify if the navigation is still valid when it resolves.
1041
+ */
1042
+ pendingTo: RouteLocationNormalizedLoaded | null;
1043
+ /**
1044
+ * Data that was staged by a loader. This is used to avoid showing the old data while the new data is loading. Calling
1045
+ * the internal `commit()` function will replace the data with the staged data.
1046
+ */
1047
+ staged: TData | typeof STAGED_NO_VALUE;
1048
+ /**
1049
+ * Error that was staged by a loader. This is used to avoid showing the old error while the new data is loading.
1050
+ * Calling the internal `commit()` function will replace the error with the staged error.
1051
+ */
1052
+ stagedError: TError | null;
1053
+ /**
1054
+ * Other data loaders that depend on this one. This is used to invalidate the data when a dependency is invalidated.
1055
+ */
1056
+ children: Set<DataLoaderEntryBase>;
1057
+ /**
1058
+ * Commits the pending data to the entry. This is called by the navigation guard when all non-lazy loaders have
1059
+ * finished loading. It should be implemented by the loader. It **must be called** from the entry itself:
1060
+ * `entry.commit(to)`.
1061
+ */
1062
+ commit(to: RouteLocationNormalizedLoaded): void;
1063
+ }
1064
+ /**
1065
+ * Common properties for the options of `defineLoader()`. Types are `unknown` to allow for more specific types in the
1066
+ * extended types while having documentation in one single place.
1067
+ * @internal
1068
+ */
1069
+ interface _DefineDataLoaderOptionsBase_Common {
1070
+ /**
1071
+ * When the data should be committed to the entry. In the case of lazy loaders, the loader will try to commit the data
1072
+ * after all non-lazy loaders have finished loading, but it might not be able to if the lazy loader hasn't been
1073
+ * resolved yet.
1074
+ *
1075
+ * @see {@link DefineDataLoaderCommit}
1076
+ * @defaultValue `'after-load'`
1077
+ */
1078
+ commit?: DefineDataLoaderCommit;
1079
+ /**
1080
+ * Whether the data should be lazy loaded without blocking the client side navigation or not. When set to true, the loader will no longer block the navigation and the returned composable can be called even
1081
+ * without having the data ready.
1082
+ *
1083
+ * @defaultValue `false`
1084
+ */
1085
+ lazy?: unknown;
1086
+ /**
1087
+ * Whether this loader should be awaited on the server side or not. Combined with the `lazy` option, this gives full
1088
+ * control over how to await for the data.
1089
+ *
1090
+ * @defaultValue `true`
1091
+ */
1092
+ server?: unknown;
1093
+ /**
1094
+ * List of _expected_ errors that shouldn't abort the navigation (for non-lazy loaders). Provide a list of
1095
+ * constructors that can be checked with `instanceof` or a custom function that returns `true` for expected errors. Can also be set to `true` to accept all globally defined errors. Defaults to `false` to abort on any error.
1096
+ * @default `false`
1097
+ */
1098
+ errors?: unknown;
1099
+ }
1100
+ /**
1101
+ * Options for a data loader that returns a data that is possibly `undefined`. Available for data loaders
1102
+ * implementations so they can be used in `defineLoader()` overloads.
1103
+ */
1104
+ interface DefineDataLoaderOptionsBase_LaxData extends _DefineDataLoaderOptionsBase_Common {
1105
+ lazy?: boolean | ((to: RouteLocationNormalizedLoaded, from?: RouteLocationNormalizedLoaded) => boolean);
1106
+ server?: boolean;
1107
+ errors?: boolean | Array<new (...args: any[]) => any> | ((reason?: unknown) => boolean);
1108
+ }
1109
+ /**
1110
+ * When the data should be committed to the entry.
1111
+ * - `immediate`: the data is committed as soon as it is loaded.
1112
+ * - `after-load`: the data is committed after all non-lazy loaders have finished loading.
1113
+ */
1114
+ type DefineDataLoaderCommit = 'immediate' | 'after-load';
1115
+ /**
1116
+ * Data Loader composable returned by `defineLoader()`.
1117
+ * @see {@link DefineDataLoader}
1118
+ */
1119
+ interface UseDataLoader<Data = unknown, TError = unknown> {
1120
+ [IS_USE_DATA_LOADER_KEY]: true;
1121
+ /**
1122
+ * Data Loader composable returned by `defineLoader()`.
1123
+ *
1124
+ * @example
1125
+ * Returns the Data loader data, isLoading, error etc. Meant to be used in `setup()` or `<script setup>` **without `await`**:
1126
+ * ```vue
1127
+ * <script setup>
1128
+ * const { data, isLoading, error } = useUserData()
1129
+ * </script>
1130
+ * ```
1131
+ *
1132
+ * @example
1133
+ * It also returns a promise of the data when used in nested loaders. Note this `data` is **not a ref**. This is not meant to be used in `setup()` or `<script setup>`.
1134
+ * ```ts
1135
+ * export const useUserConnections = defineLoader(async () => {
1136
+ * const user = await useUserData()
1137
+ * return fetchUserConnections(user.id)
1138
+ * })
1139
+ * ```
1140
+ */
1141
+ (): _PromiseMerged<Exclude<Data, NavigationResult | undefined>, UseDataLoaderResult<Exclude<Data, NavigationResult>, TError>>;
1142
+ /**
1143
+ * Internals of the data loader.
1144
+ * @internal
1145
+ */
1146
+ _: UseDataLoaderInternals<Exclude<Data, NavigationResult | undefined>, TError>;
1147
+ }
1148
+ /**
1149
+ * Internal properties of a data loader composable. Used by the internal implementation of `defineLoader()`. **Should
1150
+ * not be used in application code.**
1151
+ */
1152
+ interface UseDataLoaderInternals<Data = unknown, TError = unknown> {
1153
+ /**
1154
+ * Loads the data from the cache if possible, otherwise loads it from the loader and awaits it.
1155
+ *
1156
+ * @param to - route location to load the data for
1157
+ * @param router - router instance
1158
+ * @param from - route location we are coming from
1159
+ * @param parent - parent data loader entry
1160
+ */
1161
+ load: (to: RouteLocationNormalizedLoaded, router: Router, from?: RouteLocationNormalizedLoaded, parent?: DataLoaderEntryBase) => Promise<void>;
1162
+ /**
1163
+ * Resolved options for the loader.
1164
+ */
1165
+ options: DefineDataLoaderOptionsBase_LaxData;
1166
+ /**
1167
+ * Gets the entry associated with the router instance. Assumes the data loader has been loaded and that the entry
1168
+ * exists.
1169
+ *
1170
+ * @param router - router instance
1171
+ */
1172
+ getEntry(router: Router): DataLoaderEntryBase<Data, TError>;
1173
+ }
1174
+ /**
1175
+ * Return value of a loader composable defined with `defineLoader()`.
1176
+ */
1177
+ interface UseDataLoaderResult<TData = unknown, TError = ErrorDefault> {
1178
+ /**
1179
+ * Data returned by the loader. If the data loader is lazy, it will be undefined until the first load.
1180
+ */
1181
+ data: ShallowRef<TData>;
1182
+ /**
1183
+ * Whether there is an ongoing request.
1184
+ */
1185
+ isLoading: ShallowRef<boolean>;
1186
+ /**
1187
+ * Error if there was an error.
1188
+ */
1189
+ error: ShallowRef<TError | null>;
1190
+ /**
1191
+ * Reload the data using the current route location. Returns a promise that resolves when the data is reloaded. This
1192
+ * method should not be called during a navigation as it can conflict with an ongoing load and lead to
1193
+ * inconsistencies.
1194
+ */
1195
+ reload(): Promise<void>;
1196
+ /**
1197
+ * Reload the data using the route location passed as argument. Returns a promise that resolves when the data is reloaded.
1198
+ *
1199
+ * @param route - route location to load the data for
1200
+ */
1201
+ reload(route: RouteLocationNormalizedLoaded): Promise<void>;
1202
+ }
1203
+ //#endregion
1204
+ //#region src/experimental/data-loaders/symbols.d.ts
1205
+ /**
1206
+ * Retrieves the internal version of loaders.
1207
+ * @internal
1208
+ */
1209
+ declare const LOADER_SET_KEY: unique symbol;
1210
+ /**
1211
+ * Retrieves the internal version of loader entries.
1212
+ * @internal
1213
+ */
1214
+ declare const LOADER_ENTRIES_KEY: unique symbol;
1215
+ /**
1216
+ * Added to the loaders returned by `defineLoader()` to identify them.
1217
+ * Allows to extract exported useData() from a component.
1218
+ * @internal
1219
+ */
1220
+ declare const IS_USE_DATA_LOADER_KEY: unique symbol;
1221
+ /**
1222
+ * Symbol used to save the pending location on the router.
1223
+ * @internal
1224
+ */
1225
+ declare const PENDING_LOCATION_KEY: unique symbol;
1226
+ /**
1227
+ * Symbol used to know there is no value staged for the loader and that commit should be skipped.
1228
+ * @internal
1229
+ */
1230
+ declare const STAGED_NO_VALUE: unique symbol;
1231
+ /**
1232
+ * Gives access to the current app and it's `runWithContext` method.
1233
+ * @internal
1234
+ */
1235
+ declare const APP_KEY: unique symbol;
1236
+ /**
1237
+ * Gives access to an AbortController that aborts when the navigation is canceled.
1238
+ * @internal
1239
+ */
1240
+ declare const ABORT_CONTROLLER_KEY: unique symbol;
1241
+ /**
1242
+ * Symbol used to save the initial data on the router.
1243
+ * @internal
1244
+ */
1245
+ declare const IS_SSR_KEY: unique symbol;
1246
+ /**
1247
+ * Symbol used to get the effect scope used for data loaders.
1248
+ * @internal
1249
+ */
1250
+ declare const DATA_LOADERS_EFFECT_SCOPE_KEY: unique symbol;
1251
+ //#endregion
1252
+ //#region src/experimental/data-loaders/defineLoader.d.ts
1253
+ /**
1254
+ * Symbol used to store the data in the router so it can be retrieved after the initial navigation.
1255
+ * @internal
1256
+ */
1257
+ declare const SERVER_INITIAL_DATA_KEY: unique symbol;
1258
+ /**
1259
+ * Initial data generated on server and consumed on client.
1260
+ * @internal
1261
+ */
1262
+ declare const INITIAL_DATA_KEY: unique symbol;
1263
+ //#endregion
1264
+ //#region src/experimental/data-loaders/meta-extensions.d.ts
1265
+ /**
1266
+ * Map type for the entries used by data loaders.
1267
+ * @internal
1268
+ */
1269
+ type _DefineLoaderEntryMap<DataLoaderEntry extends DataLoaderEntryBase<unknown> = DataLoaderEntryBase<unknown>> = WeakMap<object, DataLoaderEntry>;
1270
+ /**
1271
+ * The extensions added to the router instance for data loaders. These are used
1272
+ * internally by the router and should not be accessed directly by users.
1273
+ *
1274
+ * @internal
1275
+ */
1276
+ interface DataLoaderExtensions {
1277
+ /**
1278
+ * The entries used by data loaders. Put on the router for convenience.
1279
+ * @internal
1280
+ */
1281
+ [LOADER_ENTRIES_KEY]: _DefineLoaderEntryMap;
1282
+ /**
1283
+ * Pending navigation that is waiting for data loaders to resolve.
1284
+ * @internal
1285
+ */
1286
+ [PENDING_LOCATION_KEY]: RouteLocationNormalizedLoaded | null;
1287
+ /**
1288
+ * The app instance that is used by the router.
1289
+ * @internal
1290
+ */
1291
+ [APP_KEY]: App<unknown>;
1292
+ /**
1293
+ * Whether the router is running in server-side rendering mode.
1294
+ * @internal
1295
+ */
1296
+ [IS_SSR_KEY]: boolean;
1297
+ /**
1298
+ * The effect scope used to run data loaders.
1299
+ * @internal
1300
+ */
1301
+ [DATA_LOADERS_EFFECT_SCOPE_KEY]: EffectScope;
1302
+ /**
1303
+ * Gives access to the initial state during rendering. Should be set to `false` once it's consumed.
1304
+ * Used by `defineLoader`
1305
+ *
1306
+ * @internal
1307
+ */
1308
+ [SERVER_INITIAL_DATA_KEY]?: Record<string, unknown> | false;
1309
+ /**
1310
+ * Used by `defineLoader`
1311
+ *
1312
+ * @internal
1313
+ */
1314
+ [INITIAL_DATA_KEY]?: Record<string, unknown> | false;
1315
+ }
1316
+ //#endregion
1317
+ //#region src/experimental/router.d.ts
1318
+ /**
1319
+ * Options to initialize a {@link Router} instance.
1320
+ */
1321
+ interface EXPERIMENTAL_RouterOptions_Base extends PathParserOptions {
1322
+ /**
1323
+ * History implementation used by the router. Most web applications should use
1324
+ * `createWebHistory` but it requires the server to be properly configured.
1325
+ * You can also use a _hash_ based history with `createWebHashHistory` that
1326
+ * does not require any configuration on the server but isn't handled at all
1327
+ * by search engines and does poorly on SEO.
1328
+ *
1329
+ * @example
1330
+ * ```js
1331
+ * createRouter({
1332
+ * history: createWebHistory(),
1333
+ * // other options...
1334
+ * })
1335
+ * ```
1336
+ */
1337
+ history: RouterHistory;
1338
+ /**
1339
+ * Function to control scrolling when navigating between pages. Can return a
1340
+ * Promise to delay scrolling.
1341
+ *
1342
+ * @see {@link RouterScrollBehavior}.
1343
+ *
1344
+ * @example
1345
+ * ```js
1346
+ * function scrollBehavior(to, from, savedPosition) {
1347
+ * // `to` and `from` are both route locations
1348
+ * // `savedPosition` can be null if there isn't one
1349
+ * }
1350
+ * ```
1351
+ */
1352
+ scrollBehavior?: RouterScrollBehavior;
1353
+ /**
1354
+ * Custom implementation to parse a query. See its counterpart,
1355
+ * {@link EXPERIMENTAL_RouterOptions_Base.stringifyQuery}.
1356
+ *
1357
+ * @example
1358
+ * Let's say you want to use the [qs package](https://github.com/ljharb/qs)
1359
+ * to parse queries, you can provide both `parseQuery` and `stringifyQuery`:
1360
+ * ```js
1361
+ * import qs from 'qs'
1362
+ *
1363
+ * createRouter({
1364
+ * // other options...
1365
+ * parseQuery: qs.parse,
1366
+ * stringifyQuery: qs.stringify,
1367
+ * })
1368
+ * ```
1369
+ */
1370
+ parseQuery?: typeof experimental_parseQuery;
1371
+ /**
1372
+ * Custom implementation to stringify a query object. Should not prepend a leading `?`.
1373
+ * {@link parseQuery} counterpart to handle query parsing.
1374
+ */
1375
+ stringifyQuery?: typeof stringifyQuery;
1376
+ /**
1377
+ * Default class applied to active {@link RouterLink}. If none is provided,
1378
+ * `router-link-active` will be applied.
1379
+ */
1380
+ linkActiveClass?: string;
1381
+ /**
1382
+ * Default class applied to exact active {@link RouterLink}. If none is provided,
1383
+ * `router-link-exact-active` will be applied.
1384
+ */
1385
+ linkExactActiveClass?: string;
1386
+ }
1387
+ /**
1388
+ * Router base instance.
1389
+ *
1390
+ * @experimental This version is not stable, it's meant to replace {@link Router} in the future.
1391
+ */
1392
+ interface EXPERIMENTAL_Router_Base<TRecord> extends DataLoaderExtensions {
1393
+ /**
1394
+ * Current {@link RouteLocationNormalized}
1395
+ */
1396
+ readonly currentRoute: ShallowRef<RouteLocationNormalizedLoaded>;
1397
+ /**
1398
+ * Allows turning off the listening of history events. This is a low level api for micro-frontend.
1399
+ */
1400
+ listening: boolean;
1401
+ /**
1402
+ * Checks if a route with a given name exists
1403
+ *
1404
+ * @param name - Name of the route to check
1405
+ */
1406
+ hasRoute(name: NonNullable<RouteRecordNameGeneric>): boolean;
1407
+ /**
1408
+ * Get a full list of all the {@link RouteRecord | route records}.
1409
+ */
1410
+ getRoutes(): TRecord[];
1411
+ /**
1412
+ * Returns the {@link RouteLocation | normalized version} of a
1413
+ * {@link RouteLocationRaw | route location}. Also includes an `href` property
1414
+ * that includes any existing `base`. By default, the `currentLocation` used is
1415
+ * `router.currentRoute` and should only be overridden in advanced use cases.
1416
+ *
1417
+ * @param to - Raw route location to resolve
1418
+ * @param currentLocation - Optional current location to resolve against
1419
+ */
1420
+ resolve<Name extends keyof RouteMap = keyof RouteMap>(to: RouteLocationAsRelativeTyped<RouteMap, Name>, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved<Name>;
1421
+ resolve(to: RouteLocationAsString | RouteLocationAsRelative | RouteLocationAsPath, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved;
1422
+ /**
1423
+ * Programmatically navigate to a new URL by pushing an entry in the history
1424
+ * stack.
1425
+ *
1426
+ * @param to - Route location to navigate to
1427
+ */
1428
+ push(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
1429
+ /**
1430
+ * Programmatically navigate to a new URL by replacing the current entry in
1431
+ * the history stack.
1432
+ *
1433
+ * @param to - Route location to navigate to
1434
+ */
1435
+ replace(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
1436
+ /**
1437
+ * Go back in history if possible by calling `history.back()`. Equivalent to
1438
+ * `router.go(-1)`.
1439
+ */
1440
+ back(): void;
1441
+ /**
1442
+ * Go forward in history if possible by calling `history.forward()`.
1443
+ * Equivalent to `router.go(1)`.
1444
+ */
1445
+ forward(): void;
1446
+ /**
1447
+ * Allows you to move forward or backward through the history. Calls
1448
+ * `history.go()`.
1449
+ *
1450
+ * @param delta - The position in the history to which you want to move,
1451
+ * relative to the current page
1452
+ */
1453
+ go(delta: number): void;
1454
+ /**
1455
+ * Add a navigation guard that executes before any navigation. Returns a
1456
+ * function that removes the registered guard.
1457
+ *
1458
+ * @param guard - navigation guard to add
1459
+ */
1460
+ beforeEach(guard: NavigationGuardWithThis<undefined>): () => void;
1461
+ /**
1462
+ * Add a navigation guard that executes before navigation is about to be
1463
+ * resolved. At this state all component have been fetched and other
1464
+ * navigation guards have been successful. Returns a function that removes the
1465
+ * registered guard.
1466
+ *
1467
+ * @param guard - navigation guard to add
1468
+ * @returns a function that removes the registered guard
1469
+ *
1470
+ * @example
1471
+ * ```js
1472
+ * router.beforeResolve(to => {
1473
+ * if (to.meta.requiresAuth && !isAuthenticated) return false
1474
+ * })
1475
+ * ```
1476
+ *
1477
+ */
1478
+ beforeResolve(guard: _NavigationGuardResolved): () => void;
1479
+ /**
1480
+ * Add a navigation hook that is executed after every navigation. Returns a
1481
+ * function that removes the registered hook.
1482
+ *
1483
+ * @param guard - navigation hook to add
1484
+ * @returns a function that removes the registered hook
1485
+ *
1486
+ * @example
1487
+ * ```js
1488
+ * router.afterEach((to, from, failure) => {
1489
+ * if (isNavigationFailure(failure)) {
1490
+ * console.log('failed navigation', failure)
1491
+ * }
1492
+ * })
1493
+ * ```
1494
+ */
1495
+ afterEach(guard: NavigationHookAfter): () => void;
1496
+ /**
1497
+ * Adds an error handler that is called every time a non caught error happens
1498
+ * during navigation. This includes errors thrown synchronously and
1499
+ * asynchronously, errors returned or passed to `next` in any navigation
1500
+ * guard, and errors occurred when trying to resolve an async component that
1501
+ * is required to render a route.
1502
+ *
1503
+ * @param handler - error handler to register
1504
+ */
1505
+ onError(handler: _ErrorListener): () => void;
1506
+ /**
1507
+ * Returns a Promise that resolves when the router has completed the initial
1508
+ * navigation, which means it has resolved all async enter hooks and async
1509
+ * components that are associated with the initial route. If the initial
1510
+ * navigation already happened, the promise resolves immediately.
1511
+ *
1512
+ * This is useful in server-side rendering to ensure consistent output on both
1513
+ * the server and the client. Note that on server side, you need to manually
1514
+ * push the initial location while on client side, the router automatically
1515
+ * picks it up from the URL.
1516
+ */
1517
+ isReady(): Promise<void>;
1518
+ /**
1519
+ * Called automatically by `app.use(router)`. Should not be called manually by
1520
+ * the user. This will trigger the initial navigation when on client side.
1521
+ *
1522
+ * @internal
1523
+ * @param app - Application that uses the router
1524
+ */
1525
+ install(app: App): void;
1526
+ }
1527
+ //#endregion
1528
+ //#region src/types/index.d.ts
1529
+ type Lazy<T> = () => Promise<T>;
1530
+ /**
1531
+ * @internal
1532
+ */
1533
+ type RouteParamValue = string;
1534
+ /**
1535
+ * @internal
1536
+ */
1537
+ type RouteParamValueRaw = RouteParamValue | number | null | undefined;
1538
+ type RouteParamsGeneric = Record<string, RouteParamValue | RouteParamValue[]>;
1539
+ type RouteParamsRawGeneric = Record<string, RouteParamValueRaw | Exclude<RouteParamValueRaw, null | undefined>[]>;
1540
+ /**
1541
+ * @internal
1542
+ */
1543
+ interface RouteQueryAndHash {
1544
+ query?: LocationQueryRaw;
1545
+ hash?: string;
1546
+ }
1547
+ /**
1548
+ * Common options for all navigation methods.
1549
+ */
1550
+ interface RouteLocationOptions {
1551
+ /**
1552
+ * Replace the entry in the history instead of pushing a new entry
1553
+ */
1554
+ replace?: boolean;
1555
+ /**
1556
+ * Triggers the navigation even if the location is the same as the current one.
1557
+ * Note this will also add a new entry to the history unless `replace: true`
1558
+ * is passed.
1559
+ */
1560
+ force?: boolean;
1561
+ /**
1562
+ * State to save using the History API. This cannot contain any reactive
1563
+ * values and some primitives like Symbols are forbidden. More info at
1564
+ * https://developer.mozilla.org/en-US/docs/Web/API/History/state
1565
+ */
1566
+ state?: HistoryState;
1567
+ }
1568
+ interface RouteLocationMatched extends RouteRecordNormalized {
1569
+ components: Record<string, RouteComponent> | null | undefined;
1570
+ }
1571
+ /**
1572
+ * Base properties for a normalized route location.
1573
+ *
1574
+ * @internal
1575
+ */
1576
+ interface _RouteLocationBase extends Pick<MatcherLocation, 'name' | 'path' | 'params' | 'meta'> {
1577
+ /**
1578
+ * The whole location including the `search` and `hash`. This string is
1579
+ * percentage encoded.
1580
+ */
1581
+ fullPath: string;
1582
+ /**
1583
+ * Object representation of the `search` property of the current location.
1584
+ */
1585
+ query: LocationQuery$1;
1586
+ /**
1587
+ * Hash of the current location. If present, starts with a `#`.
1588
+ */
1589
+ hash: string;
1590
+ /**
1591
+ * Contains the location we were initially trying to access before ending up
1592
+ * on the current location.
1593
+ */
1594
+ redirectedFrom: RouteLocation | undefined;
1595
+ }
1596
+ /**
1597
+ * Allowed Component in {@link RouteLocationMatched}
1598
+ */
1599
+ type RouteComponent = Component$1 | DefineComponent;
1600
+ /**
1601
+ * Allowed Component definitions in route records provided by the user
1602
+ */
1603
+ type RawRouteComponent = RouteComponent | Lazy<RouteComponent>;
1604
+ /**
1605
+ * Internal type for common properties among all kind of {@link RouteRecordRaw}.
1606
+ */
1607
+ interface _RouteRecordBase extends PathParserOptions {
1608
+ /**
1609
+ * Path of the record. Should start with `/` unless the record is the child of
1610
+ * another record.
1611
+ *
1612
+ * @example `/users/:id` matches `/users/1` as well as `/users/posva`.
1613
+ */
1614
+ path: string;
1615
+ /**
1616
+ * Where to redirect if the route is directly matched. The redirection happens
1617
+ * before any navigation guard and triggers a new navigation with the new
1618
+ * target location.
1619
+ */
1620
+ redirect?: RouteRecordRedirectOption;
1621
+ /**
1622
+ * Aliases for the record. Allows defining extra paths that will behave like a
1623
+ * copy of the record. Allows having paths shorthands like `/users/:id` and
1624
+ * `/u/:id`. All `alias` and `path` values must share the same params.
1625
+ */
1626
+ alias?: string | string[];
1627
+ /**
1628
+ * Name for the route record. Must be unique.
1629
+ */
1630
+ name?: RouteRecordNameGeneric;
1631
+ /**
1632
+ * Before Enter guard specific to this record. Note `beforeEnter` has no
1633
+ * effect if the record has a `redirect` property.
1634
+ */
1635
+ beforeEnter?: NavigationGuardWithThis<undefined> | NavigationGuardWithThis<undefined>[];
1636
+ /**
1637
+ * Arbitrary data attached to the record.
1638
+ */
1639
+ meta?: RouteMeta;
1640
+ /**
1641
+ * Array of nested routes.
1642
+ */
1643
+ children?: RouteRecordRaw[];
1644
+ /**
1645
+ * Allow passing down params as props to the component rendered by `router-view`.
1646
+ */
1647
+ props?: _RouteRecordProps | Record<string, _RouteRecordProps>;
1648
+ }
1649
+ /**
1650
+ * Interface to type `meta` fields in route records.
1651
+ *
1652
+ * @example
1653
+ *
1654
+ * ```ts
1655
+ * // typings.d.ts or router.ts
1656
+ * import 'vue-router';
1657
+ *
1658
+ * declare module 'vue-router' {
1659
+ * interface RouteMeta {
1660
+ * requiresAuth?: boolean
1661
+ * }
1662
+ * }
1663
+ * ```
1664
+ */
1665
+ interface RouteMeta extends Record<PropertyKey, unknown> {
1666
+ /**
1667
+ * The data loaders for a route record. Add any data loader to this array to
1668
+ * have it called when the route is navigated to. Note this is only needed
1669
+ * when **not** using lazy components (`() => import('./pages/Home.vue')`) or
1670
+ * when not explicitly exporting data loaders from page components.
1671
+ *
1672
+ * This requires the use of the experimental data loaders and is ignored otherwise.
1673
+ *
1674
+ * @see {@link DataLoaderPlugin}
1675
+ */
1676
+ loaders?: UseDataLoader[];
1677
+ /**
1678
+ * Set of loaders for the current route. This is built once during navigation
1679
+ * and is used to merge the loaders from the lazy import in components or the
1680
+ * `loaders` array in the route record.
1681
+ *
1682
+ * @internal
1683
+ */
1684
+ [LOADER_SET_KEY]?: Set<UseDataLoader>;
1685
+ /**
1686
+ * The signal that is aborted when the navigation is canceled or an error
1687
+ * occurs.
1688
+ *
1689
+ * @internal
1690
+ */
1691
+ [ABORT_CONTROLLER_KEY]?: AbortController;
1692
+ }
1693
+ /**
1694
+ * Route Record defining one single component with the `component` option.
1695
+ */
1696
+ interface RouteRecordSingleView extends _RouteRecordBase {
1697
+ /**
1698
+ * Component to display when the URL matches this route.
1699
+ */
1700
+ component: RawRouteComponent;
1701
+ components?: never;
1702
+ children?: never;
1703
+ redirect?: never;
1704
+ /**
1705
+ * Allow passing down params as props to the component rendered by `router-view`.
1706
+ */
1707
+ props?: _RouteRecordProps;
1708
+ }
1709
+ /**
1710
+ * Route Record defining one single component with a nested view. Differently
1711
+ * from {@link RouteRecordSingleView}, this record has children and allows a
1712
+ * `redirect` option.
1713
+ */
1714
+ interface RouteRecordSingleViewWithChildren extends _RouteRecordBase {
1715
+ /**
1716
+ * Component to display when the URL matches this route.
1717
+ */
1718
+ component?: RawRouteComponent | null | undefined;
1719
+ components?: never;
1720
+ children: RouteRecordRaw[];
1721
+ /**
1722
+ * Allow passing down params as props to the component rendered by `router-view`.
1723
+ */
1724
+ props?: _RouteRecordProps;
1725
+ }
1726
+ /**
1727
+ * Route Record defining multiple named components with the `components` option.
1728
+ */
1729
+ interface RouteRecordMultipleViews extends _RouteRecordBase {
1730
+ /**
1731
+ * Components to display when the URL matches this route. Allow using named views.
1732
+ */
1733
+ components: Record<string, RawRouteComponent>;
1734
+ component?: never;
1735
+ children?: never;
1736
+ redirect?: never;
1737
+ /**
1738
+ * Allow passing down params as props to the component rendered by
1739
+ * `router-view`. Should be an object with the same keys as `components` or a
1740
+ * boolean to be applied to every component.
1741
+ */
1742
+ props?: Record<string, _RouteRecordProps> | boolean;
1743
+ }
1744
+ /**
1745
+ * Route Record defining multiple named components with the `components` option and children.
1746
+ */
1747
+ interface RouteRecordMultipleViewsWithChildren extends _RouteRecordBase {
1748
+ /**
1749
+ * Components to display when the URL matches this route. Allow using named views.
1750
+ */
1751
+ components?: Record<string, RawRouteComponent> | null | undefined;
1752
+ component?: never;
1753
+ children: RouteRecordRaw[];
1754
+ /**
1755
+ * Allow passing down params as props to the component rendered by
1756
+ * `router-view`. Should be an object with the same keys as `components` or a
1757
+ * boolean to be applied to every component.
1758
+ */
1759
+ props?: Record<string, _RouteRecordProps> | boolean;
1760
+ }
1761
+ /**
1762
+ * Route Record that defines a redirect. Cannot have `component` or `components`
1763
+ * as it is never rendered.
1764
+ */
1765
+ interface RouteRecordRedirect extends _RouteRecordBase {
1766
+ redirect: RouteRecordRedirectOption;
1767
+ component?: never;
1768
+ components?: never;
1769
+ props?: never;
1770
+ }
1771
+ type RouteRecordRaw = RouteRecordSingleView | RouteRecordSingleViewWithChildren | RouteRecordMultipleViews | RouteRecordMultipleViewsWithChildren | RouteRecordRedirect;
1772
+ /**
1773
+ * Normalized/resolved Route location that returned by the matcher.
1774
+ */
1775
+ interface MatcherLocation {
1776
+ /**
1777
+ * Name of the matched record
1778
+ */
1779
+ name: RouteRecordNameGeneric | null | undefined;
1780
+ /**
1781
+ * Percentage encoded pathname section of the URL.
1782
+ */
1783
+ path: string;
1784
+ /**
1785
+ * Object of decoded params extracted from the `path`.
1786
+ */
1787
+ params: RouteParamsGeneric;
1788
+ /**
1789
+ * Merged `meta` properties from all the matched route records.
1790
+ */
1791
+ meta: RouteMeta;
1792
+ /**
1793
+ * Array of {@link RouteRecord} containing components as they were
1794
+ * passed when adding records. It can also contain redirect records. This
1795
+ * can't be used directly
1796
+ */
1797
+ matched: RouteRecord[];
1798
+ }
1799
+ //#endregion
1800
+ //#region src/experimental/runtime.d.ts
1801
+ /**
1802
+ * Built-in param parsers. Always available; merged into {@link ParamParsers}
1803
+ * alongside any entries the user augments into {@link TypesConfig.ParamParsers}.
1804
+ *
1805
+ * @internal
1806
+ */
1807
+ interface ParamParsers_Native {
1808
+ int: {
1809
+ type: number;
1810
+ };
1811
+ bool: {
1812
+ type: boolean;
1813
+ };
1814
+ string: {
1815
+ type: string;
1816
+ };
1817
+ }
1818
+ /**
1819
+ * Full registry of param parsers: built-ins merged with whatever the user
1820
+ * augments into {@link TypesConfig.ParamParsers}. Each entry is shaped
1821
+ * `{ type: T }` so the parsed value type can be looked up by name via
1822
+ * {@link ParamParserTypeOf}. The vue-router codegen emits this augmentation
1823
+ * automatically from files in the `params/` folder.
1824
+ *
1825
+ * @internal
1826
+ */
1827
+ type ParamParsers = ParamParsers_Native & (TypesConfig extends {
1828
+ _ParamParsers: infer P;
1829
+ } ? P : {});
1830
+ /**
1831
+ * Union of all known parser names (built-in + augmented).
1832
+ */
1833
+ type ParamParserType = keyof ParamParsers;
1834
+ /**
1835
+ * Resolves the parsed value type for a given parser name. Distributes over a
1836
+ * union of names, so `ParamParserTypeOf<'int' | 'date'>` → `number | Date`.
1837
+ *
1838
+ * Falls back to `unknown` when an entry is registered without a `type` field.
1839
+ * The `_ParamParsers` slot is internal — vue-router's codegen populates it
1840
+ * from files in `params/`.
1841
+ *
1842
+ * @example
1843
+ * ```ts
1844
+ * declare module 'vue-router' {
1845
+ * interface TypesConfig {
1846
+ * _ParamParsers: {
1847
+ * date: { type: Date }
1848
+ * }
1849
+ * }
1850
+ * }
1851
+ * ```
1852
+ */
1853
+ type ParamParserTypeOf<Name extends ParamParserType> = Name extends keyof ParamParsers ? ParamParsers[Name] extends {
1854
+ type: infer T;
1855
+ } ? T : unknown : unknown;
1856
+ /**
1857
+ * Configures how to extract a route param from a specific query parameter.
1858
+ *
1859
+ * @typeParam Parser - name of the param parser used for this query parameter,
1860
+ * used to type the {@link DefinePageQueryParamOptions.default | `default`}
1861
+ * value via {@link ParamParserTypeOf}.
1862
+ */
1863
+ interface DefinePageQueryParamOptions<Parser extends ParamParserType = ParamParserType> {
1864
+ /**
1865
+ * The type of the query parameter. Allowed values are native param parsers
1866
+ * and any parser in the {@link https://uvr.esm.is/TODO | params folder }. If
1867
+ * not provided, the value will kept as is.
1868
+ */
1869
+ parser?: Parser;
1870
+ /**
1871
+ * Default value if the query parameter is missing or if the match fails
1872
+ * (e.g. a invalid number is passed to the int param parser). If not provided
1873
+ * and the param is not required, the route will match with undefined.
1874
+ */
1875
+ default?: (() => ParamParserTypeOf<Parser>) | ParamParserTypeOf<Parser>;
1876
+ /**
1877
+ * How to format the query parameter value.
1878
+ *
1879
+ * - 'value' - keep the first value only and pass that to parser
1880
+ * - 'array' - keep all values (even one or none) as an array and pass that to parser
1881
+ *
1882
+ * @default 'value'
1883
+ */
1884
+ format?: 'value' | 'array';
1885
+ /**
1886
+ * Whether this query parameter is required. If true and the parameter is
1887
+ * missing (and no default is provided), the route will not match.
1888
+ *
1889
+ * @default false
1890
+ */
1891
+ required?: boolean;
1892
+ }
1893
+ /**
1894
+ * TODO: native parsers ideas:
1895
+ * - json -> just JSON.parse(value)
1896
+ * - boolean -> 'true' | 'false' -> boolean
1897
+ * - number -> Number(value) -> NaN if not a number
1898
+ */
1899
+ //#endregion
1900
+ //#region src/unplugin/core/customBlock.d.ts
1901
+ interface CustomRouteBlock extends Partial<Omit<RouteRecordRaw, 'components' | 'component' | 'children' | 'beforeEnter' | 'name' | 'alias'>> {
1902
+ name?: string | undefined | false;
1903
+ alias?: string[];
1904
+ params?: {
1905
+ /**
1906
+ * Override the parser for a given path param. Set to `null` to remove a
1907
+ * filename-based parser (e.g. revert `[id=int]` back to no parser).
1908
+ */
1909
+ path?: Record<string, string | null>;
1910
+ /**
1911
+ * Declare query params for the route. The value is either a parser name
1912
+ * or an options object with `parser`, `format`, `default`, and `required`.
1913
+ */
1914
+ query?: Record<string, string | CustomRouteBlockQueryParamOptions>;
1915
+ };
1916
+ }
1917
+ interface CustomRouteBlockQueryParamOptions {
1918
+ parser?: string;
1919
+ format?: DefinePageQueryParamOptions['format'];
1920
+ default?: string;
1921
+ required?: boolean;
1922
+ }
1923
+ //#endregion
1924
+ //#region src/unplugin/core/treeNodeValue.d.ts
1925
+ declare const enum TreeNodeType {
1926
+ static = 0,
1927
+ group = 1,
1928
+ param = 2
1929
+ }
1930
+ /**
1931
+ * Internal merged-overrides shape used by tree nodes. Same structure as
1932
+ * {@link CustomRouteBlock} (the user-facing `<route>` block / `definePage()`
1933
+ * payload).
1934
+ */
1935
+ type RouteRecordOverride = CustomRouteBlock;
1936
+ type PathSubSegment = string | TreePathParam;
1937
+ declare class _TreeNodeValueBase {
1938
+ /**
1939
+ * flag based on the type of the segment
1940
+ */
1941
+ _type: TreeNodeType;
1942
+ parent: TreeNodeValue | undefined;
1943
+ /**
1944
+ * segment as defined by the file structure e.g. keeps the `index` name, `(group-name)`
1945
+ */
1946
+ rawSegment: string;
1947
+ /**
1948
+ * transformed version of the segment into a vue-router path. e.g. `'index'` becomes `''` and `[param]` becomes
1949
+ * `:param`, `prefix-[param]-end` becomes `prefix-:param-end`.
1950
+ */
1951
+ pathSegment: string;
1952
+ /**
1953
+ * Array of sub segments. This is usually one single elements but can have more for paths like `prefix-[param]-end.vue`
1954
+ */
1955
+ subSegments: PathSubSegment[];
1956
+ /**
1957
+ * Overrides defined by each file. The map is necessary to handle named views.
1958
+ */
1959
+ private _overrides;
1960
+ /**
1961
+ * Params already warned about declaring a parser twice, so the warning is
1962
+ * emitted once per param even though `pathParams` is a getter.
1963
+ */
1964
+ private _warnedParsers;
1965
+ /**
1966
+ * View name (Vue Router feature) mapped to their corresponding file. By default, the view name is `default` unless
1967
+ * specified with a `@` e.g. `index@aux.vue` will have a view name of `aux`.
1968
+ */
1969
+ components: Map<string, string>;
1970
+ constructor(rawSegment: string, parent: TreeNodeValue | undefined, pathSegment?: string, subSegments?: PathSubSegment[]);
1971
+ /**
1972
+ * Path of the node. Can be absolute or not. If it has been overridden, it
1973
+ * will return the overridden path.
1974
+ */
1975
+ get path(): string;
1976
+ /**
1977
+ * Aliases of the node if any.
1978
+ */
1979
+ get alias(): string[];
1980
+ /**
1981
+ * Full path of the node including parent nodes.
1982
+ */
1983
+ get fullPath(): string;
1984
+ /**
1985
+ * Gets all the query params for the node. This does not include params from parent nodes.
1986
+ */
1987
+ get queryParams(): TreeQueryParam[];
1988
+ /**
1989
+ * Gets all the params for the node including path and query params. This
1990
+ * does not include params from parent nodes.
1991
+ */
1992
+ get params(): (TreePathParam | TreeQueryParam)[];
1993
+ /**
1994
+ * Gets the path params for the node. They come from the `path` override when
1995
+ * there is one, otherwise from the file based segment. Parsers declared in
1996
+ * `params.path` are applied on top. This does not include params from parent
1997
+ * nodes.
1998
+ */
1999
+ get pathParams(): TreePathParam[];
2000
+ toString(): string;
2001
+ isParam(): this is TreeNodeValueParam;
2002
+ isStatic(): this is TreeNodeValueStatic;
2003
+ isGroup(): this is TreeNodeValueGroup;
2004
+ get overrides(): CustomRouteBlock;
2005
+ setOverride(filePath: string, routeBlock: CustomRouteBlock | undefined): void;
2006
+ /**
2007
+ * Remove all overrides for a given key.
2008
+ *
2009
+ * @param key - key to remove from the override, e.g. path, name, etc
2010
+ */
2011
+ removeOverride(key: keyof CustomRouteBlock): void;
2012
+ /**
2013
+ * Add an override to the current node by merging with the existing values.
2014
+ *
2015
+ * @param filePath - The file path to add to the override
2016
+ * @param routeBlock - The route block to add to the override
2017
+ */
2018
+ mergeOverride(filePath: string, routeBlock: CustomRouteBlock): void;
2019
+ /**
2020
+ * Add an override to the current node using the special file path `@@edits` that makes this added at build time.
2021
+ *
2022
+ * @param routeBlock - The route block to add to the override
2023
+ */
2024
+ addEditOverride(routeBlock: CustomRouteBlock): void;
2025
+ /**
2026
+ * Set a specific value in the _edits_ override.
2027
+ *
2028
+ * @param key - key to set in the override, e.g. path, name, etc
2029
+ * @param value - value to set in the override
2030
+ */
2031
+ setEditOverride<K extends keyof RouteRecordOverride>(key: K, value: RouteRecordOverride[K]): void;
2032
+ }
2033
+ /**
2034
+ * - Static
2035
+ * - Static + Custom Param (subSegments)
2036
+ * - Static + Param (subSegments)
2037
+ * - Custom Param
2038
+ * - Param
2039
+ * - CatchAll
2040
+ */
2041
+ /**
2042
+ * Static path like `/users`, `/users/list`, etc
2043
+ * @extends _TreeNodeValueBase
2044
+ */
2045
+ declare class TreeNodeValueStatic extends _TreeNodeValueBase {
2046
+ _type: TreeNodeType.static;
2047
+ readonly score: number[];
2048
+ constructor(rawSegment: string, parent: TreeNodeValue | undefined, pathSegment?: string);
2049
+ }
2050
+ declare class TreeNodeValueGroup extends _TreeNodeValueBase {
2051
+ _type: TreeNodeType.group;
2052
+ groupName: string;
2053
+ readonly score: number[];
2054
+ constructor(rawSegment: string, parent: TreeNodeValue | undefined, pathSegment: string, groupName: string);
2055
+ }
2056
+ interface TreePathParam {
2057
+ paramName: string;
2058
+ modifier: string;
2059
+ optional: boolean;
2060
+ repeatable: boolean;
2061
+ isSplat: boolean;
2062
+ parser: string | null;
2063
+ }
2064
+ interface TreeQueryParam {
2065
+ paramName: string;
2066
+ queryKey?: string;
2067
+ parser: string | null;
2068
+ format: 'value' | 'array' | null;
2069
+ /**
2070
+ * Expression to be passed as is to the default value of the param.
2071
+ */
2072
+ defaultValue?: string;
2073
+ /**
2074
+ * Whether the query param is required.
2075
+ *
2076
+ * @default false
2077
+ */
2078
+ required?: boolean;
2079
+ }
2080
+ declare class TreeNodeValueParam extends _TreeNodeValueBase {
2081
+ _type: TreeNodeType.param;
2082
+ /**
2083
+ * @param rawSegment The raw segment as defined by the file structure, e.g.
2084
+ * `[id]`, `prefix-[param]-end`, etc.
2085
+ *
2086
+ * @param parent The parent node in the tree, if any.
2087
+ *
2088
+ * @param pathSegment The transformed version of the segment into a
2089
+ * vue-router path, e.g. `:id`, `prefix-:param-end`, etc.
2090
+ *
2091
+ * @param subSegments Array of sub segments. This is usually one single
2092
+ * element but can have more for paths like `prefix-[param]-end.vue`.
2093
+ */
2094
+ constructor(rawSegment: string, parent: TreeNodeValue | undefined, pathSegment: string, subSegments: PathSubSegment[]);
2095
+ get score(): number[];
2096
+ /**
2097
+ * Generates the regex pattern for the path segment.
2098
+ */
2099
+ get re(): string;
2100
+ toString(): string;
2101
+ }
2102
+ type TreeNodeValue = TreeNodeValueStatic | TreeNodeValueParam | TreeNodeValueGroup;
2103
+ interface TreeNodeValueOptions extends ParseSegmentOptions {
2104
+ /**
2105
+ * Format of the route path. Defaults to `file` which is the format used by vue-router and matches the file
2106
+ * structure (e.g. `index`, ``, or `users/[id]`). In `path` format, routes are expected in the format of vue-router
2107
+ * (e.g. `/` or '/users/:id' ).
2108
+ *
2109
+ * @default `'file'`
2110
+ */
2111
+ format?: 'file' | 'path';
2112
+ }
2113
+ /**
2114
+ * Creates a new TreeNodeValue based on the segment. The result can be a static segment, group segment or a param segment.
2115
+ *
2116
+ * @param segment - path segment
2117
+ * @param parent - parent node
2118
+ * @param options - options
2119
+ */
2120
+ declare function createTreeNodeValue(segment: string, parent?: TreeNodeValue, opts?: TreeNodeValueOptions): TreeNodeValue;
2121
+ /**
2122
+ * Options passed to `parseSegment()`to control how a segment of a file path is
2123
+ * parsed. e.g. in `/users/[id]`, `users` and `[id]` are segments.
2124
+ */
2125
+ interface ParseSegmentOptions {
2126
+ /**
2127
+ * Should we allow dot nesting in the param name. e.g. `users.[id]` will be
2128
+ * parsed as `users/[id]` if this is `true`, nesting. Note this only works
2129
+ * for the `file` format.
2130
+ *
2131
+ * @default `true`
2132
+ */
2133
+ dotNesting?: boolean;
2134
+ }
2135
+ //#endregion
2136
+ //#region src/unplugin/core/tree.d.ts
2137
+ interface TreeNodeOptions extends ResolvedOptions {
2138
+ treeNodeOptions?: TreeNodeValueOptions;
2139
+ }
2140
+ /**
2141
+ * Parts used by MatcherPatternPathDynamic to match a route.
2142
+ *
2143
+ * @internal
2144
+ */
2145
+ type TreeNodeValueMatcherPart = Array<string | number | Array<string | number>>;
2146
+ /**
2147
+ * Makes the `name` property required and a string. Used for readability
2148
+ *
2149
+ * @internal
2150
+ */
2151
+ type TreeNodeNamed = TreeNode & {
2152
+ name: Extract<TreeNode['name'], string>;
2153
+ };
2154
+ declare class TreeNode {
2155
+ /**
2156
+ * value of the node
2157
+ */
2158
+ value: TreeNodeValue;
2159
+ /**
2160
+ * children of the node
2161
+ */
2162
+ children: Map<string, TreeNode>;
2163
+ /**
2164
+ * Parent node.
2165
+ */
2166
+ parent: TreeNode | undefined;
2167
+ /**
2168
+ * Plugin options taken into account by the tree.
2169
+ */
2170
+ options: TreeNodeOptions;
2171
+ /**
2172
+ * Set of file paths that use `definePage()` with runtime properties (meta, props, etc.) that require a `?definePage`
2173
+ * import at build time. Tracked per-file to avoid race conditions when multiple files (e.g. named views) map to the
2174
+ * same node.
2175
+ */
2176
+ private _needsDefinePageImport;
2177
+ /**
2178
+ * Whether at least one component file uses `definePage()` with runtime properties (meta, props, etc.) that require a
2179
+ * `?definePage` import at build time.
2180
+ */
2181
+ get needsDefinePageImport(): boolean;
2182
+ /**
2183
+ * Mark whether a file needs a `?definePage` import.
2184
+ */
2185
+ setDefinePageImport(filePath: string, needsImport: boolean): void;
2186
+ /**
2187
+ * Check if a specific file needs a `?definePage` import.
2188
+ */
2189
+ fileNeedsDefinePageImport(filePath: string): boolean;
2190
+ /**
2191
+ * Creates a new tree node.
2192
+ *
2193
+ * @param options - TreeNodeOptions shared by all nodes
2194
+ * @param pathSegment - path segment of this node e.g. `users` or `:id`
2195
+ * @param parent
2196
+ */
2197
+ constructor(options: TreeNodeOptions, pathSegment: string, parent?: TreeNode);
2198
+ /**
2199
+ * Adds a path to the tree. `path` cannot start with a `/`.
2200
+ *
2201
+ * @param path - path segment to insert. **It shouldn't contain the file extension**
2202
+ * @param filePath - file path, must be a file (not a folder)
2203
+ */
2204
+ insert(path: string, filePath: string): TreeNode;
2205
+ /**
2206
+ * Adds a path that has already been parsed to the tree. `path` cannot start with a `/`. This method is similar to
2207
+ * `insert` but the path argument should be already parsed. e.g. `users/:id` for a file named `users/[id].vue`.
2208
+ *
2209
+ * @param path - path segment to insert, already parsed (e.g. users/:id)
2210
+ * @param filePath - file path, defaults to path for convenience and testing
2211
+ */
2212
+ insertParsedPath(path: string, filePath?: string): TreeNode;
2213
+ /**
2214
+ * Saves a custom route block for a specific file path. The file path is used
2215
+ * as a key. Some special file paths will have a lower or higher priority.
2216
+ *
2217
+ * @param filePath - file path where the custom block is located
2218
+ * @param routeBlock - custom block to set
2219
+ */
2220
+ setCustomRouteBlock(filePath: string, routeBlock: CustomRouteBlock | undefined): void;
2221
+ /**
2222
+ * Generator that yields all descendants without sorting.
2223
+ * Use with Array.from() for now, native .map() support in Node 22+.
2224
+ */
2225
+ getChildrenDeep(): Generator<TreeNode>;
2226
+ /**
2227
+ * Comparator function for sorting TreeNodes.
2228
+ *
2229
+ * @internal
2230
+ */
2231
+ static compare(a: TreeNode, b: TreeNode): number;
2232
+ /**
2233
+ * Get the children of this node sorted by their path.
2234
+ */
2235
+ getChildrenSorted(): TreeNode[];
2236
+ /**
2237
+ * Calls {@link getChildrenDeep} and sorts the result by path in the end.
2238
+ */
2239
+ getChildrenDeepSorted(): TreeNode[];
2240
+ /**
2241
+ * Delete a child node. If the child node has no more children and no
2242
+ * components, it will be deleted as well. This is used to recursively delete
2243
+ * empty nodes after removing a route.
2244
+ *
2245
+ * @param child - child node to delete
2246
+ */
2247
+ protected deleteChild(child: TreeNode): void;
2248
+ /**
2249
+ * Delete and detach itself from the tree.
2250
+ */
2251
+ delete(): void;
2252
+ /**
2253
+ * Remove a route from the tree. The path shouldn't start with a `/` but it can be a nested one. e.g. `foo/bar`.
2254
+ * The `path` should be relative to the page folder.
2255
+ *
2256
+ * @param path - path segment of the file
2257
+ */
2258
+ remove(path: string): void;
2259
+ /**
2260
+ * Returns the route path of the node without parent paths. If the path was overridden, it returns the override.
2261
+ */
2262
+ get path(): string;
2263
+ /**
2264
+ * Returns the route path of the node including parent paths.
2265
+ */
2266
+ get fullPath(): string;
2267
+ /**
2268
+ * Returns the alias of the node
2269
+ */
2270
+ get alias(): string[];
2271
+ /**
2272
+ * Object of components (filepaths) for this node.
2273
+ */
2274
+ get components(): {
2275
+ [k: string]: string;
2276
+ };
2277
+ /**
2278
+ * Does this node render any component?
2279
+ */
2280
+ get hasComponents(): boolean;
2281
+ /**
2282
+ * Returns the route name of the node. If the name was overridden, it returns the override.
2283
+ */
2284
+ get name(): string | false;
2285
+ /**
2286
+ * Returns the meta property as an object.
2287
+ */
2288
+ get metaAsObject(): Readonly<RouteMeta>;
2289
+ /**
2290
+ * Returns the JSON string of the meta object of the node. If the meta was overridden, it returns the override. If
2291
+ * there is no override, it returns an empty string.
2292
+ */
2293
+ get meta(): string;
2294
+ /**
2295
+ * Array of route params for this node. It includes **all** the params from the parents as well.
2296
+ */
2297
+ get params(): (TreePathParam | TreeQueryParam)[];
2298
+ /**
2299
+ * Array of route params coming from the path. It includes all the params
2300
+ * from the parents as well. Use `node.value.pathParams` for the ones
2301
+ * declared by this specific node.
2302
+ */
2303
+ get pathParams(): TreePathParam[];
2304
+ /**
2305
+ * Array of query params extracted from definePage. It includes all the query
2306
+ * params from the parents as well. Use `node.value.queryParams` for the ones
2307
+ * declared by this specific node.
2308
+ */
2309
+ get queryParams(): TreeQueryParam[];
2310
+ /**
2311
+ * Generates a regexp based on this node and its parents. This regexp is used by the custom resolver
2312
+ */
2313
+ get regexp(): string;
2314
+ /**
2315
+ * Score of the path used for sorting routes.
2316
+ */
2317
+ get score(): number[][];
2318
+ /**
2319
+ * True if the last segment of the path is a splat (catch-all) param e.g.
2320
+ * /some/thing/:path(.*). Useful to compute the trailing slash behavior of
2321
+ * the route.
2322
+ */
2323
+ get endsWithSplat(): boolean;
2324
+ /**
2325
+ * Returns an array of matcher parts that is consumed by
2326
+ * MatcherPatternPathDynamic to render the path.
2327
+ */
2328
+ get matcherPatternPathDynamicParts(): TreeNodeValueMatcherPart;
2329
+ /**
2330
+ * Is this tree node matchable? A matchable node has at least one component
2331
+ * and a name.
2332
+ */
2333
+ isMatchable(): this is TreeNode & {
2334
+ name: string;
2335
+ };
2336
+ /**
2337
+ * Returns wether this tree node is the root node of the tree.
2338
+ *
2339
+ * @returns true if the node is the root node
2340
+ */
2341
+ isRoot(): this is PrefixTree;
2342
+ /**
2343
+ * Returns wether this tree node has a name. This allows to coerce the type
2344
+ * of TreeNode
2345
+ */
2346
+ isNamed(): this is TreeNodeNamed;
2347
+ toString(): string;
2348
+ /**
2349
+ * Iterates over the tree in a breadth-first way. It first yields the direct
2350
+ * children of the node, then their children and so on. The order of the
2351
+ * children is not guaranteed.
2352
+ */
2353
+ [Symbol.iterator](): Generator<TreeNode, void, unknown>;
2354
+ }
2355
+ /**
2356
+ * Creates a new prefix tree. This is meant to only be the root node. It has access to extra methods that only make
2357
+ * sense on the root node.
2358
+ */
2359
+ declare class PrefixTree extends TreeNode {
2360
+ map: Map<string, TreeNode>;
2361
+ constructor(options: ResolvedOptions);
2362
+ insert(path: string, filePath: string): TreeNode;
2363
+ /**
2364
+ * Returns the tree node of the given file path.
2365
+ *
2366
+ * @param filePath - file path of the tree node to get
2367
+ */
2368
+ getChild(filePath: string): TreeNode | undefined;
2369
+ /**
2370
+ * Removes the tree node of the given file path.
2371
+ *
2372
+ * @param filePath - file path of the tree node to remove
2373
+ */
2374
+ removeChild(filePath: string): void;
2375
+ }
2376
+ //#endregion
2377
+ //#region src/unplugin/core/utils.d.ts
2378
+ /**
2379
+ * Creates a name based of the node path segments.
2380
+ *
2381
+ * @param node - the node to get the path from
2382
+ * @param parent - the parent node
2383
+ * @returns a route name
2384
+ */
2385
+ declare function getPascalCaseRouteName(node: TreeNode): string;
2386
+ /**
2387
+ * Joins the path segments of a node into a name that corresponds to the filepath represented by the node.
2388
+ *
2389
+ * @param node - the node to get the path from
2390
+ * @returns a route name
2391
+ */
2392
+ declare function getFileBasedRouteName(node: TreeNode): string;
2393
+ //#endregion
2394
+ //#region src/unplugin/core/extendRoutes.d.ts
2395
+ /**
2396
+ * A route node that can be modified by the user. The tree can be iterated to be traversed.
2397
+ * @example
2398
+ * ```js
2399
+ * [...node] // creates an array of all the children
2400
+ * for (const child of node) {
2401
+ * // do something with the child node
2402
+ * }
2403
+ * ```
2404
+ *
2405
+ * @experimental
2406
+ */
2407
+ declare class EditableTreeNode {
2408
+ private node;
2409
+ constructor(node: TreeNode);
2410
+ /**
2411
+ * Remove and detach the current route node from the tree. Subsequently, its children will be removed as well.
2412
+ */
2413
+ delete(): void;
2414
+ /**
2415
+ * Inserts a new route as a child of this route. This route cannot use `definePage()`. If it was meant to be included,
2416
+ * add it to the `routesFolder` option.
2417
+ *
2418
+ * @param path - path segment to insert. Note this is relative to the current route. **It shouldn't start with `/`**. If it does, it will be added to the root of the tree.
2419
+ * @param filePath - file path
2420
+ * @returns the new editable route node
2421
+ */
2422
+ insert(path: string, filePath: string): EditableTreeNode;
2423
+ /**
2424
+ * Get an editable version of the parent node if it exists.
2425
+ */
2426
+ get parent(): EditableTreeNode | undefined;
2427
+ /**
2428
+ * Return a Map of the files associated to the current route. The key of the map represents the name of the view (Vue
2429
+ * Router feature) while the value is the **resolved** file path.
2430
+ * By default, the name of the view is `default`.
2431
+ */
2432
+ get components(): Map<string, string>;
2433
+ /**
2434
+ * Alias for `route.components.get('default')`.
2435
+ */
2436
+ get component(): string | undefined;
2437
+ /**
2438
+ * Name of the route. Note that **all routes are named** but when the final `routes` array is generated, routes
2439
+ * without a `component` will not include their `name` property to avoid accidentally navigating to them and display
2440
+ * nothing.
2441
+ * @see {@link isPassThrough}
2442
+ */
2443
+ get name(): string | false;
2444
+ /**
2445
+ * Override the route name. If not provided, the name will be generated based
2446
+ * on the file path. Can be set to `false` to make the route _anonymous_
2447
+ * which removes it from types and make the route unmatchable.
2448
+ */
2449
+ set name(name: string | undefined | false);
2450
+ /**
2451
+ * Whether the route is a pass-through route. A pass-through route is a route that does not have a component and is
2452
+ * used to group other routes under the same prefix `path` and/or `meta` properties.
2453
+ */
2454
+ get isPassThrough(): boolean;
2455
+ /**
2456
+ * Meta property of the route as an object. Note this property is readonly and will be serialized as JSON. It won't contain the meta properties defined with `definePage()` as it could contain expressions **but it does contain the meta properties defined with `<route>` blocks**.
2457
+ */
2458
+ get meta(): Readonly<RouteMeta>;
2459
+ /**
2460
+ * Override the meta property of the route. This will discard any other meta property defined with `<route>` blocks or
2461
+ * through other means. If you want to keep the existing meta properties, use `addToMeta`.
2462
+ * @see {@link addToMeta}
2463
+ */
2464
+ set meta(meta: RouteMeta);
2465
+ /**
2466
+ * Add meta properties to the route keeping the existing ones. The passed object will be deeply merged with the
2467
+ * existing meta object if any. Note that the meta property is later on serialized as JSON so you can't pass functions
2468
+ * or any other non-serializable value.
2469
+ */
2470
+ addToMeta(meta: Partial<RouteMeta>): void;
2471
+ /**
2472
+ * Path of the route without parent paths.
2473
+ */
2474
+ get path(): string;
2475
+ /**
2476
+ * Override the path of the route. You must ensure `params` match with the existing path.
2477
+ */
2478
+ set path(path: string);
2479
+ /**
2480
+ * Alias of the route.
2481
+ */
2482
+ get alias(): string[] | undefined;
2483
+ /**
2484
+ * Add an alias to the route.
2485
+ *
2486
+ * @param alias - Alias to add to the route
2487
+ */
2488
+ addAlias(alias: CustomRouteBlock['alias']): void;
2489
+ /**
2490
+ * Array of the route params and all of its parent's params. Note that
2491
+ * changing the params will not update the path, you need to update both.
2492
+ */
2493
+ get params(): TreePathParam[];
2494
+ /**
2495
+ * Path of the route including parent paths.
2496
+ */
2497
+ get fullPath(): string;
2498
+ /**
2499
+ * Computes an array of EditableTreeNode from the current node. Differently from iterating over the tree, this method
2500
+ * **only returns direct children**.
2501
+ */
2502
+ get children(): EditableTreeNode[];
2503
+ /**
2504
+ * DFS traversal of the tree.
2505
+ * @example
2506
+ * ```ts
2507
+ * for (const node of tree) {
2508
+ * // ...
2509
+ * }
2510
+ * ```
2511
+ */
2512
+ traverseDFS(): Generator<EditableTreeNode, void, unknown>;
2513
+ [Symbol.iterator](): Generator<EditableTreeNode, void, unknown>;
2514
+ /**
2515
+ * BFS traversal of the tree as a generator.
2516
+ *
2517
+ * @example
2518
+ * ```ts
2519
+ * for (const node of tree) {
2520
+ * // ...
2521
+ * }
2522
+ * ```
2523
+ */
2524
+ traverseBFS(): Generator<EditableTreeNode, void, unknown>;
2525
+ }
2526
+ //#endregion
2527
+ //#region src/unplugin/utils/index.d.ts
2528
+ /**
2529
+ * Maybe a promise maybe not
2530
+ * @internal
2531
+ */
2532
+ type _Awaitable<T> = T | PromiseLike<T>;
2533
+ //#endregion
2534
+ //#region src/unplugin/options.d.ts
2535
+ /**
2536
+ * Options for a routes folder.
2537
+ */
2538
+ interface RoutesFolderOption {
2539
+ /**
2540
+ * Folder to scan files that should be used for routes. **Cannot be a glob**, use the `path`, `filePatterns`, and
2541
+ * `exclude` options to filter out files. This section will **be removed** from the resulting path.
2542
+ */
2543
+ src: string;
2544
+ /**
2545
+ * Prefix to add to the route path **as is**. Defaults to `''`. Can also be a function
2546
+ * to reuse parts of the filepath, in that case you should return a **modified version of the filepath**.
2547
+ *
2548
+ * @example
2549
+ * ```js
2550
+ * {
2551
+ * src: 'src/pages',
2552
+ * // this is equivalent to the default behavior
2553
+ * path: (file) => file.slice(file.lastIndexOf('src/pages') + 'src/pages'.length
2554
+ * },
2555
+ * {
2556
+ * src: 'src/features',
2557
+ * // match all files (note the \ is not needed in real code)
2558
+ * filePatterns: '*‍/pages/**\/',
2559
+ * path: (file) => {
2560
+ * const prefix = 'src/features'
2561
+ * // remove the everything before src/features and removes /pages
2562
+ * // /src/features/feature1/pages/index.vue -> feature1/index.vue
2563
+ * return file.slice(file.lastIndexOf(prefix) + prefix.length + 1).replace('/pages', '')
2564
+ * },
2565
+ * },
2566
+ * {
2567
+ * src: 'src/docs',
2568
+ * // adds a prefix with a param
2569
+ * path: 'docs/[lang]/',
2570
+ * },
2571
+ * ```
2572
+ */
2573
+ path?: string | ((filepath: string) => string);
2574
+ /**
2575
+ * Allows to override the global `filePattern` option for this folder. It can also extend the global values by passing
2576
+ * a function that returns an array.
2577
+ */
2578
+ filePatterns?: _OverridableOption<string[], string | string[]>;
2579
+ /**
2580
+ * Allows to override the global `exclude` option for this folder. It can
2581
+ * also extend the global values by passing a function that returns an array.
2582
+ */
2583
+ exclude?: _OverridableOption<string[], string | string[]>;
2584
+ /**
2585
+ * Allows to override the global `extensions` option for this folder. It can
2586
+ * also extend the global values by passing a function that returns an array.
2587
+ * The provided extensions are removed from the final route. For example,
2588
+ * `.page.vue` allows to suffix all pages with `.page.vue` and remove it from
2589
+ * the route name.
2590
+ */
2591
+ extensions?: _OverridableOption<string[]>;
2592
+ }
2593
+ /**
2594
+ * Normalized options for a routes folder.
2595
+ */
2596
+ interface RoutesFolderOptionResolved extends RoutesFolderOption {
2597
+ path: string | ((filepath: string) => string);
2598
+ /**
2599
+ * Final glob pattern to match files in the folder.
2600
+ */
2601
+ pattern: string[];
2602
+ filePatterns: string[];
2603
+ exclude: string[];
2604
+ extensions: string[];
2605
+ }
2606
+ /**
2607
+ * An option that can be overridden by providing a function that receives the
2608
+ * existing value and returns a new one.
2609
+ *
2610
+ * @internal
2611
+ */
2612
+ type _OverridableOption<T, AllowedTypes = T> = AllowedTypes | ((existing: T) => T);
2613
+ /**
2614
+ * Resolves an overridable option by calling the function with the existing
2615
+ * value if it's a function, otherwise returning the passed `value`. If `value`
2616
+ * is undefined, it returns the `defaultValue` instead.
2617
+ *
2618
+ * @param defaultValue default value for the option
2619
+ * @param value and overridable option
2620
+ *
2621
+ * @internal
2622
+ */
2623
+ declare function resolveOverridableOption<T>(defaultValue: T, value?: _OverridableOption<T, T>): T;
2624
+ /**
2625
+ * @internal
2626
+ */
2627
+ type _RoutesFolder = string | RoutesFolderOption;
2628
+ /**
2629
+ * Type for the {@link Options.routesFolder} option.
2630
+ */
2631
+ type RoutesFolder = _RoutesFolder[] | _RoutesFolder;
2632
+ /**
2633
+ * vue-router plugin options.
2634
+ */
2635
+ interface Options {
2636
+ /**
2637
+ * Extensions of files to be considered as pages. Cannot be empty. This allows to strip a
2638
+ * bigger part of the filename e.g. `index.page.vue` -> `index` if an extension of `.page.vue` is provided.
2639
+ * @default `['.vue']`
2640
+ */
2641
+ extensions?: string[];
2642
+ /**
2643
+ * Folder(s) to scan for files and generate routes. Can also be an array if you want to add multiple
2644
+ * folders, or an object if you want to define a route prefix. Supports glob patterns but must be a folder, use
2645
+ * `extensions` and `exclude` to filter files.
2646
+ *
2647
+ * @default `"src/pages"`
2648
+ */
2649
+ routesFolder?: RoutesFolder;
2650
+ /**
2651
+ * Array of `picomatch` globs to ignore. Note the globs are relative to the cwd, so avoid writing
2652
+ * something like `['ignored']` to match folders named that way, instead provide a path similar to the `routesFolder`:
2653
+ * `['src/pages/ignored/**']` or use `['**​/ignored']` to match every folder named `ignored`.
2654
+ * @default `[]`
2655
+ */
2656
+ exclude?: string[] | string;
2657
+ /**
2658
+ * Pattern to match files in the `routesFolder`. Defaults to `*\/*` plus a
2659
+ * combination of all the possible extensions, e.g. `*\/*.{vue,md}` if
2660
+ * `extensions` is set to `['.vue', '.md']`. This is relative to the {@link
2661
+ * RoutesFolderOption['src']} and
2662
+ *
2663
+ * @default `['*\/*']`
2664
+ */
2665
+ filePatterns?: string[] | string;
2666
+ /**
2667
+ * Method to generate the name of a route. It's recommended to keep the default value to guarantee a consistent,
2668
+ * unique, and predictable naming.
2669
+ */
2670
+ getRouteName?: (node: TreeNode) => string;
2671
+ /**
2672
+ * Allows extending a route by modifying its node, adding children, or even deleting it. This will be invoked once for
2673
+ * each route.
2674
+ *
2675
+ * @param route - {@link EditableTreeNode} of the route to extend
2676
+ */
2677
+ extendRoute?: (route: EditableTreeNode) => _Awaitable<void>;
2678
+ /**
2679
+ * Allows to do some changes before writing the files. This will be invoked **every time** the files need to be written.
2680
+ *
2681
+ * @param rootRoute - {@link EditableTreeNode} of the root route
2682
+ */
2683
+ beforeWriteFiles?: (rootRoute: EditableTreeNode) => _Awaitable<void>;
2684
+ /**
2685
+ * Defines how page components should be imported. Defaults to dynamic imports to enable lazy loading of pages.
2686
+ * @default `'async'`
2687
+ */
2688
+ importMode?: 'sync' | 'async' | ((filepath: string) => 'sync' | 'async');
2689
+ /**
2690
+ * Root of the project. All paths are resolved relatively to this one.
2691
+ * @default `process.cwd()`
2692
+ */
2693
+ root?: string;
2694
+ /**
2695
+ * Language for `<route>` blocks in SFC files.
2696
+ * @default `'json5'`
2697
+ */
2698
+ routeBlockLang?: 'yaml' | 'yml' | 'json5' | 'json';
2699
+ /**
2700
+ * Should we generate d.ts files or ont. Defaults to `true` if `typescript` is installed. Can be set to a string of
2701
+ * the filepath to write the d.ts files to. By default it will generate a file named `typed-router.d.ts`.
2702
+ * @default `true`
2703
+ */
2704
+ dts?: boolean | string;
2705
+ /**
2706
+ * Allows inspection by vite-plugin-inspect by not adding the leading `\0` to the id of virtual modules.
2707
+ * @internal
2708
+ */
2709
+ _inspect?: boolean;
2710
+ /**
2711
+ * Activates debug logs.
2712
+ */
2713
+ logs?: boolean;
2714
+ /**
2715
+ * @inheritDoc ParseSegmentOptions
2716
+ */
2717
+ pathParser?: ParseSegmentOptions;
2718
+ /**
2719
+ * Whether to watch the files for changes.
2720
+ *
2721
+ * Defaults to `true` unless the `CI` environment variable is set.
2722
+ *
2723
+ * @default `!process.env.CI`
2724
+ */
2725
+ watch?: boolean;
2726
+ /**
2727
+ * Experimental options. **Warning**: these can change or be removed at any time, even it patch releases. Keep an eye
2728
+ * on the Changelog.
2729
+ */
2730
+ experimental?: {
2731
+ /**
2732
+ * (Vite only). File paths or globs where loaders are exported. This will be used to filter out imported loaders and
2733
+ * automatically re export them in page components. You can for example set this to `'src/loaders/**\/*'` (without
2734
+ * the backslash) to automatically re export any imported variable from files in the `src/loaders` folder within a
2735
+ * page component.
2736
+ */
2737
+ autoExportsDataLoaders?: string | string[];
2738
+ /**
2739
+ * Enable experimental support for the new custom resolvers and allows
2740
+ * defining custom param matchers.
2741
+ */
2742
+ paramParsers?: boolean | ParamParsersOptions;
2743
+ };
2744
+ }
2745
+ /**
2746
+ * Options for experimental param parsers.
2747
+ */
2748
+ interface ParamParsersOptions {
2749
+ /**
2750
+ * Folder(s) to scan for param matchers. Set to an empty array to disable the feature.
2751
+ *
2752
+ * @default `['src/params']`
2753
+ */
2754
+ dir?: string | string[];
2755
+ /**
2756
+ * Glob pattern(s) of files to include when scanning param parser folders. Only flat
2757
+ * matches are supported (no nested files).
2758
+ *
2759
+ * @default `['*.ts']`
2760
+ */
2761
+ include?: string | string[];
2762
+ /**
2763
+ * Glob pattern(s) of files to ignore when scanning param parser folders. Useful to skip
2764
+ * test files that live next to their implementations.
2765
+ *
2766
+ * @default `['*.test.{ts,js}', '*.spec.{ts,js}']`
2767
+ */
2768
+ exclude?: string | string[];
2769
+ }
2770
+ /**
2771
+ * Default options for experimental param parsers.
2772
+ */
2773
+ declare const DEFAULT_PARAM_PARSERS_OPTIONS: {
2774
+ dir: string[];
2775
+ include: string[];
2776
+ exclude: string[];
2777
+ };
2778
+ /**
2779
+ * Default plugin options.
2780
+ */
2781
+ declare const DEFAULT_OPTIONS: {
2782
+ extensions: string[];
2783
+ exclude: never[];
2784
+ routesFolder: string;
2785
+ filePatterns: string[];
2786
+ routeBlockLang: "json5";
2787
+ getRouteName: typeof getFileBasedRouteName;
2788
+ importMode: "async";
2789
+ root: string;
2790
+ dts: boolean;
2791
+ logs: false;
2792
+ _inspect: false;
2793
+ pathParser: {
2794
+ dotNesting: true;
2795
+ };
2796
+ watch: boolean;
2797
+ experimental: {};
2798
+ };
2799
+ /**
2800
+ * Expected server context provided to hooks.
2801
+ *
2802
+ * @internal
2803
+ */
2804
+ interface ServerContext {
2805
+ /**
2806
+ * Invalidates a module by its id.
2807
+ * @param module - module id to invalidate
2808
+ *
2809
+ * @returns A promise that resolves when the module is invalidated, or `false` if the module was not found.
2810
+ */
2811
+ invalidate: (module: string) => Promise<void> | false;
2812
+ /**
2813
+ * Invalidates all modules associated with a page file.
2814
+ * @param filepath - file path of the page to invalidate
2815
+ *
2816
+ * @returns A promise that resolves when the page is invalidated, or `false` if no modules were found for the page.
2817
+ */
2818
+ invalidatePage: (filepath: string) => Promise<void> | false;
2819
+ /**
2820
+ * Triggers HMR for the routes module.
2821
+ */
2822
+ updateRoutes: () => Promise<void>;
2823
+ /**
2824
+ * Triggers a full page reload.
2825
+ */
2826
+ reload: () => void;
2827
+ }
2828
+ /**
2829
+ * Normalize user options with defaults and resolved paths.
2830
+ *
2831
+ * @param options - user provided options
2832
+ * @returns normalized options
2833
+ */
2834
+ declare function resolveOptions(options: Options): {
2835
+ experimental: {
2836
+ autoExportsDataLoaders: string[] | undefined;
2837
+ paramParsers: {
2838
+ dir: string[];
2839
+ include: string[];
2840
+ exclude: string[];
2841
+ } | undefined;
2842
+ };
2843
+ routesFolder: {
2844
+ src: string;
2845
+ filePatterns: string[] | ((existing: string[]) => string[]) | undefined;
2846
+ exclude: string[] | ((existing: string[]) => string[]) | undefined;
2847
+ /**
2848
+ * Prefix to add to the route path **as is**. Defaults to `''`. Can also be a function
2849
+ * to reuse parts of the filepath, in that case you should return a **modified version of the filepath**.
2850
+ *
2851
+ * @example
2852
+ * ```js
2853
+ * {
2854
+ * src: 'src/pages',
2855
+ * // this is equivalent to the default behavior
2856
+ * path: (file) => file.slice(file.lastIndexOf('src/pages') + 'src/pages'.length
2857
+ * },
2858
+ * {
2859
+ * src: 'src/features',
2860
+ * // match all files (note the \ is not needed in real code)
2861
+ * filePatterns: '*‍/pages/**\/',
2862
+ * path: (file) => {
2863
+ * const prefix = 'src/features'
2864
+ * // remove the everything before src/features and removes /pages
2865
+ * // /src/features/feature1/pages/index.vue -> feature1/index.vue
2866
+ * return file.slice(file.lastIndexOf(prefix) + prefix.length + 1).replace('/pages', '')
2867
+ * },
2868
+ * },
2869
+ * {
2870
+ * src: 'src/docs',
2871
+ * // adds a prefix with a param
2872
+ * path: 'docs/[lang]/',
2873
+ * },
2874
+ * ```
2875
+ */
2876
+ path?: string | ((filepath: string) => string);
2877
+ /**
2878
+ * Allows to override the global `extensions` option for this folder. It can
2879
+ * also extend the global values by passing a function that returns an array.
2880
+ * The provided extensions are removed from the final route. For example,
2881
+ * `.page.vue` allows to suffix all pages with `.page.vue` and remove it from
2882
+ * the route name.
2883
+ */
2884
+ extensions?: _OverridableOption<string[]>;
2885
+ }[];
2886
+ filePatterns: string[];
2887
+ exclude: string[];
2888
+ extensions: string[];
2889
+ getRouteName: typeof getFileBasedRouteName;
2890
+ /**
2891
+ * Allows extending a route by modifying its node, adding children, or even deleting it. This will be invoked once for
2892
+ * each route.
2893
+ *
2894
+ * @param route - {@link EditableTreeNode} of the route to extend
2895
+ */
2896
+ extendRoute?: (route: EditableTreeNode) => _Awaitable<void>;
2897
+ /**
2898
+ * Allows to do some changes before writing the files. This will be invoked **every time** the files need to be written.
2899
+ *
2900
+ * @param rootRoute - {@link EditableTreeNode} of the root route
2901
+ */
2902
+ beforeWriteFiles?: (rootRoute: EditableTreeNode) => _Awaitable<void>;
2903
+ importMode: "sync" | "async" | ((filepath: string) => "sync" | "async");
2904
+ root: string;
2905
+ routeBlockLang: "yaml" | "yml" | "json5" | "json";
2906
+ dts: boolean | string;
2907
+ _inspect: boolean;
2908
+ logs: boolean;
2909
+ pathParser: ParseSegmentOptions;
2910
+ watch: boolean;
2911
+ };
2912
+ /**
2913
+ * @internal
2914
+ */
2915
+ type ResolvedOptions = ReturnType<typeof resolveOptions>;
2916
+ /**
2917
+ * Merge all the possible extensions as an array of unique values
2918
+ * @param options - user provided options
2919
+ * @internal
2920
+ */
2921
+ declare function mergeAllExtensions(options: ResolvedOptions): string[];
2922
+ //#endregion
2923
+ export { createTreeNodeValue as C, TreeNodeValueStatic as S, getPascalCaseRouteName as _, ResolvedOptions as a, TreeNodeValueGroup as b, RoutesFolderOptionResolved as c, _RoutesFolder as d, mergeAllExtensions as f, getFileBasedRouteName as g, EditableTreeNode as h, ParamParsersOptions as i, ServerContext as l, resolveOverridableOption as m, DEFAULT_PARAM_PARSERS_OPTIONS as n, RoutesFolder as o, resolveOptions as p, Options as r, RoutesFolderOption as s, DEFAULT_OPTIONS as t, _OverridableOption as u, TreeNode as v, TreeNodeValueParam as x, TreeNodeValue as y };