fix: replace curl-impersonate with impit - #1
Merged
Conversation
ky uses Node.js native fetch (undici) which has a distinct TLS fingerprint (JA3/JA4) that Cloudflare detects and blocks with a challenge page. impit uses a Rust-based TLS stack (patched rustls) that impersonates Chrome's TLS handshake. Uses chrome142 fingerprint which produces the same JA4 as curl_chrome145: t13d1516h2_8daaf6152771_d8a2da3f94cd
- Delete create-fetch.ts — inline Impit creation into create-client.ts - Delete npm-fetch.ts — bake base URL into context.fetch - Simplify NpmContext.fetch type — drop NpmFetch/NpmFetchResponse - All call sites: npmFetch(context, path) → context.fetch(path) - Fix leading-slash edge case in URL resolution - Smoke test uses bare Impit instance
…acks - Smoke test now goes through createClient (not bare Impit) to catch misconfiguration. Tests both GET and POST requests. - Add createClient fetch integration test for URL resolution - Add list-packages test for missing field fallback defaults - 87 tests total (was 82)
privatenumber
marked this pull request as ready for review
March 23, 2026 06:48
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.
Replaces the
curl_chrome145external binary with impit — a Rust-based HTTP client with Chrome TLS fingerprint impersonation, distributed as a regular npm package with prebuilt binaries.curl-fetch.tsandnpm-fetch.ts— replaced by impit increate-client.tsnpmFetch(context, path)→client.fetch(path)CurlFetch/CurlRequestInit/CurlResponseLiketypesNpmContext→NpmInternalClient.npm-pkg-settings.session.txtto.npm-pkg-settings.cookies.jsoncreateClient(GET + POST verified against Cloudflare)impit,tough-cookie,tough-cookie-file-storenano-spawn