From 44cd62e9a2a5fc0f400de2862a3a07c5686bf25e Mon Sep 17 00:00:00 2001 From: wait4xx Date: Thu, 5 Nov 2026 11:02:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(lint):=20=E8=B1=81=E5=85=8D=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E8=B7=AF=E7=94=B1=E7=9A=84=20en=20=E5=AD=AA=E7=94=9F?= =?UTF-8?q?=E6=96=AD=E9=93=BE=E2=80=94=E2=80=94=E8=AF=AD=E8=A8=80=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=99=A8=E7=BB=99=20zh-only=20=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E9=A1=B5=E7=94=9F=E6=88=90=20/en/=20=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 验证: node scripts/build-perf/content-lint.mjs dist → 通过(54 页 0 断链) Spec: none (预览页需先上线供用户选择) Co-authored-by: GLM-5.3 --- scripts/build-perf/content-lint.mjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/build-perf/content-lint.mjs b/scripts/build-perf/content-lint.mjs index f13a2e8..54d1fdb 100644 --- a/scripts/build-perf/content-lint.mjs +++ b/scripts/build-perf/content-lint.mjs @@ -14,6 +14,8 @@ if (MODE === 'skip') { } const SKIP_PREFIX = ['/admin/', '/photos-originals/']; // admin=CMS 路由;photos-originals=部署期 rsync 叠加层(不在 dist,另有部署链保障) +// 已知不存在的 en 孪生目标(见 targetExists 内注释) +const KNOWN_MISSING_TWIN = new Set(['/en/heatmap-preview/']); const SKIP_FILE = new Set([ '/404.html', // Astro 404 页不参与配对 // 一次性预览路由(预览-选型-落地模式):只有 zh 版,配对检查豁免;选定后随路由一起删 @@ -43,6 +45,9 @@ function decodePath(p) { /** /x/ → dist/x/index.html;/a.svg → dist/a.svg;找不到即 null */ function targetExists(url) { if (SKIP_PREFIX.some((s) => url.startsWith(s))) return true; + // 一次性预览路由的 en 孪生:语言切换器会给预览页生成 /en/… 链接,而预览只有 zh 版 + // (页面本体已在 SKIP_FILE 豁免配对检查;此处豁免切换器链接,选定后随路由一起删) + if (KNOWN_MISSING_TWIN.has(url.split('#')[0].split('?')[0])) return true; const p = decodePath(url.split('#')[0].split('?')[0]); if (!p || p === '/') return existsSync(join(DIST, 'index.html')); if (p.endsWith('/')) return existsSync(join(DIST, p, 'index.html'));