From: Eduardo San Martin Morote Date: Sun, 31 Aug 2025 12:04:52 +0000 (+0200) Subject: chore: cleanup X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=becbaa6782a7d63d782201e5005d73342606d044;p=thirdparty%2Fvuejs%2Frouter.git chore: cleanup --- diff --git a/packages/router/src/experimental/route-resolver/resolver-abstract.ts b/packages/router/src/experimental/route-resolver/resolver-abstract.ts index b13caeff..106f5e01 100644 --- a/packages/router/src/experimental/route-resolver/resolver-abstract.ts +++ b/packages/router/src/experimental/route-resolver/resolver-abstract.ts @@ -66,7 +66,7 @@ export interface EXPERIMENTAL_Resolver_Base { currentLocation: ResolverLocationResolved ): ResolverLocationResolved - // NOTE: in practice, this overload can cause bugs. It's better to use named locations + // NOTE: in practice, this overload (above) can cause bugs. It's better to use named locations /** * Resolves a location relative to another location. It reuses existing diff --git a/packages/router/src/experimental/route-resolver/resolver-fixed.ts b/packages/router/src/experimental/route-resolver/resolver-fixed.ts index 70b8352a..13bdb30b 100644 --- a/packages/router/src/experimental/route-resolver/resolver-fixed.ts +++ b/packages/router/src/experimental/route-resolver/resolver-fixed.ts @@ -1,29 +1,33 @@ import { normalizeQuery, parseQuery, stringifyQuery } from '../../query' import { - LocationNormalized, + type LocationNormalized, NEW_stringifyURL, parseURL, resolveRelativePath, } from '../../location' -import { MatcherParamsFormatted } from './matchers/matcher-pattern' -import { ResolverLocationAsRelative } from './resolver-abstract' -import { ResolverLocationAsPathAbsolute } from './resolver-abstract' -import { ResolverLocationAsPathRelative } from './resolver-abstract' -import { ResolverLocationAsNamed } from './resolver-abstract' -import { - RecordName, - ResolverLocationResolved, - EXPERIMENTAL_Resolver_Base, - NO_MATCH_LOCATION, -} from './resolver-abstract' -import { MatcherQueryParams } from './matchers/matcher-pattern' import type { MatcherPatternPath, MatcherPatternHash, + MatcherPattern, + MatcherParamsFormatted, + MatcherQueryParams, } from './matchers/matcher-pattern' +import type { + ResolverLocationAsRelative, + ResolverLocationAsPathAbsolute, + ResolverLocationAsPathRelative, + ResolverLocationAsNamed, + RecordName, + ResolverLocationResolved, + EXPERIMENTAL_Resolver_Base, +} from './resolver-abstract' +import { NO_MATCH_LOCATION } from './resolver-abstract' import type { MatcherPatternQuery } from './matchers/matcher-pattern-query' import { warn } from '../../warning' +/** + * Base interface for a resolver record that can be extended. + */ export interface EXPERIMENTAL_ResolverRecord_Base { /** * Name of the matcher. Unique across all matchers. If missing, this record @@ -46,6 +50,10 @@ export interface EXPERIMENTAL_ResolverRecord_Base { */ hash?: MatcherPatternHash + /** + * Parent record. The parent can be a group or a matchable record. + * It will be included in the `matched` array of a resolved location. + */ parent?: EXPERIMENTAL_ResolverRecord | null // the parent can be matchable or not // TODO: implement aliases @@ -74,13 +82,17 @@ export interface EXPERIMENTAL_ResolverRecord_Matchable path: MatcherPatternPath } +/** + * A record that can be passed to the resolver. It can be extended via the + * `ExtensionT` type param. + */ export type EXPERIMENTAL_ResolverRecord = | (EXPERIMENTAL_ResolverRecord_Matchable & ExtensionT) | (EXPERIMENTAL_ResolverRecord_Group & ExtensionT) -export type EXPERIMENTAL_ResolverFixedRecord = - EXPERIMENTAL_ResolverRecord - +/** + * @alias EXPERIMENTAL_Resolver_Base + */ export interface EXPERIMENTAL_ResolverFixed extends EXPERIMENTAL_Resolver_Base {} @@ -207,7 +219,7 @@ export function createFixedResolver< if (typeof to === 'object' && to.hash && !to.hash.startsWith('#')) { warn( - `A \`hash\` should always start with the character "#". Replace "${to.hash}" with "#${to.hash}".` + `A "hash" should always start with the character "#". Replace "${to.hash}" with "#${to.hash}".` ) } } @@ -307,7 +319,6 @@ export function createFixedResolver< params: parsedParams, matched, } - // TODO: handle object location { path, query, hash } } }