From: Eduardo San Martin Morote Date: Wed, 29 Apr 2020 17:12:28 +0000 (+0200) Subject: refactor: rename PathParserOptions X-Git-Tag: v4.0.0-alpha.8~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d55de3eda258e08f5fdbb0dc2e81920a97df70d6;p=thirdparty%2Fvuejs%2Frouter.git refactor: rename PathParserOptions --- diff --git a/src/index.ts b/src/index.ts index 7495b1eb..0f4e1e1d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,6 +13,10 @@ export { export { RouterHistory } from './history/common' export { RouteRecord, RouteRecordNormalized } from './matcher/types' +export { + PathParserOptions, + _PathParserOptions, +} from './matcher/pathParserRanker' export { RouteLocationRaw, diff --git a/src/matcher/index.ts b/src/matcher/index.ts index bd6db66d..0630b25f 100644 --- a/src/matcher/index.ts +++ b/src/matcher/index.ts @@ -12,7 +12,7 @@ import { PathParams, comparePathParserScore, PathParserOptions, - PathParserOptionsPublic, + _PathParserOptions, } from './pathParserRanker' import { warn } from 'vue' @@ -40,7 +40,7 @@ export function createRouterMatcher( const matchers: RouteRecordMatcher[] = [] const matcherMap = new Map() globalOptions = mergeOptions( - { strict: false, end: true, sensitive: false } as PathParserOptionsPublic, + { strict: false, end: true, sensitive: false } as PathParserOptions, globalOptions ) @@ -362,4 +362,4 @@ function mergeOptions(defaults: T, partialOptions: Partial): T { return options } -export { PathParserOptionsPublic as PathParserOptions } +export { PathParserOptions, _PathParserOptions } diff --git a/src/matcher/pathParserRanker.ts b/src/matcher/pathParserRanker.ts index 9811387d..1519c4f8 100644 --- a/src/matcher/pathParserRanker.ts +++ b/src/matcher/pathParserRanker.ts @@ -43,7 +43,7 @@ export interface PathParser { stringify(params: PathParams): string } -export interface PathParserOptions { +export interface _PathParserOptions { /** * Makes the RegExp case sensitive. Defaults to false */ @@ -62,15 +62,15 @@ export interface PathParserOptions { end?: boolean } -export type PathParserOptionsPublic = Pick< - PathParserOptions, +export type PathParserOptions = Pick< + _PathParserOptions, 'end' | 'sensitive' | 'strict' > // default pattern for a param: non greedy everything but / const BASE_PARAM_PATTERN = '[^/]+?' -const BASE_PATH_PARSER_OPTIONS: Required = { +const BASE_PATH_PARSER_OPTIONS: Required<_PathParserOptions> = { sensitive: false, strict: false, start: true, @@ -106,7 +106,7 @@ const REGEX_CHARS_RE = /[.+*?^${}()[\]/\\]/g */ export function tokensToParser( segments: Array, - extraOptions?: PathParserOptions + extraOptions?: _PathParserOptions ): PathParser { const options = { ...BASE_PATH_PARSER_OPTIONS,