1.20.0 release - #101
Open
ECorreia45 wants to merge 139 commits into
Open
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR prepares the Markup 1.20 release line from the
nextbranch. It replaces the renderer internals with a compiled, persistent-part architecture while retaining the establishedhtml, state, lifecycle, ref, helper, and template-rendering model from 1.19.x.The redesign compiles static template shapes once, keeps dynamic parts alive between updates, makes reactive ownership explicit, improves list reconciliation and teardown, removes obsolete renderer paths, and strengthens the package-owned documentation used by developers and AI tools.
Normal tagged-template usage remains source-compatible. The notable API evolutions are:
unsafeHTML(source)provides an explicit boundary for deliberately parsing trusted or independently sanitized markup.effect()is now lifecycle cleanup. Cleanup runs before the next execution and when the effect is disposed; non-function results continue to be cached and passed to the next execution.The legacy
html(string[])form remains operational but is deprecated in favor ofunsafeHTML. No separate component, resource, renderer, or template-result abstraction is introduced.Renderer architecture
Cached compilation and persistent parts
<template>definition.DOM parsing and updates
<script>and<style>interpolation behavior.childNodestraversal during insertion.Lists and reconciliation
Reactivity, lifecycle, and refs
effect()cleanup runs untracked before reruns and on disposal, while non-function result caching remains supported.Undocumented
HtmlTemplate.__*cooperation methods are marked internal and removed from emitted public declarations. The public class remains focused on template construction, DOM inspection, rendering, insertion, replacement, unmounting, and lifecycle callbacks.Async rendering
The existing callable
suspense()API is preserved, with more robust internal lifecycle handling:Errorobjects;No public resource API is added.
HTML safety boundary
Normal
htmltagged-template interpolations remain outside the browser HTML parser. Runtime strings are applied as values, including standalone table-row content and attributes.unsafeHTML(source)is the explicit boundary for parsing trusted or independently sanitized markup. User-controlled content should remain in ordinaryhtmlinterpolations and must not be passed tounsafeHTML.The older manually constructed array form, such as
html([source]), remains supported for compatibility and is deprecated. Theelement()helper remains a small element-construction shortcut; itshtmlContentoption maps to unsanitizedinnerHTML, which is now documented explicitly.Package and build cleanup
ReactiveNode, normalization, dynamic-raw parsing, render-content, andsyncNodespaths.@beforesemicolon/html-parserruntime dependency.@beforesemicolon/builder2.0.1 with minification-oriented build options.require().distpublishing layout.typesexport condition correctly.1.20.2-nextfor prerelease validation.Current package output:
The repository includes a separate SSR and hydration design plan. It is not part of the client API or published tarball, and any future server implementation must remain outside the browser bundle.
Documentation and AI context
llms.txtwith API contracts, behavioral rules, examples, and ecosystem boundaries.llms-full.txtartifact.element({ htmlContent })is unsanitized and intended only for trusted or independently sanitized HTML.Compatibility coverage
Regression coverage includes:
<template>.content;TemplateStringsArray | string[]callers and emitted deprecation documentation;unsafeHTML;suspense()return contract.Performance
Renderer comparison with 1.19.1
The renderer was compared with 1.19.1 using 1,000 representative rows on an Apple M3 with Node 24.14.0. These are medians from warmed, alternating paired runs with explicit garbage collection; absolute timings vary by machine.
js-framework-benchmark validation of the final lifecycle changes
The final runtime was also compared against the exact pre-lifecycle-change
nextcommit with the keyed js-framework-benchmark implementation. CPU measurements use 15 iterations and the framework's default throttling. A baseline run and a reverse-order candidate run were used to control for browser and machine ordering effects.The weighted CPU geometric ratio is
0.967x, approximately 3.3% faster overall. Memory is effectively neutral in the single-sample memory groups. The final browser client adds 532 raw bytes, 198 gzip bytes, and 153 Brotli bytes for the signal identity, cleanup, and suspense lifecycle behavior.These results validate that the final API and lifecycle additions do not regress the renderer hot path. Published-table placement is not claimed because the public comparison table is produced on a different machine and browser dataset.
Verification
Verification completed on the final branch:
npm run buildnpm pack --dry-rununsafeHTML.HtmlTemplate.__*methods.Review focus
The primary review areas are:
src/html.ts;src/state.tsandsrc/effect-context.ts;