fix: deprecation of url.parse#35
Merged
Merged
Conversation
5 tasks
Contributor
Author
|
@ljharb Sorry for the ping, but would you be able to take a look or direct me to the right person? |
Collaborator
|
Before I give it a thorough review, please fix the test failures on node < 10 :-) |
ljharb
reviewed
Mar 26, 2026
ljharb
reviewed
Mar 26, 2026
ljharb
reviewed
Mar 26, 2026
ljharb
requested changes
Mar 26, 2026
ljharb
reviewed
Mar 27, 2026
ljharb
reviewed
Mar 27, 2026
e4eff00 to
7bc33bc
Compare
Collaborator
|
I've rebased and updated this; the tests now properly clean up the process warning listener. |
ljharb
approved these changes
Apr 1, 2026
5274d4a to
771ffeb
Compare
Contributor
Author
|
lgtm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #34.
Problem
Node.js v24 introduced DEP0169, a deprecation warning for url.parse():
(node:1234) [DEP0169] DeprecationWarning:
url.parse()behavior is not standardizedand prone to errors that have security implications. Use the WHATWG URL API instead.
This library called url.parse() in two places, causing the warning to be emitted to stderr whenever the library was used. Downstream projects that assert on clean stderr (e.g. in tests) were broken as a
result.
Solution
Try to detect if the WHATWG URL API exists, and if it does, replace both url.parse() calls with a polyfill using the new API.
(Claude helped me write this PR.)