//#region src/fs/write-queue.ts
const queues = /* @__PURE__ */ new Map();
function withFileQueue(filePath, fn) {
	const current = queues.get(filePath) ?? Promise.resolve();
	let resolve;
	const barrier = new Promise((r) => {
		resolve = r;
	});
	queues.set(filePath, current.then(() => barrier));
	return current.then(async () => {
		try {
			return await fn();
		} finally {
			resolve();
		}
	});
}
//#endregion
Object.defineProperty(exports, "withFileQueue", {
	enumerable: true,
	get: function() {
		return withFileQueue;
	}
});

//# sourceMappingURL=write-queue-BDolUxfs.cjs.map