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.

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

Migrates legacy imports of internal Node.js TLS modules (`_tls_common`, `_tls_wrap`) to the public `node:tls` module as introduced under [DEP0192](https://nodejs.org/api/deprecations.html#dep0192-requirenode_tls_common-and-requirenode_tls_wrap).

## Supported Modules and Exports

- `_tls_common` / `node:_tls_common`: `SecureContext`, `createSecureContext`
- `_tls_wrap` / `node:_tls_wrap`: `TLSSocket`, `Server`, `createServer`, `connect`

## Behavior

- Replaces module specifiers with `node:tls` 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:tls`.
- Skips internal-only exports (e.g. `translatePeerCertificate`), escaped namespace objects, and unknown properties, reporting them for manual review.
25 changes: 25 additions & 0 deletions recipes/tls-internal-modules-to-node-tls/codemod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
schema_version: "1.0"
name: "@nodejs/tls-internal-modules-to-node-tls"
version: "1.0.0"
description: "Handle DEP0192 by migrating internal TLS module imports (_tls_common, _tls_wrap) to node:tls."
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
- tls
- dep0192

registry:
access: public
visibility: public
24 changes: 24 additions & 0 deletions recipes/tls-internal-modules-to-node-tls/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@nodejs/tls-internal-modules-to-node-tls",
"version": "1.0.0",
"description": "Handle DEP0192 by migrating internal TLS modules (_tls_common, _tls_wrap) to node:tls",
"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/tls-internal-modules-to-node-tls",
"bugs": "https://github.com/nodejs/userland-migrations/issues"
},
"author": "Vishal Raj",
"license": "MIT",
"homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/tls-internal-modules-to-node-tls/README.md",
"devDependencies": {
"@codemod.com/jssg-types": "^1.6.3"
},
"dependencies": {
"@nodejs/codemod-utils": "*"
}
}
Loading