|
| 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 | +``` |
0 commit comments