Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions packages/router-core/src/process-route-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ import {
import type { Segment } from './path'
import type { RouteLike } from './route'

const SLASH_SCORE = 0.75
const STATIC_SEGMENT_SCORE = 1
const REQUIRED_PARAM_BASE_SCORE = 0.5
const OPTIONAL_PARAM_BASE_SCORE = 0.4
const WILDCARD_PARAM_BASE_SCORE = 0.25
const STATIC_AFTER_DYNAMIC_BONUS_SCORE = 0.2
const BOTH_PRESENCE_BASE_SCORE = 0.05
const PREFIX_PRESENCE_BASE_SCORE = 0.02
const SUFFIX_PRESENCE_BASE_SCORE = 0.01
const PREFIX_LENGTH_SCORE_MULTIPLIER = 0.0002
const SUFFIX_LENGTH_SCORE_MULTIPLIER = 0.0001
const SLASH_SCORE = 7500
const STATIC_SEGMENT_SCORE = 10000
const REQUIRED_PARAM_BASE_SCORE = 5000
const OPTIONAL_PARAM_BASE_SCORE = 4000
const WILDCARD_PARAM_BASE_SCORE = 2500
const STATIC_AFTER_DYNAMIC_BONUS_SCORE = 2000
const BOTH_PRESENCE_BASE_SCORE = 500
const PREFIX_PRESENCE_BASE_SCORE = 200
const SUFFIX_PRESENCE_BASE_SCORE = 100
const PREFIX_LENGTH_SCORE_MULTIPLIER = 2
const SUFFIX_LENGTH_SCORE_MULTIPLIER = 1

function handleParam(segment: Segment, baseScore: number) {
if (segment.prefixSegment && segment.suffixSegment) {
Expand Down
Loading