diff --git a/internal/template-literal-check.mjs b/internal/template-literal-check.mjs index e610d2193..14768e2de 100644 --- a/internal/template-literal-check.mjs +++ b/internal/template-literal-check.mjs @@ -53,11 +53,36 @@ function pluginDesignVues() { return out } +// ★ THE SAME SCOPE BUG, A SECOND TIME — now in the OTHER half of the list (2026-09-22). +// The note above records fixing plugin-designs/ by recursing instead of globbing one level. But +// `library/` stayed a hand-written list of THREE .vue files, and 17 files under library/ carry a +// useShadowStyles(`…`) literal. So a backtick inside a CSS comment in any of the other 14 — e.g. +// library/components/hints/PinHint.vue — passed this gate AND passed check:sfc-parse, and would +// have broken the build later with the far-away Babel error this script exists to replace. +// MEASURED: injecting `LICENCE \`obligation\`` into PinHint.vue's literal left both gates green. +// +// A hand-maintained file list decays silently, because nothing tells you when a new file should +// have been added to it. That is what makes this class worse than a wrong rule: the rule was +// always right, and it was simply never shown the file. Walk the tree instead, so coverage is a +// consequence of where code lives rather than of someone remembering. +function vuesUnder(root) { + if (!existsSync(root)) return [] + const out = [] + const walk = (d) => { + for (const e of readdirSync(d, { withFileTypes: true })) { + if (e.name === 'node_modules' || e.name.startsWith('.')) continue + const p = join(d, e.name) + if (e.isDirectory()) walk(p) + else if (e.name.endsWith('.vue')) out.push(p) + } + } + walk(root) + return out +} + const FILES = [ - 'library/layouts/VerticalTabsLayout.vue', - 'library/layouts/StackLayout.vue', - 'library/ProfileLoader.vue', 'internal/generate-tree.mjs', + ...vuesUnder('library'), ...pluginDesignVues(), ] @@ -154,5 +179,11 @@ if (bad) { // wrong about its INPUT SET, and that failure mode reports SUCCESS. console.log( `TEMPLATE-LITERAL: PASS — no stray backticks inside template-literal CSS comments ` + - `(checked ${FILES.length} file(s): ${FILES.length - 4} under plugin-designs + 4 library/internal).` + // Counts are DERIVED, not hardcoded. The previous label said "+ 4 library/internal" because the + // library side used to be a hand-written list of exactly four paths; after that list became a + // tree walk the constant would have under-reported coverage by 36 files while sounding precise. + // A number in a status line is documentation, and documentation drifts — compute it. + `(checked ${FILES.length} file(s): ${FILES.filter((f) => f.startsWith('plugin-designs')).length} under ` + + `plugin-designs + ${FILES.filter((f) => f.startsWith('library')).length} under library + ` + + `${FILES.filter((f) => f.startsWith('internal')).length} internal).` )