From b6b41d73e3459fd68e2e9152c47e30e253bb431f Mon Sep 17 00:00:00 2001 From: margrop <1731827+margrop@users.noreply.github.com> Date: Fri, 4 Dec 2026 19:31:10 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=B6=88=E9=99=A4=20background-tasks?= =?UTF-8?q?=20=E7=9A=84=20Turbopack=20=E6=96=87=E4=BB=B6=E8=BF=BD=E8=B8=AA?= =?UTF-8?q?=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/background-tasks.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/background-tasks.ts b/src/lib/background-tasks.ts index 3ca21fcc..305ea389 100644 --- a/src/lib/background-tasks.ts +++ b/src/lib/background-tasks.ts @@ -142,7 +142,7 @@ function ensureLoaded() { if (!file) return; let saved: unknown; try { - saved = JSON.parse(fs.readFileSync(file, 'utf8')); + saved = JSON.parse(fs.readFileSync(/* turbopackIgnore: true */ file, 'utf8')); } catch (error) { if ((error as NodeJS.ErrnoException).code !== 'ENOENT') logger.warn({ error }, 'Failed to read saved background tasks'); return; @@ -173,11 +173,11 @@ function saveNow() { // 唯一临时名,避免并发/多次写盘共用同一路径;失败时清理残留临时文件 const temp = `${file}.${process.pid}.${crypto.randomUUID()}.tmp`; try { - fs.mkdirSync(path.dirname(file), { recursive: true }); - fs.writeFileSync(temp, JSON.stringify([...tasks.values()])); - fs.renameSync(temp, file); + fs.mkdirSync(/* turbopackIgnore: true */ path.dirname(/* turbopackIgnore: true */ file), { recursive: true }); + fs.writeFileSync(/* turbopackIgnore: true */ temp, JSON.stringify([...tasks.values()])); + fs.renameSync(/* turbopackIgnore: true */ temp, /* turbopackIgnore: true */ file); } catch (error) { - fs.rmSync(temp, { force: true }); + fs.rmSync(/* turbopackIgnore: true */ temp, { force: true }); logger.warn({ error }, 'Failed to save background tasks'); } }