ajv
                                
                                 ajv copied to clipboard
                                
                                    ajv copied to clipboard
                            
                            
                            
                        Replace `uri-js` with `fast-uri`
What issue does this pull request resolve?
This PR fixes issues #2350 and #2343. It removes the (deep) dependency on punycode, a deprecated module.
What changes did you make?
I replaced the default uriResolver to fast-uri instead of uri-js.
Is there anything that requires more attention while reviewing?
This PR supersedes #2377.
It is also worth considering using the web API URL which is defined in URL Living Standard instead of URI which is defined in RFC 3986 and is less prevalent and can resolve the issue raised by @jasoniangreen in the above linked PR:
...I have been speaking to @epoberezkin and he wants me to explore removing uri-js. [..] there is just an open question around browser support. I will update you when I have more.
We can use the native URL API as it is supported with node 10+ and all major browsers and it has 97.68% caniuse score while URI is not standardized afaict.
Thanks!
TODO:
- [ ] rebase
- [ ] fix spec/resolve.spec.ts
ajv is a major contributor to the [DEP0040] DeprecationWarning: The punycode module is deprecated issue that is popping up everywhere (since it's used in eslint). Please fix this.
Less dependencies. Better performance. This is the way!
I would be very happy if there were an initial review or at least a comment from the AJV team.
how progress of this?
@epoberezkin
how progress of this?
No feedback from maintainers, can't move forward :(
I see that there is still a version of this library released recently,
Yes, other pull requests are getting merged and I believe this one is just ignored.
Some feedback - any feedback - from the maintainers would be appreciated
Hi all, I will try and get some guidance from @epoberezkin on this one. Sorry I missed your activity here.
Haha, merge and release a version as soon as possible 😁
Ready
Update: After discussing with @epoberezkin, we want to get one more minor release out with some bug fixes and then will release this change as 9.0.0.
Update: After discussing with @epoberezkin, we want to get one more minor release out with some bug fixes and then will release this change as 9.0.0.
Actually after discussing with EP and understanding the swap, we've decided this can go out as a minor release. I'm going to give it all one last check and do that next.
Hmm, something broke the build to master, I think it's related to a bug in the get_contributors script. Investigating.
Well I did just publish 8.15.0 with fast-uri but it's failing to build browser bundles because for some reason fast-uri has this line require('node:url')? I have no idea why it's not just require('url') but I think I'll have to roll forward with a revert of this change. Will discuss with @epoberezkin.
FYI
fast-uri is not officially said browser-incompatible module itself, so it's no wonder it uses node: prefix.
Webpack error message
Module build failed: UnhandledSchemeError: Reading from "node:url" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.
Related: https://github.com/fastify/fast-uri/issues/21
We are having the same issue with 8.15.0. Since pulling this package our builds have been failing with the following error:
Module build failed: UnhandledSchemeError: Reading from "node:url"
In package.json, we had "^18.12.0" and builds worked yesterday, failed today. Finally tracked it down to this update from 8.14.0 to 8.15.0
See https://github.com/ajv-validator/ajv/issues/2446