From 8c0071340ec447998e6936d6cee2e276a63d1f54 Mon Sep 17 00:00:00 2001 From: Sergey Vohmyanin Date: Fri, 9 Sep 2022 16:23:50 +0300 Subject: [PATCH] fix(resolve): use nodejs implementation of url parse instead of WHATWG URL in case of support git+ssh protocol --- workspaces/arborist/lib/arborist/reify.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/workspaces/arborist/lib/arborist/reify.js b/workspaces/arborist/lib/arborist/reify.js index 0c9026f5e4d1e..eb6dc3a396a9c 100644 --- a/workspaces/arborist/lib/arborist/reify.js +++ b/workspaces/arborist/lib/arborist/reify.js @@ -13,6 +13,7 @@ const log = require('proc-log') const { dirname, resolve, relative } = require('path') const { depth: dfwalk } = require('treeverse') const fs = require('fs') +const { parse } = require('url') const { promisify } = require('util') const lstat = promisify(fs.lstat) const symlink = promisify(fs.symlink) @@ -718,11 +719,11 @@ module.exports = cls => class Reifier extends cls { // ${REGISTRY} or something. This has to be threaded through the // Shrinkwrap and Node classes carefully, so for now, just treat // the default reg as the magical animal that it has been. - const resolvedURL = new URL(resolved) + const resolvedURL = parse(resolved) if ((this.options.replaceRegistryHost === resolvedURL.hostname) || this.options.replaceRegistryHost === 'always') { // this.registry always has a trailing slash - resolved = `${this.registry.slice(0, -1)}${resolvedURL.pathname}${resolvedURL.searchParams}` + resolved = `${this.registry.slice(0, -1)}${resolvedURL.pathname}${resolvedURL.search || ''}` } return resolved }