mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(kit): mark resolvePath
utils as sync
This commit is contained in:
parent
fe3dbfd655
commit
655e1473da
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user