Skip to content

Commit

Permalink
Lazy-load @vscode/proxy-agent (microsoft#198662)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmarti authored Nov 20, 2023
1 parent 3671d15 commit be03818
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/vs/platform/native/electron-main/nativeHostMainService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import { WindowProfiler } from 'vs/platform/profiling/electron-main/windowProfil
import { IV8Profile } from 'vs/platform/profiling/common/profiling';
import { IAuxiliaryWindowsMainService, isAuxiliaryWindow } from 'vs/platform/auxiliaryWindow/electron-main/auxiliaryWindows';
import { IAuxiliaryWindow } from 'vs/platform/auxiliaryWindow/electron-main/auxiliaryWindow';
import { loadSystemCertificates } from '@vscode/proxy-agent';

export interface INativeHostMainService extends AddFirstParameterToFunctions<ICommonNativeHostService, Promise<unknown> /* only methods, not events */, number | undefined /* window ID */> { }

Expand Down Expand Up @@ -766,7 +765,8 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
}

async loadCertificates(_windowId: number | undefined): Promise<string[]> {
return loadSystemCertificates({ log: this.logService });
const proxyAgent = await import('@vscode/proxy-agent');
return proxyAgent.loadSystemCertificates({ log: this.logService });
}

findFreePort(windowId: number | undefined, startPort: number, giveUpAfter: number, timeout: number, stride = 1): Promise<number> {
Expand Down
4 changes: 2 additions & 2 deletions src/vs/platform/request/node/requestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { ILogService, ILoggerService } from 'vs/platform/log/common/log';
import { AbstractRequestService, IRequestService } from 'vs/platform/request/common/request';
import { Agent, getProxyAgent } from 'vs/platform/request/node/proxy';
import { createGunzip } from 'zlib';
import { loadSystemCertificates } from '@vscode/proxy-agent';

interface IHTTPConfiguration {
proxy?: string;
Expand Down Expand Up @@ -112,7 +111,8 @@ export class RequestService extends AbstractRequestService implements IRequestSe
}

async loadCertificates(): Promise<string[]> {
return loadSystemCertificates({ log: this.logService });
const proxyAgent = await import('@vscode/proxy-agent');
return proxyAgent.loadSystemCertificates({ log: this.logService });
}
}

Expand Down

0 comments on commit be03818

Please sign in to comment.