mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
replace node-fetch with native fetch (#198408)
* replace node-fetch with native fetch * fix dep version * handle terminated error from fetch * more error handling
This commit is contained in:
parent
c520c85342
commit
87e7f8b5e1
File diff suppressed because one or more lines are too long
|
@ -5,8 +5,8 @@
|
|||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import fetch, { RequestInit } from 'node-fetch';
|
||||
import { Readable } from 'stream';
|
||||
import type { ReadableStream } from 'stream/web';
|
||||
import { pipeline } from 'node:stream/promises';
|
||||
import * as yauzl from 'yauzl';
|
||||
import * as crypto from 'crypto';
|
||||
|
@ -413,19 +413,23 @@ class State {
|
|||
}
|
||||
}
|
||||
|
||||
const azdoFetchOptions = { headers: { Authorization: `Bearer ${e('SYSTEM_ACCESSTOKEN')}` }, timeout: 60_000 };
|
||||
const azdoFetchOptions = { headers: { Authorization: `Bearer ${e('SYSTEM_ACCESSTOKEN')}` } };
|
||||
|
||||
async function requestAZDOAPI<T>(path: string): Promise<T> {
|
||||
const res = await fetch(`${e('BUILDS_API_URL')}${path}?api-version=6.0`, azdoFetchOptions);
|
||||
const abortController = new AbortController();
|
||||
const timeout = setTimeout(() => abortController.abort(), 2 * 60 * 1000);
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`Unexpected status code: ${res.status}`);
|
||||
try {
|
||||
const res = await fetch(`${e('BUILDS_API_URL')}${path}?api-version=6.0`, { ...azdoFetchOptions, signal: abortController.signal });
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`Unexpected status code: ${res.status}`);
|
||||
}
|
||||
|
||||
return await res.json();
|
||||
} finally {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
|
||||
return await Promise.race([
|
||||
res.json(),
|
||||
new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout')), 60_000))
|
||||
]);
|
||||
}
|
||||
|
||||
interface Artifact {
|
||||
|
@ -456,16 +460,20 @@ async function getPipelineTimeline(): Promise<Timeline> {
|
|||
}
|
||||
|
||||
async function downloadArtifact(artifact: Artifact, downloadPath: string): Promise<void> {
|
||||
const res = await fetch(artifact.resource.downloadUrl, azdoFetchOptions);
|
||||
const abortController = new AbortController();
|
||||
const timeout = setTimeout(() => abortController.abort(), 6 * 60 * 1000);
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`Unexpected status code: ${res.status}`);
|
||||
try {
|
||||
const res = await fetch(artifact.resource.downloadUrl, { ...azdoFetchOptions, signal: abortController.signal });
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(`Unexpected status code: ${res.status}`);
|
||||
}
|
||||
|
||||
await pipeline(Readable.fromWeb(res.body as ReadableStream), fs.createWriteStream(downloadPath));
|
||||
} finally {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
|
||||
await Promise.race([
|
||||
pipeline(res.body, fs.createWriteStream(downloadPath)),
|
||||
new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout')), 5 * 60 * 1000))
|
||||
]);
|
||||
}
|
||||
|
||||
async function unzip(packagePath: string, outputPath: string): Promise<string> {
|
||||
|
|
|
@ -12,7 +12,7 @@ async function retry(fn) {
|
|||
return await fn(run);
|
||||
}
|
||||
catch (err) {
|
||||
if (!/fetch failed|timeout|TimeoutError|Timeout Error|RestError|Client network socket disconnected|socket hang up|ECONNRESET|CredentialUnavailableError|endpoints_resolution_error|Audience validation failed|end of central directory record signature not found/i.test(err.message)) {
|
||||
if (!/fetch failed|terminated|aborted|timeout|TimeoutError|Timeout Error|RestError|Client network socket disconnected|socket hang up|ECONNRESET|CredentialUnavailableError|endpoints_resolution_error|Audience validation failed|end of central directory record signature not found/i.test(err.message)) {
|
||||
throw err;
|
||||
}
|
||||
lastError = err;
|
||||
|
@ -25,4 +25,4 @@ async function retry(fn) {
|
|||
throw lastError;
|
||||
}
|
||||
exports.retry = retry;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmV0cnkuanMiLCJzb3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QixDQUFDLENBQUM7SUFDN0MsTUFBTSxTQUFTLENBQUM7QUFDakIsQ0FBQztBQXJCRCxzQkFxQkMifQ==
|
|
@ -10,7 +10,7 @@ export async function retry<T>(fn: (attempt: number) => Promise<T>): Promise<T>
|
|||
try {
|
||||
return await fn(run);
|
||||
} catch (err) {
|
||||
if (!/fetch failed|timeout|TimeoutError|Timeout Error|RestError|Client network socket disconnected|socket hang up|ECONNRESET|CredentialUnavailableError|endpoints_resolution_error|Audience validation failed|end of central directory record signature not found/i.test(err.message)) {
|
||||
if (!/fetch failed|terminated|aborted|timeout|TimeoutError|Timeout Error|RestError|Client network socket disconnected|socket hang up|ECONNRESET|CredentialUnavailableError|endpoints_resolution_error|Audience validation failed|end of central directory record signature not found/i.test(err.message)) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const node_fetch_1 = require("node-fetch");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const url = require("url");
|
||||
|
@ -23,9 +22,9 @@ async function downloadExtensionDetails(extension) {
|
|||
const repositoryContentBaseUrl = `https://${token ? `${token}@` : ''}${contentBasePath}/${repository}/v${extension.version}`;
|
||||
async function getContent(fileName) {
|
||||
try {
|
||||
const response = await (0, node_fetch_1.default)(`${repositoryContentBaseUrl}/${fileName}`);
|
||||
const response = await fetch(`${repositoryContentBaseUrl}/${fileName}`);
|
||||
if (response.ok) {
|
||||
return { fileName, body: await response.buffer() };
|
||||
return { fileName, body: Buffer.from(await response.arrayBuffer()) };
|
||||
}
|
||||
else if (response.status === 404) {
|
||||
return { fileName, body: undefined };
|
||||
|
@ -77,4 +76,4 @@ main().then(() => {
|
|||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJm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SUFDbEIsS0FBSyxNQUFNLFNBQVMsSUFBSSxDQUFDLEdBQUcsaUJBQWlCLEVBQUUsR0FBRyxvQkFBb0IsQ0FBQyxFQUFFLENBQUM7UUFDekUsTUFBTSx3QkFBd0IsQ0FBQyxTQUFTLENBQUMsQ0FBQztJQUMzQyxDQUFDO0FBQ0YsQ0FBQztBQUVELElBQUksRUFBRSxDQUFDLElBQUksQ0FBQyxHQUFHLEVBQUU7SUFDaEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxpREFBaUQsVUFBVSxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUM7SUFDdkYsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUNqQixDQUFDLEVBQUUsR0FBRyxDQUFDLEVBQUU7SUFDUixPQUFPLENBQUMsR0FBRyxDQUFDLDhEQUE4RCxVQUFVLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQztJQUNsRyxPQUFPLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDO0lBQ25CLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFDakIsQ0FBQyxDQUFDLENBQUMifQ==
|
|
@ -3,7 +3,6 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import fetch from 'node-fetch';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as url from 'url';
|
||||
|
@ -30,7 +29,7 @@ async function downloadExtensionDetails(extension: IExtensionDefinition): Promis
|
|||
try {
|
||||
const response = await fetch(`${repositoryContentBaseUrl}/${fileName}`);
|
||||
if (response.ok) {
|
||||
return { fileName, body: await response.buffer() };
|
||||
return { fileName, body: Buffer.from(await response.arrayBuffer()) };
|
||||
} else if (response.status === 404) {
|
||||
return { fileName, body: undefined };
|
||||
} else {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -221,7 +221,7 @@ class MonacoGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
private _executeSoonTimer: NodeJS.Timer | null = null;
|
||||
private _executeSoonTimer: NodeJS.Timeout | null = null;
|
||||
private _executeSoon(): void {
|
||||
if (this._executeSoonTimer !== null) {
|
||||
clearTimeout(this._executeSoonTimer);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,6 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as es from 'event-stream';
|
||||
import fetch, { RequestInit } from 'node-fetch';
|
||||
import * as VinylFile from 'vinyl';
|
||||
import * as log from 'fancy-log';
|
||||
import * as ansiColors from 'ansi-colors';
|
||||
|
@ -61,7 +60,7 @@ export async function fetchUrl(url: string, options: IFetchOptions, retries = 10
|
|||
log(`Fetch completed: Status ${response.status}. Took ${ansiColors.magenta(`${new Date().getTime() - startTime} ms`)}`);
|
||||
}
|
||||
if (response.ok && (response.status >= 200 && response.status < 300)) {
|
||||
const contents = await response.buffer();
|
||||
const contents = Buffer.from(await response.arrayBuffer());
|
||||
if (options.checksumSha256) {
|
||||
const actualSHA256Checksum = crypto.createHash('sha256').update(contents).digest('hex');
|
||||
if (actualSHA256Checksum !== options.checksumSha256) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,6 @@ import * as path from 'path';
|
|||
import * as byline from 'byline';
|
||||
import { rgPath } from '@vscode/ripgrep';
|
||||
import * as Parser from 'tree-sitter';
|
||||
import fetch from 'node-fetch';
|
||||
const { typescript } = require('tree-sitter-typescript');
|
||||
const product = require('../../product.json');
|
||||
const packageJson = require('../../package.json');
|
||||
|
|
9
build/lib/typings/stream.d.ts
vendored
Normal file
9
build/lib/typings/stream.d.ts
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
declare namespace NodeJS {
|
||||
type ComposeFnParam = (source: any) => void;
|
||||
interface ReadWriteStream {
|
||||
compose<T extends NodeJS.ReadableStream>(
|
||||
stream: T | ComposeFnParam | Iterable<T> | AsyncIterable<T>,
|
||||
options?: { signal: AbortSignal },
|
||||
): T;
|
||||
}
|
||||
}
|
|
@ -50,7 +50,6 @@
|
|||
"jsonc-parser": "^2.3.0",
|
||||
"mime": "^1.4.1",
|
||||
"mkdirp": "^1.0.4",
|
||||
"node-fetch": "2",
|
||||
"source-map": "0.6.1",
|
||||
"ternary-stream": "^3.0.0",
|
||||
"through2": "^4.0.2",
|
||||
|
|
|
@ -564,9 +564,11 @@
|
|||
integrity sha512-El3+WJk2D/ppWNd2X05aiP5l2k4EwF7KwheknQZls+I26eSICoWRhRIJ56jGgw2dqNGQ5LtNajmBU2ajS28EvQ==
|
||||
|
||||
"@types/node@18.x":
|
||||
version "18.15.13"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469"
|
||||
integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==
|
||||
version "18.18.9"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.18.9.tgz#5527ea1832db3bba8eb8023ce8497b7d3f299592"
|
||||
integrity sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==
|
||||
dependencies:
|
||||
undici-types "~5.26.4"
|
||||
|
||||
"@types/pump@^1.0.1":
|
||||
version "1.0.1"
|
||||
|
@ -2076,13 +2078,6 @@ node-addon-api@^4.3.0:
|
|||
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-4.3.0.tgz#52a1a0b475193e0928e98e0426a0d1254782b77f"
|
||||
integrity sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==
|
||||
|
||||
node-fetch@2:
|
||||
version "2.6.7"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
|
||||
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
|
||||
dependencies:
|
||||
whatwg-url "^5.0.0"
|
||||
|
||||
node-fetch@^2.6.7:
|
||||
version "2.6.9"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6"
|
||||
|
@ -2704,6 +2699,11 @@ underscore@^1.12.1:
|
|||
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.6.tgz#04786a1f589dc6c09f761fc5f45b89e935136441"
|
||||
integrity sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==
|
||||
|
||||
undici-types@~5.26.4:
|
||||
version "5.26.5"
|
||||
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
|
||||
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
|
||||
|
||||
universal-user-agent@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-6.0.0.tgz#3381f8503b251c0d9cd21bc1de939ec9df5480ee"
|
||||
|
|
Loading…
Reference in a new issue