Drop deprecated punycode dependency via whatwg-url override#8
Conversation
Every CLI invocation printed:
DeprecationWarning: The `punycode` module is deprecated.
Traced to the SDK's transitive chain:
@bitmovin/api-sdk → isomorphic-fetch → node-fetch@2 → whatwg-url@5
→ tr46@0.0.3
Both whatwg-url@5 and tr46@0.0.3 do `require("punycode")` without the
trailing slash, which Node resolves to the deprecated builtin.
Add an npm override pinning whatwg-url to ^14.0.0. whatwg-url@14
pulls in tr46@5+ which uses `require("punycode/")` (forcing the
userland package and silencing the warning). The SDK does not call
into whatwg-url APIs directly — it only loads it transitively for
URL parsing inside node-fetch — so the major-version bump is safe.
Verified: SDK still talks to the API, all 108 tests still pass, no
DEP0040 warning on any CLI invocation.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Root-cause diagnosis is correct and the fix is at the right layer. One compatibility concern I'd like verified before merging. Concern:
|
|
I guess the correct fix would be to update/remove that dependency in the |
|
Agreed — upstream SDK fix is the cleaner path. The override approach in this PR works around the symptom but force-swaps Happy to leave this PR open as a reference, or close it once the SDK direction is decided — whichever you prefer. |
Summary
Every CLI invocation printed a Node `DEP0040` deprecation warning:
```
(node:NNN) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
```
The warning leaks into every command's stderr and clutters scripted output.
Root cause
The warning comes from the SDK's transitive dependency chain:
```
@bitmovin/api-sdk → isomorphic-fetch → node-fetch@2 → whatwg-url@5 → tr46@0.0.3
```
Both `whatwg-url@5/lib/url-state-machine.js` and `tr46@0.0.3/index.js` do `require("punycode")` without the trailing slash, which Node resolves to the deprecated builtin instead of the userland package.
Changes
Add an npm override pinning `whatwg-url` to `^14.0.0`. `whatwg-url@14` brings `tr46@5+` which uses `require("punycode/")` (forcing the userland package), so the warning disappears at its source rather than being silenced.
The SDK does not call into `whatwg-url` APIs directly — it only loads transitively through `node-fetch` for URL parsing — so the major-version bump is safe.
Verification
Test plan