Skip to content

Commit d5da9cd

Browse files
feat(DEP0194): migrate http2 priority signalling (#246)
Co-authored-by: Bruno Rodrigues <swe@brunocroh.com>
1 parent 9cd0fda commit d5da9cd

30 files changed

Lines changed: 705 additions & 0 deletions

File tree

package-lock.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# HTTP/2 Priority Signaling Removal - DEP0194
2+
3+
This recipe removes HTTP/2 priority-related options and methods since priority signaling has been deprecated.
4+
5+
See [DEP0194](https://nodejs.org/api/deprecations.html#DEP0194).
6+
7+
8+
## What this codemod does
9+
10+
- Removes the `priority` property from `http2.connect()` call options
11+
- Removes the `priority` property from `session.request()` call options
12+
- Removes entire `stream.priority()` method call statements
13+
- Removes the `priority` property from `client.settings()` call options
14+
- Handles both CommonJS (`require()`) and ESM (`import`) imports
15+
16+
## Examples
17+
18+
**Before:**
19+
20+
```js
21+
// CommonJS usage
22+
const http2 = require("node:http2");
23+
const session = http2.connect("https://example.com", {
24+
priority: { weight: 16, parent: 0, exclusive: false }
25+
});
26+
const stream = session.request({
27+
":path": "/api/data",
28+
priority: { weight: 32 }
29+
});
30+
stream.priority({ exclusive: true, parent: 0, weight: 128 });
31+
32+
// ESM usage
33+
import http2 from "node:http2";
34+
const client = http2.connect("https://example.com");
35+
client.settings({ enablePush: false, priority: true });
36+
```
37+
38+
**After:**
39+
40+
```js
41+
// CommonJS usage
42+
const http2 = require("node:http2");
43+
const session = http2.connect("https://example.com");
44+
const stream = session.request({
45+
":path": "/api/data"
46+
});
47+
// stream.priority() removed
48+
49+
// ESM usage
50+
import http2 from "node:http2";
51+
const client = http2.connect("https://example.com");
52+
client.settings({ enablePush: false });
53+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
schema_version: "1.0"
2+
name: "@nodejs/http2-priority-signaling"
3+
version: 1.0.0
4+
description: Handle DEP0194 via removing HTTP/2 priority-related options and methods.
5+
author: Augustin Mauroy
6+
license: MIT
7+
workflow: workflow.yaml
8+
category: migration
9+
10+
targets:
11+
languages:
12+
- javascript
13+
- typescript
14+
15+
keywords:
16+
- transformation
17+
- migration
18+
- http2
19+
- deprecation
20+
21+
registry:
22+
access: public
23+
visibility: public
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "@nodejs/http2-priority-signaling",
3+
"version": "1.0.0",
4+
"description": "Handle DEP0194 via removing HTTP/2 priority-related options and methods",
5+
"type": "module",
6+
"scripts": {
7+
"test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests/"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/nodejs/userland-migrations.git",
12+
"directory": "recipes/http2-priority-signaling",
13+
"bugs": "https://github.com/nodejs/userland-migrations/issues"
14+
},
15+
"author": "Augustin Mauroy",
16+
"license": "MIT",
17+
"homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/http2-priority-signaling/README.md",
18+
"devDependencies": {
19+
"@codemod.com/jssg-types": "^1.0.9"
20+
},
21+
"dependencies": {
22+
"@nodejs/codemod-utils": "*"
23+
}
24+
}

0 commit comments

Comments
 (0)