From 462f553442db8aca1f18d58f01f25b9d1b0d4274 Mon Sep 17 00:00:00 2001 From: Doxa Maps Date: Mon, 28 Sep 2026 07:12:04 +0000 Subject: [PATCH] check:browser-gates-guarded names its detector files by path internal/lib/browser-gates.mjs holds the regex that looks for a playwright import, so the check read it as an import once the file was tracked. The guard and the two detectors are excluded by path, so a real import added to one of them still fails. --- internal/check-browser-gates-guarded.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/check-browser-gates-guarded.mjs b/internal/check-browser-gates-guarded.mjs index 7bcf2f4f3..02c478bd5 100644 --- a/internal/check-browser-gates-guarded.mjs +++ b/internal/check-browser-gates-guarded.mjs @@ -22,9 +22,12 @@ if (process.argv.includes('--list')) { console.error(`${names.length} script(s) launch a browser: run each as internal/browser-slot.sh bun run `) process.exit(0) } +// Files that NAME the import pattern in a regex without importing playwright (the guard itself, and the +// detectors that look for it). Listed by path, not skipped by content, so a real import added to one fails. +const DETECTORS = new Set(['internal/lib/playwright-guarded.mjs', 'internal/check-browser-gates-guarded.mjs', 'internal/lib/browser-gates.mjs']) const DIRECT = /from\s+['"]playwright['"]|import\(\s*['"]playwright['"]\s*\)|require\(\s*['"]playwright['"]\s*\)/ const files = execFileSync('git', ['ls-files', '--', 'internal', 'plugin-designs'], { cwd: ROOT, encoding: 'utf8' }) - .split('\n').filter((f) => /\.(mjs|js|cjs)$/.test(f) && f !== 'internal/lib/playwright-guarded.mjs' && f !== 'internal/check-browser-gates-guarded.mjs' && f !== 'internal/run-parallel.mjs') + .split('\n').filter((f) => /\.(mjs|js|cjs)$/.test(f) && !DETECTORS.has(f)) const bad = [] for (const f of files) { const code = readFileSync(resolve(ROOT, f), 'utf8').replace(/\/\*[\s\S]*?\*\//g, '').replace(/^\s*\/\/.*$/gm, '')