Skip to content

Commit eae4f57

Browse files
committed
deps: update [email protected]
1 parent 7214149 commit eae4f57

File tree

241 files changed

+18806
-87
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+18806
-87
lines changed

node_modules/.gitignore

+40-6
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@
8484
!/@sigstore/core
8585
!/@sigstore/protobuf-specs
8686
!/@sigstore/sign
87+
!/@sigstore/sign/node_modules/
88+
/@sigstore/sign/node_modules/*
89+
!/@sigstore/sign/node_modules/@npmcli/
90+
/@sigstore/sign/node_modules/@npmcli/*
91+
!/@sigstore/sign/node_modules/@npmcli/agent
92+
!/@sigstore/sign/node_modules/@npmcli/fs
93+
!/@sigstore/sign/node_modules/cacache
94+
!/@sigstore/sign/node_modules/make-fetch-happen
95+
!/@sigstore/sign/node_modules/unique-filename
96+
!/@sigstore/sign/node_modules/unique-slug
8797
!/@sigstore/tuf
8898
!/@sigstore/verify
8999
!/@tufjs/
@@ -176,12 +186,10 @@
176186
!/make-fetch-happen
177187
!/make-fetch-happen/node_modules/
178188
/make-fetch-happen/node_modules/*
179-
!/make-fetch-happen/node_modules/@npmcli/
180-
/make-fetch-happen/node_modules/@npmcli/*
181-
!/make-fetch-happen/node_modules/@npmcli/fs
182-
!/make-fetch-happen/node_modules/cacache
183-
!/make-fetch-happen/node_modules/unique-filename
184-
!/make-fetch-happen/node_modules/unique-slug
189+
!/make-fetch-happen/node_modules/minipass-fetch
190+
!/make-fetch-happen/node_modules/minizlib
191+
!/make-fetch-happen/node_modules/proc-log
192+
!/make-fetch-happen/node_modules/ssri
185193
!/minimatch
186194
!/minipass-collect
187195
!/minipass-fetch
@@ -207,6 +215,16 @@
207215
!/mute-stream
208216
!/negotiator
209217
!/node-gyp
218+
!/node-gyp/node_modules/
219+
/node-gyp/node_modules/*
220+
!/node-gyp/node_modules/@npmcli/
221+
/node-gyp/node_modules/@npmcli/*
222+
!/node-gyp/node_modules/@npmcli/agent
223+
!/node-gyp/node_modules/@npmcli/fs
224+
!/node-gyp/node_modules/cacache
225+
!/node-gyp/node_modules/make-fetch-happen
226+
!/node-gyp/node_modules/unique-filename
227+
!/node-gyp/node_modules/unique-slug
210228
!/nopt
211229
!/nopt/node_modules/
212230
/nopt/node_modules/*
@@ -231,7 +249,13 @@
231249
/npm-registry-fetch/node_modules/*
232250
!/npm-registry-fetch/node_modules/@npmcli/
233251
/npm-registry-fetch/node_modules/@npmcli/*
252+
!/npm-registry-fetch/node_modules/@npmcli/agent
253+
!/npm-registry-fetch/node_modules/@npmcli/fs
234254
!/npm-registry-fetch/node_modules/@npmcli/redact
255+
!/npm-registry-fetch/node_modules/cacache
256+
!/npm-registry-fetch/node_modules/make-fetch-happen
257+
!/npm-registry-fetch/node_modules/unique-filename
258+
!/npm-registry-fetch/node_modules/unique-slug
235259
!/npm-user-validate
236260
!/p-map
237261
!/package-json-from-dist
@@ -311,6 +335,16 @@
311335
!/tiny-relative-date
312336
!/treeverse
313337
!/tuf-js
338+
!/tuf-js/node_modules/
339+
/tuf-js/node_modules/*
340+
!/tuf-js/node_modules/@npmcli/
341+
/tuf-js/node_modules/@npmcli/*
342+
!/tuf-js/node_modules/@npmcli/agent
343+
!/tuf-js/node_modules/@npmcli/fs
344+
!/tuf-js/node_modules/cacache
345+
!/tuf-js/node_modules/make-fetch-happen
346+
!/tuf-js/node_modules/unique-filename
347+
!/tuf-js/node_modules/unique-slug
314348
!/unique-filename
315349
!/unique-slug
316350
!/util-deprecate

node_modules/@npmcli/agent/package.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
{
22
"name": "@npmcli/agent",
3-
"version": "2.2.2",
3+
"version": "3.0.0",
44
"description": "the http/https agent used by the npm cli",
55
"main": "lib/index.js",
66
"scripts": {
77
"gencerts": "bash scripts/create-cert.sh",
88
"test": "tap",
9-
"lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
9+
"lint": "npm run eslint",
1010
"postlint": "template-oss-check",
1111
"template-oss-apply": "template-oss-apply --force",
12-
"lintfix": "npm run lint -- --fix",
12+
"lintfix": "npm run eslint -- --fix",
1313
"snap": "tap",
14-
"posttest": "npm run lint"
14+
"posttest": "npm run lint",
15+
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
1516
},
1617
"author": "GitHub Inc.",
1718
"license": "ISC",
@@ -24,11 +25,11 @@
2425
"lib/"
2526
],
2627
"engines": {
27-
"node": "^16.14.0 || >=18.0.0"
28+
"node": "^18.17.0 || >=20.5.0"
2829
},
2930
"templateOSS": {
3031
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
31-
"version": "4.21.3",
32+
"version": "4.23.1",
3233
"publish": "true"
3334
},
3435
"dependencies": {
@@ -39,17 +40,16 @@
3940
"socks-proxy-agent": "^8.0.3"
4041
},
4142
"devDependencies": {
42-
"@npmcli/eslint-config": "^4.0.0",
43-
"@npmcli/template-oss": "4.21.3",
43+
"@npmcli/eslint-config": "^5.0.0",
44+
"@npmcli/template-oss": "4.23.1",
4445
"minipass-fetch": "^3.0.3",
4546
"nock": "^13.2.7",
46-
"semver": "^7.5.4",
47-
"simple-socks": "^3.1.0",
47+
"socksv5": "^0.0.6",
4848
"tap": "^16.3.0"
4949
},
5050
"repository": {
5151
"type": "git",
52-
"url": "https://github.com/npm/agent.git"
52+
"url": "git+https://github.com/npm/agent.git"
5353
},
5454
"tap": {
5555
"nyc-arg": [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
'use strict'
2+
3+
const net = require('net')
4+
const tls = require('tls')
5+
const { once } = require('events')
6+
const timers = require('timers/promises')
7+
const { normalizeOptions, cacheOptions } = require('./options')
8+
const { getProxy, getProxyAgent, proxyCache } = require('./proxy.js')
9+
const Errors = require('./errors.js')
10+
const { Agent: AgentBase } = require('agent-base')
11+
12+
module.exports = class Agent extends AgentBase {
13+
#options
14+
#timeouts
15+
#proxy
16+
#noProxy
17+
#ProxyAgent
18+
19+
constructor (options = {}) {
20+
const { timeouts, proxy, noProxy, ...normalizedOptions } = normalizeOptions(options)
21+
22+
super(normalizedOptions)
23+
24+
this.#options = normalizedOptions
25+
this.#timeouts = timeouts
26+
27+
if (proxy) {
28+
this.#proxy = new URL(proxy)
29+
this.#noProxy = noProxy
30+
this.#ProxyAgent = getProxyAgent(proxy)
31+
}
32+
}
33+
34+
get proxy () {
35+
return this.#proxy ? { url: this.#proxy } : {}
36+
}
37+
38+
#getProxy (options) {
39+
if (!this.#proxy) {
40+
return
41+
}
42+
43+
const proxy = getProxy(`${options.protocol}//${options.host}:${options.port}`, {
44+
proxy: this.#proxy,
45+
noProxy: this.#noProxy,
46+
})
47+
48+
if (!proxy) {
49+
return
50+
}
51+
52+
const cacheKey = cacheOptions({
53+
...options,
54+
...this.#options,
55+
timeouts: this.#timeouts,
56+
proxy,
57+
})
58+
59+
if (proxyCache.has(cacheKey)) {
60+
return proxyCache.get(cacheKey)
61+
}
62+
63+
let ProxyAgent = this.#ProxyAgent
64+
if (Array.isArray(ProxyAgent)) {
65+
ProxyAgent = this.isSecureEndpoint(options) ? ProxyAgent[1] : ProxyAgent[0]
66+
}
67+
68+
const proxyAgent = new ProxyAgent(proxy, {
69+
...this.#options,
70+
socketOptions: { family: this.#options.family },
71+
})
72+
proxyCache.set(cacheKey, proxyAgent)
73+
74+
return proxyAgent
75+
}
76+
77+
// takes an array of promises and races them against the connection timeout
78+
// which will throw the necessary error if it is hit. This will return the
79+
// result of the promise race.
80+
async #timeoutConnection ({ promises, options, timeout }, ac = new AbortController()) {
81+
if (timeout) {
82+
const connectionTimeout = timers.setTimeout(timeout, null, { signal: ac.signal })
83+
.then(() => {
84+
throw new Errors.ConnectionTimeoutError(`${options.host}:${options.port}`)
85+
}).catch((err) => {
86+
if (err.name === 'AbortError') {
87+
return
88+
}
89+
throw err
90+
})
91+
promises.push(connectionTimeout)
92+
}
93+
94+
let result
95+
try {
96+
result = await Promise.race(promises)
97+
ac.abort()
98+
} catch (err) {
99+
ac.abort()
100+
throw err
101+
}
102+
return result
103+
}
104+
105+
async connect (request, options) {
106+
// if the connection does not have its own lookup function
107+
// set, then use the one from our options
108+
options.lookup ??= this.#options.lookup
109+
110+
let socket
111+
let timeout = this.#timeouts.connection
112+
const isSecureEndpoint = this.isSecureEndpoint(options)
113+
114+
const proxy = this.#getProxy(options)
115+
if (proxy) {
116+
// some of the proxies will wait for the socket to fully connect before
117+
// returning so we have to await this while also racing it against the
118+
// connection timeout.
119+
const start = Date.now()
120+
socket = await this.#timeoutConnection({
121+
options,
122+
timeout,
123+
promises: [proxy.connect(request, options)],
124+
})
125+
// see how much time proxy.connect took and subtract it from
126+
// the timeout
127+
if (timeout) {
128+
timeout = timeout - (Date.now() - start)
129+
}
130+
} else {
131+
socket = (isSecureEndpoint ? tls : net).connect(options)
132+
}
133+
134+
socket.setKeepAlive(this.keepAlive, this.keepAliveMsecs)
135+
socket.setNoDelay(this.keepAlive)
136+
137+
const abortController = new AbortController()
138+
const { signal } = abortController
139+
140+
const connectPromise = socket[isSecureEndpoint ? 'secureConnecting' : 'connecting']
141+
? once(socket, isSecureEndpoint ? 'secureConnect' : 'connect', { signal })
142+
: Promise.resolve()
143+
144+
await this.#timeoutConnection({
145+
options,
146+
timeout,
147+
promises: [
148+
connectPromise,
149+
once(socket, 'error', { signal }).then((err) => {
150+
throw err[0]
151+
}),
152+
],
153+
}, abortController)
154+
155+
if (this.#timeouts.idle) {
156+
socket.setTimeout(this.#timeouts.idle, () => {
157+
socket.destroy(new Errors.IdleTimeoutError(`${options.host}:${options.port}`))
158+
})
159+
}
160+
161+
return socket
162+
}
163+
164+
addRequest (request, options) {
165+
const proxy = this.#getProxy(options)
166+
// it would be better to call proxy.addRequest here but this causes the
167+
// http-proxy-agent to call its super.addRequest which causes the request
168+
// to be added to the agent twice. since we only support 3 agents
169+
// currently (see the required agents in proxy.js) we have manually
170+
// checked that the only public methods we need to call are called in the
171+
// next block. this could change in the future and presumably we would get
172+
// failing tests until we have properly called the necessary methods on
173+
// each of our proxy agents
174+
if (proxy?.setRequestProps) {
175+
proxy.setRequestProps(request, options)
176+
}
177+
178+
request.setHeader('connection', this.keepAlive ? 'keep-alive' : 'close')
179+
180+
if (this.#timeouts.response) {
181+
let responseTimeout
182+
request.once('finish', () => {
183+
setTimeout(() => {
184+
request.destroy(new Errors.ResponseTimeoutError(request, this.#proxy))
185+
}, this.#timeouts.response)
186+
})
187+
request.once('response', () => {
188+
clearTimeout(responseTimeout)
189+
})
190+
}
191+
192+
if (this.#timeouts.transfer) {
193+
let transferTimeout
194+
request.once('response', (res) => {
195+
setTimeout(() => {
196+
res.destroy(new Errors.TransferTimeoutError(request, this.#proxy))
197+
}, this.#timeouts.transfer)
198+
res.once('close', () => {
199+
clearTimeout(transferTimeout)
200+
})
201+
})
202+
}
203+
204+
return super.addRequest(request, options)
205+
}
206+
}

0 commit comments

Comments
 (0)