Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2279,7 +2279,7 @@ changes:
description: Documentation-only deprecation.
-->

Type: Documentation-only
Type: Runtime

The [Legacy URL API][] is deprecated. This includes [`url.format()`][],
[`url.parse()`][], [`url.resolve()`][], and the [legacy `urlObject`][]. Please
Expand Down
23 changes: 17 additions & 6 deletions lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const { validateString } = require('internal/validators');

// This ensures setURLConstructor() is called before the native
// URL::ToObject() method is used.
const { spliceOne } = require('internal/util');
const { spliceOne, deprecate } = require('internal/util');

// WHATWG URL implementation provided by internal/url
const {
Expand Down Expand Up @@ -964,11 +964,22 @@ Url.prototype.parseHost = function parseHost() {

module.exports = {
// Original API
Url,
parse: urlParse,
resolve: urlResolve,
resolveObject: urlResolveObject,
format: urlFormat,
Url: deprecate(Url,
'Url() is deprecated. Use the URL object.',
'DEP0116'),
parse: deprecate(urlParse,
'url.parse() is deprecated. Use the URL object.',
'DEP0116'),
resolve: deprecate(urlResolve,
'url.resolve() is deprecated. Use the URL object.',
'DEP0116'),
resolveObject: deprecate(urlResolveObject,
'url.resolveObject() is deprecated. ' +
'Use the URL object.',
'DEP0116'),
format: deprecate(urlFormat,
'url.format() is deprecated. Use the URL object.',
'DEP0116'),

// WHATWG API
URL,
Expand Down