Skip to content

Commit 037aa9e

Browse files
committed
build: update dependency https-proxy-agent to v8
See associated pull request for more information. Closes #32762 as a pr takeover
1 parent 4643a8a commit 037aa9e

File tree

3 files changed

+38
-6
lines changed

3 files changed

+38
-6
lines changed

packages/angular/build/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"beasties": "0.4.1",
2929
"browserslist": "^4.26.0",
3030
"esbuild": "0.27.3",
31-
"https-proxy-agent": "7.0.6",
31+
"https-proxy-agent": "8.0.0",
3232
"istanbul-lib-instrument": "6.0.3",
3333
"jsonc-parser": "3.3.1",
3434
"listr2": "10.2.1",

packages/angular/build/src/utils/index-file/inline-fonts.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import { HttpsProxyAgent } from 'https-proxy-agent';
109
import { createHash } from 'node:crypto';
1110
import { readFile, rm, writeFile } from 'node:fs/promises';
12-
import { get as httpsGet } from 'node:https';
11+
import { type Agent, get as httpsGet } from 'node:https';
1312
import { join } from 'node:path';
1413
import { NormalizedCachedOptions } from '../normalize-cache';
1514
import { htmlRewritingStream } from './html-rewriting-stream';
@@ -195,12 +194,28 @@ export class InlineFontsProcessor {
195194
}
196195

197196
const httpsProxy = process.env.HTTPS_PROXY ?? process.env.https_proxy;
197+
let agent: Agent | undefined;
198+
if (httpsProxy) {
199+
// TODO: Remove `https-proxy-agent` usage once the min supported version of Node.js is 24.5.0
200+
// https.globalAgent = new https.Agent({
201+
// proxyEnv: { HTTPS_PROXY: 'http://proxy.company.com:8080' },
202+
// });
203+
// See: https://nodejs.org/en/learn/http/enterprise-network-configuration
204+
// See: https://nodejs.org/docs/latest/api/https.html
205+
206+
const { HttpsProxyAgent } = (await import('https-proxy-agent' as string)) as typeof import(
207+
'https-proxy-agent',
208+
{ with: { 'resolution-mode': 'import' } }
209+
);
210+
agent = new HttpsProxyAgent(httpsProxy) as unknown as Agent;
211+
}
212+
198213
const data = await new Promise<string>((resolve, reject) => {
199214
let rawResponse = '';
200215
httpsGet(
201216
url,
202217
{
203-
agent: httpsProxy ? new HttpsProxyAgent(httpsProxy) : undefined,
218+
agent,
204219
headers: {
205220
/**
206221
* Always use a Windows UA. This is because Google fonts will including hinting in fonts for Windows.

pnpm-lock.yaml

Lines changed: 19 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)