Skip to content

feat: add ESM support, type definitions, and synchronous APIs to all @webref/* packages #1900

@nberlette

Description

@nberlette

Hello there! I'm opening this issue to start a discussion with the maintainers about some changes I'd like to propose for the @webref/* packages, with the goal of improving compatibility, usability, and IDE support.

The data offered by these packages is unparalleled, and I'm a huge fan of this and all the other greak work done by you folks at @w3c. That being said, I was more than a bit dismayed to discover there are no TypeScript definitions for the webref packages published to npm (and apparently I'm not alone; see #937). I was also a bit shocked to find out that the packages only provide CommonJS entry points (in 2026?!).

I threw together a quick patch late last night to address these pain points (and a couple other minor things) for all of the packages in the webref workspace. It introduces the following changes:

  • introduces well-documented type definitions to each package
  • modernizes all packages to be ESM by default, maintaining CJS support via conditional exports
  • introduces synchronous variants for all async APIs, improving alignment with common usage patterns
  • migrates the root package.json to use npm workspaces instead of file:packages/* depedencies

I'll open up a draft PR with the above changes for any and all feedback you may have. If there are parts that don't align with the scope of the project, please let me know and I'll edit it as needed. This is my first contribution to the project — apologies if I've overlooked anything!

Thanks for your time,

Nick

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