Skip to content

Commit 7edf095

Browse files
committed
url: runtime deprecate url.parse
1 parent 291d90a commit 7edf095

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

doc/api/deprecations.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3441,6 +3441,10 @@ Node-API callbacks.
34413441

34423442
<!-- YAML
34433443
changes:
3444+
- version:
3445+
- REPLACEME
3446+
pr-url: https://github.com/nodejs/node/pull/55017
3447+
description: Application deprecation.
34443448
- version:
34453449
- v19.9.0
34463450
- v18.17.0
@@ -3453,7 +3457,7 @@ changes:
34533457
description: Documentation-only deprecation.
34543458
-->
34553459

3456-
Type: Documentation-only (supports [`--pending-deprecation`][])
3460+
Type: Application (non-`node_modules` code only)
34573461

34583462
[`url.parse()`][] behavior is not standardized and prone to errors that
34593463
have security implications. Use the [WHATWG URL API][] instead. CVEs are not

lib/url.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const {
4545

4646
// This ensures setURLConstructor() is called before the native
4747
// URL::ToObject() method is used.
48-
const { spliceOne } = require('internal/util');
48+
const { isInsideNodeModules, spliceOne } = require('internal/util');
4949

5050
// WHATWG URL implementation provided by internal/url
5151
const {
@@ -63,8 +63,6 @@ const {
6363

6464
const bindingUrl = internalBinding('url');
6565

66-
const { getOptionValue } = require('internal/options');
67-
6866
// Original url.parse() API
6967

7068
function Url() {
@@ -125,7 +123,7 @@ const {
125123
let urlParseWarned = false;
126124

127125
function urlParse(url, parseQueryString, slashesDenoteHost) {
128-
if (!urlParseWarned && getOptionValue('--pending-deprecation')) {
126+
if (!urlParseWarned && !isInsideNodeModules()) {
129127
urlParseWarned = true;
130128
process.emitWarning(
131129
'`url.parse()` behavior is not standardized and prone to ' +

0 commit comments

Comments
 (0)