release: v2.0.3 - require the ESM entry directly, fail clearly on Node… - #59
Merged
Merged
Conversation
…t require(esm), and stop publishing devcheck
index.cjs used createRequire(__filename) to synchronously load index.mjs. That
idiom predates Node's native require(esm) and breaks bundlers (esbuild,
webpack) that don't follow a createRequire-constructed require the way they
follow a literal require() call.
- index.cjs: a plain require("./index.mjs") instead of createRequire. Where
Node.js has no require(esm) (before 20.19 / 22.12) it now throws
ERR_REQUIRE_ESM with a message pointing to import() instead of a bare
loader error.
- index.mjs already avoided top-level await, so no change was needed there.
- devcheck.mjs is a source-checkout-only dev warning and was never meant to
ship: dropped "./devcheck" from exports and devcheck.mjs/types/devcheck.d.mts
from files, and trimmed the now-stale devcheck globs out of bundle-size.yml's
dist_paths. devcheck.mjs itself stays in the repo (index.mjs's fire-and-forget
import of it already tolerates a missing file in the published package).
- tests/cjs: node:test checks run by `npm test` and `npm run coverage` after
Vitest: require() returns the same objects as import (type/identity only -
droidsock() opens a real ADB connection, so no call is made), and the version
check fires when require(esm) is off. test:cjs runs with CI=1 so devcheck's
own NODE_OPTIONS guard (unrelated to this fix, source-checkout only) doesn't
process.exit() the test runner.
…t require(esm), and stop publishing devcheck (#58)
Contributor
Author
🔒 Dependency Review
|
Contributor
Author
|
| File | Raw | Δ Raw | Gzipped | Δ Gzipped |
|---|---|---|---|---|
| dist/api/auth.mjs | 6.2 kB | — | 2.3 kB | — |
| dist/api/config.mjs | 3.0 kB | — | 1.4 kB | — |
| dist/api/connection.mjs | 6.5 kB | — | 2.3 kB | — |
| dist/api/device.mjs | 6.8 kB | — | 1.9 kB | — |
| dist/api/devices.mjs | 1.7 kB | — | 874 B | — |
| dist/api/discover.mjs | 10.6 kB | — | 3.8 kB | — |
| dist/api/files.mjs | 17.9 kB | — | 4.3 kB | — |
| dist/api/forward.mjs | 1.7 kB | — | 845 B | — |
| dist/api/install.mjs | 2.5 kB | — | 1.2 kB | — |
| dist/api/log.mjs | 2.1 kB | — | 771 B | — |
| dist/api/pairing.mjs | 8.3 kB | — | 3.1 kB | — |
| dist/api/reboot.mjs | 757 B | — | 499 B | — |
| dist/api/reverse.mjs | 4.0 kB | — | 1.4 kB | — |
| dist/api/shell.mjs | 6.3 kB | — | 2.1 kB | — |
| dist/api/stream.mjs | 4.4 kB | — | 1.7 kB | — |
| dist/api/utils.mjs | 6.8 kB | — | 2.8 kB | — |
| dist/droidsock.mjs | 1.2 kB | — | 738 B | — |
| index.cjs | 1.5 kB | +431 B (+38.1%) |
831 B | +249 B |
| index.mjs | 1.3 kB | — | 699 B | — |
| types/dist/api/auth.d.mts | 462 B | — | 226 B | — |
| types/dist/api/auth.d.mts.map | 193 B | — | 167 B | — |
| types/dist/api/config.d.mts | 1.3 kB | — | 457 B | — |
| types/dist/api/config.d.mts.map | 275 B | — | 197 B | — |
| types/dist/api/connection.d.mts | 93 B | — | 108 B | — |
| types/dist/api/connection.d.mts.map | 141 B | — | 130 B | — |
| types/dist/api/device.d.mts | 247 B | — | 158 B | — |
| types/dist/api/device.d.mts.map | 157 B | — | 143 B | — |
| types/dist/api/devices.d.mts | 219 B | — | 156 B | — |
| types/dist/api/devices.d.mts.map | 176 B | — | 155 B | — |
| types/dist/api/discover.d.mts | 199 B | — | 160 B | — |
| types/dist/api/discover.d.mts.map | 154 B | — | 142 B | — |
| types/dist/api/files.d.mts | 2.8 kB | — | 476 B | — |
| types/dist/api/files.d.mts.map | 407 B | — | 258 B | — |
| types/dist/api/forward.d.mts | 189 B | — | 162 B | — |
| types/dist/api/forward.d.mts.map | 136 B | — | 129 B | — |
| types/dist/api/install.d.mts | 247 B | — | 154 B | — |
| types/dist/api/install.d.mts.map | 147 B | — | 137 B | — |
| types/dist/api/log.d.mts | 667 B | — | 226 B | — |
| types/dist/api/log.d.mts.map | 218 B | — | 177 B | — |
| types/dist/api/pairing.d.mts | 128 B | — | 127 B | — |
| types/dist/api/pairing.d.mts.map | 136 B | — | 130 B | — |
| types/dist/api/reboot.d.mts | 128 B | — | 131 B | — |
| types/dist/api/reboot.d.mts.map | 131 B | — | 125 B | — |
| types/dist/api/reverse.d.mts | 225 B | — | 168 B | — |
| types/dist/api/reverse.d.mts.map | 138 B | — | 131 B | — |
| types/dist/api/shell.d.mts | 1.6 kB | — | 397 B | — |
| types/dist/api/shell.d.mts.map | 334 B | — | 244 B | — |
| types/dist/api/stream.d.mts | 347 B | — | 202 B | — |
| types/dist/api/stream.d.mts.map | 140 B | — | 130 B | — |
| types/dist/api/utils.d.mts | 1.2 kB | — | 470 B | — |
| types/dist/api/utils.d.mts.map | 365 B | — | 263 B | — |
| types/dist/droidsock.d.mts | 141 B | — | 138 B | — |
| types/dist/droidsock.d.mts.map | 132 B | — | 128 B | — |
| types/index.d.mts | 549 B | — | 325 B | — |
| types/index.d.mts.map | 165 B | — | 149 B | — |
| Total | 107.7 kB | +431 B | 40.3 kB | +249 B |
📊 Generated by bundle-size. Brotli sizes also measured but omitted from the table for brevity.
Bumps @cldmv/fix-headers to 2.1.4 (JSON/Markdown/extension-less files never get a JS comment; dependency folders never walked). Ran fix:headers: 0 files restamped.
Bumps @cldmv/fix-headers from ^2.1.4 to ^2.2.0 (lockfile resolves 2.2.0). fix:headers under 2.2.0 changed no file headers.
Bump @cldmv/configs ^1.2.1 (locked 1.2.1) to ^1.2.4 (1.2.4). The older shared fix-headers.json forced forceAuthorUpdate and forceLastModifiedAuthorUpdate on; 1.2.4 sets both false, so with fix-headers 2.2.0 @author is never rewritten and @last modified by changes only on real content edits. Restamped files: 0.
Shinrai
approved these changes
Oct 5, 2026
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.
DroidSock v2.0.3 Changelog
Release Date: October 2026
Release Type: Patch
Branch:
release/2.0.3Overview
v2.0.3 cleans up the CommonJS entry and the published file list.
index.cjsnow loads the ESM entry with a plainrequire(), which bundlers can follow, and fails with a clear message on Node.js versions that can'trequire()ES modules. The ESM entry and the API itself are unchanged.The release also stops publishing
devcheck.mjs, a source-checkout-only development check, and removes its./devchecksubpath export. Removing an export is technically a breaking change despite this being a patch release, so it's listed under Breaking Changes below. In practice the module did nothing in an installed copy of the package.💥 Breaking Changes
@cldmv/droidsock/devcheckis no longer exported or published (#58)package.jsonno longer lists a./devcheckexport, anddevcheck.mjsandtypes/devcheck.d.mtsare no longer in the published files. Importing@cldmv/droidsock/devchecknow fails withERR_PACKAGE_PATH_NOT_EXPORTED.The module was never part of the documented API. It has no exports; its only job is to warn a developer working in a source checkout who forgot to set
NODE_OPTIONS=--conditions=droidsock-dev. It only acts when asrc/folder sits next to it, and the published package has nosrc/, so importing it from an installed copy did nothing.index.mjsstill loads it fire-and-forget and already tolerates it being missing, so the main entry is unaffected.Upgrade step: if anything imports
@cldmv/droidsock/devcheck, delete that import. Nothing replaces it, because it never did anything outside this repository.🐛 Bug Fixes
Require the ESM entry directly, and fail clearly without
require(esm)(#58)index.cjsusedcreateRequire(__filename)to loadindex.mjs. That idiom predates Node's nativerequire(esm), and bundlers such as esbuild and webpack don't follow acreateRequire-constructedrequirethe way they follow a literalrequire()call, so a CommonJS build that bundled droidsock could miss the ESM entry.index.cjsnow callsrequire("./index.mjs")directly and exports the same functions as before (module.exportsis thedroidsockquick path, withcreateDroidSock,DroidSock,ADBandAndroidDebugBridgeas properties).require(esm)(before 20.19.0, or 22.0.0 to 22.11.x),index.cjsthrows anERR_REQUIRE_ESMerror whose message names the supported versions and points toimport(), instead of a bare loader error. The package'sengines.nodeis already>=22.12.0, so this only matters for installs that ignoreengines.index.mjsalready avoided top-levelawait, so it needed no change.tests/cjs/entry.test.cjschecks run under Node's own test runner after Vitest, from bothnpm testandnpm run coverage(through the newtest:cjsscript). They check thatrequire()returns the same functions asimport, and that the version check fires whenrequire(esm)is turned off. They don't calldroidsock(), since that opens a real ADB connection.🔧 CI & tooling
bundle-size.ymlno longer lists thedevcheckfiles indist_paths, matching the new published file list (#58).📚 Documentation
importandrequire().🔧 Dependencies
Both changes are to development dependencies; the package has no runtime dependency changes and the published package is unaffected. Only
package.jsonand the lockfile changed in these bumps, and no file headers were restamped.@cldmv/fix-headers^2.1.2→^2.2.0(#61 took it to^2.1.4, #63 to^2.2.0). Version 2.1.4 no longer writes a JavaScript comment into JSON or Markdown files, processes every repeated--input, and never walks dependency folders such asnode_modules. Version 2.2.0 makes the@Last modified byheader tag follow content edits only, so a header-only rewrite keeps the recorded editor instead of replacing it. It requires Node.js>=22.12.0, which matches the package'sengines.node.@cldmv/configs^1.2.1→^1.2.4(#63). It provides the sharedfix-headersconfiguration that.configs/fix-headers.jsonextends. Version 1.2.4 turns offforceAuthorUpdateandforceLastModifiedAuthorUpdate(both were on in 1.2.1), so the shared configuration no longer overwrites the recorded author or last editor.Upgrade notes
@cldmv/droidsock/devcheck, remove that import. Nothing else needs to change.import droidsock from "@cldmv/droidsock"andrequire("@cldmv/droidsock")both work as before on Node.js 22.12.0 or later.👥 Contributors
Avg: 91.8% ·
d7d1cb5· Node lts/*Co-authored-by: Shinrai Shinrai@users.noreply.github.com