-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace dagre
/dagre-d3
with dagre-d3-es
#3809
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ~200KB decrease in size is phenomenal!!
import addHtmlLabel from 'dagre-d3/lib/label/add-html-label.js'; | ||
import { render as Render } from 'dagre-d3-es'; | ||
import { applyStyle } from 'dagre-d3-es/src/dagre-js/util'; | ||
import { addHtmlLabel } from 'dagre-d3-es/src/dagre-js/label/add-html-label.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the .js
extension necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is normally required in the browser/Node.JS, see https://nodejs.org/api/esm.html#mandatory-file-extensions, but it looks like Vite is allowing it.
My gut feeling is to add the .js
extension to everything except for things exported directly by the package.json
. I've changed this in fd76e0e (I've git rebase
-d my commits).
We could also try to add https://nodejs.org/api/packages.html#subpath-patterns to dagre-d3-es
, so that we could do stuff like import {applyStyle} from 'dagre-d3-es/dagre-d3/util.js
(e.g. without the /src/
bit) instead, but even then, the Node.JS docs seem to recommend only exporting paths that end with .js
if possible.
Currently, we have mindmap tests in the cypress/integration/rendering/mermaid.spec.js which is a bit odd. They should probably all be in the mindmap.spec.js file.
All tests have been moved to `mindmap.spec.js` in a previous commit.
Sometimes, the mindmap e2e tests take a snapshot when the mindmap SVG has been created, but hasn't yet been fully rendered. This adds a quick check for a mindmap section root, so that the snapshot is only taken after the mindmap diagram has started rendering. I was also running into JSDoc ESLint warnings, so I moved the file into a TypeScript file to fix those warnings.
Replace the dagre and dagre-d3 libraries with dagre-d3-es. Both dagre and dagre-d3 are deprecated and unmaintained, and haven't been updated for more than 3 years. Since dagre-d3 still requires an old version of d3, this causes a bunch of security warnings, e.g. GHSA-36jr-mh4h-2g58 The [dagre-d3-es](https://github.com/tbo47/dagre-es) package is a fork that contains support for `"d3": "^7.6.1"`. Also, it's ESM, so we will hopefully get smaller bundle sizes too. The only issue is that this fork isn't very well used (only has 3000 weekly downloads), compared to `dagre-d3`'s 250,000 weekly downloads. (although to be fair, a large proportion of dagre-d3's downloads probably come from mermaid) Since it's is a less popular package, **I've pinned `dagre-d3-es` to `"7.0.2"` instead of `"^7.0.2"`**. This does mean if there is a bug in `dagre-d3-es`, we will have to manually bump it ourselves, but it also means we won't accidentally be sending a buggy version of `dagre-d3-es` out to users in cases something changes (it might be worth disabling renovate for this if we're feeling paranoid!)
d708ed8
to
fd76e0e
Compare
I think we can go further actually :)
We could also try swapping out |
@sidharthv96 - what tool(s) did you use to generate the bundle size info? ( == my lack of experience with dealing with js toolchain) |
I think we should keep all the internal diagrams in a single bundle, mainly for backwards compatibility. In the To be honest, we don't really save much by moving it into separate bundles anyway, because all of the internal diagrams are always imported anyway by default (unless we enable lazy loading for all of them too). E.g.
|
I did enable lazy loading for them. There are some kinks to iron out, but there is a performance difference. Good 3G4GWiFi |
@weedySeaDragon I used https://github.com/btd/rollup-plugin-visualizer. Which has very nice diagrams. Image from their readme. |
🚀 Those size/speed differences look pretty good! I still think that the bundles the Mermaid project provides shouldn't change (at least unless it's announced as a breaking change in a v10), but enabling lazy loading for all the diagrams does make sense, since then people using mermaid with their own bundlers will get the performance benefits! |
I just released dagre-d3-es v7.0.4: https://www.npmjs.com/package/dagre-d3-es It includes the modification with intersect (that you are not using) and the loadash optimization |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [mermaid](https://github.com/mermaid-js/mermaid) | [`9.2.2` -> `9.3.0`](https://renovatebot.com/diffs/npm/mermaid/9.2.2/9.3.0) | [![age](https://badges.renovateapi.com/packages/npm/mermaid/9.3.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/mermaid/9.3.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/mermaid/9.3.0/compatibility-slim/9.2.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/mermaid/9.3.0/confidence-slim/9.2.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>mermaid-js/mermaid</summary> ### [`v9.3.0`](https://github.com/mermaid-js/mermaid/releases/tag/v9.3.0) [Compare Source](https://github.com/mermaid-js/mermaid/compare/v9.2.2...v9.3.0) ### Significant Changes - 25% Smaller - New docs - Replaces the deprecated and vulnerable `dagre-d3` with `dagre-es` ### Release Notes - [#​3778](https://github.com/mermaid-js/mermaid/issues/3778) Adding a hexgon shape ([#​3834](https://github.com/mermaid-js/mermaid/issues/3834)) [@​knsv](https://github.com/knsv) - [#​3831](https://github.com/mermaid-js/mermaid/issues/3831) Re-enabling themes for er diagrams ([#​3837](https://github.com/mermaid-js/mermaid/issues/3837)) [@​knsv](https://github.com/knsv) - [#​3882](https://github.com/mermaid-js/mermaid/issues/3882) fix for issues with mindmaps with only a single node ([#​3833](https://github.com/mermaid-js/mermaid/issues/3833)) [@​knsv](https://github.com/knsv) - (chore) remove console stmt in pieDetector ([#​3840](https://github.com/mermaid-js/mermaid/issues/3840)) [@​weedySeaDragon](https://github.com/weedySeaDragon) - (feat) state classDef documentation ([#​3841](https://github.com/mermaid-js/mermaid/issues/3841)) [@​weedySeaDragon](https://github.com/weedySeaDragon) - 3882 edge labels ([#​3883](https://github.com/mermaid-js/mermaid/issues/3883)) [@​knsv](https://github.com/knsv) - Add GHA that will check links + Fix broken links ([#​3765](https://github.com/mermaid-js/mermaid/issues/3765)) [@​spier](https://github.com/spier) - Add official vim plugin to list in integrations ([#​3847](https://github.com/mermaid-js/mermaid/issues/3847)) [@​craigmac](https://github.com/craigmac) - Add package visualizations ([#​3823](https://github.com/mermaid-js/mermaid/issues/3823)) [@​sidharthv96](https://github.com/sidharthv96) - Add support for [@​include](https://github.com/include) in docs ([#​3863](https://github.com/mermaid-js/mermaid/issues/3863)) [@​sidharthv96](https://github.com/sidharthv96) - CI: disable pinning dependencies ([#​3735](https://github.com/mermaid-js/mermaid/issues/3735)) [@​aloisklink](https://github.com/aloisklink) - Defects/issue 3878 ([#​3880](https://github.com/mermaid-js/mermaid/issues/3880)) [@​MrCoder](https://github.com/MrCoder) - Feat: Add aria-describedby, aria-roledescription ([#​3808](https://github.com/mermaid-js/mermaid/issues/3808)) [@​weedySeaDragon](https://github.com/weedySeaDragon) - Fix [#​3799](https://github.com/mermaid-js/mermaid/issues/3799): Remove `type` from package.json ([#​3802](https://github.com/mermaid-js/mermaid/issues/3802)) [@​sidharthv96](https://github.com/sidharthv96) - Fix for [#​3835](https://github.com/mermaid-js/mermaid/issues/3835), makes it possible to style path elements ([#​3836](https://github.com/mermaid-js/mermaid/issues/3836)) [@​knsv](https://github.com/knsv) - Fix typos ([#​3820](https://github.com/mermaid-js/mermaid/issues/3820)) [@​endolith](https://github.com/endolith) - Housekeeping with eslint-unicorn ([#​3845](https://github.com/mermaid-js/mermaid/issues/3845)) [@​sidharthv96](https://github.com/sidharthv96) - Integrations added - Visual Studio Code \[Polyglot Interactive Notebooks] ([#​3821](https://github.com/mermaid-js/mermaid/issues/3821)) [@​dfinke](https://github.com/dfinke) - Mindmap integration docs ([#​3810](https://github.com/mermaid-js/mermaid/issues/3810)) [@​sidharthv96](https://github.com/sidharthv96) - Reduce mermaid size by 31% ([#​3825](https://github.com/mermaid-js/mermaid/issues/3825)) [@​sidharthv96](https://github.com/sidharthv96) - Remove extra arrow and adjust cross position ([#​3641](https://github.com/mermaid-js/mermaid/issues/3641)) [@​ishuen](https://github.com/ishuen) - Replace `dagre`/`dagre-d3` with `dagre-d3-es` ([#​3809](https://github.com/mermaid-js/mermaid/issues/3809)) [@​aloisklink](https://github.com/aloisklink) - Revert "Added pie" ([#​3842](https://github.com/mermaid-js/mermaid/issues/3842)) [@​pbrolin47](https://github.com/pbrolin47) - Switch CDN to unpkg.com ([#​3777](https://github.com/mermaid-js/mermaid/issues/3777)) [@​sidharthv96](https://github.com/sidharthv96) - Switch back to jsdelivr ([#​3873](https://github.com/mermaid-js/mermaid/issues/3873)) [@​sidharthv96](https://github.com/sidharthv96) - Use `github-dark` to highlight fence blocks in vitepress docs ([#​3807](https://github.com/mermaid-js/mermaid/issues/3807)) [@​aloisklink](https://github.com/aloisklink) - Use current mermaid version in docs. ([#​3846](https://github.com/mermaid-js/mermaid/issues/3846)) [@​sidharthv96](https://github.com/sidharthv96) - Use stylis to prepend idSelector ([#​3829](https://github.com/mermaid-js/mermaid/issues/3829)) [@​DanInProgress](https://github.com/DanInProgress) - bug: State diagram fix classes type ([#​3798](https://github.com/mermaid-js/mermaid/issues/3798)) [@​weedySeaDragon](https://github.com/weedySeaDragon) - bug: change shiki getHighlighter import ([#​3804](https://github.com/mermaid-js/mermaid/issues/3804)) [@​weedySeaDragon](https://github.com/weedySeaDragon) - chore(deps): remove dependency on `graphlib` ([#​3861](https://github.com/mermaid-js/mermaid/issues/3861)) [@​aloisklink](https://github.com/aloisklink) - chore(deps): update all non-major dependencies (minor) ([#​3905](https://github.com/mermaid-js/mermaid/issues/3905)) [@​renovate](https://github.com/renovate) - chore(deps): update all non-major dependencies (minor) ([#​3791](https://github.com/mermaid-js/mermaid/issues/3791)) [@​renovate](https://github.com/renovate) - chore(deps): update lycheeverse/lychee-action action to v1.5.4 ([#​3827](https://github.com/mermaid-js/mermaid/issues/3827)) [@​renovate](https://github.com/renovate) - chore(deps): update pnpm to v7.17.0 ([#​3828](https://github.com/mermaid-js/mermaid/issues/3828)) [@​renovate](https://github.com/renovate) - chore(deps): update pnpm to v7.17.1 ([#​3862](https://github.com/mermaid-js/mermaid/issues/3862)) [@​renovate](https://github.com/renovate) - chore(docs): Auto build docs ([#​3547](https://github.com/mermaid-js/mermaid/issues/3547)) [@​sidharthv96](https://github.com/sidharthv96) - chore: Housekeeping ([#​3783](https://github.com/mermaid-js/mermaid/issues/3783)) [@​sidharthv96](https://github.com/sidharthv96) - chore: Merge master to develop ([#​3780](https://github.com/mermaid-js/mermaid/issues/3780)) [@​sidharthv96](https://github.com/sidharthv96) - chore: clean up code in mermaidAPI render() and write specs/tests ([#​3684](https://github.com/mermaid-js/mermaid/issues/3684)) [@​weedySeaDragon](https://github.com/weedySeaDragon) - chore: delete functions not used in diagrams/c4 code (dead code) ([#​3871](https://github.com/mermaid-js/mermaid/issues/3871)) [@​weedySeaDragon](https://github.com/weedySeaDragon) - comments in states are skipped now ([#​3762](https://github.com/mermaid-js/mermaid/issues/3762)) [@​avijit1258](https://github.com/avijit1258) - doc: remove links from atom.io; add note Atom has been archived ([#​3899](https://github.com/mermaid-js/mermaid/issues/3899)) [@​weedySeaDragon](https://github.com/weedySeaDragon) - docs: refactor Theming doc ([#​3889](https://github.com/mermaid-js/mermaid/issues/3889)) [@​huynhicode](https://github.com/huynhicode) - feat: Redirect old documentation links. ([#​3797](https://github.com/mermaid-js/mermaid/issues/3797)) [@​sidharthv96](https://github.com/sidharthv96) - feat: Title support via front matter for ER, state, class, git, and graph diagrams ([#​3706](https://github.com/mermaid-js/mermaid/issues/3706)) [@​MasonM](https://github.com/MasonM) - fix(deps): update all non-major dependencies (patch) ([#​3790](https://github.com/mermaid-js/mermaid/issues/3790)) [@​renovate](https://github.com/renovate) - fix(deps): update dependency rollup to v3 ([#​3674](https://github.com/mermaid-js/mermaid/issues/3674)) [@​renovate](https://github.com/renovate) - fix: LintStaged ([#​3844](https://github.com/mermaid-js/mermaid/issues/3844)) [@​sidharthv96](https://github.com/sidharthv96) 🎉 **Thanks to all contributors helping with this release!** 🎉 #### What's Changed - chore(deps): update actions/checkout action to v3 by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3645](https://github.com/mermaid-js/mermaid/pull/3645) - chore(deps): update actions/setup-node action to v3 by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3646](https://github.com/mermaid-js/mermaid/pull/3646) - Remove inconsistent and deprecated semicolons by [@​revolter](https://github.com/revolter) in [https://github.com/mermaid-js/mermaid/pull/3657](https://github.com/mermaid-js/mermaid/pull/3657) - Fix windows paths for `docs:build` by [@​arpansaha13](https://github.com/arpansaha13) in [https://github.com/mermaid-js/mermaid/pull/3605](https://github.com/mermaid-js/mermaid/pull/3605) - feat: make `parseError` function more type-safe by [@​Some-Dood](https://github.com/Some-Dood) in [https://github.com/mermaid-js/mermaid/pull/3643](https://github.com/mermaid-js/mermaid/pull/3643) - chore(deps): update all non-major dependencies (minor) by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3632](https://github.com/mermaid-js/mermaid/pull/3632) - chore(deps): update all non-major dependencies (patch) by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3671](https://github.com/mermaid-js/mermaid/pull/3671) - chore(deps): pin dependencies by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3685](https://github.com/mermaid-js/mermaid/pull/3685) - Added Open Graph meta tags by [@​danangtomo](https://github.com/danangtomo) in [https://github.com/mermaid-js/mermaid/pull/3679](https://github.com/mermaid-js/mermaid/pull/3679) - add eslint-plugin-no-only-tests plugin by [@​DKurilo](https://github.com/DKurilo) in [https://github.com/mermaid-js/mermaid/pull/3690](https://github.com/mermaid-js/mermaid/pull/3690) - Added and configured cspell plugin to eslint by [@​devcer](https://github.com/devcer) in [https://github.com/mermaid-js/mermaid/pull/3604](https://github.com/mermaid-js/mermaid/pull/3604) - fix: gantt demo diagrams ([#​3655](https://github.com/mermaid-js/mermaid/issues/3655)) by [@​isinek](https://github.com/isinek) in [https://github.com/mermaid-js/mermaid/pull/3688](https://github.com/mermaid-js/mermaid/pull/3688) - Chore/3697 eslint curly by [@​jeroenekkelkamp](https://github.com/jeroenekkelkamp) in [https://github.com/mermaid-js/mermaid/pull/3698](https://github.com/mermaid-js/mermaid/pull/3698) - Update sequenceDiagram.md by [@​imgss](https://github.com/imgss) in [https://github.com/mermaid-js/mermaid/pull/3707](https://github.com/mermaid-js/mermaid/pull/3707) - Use `eslint-plugin-tsdoc` for TypeScript files instead of `eslint-plugin-jsdoc` by [@​aloisklink](https://github.com/aloisklink) in [https://github.com/mermaid-js/mermaid/pull/3708](https://github.com/mermaid-js/mermaid/pull/3708) - chore(deps): pin dependencies by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3713](https://github.com/mermaid-js/mermaid/pull/3713) - chore(deps): update all non-major dependencies (patch) by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3714](https://github.com/mermaid-js/mermaid/pull/3714) - Order pie chart slices clockwise by order of entries by [@​jasmaa](https://github.com/jasmaa) in [https://github.com/mermaid-js/mermaid/pull/3609](https://github.com/mermaid-js/mermaid/pull/3609) - fix: border attribute does not work in a certain writing style by [@​maiermic](https://github.com/maiermic) in [https://github.com/mermaid-js/mermaid/pull/3636](https://github.com/mermaid-js/mermaid/pull/3636) - add the way to add notes to class diagram by [@​DKurilo](https://github.com/DKurilo) in [https://github.com/mermaid-js/mermaid/pull/3647](https://github.com/mermaid-js/mermaid/pull/3647) - add statement aliases for ER diagram by [@​DKurilo](https://github.com/DKurilo) in [https://github.com/mermaid-js/mermaid/pull/3649](https://github.com/mermaid-js/mermaid/pull/3649) - fix: Fix useMaxWidth option for git graph by [@​uttk](https://github.com/uttk) in [https://github.com/mermaid-js/mermaid/pull/3652](https://github.com/mermaid-js/mermaid/pull/3652) - [#​3659](https://github.com/mermaid-js/mermaid/issues/3659) Adding height when not using maxWidth by [@​knsv](https://github.com/knsv) in [https://github.com/mermaid-js/mermaid/pull/3668](https://github.com/mermaid-js/mermaid/pull/3668) - Change fill attribute to style by [@​CalebUsadi](https://github.com/CalebUsadi) in [https://github.com/mermaid-js/mermaid/pull/3719](https://github.com/mermaid-js/mermaid/pull/3719) - feat: \[State diagram] Add classDefs and classes to states by [@​weedySeaDragon](https://github.com/weedySeaDragon) in [https://github.com/mermaid-js/mermaid/pull/3644](https://github.com/mermaid-js/mermaid/pull/3644) - Fill inheritance arrow with background color by [@​vallsv](https://github.com/vallsv) in [https://github.com/mermaid-js/mermaid/pull/3543](https://github.com/mermaid-js/mermaid/pull/3543) - Ensure example code and rendered output are synced by [@​marcjansen](https://github.com/marcjansen) in [https://github.com/mermaid-js/mermaid/pull/3721](https://github.com/mermaid-js/mermaid/pull/3721) - fix(git): Support quoted branch names by [@​gibson042](https://github.com/gibson042) in [https://github.com/mermaid-js/mermaid/pull/3726](https://github.com/mermaid-js/mermaid/pull/3726) - docs: Add link to docs source by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3612](https://github.com/mermaid-js/mermaid/pull/3612) - chore(deps): update all non-major dependencies (patch) by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3736](https://github.com/mermaid-js/mermaid/pull/3736) - chore(deps): update all non-major dependencies (minor) by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3737](https://github.com/mermaid-js/mermaid/pull/3737) - feat(gantt): Add option 'tickInterval' for custom tick interval by [@​DarkNami](https://github.com/DarkNami) in [https://github.com/mermaid-js/mermaid/pull/3729](https://github.com/mermaid-js/mermaid/pull/3729) - Fix/convert attr to style in er graph by [@​CalebUsadi](https://github.com/CalebUsadi) in [https://github.com/mermaid-js/mermaid/pull/3722](https://github.com/mermaid-js/mermaid/pull/3722) - update user story link for [#​3740](https://github.com/mermaid-js/mermaid/issues/3740) by [@​6footGeek](https://github.com/6footGeek) in [https://github.com/mermaid-js/mermaid/pull/3741](https://github.com/mermaid-js/mermaid/pull/3741) - Improved New Documentation by [@​emersonbottero](https://github.com/emersonbottero) in [https://github.com/mermaid-js/mermaid/pull/3678](https://github.com/mermaid-js/mermaid/pull/3678) - chore: fix cSpell word entry misspelling "mermiad" -> "mermaid" by [@​weedySeaDragon](https://github.com/weedySeaDragon) in [https://github.com/mermaid-js/mermaid/pull/3751](https://github.com/mermaid-js/mermaid/pull/3751) - Fix link to CSS classes by [@​hugovk](https://github.com/hugovk) in [https://github.com/mermaid-js/mermaid/pull/3752](https://github.com/mermaid-js/mermaid/pull/3752) - docs: Update references to default config in directives page by [@​raptor0929](https://github.com/raptor0929) in [https://github.com/mermaid-js/mermaid/pull/3738](https://github.com/mermaid-js/mermaid/pull/3738) - Fix link relative links to documentation files by [@​spier](https://github.com/spier) in [https://github.com/mermaid-js/mermaid/pull/3760](https://github.com/mermaid-js/mermaid/pull/3760) - chore(deps): update all non-major dependencies (patch) by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3769](https://github.com/mermaid-js/mermaid/pull/3769) - chore(deps): update all non-major dependencies (minor) by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3770](https://github.com/mermaid-js/mermaid/pull/3770) - Fix CSpell by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3753](https://github.com/mermaid-js/mermaid/pull/3753) - Live edits for Docs by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3755](https://github.com/mermaid-js/mermaid/pull/3755) - Switch CDN to unpkg.com by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3777](https://github.com/mermaid-js/mermaid/pull/3777) - chore: Housekeeping by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3783](https://github.com/mermaid-js/mermaid/pull/3783) - Pnpm issue reproduction by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3784](https://github.com/mermaid-js/mermaid/pull/3784) - fix(deps): update all non-major dependencies (patch) by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3790](https://github.com/mermaid-js/mermaid/pull/3790) - chore: clean up code in mermaidAPI render() and write specs/tests by [@​weedySeaDragon](https://github.com/weedySeaDragon) in [https://github.com/mermaid-js/mermaid/pull/3684](https://github.com/mermaid-js/mermaid/pull/3684) - chore(deps): update all non-major dependencies (minor) by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3791](https://github.com/mermaid-js/mermaid/pull/3791) - fix(deps): update dependency rollup to v3 by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3674](https://github.com/mermaid-js/mermaid/pull/3674) - Add GHA that will check links + Fix broken links by [@​spier](https://github.com/spier) in [https://github.com/mermaid-js/mermaid/pull/3765](https://github.com/mermaid-js/mermaid/pull/3765) - chore: Merge master to develop by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3780](https://github.com/mermaid-js/mermaid/pull/3780) - bug: change shiki getHighlighter import by [@​weedySeaDragon](https://github.com/weedySeaDragon) in [https://github.com/mermaid-js/mermaid/pull/3804](https://github.com/mermaid-js/mermaid/pull/3804) - Fix [#​3799](https://github.com/mermaid-js/mermaid/issues/3799): Remove `type` from package.json by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3802](https://github.com/mermaid-js/mermaid/pull/3802) - CI: disable pinning dependencies by [@​aloisklink](https://github.com/aloisklink) in [https://github.com/mermaid-js/mermaid/pull/3735](https://github.com/mermaid-js/mermaid/pull/3735) - bug: State diagram fix classes type by [@​weedySeaDragon](https://github.com/weedySeaDragon) in [https://github.com/mermaid-js/mermaid/pull/3798](https://github.com/mermaid-js/mermaid/pull/3798) - Remove extra arrow and adjust cross position by [@​ishuen](https://github.com/ishuen) in [https://github.com/mermaid-js/mermaid/pull/3641](https://github.com/mermaid-js/mermaid/pull/3641) - comments in states are skipped now by [@​avijit1258](https://github.com/avijit1258) in [https://github.com/mermaid-js/mermaid/pull/3762](https://github.com/mermaid-js/mermaid/pull/3762) - feat: Redirect old documentation links. by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3797](https://github.com/mermaid-js/mermaid/pull/3797) - Mindmap integration docs by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3810](https://github.com/mermaid-js/mermaid/pull/3810) - Use `github-dark` to highlight fence blocks in vitepress docs by [@​aloisklink](https://github.com/aloisklink) in [https://github.com/mermaid-js/mermaid/pull/3807](https://github.com/mermaid-js/mermaid/pull/3807) - chore(deps): update lycheeverse/lychee-action action to v1.5.4 by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3827](https://github.com/mermaid-js/mermaid/pull/3827) - chore(deps): update pnpm to v7.17.0 by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3828](https://github.com/mermaid-js/mermaid/pull/3828) - feat: Title support via front matter for ER, state, class, git, and graph diagrams by [@​MasonM](https://github.com/MasonM) in [https://github.com/mermaid-js/mermaid/pull/3706](https://github.com/mermaid-js/mermaid/pull/3706) - Replace `dagre`/`dagre-d3` with `dagre-d3-es` by [@​aloisklink](https://github.com/aloisklink) in [https://github.com/mermaid-js/mermaid/pull/3809](https://github.com/mermaid-js/mermaid/pull/3809) - Add package visualizations by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3823](https://github.com/mermaid-js/mermaid/pull/3823) - [#​3882](https://github.com/mermaid-js/mermaid/issues/3882) fix for issues with mindmaps with only a single node by [@​knsv](https://github.com/knsv) in [https://github.com/mermaid-js/mermaid/pull/3833](https://github.com/mermaid-js/mermaid/pull/3833) - [#​3778](https://github.com/mermaid-js/mermaid/issues/3778) Adding a hexgon shape by [@​knsv](https://github.com/knsv) in [https://github.com/mermaid-js/mermaid/pull/3834](https://github.com/mermaid-js/mermaid/pull/3834) - Fix for [#​3835](https://github.com/mermaid-js/mermaid/issues/3835), makes it possible to style path elements by [@​knsv](https://github.com/knsv) in [https://github.com/mermaid-js/mermaid/pull/3836](https://github.com/mermaid-js/mermaid/pull/3836) - [#​3831](https://github.com/mermaid-js/mermaid/issues/3831) Re-enabling themes for er diagrams by [@​knsv](https://github.com/knsv) in [https://github.com/mermaid-js/mermaid/pull/3837](https://github.com/mermaid-js/mermaid/pull/3837) - (chore) remove console stmt in pieDetector by [@​weedySeaDragon](https://github.com/weedySeaDragon) in [https://github.com/mermaid-js/mermaid/pull/3840](https://github.com/mermaid-js/mermaid/pull/3840) - Revert "Added pie" by [@​pbrolin47](https://github.com/pbrolin47) in [https://github.com/mermaid-js/mermaid/pull/3842](https://github.com/mermaid-js/mermaid/pull/3842) - Fix typos by [@​endolith](https://github.com/endolith) in [https://github.com/mermaid-js/mermaid/pull/3820](https://github.com/mermaid-js/mermaid/pull/3820) - (feat) state classDef documentation by [@​weedySeaDragon](https://github.com/weedySeaDragon) in [https://github.com/mermaid-js/mermaid/pull/3841](https://github.com/mermaid-js/mermaid/pull/3841) - Integrations added - Visual Studio Code \[Polyglot Interactive Notebooks] by [@​dfinke](https://github.com/dfinke) in [https://github.com/mermaid-js/mermaid/pull/3821](https://github.com/mermaid-js/mermaid/pull/3821) - Reduce mermaid size by 31% by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3825](https://github.com/mermaid-js/mermaid/pull/3825) - fix: LintStaged by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3844](https://github.com/mermaid-js/mermaid/pull/3844) - Add official vim plugin to list in integrations by [@​craigmac](https://github.com/craigmac) in [https://github.com/mermaid-js/mermaid/pull/3847](https://github.com/mermaid-js/mermaid/pull/3847) - chore(deps): remove dependency on `graphlib` by [@​aloisklink](https://github.com/aloisklink) in [https://github.com/mermaid-js/mermaid/pull/3861](https://github.com/mermaid-js/mermaid/pull/3861) - chore(deps): update pnpm to v7.17.1 by [@​renovate](https://github.com/renovate) in [https://github.com/mermaid-js/mermaid/pull/3862](https://github.com/mermaid-js/mermaid/pull/3862) - Make gitgraph snapshots consistent in E2E tests by [@​aloisklink](https://github.com/aloisklink) in [https://github.com/mermaid-js/mermaid/pull/3860](https://github.com/mermaid-js/mermaid/pull/3860) - Use stylis to prepend idSelector by [@​DanInProgress](https://github.com/DanInProgress) in [https://github.com/mermaid-js/mermaid/pull/3829](https://github.com/mermaid-js/mermaid/pull/3829) - Use current mermaid version in docs. by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3846](https://github.com/mermaid-js/mermaid/pull/3846) - Add support for [@​include](https://github.com/include) in docs by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3863](https://github.com/mermaid-js/mermaid/pull/3863) - Housekeeping with eslint-unicorn by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3845](https://github.com/mermaid-js/mermaid/pull/3845) - chore: delete functions not used in diagrams/c4 code (dead code) by [@​weedySeaDragon](https://github.com/weedySeaDragon) in [https://github.com/mermaid-js/mermaid/pull/3871](https://github.com/mermaid-js/mermaid/pull/3871) - Switch back to jsdelivr by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3873](https://github.com/mermaid-js/mermaid/pull/3873) - 3882 edge labels by [@​knsv](https://github.com/knsv) in [https://github.com/mermaid-js/mermaid/pull/3883](https://github.com/mermaid-js/mermaid/pull/3883) - Small fix for issue [#​3881](https://github.com/mermaid-js/mermaid/issues/3881) by [@​knsv](https://github.com/knsv) in [https://github.com/mermaid-js/mermaid/pull/3884](https://github.com/mermaid-js/mermaid/pull/3884) - Defects/issue 3878 by [@​MrCoder](https://github.com/MrCoder) in [https://github.com/mermaid-js/mermaid/pull/3880](https://github.com/mermaid-js/mermaid/pull/3880) - chore(docs): Auto build docs by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3547](https://github.com/mermaid-js/mermaid/pull/3547) - docs: refactor Theming doc by [@​huynhicode](https://github.com/huynhicode) in [https://github.com/mermaid-js/mermaid/pull/3889](https://github.com/mermaid-js/mermaid/pull/3889) - Feat: Add aria-describedby, aria-roledescription by [@​weedySeaDragon](https://github.com/weedySeaDragon) in [https://github.com/mermaid-js/mermaid/pull/3808](https://github.com/mermaid-js/mermaid/pull/3808) - Release/9.3.0 by [@​sidharthv96](https://github.com/sidharthv96) in [https://github.com/mermaid-js/mermaid/pull/3911](https://github.com/mermaid-js/mermaid/pull/3911) #### New Contributors - [@​revolter](https://github.com/revolter) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3657](https://github.com/mermaid-js/mermaid/pull/3657) - [@​Some-Dood](https://github.com/Some-Dood) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3643](https://github.com/mermaid-js/mermaid/pull/3643) - [@​danangtomo](https://github.com/danangtomo) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3679](https://github.com/mermaid-js/mermaid/pull/3679) - [@​DKurilo](https://github.com/DKurilo) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3690](https://github.com/mermaid-js/mermaid/pull/3690) - [@​devcer](https://github.com/devcer) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3604](https://github.com/mermaid-js/mermaid/pull/3604) - [@​isinek](https://github.com/isinek) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3688](https://github.com/mermaid-js/mermaid/pull/3688) - [@​jeroenekkelkamp](https://github.com/jeroenekkelkamp) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3698](https://github.com/mermaid-js/mermaid/pull/3698) - [@​imgss](https://github.com/imgss) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3707](https://github.com/mermaid-js/mermaid/pull/3707) - [@​jasmaa](https://github.com/jasmaa) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3609](https://github.com/mermaid-js/mermaid/pull/3609) - [@​uttk](https://github.com/uttk) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3652](https://github.com/mermaid-js/mermaid/pull/3652) - [@​CalebUsadi](https://github.com/CalebUsadi) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3719](https://github.com/mermaid-js/mermaid/pull/3719) - [@​marcjansen](https://github.com/marcjansen) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3721](https://github.com/mermaid-js/mermaid/pull/3721) - [@​DarkNami](https://github.com/DarkNami) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3729](https://github.com/mermaid-js/mermaid/pull/3729) - [@​6footGeek](https://github.com/6footGeek) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3741](https://github.com/mermaid-js/mermaid/pull/3741) - [@​hugovk](https://github.com/hugovk) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3752](https://github.com/mermaid-js/mermaid/pull/3752) - [@​raptor0929](https://github.com/raptor0929) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3738](https://github.com/mermaid-js/mermaid/pull/3738) - [@​spier](https://github.com/spier) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3760](https://github.com/mermaid-js/mermaid/pull/3760) - [@​ishuen](https://github.com/ishuen) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3641](https://github.com/mermaid-js/mermaid/pull/3641) - [@​avijit1258](https://github.com/avijit1258) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3762](https://github.com/mermaid-js/mermaid/pull/3762) - [@​MasonM](https://github.com/MasonM) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3706](https://github.com/mermaid-js/mermaid/pull/3706) - [@​endolith](https://github.com/endolith) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3820](https://github.com/mermaid-js/mermaid/pull/3820) - [@​dfinke](https://github.com/dfinke) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3821](https://github.com/mermaid-js/mermaid/pull/3821) - [@​craigmac](https://github.com/craigmac) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3847](https://github.com/mermaid-js/mermaid/pull/3847) - [@​DanInProgress](https://github.com/DanInProgress) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3829](https://github.com/mermaid-js/mermaid/pull/3829) - [@​MrCoder](https://github.com/MrCoder) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3880](https://github.com/mermaid-js/mermaid/pull/3880) - [@​huynhicode](https://github.com/huynhicode) made their first contribution in [https://github.com/mermaid-js/mermaid/pull/3889](https://github.com/mermaid-js/mermaid/pull/3889) **Full Changelog**: mermaid-js/mermaid@v9.2.2...v9.3.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/BirthdayResearch/contented). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC41NC4yIiwidXBkYXRlZEluVmVyIjoiMzQuNjIuMSJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
📑 Summary
Replace the
dagre
anddagre-d3
libraries withdagre-d3-es
.Both dagre and dagre-d3 are deprecated and unmaintained, and haven't been updated for more than 3 years.
Since dagre-d3 still requires an old version of d3, this causes a bunch of security warnings, e.g. GHSA-36jr-mh4h-2g58
The dagre-d3-es package is a fork that contains support for
"d3": "^7.6.1"
. Also, it's ESM, so we will get smaller bundle sizes too (mermaid.esm.min.mjs
seems to be about 180 KB smaller!)The only issue is that this fork isn't very well used (only has 3000 weekly downloads), compared to
dagre-d3
's 250,000 weekly downloads (although to be fair, a large proportion of dagre-d3's downloads probably come from mermaid).Resolves #3712
Resolves #3705 (there might be other issues, but
pnpm audit
now saysNo known vulnerabilities found
)Resolves #3666
Resolves #2626
📏 Design Decisions
The mindmap e2e tests were being a bit flaky.
Sometimes, the mindmap e2e tests take a snapshot when the mindmap SVG has been created, but hasn't yet been fully rendered. E.g., the
<svg ....>
exits, but is empty.I've added a quick check for a mindmap section root, so that the snapshot is only taken after the mindmap diagram has started rendering, and it seems like nothing has changed in the
e2e
tests.I also added a
demos/mindmap.html
example, since I needed it anyway to help write the Cypress E2E tests.Since it's is a less popular package, I've pinned
dagre-d3-es
to"7.0.2"
instead of"^7.0.2"
. This does mean if there is a bug indagre-d3-es
, we will have to manually bump it ourselves, but it also means we won't accidentally be sending a buggy version ofdagre-d3-es
out to users in cases something changes (it might be worth disabling renovate for this if we're feeling paranoid!)In the long-term, we should slowly move towards removing
dagre
if we can, see #1969.Other useful links:
dagre-d3
Snyk page: https://snyk.io/advisor/npm-package/dagre-d3dagre-d3-es
Snyk page: https://snyk.io/advisor/npm-package/dagre-d3-es (No known security issues)📋 Tasks
Make sure you
develop
branch