@@ -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 { spliceOne, deprecate } = require ( 'internal/util' ) ;
4949
5050// WHATWG URL implementation provided by internal/url
5151const {
@@ -63,8 +63,6 @@ const {
6363
6464const bindingUrl = internalBinding ( 'url' ) ;
6565
66- const { getOptionValue } = require ( 'internal/options' ) ;
67-
6866// Original url.parse() API
6967
7068function Url ( ) {
@@ -122,20 +120,7 @@ const {
122120 CHAR_COLON ,
123121} = require ( 'internal/constants' ) ;
124122
125- let urlParseWarned = false ;
126-
127123function urlParse ( url , parseQueryString , slashesDenoteHost ) {
128- if ( ! urlParseWarned && getOptionValue ( '--pending-deprecation' ) ) {
129- urlParseWarned = true ;
130- process . emitWarning (
131- '`url.parse()` behavior is not standardized and prone to ' +
132- 'errors that have security implications. Use the WHATWG URL API ' +
133- 'instead. CVEs are not issued for `url.parse()` vulnerabilities.' ,
134- 'DeprecationWarning' ,
135- 'DEP0169' ,
136- ) ;
137- }
138-
139124 if ( url instanceof Url ) return url ;
140125
141126 const urlObject = new Url ( ) ;
@@ -1023,7 +1008,11 @@ function pathToFileURL(path, options) {
10231008module . exports = {
10241009 // Original API
10251010 Url,
1026- parse : urlParse ,
1011+ parse : deprecate (
1012+ urlParse ,
1013+ 'url.parse() is deprecated and the behavior is prone to ' +
1014+ 'errors that have security implications. Use new URL() instead.' ,
1015+ 'DEP0169' ) ,
10271016 resolve : urlResolve ,
10281017 resolveObject : urlResolveObject ,
10291018 format : urlFormat ,
0 commit comments