/** * Normalize a file path into a lock key. * * For a path that EXISTS on disk, the key is a filesystem-identity token * (`ino:${dev}:${ino}`) derived from `realpathSync` + `statSync` on the * trailing-slash-stripped path. Because the identity is the inode, every peer * directory entry of the same file — a symlink chain (D15), a hardlink alias * (D2), or a trailing-slash spelling (D3) — folds to the SAME key and is * rejected as a duplicate within one batch, while distinct files never collide. * * For a path that does NOT exist yet (a to-be-created file), or when the * `realpathSync`/`statSync` probe fails or races the filesystem (ENOENT/ * ENOTDIR, or the file vanishing between the two calls), the key falls back to * the normalized string of the trailing-slash-stripped path: `resolve()` * collapses relative paths and `..`/`.` segments, and on darwin/win32 * (case-insensitive by default) the result is additionally lowercased so case * aliases of the same future file serialize against each other. */ export declare function normalizeLockKey(filePath: string): string; /** A held path lock. Call `release()` exactly when the critical section ends. */ export interface PathLock { /** Release the lock. Idempotent — safe to call more than once. */ release(): void; } /** * Acquire the lock for `filePath`, waiting FIFO behind any earlier acquirers. * * The returned lock must be released (use `withPathLock` / `withPathLocks` * when the critical section is a single function call). Release is idempotent: * repeated calls hand the lock to the next waiter exactly once. */ export declare function acquirePathLock(filePath: string): Promise; /** Run `fn` while holding the lock for `filePath`; release on every path. */ export declare function withPathLock(filePath: string, fn: () => T | Promise): Promise; /** * Acquire locks for every path in `filePaths` at once. * * Paths are deduplicated by normalized key (acquiring the same key twice in one * call would self-deadlock) and sorted by key, so overlapping batches from * concurrent callers contend in a single global order and can never deadlock. * The returned composite lock releases in reverse acquisition order; on partial * acquisition failure, already-held locks are released before rethrowing. */ export declare function acquirePathLocks(filePaths: string[]): Promise; /** Run `fn` while holding every lock in `filePaths`; release all on every path. */ export declare function withPathLocks(filePaths: string[], fn: () => T | Promise): Promise; //# sourceMappingURL=path-lock.d.ts.map