Skip to content

Commit ef62d96

Browse files
committed
feat: expose symbols as internals
Allow integration for testing utils and other library-level integrations with vue router. These are marked as internal and should not be used by unofficial integrations as they could change at any time.
1 parent fb72ccc commit ef62d96

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ export {
2020
_PathParserOptions,
2121
} from './matcher/pathParserRanker'
2222

23-
export { routeLocationKey, routerKey } from './injectionSymbols'
23+
export {
24+
routeLocationKey,
25+
routerKey,
26+
matchedRouteKey,
27+
viewDepthKey,
28+
} from './injectionSymbols'
2429

2530
export {
2631
RouteMeta,

src/injectionSymbols.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,23 @@ export const PolySymbol = (name: string) =>
1313
: (__DEV__ ? '[vue-router]: ' : '_vr_') + name
1414

1515
// rvlm = Router View Location Matched
16+
/**
17+
* RouteRecord being rendered by the closest ancestor Router View. Used for
18+
* `onBeforeRouteUpdate` and `onBeforeRouteLeave`. rvlm stands for Router View
19+
* Location Matched
20+
*
21+
* @internal
22+
*/
1623
export const matchedRouteKey = /*#__PURE__*/ PolySymbol(
1724
__DEV__ ? 'router view ___location matched' : 'rvlm'
1825
) as InjectionKey<ComputedRef<RouteRecordNormalized | undefined>>
19-
// rvd = Router View Depth
26+
27+
/**
28+
* Allows overriding the router view depth to control which component in
29+
* `matched` is rendered. rvd stands for Router View Depth
30+
*
31+
* @internal
32+
*/
2033
export const viewDepthKey = /*#__PURE__*/ PolySymbol(
2134
__DEV__ ? 'router view depth' : 'rvd'
2235
) as InjectionKey<number>

0 commit comments

Comments
 (0)