Skip to content

Commit eec0f97

Browse files
authored
refactor: replace deprecated url.resolve() with WHATWG URL API (#8183)
1 parent 987108a commit eec0f97

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/components/PageLinks/PageLinks.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// eslint-disable-next-line n/prefer-node-protocol
2-
import Url from "url";
31
import PropTypes from "prop-types";
42

53
const baseURL = "https://github.com/webpack/webpack.js.org/edit/main/";
@@ -21,8 +19,7 @@ function _handlePrintClick(event) {
2119
}
2220

2321
export default function PageLinks({ page = {} }) {
24-
// eslint-disable-next-line n/no-deprecated-api
25-
const editLink = page.edit || Url.resolve(baseURL, page.path);
22+
const editLink = page.edit || new URL(page.path, baseURL).href;
2623

2724
return (
2825
<div className="print:hidden mt-8">

src/utilities/process-readme.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import url from "node:url";
21
import { excludedLoaders, excludedPlugins } from "./constants.mjs";
32

43
const beginsWithDocsDomainRegex = /^(?:https?:)\/\/webpack\.js\.org/;
@@ -40,8 +39,7 @@ function linkFixerFactory(sourceUrl) {
4039
.replace(/raw.githubusercontent.com/, "github.com")
4140
.replace(/master/, "blob/master");
4241

43-
// eslint-disable-next-line n/no-deprecated-api
44-
href = url.resolve(renderedUrl, href);
42+
href = new URL(href, renderedUrl).href;
4543
}
4644

4745
// Modify absolute documentation links to be root relative

0 commit comments

Comments
 (0)