Import map
Six entry points. Each is its own module, so a bundler keeps only what is imported.
| import | exports |
|---|---|
@itsy/html | html, trusted, attrs, cx, raw, Html, isHtml, HtmlError |
@itsy/html/attrs | attrs, cx, esc — no template scanner |
@itsy/html/check | check — the markup and accessibility checks |
@itsy/html/frame | frame, head, element |
@itsy/html/util | join, map, range, when, choose, wrap, comment |
@itsy/html/create | createHtml, SCHEMES |
@itsy/html/frame includes the renderer, so a page that uses frame() does not need to import @itsy/html separately. @itsy/html/util has no shared state between its helpers, so importing join does not pull in the other six.
Types come from the entry point they belong to: Renderable and the attrs() types from the root, Problem, Finding, RuleSet, Visitor, Report, A11yRule, A11yOptions and CheckOptions from /check, FrameOptions, HeadEntry and FramePart from /frame, CreateOptions from /create. They are listed in types.
Two builds per entry
package.json declares a development export condition for all six. Bundlers that honour it — Vite does, automatically — get the development build during development and the production build in a production build. Node and esbuild need --conditions=development. See bundlers and editors.
Both builds render identical output and throw the same HtmlError.code. The one exception is trusted: its development build refuses every value on which the two would differ, with code 20. Only the message text and the markup check differ: the development build spells the message out and checks the markup, and the production build throws E followed by the code.