export interface LockfileEntry { resolved: string; integrity: string; dependencies?: string[]; fetchedAt?: string; } export interface LockfileData { version: 1; imports: Record; } export declare function createEmptyLockfile(): LockfileData; /** Compute integrity. */ export declare function computeIntegrity(content: string): Promise; export declare function verifyIntegrity(content: string, integrity: string): Promise; /** * Public API contract for lockfile manager. * * Reads and updates fail closed with `lockfile-format-mismatch` for an * unsupported format and `lockfile-read-error` for unreadable or malformed * data, so an older Veryfront build cannot overwrite unrecognized lockfile * data. `clear()` is the explicit destructive recovery operation and does not * parse the file before removing it. */ export interface LockfileManager { read(): Promise; write(data: LockfileData): Promise; get(url: string): Promise; set(url: string, entry: LockfileEntry): Promise; has(url: string): Promise; clear(): Promise; flush(): Promise; } export type FSAdapter = { /** * Authoritative queue identity for adapters that access the same backing * filesystem. Separate adapter objects must share this key to coordinate all * lockfile access, regardless of their optional canonicalization support. */ readonly coordinationKey?: string; readFile(path: string): Promise; writeFile(path: string, content: string): Promise; /** * Atomically replace `to` with the file at `from` (same-directory rename). * When present, lockfile writes stage a temp file and rename it into place, * so a crash mid-write can never leave a truncated lockfile behind. */ rename?(from: string, to: string): Promise; exists(path: string): Promise; remove?(path: string): Promise; /** * Resolve an existing project path to its stable backing identity. * Coordination through realPath is per-adapter-instance (or per shared * coordinationKey domain): two separate adapter instances without a shared * coordinationKey never serialize with each other through realPath alone, * even when both implementations agree on the canonical path. */ realPath?(path: string): Promise; }; /** Create lockfile manager. */ export declare function createLockfileManager(projectDir: string, fsAdapter?: FSAdapter): LockfileManager; /** * Read a lockfile entry on a build or dev-server hot path. * * A lockfile written by a newer Veryfront build (`lockfile-format-mismatch`) * keeps failing loudly: proceeding around data the running build cannot * understand is exactly the overwrite hazard this module guards against. An * unreadable or malformed lockfile (`lockfile-read-error`) instead degrades to * a cache miss so builds keep working from fresh fetches; a warning naming * the lockfile and the `veryfront lock --clear` remedy is logged once per * manager instead of once per import. */ export declare function getLockfileEntryForBuild(lockfile: LockfileManager, url: string): Promise; /** * Persist a lockfile entry from a build or dev-server hot path. * * Mirrors {@link getLockfileEntryForBuild}: when the on-disk lockfile is * unreadable or malformed (`lockfile-read-error`), the file is left untouched * for `veryfront lock --clear` and the entry is simply not recorded, so a * successful refetch still serves the build. Returns whether the entry was * staged; callers should only `flush()` after a `true` result. A newer-format * lockfile (`lockfile-format-mismatch`) keeps failing loudly. */ export declare function setLockfileEntryForBuild(lockfile: LockfileManager, url: string, entry: LockfileEntry): Promise; export interface FetchWithLockOptions { lockfile: LockfileManager; url: string; fetchFn?: typeof fetch; strict?: boolean; } export interface FetchWithLockResult { content: string; resolvedUrl: string; fromCache: boolean; integrity: string; } export declare function fetchWithLock(options: FetchWithLockOptions): Promise; export interface ParsedImport { specifier: string; type: "static" | "dynamic"; } export declare function extractImports(content: string): ParsedImport[]; export declare function resolveImportUrl(specifier: string, baseUrl: string): string | null; //# sourceMappingURL=import-lockfile.d.ts.map