Skip to content

Q: Is there interest in adding more assertion libraries? #22

@wooorm

Description

@wooorm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions