Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop dependency on uri-js/punycode #2343

Closed
gajus opened this issue Oct 30, 2023 · 21 comments
Closed

Drop dependency on uri-js/punycode #2343

gajus opened this issue Oct 30, 2023 · 21 comments

Comments

@gajus
Copy link
Contributor

gajus commented Oct 30, 2023

What version of Ajv you are you using?

v6.12.6

What problem do you want to solve?

Logs being flooded with deprecation warnings:

contra-api:test:vitest: (Use `node --trace-deprecation ...` to show where the warning was created)
contra-api:test:vitest: (node:747235) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
contra-api:test:vitest: (Use `node --trace-deprecation ...` to show where the warning was created)
contra-api:test:vitest: (node:747235) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
contra-api:test:vitest: (Use `node --trace-deprecation ...` to show where the warning was created)
contra-api:test:vitest: (node:747235) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
contra-api:test:vitest: (Use `node --trace-deprecation ...` to show where the warning was created)
contra-api:test:vitest: (node:747235) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
contra-api:test:vitest: (Use `node --trace-deprecation ...` to show where the warning was created)
contra-api:test:vitest: (node:747235) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
contra-api:test:vitest: (Use `node --trace-deprecation ...` to show where the warning was created)
contra-api:test:vitest: (node:747235) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
contra-api:test:vitest: (Use `node --trace-deprecation ...` to show where the warning was created)

What do you think is the correct solution to problem?

  • Drop Node.js support outside of LTE
  • Drop uri-js (which depends on punycode)

Will you be able to implement it?

Yes

Related issues:

Note:

  • My understanding is that the only reason for uri-js is backwards compatibility for older Node.js versions.
@mikicymulate
Copy link

Also happens in newer version
"ajv": "^8.12.0"
#2350

@domdomegg
Copy link

I've opened a PR to fix this in uri-js, the package ajv depends on here: garycourt/uri-js#95

@iwasrobbed
Copy link

iwasrobbed commented Mar 8, 2024

uri-js is no longer being maintained, so there's not a great chance of it being fixed upstream.

You can also nvm install 20 && nvm use 20 to go back to Node v20.11.1 and silence it for now until ajv/eslint/etc update their dependencies

@andreinwald
Copy link

Hi there,
I created a replacement for library uri-js as temporal solution.

  • Based on Node.js and browser URL api
  • 99% compatible with original URI.js library
  • Solves "The punycode module is deprecated" warning in Node
  • Tested with libraries: ESLint, Webpack, Ajv (runned all Ajv tests)

https://github.com/andreinwald/uri-js-replace

You can add to package.json of your project:

"overrides": {
    "uri-js": "npm:uri-js-replace"
 }

@tianyingchun
Copy link

how progress of this?

@Symmettry
Copy link

Symmettry commented Jun 7, 2024

seems this exists: https://www.npmjs.com/package/toad-uri-js

can this be done? it's really annoying to see when using eslint.

alternativel,y andreinwald's one can be used. i just found this asweel

@jasoniangreen
Copy link
Collaborator

We're working on moving to fast-uri, just waiting for some compatibility fixes on their side so will close this as it is redundant with ongoing work.

@bngo97
Copy link

bngo97 commented Jul 23, 2024

what's the progress on this? @jasoniangreen Is there another issue we can follow to know the progress?

@Mon-ius
Copy link

Mon-ius commented Aug 23, 2024

do we have any progress? 🤗

@jonascarlbaum
Copy link

Using eslint that is dependent on ajv and I get alot of these deprecation warnings — which is really annoying.

Really looking forward for this to be solved...

@tecoad
Copy link

tecoad commented Oct 17, 2024

+1

3 similar comments
@emkelley
Copy link

+1

@fernandoravaneli
Copy link

+1

@timotheeduran
Copy link

+1

@eraoul
Copy link

eraoul commented Nov 30, 2024

Any progress on this?

@fiftyy
Copy link

fiftyy commented Dec 1, 2024

+1

2 similar comments
@Symmettry
Copy link

+1

@Nishanth-Gobi
Copy link

+1

@jasoniangreen
Copy link
Collaborator

Release v8.17.1 has removed uri-js

@johnholliday
Copy link

As indicated by @jasoniangreen, version 8.17.1 of ajv is no longer dependent on punycode. If you're using eslint, you can add the following to your package.json.

// pnpm

{
  "pnpm": {
    "overrides": {
      "ajv": "8.17.1"
    }
  }
}

// terminal
pnpm install

This will force eslint to use the newer version of "ajv".

@jonascarlbaum
Copy link

jonascarlbaum commented Jan 1, 2025

So, guess that means that for yarn 4.5+ I need to do?

{
  "resolutions": {
    "ajv": "8.17.1"
  }
}

will try it out soon…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests