From c0a3a4cdb7da66303a12596bc81609e8477b7e65 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Fri, 18 Oct 2024 18:06:10 -0400 Subject: [PATCH] override whatwg-url dependency The generated client on the release-1.x branch relies on the node-fetch@2.x module, which depends on whatwg-url@5.0.0, which uses the Node core punycode module. Node's punycode module was runtime deprecated v21, which causes this module to print a deprecation warning when used on newer versions of Node. whatwg-url@9.0.0 stopped using punycode directly, but continued to use it indirectly via its own tr46 dependency. The problematic use of punycode was finally removed in whatwg-url@12.0.1. node-fetch will not update its 2.x release line to incorporate the fix due to backwards compatibility. node-fetch@2.x claims backwards compatibility to Node v4, but the fixed version of whatwg-url only claims compatibility back to Node 12. For this reason, the node-fetch project has stated that they will not address this issue. For reference, Node v4 went EOL in 2018, and Node v12 when EOL in early 2022. Node 18 is currently the oldest supported version, and Node v23 was released this week. Ideally, the generator will move to a newer version of node-fetch, native fetch, or even the undici module that implements fetch in core. Until that happens, this module can override whatwg-url and silence the deprecation warning. It's also worth noting that this punycode deprecation is not the same one as the punycode deprecation on the master branch. This change has been tested locally on v18.0.0. Refs: https://github.com/nodejs/node/pull/47202 Refs: https://github.com/node-fetch/node-fetch/pull/1793 --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b71585135b..0eb6949982 100644 --- a/package.json +++ b/package.json @@ -111,6 +111,7 @@ "arrowParens": "always" }, "overrides": { - "colors": "1.4.0" + "colors": "1.4.0", + "whatwg-url@<12.0.1": "12.0.1" } }