From: meteorlxy Date: Mon, 4 May 2020 13:24:46 +0000 (+0200) Subject: refactor: use named exports X-Git-Tag: v4.0.0-alpha.10~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=729721ba18d98b79fa2a4121edd7d51789f32dbf;p=thirdparty%2Fvuejs%2Frouter.git refactor: use named exports Co-authored-by: Eduardo San Martin Morote --- diff --git a/__tests__/history/hash.spec.ts b/__tests__/history/hash.spec.ts index 765b23f6..1efffcb5 100644 --- a/__tests__/history/hash.spec.ts +++ b/__tests__/history/hash.spec.ts @@ -1,6 +1,6 @@ import { JSDOM } from 'jsdom' -import createWebHashHistory from '../../src/history/hash' -import createWebHistory from '../../src/history/html5' +import { createWebHashHistory } from '../../src/history/hash' +import { createWebHistory } from '../../src/history/html5' import { createDom } from '../utils' jest.mock('../../src/history/html5') diff --git a/__tests__/history/html5.spec.ts b/__tests__/history/html5.spec.ts index 147c2a1e..8f1833ed 100644 --- a/__tests__/history/html5.spec.ts +++ b/__tests__/history/html5.spec.ts @@ -1,5 +1,5 @@ import { JSDOM } from 'jsdom' -import createWebHistory from '../../src/history/html5' +import { createWebHistory } from '../../src/history/html5' import { createDom } from '../utils' // override the value of isBrowser because the variable is created before JSDOM diff --git a/__tests__/history/memory.spec.ts b/__tests__/history/memory.spec.ts index 15711cee..63cad39a 100644 --- a/__tests__/history/memory.spec.ts +++ b/__tests__/history/memory.spec.ts @@ -1,4 +1,4 @@ -import createMemoryHistory from '../../src/history/memory' +import { createMemoryHistory } from '../../src/history/memory' import { START, HistoryLocationNormalized, diff --git a/src/history/hash.ts b/src/history/hash.ts index 6b687e93..f9a64868 100644 --- a/src/history/hash.ts +++ b/src/history/hash.ts @@ -1,7 +1,7 @@ import { RouterHistory, normalizeBase } from './common' -import createWebHistory from './html5' +import { createWebHistory } from './html5' -export default function createWebHashHistory(base?: string): RouterHistory { +export function createWebHashHistory(base?: string): RouterHistory { // Make sure this implementation is fine in terms of encoding, specially for IE11 return createWebHistory(location.host ? normalizeBase(base) + '/#' : '#') } diff --git a/src/history/html5.ts b/src/history/html5.ts index e51378a7..0e72ae0d 100644 --- a/src/history/html5.ts +++ b/src/history/html5.ts @@ -262,7 +262,7 @@ function useHistoryStateNavigation(base: string) { } } -export default function createWebHistory(base?: string): RouterHistory { +export function createWebHistory(base?: string): RouterHistory { base = normalizeBase(base) const historyNavigation = useHistoryStateNavigation(base) diff --git a/src/history/memory.ts b/src/history/memory.ts index 8e3a2933..dad5fbd7 100644 --- a/src/history/memory.ts +++ b/src/history/memory.ts @@ -16,7 +16,7 @@ import { * @param base - Base applied to all urls, defaults to '/' * @returns a history object that can be passed to the router constructor */ -export default function createMemoryHistory(base: string = ''): RouterHistory { +export function createMemoryHistory(base: string = ''): RouterHistory { let listeners: NavigationCallback[] = [] let queue: HistoryLocationNormalized[] = [START] let position: number = 0 diff --git a/src/index.ts b/src/index.ts index c7e472cd..3f71bb70 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ -import createWebHistory from './history/html5' -import createMemoryHistory from './history/memory' -import createWebHashHistory from './history/hash' +export { createWebHistory } from './history/html5' +export { createMemoryHistory } from './history/memory' +export { createWebHashHistory } from './history/hash' export { LocationQuery, @@ -47,6 +47,4 @@ export { onBeforeRouteLeave, onBeforeRouteUpdate } from './navigationGuards' export { RouterLink, useLink } from './RouterLink' export { RouterView } from './RouterView' -export { createWebHistory, createMemoryHistory, createWebHashHistory } - export * from './useApi'