Support undici 8.x request() through the built-in implementation

Aperta
#3,894 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@younggglcy ci sta già lavorando.

Dal 19/11/2026.

  • #3918 di @younggglcy — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
node.js, typescript
Ambito
backend, cli

Direzione di ricerca

Read the built-in undici implementation and the dependency guide at docs/content/docs/dependencies.mdx, then trace how package selection handles undici 7.x and the SC8005 fallback. Start by compiling the three-line request.mts example with undici 8.12.2 and no libnode pack. Done means the example builds and runs against a loopback server, prints 200 ok, and covers the stated request and response body behavior; issue #3918 already has an open linked pull request.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Request

Could the built-in undici implementation support 8.x, starting with request() over HTTP/1.1? This would let CLI applications that use the current major make an HTTP request without shipping a libnode runtime pack. The dependency guide for v0.4.14 lists 5.x and 7.x.

Reproduction

Tested on macOS arm64 with Node 24.18.0 and scriptc 0.4.14. In a fresh directory:

npm init -y
npm install --save-exact [email protected] [email protected]
cat > request.mts <<'EOF'
import { request } from "undici";
const response = await request(process.argv[2]!);
console.log(response.statusCode, await response.body.text());
EOF
npx scriptc build request.mts -o ./client

The build reports SC8005 and asks for a libnode pack. I ran the same source against a loopback HTTP server returning status 200 and the body ok:

Installed undici Build Executable output
7.28.0 Default build succeeds with the built-in implementation 200 ok
8.12.2 Default build stops at SC8005 without a libnode pack —
8.12.2 With @scriptc/[email protected] and --libnode=<pack directory>, the build reports SC8001 for the undici Node island 200 ok

An acceptance test could compile the three-line example with undici 8 installed, without a libnode pack, and run it against a loopback server. This exercises package selection and reading the response body.

Scope

The 8.x Node island also worked in a separate test calling both request and fetch with new Agent({ allowH2: false }). Native coverage for CLI clients that use proxies would additionally need ProxyAgent and EnvHttpProxyAgent. The 7.x shim rejects both imports and the explicit allowH2 option, so selecting the existing 7.x implementation for all 8.x users would leave observable gaps. Proxy traffic itself was outside this test.

Lingua principale
TypeScript
Stelle
6.6k
Fork
216
Merge medio
9h 35m
PR unite (30g)
775

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vercel-labs/scriptc

Tutte le issue di vercel-labs/scriptc

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.