Skip to content

Commit 46bd7ba

Browse files
committed
chore: rename new methods
1 parent 31ac4c9 commit 46bd7ba

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

packages/client/src/router/resolveRoute.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { resolveRoutePathInfo } from '@vuepress/shared'
1+
import { resolvePathInfo } from '@vuepress/shared'
22
import { routes } from '../internal/routes.js'
33
import type { Route, RouteMeta } from '../types/index.js'
44
import { resolveRoutePath } from './resolveRoutePath.js'
@@ -17,7 +17,7 @@ export const resolveRoute = <T extends RouteMeta = RouteMeta>(
1717
currentPath?: string,
1818
): ResolvedRoute<T> => {
1919
// get only the pathname from the path
20-
const [pathname, hashAndQueries] = resolveRoutePathInfo(path)
20+
const [pathname, hashAndQueries] = resolvePathInfo(path)
2121

2222
// resolve the route path
2323
const routePath = resolveRoutePath(pathname, currentPath)
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { resolveRoutePathInfo } from '@vuepress/shared'
1+
import { resolvePathInfo } from '@vuepress/shared'
22
import { resolveRoutePath } from './resolveRoutePath.js'
33

44
/**
@@ -8,7 +8,7 @@ export const resolveRouteFullPath = (
88
path: string,
99
currentPath?: string,
1010
): string => {
11-
const [pathname, hashAndQueries] = resolveRoutePathInfo(path)
11+
const [pathname, hashAndQueries] = resolvePathInfo(path)
1212

1313
return resolveRoutePath(pathname, currentPath) + hashAndQueries
1414
}

packages/shared/src/utils/routes/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ export * from './inferRoutePath'
22
export * from './normalizeRoutePath.js'
33
export * from './resolveLocalePath.js'
44
export * from './resolveRoutePathFromUrl.js'
5-
export * from './resolveRoutePathInfo.js'
5+
export * from './resolvePathInfo.js'

packages/shared/src/utils/routes/resolveRoutePathInfo.ts renamed to packages/shared/src/utils/routes/resolvePathInfo.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
const SPLIT_CHAR_REGEXP = /(#|\?)/
22

33
/**
4-
* Extract pathname / hash and queries from a full route path
4+
* Extract pathname / hash and queries from a relative URL
55
*/
6-
export const resolveRoutePathInfo = (
6+
export const resolvePathInfo = (
77
path: string,
88
): [pathname: string, hashAndQueries: string] => {
99
const [pathname, ...hashAndQueries] = path.split(SPLIT_CHAR_REGEXP)

packages/shared/tests/routes/resolveRoutePathInfo.spec.ts renamed to packages/shared/tests/routes/resolvePathInfo.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from 'vitest'
2-
import { resolveRoutePathInfo } from '../../src/index.js'
2+
import { resolvePathInfo } from '../../src/index.js'
33

44
const testCases: [string, [string, string]][] = [
55
['/a/b/c/', ['/a/b/c/', '']],
@@ -12,10 +12,10 @@ const testCases: [string, [string, string]][] = [
1212
['/a/index.html?a=1#b', ['/a/index.html', '?a=1#b']],
1313
]
1414

15-
describe('should resolve route path info correctly', () => {
15+
describe('should resolve path info correctly', () => {
1616
testCases.forEach(([source, expected]) => {
1717
it(`${source} -> ${expected}`, () => {
18-
expect(resolveRoutePathInfo(source)).toEqual(expected)
18+
expect(resolvePathInfo(source)).toEqual(expected)
1919
})
2020
})
2121
})

0 commit comments

Comments
 (0)