v0.9.0
New: browser entry point
@reteps/tree-sitter-htmlmustache/browser — bundler-friendly ESM entry exposing createLinter({ locateWasm, prettier? }) with lint() and format(). Targets in-browser editors (e.g. an Ace/CodeMirror editor running lint on every keystroke, format on a button click). No Node built-ins in the shipped path; consumers host and resolve the grammar WASM via the locateWasm callback or URL.
import { createLinter, DEFAULT_CONFIG } from '@reteps/tree-sitter-htmlmustache/browser';
const linter = await createLinter({ locateWasm, prettier });
const diagnostics = linter.lint(source, DEFAULT_CONFIG);
const formatted = await linter.format(source);Exports Diagnostic, Config, CustomRule, CustomTag, PrettierLike, DEFAULT_CONFIG, and createLinter. Full parity with htmlmustache check (all 8 built-in rules, custom rules, inline htmlmustache-disable directives, parse errors, HTML balance). Embedded <script>/<style> formatting is opt-in via injected prettier.
Internal reorg
- The rule engine, formatter, selector matcher, and schema types move from
lsp/server/src/to a browser-safesrc/core/. Node-only helpers (config-file discovery,.editorconfiglookup) stay underlsp/server/src/. - Selector parsing in
collectErrorsis now memoized — per-keystroke lint no longer re-parses the same custom-rule selectors. FormatDocumentParamsdrops the internalconfigFile/editorConfigfields; callers pre-resolveFormattingOptionsvia the exportedmergeOptions.- Shared helpers:
src/core/diagnostic.ts(toDiagnostic),src/core/formatting/embedded.ts(prettier-based embedded region formatter +PrettierLike),src/core/grammar.ts(GRAMMAR_WASM_FILENAME).
Compatibility
No breaking changes for existing consumers — the native binding (bindings/node), the htmlmustache CLI, and the grammar WASM are unchanged. LSP extension bumped to 0.9.0 alongside the parser.