//#region src/utils/withFileLock.d.ts type WithFileLockOptions = { /** * How long a lock may be held before it is considered abandoned and taken * over, in milliseconds. * * @default 30000 = 30 seconds */ staleTimeoutMs?: number; /** * How long to wait for the lock before running the callback anyway, in * milliseconds. Giving up serialises nothing, but it is strictly better than * deadlocking a build behind a lock that never clears. * * @default 60000 = 1 minute */ acquireTimeoutMs?: number; }; /** * Runs `callback` under a cross-process mutex materialised by a lock file. * * Unlike `runOnce`, which lets one process do the work and the others skip it, * every caller here runs the callback — just never at the same time. This is * what shared, read-modify-write outputs need (e.g. building the `.intlayer` * dictionaries, which merges every dictionary on disk): concurrent runs would * each read a half-written state. * * The lock is released even when the callback throws, and its error is * re-thrown to the caller unchanged. * * @param lockFilePath - Path of the lock file coordinating the callers. * @param callback - The critical section. * @param options - Staleness and acquisition timeouts. * * @example * ```typescript * await withFileLock(join(cacheDir, 'build-dictionary.lock'), () => * buildDictionary([dictionary], configuration) * ); * ``` */ export declare const withFileLock: (lockFilePath: string, callback: () => T | Promise, options?: WithFileLockOptions) => Promise; //#endregion //# sourceMappingURL=withFileLock.d.ts.map