]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
refactor: add __PURE__ to improve tree-shaking (#535)
authorAnthony Fu <anthonyfu117@hotmail.com>
Fri, 16 Oct 2020 08:04:15 +0000 (16:04 +0800)
committerGitHub <noreply@github.com>
Fri, 16 Oct 2020 08:04:15 +0000 (10:04 +0200)
src/RouterLink.ts
src/RouterView.ts
src/errors.ts
src/injectionSymbols.ts

index 9fb714f55b8fa50d28a560130cac8781d62d72e2..da874c786f806c2a9ab8c8d8382efaf89bc734f3 100644 (file)
@@ -125,7 +125,7 @@ export function useLink(props: UseLinkOptions) {
   }
 }
 
-export const RouterLinkImpl = defineComponent({
+export const RouterLinkImpl = /*#__PURE__*/ defineComponent({
   name: 'RouterLink',
   props: {
     to: {
@@ -259,7 +259,7 @@ function getOriginalPath(record: RouteRecord | undefined): string {
  * @param globalClass
  * @param defaultClass
  */
-let getLinkClass = (
+const getLinkClass = (
   propClass: string | undefined,
   globalClass: string | undefined,
   defaultClass: string
index 8691f9f4a05decba2f33e6e4840a92e829ba1cf8..ddb0def371f8d90ea2021ff71f36637cee4b04e8 100644 (file)
@@ -33,7 +33,7 @@ export interface RouterViewProps {
   route?: RouteLocationNormalized
 }
 
-export const RouterViewImpl = defineComponent({
+export const RouterViewImpl = /*#__PURE__*/ defineComponent({
   name: 'RouterView',
   props: {
     name: {
index cb6cb31faf7b46c7438a4d2bd71bfccba93c52ba..705d4353d0beb89d9ea5975b3b49c4c50f7e373d 100644 (file)
@@ -20,7 +20,7 @@ export const enum ErrorTypes {
   NAVIGATION_DUPLICATED = 16,
 }
 
-const NavigationFailureSymbol = PolySymbol(
+const NavigationFailureSymbol = /*#__PURE__*/ PolySymbol(
   __DEV__ ? 'navigation failure' : 'nf'
 )
 
index 73ecdc9709d3fbd16286a6131164c46ec6fbe407..0f6aa03916fab02c1fc1c6c8597278fa83daa73b 100644 (file)
@@ -13,19 +13,19 @@ export const PolySymbol = (name: string) =>
     : (__DEV__ ? '[vue-router]: ' : '_vr_') + name
 
 // rvlm = Router View Location Matched
-export const matchedRouteKey = PolySymbol(
+export const matchedRouteKey = /*#__PURE__*/ PolySymbol(
   __DEV__ ? 'router view location matched' : 'rvlm'
 ) as InjectionKey<ComputedRef<RouteRecordNormalized | undefined>>
 // rvd = Router View Depth
-export const viewDepthKey = PolySymbol(
+export const viewDepthKey = /*#__PURE__*/ PolySymbol(
   __DEV__ ? 'router view depth' : 'rvd'
 ) as InjectionKey<number>
 
 // r = router
-export const routerKey = PolySymbol(__DEV__ ? 'router' : 'r') as InjectionKey<
-  Router
->
+export const routerKey = /*#__PURE__*/ PolySymbol(
+  __DEV__ ? 'router' : 'r'
+) as InjectionKey<Router>
 // rt = route location
-export const routeLocationKey = PolySymbol(
+export const routeLocationKey = /*#__PURE__*/ PolySymbol(
   __DEV__ ? 'route location' : 'rl'
 ) as InjectionKey<RouteLocationNormalizedLoaded>