Commit 82f9798
authored
perf: Self-host mermaid and load it only on pages with diagrams (#902)
* perf: Self-host mermaid and load it only on pages with diagrams
Every page used to import mermaid (~2 MB of js) from cdn.jsdelivr.net
whether it contained a diagram or not. The mermaid-script partial now
checks for a .mermaid element and only then imports a self-hosted es
module build; mermaid's internal chunks lazy-load per diagram type.
The extension skips injecting its own script when the UI ships
partials/mermaid-script.hbs, so the mermaid_library_url/script_stem
playbook configuration is gone and no third-party CDN is involved.
* fix: Ship mermaid's own es-module dist instead of re-bundling it
mermaid is a prebuilt, minified package; running another bundler over
it produced 'undefined is not a function' at runtime. The build now
copies the dist entry and its transitive chunk imports verbatim - the
same artifact the CDN used to serve. The import closure is verified
complete at build time by construction (every referenced chunk is
copied), and the module graph import-checks cleanly under node.1 parent f19129f commit 82f9798
10 files changed
Lines changed: 1685 additions & 239 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
| |||
0 commit comments