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

Abierto
#3,894 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@younggglcy ya está trabajando en esto.

Desde el 19/11/2026.

  • #3918 de @younggglcy — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
node.js, typescript
Área
backend, cli

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
6.6k
Forks
216
Merge medio
9 h 35 min
PR fusionados (30 d)
775

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de vercel-labs/scriptc

Todos los issues de vercel-labs/scriptc

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.