0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[ci] format

This commit is contained in:
Matt Kane 2024-12-13 07:08:08 +00:00 committed by astrobot-houston
parent 029661daa9
commit 72f30ddbf3

View file

@ -196,7 +196,7 @@ export default new Map([\n${lines.join(',\n')}]);
#pending = new Set<string>(); #pending = new Set<string>();
async #writeFileAtomic(filePath: PathLike, data: string, depth = 0) { async #writeFileAtomic(filePath: PathLike, data: string, depth = 0) {
if(depth > MAX_DEPTH) { if (depth > MAX_DEPTH) {
// If we hit the max depth, we skip a write to prevent the stack from growing too large // If we hit the max depth, we skip a write to prevent the stack from growing too large
// In theory this means we may miss the latest data, but in practice this will only happen when the file is being written to very frequently // In theory this means we may miss the latest data, but in practice this will only happen when the file is being written to very frequently
// so it will be saved on the next write. This is unlikely to ever happen in practice, as the writes are debounced. It requires lots of writes to very large files. // so it will be saved on the next write. This is unlikely to ever happen in practice, as the writes are debounced. It requires lots of writes to very large files.
@ -213,7 +213,7 @@ export default new Map([\n${lines.join(',\n')}]);
const tempFile = filePath instanceof URL ? new URL(`${filePath.href}.tmp`) : `${filePath}.tmp`; const tempFile = filePath instanceof URL ? new URL(`${filePath.href}.tmp`) : `${filePath}.tmp`;
try { try {
// Write it to a temporary file first and then move it to prevent partial reads. // Write it to a temporary file first and then move it to prevent partial reads.
await fs.writeFile(tempFile, data); await fs.writeFile(tempFile, data);
await fs.rename(tempFile, filePath); await fs.rename(tempFile, filePath);
} finally { } finally {