Repository navigation
Load mermaid from a CDN by default; --offline embeds it - #102
Merged
Merged
Conversation
Mermaid is 5.5 MB of the 5.9 MB page. By default the page now loads it from jsDelivr at the vendored version, pinned by an SRI hash and allowed in the CSP by its exact URL; the page drops to about 350 KB. --offline embeds it as before. See ADR 0033.
A slow or blocked CDN held up app.js until the fetch timed out; the CDN script is now async and app.js renders diagrams when it loads. The CSP meta content is now HTML-escaped. Size figures live only in ADR 0033.
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.
The page was about 5.9 MB, and 5.5 MB of that is mermaid. Shared pages (ADR 0032) are stored on hidden refs that nothing prunes, so every preview adds that much.
What changes
--offlineembeds mermaid as before, for pages that must work without network.app.jsstay embedded in both modes (about 0.3 MB together).Safety
integrityhash of the vendored bundle. jsDelivr serves npm files unchanged, so the build needs no network, and the browser refuses any other content.async, so a slow or blocked CDN doesn't hold up the rest of the page. If mermaid never loads, each diagram shows as source text.Other changes
inline-assets.tsis renamed topage-assets.ts, since not every script is inlined any more.vendor/mermaid.version.<meta>content is now HTML-escaped.Testing
tsc,pnpm lintandpnpm testpass (1136 tests).--offlinerenders diagrams;