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 { parseQuery, stringifyQuery } from '@/core/serializer/query-serializer'
|
||||||
|
import { parseUrl } from '@/core/serializer/url-serializer'
|
||||||
import { deepClone } from '@/shared/helpers/deep-clone'
|
import { deepClone } from '@/shared/helpers/deep-clone'
|
||||||
import { parseUrl } from './serializer/url-serializer'
|
import type {
|
||||||
|
FLuentUrlPlainObject,
|
||||||
|
FluentUrlConfig,
|
||||||
|
QuerySerializer,
|
||||||
|
} from '@/shared/types'
|
||||||
|
|
||||||
export function normalizeConfig(
|
export function normalizeConfig(
|
||||||
config?: Partial<FluentUrlConfig>,
|
config?: Partial<FluentUrlConfig>,
|
||||||
|
|||||||
@@ -4,8 +4,13 @@ import {
|
|||||||
normalizeConfig,
|
normalizeConfig,
|
||||||
normalizeOptions,
|
normalizeOptions,
|
||||||
} from '@/core/config-defaults'
|
} from '@/core/config-defaults'
|
||||||
|
import { stringifyUrl } from '@/core/serializer/url-serializer'
|
||||||
import { deepClone } from '@/shared/helpers/deep-clone'
|
import { deepClone } from '@/shared/helpers/deep-clone'
|
||||||
import { stringifyUrl } from './serializer/url-serializer'
|
import type {
|
||||||
|
FLuentUrlPlainObject,
|
||||||
|
FluentUrlConfig,
|
||||||
|
QueriesPlainObject,
|
||||||
|
} from '@/shared/types'
|
||||||
|
|
||||||
export class FluentUrl {
|
export class FluentUrl {
|
||||||
private config: FluentUrlConfig
|
private config: FluentUrlConfig
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import type { QuerySerializer } from '@/shared/types'
|
||||||
|
|
||||||
export const parseQuery: QuerySerializer['parseQuery'] = () => {
|
export const parseQuery: QuerySerializer['parseQuery'] = () => {
|
||||||
throw new Error('Not implemented')
|
throw new Error('Not implemented')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import type { UrlSerializer } from '@/shared/types'
|
||||||
|
|
||||||
export const parseUrl: UrlSerializer['parseUrl'] = () => {
|
export const parseUrl: UrlSerializer['parseUrl'] = () => {
|
||||||
throw new Error('Not implemented')
|
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>
|
export interface FLuentUrlPlainObject {
|
||||||
|
|
||||||
interface FLuentUrlPlainObject {
|
|
||||||
protocol?: string
|
protocol?: string
|
||||||
hostname?: string
|
hostname?: string
|
||||||
paths: string[]
|
paths: string[]
|
||||||
@@ -11,12 +9,12 @@ interface FLuentUrlPlainObject {
|
|||||||
queries: QueriesPlainObject
|
queries: QueriesPlainObject
|
||||||
}
|
}
|
||||||
|
|
||||||
interface QuerySerializer {
|
export interface QuerySerializer {
|
||||||
parseQuery: (str: string) => QueriesPlainObject
|
parseQuery: (str: string) => QueriesPlainObject
|
||||||
stringifyQuery: (obj: QueriesPlainObject) => string
|
stringifyQuery: (obj: QueriesPlainObject) => string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface UrlSerializer {
|
export interface UrlSerializer {
|
||||||
parseUrl: (args: {
|
parseUrl: (args: {
|
||||||
str: string
|
str: string
|
||||||
parseQuery?: QuerySerializer['parseQuery']
|
parseQuery?: QuerySerializer['parseQuery']
|
||||||
@@ -27,7 +25,7 @@ interface UrlSerializer {
|
|||||||
}) => string
|
}) => string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FluentUrlConfig {
|
export interface FluentUrlConfig {
|
||||||
parseQuery: Serializer['parseQuery']
|
parseQuery: Serializer['parseQuery']
|
||||||
stringifyQuery: Serializer['stringifyQuery']
|
stringifyQuery: Serializer['stringifyQuery']
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,8 @@
|
|||||||
"rimraf": "6.1.3",
|
"rimraf": "6.1.3",
|
||||||
"tsc-alias": "1.8.16",
|
"tsc-alias": "1.8.16",
|
||||||
"tsx": "4.21.0",
|
"tsx": "4.21.0",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "5.9.3",
|
||||||
|
"typescript-transform-paths": "3.5.6",
|
||||||
"vitest": "4.0.18"
|
"vitest": "4.0.18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
23
pnpm-lock.yaml
generated
23
pnpm-lock.yaml
generated
@@ -24,8 +24,11 @@ importers:
|
|||||||
specifier: 4.21.0
|
specifier: 4.21.0
|
||||||
version: 4.21.0
|
version: 4.21.0
|
||||||
typescript:
|
typescript:
|
||||||
specifier: ^5.9.3
|
specifier: 5.9.3
|
||||||
version: 5.9.3
|
version: 5.9.3
|
||||||
|
typescript-transform-paths:
|
||||||
|
specifier: ^3.5.6
|
||||||
|
version: 3.5.6(typescript@5.9.3)
|
||||||
vitest:
|
vitest:
|
||||||
specifier: 4.0.18
|
specifier: 4.0.18
|
||||||
version: 4.0.18(@types/node@25.3.0)(tsx@4.21.0)
|
version: 4.0.18(@types/node@25.3.0)(tsx@4.21.0)
|
||||||
@@ -580,6 +583,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-+G4CpNBxa5MprY+04MbgOw1v7So6n5JY166pFi9KfYwT78fxScCeSNQSNzp6dpPSW2rONOps6Ocam1wFhCgoVw==}
|
resolution: {integrity: sha512-+G4CpNBxa5MprY+04MbgOw1v7So6n5JY166pFi9KfYwT78fxScCeSNQSNzp6dpPSW2rONOps6Ocam1wFhCgoVw==}
|
||||||
engines: {node: 18 || 20 || >=22}
|
engines: {node: 18 || 20 || >=22}
|
||||||
|
|
||||||
|
minimatch@9.0.6:
|
||||||
|
resolution: {integrity: sha512-kQAVowdR33euIqeA0+VZTDqU+qo1IeVY+hrKYtZMio3Pg0P0vuh/kwRylLUddJhB6pf3q/botcOvRtx4IN1wqQ==}
|
||||||
|
engines: {node: '>=16 || 14 >=14.17'}
|
||||||
|
|
||||||
minipass@7.1.3:
|
minipass@7.1.3:
|
||||||
resolution: {integrity: sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==}
|
resolution: {integrity: sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==}
|
||||||
engines: {node: '>=16 || 14 >=14.17'}
|
engines: {node: '>=16 || 14 >=14.17'}
|
||||||
@@ -710,6 +717,11 @@ packages:
|
|||||||
engines: {node: '>=18.0.0'}
|
engines: {node: '>=18.0.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
|
typescript-transform-paths@3.5.6:
|
||||||
|
resolution: {integrity: sha512-3eQTG6Ogt+pgPEh45uX2s9OwcfAVjWnyNO+osjYcOqYaWDVMIFUkqW8e0O1cOaVwdMqQFQf6alDT+76xmeS2Ag==}
|
||||||
|
peerDependencies:
|
||||||
|
typescript: '>=3.6.5'
|
||||||
|
|
||||||
typescript@5.9.3:
|
typescript@5.9.3:
|
||||||
resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
|
resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
|
||||||
engines: {node: '>=14.17'}
|
engines: {node: '>=14.17'}
|
||||||
@@ -1210,6 +1222,10 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
brace-expansion: 5.0.2
|
brace-expansion: 5.0.2
|
||||||
|
|
||||||
|
minimatch@9.0.6:
|
||||||
|
dependencies:
|
||||||
|
brace-expansion: 5.0.2
|
||||||
|
|
||||||
minipass@7.1.3: {}
|
minipass@7.1.3: {}
|
||||||
|
|
||||||
mylas@2.1.14: {}
|
mylas@2.1.14: {}
|
||||||
@@ -1341,6 +1357,11 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
fsevents: 2.3.3
|
fsevents: 2.3.3
|
||||||
|
|
||||||
|
typescript-transform-paths@3.5.6(typescript@5.9.3):
|
||||||
|
dependencies:
|
||||||
|
minimatch: 9.0.6
|
||||||
|
typescript: 5.9.3
|
||||||
|
|
||||||
typescript@5.9.3: {}
|
typescript@5.9.3: {}
|
||||||
|
|
||||||
undici-types@7.18.2: {}
|
undici-types@7.18.2: {}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"rootDir": "./lib",
|
"rootDir": "./lib",
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"*.test.ts",
|
"**/*.test.ts",
|
||||||
"vitest.config.ts",
|
"vitest.config.ts",
|
||||||
"sandbox/**/*",
|
"sandbox/**/*",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -33,7 +33,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"lib/shared/types"
|
"lib/shared/types",
|
||||||
|
"node_modules/@types"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
|||||||
Reference in New Issue
Block a user