Files
pnpm/__patches__/normalize-package-data@7.0.1.patch
Superchupu adb097ce11 fix: bump normalize-package-data to 7.0.1 (#9784)
* fix: bump `normalize-package-data` to 7.0.1

* fix: polyfill `URL.canParse` if not available

* chore: update lockfile
2025-07-24 00:28:46 +02:00

22 lines
584 B
Diff

diff --git a/lib/fixer.js b/lib/fixer.js
index 49b97f5e322e7acbd040806e04627cd1f1321915..c747f7cdea7afe2ac753514e3b37724a19e48cb4 100644
--- a/lib/fixer.js
+++ b/lib/fixer.js
@@ -10,6 +10,16 @@ var typos = require('./typos.json')
var isEmail = str => str.includes('@') && (str.indexOf('@') < str.lastIndexOf('.'))
+// polyfill until support for node <18.17.0 is dropped
+URL.canParse ??= (input, base) => {
+ try {
+ new URL(input, base);
+ return true;
+ } catch {
+ return false;
+ }
+}
+
module.exports = {
// default warning function
warn: function () {},