fix: resolve punycode deprecation warning by updating whatwg-url#1861
fix: resolve punycode deprecation warning by updating whatwg-url#1861veeceey wants to merge 2 commits intonode-fetch:2.xfrom
Conversation
[email protected] depends on tr46@~0.0.3 which uses Node's built-in punycode module, triggering DEP0040 deprecation warnings on Node 21+. [email protected]+ depends on tr46@^1.0.1 which uses the userland punycode npm package instead, avoiding the deprecation warning. This is the most conservative version bump that fixes the issue while maintaining backward compatibility with older Node.js versions (no engine restriction in whatwg-url@7). Fixes node-fetch#1826 Fixes node-fetch#1797
|
Friendly ping - any chance someone could take a look at this when they get a chance? Happy to make any changes if needed. |
|
I'm not sure this is enough. I have also just encountered this deprecation warning, but it is not coming from I believe that at least version [email protected] is required, as that's the one where However, even |
whatwg-url v7.x and v8.x directly require("punycode") from Node's
built-in module, which is deprecated since Node 16 and removed in v22.
v9.0.0 is the first release that fully removes this direct usage;
it delegates all punycode work to tr46 which depends on the userland
punycode npm package instead.
|
You're right, @TimShilov. Thanks for the detailed report. The original change bumping to
I've updated the range to |
Bumps
whatwg-urlfrom^5.0.0to^7.0.0to fix the punycode deprecation warning (DEP0040) that shows up on Node.js 21+.The root cause is that
[email protected]depends ontr46@~0.0.3, which uses Node's built-inpunycodemodule — deprecated since Node 21. Updating towhatwg-url@7pulls intr46@^1.0.1, which depends on the userlandpunycodenpm package instead, so the warning goes away.I went with v7 rather than a higher version because it has no
enginesrestriction, keeping backward compat with older Node versions that 2.x still supports. The only API node-fetch uses from whatwg-url is theURLconstructor (as a polyfill fallback), which is fully compatible across versions.Verified locally:
url.parse()deprecation, unrelated)node --throw-deprecationno longer throws for punycodemünchen.de->xn--mnchen-3ya.de)Fixes #1826
Fixes #1797