v0.3.1 — a general variant guard, and parameters that survive readConfig
Fixes from the whole-branch review of v0.3.0. The language block's bytes change (a comment
gains the seam contract), so lang moves to v2 and all three sites need npm run design again.
Two of these are load-bearing for the next release, which cuts a deck-footer fence in two and
gives it a second parameter plus two form-variants that emit different bytes. Both would have bitten
there, and both were cheap now.
readConfig was dropping every parameter but the first
It returned a hardcoded {groups, langKey} while paramsFor read config values generically, by
parameter name. A closed reader and an open consumer.
So a site adding a second parameter exactly as instructed would have been told
"…has no lockup — add it to design.config.json" — instructed to do the thing it had already
done. A confidently wrong message is worse than a confusing one. readConfig now returns every
parameter the config carries and validates each the way langKey was validated.
The variant guard only ran for fences with a :root brace
FENCES["language"].closes is null, so the guard was skipped — the variant word on that fence
was decorative, which is the opposite of what it was introduced for.
Harmless there, because both language variants emit identical bytes. Not harmless for a fence
whose variants differ. The guard is now general: for any fence with variants, a page whose content
matches what a different variant would emit is an error, whether or not the fence has a brace.
The brace test stays where it applies — it catches the case before any sync has run, which the
general check cannot.
Where variants emit identical bytes, the general check honestly finds nothing, and the comment says
so rather than implying a guarantee that is not there.
Also
blockFornow rejects an undeclared parameter, not just a missing one — a typo'd parameter
was previously ignored in silence.blocks/lang.jsstates its seam contract: the page must supply alangvariable in scope and
callers forlangStored/langRemember. Those live outside the fence, sodesign:checkcannot
see them — a page that renameslangkeeps a byte-perfect fence and throws on every click.- Two comments that described mechanisms which do not exist are corrected.
Adopting
npm install --save-dev "github:robertblust/design#v0.3.1"
npm run design && npm run og