From 07f75126d4e3d626af6f331fc676e3372f84ac3f Mon Sep 17 00:00:00 2001 From: Nikhil Kumar Rajak Date: Sat, 11 Apr 2026 07:30:20 +0000 Subject: [PATCH] refactor: replace deprecated url.resolve() with WHATWG URL API --- src/components/PageLinks/PageLinks.jsx | 5 +---- src/utilities/process-readme.mjs | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/components/PageLinks/PageLinks.jsx b/src/components/PageLinks/PageLinks.jsx index 6e012bac8c96..75d93e49b74b 100644 --- a/src/components/PageLinks/PageLinks.jsx +++ b/src/components/PageLinks/PageLinks.jsx @@ -1,5 +1,3 @@ -// eslint-disable-next-line n/prefer-node-protocol -import Url from "url"; import PropTypes from "prop-types"; const baseURL = "https://github.com/webpack/webpack.js.org/edit/main/"; @@ -21,8 +19,7 @@ function _handlePrintClick(event) { } export default function PageLinks({ page = {} }) { - // eslint-disable-next-line n/no-deprecated-api - const editLink = page.edit || Url.resolve(baseURL, page.path); + const editLink = page.edit || new URL(page.path, baseURL).href; return (
diff --git a/src/utilities/process-readme.mjs b/src/utilities/process-readme.mjs index de07152328d1..064b7b90e690 100644 --- a/src/utilities/process-readme.mjs +++ b/src/utilities/process-readme.mjs @@ -1,4 +1,3 @@ -import url from "node:url"; import { excludedLoaders, excludedPlugins } from "./constants.mjs"; const beginsWithDocsDomainRegex = /^(?:https?:)\/\/webpack\.js\.org/; @@ -40,8 +39,7 @@ function linkFixerFactory(sourceUrl) { .replace(/raw.githubusercontent.com/, "github.com") .replace(/master/, "blob/master"); - // eslint-disable-next-line n/no-deprecated-api - href = url.resolve(renderedUrl, href); + href = new URL(href, renderedUrl).href; } // Modify absolute documentation links to be root relative