@cldmv/droidsock 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -38
- package/index.cjs +17 -6
- package/index.mjs +5 -3
- package/package.json +7 -11
- package/types/index.d.mts.map +1 -1
- package/devcheck.mjs +0 -62
- package/types/devcheck.d.mts +0 -2
package/README.md
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @cldmv/droidsock
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
<img src="https://github.com/CLDMV/droidsock/raw/HEAD/images/droidsock-banner.jpg" alt="DroidSock Banner">
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**DroidSock** is a complete, from-scratch implementation of the Android Debug Bridge (ADB) protocol in Node.js. This library provides full ADB functionality including device connection, RSA authentication, shell command execution, and file transfers - eliminating clicking sounds on Android TV devices!
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
It talks to devices directly over TCP, with no `adb` binary or ADB server in between, and composes its protocol layers into a single API tree with [`@cldmv/slothlet`](https://github.com/CLDMV/slothlet), so every connected device becomes its own persistent API leaf.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
> _ADB over the wire, in pure Node.js - no adb binary required._
|
|
12
|
+
|
|
13
|
+
[![npm version]][npm_version_url] [![npm downloads]][npm_downloads_url] [![GitHub downloads]][github_downloads_url] [![Last commit]][last_commit_url] [![npm last update]][npm_last_update_url] [![coverage]][coverage_url]
|
|
12
14
|
|
|
13
15
|
> [!NOTE]
|
|
14
16
|
> **Current status:**
|
|
@@ -17,30 +19,26 @@ A complete, from-scratch implementation of the Android Debug Bridge (ADB) protoc
|
|
|
17
19
|
> - **File transfer**: `mkdir` / `remove` / `move` / `copy` / `chmod` / `diskUsage` / `find` / `stat` work today via shell commands. `list` prefers a binary-safe SYNC-based implementation with automatic shell fallback.
|
|
18
20
|
> - **Experimental**: `push` / `pull` / `pushV2` / `pullV2` / `listSync` / `listV2` / `statV2` (real ADB SYNC sub-protocol usage, both the legacy 32-bit and newer 64-bit variants), `device.reboot()`, `device.forward()` / `device.reverse()`, `device.install()` (both the classic push-then-install and modern streaming install paths), and `pairing.pair()` (Wi-Fi pairing) are all implemented - built from the ADB protocol spec and covered by unit tests (several exercised against real loopback TCP/TLS servers, not purely mocks) - but **none of them have been run against a real device yet**. See [#1](https://github.com/CLDMV/droidsock/issues/1).
|
|
19
21
|
|
|
22
|
+
[![Contributors]][contributors_url] [![Sponsor shinrai]][sponsor_url]
|
|
23
|
+
|
|
20
24
|
---
|
|
21
25
|
|
|
22
26
|
## ✨ What's New
|
|
23
27
|
|
|
24
|
-
### Latest: v2.0.
|
|
28
|
+
### Latest: v2.0.3 (October 2026)
|
|
25
29
|
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
- **`device.reverse()`** (experimental) - completes port forwarding with the device → host direction.
|
|
30
|
-
- **`pairing.pair()`** (experimental) - Wi-Fi pairing (SPAKE2-over-Ed25519 + TLS 1.3) for Android 11+ wireless debugging.
|
|
31
|
-
- **Streaming APK install** (experimental) - `device.install()` now tries `exec:cmd`-based streaming install first, falling back to the classic push-then-install flow.
|
|
32
|
-
- **SYNC V2 (64-bit)** - `pushV2` / `pullV2` / `statV2` / `listV2` lift the legacy 32-bit size ceiling, with optional brotli compression.
|
|
33
|
-
- **Hardening** - closed a shell-injection gap in `devices.mjs`'s and `shell.mjs`'s convenience shortcuts, capped several unbounded device-controlled memory allocations in the SYNC V2 paths, and fixed a handful of mid-transfer disconnect/failure edge cases.
|
|
34
|
-
- [View full v2.0.0 Changelog](./docs/changelog/v2/v2.0.0.md)
|
|
30
|
+
- **Bundler-friendly CommonJS entry** - `index.cjs` now loads the ESM entry with a plain `require()` instead of `createRequire`, so esbuild and webpack can follow it, and on a Node.js version without `require(esm)` it fails with a clear message pointing to `import()`. The ESM entry and the API are unchanged ([#58](https://github.com/CLDMV/droidsock/pull/58)).
|
|
31
|
+
- **`devcheck` no longer published** - the source-checkout-only `devcheck.mjs` and its `./devcheck` subpath export are gone from the package. It never did anything in an installed copy, but importing `@cldmv/droidsock/devcheck` now throws `ERR_PACKAGE_PATH_NOT_EXPORTED`, so remove any such import ([#58](https://github.com/CLDMV/droidsock/pull/58)).
|
|
32
|
+
- [View full v2.0.3 Changelog](https://github.com/CLDMV/droidsock/blob/master/docs/changelog/v2/v2.0.3.md)
|
|
35
33
|
|
|
36
34
|
### Recent Releases
|
|
37
35
|
|
|
38
|
-
- **
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
41
|
-
- **v1.
|
|
36
|
+
- **v2.0.2** (October 2026) - Dev tooling only: shared CLDMV fix-headers config and a required PR check that never reports as skipped, no runtime change ([Changelog](https://github.com/CLDMV/droidsock/blob/master/docs/changelog/v2/v2.0.2.md))
|
|
37
|
+
- **v2.0.1** (October 2026) - No runtime change, but `engines.node` rose to `>=22.12.0` (from `>=20.19.0`) to match the vitest 5 toolchain; also syncs the v4 workflows with the v4.29.2 templates ([Changelog](https://github.com/CLDMV/droidsock/blob/master/docs/changelog/v2/v2.0.1.md))
|
|
38
|
+
- **v2.0.0** (September 2026) - Breaking: the `device` module splits into `device` and `devices`, device leaves persist across a disconnect, plus IPv6, `devices.get()`, and experimental `device.reverse()`, Wi-Fi pairing, streaming install and SYNC V2 ([Changelog](https://github.com/CLDMV/droidsock/blob/master/docs/changelog/v2/v2.0.0.md))
|
|
39
|
+
- **v1.2.0** (September 2026) - Device discovery (`discover.subnet()` CIDR sweep, `discover.mdns()` for wireless-debugging-advertised devices, both experimental) and a shell-injection fix across every `files.*` shell-based method ([Changelog](https://github.com/CLDMV/droidsock/blob/master/docs/changelog/v1/v1.2.0.md))
|
|
42
40
|
|
|
43
|
-
📚 **For complete version history and detailed release notes, see [docs/changelog/](
|
|
41
|
+
📚 **For complete version history and detailed release notes, see the [docs/changelog/](https://github.com/CLDMV/droidsock/tree/master/docs/changelog/) folder.**
|
|
44
42
|
|
|
45
43
|
---
|
|
46
44
|
|
|
@@ -55,16 +53,27 @@ A complete, from-scratch implementation of the Android Debug Bridge (ADB) protoc
|
|
|
55
53
|
- ✅ **Port Forwarding** (experimental): `adb forward`/`adb reverse`-equivalent TCP tunneling, both directions
|
|
56
54
|
- ✅ **APK Install** (experimental): `adb install`-equivalent local APK installation - classic push-then-install and modern streaming (`exec:cmd package install`) paths
|
|
57
55
|
- ✅ **Wi-Fi Pairing** (experimental): `adb pair`-equivalent PIN-based pairing (SPAKE2-over-Ed25519 + TLS 1.3) for Android 11+ wireless debugging
|
|
58
|
-
- ✅ **Device Discovery
|
|
56
|
+
- ✅ **Device Discovery** (experimental): `discover.subnet()` CIDR sweep and `discover.mdns()` for devices advertising wireless debugging, plus support for multiple devices via configuration
|
|
59
57
|
- ✅ **Error Handling**: Robust error handling and connection recovery
|
|
60
58
|
|
|
61
|
-
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 📦 Installation
|
|
62
|
+
|
|
63
|
+
### Requirements
|
|
64
|
+
|
|
65
|
+
- **Node.js v22.12.0 or higher** (the package's `engines.node` floor)
|
|
66
|
+
- Both `import` and `require()` are supported. `require()` loads the ESM entry through Node's synchronous `require(esm)`, which needs Node.js ^20.19.0 or >=22.12.0; on older versions, load the package with `import()` instead.
|
|
67
|
+
|
|
68
|
+
### Install
|
|
62
69
|
|
|
63
70
|
```bash
|
|
64
71
|
npm install @cldmv/droidsock
|
|
65
72
|
```
|
|
66
73
|
|
|
67
|
-
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 🚀 Quick Start
|
|
68
77
|
|
|
69
78
|
```javascript
|
|
70
79
|
import droidsock from "@cldmv/droidsock";
|
|
@@ -92,9 +101,13 @@ const logcat = device.logcat({
|
|
|
92
101
|
await device.disconnect();
|
|
93
102
|
```
|
|
94
103
|
|
|
95
|
-
|
|
104
|
+
CommonJS works the same way: `const droidsock = require("@cldmv/droidsock")` (also available as `createDroidSock`).
|
|
96
105
|
|
|
97
|
-
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## ⚙️ Device Configuration
|
|
109
|
+
|
|
110
|
+
The example scripts read device addresses from `references/devices.json`. The folder is git-ignored, so create the file yourself:
|
|
98
111
|
|
|
99
112
|
```json
|
|
100
113
|
{
|
|
@@ -114,13 +127,17 @@ Use the `references/devices.json` file to configure your devices:
|
|
|
114
127
|
}
|
|
115
128
|
```
|
|
116
129
|
|
|
117
|
-
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 📘 API Reference
|
|
118
133
|
|
|
119
134
|
`droidsock(options)` (also `createDroidSock`) creates the API instance; `api.device.connect(host, port, options)` connects to a device (IPv4 or IPv6) and returns its live leaf - also reachable afterward at `api.devices["<host>_<port>"]` (a `.` becomes `_`, a `:` becomes `__`) - exposing connection state, shell execution/streaming, file operations (`push` / `pull` / `list` / `stat`), reboot, port forwarding, and APK install. `api.device.disconnect(host, port)` tears down one device's connection without forgetting it - reconnect later with `connect()` on the same host:port, no need to re-supply options; `api.device.remove(host, port)` forgets it entirely. `api.devices.list()` / `disconnect()` (all) / `remove()` (all) / `get(idOrLeaf)` manage the set of known devices as a whole.
|
|
120
135
|
|
|
121
|
-
📚 **See [docs/API.md](
|
|
136
|
+
📚 **See [docs/API.md](https://github.com/CLDMV/droidsock/blob/master/docs/API.md) for the full method reference**, including every option and the experimental/scope caveats on `push` / `pull` / `list` / `forward` / `reverse` / `install`.
|
|
137
|
+
|
|
138
|
+
---
|
|
122
139
|
|
|
123
|
-
## Examples
|
|
140
|
+
## 💡 Examples
|
|
124
141
|
|
|
125
142
|
### Basic Usage
|
|
126
143
|
|
|
@@ -145,7 +162,9 @@ node examples/streaming-example.mjs top
|
|
|
145
162
|
node examples/streaming-example.mjs files
|
|
146
163
|
```
|
|
147
164
|
|
|
148
|
-
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## 🏗️ Architecture
|
|
149
168
|
|
|
150
169
|
`src/droidsock.mjs` composes the layers below into a single api tree via [`@cldmv/slothlet`](https://github.com/CLDMV/slothlet):
|
|
151
170
|
|
|
@@ -162,9 +181,11 @@ node examples/streaming-example.mjs files
|
|
|
162
181
|
11. **Device / Devices Layers** (`src/api/device.mjs`, `src/api/devices.mjs`): High-level per-device API composing the layers above, split by single-target (`device.connect`/`disconnect`/`remove`) vs. collection-wide (`devices.list`/`disconnect`/`remove`/`get`) operations. Each device is a real, persistent slothlet leaf at `api.devices.<sanitized host_port>`, assigned there by `connect()` rather than held in a private module variable, so its methods keep working `self`/context access exactly like any other leaf - the leaf outlives any one connection, and only `remove()` unmounts it
|
|
163
182
|
12. **Config / Log Layers** (`src/api/config.mjs`, `src/api/log.mjs`): Shared configuration and logging
|
|
164
183
|
|
|
165
|
-
📚 **See [docs/PROTOCOL.md](
|
|
184
|
+
📚 **See [docs/PROTOCOL.md](https://github.com/CLDMV/droidsock/blob/master/docs/PROTOCOL.md) for wire-level protocol details** (packet structure, auth flow, SYNC sub-protocol framing, reboot/forward service usage).
|
|
166
185
|
|
|
167
|
-
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 🛠 Troubleshooting
|
|
168
189
|
|
|
169
190
|
### Connection Issues
|
|
170
191
|
|
|
@@ -185,28 +206,71 @@ node examples/streaming-example.mjs files
|
|
|
185
206
|
- "Stream not open": Ensure connection is established
|
|
186
207
|
- "File not found": Check paths and permissions
|
|
187
208
|
|
|
188
|
-
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## 🧪 Development
|
|
189
212
|
|
|
190
213
|
The implementation is built directly from the public ADB protocol documentation (AOSP `SYNC.TXT` and the wire-protocol references), cross-checked against Google's own reference client (`google/python-adb`) where the public docs are ambiguous, and covered by a mocked Vitest suite. The core connection/shell/stream-multiplexing path has real device usage behind it; the newer SYNC-protocol and service additions (`push` / `pull` / `listSync` / `reboot` / `forward` / `install`) have not yet been run against a real device - see the status note at the top of this README and [#1](https://github.com/CLDMV/droidsock/issues/1).
|
|
191
214
|
|
|
192
|
-
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 📚 Documentation
|
|
193
218
|
|
|
194
|
-
|
|
219
|
+
- **[API Reference](https://github.com/CLDMV/droidsock/blob/master/docs/API.md)** - every method and option, with the experimental and scope caveats
|
|
220
|
+
- **[Protocol Details](https://github.com/CLDMV/droidsock/blob/master/docs/PROTOCOL.md)** - packet structure, auth flow, SYNC sub-protocol framing, reboot / forward service usage
|
|
221
|
+
- **[Changelog](https://github.com/CLDMV/droidsock/tree/master/docs/changelog/)** - per-version release notes
|
|
195
222
|
|
|
196
|
-
|
|
223
|
+
[![CodeFactor]][codefactor_url] [![OpenSSF Scorecard]][ossf_scorecard_url] [![npms.io score]][npms_url] [![npm unpacked size]][npm_size_url] [![Repo size]][repo_size_url]
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## 🤝 Contributing
|
|
197
228
|
|
|
198
229
|
This is a complete implementation of the ADB protocol. For improvements or bug fixes, please submit issues or pull requests.
|
|
199
230
|
|
|
231
|
+
[![Contributors]][contributors_url] [![Sponsor shinrai]][sponsor_url]
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## 🔗 Links
|
|
236
|
+
|
|
237
|
+
- **npm**: [@cldmv/droidsock](https://www.npmjs.com/package/@cldmv/droidsock)
|
|
238
|
+
- **GitHub**: [CLDMV/droidsock](https://github.com/CLDMV/droidsock)
|
|
239
|
+
- **Issues**: [GitHub Issues](https://github.com/CLDMV/droidsock/issues)
|
|
240
|
+
- **Changelog**: [docs/changelog/](https://github.com/CLDMV/droidsock/tree/master/docs/changelog/)
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## 📄 License
|
|
245
|
+
|
|
246
|
+
[![GitHub license]][github_license_url] [![npm license]][npm_license_url]
|
|
247
|
+
|
|
248
|
+
Apache-2.0 - see [LICENSE](https://github.com/CLDMV/droidsock/blob/HEAD/LICENSE) for details.
|
|
249
|
+
|
|
200
250
|
[npm version]: https://img.shields.io/npm/v/%40cldmv%2Fdroidsock.svg?style=for-the-badge&logo=npm&logoColor=white&labelColor=CB3837
|
|
201
251
|
[npm_version_url]: https://www.npmjs.com/package/@cldmv/droidsock
|
|
202
|
-
[npm downloads]: https://img.shields.io/npm/dm/%40cldmv%2Fdroidsock.svg?style=for-the-badge&logo=npm&logoColor=white&labelColor=CB3837
|
|
203
|
-
[npm_downloads_url]: https://www.npmjs.com/package/@cldmv/droidsock
|
|
204
|
-
[github downloads]: https://img.shields.io/github/downloads/CLDMV/droidsock/total?style=for-the-badge&logo=github&logoColor=white&labelColor=181717
|
|
205
|
-
[github_downloads_url]: https://github.com/CLDMV/droidsock/releases
|
|
206
252
|
[last commit]: https://img.shields.io/github/last-commit/CLDMV/droidsock?style=for-the-badge&logo=github&logoColor=white&labelColor=181717
|
|
207
253
|
[last_commit_url]: https://github.com/CLDMV/droidsock/commits
|
|
208
254
|
[npm last update]: https://img.shields.io/npm/last-update/%40cldmv%2Fdroidsock?style=for-the-badge&logo=npm&logoColor=white&labelColor=CB3837
|
|
209
255
|
[npm_last_update_url]: https://www.npmjs.com/package/@cldmv/droidsock
|
|
256
|
+
[codefactor]: https://img.shields.io/codefactor/grade/github/CLDMV/droidsock?style=for-the-badge&logo=codefactor&logoColor=white&labelColor=F44A6A
|
|
257
|
+
[codefactor_url]: https://www.codefactor.io/repository/github/cldmv/droidsock
|
|
258
|
+
[openssf scorecard]: https://img.shields.io/ossf-scorecard/github.com/CLDMV/droidsock?style=for-the-badge&label=OpenSSF%20Scorecard
|
|
259
|
+
[ossf_scorecard_url]: https://scorecard.dev/viewer/?uri=github.com/CLDMV/droidsock
|
|
260
|
+
[npms.io score]: https://img.shields.io/npms-io/final-score/%40cldmv%2Fdroidsock?style=for-the-badge&logo=npms&logoColor=white&labelColor=0B5D57
|
|
261
|
+
[npms_url]: https://npms.io/search?q=%40cldmv%2Fdroidsock
|
|
262
|
+
[npm downloads]: https://img.shields.io/npm/dm/%40cldmv%2Fdroidsock.svg?style=for-the-badge&logo=npm&logoColor=white&labelColor=CB3837
|
|
263
|
+
[npm_downloads_url]: https://www.npmjs.com/package/@cldmv/droidsock
|
|
264
|
+
[github downloads]: https://img.shields.io/github/downloads/CLDMV/droidsock/total?style=for-the-badge&logo=github&logoColor=white&labelColor=181717
|
|
265
|
+
[github_downloads_url]: https://github.com/CLDMV/droidsock/releases
|
|
266
|
+
[npm unpacked size]: https://img.shields.io/npm/unpacked-size/%40cldmv%2Fdroidsock.svg?style=for-the-badge&logo=npm&logoColor=white&labelColor=CB3837
|
|
267
|
+
[npm_size_url]: https://www.npmjs.com/package/@cldmv/droidsock
|
|
268
|
+
[repo size]: https://img.shields.io/github/repo-size/CLDMV/droidsock?style=for-the-badge&logo=github&logoColor=white&labelColor=181717
|
|
269
|
+
[repo_size_url]: https://github.com/CLDMV/droidsock
|
|
270
|
+
[github license]: https://img.shields.io/github/license/CLDMV/droidsock.svg?style=for-the-badge&logo=github&logoColor=white&labelColor=181717
|
|
271
|
+
[github_license_url]: https://github.com/CLDMV/droidsock/blob/HEAD/LICENSE
|
|
272
|
+
[npm license]: https://img.shields.io/npm/l/%40cldmv%2Fdroidsock.svg?style=for-the-badge&logo=npm&logoColor=white&labelColor=CB3837
|
|
273
|
+
[npm_license_url]: https://www.npmjs.com/package/@cldmv/droidsock
|
|
210
274
|
[coverage]: https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2FCLDMV%2Fdroidsock%2Fbadges%2Fcoverage.json&style=for-the-badge&logo=vitest&logoColor=white
|
|
211
275
|
[coverage_url]: https://github.com/CLDMV/droidsock/blob/badges/coverage.json
|
|
212
276
|
[contributors]: https://img.shields.io/github/contributors/CLDMV/droidsock.svg?style=for-the-badge&logo=github&logoColor=white&labelColor=181717
|
package/index.cjs
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
+
*
|
|
2
3
|
* @Project: @cldmv/droidsock
|
|
3
4
|
* @Filename: /index.cjs
|
|
4
5
|
* @Date: 2025-11-21T15:41:06-08:00 (1763768466)
|
|
5
|
-
* @Author:
|
|
6
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
6
7
|
* @Email: <Shinrai@users.noreply.github.com>
|
|
7
8
|
* -----
|
|
8
|
-
* @Last modified by:
|
|
9
|
-
* @Last modified time: 2026-
|
|
9
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
10
|
+
* @Last modified time: 2026-10-02T15:29:45-07:00 (1790980185)
|
|
10
11
|
* -----
|
|
11
12
|
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
13
|
+
*
|
|
12
14
|
*/
|
|
13
15
|
|
|
14
16
|
/**
|
|
@@ -19,11 +21,20 @@
|
|
|
19
21
|
*
|
|
20
22
|
* @module droidsock
|
|
21
23
|
*/
|
|
24
|
+
"use strict";
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
// index.cjs is a thin wrapper: it loads index.mjs through Node's synchronous require(esm).
|
|
27
|
+
// Node.js versions without require(esm) would fail with a bare ERR_REQUIRE_ESM, so fail
|
|
28
|
+
// early with a message that says what to do instead.
|
|
29
|
+
if (!process.features?.require_module) {
|
|
30
|
+
const error = new Error(
|
|
31
|
+
`@cldmv/droidsock: require() needs Node.js ^20.19.0 or >=22.12.0 (this is ${process.version}). On older Node.js, load the package with import() instead.`
|
|
32
|
+
);
|
|
33
|
+
error.code = "ERR_REQUIRE_ESM";
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
25
36
|
|
|
26
|
-
const { default: droidsock } =
|
|
37
|
+
const { default: droidsock } = require("./index.mjs");
|
|
27
38
|
|
|
28
39
|
// Export main function - the quick path, also callable with options
|
|
29
40
|
module.exports = droidsock; // Default export
|
package/index.mjs
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
+
*
|
|
2
3
|
* @Project: @cldmv/droidsock
|
|
3
4
|
* @Filename: /index.mjs
|
|
4
5
|
* @Date: 2025-11-21T15:41:06-08:00 (1763768466)
|
|
5
|
-
* @Author:
|
|
6
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
6
7
|
* @Email: <Shinrai@users.noreply.github.com>
|
|
7
8
|
* -----
|
|
8
|
-
* @Last modified by:
|
|
9
|
-
* @Last modified time: 2026-
|
|
9
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
10
|
+
* @Last modified time: 2026-10-02T15:29:45-07:00 (1790980185)
|
|
10
11
|
* -----
|
|
11
12
|
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
13
|
+
*
|
|
12
14
|
*/
|
|
13
15
|
|
|
14
16
|
// Development environment check (must happen before droidsock imports)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cldmv/droidsock",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Complete Node.js implementation of the Android Debug Bridge (ADB) protocol",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"module": "./index.mjs",
|
|
@@ -11,10 +11,6 @@
|
|
|
11
11
|
"import": "./index.mjs",
|
|
12
12
|
"require": "./index.cjs"
|
|
13
13
|
},
|
|
14
|
-
"./devcheck": {
|
|
15
|
-
"types": "./types/devcheck.d.mts",
|
|
16
|
-
"import": "./devcheck.mjs"
|
|
17
|
-
},
|
|
18
14
|
"./main": {
|
|
19
15
|
"droidsock-dev": {
|
|
20
16
|
"types": "./types/src/droidsock.d.mts",
|
|
@@ -32,16 +28,17 @@
|
|
|
32
28
|
"build": "node build.mjs",
|
|
33
29
|
"build:types": "tsc --project .configs/tsconfig.dts.jsonc",
|
|
34
30
|
"build:ci": "npm run build && npm run build:types && npm run test:types",
|
|
35
|
-
"test": "node tests/run-vitest.mjs",
|
|
31
|
+
"test": "node tests/run-vitest.mjs && npm run test:cjs",
|
|
32
|
+
"test:cjs": "CI=1 node --test tests/cjs/entry.test.cjs",
|
|
36
33
|
"test:watch": "vitest --config .configs/vitest.config.mjs",
|
|
37
34
|
"test:types": "tsc --noEmit --project .configs/tsconfig.dts.jsonc",
|
|
38
|
-
"coverage": "node tests/run-vitest.mjs --coverage-quiet",
|
|
35
|
+
"coverage": "node tests/run-vitest.mjs --coverage-quiet && npm run test:cjs",
|
|
39
36
|
"ci:coverage": "npm run coverage",
|
|
40
37
|
"lint": "eslint --config .configs/eslint.config.mjs .",
|
|
41
38
|
"lint:fix": "eslint --config .configs/eslint.config.mjs . --fix",
|
|
42
39
|
"format": "prettier --config .configs/.prettierrc --write .",
|
|
43
40
|
"format:check": "prettier --config .configs/.prettierrc --check .",
|
|
44
|
-
"fix:headers": "
|
|
41
|
+
"fix:headers": "fix-headers --config .configs/fix-headers.json",
|
|
45
42
|
"prepare": "node -e \"import('./.githooks/install.mjs').catch(()=>{})\"",
|
|
46
43
|
"precommit:local": "npm run test:types",
|
|
47
44
|
"precommit": "npm run build && npm run build:types && npm run test:types && npm run lint && npm run format:check && npm run test"
|
|
@@ -94,19 +91,18 @@
|
|
|
94
91
|
"files": [
|
|
95
92
|
"index.mjs",
|
|
96
93
|
"index.cjs",
|
|
97
|
-
"devcheck.mjs",
|
|
98
94
|
"README.md",
|
|
99
95
|
"LICENSE",
|
|
100
96
|
"types/dist/",
|
|
101
97
|
"types/index.d.mts",
|
|
102
98
|
"types/index.d.mts.map",
|
|
103
|
-
"types/devcheck.d.mts",
|
|
104
99
|
"dist/"
|
|
105
100
|
],
|
|
106
101
|
"sideEffects": false,
|
|
107
102
|
"devDependencies": {
|
|
103
|
+
"@cldmv/configs": "^1.2.4",
|
|
108
104
|
"@cldmv/eslint-plugin-jsonv": "^1.0.3",
|
|
109
|
-
"@cldmv/fix-headers": "^
|
|
105
|
+
"@cldmv/fix-headers": "^2.2.0",
|
|
110
106
|
"@cldmv/jsonv": "^1.0.2",
|
|
111
107
|
"@cldmv/prettier-plugin-jsonv": "^1.0.1",
|
|
112
108
|
"@cldmv/vitest-runner": "^1.2.0",
|
package/types/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../index.mjs"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../index.mjs"],"names":[],"mappings":";AAwBA;;;;;;GAMG;AACH,qCAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAM3B"}
|
package/devcheck.mjs
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @Project: @cldmv/droidsock
|
|
3
|
-
* @Filename: /devcheck.mjs
|
|
4
|
-
* @Date: 2025-11-08 22:18:57 -08:00 (1762669137)
|
|
5
|
-
* @Author: Nate Hyson <CLDMV>
|
|
6
|
-
* @Email: <Shinrai@users.noreply.github.com>
|
|
7
|
-
* -----
|
|
8
|
-
* @Last modified by: Nate Hyson <CLDMV> (Shinrai@users.noreply.github.com)
|
|
9
|
-
* @Last modified time: 2026-08-30 16:02:20 -07:00 (1788130940)
|
|
10
|
-
* -----
|
|
11
|
-
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { existsSync } from "node:fs";
|
|
15
|
-
import { fileURLToPath } from "node:url";
|
|
16
|
-
import path from "node:path";
|
|
17
|
-
|
|
18
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
-
const __dirname = path.dirname(__filename);
|
|
20
|
-
const srcPath = path.join(__dirname, "src");
|
|
21
|
-
// const distPath = path.join(__dirname, "dist");
|
|
22
|
-
|
|
23
|
-
// Detect if we're running in a CI environment
|
|
24
|
-
const isCI = !!(
|
|
25
|
-
process.env.CI || // Generic CI flag
|
|
26
|
-
process.env.GITHUB_ACTIONS || // GitHub Actions
|
|
27
|
-
process.env.TRAVIS || // Travis CI
|
|
28
|
-
process.env.CIRCLECI || // CircleCI
|
|
29
|
-
process.env.GITLAB_CI || // GitLab CI
|
|
30
|
-
process.env.BUILDKITE || // Buildkite
|
|
31
|
-
process.env.JENKINS_URL || // Jenkins
|
|
32
|
-
process.env.TF_BUILD // Azure DevOps
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
if (existsSync(srcPath) && !isCI) {
|
|
36
|
-
// if (existsSync(srcPath) && !existsSync(distPath)) {
|
|
37
|
-
// NODE_ENV plays no part in Node's conditional-exports resolution - only the
|
|
38
|
-
// "--conditions=droidsock-dev" condition (via NODE_OPTIONS) actually routes
|
|
39
|
-
// exports["./main"] to src/ instead of dist/. NODE_ENV=development alone
|
|
40
|
-
// would previously pass this check while still resolving to dist/.
|
|
41
|
-
const hasNodeOptions = process.env.NODE_OPTIONS?.includes("--conditions=droidsock-dev");
|
|
42
|
-
|
|
43
|
-
if (!hasNodeOptions) {
|
|
44
|
-
console.error("❌ Development environment not properly configured!");
|
|
45
|
-
console.error("📁 Source folder detected but NODE_OPTIONS is not set for development.");
|
|
46
|
-
console.error("");
|
|
47
|
-
console.error("🔧 To fix this, run one of these commands:");
|
|
48
|
-
console.error(" Windows (cmd):");
|
|
49
|
-
console.error(" set NODE_OPTIONS=--conditions=droidsock-dev");
|
|
50
|
-
console.error("");
|
|
51
|
-
console.error(" Windows (PowerShell):");
|
|
52
|
-
console.error(" $env:NODE_OPTIONS='--conditions=droidsock-dev'");
|
|
53
|
-
console.error("");
|
|
54
|
-
console.error(" Unix/Linux/macOS:");
|
|
55
|
-
console.error(" export NODE_OPTIONS=--conditions=droidsock-dev");
|
|
56
|
-
console.error("");
|
|
57
|
-
console.error("💡 This ensures this module loads from src/ instead of dist/ for development.");
|
|
58
|
-
console.error(" (NODE_ENV is not checked here - it has no effect on this resolution.)");
|
|
59
|
-
console.error("🚀 CI environments automatically skip this check.");
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
}
|
package/types/devcheck.d.mts
DELETED