Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use mermaid IFFE instead of bundling mermaid #685

Merged

Conversation

aloisklink
Copy link
Member

馃搼 Summary

Add support for Mermaid v10.9.0 and KaTeX, by importing the mermaid IFFE, instead of bundling it.

Since 9e168fb, we're bundling mermaid using vite. The main reason was that back then, Mermaid was only offering an ESM version of some libraries, but puppeteer doesn't support importing ESM from file:// URLs, due to CORS errors.

Unfortunately, the large size of KaTeX in Mermaid v10.9.0 seems to be somehow breaking mermaid-cli on slow computers.

However, Mermaid v10.2.0 added back the IFFE bundle, so we can now use that instead, in a <script src='file://'>, and we therefore don't need to bundle it.

This seems to fix the issue. It also means that we can move mermaid from devDependencies to a dependencies, allowing users to update their mermaid version independently from mermaid-cli!

Resolves #680
Closes #663

馃搹 Design Decisions

Describe the way your implementation works or what design decisions you made if applicable.

馃搵 Tasks

Make sure you

  • 馃摉 have read the contribution guidelines
  • 馃捇 have added unit/e2e tests (if appropriate)
  • 馃敄 targeted master branch

aloisklink and others added 4 commits April 27, 2024 19:12
Since
9e168fb (refactor: use `vite` to bundle `index.html` code, 2022-11-10),
we're bundling mermaid using vite. This allows us to get
around CORS issues with importing ESM modules.

However, Mermaid v10.9.0 is now much much larger, which is causing
issues on slower PCs.

Loading the Mermaid IFFE seems to fix this issue. It also means that we
can move mermaid to a `'dependencies` instead of a `'devDependencies`,
allowing users to update Mermaid without waiting for us to update
Mermaid.

See: 9e168fb
Bumps [mermaid](https://github.com/mermaid-js/mermaid) from 10.8.0 to 10.9.0.
- [Release notes](https://github.com/mermaid-js/mermaid/releases)
- [Changelog](https://github.com/mermaid-js/mermaid/blob/develop/CHANGELOG.md)
- [Commits](mermaid-js/mermaid@v10.8.0...v10.9.0)

---
updated-dependencies:
- dependency-name: mermaid
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@aloisklink aloisklink added bug Something isn't working dependencies Pull requests that update a dependency file labels Apr 27, 2024
@github-actions github-actions bot added the fix label Apr 27, 2024
@MindaugasLaganeckas
Copy link
Member

Thank you :)

@aloisklink
Copy link
Member Author

Sorry it took so long :) I've been pretty busy (and was ill for a while too) recently, and I didn't realize the fix would be so simple!

@MindaugasLaganeckas, can you make a v10.9.0 release? I still don't know the release process 馃槅

Mermaid v11 is apparently going to be the next Mermaid release, so I'll hopefully also start working on some breaking changes, like finally upgrading Puppeteer and dropping Node.JS v14 and v16 support.

@MindaugasLaganeckas MindaugasLaganeckas merged commit f4c8845 into mermaid-js:master May 7, 2024
7 of 8 checks passed
@MindaugasLaganeckas
Copy link
Member

I will document the release procedure :) Thank you :)

@aloisklink aloisklink deleted the fix/support-mermaid-v10.9.0 branch May 7, 2024 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade mermaid to 10.9.0 (Latex support)
2 participants