@ogygia/rewrite
0.14.0 minor
@ogygia/rewrite
Minor Changes
- #1707
b20ae04Thanks @PuruVJ! - - breaking: an app's own pass over the HTML ogygia sends is the new@ogygia/rewritepackage.ogygia.handle({ transform })now throwshandle_transform_moved; listrewrite()(from@ogygia/rewrite/vite, no options) besideogygia(), and put arewrite()handle beforeogygia.handle()insequence().ogygia/markupis removed, andscanRegions/liftRegions/restoreRegionsleaveogygia/server. -@ogygia/rewrite:rewrite({ match, render })renders only the outermost custom elementsmatchpicks (a tag prefix, a list of tags, or a test), in onerender(elements, ctx)call per chunk of the page and per region answer, so a streamed page keeps streaming and its later chunks are rendered too. -@ogygia/rewrite: each elementrendergets has ogygia's marks numbered from 0, so a cache can key on its bytes; equal elements in one call are rendered once. -@ogygia/rewrite:ctxcarrieskind,csr,url,eventandsignal, an AbortSignal that fires when the request is cancelled. -@ogygia/rewrite: a render'ssheetsgo out once per key per response, into the head while it is open and inline before the first element that needs them after. -@ogygia/rewrite: a failed batch is retried one element at a time; an element that still fails, drops ogygia's marks, or returns HTML that does not close what it opens goes out as ogygia rendered it, with a warning in every build (rewrite_element_failed,rewrite_marks_lost), never thrown. -@ogygia/rewrite: an element split across streamed chunks goes out unrendered, said in dev (rewrite_element_split). -@ogygia/rewrite: several rewrites insequence()run in order on one marking of the HTML; one listed afterogygia.handle()throwsrewrite_after_ogygia, and a rewrite without the plugin throwsrewrite_plugin_missing. -@ogygia/rewrite:rewrite({ page })rewrites the whole document (held until its last chunk) or region answer, saysrewrite_page_failedwhen it throws (thrown in dev), and has.html(str)for a plain string. -@ogygia/rewrite:.check(html, { kind, csr })runs the whole round trip on one piece of markup for a test, listing failures and, with a DOM, every restored element that differs from Svelte's. -@ogygia/rewrite: a page where nothing was restored ships no restorer, and each streamed chunk that restored something ends with one short restore call. -@ogygia/devtools: the profiler reads a page's regions itself and no longer depends on@ogygia/rewrite.
Patch Changes
- #608
67127a4Thanks @PuruVJ! - -@ogygia/core: the runtime no longer carries the restore support for an app's own HTML pass (the restore report, a web component's class tokens through hydration, the answer restore hooks); apps without@ogygia/rewriteboot about 0.15 to 0.2 kB (brotli) smaller. -@ogygia/rewrite:rewrite()ships that support to the browser itself;restore_markup_brokenandrestore_lateare its message codes. - #855
db021f1Thanks @PuruVJ! -@ogygia/rewrite: the restorer's attribute reset (og-r) never sets anon*orsrcdocattribute, or ajavascript:/vbscript:URL (#851). - #1681
3398571Thanks @PuruVJ! - A restored host's shadow root is now declarative, as a server-rendered<template shadowrootmode>root would be: a component whose constructor attaches its own root no longer throws on upgrade, and gets that root back emptied. A host not yet upgraded is replaced by an equal element during the restore, before anything hydrates. - #1693
29ac140Thanks @PuruVJ! - A marked host that cannot have a shadow root no longer stops the restore: it is left as served with ogygia's marks taken off, said once per page and element name (restore_host_invalid), and every other host is still restored. - #1886
1b756bfThanks @PuruVJ! - The restorer refuses adata:URL in an attribute reset (og-r), as it refusesjavascript:andvbscript:, and reads each value's scheme the way a browser's URL parser does (the same check as core'shtml). - #1679
aa32050Thanks @PuruVJ! - A restored host whoseog-shadownames a sheet the page does not carry is no longer skipped silently: the page saysrestore_sheet_missingonce per key, and the other sheets it names still apply. - #710
28f8504Thanks @PuruVJ! -@ogygia/rewrite: the restorer for an app's server transform turns an<og-as>stand-in back only into a tag the server pass writes as one (a block, a list or table part, a link, a button, a form, an option), and never copies anon*attribute onto it. Any other<og-as>is left as it is. - #720
47d4d47Thanks @PuruVJ! - The restorer reshape inlines into a document the app's transform reshaped is now written the same safe way as every other inline script (no text in it can end the script element early). - #1393
9872aceThanks @PuruVJ! - The reversible transform's marking reads the page as the browser does: a quote inside an unquoted value or an attribute name no longer hides every custom element after it, a comment ends at--!>and<!-->too, and a custom element inside a<noscript>is left as the text it is. - #1832
b9edaf3Thanks @PuruVJ! - A matched element whose start tag a chunk boundary cuts, after a chunk with no match, is now said as split (rewrite_element_split, in dev) like any element its chunk ends inside, instead of going out unrendered with nothing said. - #1830
abdfed1Thanks @PuruVJ! - A matched element inside a declarative shadow root the page opened, in a later chunk of a streamed page, is now restored: that chunk's restore call enters every shadow root. - #1779
fa587dcThanks @PuruVJ! - A stand-in tag whose attributes include a name only the HTML parser accepts (like=eq) is restored to its real tag, and the restore goes on to every stand-in and host after it instead of stopping with an error.
Updated dependencies: @ogygia/[email protected], @ogygia/[email protected], @ogygia/[email protected]