/** * virtual-documents — split a mixed-syntax source file into the plain * documents Eddie's validators already understand (#1827, #1864). * * AGENTS.md §2.5 tells every agent in every BFW consumer repo: * * > `eddie_validate_file` — Validate a `.ts` / `.scss` / `.vue` / `.njk` file * > for token-usage violations and naming convention issues. **Run this * > before every commit that touches Eddie code.** * * The tool did not do that. `.vue` and `.njk` hit the extension gate and came * back `validated: false` — next to `issueCount: 0`, which a caller skimming * for issues reads as a clean bill of health. That is the §2.13a shape: the * absence of a failure looking identical to the absence of a check. And it hit * exactly where it hurts most, because every BFW content site is Eleventy + * Nunjucks and every Nuxt consumer writes its Eddie markup in `.vue` SFCs — the * files the rule most wants checked were the files the tool refused. * * The validators each self-select by extension (`token-validator` returns `[]` * for anything but `.scss`/`.css`, `spacing-validator` for anything but * `.scss`, and so on), so nothing here needs to know which validator wants * which region. It only has to hand each region a filename with the right * extension, and remember where in the real file that region started so line * numbers can be mapped back. */ /** One extractable region of a source file, as a document a validator can read. */ export interface VirtualDocument { /** Extension to give the temp file, chosen so the right validators self-select. */ ext: '.html' | '.scss' | '.css' | '.ts'; /** The region's own text. */ content: string; /** * Zero-based count of lines in the original file BEFORE this region's first * line. Add it to a reported line number to get back to the real file. */ lineOffset: number; /** Human label for the region, so an issue can say where it came from. */ region: string; } /** * Blank out Nunjucks/Jinja syntax while preserving the line structure exactly. * * Line-for-line fidelity is the whole point: an issue reported at line 40 of the * neutralised text has to be line 40 of the file the author will open. So every * newline inside a replaced span survives, and only the non-newline characters * are dropped. * * `{{ ... }}` and `{% ... %}` are removed rather than replaced with a token, * because the common shape is interpolation *inside* an attribute — * `class="ed-c-card {{ modifier }}"` — where removing the expression leaves * valid markup with a real class list, and substituting a placeholder would * invent a class name that the naming validator would then flag. `{# ... #}` * comments go the same way. */ export declare function neutraliseTemplateSyntax(source: string): string; /** * Blank out Vue's control-flow `