Skip to content

Commit 82da018

Browse files
committed
refactor: remove unused code
1 parent 1ca2a13 commit 82da018

File tree

7 files changed

+19
-462
lines changed

7 files changed

+19
-462
lines changed

packages/router/src/new-route-resolver/matcher-pattern.ts

Lines changed: 0 additions & 194 deletions
This file was deleted.

packages/router/src/new-route-resolver/matcher.spec.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { describe, expect, it } from 'vitest'
2-
import { MatcherPatternImpl } from './matcher-pattern'
32
import { createCompiledMatcher, NO_MATCH_LOCATION } from './matcher'
43
import {
54
MatcherPatternParams_Base,
@@ -10,12 +9,6 @@ import {
109
import { miss } from './matchers/errors'
1110
import { EmptyParams } from './matcher-location'
1211

13-
function createMatcherPattern(
14-
...args: ConstructorParameters<typeof MatcherPatternImpl>
15-
) {
16-
return new MatcherPatternImpl(...args)
17-
}
18-
1912
const ANY_PATH_PATTERN_MATCHER: MatcherPatternPath<{ pathMatch: string }> = {
2013
match(path) {
2114
return { pathMatch: path }

packages/router/src/new-route-resolver/matcher.ts

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,13 @@ import type {
1111
MatcherPatternQuery,
1212
} from './new-matcher-pattern'
1313
import { warn } from '../warning'
14-
import {
15-
SLASH_RE,
16-
encodePath,
17-
encodeQueryValue as _encodeQueryValue,
18-
} from '../encoding'
14+
import { encodeQueryValue as _encodeQueryValue } from '../encoding'
1915
import { parseURL, stringifyURL } from '../location'
2016
import type {
2117
MatcherLocationAsNamed,
2218
MatcherLocationAsRelative,
2319
MatcherParamsFormatted,
2420
} from './matcher-location'
25-
import { RouteRecordRaw } from 'test-dts'
2621

2722
/**
2823
* Allowed types for a matcher name.
@@ -165,20 +160,20 @@ interface FnStableNull {
165160
(value: string | number | null | undefined): string | null
166161
}
167162

168-
function encodeParam(text: null | undefined, encodeSlash?: boolean): null
169-
function encodeParam(text: string | number, encodeSlash?: boolean): string
170-
function encodeParam(
171-
text: string | number | null | undefined,
172-
encodeSlash?: boolean
173-
): string | null
174-
function encodeParam(
175-
text: string | number | null | undefined,
176-
encodeSlash = true
177-
): string | null {
178-
if (text == null) return null
179-
text = encodePath(text)
180-
return encodeSlash ? text.replace(SLASH_RE, '%2F') : text
181-
}
163+
// function encodeParam(text: null | undefined, encodeSlash?: boolean): null
164+
// function encodeParam(text: string | number, encodeSlash?: boolean): string
165+
// function encodeParam(
166+
// text: string | number | null | undefined,
167+
// encodeSlash?: boolean
168+
// ): string | null
169+
// function encodeParam(
170+
// text: string | number | null | undefined,
171+
// encodeSlash = true
172+
// ): string | null {
173+
// if (text == null) return null
174+
// text = encodePath(text)
175+
// return encodeSlash ? text.replace(SLASH_RE, '%2F') : text
176+
// }
182177

183178
// @ts-expect-error: overload are not correctly identified
184179
const encodeQueryValue: FnStableNull =
@@ -190,23 +185,6 @@ const encodeQueryValue: FnStableNull =
190185
// // for ts
191186
// value => (value == null ? null : _encodeQueryKey(value))
192187

193-
function transformObject<T>(
194-
fnKey: (value: string | number) => string,
195-
fnValue: FnStableNull,
196-
query: T
197-
): T {
198-
const encoded: any = {}
199-
200-
for (const key in query) {
201-
const value = query[key]
202-
encoded[fnKey(key)] = Array.isArray(value)
203-
? value.map(fnValue)
204-
: fnValue(value as string | number | null | undefined)
205-
}
206-
207-
return encoded
208-
}
209-
210188
export const NO_MATCH_LOCATION = {
211189
name: __DEV__ ? Symbol('no-match') : Symbol(),
212190
params: {},

packages/router/src/new-route-resolver/matchers/path-param.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

packages/router/src/new-route-resolver/matchers/path-static.spec.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/router/src/new-route-resolver/matchers/path-static.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)