Modernize for Node.js 22+ — ESM, async/await, ya-disk v5 - #342
Merged
Conversation
- Replaced onReady/onError callbacks with async/await in download, upload, and followRedirect - Updated unit tests to mock fetch and https.request instead of ya-disk internals - Updated integration test helpers for ya-disk v5 async API
- Migrated all source, specs, and examples to ESM with named exports - Added esbuild to generate CJS bundle at dist/index.cjs - Added conditional exports for seamless require/import support - Used node: prefix for all built-in modules
… stale .eslintignore
RomiC
force-pushed
the
feat/341-node22-modernize
branch
from
August 8, 2026 14:03
4b91fc9 to
2adbd37
Compare
Greptile SummaryThe PR modernizes the package for Node.js 22 by converting the API to Promises and ESM, adding a generated CommonJS bundle, upgrading Confidence Score: 5/5The PR appears safe to merge because the previously reported upload-example failure has been fixed and no blocking failure remains. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| examples/upload.js | Defines an ESM-compatible __dirname using fileURLToPath(import.meta.url), resolving the previous runtime failure. |
| package.json | Declares ESM packaging, conditional CommonJS exports, Node.js 22 support, and the build process. |
| index.js | Replaces CommonJS exports with ESM named exports. |
| lib/download.js | Converts download-link acquisition and stream creation to a Promise-based API. |
| lib/upload.js | Converts upload-link acquisition and writable request creation to a Promise-based API. |
| lib/followRedirect.js | Converts redirect handling to a Promise and rejects unexpected responses or request errors. |
Reviews (2): Last reviewed commit: "fixup! Feat: [#341] Convert to ESM with ..." | Re-trigger Greptile
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #341.
What changed
Breaking: Promise-based API
download()andupload()now return Promises instead of taking callbacks:Before:
After:
ESM with CJS backward compatibility
node:prefix, and.jsextensionsdist/index.cjsexportsinpackage.json—require('ya-disk-stream')works seamlesslyUpgraded to ya-disk v5.0.1
Modernized internals
url.parse()with direct URL strings passed tohttps.request()Promise.withResolvers()in integration tests.eslintignore