fix(compiler): reject dynamic api access in client functions

Usage-driven emission can only see api.<name> calls. api["name"]()
or passing api to a helper is invisible to it, silently drops the
block from the browser bundle, and fails at runtime instead of build
time. Detect that dynamic/indirect use (masking strings and comments
first, reusing the tokenizer's skipLiteralOrComment) and refuse to
compile instead, naming the offending function.
This commit is contained in:
2026-08-20 07:25:02 +05:30
parent 712a6d3d8c
commit a08dfa5322
6 changed files with 202 additions and 17 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
export { Lexer, LexError } from "./tokenizer.ts";
export { Lexer, LexError, skipLiteralOrComment } from "./tokenizer.ts";
export { formatWrn } from "./formatter.ts";
export type { FormatWrnOptions } from "./formatter.ts";
export { parse, parseHtmlView, ParseError, VOID_ELEMENTS } from "./parser.ts";