]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
refactor: use vue 3
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 21 Jan 2020 15:32:34 +0000 (16:32 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 21 Jan 2020 15:32:34 +0000 (16:32 +0100)
explorations/html5.html
explorations/html5.ts
package.json
src/components/Link.ts
src/components/View.ts
src/index.ts
src/router.ts
src/types/index.ts
src/utils/index.ts
yarn.lock

index 3f4118c6192344f6387c2b6d4a2a9144cd1f2ddc..e74fde52ca5e0bbee5d0eeb2c2f281796621b78f 100644 (file)
       .fade-leave-active {
         transition: opacity 0.15s ease;
       }
-      .fade-enter,
-      .fade-leave-active {
+      .fade-enter-from,
+      .fade-leave-to {
         opacity: 0;
       }
       .child-view {
         position: absolute;
         transition: all 0.3s cubic-bezier(0.55, 0, 0.1, 1);
       }
-      .slide-left-enter,
-      .slide-right-leave-active {
+      .slide-left-enter-from,
+      .slide-right-leave-to {
         opacity: 0;
         transform: translate(30px, 0);
       }
-      .slide-left-leave-active,
-      .slide-right-enter {
+      .slide-left-leave-to,
+      .slide-right-enter-from {
         opacity: 0;
         transform: translate(-30px, 0);
       }
   </head>
   <body>
     <div id="app">
-      <h2>{{ message }}</h2>
-      <pre>{{ $route }}</pre>
+      <pre>{{ currentLocation }}</pre>
       <section class="info">
         Name:
-        <pre id="name">{{ $route.name }}</pre>
+        <pre id="name">{{ currentLocation.name }}</pre>
       </section>
 
       <section class="info">
         Params:
-        <pre id="params">{{ $route.params }}</pre>
+        <pre id="params">{{ currentLocation.params }}</pre>
       </section>
 
       <section class="info">
         Query:
-        <pre id="query">{{ $route.query }}</pre>
+        <pre id="query">{{ currentLocation.query }}</pre>
       </section>
 
       <section class="info">
         Hash:
-        <pre id="hash">{{ $route.hash }}</pre>
+        <pre id="hash">{{ currentLocation.hash }}</pre>
       </section>
 
       <section class="info">
         FullPath:
-        <pre id="fullPath">{{ $route.fullPath }}</pre>
+        <pre id="fullPath">{{ currentLocation.fullPath }}</pre>
       </section>
 
       <section class="info">
         path:
-        <pre id="path">{{ $route.path }}</pre>
+        <pre id="path">{{ currentLocation.path }}</pre>
       </section>
 
       <hr />
 
       <label>
-        <input type="checkbox" v-model="shared.cancel" /> Cancel Next Navigation
+        <input type="checkbox" v-model="state.cancelNextNavigation" /> Cancel
+        Next Navigation
       </label>
       <ul>
         <li>
         </li>
         <li>
           <router-link
-            :to="{ name: 'user', params: { id: Number($route.params.id || 0) + 1 }}"
-            >/users/{{ Number($route.params.id || 0) + 1 }}</router-link
+            :to="{ name: 'user', params: { id: Number(currentLocation.params.id || 0) + 1 }}"
+            >/users/{{ Number(currentLocation.params.id || 0) + 1
+            }}</router-link
           >
         </li>
         <!-- <li>
index bb1adad4e51cfce58739c775fed863e538bf451b..e7b80edbf3056c1713e5bea684c7ab67288d5c13 100644 (file)
@@ -1,19 +1,25 @@
 import {
   createRouter,
-  plugin,
+  RouterPlugin,
   // @ts-ignore
   createHistory,
   // @ts-ignore
   createMemoryHistory,
   // @ts-ignore
   createHashHistory,
+  RouteLocationNormalized,
 } from '../src'
-import { RouteComponent } from '../src/types'
-import Vue from 'vue'
+import {
+  defineComponent,
+  computed,
+  createApp,
+  inject,
+  reactive,
+  Ref,
+} from 'vue'
 
 declare global {
   interface Window {
-    vm: Vue
     // h: HTML5History
     h: ReturnType<typeof createHistory>
     r: ReturnType<typeof createRouter>
@@ -25,65 +31,82 @@ declare global {
 const routerHistory = createHistory()
 window.h = routerHistory
 
-const shared = {
-  cancel: false,
-}
-
-const component: RouteComponent = {
+const component = defineComponent({
+  name: 'GenericComponent',
   template: `<div>A component</div>`,
-}
+})
 
-const NotFound: RouteComponent = {
-  template: `<div>Not Found: {{ $route.fullPath }}</div>`,
-}
+const NotFound = defineComponent({
+  name: 'NotFound',
+  setup() {
+    const route = inject('route')
+    return { route }
+  },
+  template: `<div>Not Found: {{ route.fullPath }}</div>`,
+})
 
-const Home: RouteComponent = {
+const Home = defineComponent({
+  name: 'Home',
   template: `<div>Home</div>`,
-}
+})
 
-const User: RouteComponent = {
-  template: `<div>User: {{ $route.params.id }}</div>`,
-}
+const User = defineComponent({
+  name: 'User',
+  setup() {
+    const route = inject('route')
+    console.log({ route })
+    return { route }
+  },
+  template: `<div>User: {{ route.params.id }}</div>`,
+})
 
-const LongView: RouteComponent = {
+const LongView = defineComponent({
+  name: 'LongView',
+  setup() {
+    const route = inject('route')
+    return { route }
+  },
   template: `
   <section>
-    <div class="long">This one is long: {{ $route.params.n }}. Go down to click on a link</div>
+    <div class="long">This one is long: {{ route.params.n }}. Go down to click on a link</div>
     <p class="long">
       <router-link
-        :to="{ name: 'long', params: { n: Number($route.params.n || 0) + 1 }}"
-        >/long-{{ Number($route.params.n || 0) + 1 }}</router-link>
+        :to="{ name: 'long', params: { n: Number(route.params.n || 0) + 1 }}"
+        >/long-{{ Number(route.params.n || 0) + 1 }}</router-link>
     </p>
   </section>
   `,
-}
+})
 
-const GuardedWithLeave: RouteComponent = {
+const GuardedWithLeave = defineComponent({
+  name: 'GuardedWithLeave',
   template: `<div>
     <p>try to leave</p>
   </div>`,
+  // @ts-ignore
   beforeRouteLeave(to, from, next) {
     if (window.confirm()) next()
     else next(false)
   },
-}
+})
 
-const ComponentWithData: RouteComponent = {
+const ComponentWithData = defineComponent({
+  name: 'ComponentWithData',
   template: `<div>
     <p>Here is the data: {{ data }}</p>
   </div>`,
-  // @ts-ignore
   data: () => ({ data: 'nope' }),
+  // @ts-ignore
   beforeRouteEnter(to, from, next) {
     // console.log('this in beforeRouteEnter', this)
-    setTimeout(() => {
-      next(vm => {
-        // console.log('got vm', vm)
-        vm.data = 'Hola'
-      })
-    }, 300)
+    // setTimeout(() => {
+    // next(vm => {
+    //   // console.log('got vm', vm)
+    //   vm.data = 'Hola'
+    // })
+    // }, 300)
   },
-}
+})
 
 if ('scrollRestoration' in history) {
   history.scrollRestoration = 'manual'
@@ -175,7 +198,7 @@ router.beforeEach(async (to, from, next) => {
 })
 
 router.beforeEach((to, from, next) => {
-  if (shared.cancel) return next(false)
+  if (globalState.cancelNextNavigation) return next(false)
   next()
 })
 
@@ -241,36 +264,68 @@ async function run() {
   // await router.push({ name: 'a-child' })
 }
 
-// use the router
-Vue.use(plugin)
+const globalState = reactive({
+  cancelNextNavigation: false,
+})
 
-window.vm = new Vue({
-  el: '#app',
-  // @ts-ignore
-  router,
-  data: {
-    message: 'hello',
-    shared,
-  },
+const App = defineComponent({
+  name: 'App',
+  setup() {
+    // TODO: should be a computed property or a readonly ref
+    const route = inject<Ref<RouteLocationNormalized>>('route')!
+    const state = inject<typeof globalState>('state')!
+    const currentLocation = computed(() => {
+      const { matched, ...rest } = route.value
+      return rest
+    })
 
-  methods: {
-    flushWaiter() {
+    function flushWaiter() {
       scrollWaiter.flush()
-    },
-    setupWaiter() {
+    }
+    function setupWaiter() {
       scrollWaiter.add()
-    },
-  },
+    }
 
-  // try out watchers
-  // watch: {
-  //   '$route.params.id' (id) {
-  //     console.log('id changed', id)
-  //   },
-  //   '$route.name' (name) {
-  //     console.log('name changed', name)
-  //   }
-  // }
+    const nextUserLink = computed(
+      () =>
+        '/users/' +
+        String((Number(router.currentRoute.value.params.id) || 0) + 1)
+    )
+
+    return { currentLocation, nextUserLink, state, flushWaiter, setupWaiter }
+  },
+  template: document.getElementById('app')?.innerHTML,
 })
 
+const app = createApp()
+app.provide('state', globalState)
+app.use(RouterPlugin, router)
+
+app.mount(App, '#app')
+
+// use the router
+// Vue.use(plugin)
+
+// window.vm = new Vue({
+// el: '#app',
+// @ts-ignore
+// router,
+// data: {
+//   message: 'hello',
+//   shared,
+// },
+
+// methods: {
+
+// try out watchers
+// watch: {
+//   'route.params.id' (id) {
+//     console.log('id changed', id)
+//   },
+//   'route.name' (name) {
+//     console.log('name changed', name)
+//   }
+// }
+// })
+
 run()
index c87d70a6fbd1318bfa6dbf600f543b4188117659..c51ac3149f4c9683bfa588ce815432c2365715cb 100644 (file)
@@ -26,7 +26,6 @@
     "@types/jsdom": "^12.2.4",
     "@types/webpack": "^4.41.2",
     "@types/webpack-env": "^1.15.0",
-    "@vue/test-utils": "^1.0.0-beta.30",
     "axios": "^0.19.1",
     "browserstack-local": "^1.4.4",
     "chromedriver": "^78.0.1",
@@ -52,9 +51,7 @@
     "ts-loader": "^6.2.1",
     "ts-node": "^8.6.2",
     "typescript": "^3.7.4",
-    "vue": "^2.6.11",
-    "vue-server-renderer": "^2.6.11",
-    "vue-template-compiler": "^2.6.11",
+    "vue": "^3.0.0-alpha.2",
     "webpack": "^4.41.5",
     "webpack-cli": "^3.3.10",
     "webpack-dev-server": "^3.9.0"
index 1efa15806561ee446e5ef11f91a02a44442830a6..7d04d7874ad4803ab0ebe5f7f7f53af8e5ef5437 100644 (file)
@@ -1,48 +1,42 @@
-import { Component } from 'vue'
+import { defineComponent, h, PropType, inject, computed } from 'vue'
 import { Router } from '../router'
-import { RouteLocationNormalized, RouteLocation } from '../types'
+import { RouteLocation } from '../types'
 
-const Link: Component = {
+const Link = defineComponent({
   name: 'RouterLink',
   props: {
     to: {
-      type: [String, Object],
+      type: [String, Object] as PropType<RouteLocation>,
       required: true,
     },
   },
 
-  render(h) {
-    // @ts-ignore can't get `this`
-    const router = this.$router as Router
-    // @ts-ignore can't get `this`
-    const from = this.$route as RouteLocationNormalized
-    // @ts-ignore can't get `this`
-    const to = this.to as RouteLocation
+  setup(props, context) {
+    const router = inject<Router>('router')!
 
-    const route = router.resolve(to)
-    const href = router.createHref(route)
+    const route = computed(() => router.resolve(props.to))
 
     // TODO: active classes
     // TODO: handle replace prop
 
-    const handler = (e: MouseEvent) => {
+    const onClick = (e: MouseEvent) => {
       // TODO: handle navigate with empty parameters for scoped slot and composition api
       if (guardEvent(e)) {
-        router.push(route)
+        router.push(route.value)
       }
     }
 
-    const on = { click: handler }
-
-    const data: any = {
-      on,
-      attrs: { href },
-    }
-
-    // @ts-ignore
-    return h('a', data, this.$slots.default)
+    return () =>
+      h(
+        'a',
+        {
+          onClick,
+          href: router.createHref(route.value),
+        },
+        context.slots.default()
+      )
   },
-}
+})
 
 function guardEvent(e: MouseEvent) {
   // don't redirect with control keys
index 07a336541ba7e244046f47d855b33c3e42361bd5..a6b693963495a9d69b44cb7c59391e3d1245d607 100644 (file)
@@ -1,59 +1,29 @@
-// @ts-nocheck
-
-import { Component } from 'vue'
-
-const View: Component = {
-  name: 'RouterView',
-  functional: true,
-
-  props: {
-    name: {
-      type: String,
-      default: 'default',
-    },
-  },
-
-  render(_, { children, parent, data, props }) {
-    // @ts-ignore used by devtools to display a router-view badge
-    data.routerView = true
-
-    // directly use parent context's createElement() function
-    // so that components rendered by router-view can resolve named slots
-    const h = parent.$createElement
-    // @ts-ignore $route is added by our typings
-    const route = parent.$route
-
-    // determine current view depth, also check to see if the tree
-    // has been toggled inactive but kept-alive.
-    let depth = 0
-    // let inactive = false
-    // @ts-ignore
-    while (parent && parent._routerRoot !== parent) {
-      const vnodeData = parent.$vnode && parent.$vnode.data
-      if (vnodeData) {
-        // @ts-ignore
-        if (vnodeData.routerView) {
-          depth++
-        }
-        // if (vnodeData.keepAlive && parent._inactive) {
-        //   inactive = true
-        // }
-      }
-      parent = parent.$parent
-    }
-    // @ts-ignore for devtools
-    data.routerViewDepth = depth
-
-    // TODO: support nested router-views
-    const matched = route.matched[depth]
-
-    // render empty node if no matched route
-    if (!matched) return h()
-
-    const component = matched.components[props.name]
-
-    return h(component, data, children)
-  },
+import { h, inject, FunctionalComponent } from 'vue'
+import { Router } from '../'
+
+interface Props {
+  name: string
+}
+
+const View: FunctionalComponent<Props> = (props, { slots, attrs }) => {
+  const router = inject<Router>('router')!
+
+  const route = router.currentRoute.value
+
+  let depth = 0
+
+  // TODO: support nested router-views
+  const matched = route.matched[depth]
+
+  // render empty node if no matched route
+  if (!matched) return null
+
+  const component = matched.components[props.name || 'default']
+
+  // TODO: remove any
+  return h(component as any, attrs, slots.default)
 }
 
+// View.props =
+
 export default View
index 0e712896de7e0e22b713c6a439c049397506cbe4..1a014115cbccbc4be9f5834ef8b8a2e246cd28c6 100644 (file)
 import { createRouter, Router } from './router'
-import { PluginFunction } from 'vue'
+import { App } from 'vue'
 import createHistory from './history/html5'
 import createMemoryHistory from './history/memory'
 import createHashHistory from './history/hash'
 import View from './components/View'
 import Link from './components/Link'
 
-const plugin: PluginFunction<void> = Vue => {
-  Vue.mixin({
+export { RouteLocationNormalized } from './types'
+export { Router } from './router'
+
+export function RouterPlugin(app: App, router: Router) {
+  // TODO: remove as any
+  app.component('RouterLink', Link as any)
+  app.component('RouterView', View as any)
+
+  let started = false
+  app.mixin({
     beforeCreate() {
-      if ('router' in this.$options) {
-        // @ts-ignore we are adding this
-        this._routerRoot = this
-        // @ts-ignore should be able to be removed once we add the typing
-        const router = this.$options.router as Router
-        // @ts-ignore _router is internal
-        this._router = router
-        // this._router.init(this)
+      if (!started) {
         router.setActiveApp(this)
-        // @ts-ignore we can use but should not be used by others
-        Vue.util.defineReactive(
-          this,
-          '_route',
-          router.currentRoute
-          // undefined,
-          // true
-        )
 
         router.doInitialNavigation().catch(err => {
           console.error('Unhandled error', err)
         })
-      } else {
-        // @ts-ignore we are adding this
-        this._routerRoot = (this.$parent && this.$parent._routerRoot) || this
+        started = true
       }
     },
   })
 
-  Object.defineProperty(Vue.prototype, '$router', {
-    get() {
-      return this._routerRoot._router
-    },
-  })
-
-  Object.defineProperty(Vue.prototype, '$route', {
-    get() {
-      return this._routerRoot._route
-    },
-  })
-
-  // @ts-ignore FIXME: should work
-  Vue.component('RouterView', View)
-  // @ts-ignore FIXME: should work
-  Vue.component('RouterLink', Link)
-  // Vue.component('RouterLink', Link)
+  // TODO: merge strats?
 
-  const strats = Vue.config.optionMergeStrategies
-  // use the same hook merging strategy for route hooks
-  strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate =
-    strats.created
+  app.provide('router', router)
+  app.provide('route', router.currentRoute)
 }
 
-export {
-  createRouter,
-  createHistory,
-  createMemoryHistory,
-  createHashHistory,
-  plugin,
-}
-
-// TODO: refactor somewhere else
-// const inBrowser = typeof window !== 'undefined'
-
-// const HistoryMode = {
-//   history: HTML5History,
-//   hash: HashHistory,
-//   abstract: AbstractHistory
-// }
-
-// export default class VueRouter extends Router {
-//   static install = plugin
-//   static version = '__VERSION__'
-
-//   // TODO: handle mode in a retro compatible way
-//   constructor(
-//     options: Partial<RouterOptions & { mode: 'history' | 'abstract' | 'hash' }>
-//   ) {
-//     // let { mode } = options
-//     // if (!inBrowser) mode = 'abstract'
-//     super({
-//       ...options,
-//       routes: options.routes || [],
-//       // FIXME: change when possible
-//       history: createHistory(),
-//       // history: new HistoryMode[mode || 'hash'](),
-//     })
-//   }
-// }
-
-// declare global {
-//   interface Window {
-//     Vue: VueConstructor
-//   }
-// }
-
-// if (typeof window !== 'undefined' && window.Vue) window.Vue.use(VueRouter)
+export { createHistory, createMemoryHistory, createHashHistory, createRouter }
index 7f55604f725dad21098a67e100bb76e8021fbded..b9efe592b37a026d0e9c5daaa9da6a21620c1f40 100644 (file)
@@ -31,9 +31,9 @@ import {
   NavigationAborted,
 } from './errors'
 import { extractComponentsGuards, guardToPromiseFn } from './utils'
-import Vue from 'vue'
 import { encodeParam } from './utils/encoding'
 import { decode } from './utils/encoding'
+import { ref, Ref } from 'vue'
 
 type ErrorHandler = (error: any) => any
 // resolve, reject arguments of Promise constructor
@@ -55,7 +55,7 @@ export interface RouterOptions {
 }
 
 export interface Router {
-  currentRoute: Readonly<RouteLocationNormalized>
+  currentRoute: Ref<RouteLocationNormalized>
 
   resolve(to: RouteLocation): RouteLocationNormalized
   createHref(to: RouteLocationNormalized): string
@@ -64,7 +64,7 @@ export interface Router {
 
   // TODO: find a way to remove it
   doInitialNavigation(): Promise<void>
-  setActiveApp(vm: Vue): void
+  setActiveApp(vm: TODO): void
 
   beforeEach(guard: NavigationGuard): ListenerRemover
   afterEach(guard: PostNavigationGuard): ListenerRemover
@@ -87,12 +87,12 @@ export function createRouter({
   )
   const beforeGuards: NavigationGuard[] = []
   const afterGuards: PostNavigationGuard[] = []
-  let currentRoute: Readonly<RouteLocationNormalized> = START_LOCATION_NORMALIZED
+  const currentRoute = ref<RouteLocationNormalized>(START_LOCATION_NORMALIZED)
   let pendingLocation: Readonly<RouteLocationNormalized> = START_LOCATION_NORMALIZED
   let onReadyCbs: OnReadyCallback[] = []
   // TODO: should these be triggered before or after route.push().catch()
   let errorHandlers: ErrorHandler[] = []
-  let app: Vue
+  let app: TODO
   let ready: boolean = false
 
   function resolve(
@@ -126,7 +126,7 @@ export function createRouter({
     redirectedFrom?: RouteLocationNormalized
     // ensure when returning that the redirectedFrom is a normalized location
   ): RouteLocationNormalized {
-    currentLocation = currentLocation || currentRoute
+    currentLocation = currentLocation || currentRoute.value
     const matchedRoute = matcher.resolve(location, currentLocation)
 
     if ('redirect' in matchedRoute) {
@@ -209,13 +209,13 @@ export function createRouter({
     if (typeof to === 'string' || ('path' in to && !('name' in to))) {
       url = normalizeLocation(to)
       // TODO: should allow a non matching url to allow dynamic routing to work
-      location = resolveLocation(url, currentRoute)
+      location = resolveLocation(url, currentRoute.value)
     } else {
       // named or relative route
       const query = to.query ? normalizeQuery(to.query) : {}
       const hash = to.hash || ''
       // we need to resolve first
-      location = resolveLocation({ ...to, query, hash }, currentRoute)
+      location = resolveLocation({ ...to, query, hash }, currentRoute.value)
       // intentionally drop current query and hash
       url = normalizeLocation({
         query,
@@ -227,22 +227,22 @@ export function createRouter({
     // TODO: should we throw an error as the navigation was aborted
     // TODO: needs a proper check because order in query could be different
     if (
-      currentRoute !== START_LOCATION_NORMALIZED &&
-      currentRoute.fullPath === url.fullPath
+      currentRoute.value !== START_LOCATION_NORMALIZED &&
+      currentRoute.value.fullPath === url.fullPath
     )
-      return currentRoute
+      return currentRoute.value
 
     const toLocation: RouteLocationNormalized = location
     pendingLocation = toLocation
     // trigger all guards, throw if navigation is rejected
     try {
-      await navigate(toLocation, currentRoute)
+      await navigate(toLocation, currentRoute.value)
     } catch (error) {
       if (NavigationGuardRedirect.is(error)) {
         // push was called while waiting in guards
         if (pendingLocation !== toLocation) {
           // TODO: trigger onError as well
-          throw new NavigationCancelled(toLocation, currentRoute)
+          throw new NavigationCancelled(toLocation, currentRoute.value)
         }
         // TODO: setup redirect stack
         // TODO: shouldn't we trigger the error as well
@@ -252,7 +252,7 @@ export function createRouter({
         // triggerError as well
         if (pendingLocation !== toLocation) {
           // TODO: trigger onError as well
-          throw new NavigationCancelled(toLocation, currentRoute)
+          throw new NavigationCancelled(toLocation, currentRoute.value)
         }
 
         triggerError(error)
@@ -261,22 +261,22 @@ export function createRouter({
 
     // push was called while waiting in guards
     if (pendingLocation !== toLocation) {
-      throw new NavigationCancelled(toLocation, currentRoute)
+      throw new NavigationCancelled(toLocation, currentRoute.value)
     }
 
     // change URL
     if (to.replace === true) history.replace(url)
     else history.push(url)
 
-    const from = currentRoute
-    currentRoute = toLocation
+    const from = currentRoute.value
+    currentRoute.value = toLocation
     updateReactiveRoute()
     handleScroll(toLocation, from).catch(err => triggerError(err, false))
 
     // navigation is confirmed, call afterGuards
     for (const guard of afterGuards) guard(toLocation, from)
 
-    return currentRoute
+    return currentRoute.value
   }
 
   function replace(to: RouteLocation) {
@@ -358,25 +358,25 @@ export function createRouter({
   }
 
   history.listen(async (to, from, info) => {
-    const matchedRoute = resolveLocation(to, currentRoute)
+    const matchedRoute = resolveLocation(to, currentRoute.value)
     // console.log({ to, matchedRoute })
 
     const toLocation: RouteLocationNormalized = { ...to, ...matchedRoute }
     pendingLocation = toLocation
 
     try {
-      await navigate(toLocation, currentRoute)
+      await navigate(toLocation, currentRoute.value)
 
       // a more recent navigation took place
       if (pendingLocation !== toLocation) {
         return triggerError(
-          new NavigationCancelled(toLocation, currentRoute),
+          new NavigationCancelled(toLocation, currentRoute.value),
           false
         )
       }
 
       // accept current navigation
-      currentRoute = {
+      currentRoute.value = {
         ...to,
         ...matchedRoute,
       }
@@ -384,7 +384,7 @@ export function createRouter({
       // TODO: refactor with a state getter
       // const { scroll } = history.state
       const { state } = window.history
-      handleScroll(toLocation, currentRoute, state.scroll).catch(err =>
+      handleScroll(toLocation, currentRoute.value, state.scroll).catch(err =>
         triggerError(err, false)
       )
     } catch (error) {
@@ -394,7 +394,7 @@ export function createRouter({
         // a more recent navigation took place
         if (pendingLocation !== toLocation) {
           return triggerError(
-            new NavigationCancelled(toLocation, currentRoute),
+            new NavigationCancelled(toLocation, currentRoute.value),
             false
           )
         }
@@ -454,7 +454,7 @@ export function createRouter({
   function updateReactiveRoute() {
     if (!app) return
     // TODO: matched should be non enumerable and the defineProperty here shouldn't be necessary
-    const route = { ...currentRoute }
+    const route = { ...currentRoute.value }
     Object.defineProperty(route, 'matched', { enumerable: false })
     // @ts-ignore
     app._route = Object.freeze(route)
@@ -462,7 +462,7 @@ export function createRouter({
   }
 
   function isReady(): Promise<void> {
-    if (ready && currentRoute !== START_LOCATION_NORMALIZED)
+    if (ready && currentRoute.value !== START_LOCATION_NORMALIZED)
       return Promise.resolve()
     return new Promise((resolve, reject) => {
       onReadyCbs.push([resolve, reject])
@@ -470,7 +470,7 @@ export function createRouter({
   }
 
   function markAsReady(err?: any): void {
-    if (ready || currentRoute === START_LOCATION_NORMALIZED) return
+    if (ready || currentRoute.value === START_LOCATION_NORMALIZED) return
     ready = true
     for (const [resolve] of onReadyCbs) {
       // TODO: is this okay?
@@ -490,20 +490,20 @@ export function createRouter({
     // TODO: refactor code that was duplicated from push method
     const toLocation: RouteLocationNormalized = resolveLocation(
       history.location,
-      currentRoute
+      currentRoute.value
     )
 
     pendingLocation = toLocation
     // trigger all guards, throw if navigation is rejected
     try {
-      await navigate(toLocation, currentRoute)
+      await navigate(toLocation, currentRoute.value)
     } catch (error) {
       markAsReady(error)
       if (NavigationGuardRedirect.is(error)) {
         // push was called while waiting in guards
         if (pendingLocation !== toLocation) {
           // TODO: trigger onError as well
-          throw new NavigationCancelled(toLocation, currentRoute)
+          throw new NavigationCancelled(toLocation, currentRoute.value)
         }
         // TODO: setup redirect stack
         await push(error.to)
@@ -513,7 +513,7 @@ export function createRouter({
         // triggerError as well
         if (pendingLocation !== toLocation) {
           // TODO: trigger onError as well
-          throw new NavigationCancelled(toLocation, currentRoute)
+          throw new NavigationCancelled(toLocation, currentRoute.value)
         }
 
         // this throws, so nothing ahead happens
@@ -523,7 +523,7 @@ export function createRouter({
 
     // push was called while waiting in guards
     if (pendingLocation !== toLocation) {
-      const error = new NavigationCancelled(toLocation, currentRoute)
+      const error = new NavigationCancelled(toLocation, currentRoute.value)
       markAsReady(error)
       throw error
     }
@@ -531,8 +531,8 @@ export function createRouter({
     // NOTE: here we removed the pushing to history part as the history
     // already contains current location
 
-    const from = currentRoute
-    currentRoute = toLocation
+    const from = currentRoute.value
+    currentRoute.value = toLocation
     updateReactiveRoute()
 
     // navigation is confirmed, call afterGuards
@@ -554,7 +554,7 @@ export function createRouter({
     scrollToPosition(position)
   }
 
-  function setActiveApp(vm: Vue) {
+  function setActiveApp(vm: TODO) {
     app = vm
     updateReactiveRoute()
   }
@@ -574,9 +574,5 @@ export function createRouter({
     setActiveApp,
   }
 
-  Object.defineProperty(router, 'currentRoute', {
-    get: () => currentRoute,
-  })
-
   return router
 }
index 69b6c0329357df264fdb232976cc36ecf6a15ac8..44091c64f7aa7efed3abbd906e5988d9443269c9 100644 (file)
@@ -1,6 +1,5 @@
 import { HistoryQuery, RawHistoryQuery } from '../history/common'
 import { PathParserOptions } from '../matcher/path-parser-ranker'
-// import Vue, { ComponentOptions, AsyncComponent } from 'vue'
 
 // type Component = ComponentOptions<Vue> | typeof Vue | AsyncComponent
 
@@ -93,13 +92,9 @@ export interface RouteComponentInterface {
 }
 
 // TODO: have a real type with augmented properties
-// export type RouteComponent = Component & RouteComponentInterface
-type Component = {
-  template?: string
-  render?: Function
-} & RouteComponentInterface
-
-export type RouteComponent = Component | Lazy<Component>
+// add async component
+// export type RouteComponent = (Component | ReturnType<typeof defineComponent>) & RouteComponentInterface
+export type RouteComponent = TODO
 
 // NOTE not sure the whole PropsTransformer thing can be usefull
 // since in callbacks we don't know where we are coming from
index fa58b1119317a5c58d242f3aa0dd5b399f835e23..e4d70c2dc4acca31bc76865557557a635301b709 100644 (file)
@@ -18,9 +18,11 @@ export async function extractComponentsGuards(
         const component = record.components[name]
         // TODO: handle Vue.extend views
         // if ('options' in component) throw new Error('TODO')
-        const resolvedComponent = await (typeof component === 'function'
-          ? component()
-          : component)
+        const resolvedComponent = component
+        // TODO: handle async component
+        // const resolvedComponent = await (typeof component === 'function'
+        //   ? component()
+        //   : component)
 
         const guard = resolvedComponent[guardType]
         if (guard) {
index f41d4a4ea57f9893a4ab1b23282a20e7fbbf654e..04e4a7a539711feae32e3d7becb17a5723413786 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
   dependencies:
     "@types/yargs-parser" "*"
 
-"@vue/test-utils@^1.0.0-beta.30":
-  version "1.0.0-beta.30"
-  resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-1.0.0-beta.30.tgz#d5f26d1e2411fdb7fa7fdedb61b4b4ea4194c49d"
-  integrity sha512-Wyvcha9fNk8+kzTDwb3xWGjPkCPzHSYSwKP6MplrPTG/auhqoad7JqUEceZLc6u7AU4km2pPQ8/m9s0RgCZ0NA==
+"@vue/compiler-core@3.0.0-alpha.2":
+  version "3.0.0-alpha.2"
+  resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.0.0-alpha.2.tgz#c37e7b3df56e8c37c7a4085f24a0c4f76e93119e"
+  integrity sha512-BJAnc5NKl69Hs7X+W+i0mvu/FksgLvN4tIuXlPAmOKI1bBROTontNtqL6Dq+mZ3yu+eeIw8pM6s0gminDnCojg==
   dependencies:
-    dom-event-types "^1.0.0"
-    lodash "^4.17.15"
-    pretty "^2.0.0"
+    acorn "^7.1.0"
+    estree-walker "^0.8.1"
+    source-map "^0.6.1"
+
+"@vue/compiler-dom@3.0.0-alpha.2":
+  version "3.0.0-alpha.2"
+  resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.0.0-alpha.2.tgz#76b0b77026e05831c8ca6aab9f90807843f45013"
+  integrity sha512-BeKtdWi253njQy2SxvNH8iNdtnBctUIbjRbEOXC/2KDOPo6lwrgHNWjHxS43kX0aBM6qJa11w+jzfcCcpQ4yVQ==
+  dependencies:
+    "@vue/compiler-core" "3.0.0-alpha.2"
+
+"@vue/reactivity@3.0.0-alpha.2":
+  version "3.0.0-alpha.2"
+  resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.0.0-alpha.2.tgz#8d0b235652f1834236325c36ea0ba419e06df423"
+  integrity sha512-uUQmNHR2mc2XPwY9stm0WuYCzZ0JEiAdtMNNFbdiIrgbbpFY5EYQEebXojmw4f13AhErUasB9dPPqBPxyGft3A==
+
+"@vue/runtime-core@3.0.0-alpha.2":
+  version "3.0.0-alpha.2"
+  resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.0.0-alpha.2.tgz#574af742f13cfc691eab9247d3d23e8db59f1f83"
+  integrity sha512-wyzZ69B4fO6pawN7Z/thLnWOwhymJ8eE45mO8VGjRWi91RbC70X+tDrjUhsVQBTDJy9C9YkimBtDhBAy/cREIw==
+  dependencies:
+    "@vue/reactivity" "3.0.0-alpha.2"
+
+"@vue/runtime-dom@3.0.0-alpha.2":
+  version "3.0.0-alpha.2"
+  resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.0.0-alpha.2.tgz#16d0cf1ce4ff806d7e1ef8c16aaf869093c8ebbd"
+  integrity sha512-YQexi68NcGH0miaSDVZ7TlMIjO/m8tlOKKw+2ze4TeEyHAb5cXq/pfeqs6JvnLKvZ53ThtG18Uuku4pDmt8bWw==
+  dependencies:
+    "@vue/runtime-core" "3.0.0-alpha.2"
+    csstype "^2.6.8"
 
 "@webassemblyjs/ast@1.8.5":
   version "1.8.5"
@@ -794,11 +821,6 @@ ansi-regex@^5.0.0:
   resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75"
   integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==
 
-ansi-styles@^2.2.1:
-  version "2.2.1"
-  resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
-  integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=
-
 ansi-styles@^3.2.0, ansi-styles@^3.2.1:
   version "3.2.1"
   resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
@@ -1396,17 +1418,6 @@ chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.0, chalk@^2.4.2:
     escape-string-regexp "^1.0.5"
     supports-color "^5.3.0"
 
-chalk@^1.1.3:
-  version "1.1.3"
-  resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
-  integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=
-  dependencies:
-    ansi-styles "^2.2.1"
-    escape-string-regexp "^1.0.2"
-    has-ansi "^2.0.0"
-    strip-ansi "^3.0.0"
-    supports-color "^2.0.0"
-
 chalk@^3.0.0:
   version "3.0.0"
   resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4"
@@ -1587,7 +1598,7 @@ commander@2.17.x:
   resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
   integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==
 
-commander@^2.19.0, commander@^2.20.0, commander@~2.20.3:
+commander@^2.20.0, commander@~2.20.3:
   version "2.20.3"
   resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
   integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
@@ -1642,23 +1653,6 @@ concat-stream@1.6.2, concat-stream@^1.5.0:
     readable-stream "^2.2.2"
     typedarray "^0.0.6"
 
-condense-newlines@^0.2.1:
-  version "0.2.1"
-  resolved "https://registry.yarnpkg.com/condense-newlines/-/condense-newlines-0.2.1.tgz#3de985553139475d32502c83b02f60684d24c55f"
-  integrity sha1-PemFVTE5R10yUCyDsC9gaE0kxV8=
-  dependencies:
-    extend-shallow "^2.0.1"
-    is-whitespace "^0.3.0"
-    kind-of "^3.0.2"
-
-config-chain@^1.1.12:
-  version "1.1.12"
-  resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.12.tgz#0fde8d091200eb5e808caf25fe618c02f48e4efa"
-  integrity sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==
-  dependencies:
-    ini "^1.3.4"
-    proto-list "~1.2.1"
-
 connect-history-api-fallback@^1.6.0:
   version "1.6.0"
   resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc"
@@ -1856,6 +1850,11 @@ cssstyle@^2.0.0:
   dependencies:
     cssom "~0.3.6"
 
+csstype@^2.6.8:
+  version "2.6.8"
+  resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.8.tgz#0fb6fc2417ffd2816a418c9336da74d7f07db431"
+  integrity sha512-msVS9qTuMT5zwAGCVm4mxfrZ18BNc6Csd0oJAtiFMZ1FAx1CCvy2+5MDmYoix63LM/6NDbNtodCiGYGmFgO0dA==
+
 cyclist@^1.0.1:
   version "1.0.1"
   resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
@@ -1891,11 +1890,6 @@ data-urls@^2.0.0:
     whatwg-mimetype "^2.3.0"
     whatwg-url "^8.0.0"
 
-de-indent@^1.0.2:
-  version "1.0.2"
-  resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
-  integrity sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0=
-
 debug@2, debug@2.6.9, debug@^2.2.0, debug@^2.3.3:
   version "2.6.9"
   resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
@@ -2140,11 +2134,6 @@ dom-converter@^0.2:
   dependencies:
     utila "~0.4"
 
-dom-event-types@^1.0.0:
-  version "1.0.0"
-  resolved "https://registry.yarnpkg.com/dom-event-types/-/dom-event-types-1.0.0.tgz#5830a0a29e1bf837fe50a70cd80a597232813cae"
-  integrity sha512-2G2Vwi2zXTHBGqXHsJ4+ak/iP0N8Ar+G8a7LiD2oup5o4sQWytwqqrZu/O6hIMV0KMID2PL69OhpshLO0n7UJQ==
-
 dom-serializer@0:
   version "0.2.2"
   resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.2.2.tgz#1afb81f533717175d478655debc5e332d9f9bb51"
@@ -2238,16 +2227,6 @@ ecc-jsbn@~0.1.1:
     jsbn "~0.1.0"
     safer-buffer "^2.1.0"
 
-editorconfig@^0.15.3:
-  version "0.15.3"
-  resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.15.3.tgz#bef84c4e75fb8dcb0ce5cee8efd51c15999befc5"
-  integrity sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==
-  dependencies:
-    commander "^2.19.0"
-    lru-cache "^4.1.5"
-    semver "^5.6.0"
-    sigmund "^1.0.1"
-
 ee-first@1.1.1:
   version "1.1.1"
   resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
@@ -2377,7 +2356,7 @@ escape-html@~1.0.3:
   resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
   integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=
 
-escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
+escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5:
   version "1.0.5"
   resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
   integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
@@ -2429,6 +2408,11 @@ estree-walker@^0.6.1:
   resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362"
   integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==
 
+estree-walker@^0.8.1:
+  version "0.8.1"
+  resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.8.1.tgz#6230ce2ec9a5cb03888afcaf295f97d90aa52b79"
+  integrity sha512-H6cJORkqvrNziu0KX2hqOMAlA2CiuAxHeGJXSIoKA/KLv229Dw806J3II6mKTm5xiDX1At1EXCfsOQPB+tMB+g==
+
 esutils@^2.0.2:
   version "2.0.3"
   resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
@@ -3066,13 +3050,6 @@ har-validator@~5.1.0:
     ajv "^6.5.5"
     har-schema "^2.0.0"
 
-has-ansi@^2.0.0:
-  version "2.0.0"
-  resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
-  integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=
-  dependencies:
-    ansi-regex "^2.0.0"
-
 has-flag@^3.0.0:
   version "3.0.0"
   resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
@@ -3139,11 +3116,6 @@ hash-base@^3.0.0:
     inherits "^2.0.1"
     safe-buffer "^5.0.1"
 
-hash-sum@^1.0.2:
-  version "1.0.2"
-  resolved "https://registry.yarnpkg.com/hash-sum/-/hash-sum-1.0.2.tgz#33b40777754c6432573c120cc3808bbd10d47f04"
-  integrity sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=
-
 hash.js@^1.0.0, hash.js@^1.0.3:
   version "1.1.7"
   resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42"
@@ -3152,7 +3124,7 @@ hash.js@^1.0.0, hash.js@^1.0.3:
     inherits "^2.0.3"
     minimalistic-assert "^1.0.1"
 
-he@1.2.0, he@1.2.x, he@^1.1.0:
+he@1.2.0, he@1.2.x:
   version "1.2.0"
   resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
   integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
@@ -3711,11 +3683,6 @@ is-url@^1.2.2:
   resolved "https://registry.yarnpkg.com/is-url/-/is-url-1.2.4.tgz#04a4df46d28c4cff3d73d01ff06abeb318a1aa52"
   integrity sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==
 
-is-whitespace@^0.3.0:
-  version "0.3.0"
-  resolved "https://registry.yarnpkg.com/is-whitespace/-/is-whitespace-0.3.0.tgz#1639ecb1be036aec69a54cbb401cfbed7114ab7f"
-  integrity sha1-Fjnssb4DauxppUy7QBz77XEUq38=
-
 is-windows@^1.0.1, is-windows@^1.0.2:
   version "1.0.2"
   resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
@@ -4166,17 +4133,6 @@ jest@^24.9.0:
     import-local "^2.0.0"
     jest-cli "^24.9.0"
 
-js-beautify@^1.6.12:
-  version "1.10.2"
-  resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.10.2.tgz#88c9099cd6559402b124cfab18754936f8a7b178"
-  integrity sha512-ZtBYyNUYJIsBWERnQP0rPN9KjkrDfJcMjuVGcvXOUJrD1zmOGwhRwQ4msG+HJ+Ni/FA7+sRQEMYVzdTQDvnzvQ==
-  dependencies:
-    config-chain "^1.1.12"
-    editorconfig "^0.15.3"
-    glob "^7.1.3"
-    mkdirp "~0.5.1"
-    nopt "~4.0.1"
-
 "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
   version "4.0.0"
   resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
@@ -4487,11 +4443,6 @@ lodash._isiterateecall@^3.0.0:
   resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c"
   integrity sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=
 
-lodash._reinterpolate@^3.0.0:
-  version "3.0.0"
-  resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
-  integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=
-
 lodash.clone@3.0.3:
   version "3.0.3"
   resolved "https://registry.yarnpkg.com/lodash.clone/-/lodash.clone-3.0.3.tgz#84688c73d32b5a90ca25616963f189252a997043"
@@ -4540,26 +4491,6 @@ lodash.sortby@^4.7.0:
   resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
   integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=
 
-lodash.template@^4.5.0:
-  version "4.5.0"
-  resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab"
-  integrity sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==
-  dependencies:
-    lodash._reinterpolate "^3.0.0"
-    lodash.templatesettings "^4.0.0"
-
-lodash.templatesettings@^4.0.0:
-  version "4.2.0"
-  resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz#e481310f049d3cf6d47e912ad09313b154f0fb33"
-  integrity sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==
-  dependencies:
-    lodash._reinterpolate "^3.0.0"
-
-lodash.uniq@^4.5.0:
-  version "4.5.0"
-  resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
-  integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
-
 lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.3:
   version "4.17.15"
   resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
@@ -4596,14 +4527,6 @@ lower-case@^1.1.1:
   resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac"
   integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw=
 
-lru-cache@^4.1.5:
-  version "4.1.5"
-  resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd"
-  integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==
-  dependencies:
-    pseudomap "^1.0.2"
-    yallist "^2.1.2"
-
 lru-cache@^5.1.1:
   version "5.1.1"
   resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920"
@@ -4861,7 +4784,7 @@ mixin-deep@^1.2.0:
     for-in "^1.0.2"
     is-extendable "^1.0.1"
 
-mkdirp@0.5.1, mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1:
+mkdirp@0.5.1, mkdirp@0.x, mkdirp@^0.5.0, mkdirp@^0.5.1:
   version "0.5.1"
   resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
   integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=
@@ -5123,7 +5046,7 @@ node-pre-gyp@^0.12.0:
     semver "^5.3.0"
     tar "^4"
 
-nopt@^4.0.1, nopt@~4.0.1:
+nopt@^4.0.1:
   version "4.0.1"
   resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d"
   integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=
@@ -5776,15 +5699,6 @@ pretty-format@^24.9.0:
     ansi-styles "^3.2.0"
     react-is "^16.8.4"
 
-pretty@^2.0.0:
-  version "2.0.0"
-  resolved "https://registry.yarnpkg.com/pretty/-/pretty-2.0.0.tgz#adbc7960b7bbfe289a557dc5f737619a220d06a5"
-  integrity sha1-rbx5YLe7/iiaVX3F9zdhmiINBqU=
-  dependencies:
-    condense-newlines "^0.2.1"
-    extend-shallow "^2.0.1"
-    js-beautify "^1.6.12"
-
 process-nextick-args@~2.0.0:
   version "2.0.1"
   resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
@@ -5808,11 +5722,6 @@ prompts@^2.0.1:
     kleur "^3.0.3"
     sisteransi "^1.0.3"
 
-proto-list@~1.2.1:
-  version "1.2.4"
-  resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849"
-  integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=
-
 proxy-addr@~2.0.5:
   version "2.0.5"
   resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.5.tgz#34cbd64a2d81f4b1fd21e76f9f06c8a45299ee34"
@@ -5852,11 +5761,6 @@ ps-tree@=1.2.0:
   dependencies:
     event-stream "=3.3.4"
 
-pseudomap@^1.0.2:
-  version "1.0.2"
-  resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
-  integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM=
-
 psl@^1.1.24, psl@^1.1.28:
   version "1.6.0"
   resolved "https://registry.yarnpkg.com/psl/-/psl-1.6.0.tgz#60557582ee23b6c43719d9890fb4170ecd91e110"
@@ -6214,7 +6118,7 @@ resolve@1.12.0:
   dependencies:
     path-parse "^1.0.6"
 
-resolve@1.x, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.2.0, resolve@^1.3.2:
+resolve@1.x, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.3.2:
   version "1.13.1"
   resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.13.1.tgz#be0aa4c06acd53083505abb35f4d66932ab35d16"
   integrity sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w==
@@ -6524,11 +6428,6 @@ shellwords@^0.1.1:
   resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
   integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==
 
-sigmund@^1.0.1:
-  version "1.0.1"
-  resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590"
-  integrity sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=
-
 signal-exit@^3.0.0, signal-exit@^3.0.2:
   version "3.0.2"
   resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
@@ -6649,11 +6548,6 @@ source-map-url@^0.4.0:
   resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"
   integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=
 
-source-map@0.5.6:
-  version "0.5.6"
-  resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412"
-  integrity sha1-dc449SvwczxafwwRjYEzSiu19BI=
-
 source-map@^0.5.0, source-map@^0.5.6:
   version "0.5.7"
   resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
@@ -6955,11 +6849,6 @@ supports-color@6.1.0, supports-color@^6.1.0:
   dependencies:
     has-flag "^3.0.0"
 
-supports-color@^2.0.0:
-  version "2.0.0"
-  resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
-  integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=
-
 supports-color@^5.3.0:
   version "5.5.0"
   resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
@@ -7461,32 +7350,13 @@ vm-browserify@^1.0.1:
   resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
   integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==
 
-vue-server-renderer@^2.6.11:
-  version "2.6.11"
-  resolved "https://registry.yarnpkg.com/vue-server-renderer/-/vue-server-renderer-2.6.11.tgz#be8c9abc6aacc309828a755c021a05fc474b4bc3"
-  integrity sha512-V3faFJHr2KYfdSIalL+JjinZSHYUhlrvJ9pzCIjjwSh77+pkrsXpK4PucdPcng57+N77pd1LrKqwbqjQdktU1A==
-  dependencies:
-    chalk "^1.1.3"
-    hash-sum "^1.0.2"
-    he "^1.1.0"
-    lodash.template "^4.5.0"
-    lodash.uniq "^4.5.0"
-    resolve "^1.2.0"
-    serialize-javascript "^2.1.2"
-    source-map "0.5.6"
-
-vue-template-compiler@^2.6.11:
-  version "2.6.11"
-  resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.6.11.tgz#c04704ef8f498b153130018993e56309d4698080"
-  integrity sha512-KIq15bvQDrcCjpGjrAhx4mUlyyHfdmTaoNfeoATHLAiWB+MU3cx4lOzMwrnUh9cCxy0Lt1T11hAFY6TQgroUAA==
+vue@^3.0.0-alpha.2:
+  version "3.0.0-alpha.2"
+  resolved "https://registry.yarnpkg.com/vue/-/vue-3.0.0-alpha.2.tgz#98e1769e264110404e7131a4258f23ba554a885b"
+  integrity sha512-juu9wygL/NwSTU/ZvsvSoBIoK740MbQLp90nPgCSp8VDxfaDvF8V21SqUbNLrPHy4lLydkiX+OxdH0hrnC8MzQ==
   dependencies:
-    de-indent "^1.0.2"
-    he "^1.1.0"
-
-vue@^2.6.11:
-  version "2.6.11"
-  resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.11.tgz#76594d877d4b12234406e84e35275c6d514125c5"
-  integrity sha512-VfPwgcGABbGAue9+sfrD4PuwFar7gPb1yl1UK1MwXoQPAw0BKSqWfoYCT/ThFrdEVWoI51dBuyCoiNU9bZDZxQ==
+    "@vue/compiler-dom" "3.0.0-alpha.2"
+    "@vue/runtime-dom" "3.0.0-alpha.2"
 
 w3c-hr-time@^1.0.1:
   version "1.0.1"
@@ -7818,11 +7688,6 @@ xtend@^4.0.0, xtend@~4.0.1:
   resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
   integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==
 
-yallist@^2.1.2:
-  version "2.1.2"
-  resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
-  integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=
-
 yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3:
   version "3.1.1"
   resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"