feat!: add Deno support via node: protocol in ESM output #166
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #165
Summary
This PR adds Deno support by enabling the
node:protocol for Node.js builtin imports in ESM builds. This allows the library to work with Deno without requiring import maps.Changes
1. Upgrade tsdown to latest version
tsdownfrom0.12.5to0.18.1to access latest features and the updated API2. Enable
node:protocol in ESM outputremoveNodeProtocoloption tonodeProtocoloptionnode:protocol in ESM output while keeping CJS output unchanged12.20.0(whennode:protocol was introduced)3. Update source code to use node: prefix
node:prefix to all Node.js builtin imports in source files (16 imports across 12 files)Breaking Changes
12.20.0(previously12.0.0)This is required to support the
node:protocol for builtin imports.Benefits
Testing
master... This PR has not changed any functionality, just build outputs and import statements. The same tests failing on master fail on this branch, no new tests are failing. I actually tried fixing the tests, but realised that some might be actual bugs that I'm not familiar enough with the codebase to tackle properly, so I gave up...npm run buildbefore and after each change.0.18.1resulted in a few non-functional changes to the output filesifstatements now have{ }blocks where they previously didn'tnode:prefix to the built-in imports in the ESM output, nothing else compared to above