From cf0b23a4d1094191a74128dc7d9448fdf0d5784e Mon Sep 17 00:00:00 2001 From: Doxa Maps Date: Sun, 27 Sep 2026 22:00:29 +0000 Subject: [PATCH] check:mjs-parses parses with node even when the gates run under bun Under bun, process.execPath is bun, and bun --check runs the script instead of parsing it; a cloud build hung inside check-link-rot-sample.mjs. The gate now uses node under bun and fails plainly if node is missing. --- internal/check-mjs-parses.mjs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/check-mjs-parses.mjs b/internal/check-mjs-parses.mjs index e8ed55910..be0a854cd 100644 --- a/internal/check-mjs-parses.mjs +++ b/internal/check-mjs-parses.mjs @@ -57,13 +57,24 @@ if (!files.length) { process.exit(1) } +// Under bun, process.execPath is bun, and `bun --check` RUNS the script instead of parsing it (a cloud +// build hung 18+ min inside check-link-rot-sample.mjs). Parse with a real node, or refuse to guess. +let NODE = process.execPath +if (process.versions.bun) { + NODE = 'node' + try { execFileSync(NODE, ['--version'], { stdio: 'pipe' }) } catch { + console.error('MJS-PARSE: FAIL — running under bun and no `node` on PATH; this gate needs node --check (bun --check executes).') + process.exit(1) + } +} + const broken = [] for (const f of files) { const p = join(DIR, f) try { // `node --check` is the same parser the build uses, so a pass here means the build will at // least get past parsing. It does not execute the module. - execFileSync(process.execPath, ['--check', p], { stdio: 'pipe' }) + execFileSync(NODE, ['--check', p], { stdio: 'pipe' }) } catch (e) { const out = String(e.stderr || e.stdout || e.message) // node --check prints: \n\n\n\nSyntaxError: