Skip to content

Commit af96445

Browse files
committed
Fix Node 18 regression.
1 parent 4e6c2e0 commit af96445

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/utils/lockfile/package-lock-json.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ function getDetailsFromDiff(
127127

128128
function getUrlOrigin(input: string): string {
129129
try {
130-
return URL.parse(input)?.origin ?? ''
130+
// TODO: URL.parse is available in Node 22.1.0. We can use it when we drop Node 18.
131+
// https://nodejs.org/docs/latest-v22.x/api/url.html#urlparseinput-base
132+
// return URL.parse(input)?.origin ?? ''
133+
return new URL(input).origin ?? ''
131134
} catch {}
132135
return ''
133136
}

0 commit comments

Comments
 (0)