@nuxt/webpack-builder 3.20.2 → 3.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +5 -3
  2. package/dist/THIRD-PARTY-LICENSES.md +3847 -0
  3. package/dist/_chunks/libs/@babel/parser.d.mts +1536 -0
  4. package/dist/_chunks/libs/@jridgewell/trace-mapping.d.mts +82 -0
  5. package/dist/_chunks/libs/@types/estree.d.mts +525 -0
  6. package/dist/_chunks/libs/@types/pug.d.mts +123 -0
  7. package/dist/_chunks/libs/@unhead/vue.d.mts +1096 -0
  8. package/dist/_chunks/libs/@vitejs/plugin-vue-jsx.d.mts +5297 -0
  9. package/dist/_chunks/libs/@vitejs/plugin-vue.d.mts +83 -0
  10. package/dist/_chunks/libs/@volar/language-core.d.mts +56 -0
  11. package/dist/_chunks/libs/@volar/source-map.d.mts +10 -0
  12. package/dist/_chunks/libs/@vue/compiler-core.d.mts +1213 -0
  13. package/dist/_chunks/libs/@vue/compiler-dom.d.mts +45 -0
  14. package/dist/_chunks/libs/@vue/language-core.d.mts +11387 -0
  15. package/dist/_chunks/libs/c12.d.mts +147 -0
  16. package/dist/_chunks/libs/compatx.d.mts +47 -0
  17. package/dist/_chunks/libs/h3.d.mts +45 -0
  18. package/dist/_chunks/libs/ofetch.d.mts +870 -0
  19. package/dist/_chunks/libs/open.d.mts +1 -0
  20. package/dist/_chunks/libs/oxc-transform.d.mts +422 -0
  21. package/dist/_chunks/libs/pkg-types.d.mts +23 -0
  22. package/dist/_chunks/libs/rollup-plugin-visualizer.d.mts +90 -0
  23. package/dist/_chunks/libs/scule.d.mts +15 -0
  24. package/dist/_chunks/libs/unctx.d.mts +28 -0
  25. package/dist/_chunks/libs/unimport.d.mts +386 -0
  26. package/dist/_chunks/libs/untyped.d.mts +44 -0
  27. package/dist/_chunks/libs/vue-router.d.mts +1413 -0
  28. package/dist/_chunks/rolldown-runtime.mjs +12 -0
  29. package/dist/index.d.mts +3150 -4
  30. package/dist/index.mjs +1310 -1155
  31. package/dist/loaders/vue-module-identifier.mjs +11 -0
  32. package/package.json +31 -27
  33. package/dist/index.d.ts +0 -5
@@ -0,0 +1,1413 @@
1
+ import { AllowedComponentProps, AnchorHTMLAttributes, App, Component as Component$1, ComponentCustomProps, ComponentPublicInstance, ComputedRef, DefineComponent, MaybeRef, ShallowRef, UnwrapRef, VNode, VNodeProps } from "vue";
2
+
3
+ //#region ../../node_modules/.pnpm/vue-router@4.6.4_vue@3.5.27_typescript@5.9.3_/node_modules/vue-router/dist/router-CWoNjPRp.d.mts
4
+ /*!
5
+ * vue-router v4.6.4
6
+ * (c) 2025 Eduardo San Martin Morote
7
+ * @license MIT
8
+ */
9
+ //#region src/query.d.ts
10
+ /**
11
+ * Possible values in normalized {@link LocationQuery}. `null` renders the query
12
+ * param but without an `=`.
13
+ *
14
+ * @example
15
+ * ```
16
+ * ?isNull&isEmpty=&other=other
17
+ * gives
18
+ * `{ isNull: null, isEmpty: '', other: 'other' }`.
19
+ * ```
20
+ *
21
+ * @internal
22
+ */
23
+ type LocationQueryValue = string | null;
24
+ /**
25
+ * Possible values when defining a query. `undefined` allows to remove a value.
26
+ *
27
+ * @internal
28
+ */
29
+ type LocationQueryValueRaw = LocationQueryValue | number | undefined;
30
+ /**
31
+ * Normalized query object that appears in {@link RouteLocationNormalized}
32
+ *
33
+ * @public
34
+ */
35
+ type LocationQuery = Record<string, LocationQueryValue | LocationQueryValue[]>;
36
+ /**
37
+ * Loose {@link LocationQuery} object that can be passed to functions like
38
+ * {@link Router.push} and {@link Router.replace} or anywhere when creating a
39
+ * {@link RouteLocationRaw}
40
+ *
41
+ * @public
42
+ */
43
+ type LocationQueryRaw = Record<string | number, LocationQueryValueRaw | LocationQueryValueRaw[]>;
44
+ /**
45
+ * Transforms a queryString into a {@link LocationQuery} object. Accept both, a
46
+ * version with the leading `?` and without Should work as URLSearchParams
47
+
48
+ * @internal
49
+ *
50
+ * @param search - search string to parse
51
+ * @returns a query object
52
+ */
53
+ declare function parseQuery(search: string): LocationQuery;
54
+ /**
55
+ * Stringifies a {@link LocationQueryRaw} object. Like `URLSearchParams`, it
56
+ * doesn't prepend a `?`
57
+ *
58
+ * @internal
59
+ *
60
+ * @param query - query object to stringify
61
+ * @returns string version of the query without the leading `?`
62
+ */
63
+ declare function stringifyQuery(query: LocationQueryRaw | undefined): string; //#endregion
64
+ //#region src/config.d.ts
65
+ /**
66
+ * Allows customizing existing types of the router that are used globally like `$router`, `<RouterLink>`, etc. **ONLY FOR INTERNAL USAGE**.
67
+ *
68
+ * - `$router` - the router instance
69
+ * - `$route` - the current route location
70
+ * - `beforeRouteEnter` - Page component option
71
+ * - `beforeRouteUpdate` - Page component option
72
+ * - `beforeRouteLeave` - Page component option
73
+ * - `RouterLink` - RouterLink Component
74
+ * - `RouterView` - RouterView Component
75
+ *
76
+ * @internal
77
+ */
78
+ interface TypesConfig {} //#endregion
79
+ //#region src/typed-routes/route-map.d.ts
80
+ /**
81
+ * Helper type to define a Typed `RouteRecord`
82
+ * @see {@link RouteRecord}
83
+ */
84
+ interface RouteRecordInfo<Name extends string | symbol = string, Path extends string = string, ParamsRaw extends RouteParamsRawGeneric = RouteParamsRawGeneric, Params extends RouteParamsGeneric = RouteParamsGeneric, ChildrenNames extends string | symbol = never> {
85
+ name: Name;
86
+ path: Path;
87
+ paramsRaw: ParamsRaw;
88
+ params: Params;
89
+ childrenNames: ChildrenNames;
90
+ }
91
+ type RouteRecordInfoGeneric = RouteRecordInfo<string | symbol, string, RouteParamsRawGeneric, RouteParamsGeneric, string | symbol>;
92
+ /**
93
+ * Convenience type to get the typed RouteMap or a generic one if not provided. It is extracted from the {@link TypesConfig} if it exists, it becomes {@link RouteMapGeneric} otherwise.
94
+ */
95
+ type RouteMap = TypesConfig extends Record<'RouteNamedMap', infer RouteNamedMap> ? RouteNamedMap : RouteMapGeneric;
96
+ /**
97
+ * Generic version of the `RouteMap`.
98
+ */
99
+ type RouteMapGeneric = Record<string | symbol, RouteRecordInfoGeneric>; //#endregion
100
+ //#region src/typed-routes/params.d.ts
101
+ /**
102
+ * Utility type for raw and non raw params like :id+
103
+ *
104
+ */
105
+ //#endregion
106
+ //#region src/types/utils.d.ts
107
+ /**
108
+ * Creates a union type that still allows autocompletion for strings.
109
+ * @internal
110
+ */
111
+ type _LiteralUnion<LiteralType, BaseType extends string = string> = LiteralType | (BaseType & Record<never, never>);
112
+ /**
113
+ * Maybe a promise maybe not
114
+ * @internal
115
+ */
116
+ type _Awaitable<T> = T | PromiseLike<T>;
117
+ /**
118
+ * @internal
119
+ */
120
+ //#endregion
121
+ //#region src/typed-routes/route-records.d.ts
122
+ /**
123
+ * @internal
124
+ */
125
+ type RouteRecordRedirectOption = RouteLocationRaw | ((to: RouteLocation, from: RouteLocationNormalizedLoaded) => RouteLocationRaw);
126
+ /**
127
+ * Generic version of {@link RouteRecordName}.
128
+ */
129
+ type RouteRecordNameGeneric = string | symbol | undefined;
130
+ /**
131
+ * Possible values for a route record **after normalization**
132
+ *
133
+ * NOTE: since `RouteRecordName` is a type, it evaluates too early and it's often the generic version {@link RouteRecordNameGeneric}. If you need a typed version of all of the names of routes, use {@link RouteMap | `keyof RouteMap`}
134
+ */
135
+ /**
136
+ * @internal
137
+ */
138
+ type _RouteRecordProps<Name extends keyof RouteMap = keyof RouteMap> = boolean | Record<string, any> | ((to: RouteLocationNormalized<Name>) => Record<string, any>); //#endregion
139
+ //#region src/typed-routes/route-location.d.ts
140
+ /**
141
+ * Generic version of {@link RouteLocation}. It is used when no {@link RouteMap} is provided.
142
+ */
143
+ interface RouteLocationGeneric extends _RouteLocationBase, RouteLocationOptions {
144
+ /**
145
+ * Array of {@link RouteRecord} containing components as they were
146
+ * passed when adding records. It can also contain redirect records. This
147
+ * can't be used directly. **This property is non-enumerable**.
148
+ */
149
+ matched: RouteRecord[];
150
+ }
151
+ /**
152
+ * Helper to generate a type safe version of the {@link RouteLocation} type.
153
+ */
154
+ interface RouteLocationTyped<RouteMap$1 extends RouteMapGeneric, Name extends keyof RouteMap$1> extends RouteLocationGeneric {
155
+ name: Extract<Name, string | symbol>;
156
+ params: RouteMap$1[Name]['params'];
157
+ }
158
+ /**
159
+ * List of all possible {@link RouteLocation} indexed by the route name.
160
+ * @internal
161
+ */
162
+ type RouteLocationTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationTyped<RouteMap$1, N> };
163
+ /**
164
+ * Generic version of {@link RouteLocationNormalized} that is used when no {@link RouteMap} is provided.
165
+ */
166
+ interface RouteLocationNormalizedGeneric extends _RouteLocationBase {
167
+ name: RouteRecordNameGeneric;
168
+ /**
169
+ * Array of {@link RouteRecordNormalized}
170
+ */
171
+ matched: RouteRecordNormalized[];
172
+ }
173
+ /**
174
+ * Helper to generate a type safe version of the {@link RouteLocationNormalized} type.
175
+ */
176
+ interface RouteLocationNormalizedTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationNormalizedGeneric {
177
+ name: Extract<Name, string | symbol>;
178
+ params: RouteMap$1[Name]['params'];
179
+ /**
180
+ * Array of {@link RouteRecordNormalized}
181
+ */
182
+ matched: RouteRecordNormalized[];
183
+ }
184
+ /**
185
+ * List of all possible {@link RouteLocationNormalized} indexed by the route name.
186
+ * @internal
187
+ */
188
+ type RouteLocationNormalizedTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationNormalizedTyped<RouteMap$1, N> };
189
+ /**
190
+ * Generic version of {@link RouteLocationNormalizedLoaded} that is used when no {@link RouteMap} is provided.
191
+ */
192
+ interface RouteLocationNormalizedLoadedGeneric extends RouteLocationNormalizedGeneric {
193
+ /**
194
+ * Array of {@link RouteLocationMatched} containing only plain components (any
195
+ * lazy-loaded components have been loaded and were replaced inside the
196
+ * `components` object) so it can be directly used to display routes. It
197
+ * cannot contain redirect records either. **This property is non-enumerable**.
198
+ */
199
+ matched: RouteLocationMatched[];
200
+ }
201
+ /**
202
+ * Helper to generate a type safe version of the {@link RouteLocationNormalizedLoaded} type.
203
+ */
204
+ interface RouteLocationNormalizedLoadedTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationNormalizedLoadedGeneric {
205
+ name: Extract<Name, string | symbol>;
206
+ params: RouteMap$1[Name]['params'];
207
+ }
208
+ /**
209
+ * List of all possible {@link RouteLocationNormalizedLoaded} indexed by the route name.
210
+ * @internal
211
+ */
212
+ type RouteLocationNormalizedLoadedTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationNormalizedLoadedTyped<RouteMap$1, N> };
213
+ /**
214
+ * Generic version of {@link RouteLocationAsRelative}. It is used when no {@link RouteMap} is provided.
215
+ */
216
+ interface RouteLocationAsRelativeGeneric extends RouteQueryAndHash, RouteLocationOptions {
217
+ name?: RouteRecordNameGeneric;
218
+ params?: RouteParamsRawGeneric;
219
+ /**
220
+ * A relative path to the current location. This property should be removed
221
+ */
222
+ path?: undefined;
223
+ }
224
+ /**
225
+ * Helper to generate a type safe version of the {@link RouteLocationAsRelative} type.
226
+ */
227
+ interface RouteLocationAsRelativeTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationAsRelativeGeneric {
228
+ name?: Extract<Name, string | symbol>;
229
+ params?: RouteMap$1[Name]['paramsRaw'];
230
+ }
231
+ /**
232
+ * List of all possible {@link RouteLocationAsRelative} indexed by the route name.
233
+ * @internal
234
+ */
235
+ type RouteLocationAsRelativeTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationAsRelativeTyped<RouteMap$1, N> };
236
+ /**
237
+ * Generic version of {@link RouteLocationAsPath}. It is used when no {@link RouteMap} is provided.
238
+ */
239
+ interface RouteLocationAsPathGeneric extends RouteQueryAndHash, RouteLocationOptions {
240
+ /**
241
+ * Percentage encoded pathname section of the URL.
242
+ */
243
+ path: string;
244
+ }
245
+ /**
246
+ * Helper to generate a type safe version of the {@link RouteLocationAsPath} type.
247
+ */
248
+ interface RouteLocationAsPathTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> extends RouteLocationAsPathGeneric {
249
+ path: _LiteralUnion<RouteMap$1[Name]['path']>;
250
+ }
251
+ /**
252
+ * List of all possible {@link RouteLocationAsPath} indexed by the route name.
253
+ * @internal
254
+ */
255
+ type RouteLocationAsPathTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationAsPathTyped<RouteMap$1, N> };
256
+ /**
257
+ * Helper to generate a type safe version of the {@link RouteLocationAsString} type.
258
+ */
259
+ type RouteLocationAsStringTyped<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric, Name extends keyof RouteMap$1 = keyof RouteMap$1> = RouteMap$1[Name]['path'];
260
+ /**
261
+ * List of all possible {@link RouteLocationAsString} indexed by the route name.
262
+ * @internal
263
+ */
264
+ type RouteLocationAsStringTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationAsStringTyped<RouteMap$1, N> };
265
+ /**
266
+ * Generic version of {@link RouteLocationResolved}. It is used when no {@link RouteMap} is provided.
267
+ */
268
+ interface RouteLocationResolvedGeneric extends RouteLocationGeneric {
269
+ /**
270
+ * Resolved `href` for the route location that will be set on the `<a href="...">`.
271
+ */
272
+ href: string;
273
+ }
274
+ /**
275
+ * Helper to generate a type safe version of the {@link RouteLocationResolved} type.
276
+ */
277
+ interface RouteLocationResolvedTyped<RouteMap$1 extends RouteMapGeneric, Name extends keyof RouteMap$1> extends RouteLocationTyped<RouteMap$1, Name> {
278
+ /**
279
+ * Resolved `href` for the route location that will be set on the `<a href="...">`.
280
+ */
281
+ href: string;
282
+ }
283
+ /**
284
+ * List of all possible {@link RouteLocationResolved} indexed by the route name.
285
+ * @internal
286
+ */
287
+ type RouteLocationResolvedTypedList<RouteMap$1 extends RouteMapGeneric = RouteMapGeneric> = { [N in keyof RouteMap$1]: RouteLocationResolvedTyped<RouteMap$1, N> };
288
+ /**
289
+ * 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.
290
+ */
291
+ /**
292
+ * {@link RouteLocationRaw} resolved using the matcher
293
+ */
294
+ type RouteLocation<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationGeneric : RouteLocationTypedList<RouteMap>[Name];
295
+ /**
296
+ * Similar to {@link RouteLocation} but its
297
+ * {@link RouteLocationNormalizedTyped.matched | `matched` property} cannot contain redirect records
298
+ */
299
+ type RouteLocationNormalized<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedGeneric : RouteLocationNormalizedTypedList<RouteMap>[Name];
300
+ /**
301
+ * Similar to {@link RouteLocationNormalized} but its `components` do not contain any function to lazy load components.
302
+ * In other words, it's ready to be rendered by `<RouterView>`.
303
+ */
304
+ type RouteLocationNormalizedLoaded<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationNormalizedLoadedGeneric : RouteLocationNormalizedLoadedTypedList<RouteMap>[Name];
305
+ /**
306
+ * Route location relative to the current location. It accepts other properties than `path` like `params`, `query` and
307
+ * `hash` to conveniently change them.
308
+ */
309
+ type RouteLocationAsRelative<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsRelativeGeneric : RouteLocationAsRelativeTypedList<RouteMap>[Name];
310
+ /**
311
+ * Route location resolved with {@link Router | `router.resolve()`}.
312
+ */
313
+ type RouteLocationResolved<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationResolvedGeneric : RouteLocationResolvedTypedList<RouteMap>[Name];
314
+ /**
315
+ * Same as {@link RouteLocationAsPath} but as a string literal.
316
+ */
317
+ type RouteLocationAsString<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? string : _LiteralUnion<RouteLocationAsStringTypedList<RouteMap>[Name], string>;
318
+ /**
319
+ * Route location as an object with a `path` property.
320
+ */
321
+ type RouteLocationAsPath<Name extends keyof RouteMap = keyof RouteMap> = RouteMapGeneric extends RouteMap ? RouteLocationAsPathGeneric : RouteLocationAsPathTypedList<RouteMap>[Name];
322
+ /**
323
+ * Route location that can be passed to `router.push()` and other user-facing APIs.
324
+ */
325
+ 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]; //#endregion
326
+ //#region src/typed-routes/navigation-guards.d.ts
327
+ /**
328
+ * Return types for a Navigation Guard. Based on `TypesConfig`
329
+ *
330
+ * @see {@link TypesConfig}
331
+ */
332
+ type NavigationGuardReturn = void | Error | boolean | RouteLocationRaw;
333
+ /**
334
+ * Navigation Guard with a type parameter for `this`.
335
+ * @see {@link TypesConfig}
336
+ */
337
+ interface NavigationGuardWithThis<T> {
338
+ (this: T, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, next: NavigationGuardNext): _Awaitable<NavigationGuardReturn>;
339
+ }
340
+ /**
341
+ * Navigation Guard.
342
+ */
343
+ interface NavigationGuard {
344
+ (to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, next: NavigationGuardNext): _Awaitable<NavigationGuardReturn>;
345
+ }
346
+ /**
347
+ * Navigation hook triggered after a navigation is settled.
348
+ */
349
+ interface NavigationHookAfter {
350
+ (to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, failure?: NavigationFailure | void): unknown;
351
+ }
352
+ /**
353
+ * `next()` callback passed to navigation guards.
354
+ */
355
+ interface NavigationGuardNext {
356
+ (): void;
357
+ (error: Error): void;
358
+ (location: RouteLocationRaw): void;
359
+ (valid: boolean | undefined): void;
360
+ (cb: NavigationGuardNextCallback): void;
361
+ }
362
+ /**
363
+ * Callback that can be passed to `next()` in `beforeRouteEnter()` guards.
364
+ */
365
+ type NavigationGuardNextCallback = (vm: ComponentPublicInstance) => unknown; //#endregion
366
+ //#region src/matcher/types.d.ts
367
+ /**
368
+ * Normalized version of a {@link RouteRecord | route record}.
369
+ */
370
+ interface RouteRecordNormalized {
371
+ /**
372
+ * {@inheritDoc _RouteRecordBase.path}
373
+ */
374
+ path: _RouteRecordBase['path'];
375
+ /**
376
+ * {@inheritDoc _RouteRecordBase.redirect}
377
+ */
378
+ redirect: _RouteRecordBase['redirect'] | undefined;
379
+ /**
380
+ * {@inheritDoc _RouteRecordBase.name}
381
+ */
382
+ name: _RouteRecordBase['name'];
383
+ /**
384
+ * {@inheritDoc RouteRecordMultipleViews.components}
385
+ */
386
+ components: RouteRecordMultipleViews['components'] | null | undefined;
387
+ /**
388
+ * Contains the original modules for lazy loaded components.
389
+ * @internal
390
+ */
391
+ mods: Record<string, unknown>;
392
+ /**
393
+ * Nested route records.
394
+ */
395
+ children: RouteRecordRaw[];
396
+ /**
397
+ * {@inheritDoc _RouteRecordBase.meta}
398
+ */
399
+ meta: Exclude<_RouteRecordBase['meta'], void>;
400
+ /**
401
+ * {@inheritDoc RouteRecordMultipleViews.props}
402
+ */
403
+ props: Record<string, _RouteRecordProps>;
404
+ /**
405
+ * Registered beforeEnter guards
406
+ */
407
+ beforeEnter: _RouteRecordBase['beforeEnter'];
408
+ /**
409
+ * Registered leave guards
410
+ *
411
+ * @internal
412
+ */
413
+ leaveGuards: Set<NavigationGuard>;
414
+ /**
415
+ * Registered update guards
416
+ *
417
+ * @internal
418
+ */
419
+ updateGuards: Set<NavigationGuard>;
420
+ /**
421
+ * Registered beforeRouteEnter callbacks passed to `next` or returned in guards
422
+ *
423
+ * @internal
424
+ */
425
+ enterCallbacks: Record<string, NavigationGuardNextCallback[]>;
426
+ /**
427
+ * Mounted route component instances
428
+ * Having the instances on the record mean beforeRouteUpdate and
429
+ * beforeRouteLeave guards can only be invoked with the latest mounted app
430
+ * instance if there are multiple application instances rendering the same
431
+ * view, basically duplicating the content on the page, which shouldn't happen
432
+ * in practice. It will work if multiple apps are rendering different named
433
+ * views.
434
+ */
435
+ instances: Record<string, ComponentPublicInstance | undefined | null>;
436
+ /**
437
+ * Defines if this record is the alias of another one. This property is
438
+ * `undefined` if the record is the original one.
439
+ */
440
+ aliasOf: RouteRecordNormalized | undefined;
441
+ }
442
+ /**
443
+ * {@inheritDoc RouteRecordNormalized}
444
+ */
445
+ type RouteRecord = RouteRecordNormalized; //#endregion
446
+ //#region src/matcher/pathParserRanker.d.ts
447
+ /**
448
+ * @internal
449
+ */
450
+ interface _PathParserOptions {
451
+ /**
452
+ * Makes the RegExp case-sensitive.
453
+ *
454
+ * @defaultValue `false`
455
+ */
456
+ sensitive?: boolean;
457
+ /**
458
+ * Whether to disallow a trailing slash or not.
459
+ *
460
+ * @defaultValue `false`
461
+ */
462
+ strict?: boolean;
463
+ /**
464
+ * Should the RegExp match from the beginning by prepending a `^` to it.
465
+ * @internal
466
+ *
467
+ * @defaultValue `true`
468
+ */
469
+ start?: boolean;
470
+ /**
471
+ * Should the RegExp match until the end by appending a `$` to it.
472
+ *
473
+ * @deprecated this option will alsways be `true` in the future. Open a discussion in vuejs/router if you need this to be `false`
474
+ *
475
+ * @defaultValue `true`
476
+ */
477
+ end?: boolean;
478
+ }
479
+ type PathParserOptions = Pick<_PathParserOptions, 'end' | 'sensitive' | 'strict'>; //#endregion
480
+ //#region src/matcher/pathMatcher.d.ts
481
+ //#endregion
482
+ //#region src/history/common.d.ts
483
+ type HistoryLocation = string;
484
+ /**
485
+ * Allowed variables in HTML5 history state. Note that pushState clones the state
486
+ * passed and does not accept everything: e.g.: it doesn't accept symbols, nor
487
+ * functions as values. It also ignores Symbols as keys.
488
+ *
489
+ * @internal
490
+ */
491
+ type HistoryStateValue = string | number | boolean | null | undefined | HistoryState | HistoryStateArray;
492
+ /**
493
+ * Allowed HTML history.state
494
+ */
495
+ interface HistoryState {
496
+ [x: number]: HistoryStateValue;
497
+ [x: string]: HistoryStateValue;
498
+ }
499
+ /**
500
+ * Allowed arrays for history.state.
501
+ *
502
+ * @internal
503
+ */
504
+ interface HistoryStateArray extends Array<HistoryStateValue> {}
505
+ declare enum NavigationType {
506
+ pop = "pop",
507
+ push = "push"
508
+ }
509
+ declare enum NavigationDirection {
510
+ back = "back",
511
+ forward = "forward",
512
+ unknown = ""
513
+ }
514
+ interface NavigationInformation {
515
+ type: NavigationType;
516
+ direction: NavigationDirection;
517
+ delta: number;
518
+ }
519
+ interface NavigationCallback {
520
+ (to: HistoryLocation, from: HistoryLocation, information: NavigationInformation): void;
521
+ }
522
+ /**
523
+ * Interface implemented by History implementations that can be passed to the
524
+ * router as {@link Router.history}
525
+ *
526
+ * @alpha
527
+ */
528
+ interface RouterHistory {
529
+ /**
530
+ * Base path that is prepended to every url. This allows hosting an SPA at a
531
+ * sub-folder of a domain like `example.com/sub-folder` by having a `base` of
532
+ * `/sub-folder`
533
+ */
534
+ readonly base: string;
535
+ /**
536
+ * Current History location
537
+ */
538
+ readonly location: HistoryLocation;
539
+ /**
540
+ * Current History state
541
+ */
542
+ readonly state: HistoryState;
543
+ /**
544
+ * Navigates to a location. In the case of an HTML5 History implementation,
545
+ * this will call `history.pushState` to effectively change the URL.
546
+ *
547
+ * @param to - location to push
548
+ * @param data - optional {@link HistoryState} to be associated with the
549
+ * navigation entry
550
+ */
551
+ push(to: HistoryLocation, data?: HistoryState): void;
552
+ /**
553
+ * Same as {@link RouterHistory.push} but performs a `history.replaceState`
554
+ * instead of `history.pushState`
555
+ *
556
+ * @param to - location to set
557
+ * @param data - optional {@link HistoryState} to be associated with the
558
+ * navigation entry
559
+ */
560
+ replace(to: HistoryLocation, data?: HistoryState): void;
561
+ /**
562
+ * Traverses history in a given direction.
563
+ *
564
+ * @example
565
+ * ```js
566
+ * myHistory.go(-1) // equivalent to window.history.back()
567
+ * myHistory.go(1) // equivalent to window.history.forward()
568
+ * ```
569
+ *
570
+ * @param delta - distance to travel. If delta is \< 0, it will go back,
571
+ * if it's \> 0, it will go forward by that amount of entries.
572
+ * @param triggerListeners - whether this should trigger listeners attached to
573
+ * the history
574
+ */
575
+ go(delta: number, triggerListeners?: boolean): void;
576
+ /**
577
+ * Attach a listener to the History implementation that is triggered when the
578
+ * navigation is triggered from outside (like the Browser back and forward
579
+ * buttons) or when passing `true` to {@link RouterHistory.back} and
580
+ * {@link RouterHistory.forward}
581
+ *
582
+ * @param callback - listener to attach
583
+ * @returns a callback to remove the listener
584
+ */
585
+ listen(callback: NavigationCallback): () => void;
586
+ /**
587
+ * Generates the corresponding href to be used in an anchor tag.
588
+ *
589
+ * @param location - history location that should create an href
590
+ */
591
+ createHref(location: HistoryLocation): string;
592
+ /**
593
+ * Clears any event listener attached by the history implementation.
594
+ */
595
+ destroy(): void;
596
+ } //#endregion
597
+ //#region src/types/index.d.ts
598
+ type Lazy<T> = () => Promise<T>;
599
+ /**
600
+ * @internal
601
+ */
602
+ type RouteParamValue = string;
603
+ /**
604
+ * @internal
605
+ */
606
+ type RouteParamValueRaw = RouteParamValue | number | null | undefined;
607
+ type RouteParamsGeneric = Record<string, RouteParamValue | RouteParamValue[]>;
608
+ type RouteParamsRawGeneric = Record<string, RouteParamValueRaw | Exclude<RouteParamValueRaw, null | undefined>[]>;
609
+ /**
610
+ * @internal
611
+ */
612
+ interface RouteQueryAndHash {
613
+ query?: LocationQueryRaw;
614
+ hash?: string;
615
+ }
616
+ /**
617
+ * @internal
618
+ */
619
+ /**
620
+ * Common options for all navigation methods.
621
+ */
622
+ interface RouteLocationOptions {
623
+ /**
624
+ * Replace the entry in the history instead of pushing a new entry
625
+ */
626
+ replace?: boolean;
627
+ /**
628
+ * Triggers the navigation even if the location is the same as the current one.
629
+ * Note this will also add a new entry to the history unless `replace: true`
630
+ * is passed.
631
+ */
632
+ force?: boolean;
633
+ /**
634
+ * State to save using the History API. This cannot contain any reactive
635
+ * values and some primitives like Symbols are forbidden. More info at
636
+ * https://developer.mozilla.org/en-US/docs/Web/API/History/state
637
+ */
638
+ state?: HistoryState;
639
+ }
640
+ /**
641
+ * Route Location that can infer the necessary params based on the name.
642
+ *
643
+ * @internal
644
+ */
645
+ interface RouteLocationMatched extends RouteRecordNormalized {
646
+ components: Record<string, RouteComponent> | null | undefined;
647
+ }
648
+ /**
649
+ * Base properties for a normalized route location.
650
+ *
651
+ * @internal
652
+ */
653
+ interface _RouteLocationBase extends Pick<MatcherLocation, 'name' | 'path' | 'params' | 'meta'> {
654
+ /**
655
+ * The whole location including the `search` and `hash`. This string is
656
+ * percentage encoded.
657
+ */
658
+ fullPath: string;
659
+ /**
660
+ * Object representation of the `search` property of the current location.
661
+ */
662
+ query: LocationQuery;
663
+ /**
664
+ * Hash of the current location. If present, starts with a `#`.
665
+ */
666
+ hash: string;
667
+ /**
668
+ * Contains the location we were initially trying to access before ending up
669
+ * on the current location.
670
+ */
671
+ redirectedFrom: RouteLocation | undefined;
672
+ }
673
+ /**
674
+ * Allowed Component in {@link RouteLocationMatched}
675
+ */
676
+ type RouteComponent = Component$1 | DefineComponent;
677
+ /**
678
+ * Allowed Component definitions in route records provided by the user
679
+ */
680
+ type RawRouteComponent = RouteComponent | Lazy<RouteComponent>;
681
+ /**
682
+ * Internal type for common properties among all kind of {@link RouteRecordRaw}.
683
+ */
684
+ interface _RouteRecordBase extends PathParserOptions {
685
+ /**
686
+ * Path of the record. Should start with `/` unless the record is the child of
687
+ * another record.
688
+ *
689
+ * @example `/users/:id` matches `/users/1` as well as `/users/posva`.
690
+ */
691
+ path: string;
692
+ /**
693
+ * Where to redirect if the route is directly matched. The redirection happens
694
+ * before any navigation guard and triggers a new navigation with the new
695
+ * target location.
696
+ */
697
+ redirect?: RouteRecordRedirectOption;
698
+ /**
699
+ * Aliases for the record. Allows defining extra paths that will behave like a
700
+ * copy of the record. Allows having paths shorthands like `/users/:id` and
701
+ * `/u/:id`. All `alias` and `path` values must share the same params.
702
+ */
703
+ alias?: string | string[];
704
+ /**
705
+ * Name for the route record. Must be unique.
706
+ */
707
+ name?: RouteRecordNameGeneric;
708
+ /**
709
+ * Before Enter guard specific to this record. Note `beforeEnter` has no
710
+ * effect if the record has a `redirect` property.
711
+ */
712
+ beforeEnter?: NavigationGuardWithThis<undefined> | NavigationGuardWithThis<undefined>[];
713
+ /**
714
+ * Arbitrary data attached to the record.
715
+ */
716
+ meta?: RouteMeta;
717
+ /**
718
+ * Array of nested routes.
719
+ */
720
+ children?: RouteRecordRaw[];
721
+ /**
722
+ * Allow passing down params as props to the component rendered by `router-view`.
723
+ */
724
+ props?: _RouteRecordProps | Record<string, _RouteRecordProps>;
725
+ }
726
+ /**
727
+ * Interface to type `meta` fields in route records.
728
+ *
729
+ * @example
730
+ *
731
+ * ```ts
732
+ * // typings.d.ts or router.ts
733
+ * import 'vue-router';
734
+ *
735
+ * declare module 'vue-router' {
736
+ * interface RouteMeta {
737
+ * requiresAuth?: boolean
738
+ * }
739
+ * }
740
+ * ```
741
+ */
742
+ interface RouteMeta extends Record<PropertyKey, unknown> {}
743
+ /**
744
+ * Route Record defining one single component with the `component` option.
745
+ */
746
+ interface RouteRecordSingleView extends _RouteRecordBase {
747
+ /**
748
+ * Component to display when the URL matches this route.
749
+ */
750
+ component: RawRouteComponent;
751
+ components?: never;
752
+ children?: never;
753
+ redirect?: never;
754
+ /**
755
+ * Allow passing down params as props to the component rendered by `router-view`.
756
+ */
757
+ props?: _RouteRecordProps;
758
+ }
759
+ /**
760
+ * Route Record defining one single component with a nested view. Differently
761
+ * from {@link RouteRecordSingleView}, this record has children and allows a
762
+ * `redirect` option.
763
+ */
764
+ interface RouteRecordSingleViewWithChildren extends _RouteRecordBase {
765
+ /**
766
+ * Component to display when the URL matches this route.
767
+ */
768
+ component?: RawRouteComponent | null | undefined;
769
+ components?: never;
770
+ children: RouteRecordRaw[];
771
+ /**
772
+ * Allow passing down params as props to the component rendered by `router-view`.
773
+ */
774
+ props?: _RouteRecordProps;
775
+ }
776
+ /**
777
+ * Route Record defining multiple named components with the `components` option.
778
+ */
779
+ interface RouteRecordMultipleViews extends _RouteRecordBase {
780
+ /**
781
+ * Components to display when the URL matches this route. Allow using named views.
782
+ */
783
+ components: Record<string, RawRouteComponent>;
784
+ component?: never;
785
+ children?: never;
786
+ redirect?: never;
787
+ /**
788
+ * Allow passing down params as props to the component rendered by
789
+ * `router-view`. Should be an object with the same keys as `components` or a
790
+ * boolean to be applied to every component.
791
+ */
792
+ props?: Record<string, _RouteRecordProps> | boolean;
793
+ }
794
+ /**
795
+ * Route Record defining multiple named components with the `components` option and children.
796
+ */
797
+ interface RouteRecordMultipleViewsWithChildren extends _RouteRecordBase {
798
+ /**
799
+ * Components to display when the URL matches this route. Allow using named views.
800
+ */
801
+ components?: Record<string, RawRouteComponent> | null | undefined;
802
+ component?: never;
803
+ children: RouteRecordRaw[];
804
+ /**
805
+ * Allow passing down params as props to the component rendered by
806
+ * `router-view`. Should be an object with the same keys as `components` or a
807
+ * boolean to be applied to every component.
808
+ */
809
+ props?: Record<string, _RouteRecordProps> | boolean;
810
+ }
811
+ /**
812
+ * Route Record that defines a redirect. Cannot have `component` or `components`
813
+ * as it is never rendered.
814
+ */
815
+ interface RouteRecordRedirect extends _RouteRecordBase {
816
+ redirect: RouteRecordRedirectOption;
817
+ component?: never;
818
+ components?: never;
819
+ props?: never;
820
+ }
821
+ type RouteRecordRaw = RouteRecordSingleView | RouteRecordSingleViewWithChildren | RouteRecordMultipleViews | RouteRecordMultipleViewsWithChildren | RouteRecordRedirect;
822
+ /**
823
+ * Route location that can be passed to the matcher.
824
+ */
825
+ /**
826
+ * Normalized/resolved Route location that returned by the matcher.
827
+ */
828
+ interface MatcherLocation {
829
+ /**
830
+ * Name of the matched record
831
+ */
832
+ name: RouteRecordNameGeneric | null | undefined;
833
+ /**
834
+ * Percentage encoded pathname section of the URL.
835
+ */
836
+ path: string;
837
+ /**
838
+ * Object of decoded params extracted from the `path`.
839
+ */
840
+ params: RouteParamsGeneric;
841
+ /**
842
+ * Merged `meta` properties from all the matched route records.
843
+ */
844
+ meta: RouteMeta;
845
+ /**
846
+ * Array of {@link RouteRecord} containing components as they were
847
+ * passed when adding records. It can also contain redirect records. This
848
+ * can't be used directly
849
+ */
850
+ matched: RouteRecord[];
851
+ } //#endregion
852
+ //#region src/errors.d.ts
853
+ /**
854
+ * Flags so we can combine them when checking for multiple errors. This is the internal version of
855
+ * {@link NavigationFailureType}.
856
+ *
857
+ * @internal
858
+ */
859
+ declare const enum ErrorTypes {
860
+ MATCHER_NOT_FOUND = 1,
861
+ NAVIGATION_GUARD_REDIRECT = 2,
862
+ NAVIGATION_ABORTED = 4,
863
+ NAVIGATION_CANCELLED = 8,
864
+ NAVIGATION_DUPLICATED = 16
865
+ }
866
+ /**
867
+ * Enumeration with all possible types for navigation failures. Can be passed to
868
+ * {@link isNavigationFailure} to check for specific failures.
869
+ */
870
+ /**
871
+ * Extended Error that contains extra information regarding a failed navigation.
872
+ */
873
+ interface NavigationFailure extends Error {
874
+ /**
875
+ * Type of the navigation. One of {@link NavigationFailureType}
876
+ */
877
+ type: ErrorTypes.NAVIGATION_CANCELLED | ErrorTypes.NAVIGATION_ABORTED | ErrorTypes.NAVIGATION_DUPLICATED;
878
+ /**
879
+ * Route location we were navigating from
880
+ */
881
+ from: RouteLocationNormalized;
882
+ /**
883
+ * Route location we were navigating to
884
+ */
885
+ to: RouteLocationNormalized;
886
+ }
887
+ /**
888
+ * Internal error used to detect a redirection.
889
+ *
890
+ * @internal
891
+ */
892
+ /**
893
+ * Internal type to define an ErrorHandler
894
+ *
895
+ * @param error - error thrown
896
+ * @param to - location we were navigating to when the error happened
897
+ * @param from - location we were navigating from when the error happened
898
+ * @internal
899
+ */
900
+ interface _ErrorListener {
901
+ (error: any, to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded): any;
902
+ } //#endregion
903
+ //#region src/scrollBehavior.d.ts
904
+ /**
905
+ * Scroll position similar to
906
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/ScrollToOptions | `ScrollToOptions`}.
907
+ * Note that not all browsers support `behavior`.
908
+ */
909
+ type ScrollPositionCoordinates = {
910
+ behavior?: ScrollOptions['behavior'];
911
+ left?: number;
912
+ top?: number;
913
+ };
914
+ /**
915
+ * Internal normalized version of {@link ScrollPositionCoordinates} that always
916
+ * has `left` and `top` coordinates. Must be a type to be assignable to HistoryStateValue.
917
+ *
918
+ * @internal
919
+ */
920
+ type _ScrollPositionNormalized = {
921
+ behavior?: ScrollOptions['behavior'];
922
+ left: number;
923
+ top: number;
924
+ };
925
+ /**
926
+ * Type of the `scrollBehavior` option that can be passed to `createRouter`.
927
+ */
928
+ interface RouterScrollBehavior {
929
+ /**
930
+ * @param to - Route location where we are navigating to
931
+ * @param from - Route location where we are navigating from
932
+ * @param savedPosition - saved position if it exists, `null` otherwise
933
+ */
934
+ (to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, savedPosition: _ScrollPositionNormalized | null): Awaitable<ScrollPosition | false | void>;
935
+ }
936
+ interface ScrollPositionElement extends ScrollToOptions {
937
+ /**
938
+ * A valid CSS selector. Note some characters must be escaped in id selectors (https://mathiasbynens.be/notes/css-escapes).
939
+ * @example
940
+ * Here are a few examples:
941
+ *
942
+ * - `.title`
943
+ * - `.content:first-child`
944
+ * - `#marker`
945
+ * - `#marker\~with\~symbols`
946
+ * - `#marker.with.dot`: selects `class="with dot" id="marker"`, not `id="marker.with.dot"`
947
+ *
948
+ */
949
+ el: string | Element;
950
+ }
951
+ type ScrollPosition = ScrollPositionCoordinates | ScrollPositionElement;
952
+ type Awaitable<T> = T | PromiseLike<T>; //#endregion
953
+ //#region src/experimental/route-resolver/matchers/param-parsers/types.d.ts
954
+ /**
955
+ * Defines a parser that can read a param from the url (string-based) and
956
+ * transform it into a more complex type, or vice versa.
957
+ *
958
+ * @see MatcherPattern
959
+ */
960
+ //#endregion
961
+ //#region src/experimental/router.d.ts
962
+ /**
963
+ * Options to initialize a {@link Router} instance.
964
+ */
965
+ interface EXPERIMENTAL_RouterOptions_Base extends PathParserOptions {
966
+ /**
967
+ * History implementation used by the router. Most web applications should use
968
+ * `createWebHistory` but it requires the server to be properly configured.
969
+ * You can also use a _hash_ based history with `createWebHashHistory` that
970
+ * does not require any configuration on the server but isn't handled at all
971
+ * by search engines and does poorly on SEO.
972
+ *
973
+ * @example
974
+ * ```js
975
+ * createRouter({
976
+ * history: createWebHistory(),
977
+ * // other options...
978
+ * })
979
+ * ```
980
+ */
981
+ history: RouterHistory;
982
+ /**
983
+ * Function to control scrolling when navigating between pages. Can return a
984
+ * Promise to delay scrolling.
985
+ *
986
+ * @see {@link RouterScrollBehavior}.
987
+ *
988
+ * @example
989
+ * ```js
990
+ * function scrollBehavior(to, from, savedPosition) {
991
+ * // `to` and `from` are both route locations
992
+ * // `savedPosition` can be null if there isn't one
993
+ * }
994
+ * ```
995
+ */
996
+ scrollBehavior?: RouterScrollBehavior;
997
+ /**
998
+ * Custom implementation to parse a query. See its counterpart,
999
+ * {@link EXPERIMENTAL_RouterOptions_Base.stringifyQuery}.
1000
+ *
1001
+ * @example
1002
+ * Let's say you want to use the [qs package](https://github.com/ljharb/qs)
1003
+ * to parse queries, you can provide both `parseQuery` and `stringifyQuery`:
1004
+ * ```js
1005
+ * import qs from 'qs'
1006
+ *
1007
+ * createRouter({
1008
+ * // other options...
1009
+ * parseQuery: qs.parse,
1010
+ * stringifyQuery: qs.stringify,
1011
+ * })
1012
+ * ```
1013
+ */
1014
+ parseQuery?: typeof parseQuery;
1015
+ /**
1016
+ * Custom implementation to stringify a query object. Should not prepend a leading `?`.
1017
+ * {@link parseQuery} counterpart to handle query parsing.
1018
+ */
1019
+ stringifyQuery?: typeof stringifyQuery;
1020
+ /**
1021
+ * Default class applied to active {@link RouterLink}. If none is provided,
1022
+ * `router-link-active` will be applied.
1023
+ */
1024
+ linkActiveClass?: string;
1025
+ /**
1026
+ * Default class applied to exact active {@link RouterLink}. If none is provided,
1027
+ * `router-link-exact-active` will be applied.
1028
+ */
1029
+ linkExactActiveClass?: string;
1030
+ }
1031
+ /**
1032
+ * Internal type for common properties among all kind of {@link RouteRecordRaw}.
1033
+ */
1034
+ /**
1035
+ * Router base instance.
1036
+ *
1037
+ * @experimental This version is not stable, it's meant to replace {@link Router} in the future.
1038
+ */
1039
+ interface EXPERIMENTAL_Router_Base<TRecord> {
1040
+ /**
1041
+ * Current {@link RouteLocationNormalized}
1042
+ */
1043
+ readonly currentRoute: ShallowRef<RouteLocationNormalizedLoaded>;
1044
+ /**
1045
+ * Allows turning off the listening of history events. This is a low level api for micro-frontend.
1046
+ */
1047
+ listening: boolean;
1048
+ /**
1049
+ * Checks if a route with a given name exists
1050
+ *
1051
+ * @param name - Name of the route to check
1052
+ */
1053
+ hasRoute(name: NonNullable<RouteRecordNameGeneric>): boolean;
1054
+ /**
1055
+ * Get a full list of all the {@link RouteRecord | route records}.
1056
+ */
1057
+ getRoutes(): TRecord[];
1058
+ /**
1059
+ * Returns the {@link RouteLocation | normalized version} of a
1060
+ * {@link RouteLocationRaw | route location}. Also includes an `href` property
1061
+ * that includes any existing `base`. By default, the `currentLocation` used is
1062
+ * `router.currentRoute` and should only be overridden in advanced use cases.
1063
+ *
1064
+ * @param to - Raw route location to resolve
1065
+ * @param currentLocation - Optional current location to resolve against
1066
+ */
1067
+ resolve<Name extends keyof RouteMap = keyof RouteMap>(to: RouteLocationAsRelativeTyped<RouteMap, Name>, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved<Name>;
1068
+ resolve(to: RouteLocationAsString | RouteLocationAsRelative | RouteLocationAsPath, currentLocation?: RouteLocationNormalizedLoaded): RouteLocationResolved;
1069
+ /**
1070
+ * Programmatically navigate to a new URL by pushing an entry in the history
1071
+ * stack.
1072
+ *
1073
+ * @param to - Route location to navigate to
1074
+ */
1075
+ push(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
1076
+ /**
1077
+ * Programmatically navigate to a new URL by replacing the current entry in
1078
+ * the history stack.
1079
+ *
1080
+ * @param to - Route location to navigate to
1081
+ */
1082
+ replace(to: RouteLocationRaw): Promise<NavigationFailure | void | undefined>;
1083
+ /**
1084
+ * Go back in history if possible by calling `history.back()`. Equivalent to
1085
+ * `router.go(-1)`.
1086
+ */
1087
+ back(): void;
1088
+ /**
1089
+ * Go forward in history if possible by calling `history.forward()`.
1090
+ * Equivalent to `router.go(1)`.
1091
+ */
1092
+ forward(): void;
1093
+ /**
1094
+ * Allows you to move forward or backward through the history. Calls
1095
+ * `history.go()`.
1096
+ *
1097
+ * @param delta - The position in the history to which you want to move,
1098
+ * relative to the current page
1099
+ */
1100
+ go(delta: number): void;
1101
+ /**
1102
+ * Add a navigation guard that executes before any navigation. Returns a
1103
+ * function that removes the registered guard.
1104
+ *
1105
+ * @param guard - navigation guard to add
1106
+ */
1107
+ beforeEach(guard: NavigationGuardWithThis<undefined>): () => void;
1108
+ /**
1109
+ * Add a navigation guard that executes before navigation is about to be
1110
+ * resolved. At this state all component have been fetched and other
1111
+ * navigation guards have been successful. Returns a function that removes the
1112
+ * registered guard.
1113
+ *
1114
+ * @param guard - navigation guard to add
1115
+ * @returns a function that removes the registered guard
1116
+ *
1117
+ * @example
1118
+ * ```js
1119
+ * router.beforeResolve(to => {
1120
+ * if (to.meta.requiresAuth && !isAuthenticated) return false
1121
+ * })
1122
+ * ```
1123
+ *
1124
+ */
1125
+ beforeResolve(guard: NavigationGuardWithThis<undefined>): () => void;
1126
+ /**
1127
+ * Add a navigation hook that is executed after every navigation. Returns a
1128
+ * function that removes the registered hook.
1129
+ *
1130
+ * @param guard - navigation hook to add
1131
+ * @returns a function that removes the registered hook
1132
+ *
1133
+ * @example
1134
+ * ```js
1135
+ * router.afterEach((to, from, failure) => {
1136
+ * if (isNavigationFailure(failure)) {
1137
+ * console.log('failed navigation', failure)
1138
+ * }
1139
+ * })
1140
+ * ```
1141
+ */
1142
+ afterEach(guard: NavigationHookAfter): () => void;
1143
+ /**
1144
+ * Adds an error handler that is called every time a non caught error happens
1145
+ * during navigation. This includes errors thrown synchronously and
1146
+ * asynchronously, errors returned or passed to `next` in any navigation
1147
+ * guard, and errors occurred when trying to resolve an async component that
1148
+ * is required to render a route.
1149
+ *
1150
+ * @param handler - error handler to register
1151
+ */
1152
+ onError(handler: _ErrorListener): () => void;
1153
+ /**
1154
+ * Returns a Promise that resolves when the router has completed the initial
1155
+ * navigation, which means it has resolved all async enter hooks and async
1156
+ * components that are associated with the initial route. If the initial
1157
+ * navigation already happened, the promise resolves immediately.
1158
+ *
1159
+ * This is useful in server-side rendering to ensure consistent output on both
1160
+ * the server and the client. Note that on server side, you need to manually
1161
+ * push the initial location while on client side, the router automatically
1162
+ * picks it up from the URL.
1163
+ */
1164
+ isReady(): Promise<void>;
1165
+ /**
1166
+ * Called automatically by `app.use(router)`. Should not be called manually by
1167
+ * the user. This will trigger the initial navigation when on client side.
1168
+ *
1169
+ * @internal
1170
+ * @param app - Application that uses the router
1171
+ */
1172
+ install(app: App): void;
1173
+ }
1174
+ //#endregion
1175
+ //#region ../../node_modules/.pnpm/vue-router@4.6.4_vue@3.5.27_typescript@5.9.3_/node_modules/vue-router/dist/vue-router.d.mts
1176
+ //#endregion
1177
+ //#region src/router.d.ts
1178
+ /**
1179
+ * Options to initialize a {@link Router} instance.
1180
+ */
1181
+ interface RouterOptions extends EXPERIMENTAL_RouterOptions_Base {
1182
+ /**
1183
+ * Initial list of routes that should be added to the router.
1184
+ */
1185
+ routes: Readonly<RouteRecordRaw[]>;
1186
+ }
1187
+ /**
1188
+ * Router instance.
1189
+ */
1190
+ interface Router extends EXPERIMENTAL_Router_Base<RouteRecordNormalized> {
1191
+ /**
1192
+ * Original options object passed to create the Router
1193
+ */
1194
+ readonly options: RouterOptions;
1195
+ /**
1196
+ * Add a new {@link RouteRecordRaw | route record} as the child of an existing route.
1197
+ *
1198
+ * @param parentName - Parent Route Record where `route` should be appended at
1199
+ * @param route - Route Record to add
1200
+ */
1201
+ addRoute(parentName: NonNullable<RouteRecordNameGeneric>, route: RouteRecordRaw): () => void;
1202
+ /**
1203
+ * Add a new {@link RouteRecordRaw | route record} to the router.
1204
+ *
1205
+ * @param route - Route Record to add
1206
+ */
1207
+ addRoute(route: RouteRecordRaw): () => void;
1208
+ /**
1209
+ * Remove an existing route by its name.
1210
+ *
1211
+ * @param name - Name of the route to remove
1212
+ */
1213
+ removeRoute(name: NonNullable<RouteRecordNameGeneric>): void;
1214
+ /**
1215
+ * Delete all routes from the router.
1216
+ */
1217
+ clearRoutes(): void;
1218
+ }
1219
+ /**
1220
+ * Creates a Router instance that can be used by a Vue app.
1221
+ *
1222
+ * @param options - {@link RouterOptions}
1223
+ */
1224
+ //#endregion
1225
+ //#region src/RouterLink.d.ts
1226
+ interface RouterLinkOptions {
1227
+ /**
1228
+ * Route Location the link should navigate to when clicked on.
1229
+ */
1230
+ to: RouteLocationRaw;
1231
+ /**
1232
+ * Calls `router.replace` instead of `router.push`.
1233
+ */
1234
+ replace?: boolean;
1235
+ }
1236
+ interface RouterLinkProps extends RouterLinkOptions {
1237
+ /**
1238
+ * Whether RouterLink should not wrap its content in an `a` tag. Useful when
1239
+ * using `v-slot` to create a custom RouterLink
1240
+ */
1241
+ custom?: boolean;
1242
+ /**
1243
+ * Class to apply when the link is active
1244
+ */
1245
+ activeClass?: string;
1246
+ /**
1247
+ * Class to apply when the link is exact active
1248
+ */
1249
+ exactActiveClass?: string;
1250
+ /**
1251
+ * Value passed to the attribute `aria-current` when the link is exact active.
1252
+ *
1253
+ * @defaultValue `'page'`
1254
+ */
1255
+ ariaCurrentValue?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';
1256
+ /**
1257
+ * Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
1258
+ */
1259
+ viewTransition?: boolean;
1260
+ }
1261
+ /**
1262
+ * Options passed to {@link useLink}.
1263
+ */
1264
+ interface UseLinkOptions<Name extends keyof RouteMap = keyof RouteMap> {
1265
+ to: MaybeRef<RouteLocationAsString | RouteLocationAsRelativeTyped<RouteMap, Name> | RouteLocationAsPath | RouteLocationRaw>;
1266
+ replace?: MaybeRef<boolean | undefined>;
1267
+ /**
1268
+ * Pass the returned promise of `router.push()` to `document.startViewTransition()` if supported.
1269
+ */
1270
+ viewTransition?: boolean;
1271
+ }
1272
+ /**
1273
+ * Return type of {@link useLink}.
1274
+ * @internal
1275
+ */
1276
+ interface UseLinkReturn<Name extends keyof RouteMap = keyof RouteMap> {
1277
+ route: ComputedRef<RouteLocationResolved<Name>>;
1278
+ href: ComputedRef<string>;
1279
+ isActive: ComputedRef<boolean>;
1280
+ isExactActive: ComputedRef<boolean>;
1281
+ navigate(e?: MouseEvent): Promise<void | NavigationFailure>;
1282
+ }
1283
+ /**
1284
+ * Returns the internal behavior of a {@link RouterLink} without the rendering part.
1285
+ *
1286
+ * @param props - a `to` location and an optional `replace` flag
1287
+ */
1288
+ declare function useLink<Name extends keyof RouteMap = keyof RouteMap>(props: UseLinkOptions<Name>): UseLinkReturn<Name>;
1289
+ /**
1290
+ * Component to render a link that triggers a navigation on click.
1291
+ */
1292
+ declare const RouterLink: _RouterLinkI;
1293
+ /**
1294
+ * @internal
1295
+ */
1296
+ type _RouterLinkPropsTypedBase = AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterLinkProps;
1297
+ /**
1298
+ * @internal
1299
+ */
1300
+ type RouterLinkPropsTyped<Custom extends boolean | undefined> = Custom extends true ? _RouterLinkPropsTypedBase & {
1301
+ custom: true;
1302
+ } : _RouterLinkPropsTypedBase & {
1303
+ custom?: false | undefined;
1304
+ } & Omit<AnchorHTMLAttributes, 'href'>;
1305
+ /**
1306
+ * Typed version of the `RouterLink` component. Its generic defaults to the typed router, so it can be inferred
1307
+ * automatically for JSX.
1308
+ *
1309
+ * @internal
1310
+ */
1311
+ interface _RouterLinkI {
1312
+ new <Custom extends boolean | undefined = boolean | undefined>(): {
1313
+ $props: RouterLinkPropsTyped<Custom>;
1314
+ $slots: {
1315
+ default?: ({
1316
+ route,
1317
+ href,
1318
+ isActive,
1319
+ isExactActive,
1320
+ navigate
1321
+ }: UnwrapRef<UseLinkReturn>) => VNode[];
1322
+ };
1323
+ };
1324
+ /**
1325
+ * Access to `useLink()` without depending on using vue-router
1326
+ *
1327
+ * @internal
1328
+ */
1329
+ useLink: typeof useLink;
1330
+ } //#endregion
1331
+ //#region src/RouterView.d.ts
1332
+ interface RouterViewProps {
1333
+ name?: string;
1334
+ route?: RouteLocationNormalized;
1335
+ }
1336
+ /**
1337
+ * Component to display the current route the user is at.
1338
+ */
1339
+ declare const RouterView: {
1340
+ new (): {
1341
+ $props: AllowedComponentProps & ComponentCustomProps & VNodeProps & RouterViewProps;
1342
+ $slots: {
1343
+ default?: ({
1344
+ Component,
1345
+ route
1346
+ }: {
1347
+ Component: VNode;
1348
+ route: RouteLocationNormalizedLoaded;
1349
+ }) => VNode[];
1350
+ };
1351
+ };
1352
+ }; //#endregion
1353
+ //#region src/useApi.d.ts
1354
+ /**
1355
+ * Returns the router instance. Equivalent to using `$router` inside
1356
+ * templates.
1357
+ */
1358
+ //#endregion
1359
+ //#region src/index.d.ts
1360
+ declare module 'vue' {
1361
+ interface ComponentCustomOptions {
1362
+ /**
1363
+ * Guard called when the router is navigating to the route that is rendering
1364
+ * this component from a different route. Differently from `beforeRouteUpdate`
1365
+ * and `beforeRouteLeave`, `beforeRouteEnter` does not have access to the
1366
+ * component instance through `this` because it triggers before the component
1367
+ * is even mounted.
1368
+ *
1369
+ * @param to - RouteLocationRaw we are navigating to
1370
+ * @param from - RouteLocationRaw we are navigating from
1371
+ * @param next - function to validate, cancel or modify (by redirecting) the
1372
+ * navigation
1373
+ */
1374
+ beforeRouteEnter?: TypesConfig extends Record<'beforeRouteEnter', infer T> ? T : NavigationGuardWithThis<undefined>;
1375
+ /**
1376
+ * Guard called whenever the route that renders this component has changed, but
1377
+ * it is reused for the new route. This allows you to guard for changes in
1378
+ * params, the query or the hash.
1379
+ *
1380
+ * @param to - RouteLocationRaw we are navigating to
1381
+ * @param from - RouteLocationRaw we are navigating from
1382
+ * @param next - function to validate, cancel or modify (by redirecting) the
1383
+ * navigation
1384
+ */
1385
+ beforeRouteUpdate?: TypesConfig extends Record<'beforeRouteUpdate', infer T> ? T : NavigationGuard;
1386
+ /**
1387
+ * Guard called when the router is navigating away from the current route that
1388
+ * is rendering this component.
1389
+ *
1390
+ * @param to - RouteLocationRaw we are navigating to
1391
+ * @param from - RouteLocationRaw we are navigating from
1392
+ * @param next - function to validate, cancel or modify (by redirecting) the
1393
+ * navigation
1394
+ */
1395
+ beforeRouteLeave?: TypesConfig extends Record<'beforeRouteLeave', infer T> ? T : NavigationGuard;
1396
+ }
1397
+ interface ComponentCustomProperties {
1398
+ /**
1399
+ * Normalized current location. See {@link RouteLocationNormalizedLoaded}.
1400
+ */
1401
+ $route: TypesConfig extends Record<'$route', infer T> ? T : RouteLocationNormalizedLoaded;
1402
+ /**
1403
+ * {@link Router} instance used by the application.
1404
+ */
1405
+ $router: TypesConfig extends Record<'$router', infer T> ? T : Router;
1406
+ }
1407
+ interface GlobalComponents {
1408
+ RouterView: TypesConfig extends Record<'RouterView', infer T> ? T : typeof RouterView;
1409
+ RouterLink: TypesConfig extends Record<'RouterLink', infer T> ? T : typeof RouterLink;
1410
+ }
1411
+ } //#endregion
1412
+ //#endregion
1413
+ export { RouterHistory as i, RouteLocationRaw as n, RouteRecordRaw as r, RouterOptions as t };