Closed eliellis closed 5 months ago
Thanks for reporting the issue. I've replaced node-fetch with rock-req, which is smaller. Please try the latest version.
Wow! Thank you for such a quick response. I really appreciate it. Latest version yields no warning. π
What
Currently, when requiring
@pushcorn/hocon-parser
in a script using Node.js 21 or greater, a deprecation warning regardingpunycode
is thrown:Why
This is due to
@pushcorn/hocon-parser
directly depending onnode-fetch@2.7.0
, which itself depends onwhatwg-url@^5.0.0
, which depends on the now-deprecated built-inpunycode
module.Doing some investigation, it seems like the correct course of action to solve this would be (in a perfect world) for this package to simply update its dependency on
node-fetch
to version 3, given that this module mandates a minimum Node.js version of 14 or greater already...However
node-fetch
v3 and greater is ESM only, which opens up a whole bag of worms around compatibility with existing users of the library. I'm not sure what the maintainers want to do here, but I am opening this issue as a means to track the deprecation warning because of this transient dependency. Eventually a major release of Node.js will remove thepunycode
module altogether and at that point,node-fetch@2.7.0
will no longer function with those major versions of Node.js, which, in turn, means that this library will not function with those higher versions of Node.js either. πIdeally, the best course of action would be to find a CJS (and possibly additionally, an ESM) compatible way to resolve the issue.
Possible Solutions
node-fetch
v3, make this package ESM-only, and bump this package's major version to to signify the breaking changefetch
module directly, remove thenode-fetch
dependency altogether, update theengines
for this package tonodejs >= 21
and bump this package's major version to signify the breaking changenode-fetch
that does not suffer from the deprecation, doesn't require any changes to theengines
field, and wouldn't require very many changes to this code-base