Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
15 changes: 15 additions & 0 deletions package-lock.json

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

53 changes: 53 additions & 0 deletions recipes/http2-priority-signaling/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# HTTP/2 Priority Signaling Removal - DEP0194

This recipe removes HTTP/2 priority-related options and methods since priority signaling has been deprecated.

See [DEP0194](https://nodejs.org/api/deprecations.html#DEP0194).


## What this codemod does

- Removes the `priority` property from `http2.connect()` call options
- Removes the `priority` property from `session.request()` call options
- Removes entire `stream.priority()` method call statements
- Removes the `priority` property from `client.settings()` call options
- Handles both CommonJS (`require()`) and ESM (`import`) imports

## Examples

**Before:**

```js
// CommonJS usage
const http2 = require("node:http2");
const session = http2.connect("https://example.com", {
priority: { weight: 16, parent: 0, exclusive: false }
});
const stream = session.request({
":path": "/api/data",
priority: { weight: 32 }
});
stream.priority({ exclusive: true, parent: 0, weight: 128 });

// ESM usage
import http2 from "node:http2";
const client = http2.connect("https://example.com");
client.settings({ enablePush: false, priority: true });
```

**After:**

```js
// CommonJS usage
const http2 = require("node:http2");
const session = http2.connect("https://example.com");
const stream = session.request({
":path": "/api/data"
});
// stream.priority() removed

// ESM usage
import http2 from "node:http2";
const client = http2.connect("https://example.com");
client.settings({ enablePush: false });
```
23 changes: 23 additions & 0 deletions recipes/http2-priority-signaling/codemod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
schema_version: "1.0"
name: "@nodejs/http2-priority-signaling"
version: 1.0.0
description: Handle DEP0194 via removing HTTP/2 priority-related options and methods.
author: Augustin Mauroy
license: MIT
workflow: workflow.yaml
category: migration

targets:
languages:
- javascript
- typescript

keywords:
- transformation
- migration
- http2
- deprecation

registry:
access: public
visibility: public
24 changes: 24 additions & 0 deletions recipes/http2-priority-signaling/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@nodejs/http2-priority-signaling",
"version": "1.0.0",
"description": "Handle DEP0194 via removing HTTP/2 priority-related options and methods",
"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/http2-priority-signaling",
"bugs": "https://github.com/nodejs/userland-migrations/issues"
},
"author": "Augustin Mauroy",
"license": "MIT",
"homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/http2-priority-signaling/README.md",
"devDependencies": {
"@codemod.com/jssg-types": "^1.0.9"
},
"dependencies": {
"@nodejs/codemod-utils": "*"
}
}
Loading
Loading