Conversation
BREAKING CHANGE since it is a named export
BREAKING CHANGE kinda since this changes expected behavior
BREAKING CHANGE since it is a named export
There was a problem hiding this comment.
Pull Request Overview
This PR updates the library by reorganizing the source code into separate modules (shared, generic, and bun) and updating tests and documentation to reflect the new API structure.
- New tests and API functions for checking Bun modules, implemented Node modules, and built-in modules have been introduced.
- The build configuration (tsup.config.ts) and README have been updated to match these changes.
- Legacy code (src/index.ts and tests for deprecated functions) has been removed.
Reviewed Changes
Copilot reviewed 12 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/isBunBuiltin.test.ts | Added tests for the new isBunBuiltin module checking function. |
| test/isBunImplementedNodeModule.test.ts | Added tests for verifying Node modules implemented in Bun. |
| test/getModules.test.ts | Introduced tests for module listing functions. |
| src/shared.ts | New shared helpers for semver and module checking functionality. |
| src/generic.ts | Exports generic module checking and listing functions. |
| src/bun.ts | Implements Bun‑specific functions using Bun.version as default. |
| README.md | Updated API documentation to reflect the reorganized functions. |
| tsup.config.ts | Updated bundler configuration to support the new module structure. |
| test/bunVersion.test.ts | Updated version parsing tests to use new function names. |
| test/versionRanges.test.ts | Adjusted asset reference for implemented node modules. |
| src/index.ts | Removed legacy index file. |
| test/isSupportedModule.test.ts | Removed deprecated tests for legacy module support. |
Files not reviewed (3)
- package.json: Language not supported
- src/assets/implemented-node-modules.json: Language not supported
- src/assets/node-modules.json: Language not supported
f24bcd8 to
84498e6
Compare
| * @returns `true` if the module is a Bun module, `false` otherwise | ||
| */ | ||
| export function isBunModule(moduleName: string, bunVersion?: BunVersion): boolean { | ||
| return checkModule(moduleName, bundledBunModules, bunVersion ?? "latest"); |
There was a problem hiding this comment.
Try process.versions.bun first then fallack to latest? Maybe extract as const DEFAULT_BUN_VERSION = process.versions.bun ?? "latest"
There was a problem hiding this comment.
process.versions.bun will always be undefended as this code will never run in bun. this is a file for other runtimes, bun.mjs is for bun:
Lines 11 to 18 in c6c83e5
There was a problem hiding this comment.
What is the difference between them then? If process.versions.bun is used, is there any other difference?
There was a problem hiding this comment.
I still don't get, can't we just write if (process.versions.bun) for this part and unify the two entries?
There was a problem hiding this comment.
unify the two entries?
this is not possible because I want this package to be runtime-independent and dynamically add missing bun modules to the list
dynamically add missing bun modules to the list
for this I need to use node:module, which I cannot dynamically require in CJS only with language features
BREAKING CHANGE
and add `node:test` module to the list
| export { default as implementedNodeModules } from "@assets/implemented-node-modules.json"; | ||
|
|
||
| type SemVerBaseStringified = `${bigint}.${bigint}.${bigint}`; | ||
| type SemVerStringifiedWithReleaseName = `${SemVerBaseStringified}-${string}`; |
There was a problem hiding this comment.
If the version pattern strictly follows the type, would something like the following help without depending on semver:
https://github.com/un-ts/synckit/blob/38578a5e6858d54958d41a17e3dc240a56da65d4/src/index.ts#L87-L106
There was a problem hiding this comment.
having semver as a dependency allows me to easily and confidently write version range expressions of any complexity
removing it offers minimal benefits since it's typically already installed locally and adds less than 20KB to the minified bundle size
|
🎉 This PR is included in version 2.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
CC: @JounQin