Socket
Socket
Sign inDemoInstall

@vscode/test-web

Package Overview
Dependencies
Maintainers
7
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vscode/test-web - npm Package Compare versions

Comparing version 0.0.41 to 0.0.42

48

out/server/download.js

@@ -15,4 +15,2 @@ "use strict";

const url_1 = require("url");
const decompress = require("decompress");
const decompressTargz = require("decompress-targz");
async function getLatestVersion(quality) {

@@ -23,4 +21,9 @@ const update = await fetchJSON(`https://update.code.visualstudio.com/api/update/web-standalone/${quality}/latest`);

const reset = '\x1b[G\x1b[0K';
async function download(downloadUrl, destination, message) {
async function downloadAndUntar(downloadUrl, destination, message) {
process.stdout.write(message);
if (!(0, fs_1.existsSync)(destination)) {
await fs_1.promises.mkdir(destination, { recursive: true });
}
const tar = await Promise.resolve().then(() => require('tar-fs'));
const gunzip = await Promise.resolve().then(() => require('gunzip-maybe'));
return new Promise((resolve, reject) => {

@@ -32,5 +35,2 @@ const httpLibrary = downloadUrl.startsWith('https') ? https : http;

let timeout;
const outStream = (0, fs_1.createWriteStream)(destination);
outStream.on('close', () => resolve(destination));
outStream.on('error', reject);
res.on('data', chunk => {

@@ -51,22 +51,16 @@ if (!timeout) {

});
res.on('error', reject);
res.pipe(outStream);
const extract = res.pipe(gunzip()).pipe(tar.extract(destination, { strip: 1 }));
extract.on('finish', () => {
process.stdout.write(`Extracted to ${destination}\n`);
resolve();
});
extract.on('error', reject);
});
});
}
async function unzip(source, destination, message) {
process.stdout.write(message);
if (!(0, fs_1.existsSync)(destination)) {
await fs_1.promises.mkdir(destination, { recursive: true });
}
await decompress(source, destination, {
plugins: [
decompressTargz()
],
strip: 1
});
process.stdout.write(`${reset}${message}: complete\n`);
}
async function downloadAndUnzipVSCode(quality, vscodeTestDir) {
const info = await getLatestVersion(quality);
if (!info.url.endsWith('.tar.gz')) {
throw new Error(`Unexpected download URL: ${info.url}. Should end with .tar.gz`);
}
const folderName = `vscode-web-${quality}-${info.version}`;

@@ -82,6 +76,4 @@ const downloadedPath = path.resolve(vscodeTestDir, folderName);

const productName = `VS Code ${quality === 'stable' ? 'Stable' : 'Insiders'}`;
const tmpArchiveName = path.join(vscodeTestDir, `vscode-web-${quality}-${info.version}-tmp`);
try {
await download(info.url, tmpArchiveName, `Downloading ${productName}`);
await unzip(tmpArchiveName, downloadedPath, `Unpacking ${productName}`);
await downloadAndUntar(info.url, downloadedPath, `Downloading ${productName}`);
await fs_1.promises.writeFile(path.join(downloadedPath, 'version'), folderName);

@@ -93,10 +85,2 @@ }

}
finally {
try {
fs_1.promises.unlink(tmpArchiveName);
}
catch (e) {
// ignore
}
}
return { type: 'static', location: downloadedPath, quality, version: info.version };

@@ -103,0 +87,0 @@ }

{
"name": "@vscode/test-web",
"version": "0.0.41",
"version": "0.0.42",
"scripts": {

@@ -28,3 +28,3 @@ "install-extensions": "yarn --cwd=fs-provider && yarn --cwd=sample",

"@koa/cors": "^4.0.0",
"koa": "^2.14.1",
"koa": "^2.14.2",
"koa-morgan": "^1.0.1",

@@ -34,9 +34,9 @@ "koa-mount": "^4.0.0",

"minimist": "^1.2.8",
"playwright": "^1.32.2",
"playwright": "^1.32.3",
"vscode-uri": "^3.0.7",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.1",
"decompress": "^4.2.1",
"decompress-targz": "^4.1.1",
"get-stream": "6.0.1"
"get-stream": "6.0.1",
"tar-fs": "^2.1.1",
"gunzip-maybe": "^1.4.2"
},

@@ -51,8 +51,9 @@ "devDependencies": {

"@types/node": "16.x",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"@types/decompress": "^4.2.4",
"eslint": "^8.37.0",
"@types/gunzip-maybe": "^1.4.0",
"@types/tar-fs": "^2.0.1",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"eslint": "^8.38.0",
"eslint-plugin-header": "^3.1.1",
"typescript": "^5.0.3"
"typescript": "^5.0.4"
},

@@ -59,0 +60,0 @@ "license": "MIT",

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