Skip to content

Conversation

LukeAbby
Copy link
Contributor

@LukeAbby LukeAbby commented Jan 20, 2025

I want to update earcut to v3.0.0 because I have a project that makes their own earcut global that conflicts with the 2.0.0 era global earcut variable with TypeScript typings.

Wrangling with Jest unfortunately took most of the time because apparently its support for node module dependencies written in ESM is lacking. If anyone knows of a better way I'm all ears!

@LukeAbby LukeAbby changed the title Update Earcut to v3.0.0 chore: update Earcut to v3.0.0 Jan 20, 2025
Copy link

codesandbox-ci bot commented Feb 27, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@LukeAbby LukeAbby force-pushed the dev branch 2 times, most recently from da02de1 to 932d591 Compare February 27, 2025 21:11
@LukeAbby LukeAbby marked this pull request as ready for review February 27, 2025 21:15
@bigtimebuddy bigtimebuddy requested a review from Zyie February 27, 2025 21:22
@bigtimebuddy
Copy link
Member

What are the big difference between v2 and v3 of earcut?

@LukeAbby
Copy link
Contributor Author

LukeAbby commented Feb 27, 2025

There aren't many. Here's the differences copy and pasted from the release notes:

  • Fix edge cases related to touching inner rings. Touching inner rings mapbox/earcut#177
  • Slightly improve performance. Touching inner rings mapbox/earcut#177
  • ⚠️ Breaking: publish earcut as a ES module, dropping support for CommonJS (use v2.2.4 if you need compatibility).
  • ⚠️ Breaking: use modern ES syntax, dropping support for IE11 (you can still transpile on your end to keep support).
  • ⚠️ Breaking: the legacy UMD browser bundle now exposes the main function as earcut.default.

Granted there's also the entirety of 2.1.5 to 2.2.4 that don't have any release notes at all. The one actual change to the API was switching from CommonJS to ESM which changed the exports slightly and made earcut no longer automatically global (due to module scoping rules). The only JS file is less than 700 lines long so if you want to look at 2.1.4 compared to 3.0.1 you can!

I was really thinking this'd be a tiny bump in the dependencies, the fact that Jest was so annoying to grapple with was an unexpected development. I just hope it won't be a blocker to getting this merged, if it is I really would like to work with you in any way to work through this.

It might seem odd to care about such a small change but the global earcut variable has caused conflicts and started to become a genuine blocker for one of my projects, hence why I would like this upgrade.

@LukeAbby
Copy link
Contributor Author

@Zyie would you mind taking a look at if this PR can be merged? Hopefully not being impatient, just want to make sure it hasn't slipped under your radar.

@mourner
Copy link

mourner commented Apr 29, 2025

Granted there's also the entirety of 2.1.5 to 2.2.4 that don't have any release notes at all.

They do, they were just kept in a different place (I moved them from being kept in the readme to using GitHub releases): https://github.com/mapbox/earcut/tree/v2.2.4#changelog

@Zyie
Copy link
Member

Zyie commented Apr 29, 2025

Hey @LukeAbby,

Thanks for this! I’m planning to merge it in for the next minor release. While it looks safe, there’s a small chance it could impact users, so I’d prefer to include it in 8.10.0 rather than a patch. A minor version bump signals a bit more strongly that there’s a change they might want to be aware of.

@LukeAbby
Copy link
Contributor Author

Okay, sounds great!

Sorry if that was the plan all along and I was just being impatient haha.

@LukeAbby
Copy link
Contributor Author

@mourner Good to know! And thanks for the library.

@LukeAbby LukeAbby changed the title chore: update Earcut to v3.0.0 feat: update Earcut to v3.0.0 May 2, 2025
@Zyie Zyie added the ✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t label May 4, 2025
@Zyie Zyie added this pull request to the merge queue May 9, 2025
Merged via the queue into pixijs:dev with commit 73c9c0b May 9, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants