Skip to content

Deps upgrade and http2 autoselectfamily#484

Merged
mike442144 merged 2 commits into
masterfrom
deps-upgrade-and-http2-autoselectfamily
Jun 4, 2026
Merged

Deps upgrade and http2 autoselectfamily#484
mike442144 merged 2 commits into
masterfrom
deps-upgrade-and-http2-autoselectfamily

Conversation

@mike442144
Copy link
Copy Markdown
Collaborator

No description provided.

Bump runtime deps (got 15, cheerio 1.2, iconv-lite 0.7, tslog, tsup) and
dev deps (ava 8, nock 14, sinon 22, typescript 6, eslint 10, etc.), and
remove the obsolete @types/got (got ships its own types now), which also
clears the form-data advisory. moduleResolution -> "bundler" so got's ESM
types resolve.

Adapt to got 15: pass url as the first argument and normalize the
Uint8Array body to a Buffer before charset sniffing.

Fix renameOptionParams writing keys that resolved to undefined (e.g.
rateLimit: undefined), which clobbered crawler defaults when spread via
{ ...defaultOptions, ...options }.

Ignore .npmrc so the publish auth token is never committed.
Expose autoSelectFamily and autoSelectFamilyAttemptTimeout so callers can
tune Node's "Happy Eyeballs" behavior. On dual-stack hosts with broken or
slow IPv6, Node's 250ms per-address default aborts the request with
ETIMEDOUT before the working address can connect.

got strips unknown options and manages the http2 session internally, so
these can't be forwarded per-request; they are applied via Node's
process-wide net defaults, which covers both the http1 and http2 paths.

Document both options in the README and set the attempt timeout in the
http2 tests so they pass against the high-latency live host.
@mike442144 mike442144 requested a review from Copilot June 4, 2026 12:31
@mike442144 mike442144 merged commit 2877e44 into master Jun 4, 2026
1 of 2 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades key dependencies (notably got), updates the crawler’s request pipeline to stay compatible with the newer got API, and adds support/documentation for Node “Happy Eyeballs” socket defaults (autoSelectFamily*) to improve HTTP/2 connectivity on dual-stack hosts.

Changes:

  • Upgrade dependencies (including got to v15) and adjust request invocation/response-body normalization accordingly.
  • Add autoSelectFamily / autoSelectFamilyAttemptTimeout options to types, option-stripping, README, and HTTP/2 tests.
  • Update TypeScript module resolution and AVA config format to match newer toolchain expectations.

Reviewed changes

Copilot reviewed 6 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tsconfig.json Switches TS module resolution to bundler.
test/http2Response.js Adds autoSelectFamilyAttemptTimeout to HTTP/2 tests and adds error logging (needs adjustment).
src/types/crawler.ts Extends RequestOptions with autoSelectFamily* and JSDoc.
src/options.ts Adds autoSelectFamily* to option filtering; applies Node process-wide defaults; adapts types for new got usage.
src/crawler.ts Updates got typing/imports, got v15 calling convention, and normalizes body type.
README.md Documents the new autoSelectFamily* options.
package.json Bumps version and upgrades runtime/dev dependencies; updates AVA config shape.
.gitignore Adds .npmrc to ignored files.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/options.ts
};

export const alignOptions = (options: RequestOptions): GotUrl => {
export const alignOptions = (options: RequestOptions): OptionsInit => {
Comment thread src/options.ts
Comment on lines +112 to +116
// "Happy Eyeballs" tuning. got strips unknown options and manages the
// http2 session internally, so these socket-level settings can't be passed
// per-request through got — Node only exposes them as process-wide defaults.
// Applied here (before they are stripped below) so they take effect for both
// the http1 and http2 paths. Guarded because the setters only exist on Node >=19.
Comment thread src/types/crawler.ts
Comment on lines +123 to +124
* Note: Node applies this as a process-wide default, so it affects all in-flight requests.
*/
Comment thread src/types/crawler.ts
Comment on lines +133 to +134
* Note: Node applies this as a process-wide default, so it affects all in-flight requests.
*/
Comment thread README.md
Comment on lines +595 to +596
- **Note:** Node applies this as a process-wide default, so it affects all in-flight requests.

Comment thread README.md
Comment on lines +602 to +603
- **Note:** Node applies this as a process-wide default, so it affects all in-flight requests.

Comment thread test/http2Response.js
Comment on lines 23 to 27
callback: (error, response, done) => {
if(error){
console.log(error);
}
t.is(response.statusCode, 200);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants