Skip to content

release: v2.0.3 - require the ESM entry directly, fail clearly on Node… - #59

Merged
cldmv-bot[bot] merged 15 commits into
masterfrom
next
Oct 5, 2026
Merged

cldmv-bot[bot] merged 15 commits into
masterfrom
next

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

DroidSock v2.0.3 Changelog

Release Date: October 2026
Release Type: Patch
Branch: release/2.0.3


Overview

v2.0.3 cleans up the CommonJS entry and the published file list. index.cjs now loads the ESM entry with a plain require(), which bundlers can follow, and fails with a clear message on Node.js versions that can't require() 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 ./devcheck subpath 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/devcheck is no longer exported or published (#58)

package.json no longer lists a ./devcheck export, and devcheck.mjs and types/devcheck.d.mts are no longer in the published files. Importing @cldmv/droidsock/devcheck now fails with ERR_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 a src/ folder sits next to it, and the published package has no src/, so importing it from an installed copy did nothing. index.mjs still 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.cjs used createRequire(__filename) to load index.mjs. That idiom predates Node's native require(esm), and bundlers such as esbuild and webpack don't follow a createRequire-constructed require the way they follow a literal require() call, so a CommonJS build that bundled droidsock could miss the ESM entry.

  • index.cjs now calls require("./index.mjs") directly and exports the same functions as before (module.exports is the droidsock quick path, with createDroidSock, DroidSock, ADB and AndroidDebugBridge as properties).
  • On a Node.js version without require(esm) (before 20.19.0, or 22.0.0 to 22.11.x), index.cjs throws an ERR_REQUIRE_ESM error whose message names the supported versions and points to import(), instead of a bare loader error. The package's engines.node is already >=22.12.0, so this only matters for installs that ignore engines.
  • index.mjs already avoided top-level await, so it needed no change.
  • New tests/cjs/entry.test.cjs checks run under Node's own test runner after Vitest, from both npm test and npm run coverage (through the new test:cjs script). They check that require() returns the same functions as import, and that the version check fires when require(esm) is turned off. They don't call droidsock(), since that opens a real ADB connection.

🔧 CI & tooling

  • bundle-size.yml no longer lists the devcheck files in dist_paths, matching the new published file list (#58).

📚 Documentation

  • NEW: docs/changelog/v2/v2.0.3.md: this changelog.
  • NEW: backfilled v1.1.1, v2.0.1 and v2.0.2.
  • README restructured to the standard CLDMV layout, with a new Requirements section that states the Node.js floor for import and require().

🔧 Dependencies

Both changes are to development dependencies; the package has no runtime dependency changes and the published package is unaffected. Only package.json and 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 as node_modules. Version 2.2.0 makes the @Last modified by header 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's engines.node.
  • @cldmv/configs ^1.2.1 → ^1.2.4 (#63). It provides the shared fix-headers configuration that .configs/fix-headers.json extends. Version 1.2.4 turns off forceAuthorUpdate and forceLastModifiedAuthorUpdate (both were on in 1.2.1), so the shared configuration no longer overwrites the recorded author or last editor.

Upgrade notes

  • If anything imports @cldmv/droidsock/devcheck, remove that import. Nothing else needs to change.
  • import droidsock from "@cldmv/droidsock" and require("@cldmv/droidsock") both work as before on Node.js 22.12.0 or later.
👥 Contributors

coverage

Metric Coverage
Statements 93.0%
Branches 85.3%
Functions 94.4%
Lines 94.5%

Avg: 91.8% · d7d1cb5 · Node lts/*

Co-authored-by: Shinrai Shinrai@users.noreply.github.com

Shinrai and others added 3 commits October 3, 2026 11:15
…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)
@cldmv-bot cldmv-bot Bot added ! release → master v4 flow: persistent next → master release PR (carries the next feature release) release Marks a pull request as a pending release — merge to publish a new version semver: patch This release contains only backwards-compatible bug fixes type: bug Something is broken or not behaving as expected area: tests Touches test files, fixtures, or test infrastructure type: ci Changes to CI workflows, actions, or build pipelines type: config Changes to repository or project configuration files type: dependencies Relates to dependency updates, version bumps, or package management labels Oct 3, 2026
@cldmv-bot

cldmv-bot Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor Author

🔒 Dependency Review

  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ✅ 0 package(s) with unknown licenses
  • ✅ 0 denied package(s)
  • ✅ 0 package(s) with OpenSSF Scorecard score < 3

Full job summary

@cldmv-bot

cldmv-bot Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Bundle size increased

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.

@cldmv-bot cldmv-bot Bot added the type: documentation Relates to docs, README updates, guides, or inline code comments label Oct 4, 2026
Shinrai and others added 9 commits October 3, 2026 19:51
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.
@cldmv-bot
cldmv-bot Bot merged commit 09f53ae into master Oct 5, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Touches test files, fixtures, or test infrastructure ! release → master v4 flow: persistent next → master release PR (carries the next feature release) release Marks a pull request as a pending release — merge to publish a new version semver: patch This release contains only backwards-compatible bug fixes type: bug Something is broken or not behaving as expected type: ci Changes to CI workflows, actions, or build pipelines type: config Changes to repository or project configuration files type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant