feat: enhance type definitions and import structure across modules
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import { parseQuery, stringifyQuery } from '@/core/serializer/query-serializer'
|
||||
import { parseUrl } from '@/core/serializer/url-serializer'
|
||||
import { deepClone } from '@/shared/helpers/deep-clone'
|
||||
import { parseUrl } from './serializer/url-serializer'
|
||||
import type {
|
||||
FLuentUrlPlainObject,
|
||||
FluentUrlConfig,
|
||||
QuerySerializer,
|
||||
} from '@/shared/types'
|
||||
|
||||
export function normalizeConfig(
|
||||
config?: Partial<FluentUrlConfig>,
|
||||
|
||||
@@ -4,8 +4,13 @@ import {
|
||||
normalizeConfig,
|
||||
normalizeOptions,
|
||||
} from '@/core/config-defaults'
|
||||
import { stringifyUrl } from '@/core/serializer/url-serializer'
|
||||
import { deepClone } from '@/shared/helpers/deep-clone'
|
||||
import { stringifyUrl } from './serializer/url-serializer'
|
||||
import type {
|
||||
FLuentUrlPlainObject,
|
||||
FluentUrlConfig,
|
||||
QueriesPlainObject,
|
||||
} from '@/shared/types'
|
||||
|
||||
export class FluentUrl {
|
||||
private config: FluentUrlConfig
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import type { QuerySerializer } from '@/shared/types'
|
||||
|
||||
export const parseQuery: QuerySerializer['parseQuery'] = () => {
|
||||
throw new Error('Not implemented')
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import type { UrlSerializer } from '@/shared/types'
|
||||
|
||||
export const parseUrl: UrlSerializer['parseUrl'] = () => {
|
||||
throw new Error('Not implemented')
|
||||
}
|
||||
|
||||
12
lib/shared/types/index.d.ts
vendored
12
lib/shared/types/index.d.ts
vendored
@@ -1,8 +1,6 @@
|
||||
/** biome-ignore-all lint/correctness/noUnusedVariables: <> */
|
||||
export type QueriesPlainObject = Record<string, any>
|
||||
|
||||
type QueriesPlainObject = Record<string, any>
|
||||
|
||||
interface FLuentUrlPlainObject {
|
||||
export interface FLuentUrlPlainObject {
|
||||
protocol?: string
|
||||
hostname?: string
|
||||
paths: string[]
|
||||
@@ -11,12 +9,12 @@ interface FLuentUrlPlainObject {
|
||||
queries: QueriesPlainObject
|
||||
}
|
||||
|
||||
interface QuerySerializer {
|
||||
export interface QuerySerializer {
|
||||
parseQuery: (str: string) => QueriesPlainObject
|
||||
stringifyQuery: (obj: QueriesPlainObject) => string
|
||||
}
|
||||
|
||||
interface UrlSerializer {
|
||||
export interface UrlSerializer {
|
||||
parseUrl: (args: {
|
||||
str: string
|
||||
parseQuery?: QuerySerializer['parseQuery']
|
||||
@@ -27,7 +25,7 @@ interface UrlSerializer {
|
||||
}) => string
|
||||
}
|
||||
|
||||
interface FluentUrlConfig {
|
||||
export interface FluentUrlConfig {
|
||||
parseQuery: Serializer['parseQuery']
|
||||
stringifyQuery: Serializer['stringifyQuery']
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user