]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
chore: cleanup
authorEduardo San Martin Morote <posva13@gmail.com>
Sun, 31 Aug 2025 12:04:52 +0000 (14:04 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Sun, 31 Aug 2025 12:04:52 +0000 (14:04 +0200)
packages/router/src/experimental/route-resolver/resolver-abstract.ts
packages/router/src/experimental/route-resolver/resolver-fixed.ts

index b13caeffd4b64118804a15190bb485aa03fce669..106f5e016d40c09d3ce895607c02589c3b280fc8 100644 (file)
@@ -66,7 +66,7 @@ export interface EXPERIMENTAL_Resolver_Base<TRecord> {
     currentLocation: ResolverLocationResolved<TRecord>
   ): ResolverLocationResolved<TRecord>
 
-  // 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
index 70b8352aefc067a689b4fe91b8dacd3aeb00ac06..13bdb30b67a42edb84f5caa1eabb92eadc66cb3b 100644 (file)
@@ -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<ExtensionT = {}> =
   | (EXPERIMENTAL_ResolverRecord_Matchable & ExtensionT)
   | (EXPERIMENTAL_ResolverRecord_Group & ExtensionT)
 
-export type EXPERIMENTAL_ResolverFixedRecord<ExtensionT = {}> =
-  EXPERIMENTAL_ResolverRecord<ExtensionT>
-
+/**
+ * @alias EXPERIMENTAL_Resolver_Base
+ */
 export interface EXPERIMENTAL_ResolverFixed<TRecord>
   extends EXPERIMENTAL_Resolver_Base<TRecord> {}
 
@@ -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 }
     }
   }