fix(kit): mark resolvePath utils as sync

This commit is contained in:
Daniel Roe 2024-07-03 23:15:24 +01:00
parent fe3dbfd655
commit 655e1473da
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

View File

@ -1,5 +1,5 @@
import { pathToFileURL } from 'node:url' import { pathToFileURL } from 'node:url'
import { interopDefault, resolvePath } from 'mlly' import { interopDefault, resolvePathSync } from 'mlly'
export interface ResolveModuleOptions { export interface ResolveModuleOptions {
paths?: string | string[] paths?: string | string[]
@ -11,16 +11,16 @@ export interface ResolveModuleOptions {
* *
* @internal * @internal
*/ */
export async function tryResolveModule (id: string, url: string | string[] = import.meta.url) { export function tryResolveModule (id: string, url: string | string[] = import.meta.url) {
try { try {
return await resolvePath(id, { url }) return resolvePathSync(id, { url })
} catch { } catch {
// intentionally empty as this is a `try-` function // intentionally empty as this is a `try-` function
} }
} }
export async function resolveModule (id: string, options?: ResolveModuleOptions) { export function resolveModule (id: string, options?: ResolveModuleOptions) {
return await resolvePath(id, { url: options?.paths ?? [import.meta.url] }) return resolvePathSync(id, { url: options?.paths ?? [import.meta.url] })
} }
export interface ImportModuleOptions extends ResolveModuleOptions { export interface ImportModuleOptions extends ResolveModuleOptions {