(compilerOptions: CompilerOptions, projectRoot: string, host?: ModuleResolutionHost): ImportResolver import {createDefaultResolver} from 'svelte-docinfo/dep-resolver.js'; Create the default ImportResolver (TypeScript + tsconfig).
Uses ts.resolveModuleName against host (default ts.sys) — no
ts.Program is built. Identity is a fresh symbol per call, so each session
that constructs its own default gets a unique cache scope. Multiple
sessions sharing one resolver instance share the cache scope (correct,
since resolver state is shared too).
ts.resolveModuleName cannot resolve real .svelte files (no compiler
option teaches it the extension), so relative and absolute .svelte
specifiers — with or without the extension written — fall back to manual
resolution against fromFile through the same host. Non-relative .svelte
specifiers (tsconfig paths aliases, package subpaths) stay unresolved;
supply a custom resolveImport for those setups.
The resolution cache lives for the resolver's lifetime and caches failed
lookups alongside successful ones, so invalidate clears it — the session
calls that whenever its owned set's membership changed (see ImportResolver).
compilerOptions
parsed tsconfig (from loadTsconfig, or the LS
handle's getCompilerOptions())
CompilerOptionsprojectRoot
absolute project root for the module-resolution cache
stringhost
resolution surface; the session passes an owned-content-aware
host so dependency edges see the same world the checker does (in-memory
files, including ones in directories that exist nowhere on disk), disk-only
callers take the ts.sys default
ModuleResolutionHostts.sysreturns
ImportResolver