Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions recipes/http-internal-modules-to-node-http/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# @nodejs/http-internal-modules-to-node-http

Migrates legacy imports of internal Node.js HTTP modules (`_http_*`) to the public `node:http` module as introduced under [DEP0199](https://nodejs.org/api/deprecations.html#dep0199-requirenode_http_).

## Supported Modules and Exports

- `_http_agent` / `node:_http_agent`: `Agent`, `globalAgent`
- `_http_client` / `node:_http_client`: `ClientRequest`
- `_http_incoming` / `node:_http_incoming`: `IncomingMessage`
- `_http_outgoing` / `node:_http_outgoing`: `OutgoingMessage`, `validateHeaderName`, `validateHeaderValue`
- `_http_server` / `node:_http_server`: `Server`, `ServerResponse`, `STATUS_CODES`

## Behavior

- Replaces module specifiers with `node:http` when accessing supported public exports.
- Supports ESM named imports, CommonJS destructuring, direct property access, dynamic imports, and re-exports.
- Preserves local aliases and handles TypeScript type annotations.
- Consolidates multiple imports targeting `node:http`.
- Skips internal-only exports (e.g. `_http_common`), escaped namespace objects, and unknown properties, reporting them for manual review.
25 changes: 25 additions & 0 deletions recipes/http-internal-modules-to-node-http/codemod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
schema_version: "1.0"
name: "@nodejs/http-internal-modules-to-node-http"
version: "1.0.0"
description: "Handle DEP0199 by migrating internal HTTP module imports (_http_*) to node:http."
author: Vishal Raj
license: MIT
workflow: workflow.yaml
category: migration
repository: https://github.com/nodejs/userland-migrations

targets:
languages:
- javascript
- typescript

keywords:
- transformation
- migration
- nodejs
- http
- dep0199

registry:
access: public
visibility: public
24 changes: 24 additions & 0 deletions recipes/http-internal-modules-to-node-http/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@nodejs/http-internal-modules-to-node-http",
"version": "1.0.0",
"description": "Handle DEP0199 by migrating internal HTTP modules (_http_*) to node:http",
"type": "module",
"scripts": {
"test": "npx codemod jssg test -l typescript ./src/workflow.ts"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nodejs/userland-migrations.git",
"directory": "recipes/http-internal-modules-to-node-http",
"bugs": "https://github.com/nodejs/userland-migrations/issues"
},
"author": "Vishal Raj",
"license": "MIT",
"homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/http-internal-modules-to-node-http/README.md",
"devDependencies": {
"@codemod.com/jssg-types": "^1.6.3"
},
"dependencies": {
"@nodejs/codemod-utils": "*"
}
}
Loading
Loading