RouteLocationNormalized,
} from './types'
import { assign } from './utils'
-import { PolySymbol } from './injectionSymbols'
/**
* Flags so we can combine them when checking for multiple errors
NAVIGATION_DUPLICATED = 16,
}
-const NavigationFailureSymbol = /*#__PURE__*/ PolySymbol(
- __DEV__ ? 'navigation failure' : 'nf'
-)
+const NavigationFailureSymbol = Symbol(__DEV__ ? 'navigation failure' : '')
export interface MatcherError extends Error {
type: ErrorTypes.MATCHER_NOT_FOUND
import { Router } from './router'
import { RouteRecordNormalized } from './matcher/types'
-export const hasSymbol =
- typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'
-
-export const PolySymbol = (name: string) =>
- // vr = vue router
- hasSymbol
- ? Symbol(__DEV__ ? '[vue-router]: ' + name : name)
- : (__DEV__ ? '[vue-router]: ' : '_vr_') + name
-
-// rvlm = Router View Location Matched
/**
* RouteRecord being rendered by the closest ancestor Router View. Used for
* `onBeforeRouteUpdate` and `onBeforeRouteLeave`. rvlm stands for Router View
*
* @internal
*/
-export const matchedRouteKey = /*#__PURE__*/ PolySymbol(
- __DEV__ ? 'router view location matched' : 'rvlm'
+export const matchedRouteKey = Symbol(
+ __DEV__ ? 'router view location matched' : ''
) as InjectionKey<ComputedRef<RouteRecordNormalized | undefined>>
/**
*
* @internal
*/
-export const viewDepthKey = /*#__PURE__*/ PolySymbol(
- __DEV__ ? 'router view depth' : 'rvd'
+export const viewDepthKey = Symbol(
+ __DEV__ ? 'router view depth' : ''
) as InjectionKey<Ref<number> | number>
/**
*
* @internal
*/
-export const routerKey = /*#__PURE__*/ PolySymbol(
- __DEV__ ? 'router' : 'r'
-) as InjectionKey<Router>
+export const routerKey = Symbol(__DEV__ ? 'router' : '') as InjectionKey<Router>
/**
* Allows overriding the current route returned by `useRoute` in tests. rl
*
* @internal
*/
-export const routeLocationKey = /*#__PURE__*/ PolySymbol(
- __DEV__ ? 'route location' : 'rl'
+export const routeLocationKey = Symbol(
+ __DEV__ ? 'route location' : ''
) as InjectionKey<RouteLocationNormalizedLoaded>
/**
*
* @internal
*/
-export const routerViewLocationKey = /*#__PURE__*/ PolySymbol(
- __DEV__ ? 'router view location' : 'rvl'
+export const routerViewLocationKey = Symbol(
+ __DEV__ ? 'router view location' : ''
) as InjectionKey<Ref<RouteLocationNormalizedLoaded>>
import { RouteParams, RouteComponent, RouteParamsRaw } from '../types'
-import { hasSymbol } from '../injectionSymbols'
export * from './env'
export function isESModule(obj: any): obj is { default: RouteComponent } {
- return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
+ return obj.__esModule || obj[Symbol.toStringTag] === 'Module'
}
export const assign = Object.assign