resolve_specifier.ts

view source

Declarations
#

3 declarations

resolve_specifier
#

resolve_specifier.ts view source

(specifier: string, dir: string): Promise<ResolvedSpecifier> import {resolve_specifier} from '@fuzdev/gro/resolve_specifier.js';

Maps an import specifier relative to dir, and infer the correct extension following Vite conventions. If no .js file is found for the specifier on the filesystem, it assumes .ts.

specifier

type string

dir

type string

returns

Promise<ResolvedSpecifier>

ResolvedSpecifier
#

resolve_specifier.ts view source

ResolvedSpecifier import type {ResolvedSpecifier} from '@fuzdev/gro/resolve_specifier.js';

path_id

The resolved filesystem path for the specifier.

type PathId

path_id_with_querystring

Same as path_id but includes ?raw and other querystrings. (currently none)

type string

specifier

type string

mapped_specifier

type string

namespace

type "sveltekit_local_imports_ts" | "sveltekit_local_imports_js" | undefined

raw

type boolean

to_missing_module_id
#

resolve_specifier.ts view source

(error: unknown): string | null import {to_missing_module_id} from '@fuzdev/gro/resolve_specifier.js';

The file a failed Node resolution was looking for, if it failed because the file is missing - Node maps a subpath import like #lib/foo.js through package.json imports before failing, so this is the path a .js-for-.ts retry should start from.

error

type unknown

returns

string | null

the missing file's path, or null for any other error

Depends on
#

Imported by
#