From 6a4bcf4f31ebaa378c19d0cec3ff08ed51f9f9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sat, 3 Oct 2026 13:47:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E7=94=9F=E6=88=90?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E6=A0=A1=E9=AA=8C=E4=B8=8D=E5=86=8D=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=20readdirSync=20=E7=9A=84=20recursive=20=E9=80=89?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - check-generated-bindings.mjs:snapshot() 改用普通 fs.readdirSync(absolute) - recursive 选项要 Node 18.17 / 20.1 才有;仓库没有 engines 约束,旧版本会静默退化成只读顶层,反而削弱嵌套目录的覆盖 - 四个生成目录都是平铺的(ts-rs 的 export_to 直接落文件),去掉后行为不变,已跑 check:generated-bindings 验证 --- scripts/check-generated-bindings.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/check-generated-bindings.mjs b/scripts/check-generated-bindings.mjs index 2ca94a959..355163474 100644 --- a/scripts/check-generated-bindings.mjs +++ b/scripts/check-generated-bindings.mjs @@ -78,7 +78,9 @@ function snapshot(dir) { // "0 个文件"静默通过——`export_to` 路径被改名或生成文件被整体删除时,校验形同虚设。 throw new Error(`生成绑定目录不存在,无法校验:${dir}`); } - const entries = fs.readdirSync(absolute, { recursive: true }); + // 四个生成目录都是平铺的(ts-rs 的 `export_to` 直接落文件,不再嵌套子目录); + // 不用 `recursive`,避免依赖 Node 18.17 / 20.1 才有的选项(旧版本会静默退化成只读顶层)。 + const entries = fs.readdirSync(absolute); return new Map( entries.flatMap((entry) => { const absoluteFile = path.join(absolute, entry);