Background
I’m using assertions in micromark. It’s a complex parser using state machines. It’s also extendable with plugins. So assertions makes it much easier to reason about.
I’m using an export map to differentiate between code that does have assertions, and code that doesn’t: https://github.com/micromark/micromark/blob/a03a08ce677b91a2960be2f4fcaacd64b3b8ec18/packages/micromark/package.json#L55-L58. Most people will get unasserted files. With node --conditions development, code with assertions is loaded. This is very useful when making plugins.
Problem
- However, some browser bundlers (Vite, webpack), don’t load
assert normally. While users can configure their bundlers, micromark is often used through many other packages, and I’d rather have everything just work by default
power-assert contains tons of code and also doesn’t bundle well in at least webpack.
Solution
- I could either create a new, small, typed
assert library, or perhaps use something like uvu/assert
- Is
unassert interested in adding support for more libraries, and if so, what are the requirements?
I can do the work on adding one.
/cc @twada
Related-to: micromark/micromark#87, micromark/micromark#95.
Background
I’m using assertions in micromark. It’s a complex parser using state machines. It’s also extendable with plugins. So assertions makes it much easier to reason about.
I’m using an export map to differentiate between code that does have assertions, and code that doesn’t: https://github.com/micromark/micromark/blob/a03a08ce677b91a2960be2f4fcaacd64b3b8ec18/packages/micromark/package.json#L55-L58. Most people will get unasserted files. With
node --conditions development, code with assertions is loaded. This is very useful when making plugins.Problem
assertnormally. While users can configure their bundlers, micromark is often used through many other packages, and I’d rather have everything just work by defaultpower-assertcontains tons of code and also doesn’t bundle well in at least webpack.Solution
assertlibrary, or perhaps use something likeuvu/assertunassertinterested in adding support for more libraries, and if so, what are the requirements?I can do the work on adding one.
/cc @twada
Related-to: micromark/micromark#87, micromark/micromark#95.