Skip to content

fix: deprecation of url.parse#35

Merged
ljharb merged 1 commit into
jonschlinkert:masterfrom
Zamiell:fix-34
Apr 1, 2026
Merged

fix: deprecation of url.parse#35
ljharb merged 1 commit into
jonschlinkert:masterfrom
Zamiell:fix-34

Conversation

@Zamiell
Copy link
Copy Markdown
Contributor

@Zamiell Zamiell commented Mar 11, 2026

Fixes #34.

Problem

Node.js v24 introduced DEP0169, a deprecation warning for url.parse():

(node:1234) [DEP0169] DeprecationWarning: url.parse() behavior is not standardized
and 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.)

@Zamiell
Copy link
Copy Markdown
Contributor Author

Zamiell commented Mar 26, 2026

@ljharb Sorry for the ping, but would you be able to take a look or direct me to the right person?

@ljharb
Copy link
Copy Markdown
Collaborator

ljharb commented Mar 26, 2026

Before I give it a thorough review, please fix the test failures on node < 10 :-)

@ljharb ljharb marked this pull request as draft March 26, 2026 19:07
@Zamiell Zamiell marked this pull request as ready for review March 26, 2026 20:01
Copy link
Copy Markdown
Collaborator

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a test that ensures no deprecation warning is fired?

Comment thread index.js Outdated
Comment thread index.js Outdated
Comment thread index.js Outdated
Comment thread test/index.js Outdated
@Zamiell Zamiell requested a review from ljharb March 26, 2026 20:30
Comment thread index.js Outdated
Comment thread index.js Outdated
@Zamiell Zamiell requested a review from ljharb March 26, 2026 20:45
Comment thread test/index.js Outdated
Comment thread index.js Outdated
Comment thread index.js Outdated
Comment thread index.js Outdated
@Zamiell Zamiell requested a review from ljharb March 26, 2026 23:56
Comment thread index.js Outdated
@Zamiell Zamiell requested a review from ljharb March 27, 2026 03:50
Comment thread index.js Outdated
Comment thread test/index.js Outdated
@Zamiell Zamiell requested a review from ljharb March 27, 2026 11:47
@ljharb ljharb force-pushed the fix-34 branch 2 times, most recently from e4eff00 to 7bc33bc Compare April 1, 2026 03:27
@ljharb
Copy link
Copy Markdown
Collaborator

ljharb commented Apr 1, 2026

I've rebased and updated this; the tests now properly clean up the process warning listener.

@ljharb ljharb added the bug label Apr 1, 2026
@ljharb ljharb force-pushed the fix-34 branch 2 times, most recently from 5274d4a to 771ffeb Compare April 1, 2026 03:38
@Zamiell
Copy link
Copy Markdown
Contributor Author

Zamiell commented Apr 1, 2026

lgtm

@ljharb ljharb merged commit 771ffeb into jonschlinkert:master Apr 1, 2026
410 checks passed
@Zamiell Zamiell deleted the fix-34 branch April 2, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node 24 deprecation warning

2 participants