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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align exports with dagre-d3 #5

Closed
sidharthv96 opened this issue Nov 17, 2022 · 3 comments
Closed

Align exports with dagre-d3 #5

sidharthv96 opened this issue Nov 17, 2022 · 3 comments

Comments

@sidharthv96
Copy link
Collaborator

Hi,

We're trying to migrate mermaid-js from dagre-d3 to dagre-es, but ran into trouble because some members are not exported in dagre-es.

mermaid-js/mermaid#3712 (comment)

Can we work together to expose the required items from dagre-es?

Thank you :)

@tbo47
Copy link
Owner

tbo47 commented Nov 17, 2022

Sure, I will have a look.

@aloisklink
Copy link
Collaborator

I've manage to migrate the mermaid codebase from dagre/dagre-d3 to dagre-es, and it looks like it has fixed a bunch of security warnings, and mermaid's bundle sizes seems to have gone down by ~200 KB (the magic of ESM!) See mermaid-js/mermaid@d708ed8

Some of the exports were quite a bit different however, e.g. I had to do the following:

// before
import dagreD3 from 'dagre-d3';
dagreD3.intersect.polygon(node, points, point);

// after
import { intersectPolygon } from 'dagre-d3-es/src/dagre-js/intersect/intersect-polygon';
intersectPolygon(node, points, point);

To be honest, the new syntax is probably better from an ESM/tree-shaking perspective though, and is probably the big reason why the built bundle has gone down by so much!

Many thanks for creating this fork!

@tbo47 tbo47 closed this as completed Nov 18, 2022
@tbo47 tbo47 reopened this Nov 18, 2022
@tbo47
Copy link
Owner

tbo47 commented Nov 18, 2022

I answered in the other thread mermaid-js/mermaid#3712

Don't hesitate to reopen this if needed.

@tbo47 tbo47 closed this as completed Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants