feat: implement FluentUrl class with configuration and options normalization

This commit is contained in:
2026-02-22 16:42:34 -05:00
parent 03f30ecbcd
commit f01755fda9
6 changed files with 169 additions and 0 deletions

33
lib/shared/types/index.d.ts vendored Normal file
View File

@@ -0,0 +1,33 @@
/** biome-ignore-all lint/correctness/noUnusedVariables: <> */
type QueriesPlainObject = Record<string, any>
interface FLuentUrlPlainObject {
protocol?: string
hostname?: string
paths: string[]
port?: number
fragment?: string
queries: QueriesPlainObject
}
interface QuerySerializer {
parseQuery: (str: string) => QueriesPlainObject
stringifyQuery: (obj: QueriesPlainObject) => string
}
interface UrlSerializer {
parseUrl: (args: {
str: string
parseQuery?: QuerySerializer['parseQuery']
}) => FLuentUrlPlainObject
stringifyUrl: (args: {
obj: FLuentUrlPlainObject
stringifyQuery?: QuerySerializer['stringifyQuery']
}) => string
}
interface FluentUrlConfig {
parseQuery: Serializer['parseQuery']
stringifyQuery: Serializer['stringifyQuery']
}