stoplightio / spectral

A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v3.1, v3.0, and v2.0 as well as AsyncAPI v2.x.
https://stoplight.io/spectral
Apache License 2.0
2.35k stars 226 forks source link

Node.js 21+: DeprecationWarning: The `punycode` module is deprecated #2622

Open silverwind opened 1 month ago

silverwind commented 1 month ago

@stoplight/spectral-runtime and @stoplight/json-ref-readers indirectly depend on node-fetch@2 and tr46@0.0.3 which triggers a runtime deprecation warning in Node.js 21 and above. As per https://github.com/node-fetch/node-fetch/pull/1793#issuecomment-1839050150, the likely only option is to upgrade to node-fetch@3:

Warning:

(node:77383) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.

Occurence:

$ rg require.+punycode node_modules/tr46/index.js
3:var punycode = require("punycode");

Dependency tree:

└─┬ @stoplight/spectral-cli@6.11.1
  └─┬ @stoplight/spectral-runtime@1.1.2
    └─┬ node-fetch@2.7.0
      └─┬ whatwg-url@5.0.0
        └── tr46@0.0.3