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

Create new @visx/delaunay package #1678

Merged
merged 21 commits into from
Jul 11, 2023
Merged

Conversation

SheaJanke
Copy link
Contributor

🚀 Enhancements

  • Add a new @visx/delaunay package that acts as a wrapper for d3-delaunay.
  • Supports Voronoi diagrams as well as Delaunay triangulation.
  • @visx/delaunay aims to replace @visx/voronoi.

closes: #1330

@SheaJanke
Copy link
Contributor Author

Hey @williaster, if you have some time can you take a look at this review? The code and documentation closely follow @visx/voronoi, so hopefully there aren't too many issues.

Copy link
Collaborator

@williaster williaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @SheaJanke thanks for the contribution and fix for the OOM issue! Sorry this has taken me forever to review but I just left some comments which pertain to the new @visx/vendor package (which unfortunately also resulted in some merge conflicts). after those changes I think we should be able to land this/I'll keep an eye on it.

Thanks for all the work adding a new package and finding all of the "hooks" to add references, @visx/demo examples, etc. 🙏

packages/visx-delaunay/yarn.lock Outdated Show resolved Hide resolved
packages/visx-demo/public/static/docs/visx-demo.html Outdated Show resolved Hide resolved
packages/visx-delaunay/package.json Outdated Show resolved Hide resolved
@SheaJanke
Copy link
Contributor Author

Thanks for the review! I'll try to address the comments and merge conflicts in the next week or so.

SheaJanke added 3 commits July 5, 2023 21:12
* Change d3-delaunay references to @visx/vendor package.

* Delete unnecessary yarn.lock file and visx-demo.html
@SheaJanke SheaJanke requested a review from williaster July 6, 2023 06:08
Copy link
Collaborator

@williaster williaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SheaJanke this is great, thanks for such a clean addition and pattern matching everything so well 💯

also appreciate the additional fixes for the @visx/vendor merge conflicts. I had a couple super minor suggestions but overall this LGTM. let me know if you want to work on those minor things, else we can land as is.

jest.config.js Outdated
@@ -44,6 +44,6 @@ module.exports = {
verbose: false,
testPathIgnorePatterns: ['<rootDir>/packages/visx-demo'],
transformIgnorePatterns: [
'node_modules/(?!(d3-(array|color|format|interpolate|scale|time|time-format)|internmap)/)',
'node_modules/(?!(d3-(array|color|delaunay|format|interpolate|scale|time|time-format)|delaunator|internmap|robust-predicates)/)',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah interesting, I missed this in the esm/cjs work. I might need to revisit this (in a separate PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had another look at this, and I was able to remove d3-delaunay from here. The other two still seem to be necessary.

Copy link
Collaborator

@williaster williaster Jul 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking at this. I did some more digging and it seems like delaunator and robust-predicates may be ESM-only which likely trips up jest.

I pulled and built your branch locally and you can see that this generated/vendored CJS file references an the ESM-only delaunator lib. I'm not sure why that doesn't mess up our next demo app, perhaps it's all resolving to the ESM versions so this path isn't triggered.

all this to say that if someone hits CJS/ESM issues with this we might have to also vendor delaunator + robust-predicates in the future, but since it seems to work with next.js as-is I think we can merge this for now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

packages/sizes.json Outdated Show resolved Hide resolved
packages/visx-delaunay/test/voronoi.test.ts Show resolved Hide resolved
packages/visx-vendor/package.json Show resolved Hide resolved
@williaster
Copy link
Collaborator

happo looks good also 👍

@SheaJanke SheaJanke requested a review from williaster July 11, 2023 03:45
@SheaJanke
Copy link
Contributor Author

Thanks for the feedback! I made the requested changes 👍

@williaster
Copy link
Collaborator

thanks again for all the hard work here @SheaJanke ! 🙌

@williaster williaster merged commit 620ecd7 into airbnb:master Jul 11, 2023
@github-actions
Copy link

🎉 This PR is included in version v3.3.0 of the packages modified 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Voronoi: High memory usage (OOM in browser in some cases)
2 participants