]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
refactor: move old dynamic new matcher
authorEduardo San Martin Morote <posva13@gmail.com>
Thu, 14 Aug 2025 14:14:28 +0000 (16:14 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Thu, 14 Aug 2025 14:14:28 +0000 (16:14 +0200)
kept because it will be fixed and shiped at some point

packages/router/src/experimental/route-resolver/matcher-resolve.spec.ts
packages/router/src/experimental/route-resolver/matchers/test-utils.ts
packages/router/src/experimental/route-resolver/old/resolver-dynamic.spec.ts [moved from packages/router/src/experimental/route-resolver/resolver.spec.ts with 98% similarity]
packages/router/src/experimental/route-resolver/old/resolver-dynamic.test-d.ts [moved from packages/router/src/experimental/route-resolver/resolver.test-d.ts with 95% similarity]
packages/router/src/experimental/route-resolver/old/resolver-dynamic.ts [moved from packages/router/src/experimental/route-resolver/resolver-dynamic.ts with 94% similarity]
packages/router/src/experimental/route-resolver/resolver-abstract.ts

index 2adbdb8a03b4e6fd0b38fe7d324526f5bf088985..27bab6028338e194d8d02d09b79a58b184b7cf7f 100644 (file)
@@ -6,11 +6,11 @@ import { mockWarn } from '../../../__tests__/vitest-mock-warn'
 import {
   type MatcherLocationRaw,
   type ResolverLocationResolved,
-  type NEW_MatcherRecord,
   NO_MATCH_LOCATION,
 } from './resolver-abstract'
-import { type NEW_MatcherRecordRaw } from './resolver-dynamic'
-import { createCompiledMatcher } from './resolver-dynamic'
+import { type NEW_MatcherRecord } from './old/resolver-dynamic'
+import { type NEW_MatcherRecordRaw } from './old/resolver-dynamic'
+import { createCompiledMatcher } from './old/resolver-dynamic'
 import { miss } from './matchers/errors'
 import {
   MatcherPatternPath,
index 088c19a49dc93a9ed9fdfb98dc6b627613f4073a..2da8adde75c28c1d82c9c5a4a6c0975dc21467e3 100644 (file)
@@ -4,7 +4,7 @@ import {
   MatcherPatternQuery,
   MatcherPatternHash,
 } from './matcher-pattern'
-import { NEW_MatcherRecord } from '../resolver-abstract'
+import { NEW_MatcherRecord } from '../old/resolver-dynamic'
 import { invalid, miss } from './errors'
 
 export const ANY_PATH_PATTERN_MATCHER: MatcherPatternPath<{
similarity index 98%
rename from packages/router/src/experimental/route-resolver/resolver.spec.ts
rename to packages/router/src/experimental/route-resolver/old/resolver-dynamic.spec.ts
index fea7655f3c8c462ca74fd5e333d46ee04f1ceca3..a1ebbde614af9ff1e5404d0277fb0ef0f4a98228 100644 (file)
@@ -1,11 +1,11 @@
 import { describe, expect, it } from 'vitest'
-import { NO_MATCH_LOCATION, pathEncoded } from './resolver-abstract'
+import { NO_MATCH_LOCATION, pathEncoded } from '../resolver-abstract'
 import { createCompiledMatcher } from './resolver-dynamic'
 import {
   MatcherPatternQuery,
   MatcherPatternPathStatic,
   MatcherPatternPathDynamic,
-} from './matchers/matcher-pattern'
+} from '../matchers/matcher-pattern'
 import {
   EMPTY_PATH_ROUTE,
   USER_ID_ROUTE,
@@ -14,7 +14,7 @@ import {
   EMPTY_PATH_PATTERN_MATCHER,
   USER_ID_PATH_PATTERN_MATCHER,
   ANY_HASH_PATTERN_MATCHER,
-} from './matchers/test-utils'
+} from '../matchers/test-utils'
 
 const PAGE_QUERY_PATTERN_MATCHER: MatcherPatternQuery<{ page: number }> = {
   match: query => {
similarity index 95%
rename from packages/router/src/experimental/route-resolver/resolver.test-d.ts
rename to packages/router/src/experimental/route-resolver/old/resolver-dynamic.test-d.ts
index 29717e8e92418e27a9f952dd7f808ca2a298b291..e249fe28a6b7f00cba9c5c20d55b5129076b002e 100644 (file)
@@ -1,8 +1,8 @@
 import { describe, expectTypeOf, it } from 'vitest'
-import { ResolverLocationResolved } from './resolver-abstract'
+import { ResolverLocationResolved } from '../resolver-abstract'
 import { NEW_MatcherRecordRaw } from './resolver-dynamic'
 import { NEW_RouterResolver } from './resolver-dynamic'
-import { EXPERIMENTAL_RouteRecordNormalized } from '../router'
+import { EXPERIMENTAL_RouteRecordNormalized } from '../../router'
 
 describe('Matcher', () => {
   type TMatcherRecordRaw = NEW_MatcherRecordRaw
similarity index 94%
rename from packages/router/src/experimental/route-resolver/resolver-dynamic.ts
rename to packages/router/src/experimental/route-resolver/old/resolver-dynamic.ts
index dc8de007818affb5c9984c00739db3080d4b7074..36abb07d0ceb98731f735c341538c758f3cc48b3 100644 (file)
@@ -3,27 +3,27 @@ import {
   LocationNormalized,
   parseURL,
   resolveRelativePath,
-} from '../../location'
-import { normalizeQuery, stringifyQuery, parseQuery } from '../../query'
-import type { MatcherParamsFormatted } from './matchers/matcher-pattern'
-import type { ResolverLocationAsRelative } from './resolver-abstract'
-import type { ResolverLocationAsPathAbsolute } from './resolver-abstract'
-import type { ResolverLocationAsPathRelative } from './resolver-abstract'
-import type { ResolverLocationAsNamed } from './resolver-abstract'
+} from '../../../location'
+import { normalizeQuery, stringifyQuery, parseQuery } from '../../../query'
+import type { MatcherParamsFormatted } from '../matchers/matcher-pattern'
+import type { ResolverLocationAsRelative } from '../resolver-abstract'
+import type { ResolverLocationAsPathAbsolute } from '../resolver-abstract'
+import type { ResolverLocationAsPathRelative } from '../resolver-abstract'
+import type { ResolverLocationAsNamed } from '../resolver-abstract'
 import {
   MatcherQueryParams,
   EXPERIMENTAL_Resolver_Base,
   NO_MATCH_LOCATION,
   RecordName,
   ResolverLocationResolved,
-} from './resolver-abstract'
-import { comparePathParserScore } from '../../matcher/pathParserRanker'
-import { warn } from '../../warning'
+} from '../resolver-abstract'
+import { comparePathParserScore } from '../../../matcher/pathParserRanker'
+import { warn } from '../../../warning'
 import type {
   MatcherPatternPath,
   MatcherPatternQuery,
   MatcherPatternHash,
-} from './matchers/matcher-pattern'
+} from '../matchers/matcher-pattern'
 
 /**
  * Manage and resolve routes. Also handles the encoding, decoding, parsing and
@@ -468,3 +468,8 @@ export interface NEW_MatcherRecordRaw {
 
   score: Array<number[]>
 }
+
+/**
+ * Normalized version of a {@link NEW_MatcherRecordRaw} record.
+ */
+export interface NEW_MatcherRecord extends NEW_MatcherDynamicRecord {}
index abc70e918b1e100cd6997c5c233f749e6cbd5ec9..f1b7a39fb8a76005056c44c05f4dee86383f3c18 100644 (file)
@@ -6,7 +6,6 @@ import {
 } from '../../encoding'
 import type { MatcherParamsFormatted } from './matchers/matcher-pattern'
 import type { _RouteRecordProps } from '../../typed-routes'
-import type { NEW_MatcherDynamicRecord } from './resolver-dynamic'
 import type { LocationNormalized } from '../../location'
 
 /**
@@ -207,11 +206,6 @@ export const NO_MATCH_LOCATION = {
   matched: [],
 } satisfies Omit<ResolverLocationResolved<never>, keyof LocationNormalized>
 
-/**
- * Normalized version of a {@link NEW_MatcherRecordRaw} record.
- */
-export interface NEW_MatcherRecord extends NEW_MatcherDynamicRecord {}
-
 // FIXME: move somewhere else
 /**
  * Tagged template helper to encode params into a path. Doesn't work with null