feat: replace nodeify by async/await#656
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the internal nodeify helper and shifts the codebase (including tests/examples) toward pure async/await, while also moving the package to modern Node/ESM conventions.
Changes:
- Remove
nodeifyand drop callback-style overloads in favor of promise-based APIs. - Migrate the package/tests/examples to ESM (
type: module, NodeNext TS config,.jsspecifiers). - Update CI/test infrastructure for newer Node versions and address Node 20+ keep-alive/test flakiness.
Reviewed changes
Copilot reviewed 36 out of 38 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Switch TS compilation to NodeNext ESM settings. |
| package.json | Declare ESM package, add exports, bump engines/typescript tooling. |
| .mocharc.json | Preload tsx for test execution under ESM. |
| scripts/test-docker-all.sh | Update Docker test matrix to newer Node versions. |
| test/Dockerfile | Update Node base image for test container. |
| .github/workflows/release.yaml | Workflow formatting + beta script rename to .cjs. |
| .github/workflows/check.yaml | Update CI Node matrix and lint gating. |
| .github/scripts/before-beta-release.cjs | New script to auto-increment beta prerelease versions. |
| README.md | Update docs to ESM import style and newer Node behavior notes. |
| examples/apify_proxy_tunnel.js | Convert example to ESM import style. |
| src/utils/valid_headers_only.ts | Update local import specifier to .js. |
| src/utils/get_basic.ts | Update local import specifier to .js. |
| src/utils/count_target_bytes.ts | Refactor socket typing/assertion approach. |
| src/utils/nodeify.ts | Remove nodeify helper implementation. |
| src/tcp_tunnel_tools.ts | Remove callback overloads; return promises directly. |
| src/server.ts | Remove callback overloads for listen/close; update ESM imports/types. |
| src/index.ts | Update barrel exports to .js specifiers; export type-only CustomResponse. |
| src/forward_socks.ts | Update local import specifiers to .js. |
| src/forward.ts | Update local import specifiers to .js. |
| src/direct.ts | Update local import specifiers to .js. |
| src/chain_socks.ts | Update local import specifiers to .js. |
| src/chain.ts | Update local import specifiers to .js. |
| src/anonymize_proxy.ts | Remove callback overloads; return promises directly; update imports. |
| test/utils/throws_async.js | Convert test helper to ESM exports/imports. |
| test/utils/testing_tcp_service.js | Convert net import to node: ESM style. |
| test/utils/target_server.js | Convert to ESM, update ws usage, adjust keep-alive for Node 20+. |
| test/utils/run_locally.js | Convert to ESM and run via tsx script. |
| test/tools.js | Convert to ESM imports; remove nodeify tests. |
| test/tcp_tunnel.js | Convert to ESM; rewrite one test to async/await + try/finally cleanup. |
| test/socks.js | Convert to ESM; rewrite tests to async/await. |
| test/server.js | Convert to ESM; improve puppeteer stability + Node 20 behavior adjustments; refactor a test to async/await. |
| test/phantom_get.js | Remove PhantomJS-specific script. |
| test/https-stress-test.js | Convert to ESM; disable keep-alive behaviors that break tracking on Node 20+. |
| test/https-server.js | Convert to ESM; remove external dependency by using local target; relax OpenSSL-variant assertion. |
| test/http-agent.js | Convert to ESM. |
| test/ee-memory-leak.js | Convert to ESM; rewrite test to async/await. |
| test/anonymize_proxy_no_password.js | Convert to ESM; remove callback-style coverage and adjust Node 20+ error expectations. |
| test/anonymize_proxy.js | Convert to ESM; rewrite callback/promise mixed tests to async/await. |
Comments suppressed due to low confidence (1)
README.md:30
Server.listen()is now async-only (no callback), but the README examples still useserver.listen(() => ...). Update these snippets toawait server.listen()(orserver.listen().then(...)) so the example actually runs and prints after the server is listening.
import { Server } from 'proxy-chain';
const server = new Server({ port: 8000 });
server.listen(() => {
console.log(`Proxy server is listening on port ${server.port}`);
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
I wonder if the target branch should be |
daniil-poletaev
requested changes
May 4, 2026
daniil-poletaev
left a comment
Contributor
There was a problem hiding this comment.
Looks way cleaner with async/await 👍
Left few suggestions
Contributor
Author
@jirimoravcik my bad, should be |
jirimoravcik
approved these changes
May 5, 2026
daniil-poletaev
approved these changes
May 5, 2026
bliuchak
added a commit
that referenced
this pull request
May 5, 2026
* feat!: update minimal supported version of Node.js to v20 (#638) * chore: remove typeSocket assertion helper (#653) * feat!: migrate from CJS to ESM (#654) * feat: upgrade typescript to v5 (#655) * feat!: replace nodeify by async/await (#656) * chore: format changelog markdown * docs: add new version info into changelog * chore: bump package version to a major one Close #637
6 tasks
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.
Close #642