Releases: RomiC/ya-disk
Release list
v4.1.1
What's Changed
- Drop Node 20 support in v4.x (#615)
- Migrate from Jest to Node.js built-in test runner (#660)
- Update
actions/setup-nodetov6.4.0andcoverallsapp/github-actiontov2.3.6(#666) - Fix NPM publish workflow trigger for draft releases (#668)
- Bump
eslintfrom10.1.0to10.4.1 - Bump
lint-stagedfrom16.4.0to17.0.6 - Bump
prettierfrom3.8.1to3.8.3 - Bump
globalsfrom17.4.0to17.6.0 - Bump
@eslint/markdownfrom8.0.1to8.0.2 - Bump
eslint-plugin-prettierfrom5.5.5to5.5.6 - Bump
eslint-plugin-jestfrom29.15.1to29.15.2 - Other dependency updates
Migrate request transport to `fetch`
⚡ Migrate request transport from https to fetch (#613)
The internal HTTP transport has been rewritten from Node's https module to the native fetch API. The public API is fully unchanged — this is an internal improvement only.
What changed under the hood:
- Removed
node:httpsandnode:querystringdependencies fromlib/request.js - Query strings now built via
URL.searchParamsinstead ofquerystring.stringify request()is a cleanasyncfunction — no morenew Promise()/ stream / event boilerplatenode:testmock target changed fromhttps.requesttoglobalThis.fetch
Improved error handling:
Previously, a non-JSON response body (e.g. an HTML error page from a proxy or gateway) would throw a raw SyntaxError with no context. It now rejects with a descriptive message:
Error: Unexpected response (status 502): <html>Bad Gateway</html>
Non-2xx responses with an empty or non-JSON body also now produce a meaningful error instead of a TypeError:
Error: Request failed with status 503 [name: ApiError]
🛠️ Internals
- Test suite for
request.jsfully rewritten aroundglobalThis.fetchmocking —IncomingMessageStub,ServerResponseStuband all stream scaffolding removed - 3 new test cases covering invalid JSON and empty non-2xx response bodies
node:https,node:querystring,node:streamimports removed from test file
ESM first
⚠️ Breaking Changes
- Node.js ≥ 22 is now required. Node 20 and below are no longer supported.
- Package is now ESM-first.
"type": "module"is set inpackage.json. Direct imports of source files (e.g.require('./lib/download')) no longer work — use the package name instead. - Only
dist/is published. Source files (lib/,index.js) are no longer included in the npm tarball.
✨ ESM-first with CommonJS backward compatibility (#611)
ya-disk is now distributed as dual ESM + CJS artifacts, so both import and require consumers work out of the box with no extra configuration:
// ESM
import { info, resources } from 'ya-disk';
// CommonJS
const { info, resources } = require('ya-disk');The exports field in package.json routes each consumer to the correct artifact automatically. Deep imports into internal paths (e.g. ya-disk/dist/lib/info) are not supported — the dist/ layout is an internal implementation detail and may change between releases.
🛠️ Internals
- Replaced Jest with Node.js built-in
node:testrunner (#612) — no test framework dependencies - Replaced Istanbul/Jest coverage with
c8; reports available as text, lcov and clover - Build pipeline introduced via
esbuildproducing both ESM (.js) and CJS (.cjs) artifacts - Coverage gated in CI; Coveralls report updated on every push
Missing Ya-Disk methods
ya-disk v4.1.0
Highlights
- Added missing Yandex Disk API support for public resources and trash control.
- Expanded resources API with publish/unpublish operations.
- Improved request query handling by stripping empty query parameters before sending requests.
Added
- New publicResources module:
- get(token, public_key, options?)
- download(token, public_key, path?)
- saveToDisk(token, public_key, path?, name?)
- list(token, options?)
- New trash module:
- delete(token, path?)
- restore(token, path, name?, overwrite?)
- New endpoint constants for public resources.
Changed
- resources now includes:
- publish(token, path)
- unpublish(token, path)
- README expanded with usage docs and examples for new APIs.
- Package version bumped to 4.1.0.
Tests and Quality
- Added/updated unit tests for:
- public resources module
- trash module
- resources publish/unpublish
- request query sanitization
- root exports
- Latest release path reports full passing test suite and complete coverage for the newly introduced modules.
Changelog References
Missing Ya-Disk methods v3.x
ya-disk v3.1.0
Highlights
- Added missing Yandex Disk API support for public resources and trash control.
- Expanded resources API with publish/unpublish operations.
- Improved request query handling by stripping empty query parameters before sending requests.
Added
- New publicResources module:
- get(token, public_key, options?)
- download(token, public_key, path?)
- saveToDisk(token, public_key, path?, name?)
- list(token, options?)
- New trash module:
- delete(token, path?)
- restore(token, path, name?, overwrite?)
- New endpoint constants for public resources.
Changed
- resources now includes:
- publish(token, path)
- unpublish(token, path)
- README expanded with usage docs and examples for new APIs.
- Package version bumped to 4.1.0.
- Removed dev files from the package
Tests and Quality
- Added/updated unit tests for:
- public resources module
- trash module
- resources publish/unpublish
- request query sanitization
- root exports
- Latest release path reports full passing test suite and complete coverage for the newly introduced modules.
JSDoc Update
Added typings for v3.x
This version should slightly improve the developer experience, by adding typings for the library functions.
Migrated to the native Promise
Bumped minimal supported node version to 10.x
- Due to node 8.x isn't being maintained anymore, bumped minimal supported version to 10.x
- DX-updates:
- Linting+formatting
- Removed
.editorconfig - Added prettier and integrated it with
eslint - Formatted code
- Removed
- Migrated Travis → Github-actions
- Rewrote tests from ava+sinon to jest
- Linting+formatting
Added support of resources.copy and resources.move methods
Big thumbs up to @fan-tom for:
- adding support of resources.copy and resources.move methods,
- adding handler for an empty response