//#region src/loader.d.ts /** * Candidate files for a specifier using the tsconfig path mappings visible * from a directory. Used by the static dependency crawler so alias imports * resolve the same way discovery resolves them. * * `authoritative` tells the caller how to treat a miss (no candidate exists * on disk): * - true — the tsconfig owns this specifier: an explicit `paths` pattern * matched, or the paths config exists but cannot be interpreted * (createPathsMatcher rejects what tsc rejects). Resolution must be * treated as failed rather than falling back to node — which specifiers a * broken config would have mapped is unknowable. * - false — candidates came only from the implicit baseUrl lookup, which * proposes `/` for EVERY bare specifier (npm packages * and `#` subpath imports included) and expects the caller to fall back * to node resolution when the candidate does not exist. */ declare function resolveTsconfigPathCandidates(fromDir: string, specifier: string): { candidates: string[]; authoritative: boolean; }; /** * Thrown in place of a `process.exit()` call made while a build-time module is * executing (see {@link runGuarded}). Discovery already catches load failures * and skips the file (falling back to runtime Zod), so a non-cooperating * module's exit degrades gracefully instead of terminating the bundler. */ declare class ProcessExitDuringLoadError extends Error { /** The code passed to the intercepted `process.exit()`, if any. */ readonly exitCode: number | string | undefined; constructor(code?: number | string); } /** * Drop every first-party (non-node_modules) module from the shared loader * caches. Called on watch/HMR file changes so the next discovery re-executes * changed schema graphs. * * Eviction is deliberately first-party-wide rather than per-module: jiti's * module cache only records importer→dep edges on cache misses, so a precise * reverse-dependency walk would miss importers of already-cached modules and * serve stale schemas. Evicting all project files (cheap to re-execute) while * keeping node_modules (the expensive bulk — zod itself) warm is both correct * and fast. */ declare function invalidateModuleCache(): void; /** * Absolute paths of every first-party (non-node_modules) module currently * executed by the shared loader. Used by the unplugin disk cache to record * which source files a schema file's discovery depended on — a superset is * safe (it can only over-invalidate, never serve stale results). * * Returns null when no jiti instance exists (Bun/Deno native import — no * evictable cache, so dependency tracking is unavailable). */ declare function getFirstPartyModulePaths(): string[] | null; /** * Dynamically import a source file (.ts or .js). * - Bun/Deno: native TypeScript support, direct import * - Node.js: uses a shared jiti instance for reliable TypeScript transpilation * (handles extensionless imports, enums, path aliases, and all TS syntax) * * Module executions are cached across calls; use invalidateModuleCache() * when source files change (watch/HMR). */ declare function loadSourceFile(filePath: string): Promise>; /** * Import a module by SPECIFIER as `fromFile` would: relative specifiers * resolve against the importing file's directory; bare specifiers (`zod`) * resolve through node_modules / the shared jiti instance, so the value is * the same module instance discovery executions see. Used by the hoisted- * schema compile step to evaluate hoisted expressions at build time. */ declare function loadModule(specifier: string, fromFile: string): Promise>; //#endregion export { ProcessExitDuringLoadError, getFirstPartyModulePaths, invalidateModuleCache, loadModule, loadSourceFile, resolveTsconfigPathCandidates }; //# sourceMappingURL=loader.d.ts.map