Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2023-07-13 09:09:17 +00:00
parent 4fad06f438
commit 40a500c743
4168 changed files with 298222 additions and 374905 deletions

47
node_modules/nock/lib/scope.js generated vendored
View file

@ -11,6 +11,7 @@ const debug = require('debug')('nock.scope')
const { EventEmitter } = require('events')
const Interceptor = require('./interceptor')
const { URL, Url: LegacyUrl } = url
let fs
try {
@ -20,7 +21,46 @@ try {
}
/**
* @param {string|RegExp|url.url} basePath
* Normalizes the passed url for consistent internal processing
* @param {string|LegacyUrl|URL} u
*/
function normalizeUrl(u) {
if (!(u instanceof URL)) {
if (u instanceof LegacyUrl) {
return normalizeUrl(new URL(url.format(u)))
}
// If the url is invalid, let the URL library report it
return normalizeUrl(new URL(u))
}
if (!/https?:/.test(u.protocol)) {
throw new TypeError(
`Protocol '${u.protocol}' not recognized. This commonly occurs when a hostname and port are included without a protocol, producing a URL that is valid but confusing, and probably not what you want.`
)
}
return {
href: u.href,
origin: u.origin,
protocol: u.protocol,
username: u.username,
password: u.password,
host: u.host,
hostname:
// strip brackets from IPv6
typeof u.hostname === 'string' && u.hostname.startsWith('[')
? u.hostname.slice(1, -1)
: u.hostname,
port: u.port || (u.protocol === 'http:' ? 80 : 443),
pathname: u.pathname,
search: u.search,
searchParams: u.searchParams,
hash: u.hash,
}
}
/**
* @param {string|RegExp|LegacyUrl|URL} basePath
* @param {Object} options
* @param {boolean} options.allowUnmocked
* @param {string[]} options.badheaders
@ -52,9 +92,8 @@ class Scope extends EventEmitter {
let logNamespace = String(basePath)
if (!(basePath instanceof RegExp)) {
this.urlParts = url.parse(basePath)
this.port =
this.urlParts.port || (this.urlParts.protocol === 'http:' ? 80 : 443)
this.urlParts = normalizeUrl(basePath)
this.port = this.urlParts.port
this.basePathname = this.urlParts.pathname.replace(/\/$/, '')
this.basePath = `${this.urlParts.protocol}//${this.urlParts.hostname}:${this.port}`
logNamespace = this.urlParts.host