From e55dfe8dd080c3c72ee694a1c7c49dc62bd1b5db Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Thu, 23 Apr 2020 11:34:58 -0700 Subject: [PATCH] Clean up for new release --- README.md | 12 +++++++----- bin/install | 6 +++--- lib/shared.js | 8 ++++---- lib/shared.ts | 6 +++--- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 6142cc4..8ff3b90 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,18 @@ # vscode-extension-vscode -## ⚠️ Use @types/vscode and vscode-test instead ⚠️ +## ⚠️ Deprecated, use @types/vscode and vscode-test instead ⚠️ -The funcionality of `vscode` module has been splitted into `@types/vscode` and `vscode-test`. They have fewer dependencies, allow greater flexibility in writing tests and will continue to receive updates. Although `vscode` will continue to work, we suggest that you migrate to `@types/vscode` and `vscode-test`. +This is the source code for the NPM [`vscode` module](https://www.npmjs.com/package/vscode). + +The funcionality of `vscode` module has been splitted into `@types/vscode` and `vscode-test`. They have fewer dependencies, allow greater flexibility in writing tests and will continue to receive updates. Although `vscode` will continue to work, we suggest that you migrate to `@types/vscode` and `vscode-test`. This package will only receive security updates. [Release Notes](https://code.visualstudio.com/updates/v1_36#_splitting-vscode-package-into-typesvscode-and-vscodetest) | [Migration Guide](https://code.visualstudio.com/api/working-with-extensions/testing-extension#migrating-from-vscode) ---- +## Summary -The `vscode` NPM module provides VS Code extension authors tools to write extensions. It provides the `vscode.d.ts` node module (all accessible API for extensions) as well as commands for compiling and testing extensions. +~~The `vscode` NPM module provides VS Code extension authors tools to write extensions. It provides the `vscode.d.ts` node module (all accessible API for extensions) as well as commands for compiling and testing extensions.~~ -For more information around extension authoring for VS Code, please see http://code.visualstudio.com/docs/extensions/overview +~~For more information around extension authoring for VS Code, please see http://code.visualstudio.com/docs/extensions/overview~~ ## Changes diff --git a/bin/install b/bin/install index b529425..51044b5 100644 --- a/bin/install +++ b/bin/install @@ -21,7 +21,7 @@ console.log('Detected VS Code engine version: ' + engine); getURLMatchingEngine(engine, function (_, data) { console.log('Fetching vscode.d.ts from: ' + data.url); - shared.getContents(data.url, process.env.GITHUB_TOKEN, null, function (error, contents) { + shared.getUrlContents(data.url, process.env.GITHUB_TOKEN, null, function (error, contents) { if (error) { exitWithError(error); } @@ -66,7 +66,7 @@ function getURLMatchingEngine(engine, callback) { }); } - shared.getContents('https://update.code.visualstudio.com/api/releases/stable', null, { "X-API-Version": "2" }, function (error, tagsRaw) { + shared.getUrlContents('https://update.code.visualstudio.com/api/releases/stable', null, { "X-API-Version": "2" }, function (error, tagsRaw) { if (error) { exitWithError(error); } @@ -90,7 +90,7 @@ function getURLMatchingEngine(engine, callback) { // check if master is on the version specified if (!tag) { - return shared.getContents('https://raw.githubusercontent.com/Microsoft/vscode/master/package.json', process.env.GITHUB_TOKEN, null, function (error, packageJson) { + return shared.getUrlContents('https://raw.githubusercontent.com/Microsoft/vscode/master/package.json', process.env.GITHUB_TOKEN, null, function (error, packageJson) { if (error) { exitWithError(error); } diff --git a/lib/shared.js b/lib/shared.js index 64e35c8..7ccf5fd 100644 --- a/lib/shared.js +++ b/lib/shared.js @@ -16,8 +16,8 @@ if (process.env.npm_config_proxy) { if (process.env.npm_config_https_proxy) { HTTPS_PROXY_AGENT = new HttpsProxyAgent(process.env.npm_config_https_proxy); } -function getContents(url, token, headers, callback) { - var options = toRequestOptions(url, token, headers); +function getUrlContents(url, token, headers, callback) { + var options = toHttpRequestOptions(url, token, headers); https.get(options, function (res) { if (res && res.statusCode >= 400) { callback(new Error('Request returned status code: ' + res.statusCode)); @@ -33,8 +33,8 @@ function getContents(url, token, headers, callback) { callback(e); }); } -exports.getContents = getContents; -function toRequestOptions(url, token, headers) { +exports.getUrlContents = getUrlContents; +function toHttpRequestOptions(url, token, headers) { if (headers === void 0) { headers = { 'user-agent': 'nodejs' }; } var options = url_1.parse(url); if (PROXY_AGENT && options.protocol.startsWith('http:')) { diff --git a/lib/shared.ts b/lib/shared.ts index 4ea36bf..fc0926e 100644 --- a/lib/shared.ts +++ b/lib/shared.ts @@ -21,8 +21,8 @@ if (process.env.npm_config_https_proxy) { HTTPS_PROXY_AGENT = new HttpsProxyAgent(process.env.npm_config_https_proxy); } -export function getContents(url: string, token?: string, headers?: any, callback?: (err: Error, body?: any) => void) { - const options = toRequestOptions(url, token, headers); +export function getUrlContents(url: string, token?: string, headers?: any, callback?: (err: Error, body?: any) => void) { + const options = toHttpRequestOptions(url, token, headers); https.get(options, res => { if (res && res.statusCode >= 400) { @@ -43,7 +43,7 @@ export function getContents(url: string, token?: string, headers?: any, callback }); } -function toRequestOptions(url: string, token: string | null, headers = { 'user-agent': 'nodejs' }): https.RequestOptions { +function toHttpRequestOptions(url: string, token: string | null, headers = { 'user-agent': 'nodejs' }): https.RequestOptions { const options: https.RequestOptions = parseUrl(url); if (PROXY_AGENT && options.protocol.startsWith('http:')) { options.agent = PROXY_AGENT;