benjamn / recast

JavaScript syntax tree transformer, nondestructive pretty-printer, and automatic source map generator
MIT License
4.91k stars 347 forks source link

feat: use invariant for assertions #1387

Closed 43081j closed 5 months ago

43081j commented 5 months ago

This replaces assert with tiny-invariant in the production code (lib/) while continuing to use node's built-in assert for tests.

The result is a much leaner dependency tree (as shown in the lockfile diff).

part of on ongoing effort to reduce the footprint of various packages in the ecosystem FYI

also, i ran npm run format which has reformatted some missed formatting inconsistencies in unrelated code i haven't otherwise touched

eventualbuddha commented 5 months ago

Thanks @43081j! I ended up creating #1388 to make the same change but without the formatting changes. If you're still interested in making those changes you can rebase this PR or create a new one. The tiny-invariant change is published in v0.23.5.

43081j commented 5 months ago

Awesome, thanks for taking a look so soon!

I'll take a look tomorrow at repurposing this to be a formatting pr since it would still be useful for future contributors (to keep it consistent)