Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vscode/test-electron

Package Overview
Dependencies
Maintainers
21
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vscode/test-electron - npm Package Compare versions

Comparing version 2.1.5 to 2.2.0

30

out/download.js

@@ -21,2 +21,3 @@ "use strict";

const vscodeStableReleasesAPI = `https://update.code.visualstudio.com/api/releases/stable`;
const vscodeInsiderCommitsAPI = (platform) => `https://update.code.visualstudio.com/api/commits/insider/${platform}`;
const DOWNLOAD_ATTEMPTS = 3;

@@ -30,5 +31,14 @@ async function fetchLatestStableVersion() {

}
async function isValidVersion(version) {
const validVersions = await request.getJSON(vscodeStableReleasesAPI);
return version === 'insiders' || validVersions.indexOf(version) !== -1;
async function isValidVersion(version, platform) {
if (version === 'insiders') {
return true;
}
const stableVersionNumbers = await request.getJSON(vscodeStableReleasesAPI);
if (stableVersionNumbers.includes(version)) {
return true;
}
const insiderCommits = await request.getJSON(vscodeInsiderCommitsAPI(platform));
if (insiderCommits.includes(version)) {
return true;
}
}

@@ -153,3 +163,3 @@ /**

if (!fs.existsSync(path.resolve(cachePath, `vscode-${platform}-${version}`))) {
if (!(await isValidVersion(version))) {
if (!(await isValidVersion(version, platform))) {
throw Error(`Invalid version ${version}`);

@@ -192,6 +202,10 @@ }

}
else {
else if (util_2.isStableVersionIdentifier(version)) {
reporter.report({ stage: progress_1.ProgressReportStage.FoundMatchingInstall, downloadedPath });
return Promise.resolve(util_2.downloadDirToExecutablePath(downloadedPath, platform));
}
else {
reporter.report({ stage: progress_1.ProgressReportStage.FoundMatchingInstall, downloadedPath });
return Promise.resolve(util_2.insidersDownloadDirToExecutablePath(downloadedPath, platform));
}
}

@@ -216,7 +230,7 @@ for (let i = 0;; i++) {

reporter.report({ stage: progress_1.ProgressReportStage.NewInstallComplete, downloadedPath });
if (version === 'insiders') {
return Promise.resolve(util_2.insidersDownloadDirToExecutablePath(downloadedPath, platform));
if (util_2.isStableVersionIdentifier(version)) {
return util_2.downloadDirToExecutablePath(downloadedPath, platform);
}
else {
return util_2.downloadDirToExecutablePath(downloadedPath, platform);
return util_2.insidersDownloadDirToExecutablePath(downloadedPath, platform);
}

@@ -223,0 +237,0 @@ }

@@ -6,2 +6,3 @@ /// <reference types="node" />

export declare let systemDefaultPlatform: DownloadPlatform;
export declare function isStableVersionIdentifier(version: string): boolean;
export declare function getVSCodeDownloadUrl(version: string, platform?: DownloadPlatform): string;

@@ -8,0 +9,0 @@ export declare function urlToOptions(url: string): https.RequestOptions;

@@ -7,3 +7,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveCliArgsFromVSCodeExecutablePath = exports.resolveCliPathFromVSCodeExecutablePath = exports.getLatestInsidersMetadata = exports.insidersDownloadDirMetadata = exports.insidersDownloadDirToExecutablePath = exports.downloadDirToExecutablePath = exports.urlToOptions = exports.getVSCodeDownloadUrl = exports.systemDefaultPlatform = void 0;
exports.resolveCliArgsFromVSCodeExecutablePath = exports.resolveCliPathFromVSCodeExecutablePath = exports.getLatestInsidersMetadata = exports.insidersDownloadDirMetadata = exports.insidersDownloadDirToExecutablePath = exports.downloadDirToExecutablePath = exports.urlToOptions = exports.getVSCodeDownloadUrl = exports.isStableVersionIdentifier = exports.systemDefaultPlatform = void 0;
const path = require("path");

@@ -36,2 +36,6 @@ const url_1 = require("url");

}
function isStableVersionIdentifier(version) {
return version === 'stable' || version.includes('.'); // stable or 1.2.3 version string
}
exports.isStableVersionIdentifier = isStableVersionIdentifier;
function getVSCodeDownloadUrl(version, platform = exports.systemDefaultPlatform) {

@@ -41,3 +45,8 @@ if (version === 'insiders') {

}
return `https://update.code.visualstudio.com/${version}/${platform}/stable`;
else if (isStableVersionIdentifier(version)) {
return `https://update.code.visualstudio.com/${version}/${platform}/stable`;
}
else { // insiders commit hash
return `https://update.code.visualstudio.com/commit:${version}/${platform}/insider`;
}
}

@@ -44,0 +53,0 @@ exports.getVSCodeDownloadUrl = getVSCodeDownloadUrl;

{
"name": "@vscode/test-electron",
"version": "2.1.5",
"version": "2.2.0",
"scripts": {

@@ -5,0 +5,0 @@ "compile": "tsc -p ./",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc