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

@puppeteer/browsers

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@puppeteer/browsers - npm Package Compare versions

Comparing version 2.4.0 to 2.4.1

10

lib/cjs/browser-data/browser-data.js

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.getVersionComparator = exports.resolveSystemExecutablePath = exports.createProfile = exports.resolveBuildId = exports.ChromeReleaseChannel = exports.BrowserPlatform = exports.Browser = exports.versionComparators = exports.executablePathByBrowser = exports.downloadPaths = exports.downloadUrls = void 0;
exports.ChromeReleaseChannel = exports.BrowserPlatform = exports.Browser = exports.versionComparators = exports.executablePathByBrowser = exports.downloadPaths = exports.downloadUrls = void 0;
exports.resolveBuildId = resolveBuildId;
exports.createProfile = createProfile;
exports.resolveSystemExecutablePath = resolveSystemExecutablePath;
exports.getVersionComparator = getVersionComparator;
const chromeHeadlessShell = __importStar(require("./chrome-headless-shell.js"));

@@ -193,3 +197,2 @@ const chrome = __importStar(require("./chrome.js"));

}
exports.resolveBuildId = resolveBuildId;
/**

@@ -207,3 +210,2 @@ * @public

}
exports.createProfile = createProfile;
/**

@@ -223,3 +225,2 @@ * @public

}
exports.resolveSystemExecutablePath = resolveSystemExecutablePath;
/**

@@ -234,3 +235,2 @@ * Returns a version comparator for the given browser that can be used to sort

}
exports.getVersionComparator = getVersionComparator;
//# sourceMappingURL=browser-data.js.map

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.compareVersions = exports.resolveBuildId = exports.relativeExecutablePath = exports.resolveDownloadPath = exports.resolveDownloadUrl = void 0;
exports.compareVersions = exports.resolveBuildId = void 0;
exports.resolveDownloadUrl = resolveDownloadUrl;
exports.resolveDownloadPath = resolveDownloadPath;
exports.relativeExecutablePath = relativeExecutablePath;
/**

@@ -32,3 +35,2 @@ * @license

}
exports.resolveDownloadUrl = resolveDownloadUrl;
function resolveDownloadPath(platform, buildId) {

@@ -41,3 +43,2 @@ return [

}
exports.resolveDownloadPath = resolveDownloadPath;
function relativeExecutablePath(platform, _buildId) {

@@ -55,3 +56,2 @@ switch (platform) {

}
exports.relativeExecutablePath = relativeExecutablePath;
var chrome_js_1 = require("./chrome.js");

@@ -58,0 +58,0 @@ Object.defineProperty(exports, "resolveBuildId", { enumerable: true, get: function () { return chrome_js_1.resolveBuildId; } });

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.compareVersions = exports.resolveSystemExecutablePath = exports.resolveBuildId = exports.getLastKnownGoodReleaseForBuild = exports.getLastKnownGoodReleaseForMilestone = exports.getLastKnownGoodReleaseForChannel = exports.relativeExecutablePath = exports.resolveDownloadPath = exports.resolveDownloadUrl = void 0;
exports.resolveDownloadUrl = resolveDownloadUrl;
exports.resolveDownloadPath = resolveDownloadPath;
exports.relativeExecutablePath = relativeExecutablePath;
exports.getLastKnownGoodReleaseForChannel = getLastKnownGoodReleaseForChannel;
exports.getLastKnownGoodReleaseForMilestone = getLastKnownGoodReleaseForMilestone;
exports.getLastKnownGoodReleaseForBuild = getLastKnownGoodReleaseForBuild;
exports.resolveBuildId = resolveBuildId;
exports.resolveSystemExecutablePath = resolveSystemExecutablePath;
exports.compareVersions = compareVersions;
const path_1 = __importDefault(require("path"));

@@ -34,7 +42,5 @@ const semver_1 = __importDefault(require("semver"));

}
exports.resolveDownloadUrl = resolveDownloadUrl;
function resolveDownloadPath(platform, buildId) {
return [buildId, folder(platform), `chrome-${folder(platform)}.zip`];
}
exports.resolveDownloadPath = resolveDownloadPath;
function relativeExecutablePath(platform, _buildId) {

@@ -52,3 +58,2 @@ switch (platform) {

}
exports.relativeExecutablePath = relativeExecutablePath;
async function getLastKnownGoodReleaseForChannel(channel) {

@@ -62,3 +67,2 @@ const data = (await (0, httpUtil_js_1.getJSON)(new URL('https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json')));

}
exports.getLastKnownGoodReleaseForChannel = getLastKnownGoodReleaseForChannel;
async function getLastKnownGoodReleaseForMilestone(milestone) {

@@ -68,3 +72,2 @@ const data = (await (0, httpUtil_js_1.getJSON)(new URL('https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone.json')));

}
exports.getLastKnownGoodReleaseForMilestone = getLastKnownGoodReleaseForMilestone;
async function getLastKnownGoodReleaseForBuild(

@@ -78,3 +81,2 @@ /**

}
exports.getLastKnownGoodReleaseForBuild = getLastKnownGoodReleaseForBuild;
async function resolveBuildId(channel) {

@@ -94,3 +96,2 @@ if (Object.values(types_js_1.ChromeReleaseChannel).includes(channel)) {

}
exports.resolveBuildId = resolveBuildId;
function resolveSystemExecutablePath(platform, channel) {

@@ -134,3 +135,2 @@ switch (platform) {

}
exports.resolveSystemExecutablePath = resolveSystemExecutablePath;
function compareVersions(a, b) {

@@ -153,3 +153,2 @@ if (!semver_1.default.valid(a)) {

}
exports.compareVersions = compareVersions;
//# sourceMappingURL=chrome.js.map

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.compareVersions = exports.resolveBuildId = exports.relativeExecutablePath = exports.resolveDownloadPath = exports.resolveDownloadUrl = void 0;
exports.compareVersions = exports.resolveBuildId = void 0;
exports.resolveDownloadUrl = resolveDownloadUrl;
exports.resolveDownloadPath = resolveDownloadPath;
exports.relativeExecutablePath = relativeExecutablePath;
/**

@@ -32,7 +35,5 @@ * @license

}
exports.resolveDownloadUrl = resolveDownloadUrl;
function resolveDownloadPath(platform, buildId) {
return [buildId, folder(platform), `chromedriver-${folder(platform)}.zip`];
}
exports.resolveDownloadPath = resolveDownloadPath;
function relativeExecutablePath(platform, _buildId) {

@@ -50,3 +51,2 @@ switch (platform) {

}
exports.relativeExecutablePath = relativeExecutablePath;
var chrome_js_1 = require("./chrome.js");

@@ -53,0 +53,0 @@ Object.defineProperty(exports, "resolveBuildId", { enumerable: true, get: function () { return chrome_js_1.resolveBuildId; } });

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.compareVersions = exports.resolveBuildId = exports.relativeExecutablePath = exports.resolveDownloadPath = exports.resolveDownloadUrl = void 0;
exports.resolveDownloadUrl = resolveDownloadUrl;
exports.resolveDownloadPath = resolveDownloadPath;
exports.relativeExecutablePath = relativeExecutablePath;
exports.resolveBuildId = resolveBuildId;
exports.compareVersions = compareVersions;
const path_1 = __importDefault(require("path"));

@@ -46,7 +50,5 @@ const httpUtil_js_1 = require("../httpUtil.js");

}
exports.resolveDownloadUrl = resolveDownloadUrl;
function resolveDownloadPath(platform, buildId) {
return [folder(platform), buildId, `${archive(platform, buildId)}.zip`];
}
exports.resolveDownloadPath = resolveDownloadPath;
function relativeExecutablePath(platform, _buildId) {

@@ -64,11 +66,8 @@ switch (platform) {

}
exports.relativeExecutablePath = relativeExecutablePath;
async function resolveBuildId(platform) {
return await (0, httpUtil_js_1.getText)(new URL(`https://storage.googleapis.com/chromium-browser-snapshots/${folder(platform)}/LAST_CHANGE`));
}
exports.resolveBuildId = resolveBuildId;
function compareVersions(a, b) {
return Number(a) - Number(b);
}
exports.compareVersions = compareVersions;
//# sourceMappingURL=chromium.js.map

@@ -11,3 +11,9 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.compareVersions = exports.createProfile = exports.resolveBuildId = exports.FirefoxChannel = exports.relativeExecutablePath = exports.resolveDownloadPath = exports.resolveDownloadUrl = void 0;
exports.FirefoxChannel = void 0;
exports.resolveDownloadUrl = resolveDownloadUrl;
exports.resolveDownloadPath = resolveDownloadPath;
exports.relativeExecutablePath = relativeExecutablePath;
exports.resolveBuildId = resolveBuildId;
exports.createProfile = createProfile;
exports.compareVersions = compareVersions;
const fs_1 = __importDefault(require("fs"));

@@ -81,3 +87,2 @@ const path_1 = __importDefault(require("path"));

}
exports.resolveDownloadUrl = resolveDownloadUrl;
function resolveDownloadPath(platform, buildId) {

@@ -100,3 +105,2 @@ const [channel, resolvedBuildId] = parseBuildId(buildId);

}
exports.resolveDownloadPath = resolveDownloadPath;
function relativeExecutablePath(platform, buildId) {

@@ -132,3 +136,2 @@ const [channel] = parseBuildId(buildId);

}
exports.relativeExecutablePath = relativeExecutablePath;
var FirefoxChannel;

@@ -157,3 +160,2 @@ (function (FirefoxChannel) {

}
exports.resolveBuildId = resolveBuildId;
async function createProfile(options) {

@@ -173,3 +175,2 @@ if (!fs_1.default.existsSync(options.path)) {

}
exports.createProfile = createProfile;
function defaultProfilePreferences(extraPrefs) {

@@ -370,3 +371,2 @@ const server = 'dummy.test';

}
exports.compareVersions = compareVersions;
//# sourceMappingURL=firefox.js.map

@@ -6,3 +6,2 @@ /**

*/
/// <reference types="node" />
import * as readline from 'readline';

@@ -9,0 +8,0 @@ import { type Browser } from './browser-data/browser-data.js';

@@ -34,8 +34,9 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.makeProgressCallback = exports.CLI = void 0;
exports.CLI = void 0;
exports.makeProgressCallback = makeProgressCallback;
const process_1 = require("process");
const readline = __importStar(require("readline"));
const progress_1 = __importDefault(require("progress"));
const yargs_1 = __importDefault(require("yargs"));
const helpers_1 = require("yargs/helpers");
const yargs_1 = __importDefault(require("yargs/yargs"));
const browser_data_js_1 = require("./browser-data/browser-data.js");

@@ -324,3 +325,2 @@ const Cache_js_1 = require("./Cache.js");

}
exports.makeProgressCallback = makeProgressCallback;
function toMegabytes(bytes) {

@@ -327,0 +327,0 @@ const mb = bytes / 1000 / 1000;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.detectBrowserPlatform = void 0;
exports.detectBrowserPlatform = detectBrowserPlatform;
const os_1 = __importDefault(require("os"));

@@ -37,3 +37,2 @@ const browser_data_js_1 = require("./browser-data/browser-data.js");

}
exports.detectBrowserPlatform = detectBrowserPlatform;
/**

@@ -40,0 +39,0 @@ * Windows 11 is identified by the version 10.0.22000 or greater

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.unpackArchive = void 0;
exports.unpackArchive = unpackArchive;
const child_process_1 = require("child_process");

@@ -72,3 +72,2 @@ const fs_1 = require("fs");

}
exports.unpackArchive = unpackArchive;
/**

@@ -75,0 +74,0 @@ * @internal

@@ -6,4 +6,2 @@ /**

*/
/// <reference types="node" />
/// <reference types="node" />
import * as http from 'http';

@@ -10,0 +8,0 @@ import { URL } from 'url';

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.getText = exports.getJSON = exports.downloadFile = exports.httpRequest = exports.headHttpRequest = void 0;
exports.headHttpRequest = headHttpRequest;
exports.httpRequest = httpRequest;
exports.downloadFile = downloadFile;
exports.getJSON = getJSON;
exports.getText = getText;
const fs_1 = require("fs");

@@ -50,3 +54,2 @@ const http = __importStar(require("http"));

}
exports.headHttpRequest = headHttpRequest;
function httpRequest(url, method, response, keepAlive = true) {

@@ -83,3 +86,2 @@ const options = {

}
exports.httpRequest = httpRequest;
/**

@@ -122,3 +124,2 @@ * @internal

}
exports.downloadFile = downloadFile;
async function getJSON(url) {

@@ -133,3 +134,2 @@ const text = await getText(url);

}
exports.getJSON = getJSON;
function getText(url) {

@@ -159,3 +159,2 @@ return new Promise((resolve, reject) => {

}
exports.getText = getText;
//# sourceMappingURL=httpUtil.js.map

@@ -11,3 +11,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.canDownload = exports.getInstalledBrowsers = exports.uninstall = exports.install = void 0;
exports.install = install;
exports.uninstall = uninstall;
exports.getInstalledBrowsers = getInstalledBrowsers;
exports.canDownload = canDownload;
const assert_1 = __importDefault(require("assert"));

@@ -93,3 +96,2 @@ const child_process_1 = require("child_process");

}
exports.install = install;
async function installDeps(installedBrowser) {

@@ -231,3 +233,2 @@ if (process.platform !== 'linux' ||

}
exports.uninstall = uninstall;
/**

@@ -241,3 +242,2 @@ * Returns metadata about browsers installed in the cache directory.

}
exports.getInstalledBrowsers = getInstalledBrowsers;
/**

@@ -253,3 +253,2 @@ * @public

}
exports.canDownload = canDownload;
function getDownloadUrl(browser, platform, buildId, baseUrl) {

@@ -256,0 +255,0 @@ return new URL(browser_data_js_1.downloadUrls[browser](platform, buildId, baseUrl));

@@ -6,4 +6,2 @@ /**

*/
/// <reference types="node" />
/// <reference types="node" />
import childProcess from 'child_process';

@@ -10,0 +8,0 @@ import { type Browser, type BrowserPlatform, type ChromeReleaseChannel } from './browser-data/browser-data.js';

@@ -11,3 +11,8 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.TimeoutError = exports.isErrnoException = exports.isErrorLike = exports.Process = exports.WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = exports.CDP_WEBSOCKET_ENDPOINT_REGEX = exports.launch = exports.computeSystemExecutablePath = exports.computeExecutablePath = void 0;
exports.TimeoutError = exports.Process = exports.WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = exports.CDP_WEBSOCKET_ENDPOINT_REGEX = void 0;
exports.computeExecutablePath = computeExecutablePath;
exports.computeSystemExecutablePath = computeSystemExecutablePath;
exports.launch = launch;
exports.isErrorLike = isErrorLike;
exports.isErrnoException = isErrnoException;
const child_process_1 = __importDefault(require("child_process"));

@@ -28,3 +33,2 @@ const fs_1 = require("fs");

}
exports.computeExecutablePath = computeExecutablePath;
/**

@@ -42,3 +46,3 @@ * @public

}
catch (error) {
catch {
throw new Error(`Could not find Google Chrome executable for channel '${options.channel}' at '${path}'.`);

@@ -48,3 +52,2 @@ }

}
exports.computeSystemExecutablePath = computeSystemExecutablePath;
/**

@@ -58,3 +61,2 @@ * Launches a browser process according to {@link LaunchOptions}.

}
exports.launch = launch;
/**

@@ -369,3 +371,2 @@ * @public

}
exports.isErrorLike = isErrorLike;
/**

@@ -378,3 +379,2 @@ * @internal

}
exports.isErrnoException = isErrnoException;
/**

@@ -381,0 +381,0 @@ * @public

@@ -6,3 +6,2 @@ /**

*/
/// <reference types="node" />
import * as readline from 'readline';

@@ -9,0 +8,0 @@ import { type Browser } from './browser-data/browser-data.js';

@@ -9,4 +9,4 @@ /**

import ProgressBar from 'progress';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import yargs from 'yargs/yargs';
import { resolveBuildId, BrowserPlatform, } from './browser-data/browser-data.js';

@@ -13,0 +13,0 @@ import { Cache } from './Cache.js';

@@ -6,4 +6,2 @@ /**

*/
/// <reference types="node" />
/// <reference types="node" />
import * as http from 'http';

@@ -10,0 +8,0 @@ import { URL } from 'url';

@@ -6,4 +6,2 @@ /**

*/
/// <reference types="node" />
/// <reference types="node" />
import childProcess from 'child_process';

@@ -10,0 +8,0 @@ import { type Browser, type BrowserPlatform, type ChromeReleaseChannel } from './browser-data/browser-data.js';

@@ -33,3 +33,3 @@ /**

}
catch (error) {
catch {
throw new Error(`Could not find Google Chrome executable for channel '${options.channel}' at '${path}'.`);

@@ -36,0 +36,0 @@ }

{
"name": "@puppeteer/browsers",
"version": "2.4.0",
"version": "2.4.1",
"description": "Download and launch browsers",

@@ -98,3 +98,3 @@ "scripts": {

"dependencies": {
"debug": "^4.3.6",
"debug": "^4.3.7",
"extract-zip": "^2.0.1",

@@ -101,0 +101,0 @@ "progress": "^2.0.3",

@@ -62,3 +62,3 @@ /**

platform: BrowserPlatform,
tag: BrowserTag
tag: BrowserTag,
): Promise<string> {

@@ -76,3 +76,3 @@ switch (browser) {

return await firefox.resolveBuildId(
firefox.FirefoxChannel.DEVEDITION
firefox.FirefoxChannel.DEVEDITION,
);

@@ -120,3 +120,3 @@ case BrowserTag.STABLE:

throw new Error(
`${tag.toUpperCase()} is not available for ChromeDriver`
`${tag.toUpperCase()} is not available for ChromeDriver`,
);

@@ -130,15 +130,15 @@ }

return await chromeHeadlessShell.resolveBuildId(
ChromeReleaseChannel.CANARY
ChromeReleaseChannel.CANARY,
);
case BrowserTag.BETA:
return await chromeHeadlessShell.resolveBuildId(
ChromeReleaseChannel.BETA
ChromeReleaseChannel.BETA,
);
case BrowserTag.DEV:
return await chromeHeadlessShell.resolveBuildId(
ChromeReleaseChannel.DEV
ChromeReleaseChannel.DEV,
);
case BrowserTag.STABLE:
return await chromeHeadlessShell.resolveBuildId(
ChromeReleaseChannel.STABLE
ChromeReleaseChannel.STABLE,
);

@@ -163,3 +163,3 @@ case BrowserTag.NIGHTLY:

throw new Error(
`${tag} is not supported for Chromium. Use 'latest' instead.`
`${tag} is not supported for Chromium. Use 'latest' instead.`,
);

@@ -176,3 +176,3 @@ }

platform: BrowserPlatform,
tag: string
tag: string,
): Promise<string> {

@@ -216,3 +216,3 @@ const browserTag = tag as BrowserTag;

browser: Browser,
opts: ProfileOptions
opts: ProfileOptions,
): Promise<void> {

@@ -234,3 +234,3 @@ switch (browser) {

platform: BrowserPlatform,
channel: ChromeReleaseChannel
channel: ChromeReleaseChannel,
): string {

@@ -243,3 +243,3 @@ switch (browser) {

throw new Error(
`System browser detection is not supported for ${browser} yet.`
`System browser detection is not supported for ${browser} yet.`,
);

@@ -258,5 +258,5 @@ case Browser.CHROME:

export function getVersionComparator(
browser: Browser
browser: Browser,
): (a: string, b: string) => number {
return versionComparators[browser];
}

@@ -28,3 +28,3 @@ /**

buildId: string,
baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public'
baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public',
): string {

@@ -36,3 +36,3 @@ return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;

platform: BrowserPlatform,
buildId: string
buildId: string,
): string[] {

@@ -48,3 +48,3 @@ return [

platform: BrowserPlatform,
_buildId: string
_buildId: string,
): string {

@@ -56,3 +56,3 @@ switch (platform) {

'chrome-headless-shell-' + folder(platform),
'chrome-headless-shell'
'chrome-headless-shell',
);

@@ -62,3 +62,3 @@ case BrowserPlatform.LINUX:

'chrome-headless-shell-linux64',
'chrome-headless-shell'
'chrome-headless-shell',
);

@@ -69,3 +69,3 @@ case BrowserPlatform.WIN32:

'chrome-headless-shell-' + folder(platform),
'chrome-headless-shell.exe'
'chrome-headless-shell.exe',
);

@@ -72,0 +72,0 @@ }

@@ -33,3 +33,3 @@ /**

buildId: string,
baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public'
baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public',
): string {

@@ -41,3 +41,3 @@ return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;

platform: BrowserPlatform,
buildId: string
buildId: string,
): string[] {

@@ -49,3 +49,3 @@ return [buildId, folder(platform), `chrome-${folder(platform)}.zip`];

platform: BrowserPlatform,
_buildId: string
_buildId: string,
): string {

@@ -60,3 +60,3 @@ switch (platform) {

'MacOS',
'Google Chrome for Testing'
'Google Chrome for Testing',
);

@@ -72,8 +72,8 @@ case BrowserPlatform.LINUX:

export async function getLastKnownGoodReleaseForChannel(
channel: ChromeReleaseChannel
channel: ChromeReleaseChannel,
): Promise<{version: string; revision: string}> {
const data = (await getJSON(
new URL(
'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json'
)
'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json',
),
)) as {

@@ -98,8 +98,8 @@ channels: Record<string, {version: string}>;

export async function getLastKnownGoodReleaseForMilestone(
milestone: string
milestone: string,
): Promise<{version: string; revision: string} | undefined> {
const data = (await getJSON(
new URL(
'https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone.json'
)
'https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone.json',
),
)) as {

@@ -117,8 +117,8 @@ milestones: Record<string, {version: string; revision: string}>;

*/
buildPrefix: string
buildPrefix: string,
): Promise<{version: string; revision: string} | undefined> {
const data = (await getJSON(
new URL(
'https://googlechromelabs.github.io/chrome-for-testing/latest-patch-versions-per-build.json'
)
'https://googlechromelabs.github.io/chrome-for-testing/latest-patch-versions-per-build.json',
),
)) as {

@@ -133,13 +133,13 @@ builds: Record<string, {version: string; revision: string}>;

export async function resolveBuildId(
channel: ChromeReleaseChannel
channel: ChromeReleaseChannel,
): Promise<string>;
export async function resolveBuildId(
channel: string
channel: string,
): Promise<string | undefined>;
export async function resolveBuildId(
channel: ChromeReleaseChannel | string
channel: ChromeReleaseChannel | string,
): Promise<string | undefined> {
if (
Object.values(ChromeReleaseChannel).includes(
channel as ChromeReleaseChannel
channel as ChromeReleaseChannel,
)

@@ -164,3 +164,3 @@ ) {

platform: BrowserPlatform,
channel: ChromeReleaseChannel
channel: ChromeReleaseChannel,
): string {

@@ -204,3 +204,3 @@ switch (platform) {

throw new Error(
`Unable to detect browser executable path for '${channel}' on ${platform}.`
`Unable to detect browser executable path for '${channel}' on ${platform}.`,
);

@@ -207,0 +207,0 @@ }

@@ -28,3 +28,3 @@ /**

buildId: string,
baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public'
baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public',
): string {

@@ -36,3 +36,3 @@ return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;

platform: BrowserPlatform,
buildId: string
buildId: string,
): string[] {

@@ -44,3 +44,3 @@ return [buildId, folder(platform), `chromedriver-${folder(platform)}.zip`];

platform: BrowserPlatform,
_buildId: string
_buildId: string,
): string {

@@ -47,0 +47,0 @@ switch (platform) {

@@ -45,3 +45,3 @@ /**

buildId: string,
baseUrl = 'https://storage.googleapis.com/chromium-browser-snapshots'
baseUrl = 'https://storage.googleapis.com/chromium-browser-snapshots',
): string {

@@ -53,3 +53,3 @@ return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;

platform: BrowserPlatform,
buildId: string
buildId: string,
): string[] {

@@ -61,3 +61,3 @@ return [folder(platform), buildId, `${archive(platform, buildId)}.zip`];

platform: BrowserPlatform,
_buildId: string
_buildId: string,
): string {

@@ -72,3 +72,3 @@ switch (platform) {

'MacOS',
'Chromium'
'Chromium',
);

@@ -83,3 +83,3 @@ case BrowserPlatform.LINUX:

export async function resolveBuildId(
platform: BrowserPlatform
platform: BrowserPlatform,
): Promise<string> {

@@ -89,5 +89,5 @@ return await getText(

`https://storage.googleapis.com/chromium-browser-snapshots/${folder(
platform
)}/LAST_CHANGE`
)
platform,
)}/LAST_CHANGE`,
),
);

@@ -94,0 +94,0 @@ }

@@ -67,3 +67,3 @@ /**

buildId: string,
baseUrl?: string
baseUrl?: string,
): string {

@@ -90,3 +90,3 @@ const [channel] = parseBuildId(buildId);

platform: BrowserPlatform,
buildId: string
buildId: string,
): string[] {

@@ -112,3 +112,3 @@ const [channel, resolvedBuildId] = parseBuildId(buildId);

platform: BrowserPlatform,
buildId: string
buildId: string,
): string {

@@ -125,3 +125,3 @@ const [channel] = parseBuildId(buildId);

'MacOS',
'firefox'
'firefox',
);

@@ -160,3 +160,3 @@ case BrowserPlatform.LINUX:

export async function resolveBuildId(
channel: FirefoxChannel = FirefoxChannel.NIGHTLY
channel: FirefoxChannel = FirefoxChannel.NIGHTLY,
): Promise<string> {

@@ -171,3 +171,3 @@ const channelToVersionKey = {

const versions = (await getJSON(
new URL('https://product-details.mozilla.org/1.0/firefox_versions.json')
new URL('https://product-details.mozilla.org/1.0/firefox_versions.json'),
)) as Record<string, string>;

@@ -197,3 +197,3 @@ const version = versions[channelToVersionKey[channel]];

function defaultProfilePreferences(
extraPrefs: Record<string, unknown>
extraPrefs: Record<string, unknown>,
): Record<string, unknown> {

@@ -200,0 +200,0 @@ const server = 'dummy.test';

@@ -41,3 +41,3 @@ /**

buildId: string,
platform: BrowserPlatform
platform: BrowserPlatform,
) {

@@ -63,3 +63,3 @@ this.#cache = cache;

this.platform,
this.buildId
this.buildId,
);

@@ -171,3 +171,3 @@ }

platform: BrowserPlatform,
buildId: string
buildId: string,
): string {

@@ -189,3 +189,3 @@ return path.join(this.browserRoot(browser), `${platform}-${buildId}`);

platform: BrowserPlatform,
buildId: string
buildId: string,
): void {

@@ -219,3 +219,3 @@ const metadata = this.readMetadata(browser);

const result = parseFolderPath(
path.join(this.browserRoot(browser), file)
path.join(this.browserRoot(browser), file),
);

@@ -229,3 +229,3 @@ if (!result) {

result.buildId,
result.platform as BrowserPlatform
result.platform as BrowserPlatform,
);

@@ -243,3 +243,3 @@ })

throw new Error(
`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`
`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`,
);

@@ -256,3 +256,3 @@ }

options.platform,
options.buildId
options.buildId,
);

@@ -263,4 +263,4 @@ return path.join(

options.platform,
options.buildId
)
options.buildId,
),
);

@@ -271,3 +271,3 @@ }

function parseFolderPath(
folderPath: string
folderPath: string,
): {platform: string; buildId: string} | undefined {

@@ -274,0 +274,0 @@ const name = path.basename(folderPath);

@@ -12,4 +12,4 @@ /**

import type * as Yargs from 'yargs';
import yargs from 'yargs';
import {hideBin} from 'yargs/helpers';
import yargs from 'yargs/yargs';

@@ -89,3 +89,3 @@ import {

},
rl?: readline.Interface
rl?: readline.Interface,
) {

@@ -155,3 +155,3 @@ if (!opts) {

return this.#build(yargs);
}
},
);

@@ -194,87 +194,87 @@ } else {

'$0 install chrome',
`Install the ${latestOrPinned} available build of the Chrome browser.`
`Install the ${latestOrPinned} available build of the Chrome browser.`,
);
yargs.example(
'$0 install chrome@latest',
'Install the latest available build for the Chrome browser.'
'Install the latest available build for the Chrome browser.',
);
yargs.example(
'$0 install chrome@stable',
'Install the latest available build for the Chrome browser from the stable channel.'
'Install the latest available build for the Chrome browser from the stable channel.',
);
yargs.example(
'$0 install chrome@beta',
'Install the latest available build for the Chrome browser from the beta channel.'
'Install the latest available build for the Chrome browser from the beta channel.',
);
yargs.example(
'$0 install chrome@dev',
'Install the latest available build for the Chrome browser from the dev channel.'
'Install the latest available build for the Chrome browser from the dev channel.',
);
yargs.example(
'$0 install chrome@canary',
'Install the latest available build for the Chrome Canary browser.'
'Install the latest available build for the Chrome Canary browser.',
);
yargs.example(
'$0 install chrome@115',
'Install the latest available build for Chrome 115.'
'Install the latest available build for Chrome 115.',
);
yargs.example(
'$0 install chromedriver@canary',
'Install the latest available build for ChromeDriver Canary.'
'Install the latest available build for ChromeDriver Canary.',
);
yargs.example(
'$0 install chromedriver@115',
'Install the latest available build for ChromeDriver 115.'
'Install the latest available build for ChromeDriver 115.',
);
yargs.example(
'$0 install chromedriver@115.0.5790',
'Install the latest available patch (115.0.5790.X) build for ChromeDriver.'
'Install the latest available patch (115.0.5790.X) build for ChromeDriver.',
);
yargs.example(
'$0 install chrome-headless-shell',
'Install the latest available chrome-headless-shell build.'
'Install the latest available chrome-headless-shell build.',
);
yargs.example(
'$0 install chrome-headless-shell@beta',
'Install the latest available chrome-headless-shell build corresponding to the Beta channel.'
'Install the latest available chrome-headless-shell build corresponding to the Beta channel.',
);
yargs.example(
'$0 install chrome-headless-shell@118',
'Install the latest available chrome-headless-shell 118 build.'
'Install the latest available chrome-headless-shell 118 build.',
);
yargs.example(
'$0 install chromium@1083080',
'Install the revision 1083080 of the Chromium browser.'
'Install the revision 1083080 of the Chromium browser.',
);
yargs.example(
'$0 install firefox',
'Install the latest nightly available build of the Firefox browser.'
'Install the latest nightly available build of the Firefox browser.',
);
yargs.example(
'$0 install firefox@stable',
'Install the latest stable build of the Firefox browser.'
'Install the latest stable build of the Firefox browser.',
);
yargs.example(
'$0 install firefox@beta',
'Install the latest beta build of the Firefox browser.'
'Install the latest beta build of the Firefox browser.',
);
yargs.example(
'$0 install firefox@devedition',
'Install the latest devedition build of the Firefox browser.'
'Install the latest devedition build of the Firefox browser.',
);
yargs.example(
'$0 install firefox@esr',
'Install the latest ESR build of the Firefox browser.'
'Install the latest ESR build of the Firefox browser.',
);
yargs.example(
'$0 install firefox@nightly',
'Install the latest nightly build of the Firefox browser.'
'Install the latest nightly build of the Firefox browser.',
);
yargs.example(
'$0 install firefox@stable_111.0.1',
'Install a specific version of the Firefox browser.'
'Install a specific version of the Firefox browser.',
);
yargs.example(
'$0 install firefox --platform mac',
'Install the latest Mac (Intel) build of the Firefox browser.'
'Install the latest Mac (Intel) build of the Firefox browser.',
);

@@ -284,3 +284,3 @@ if (this.#allowCachePathOverride) {

'$0 install firefox --path /tmp/my-browser-cache',
'Install to the specified cache directory.'
'Install to the specified cache directory.',
);

@@ -308,4 +308,4 @@ }

});
}
)
},
),
);

@@ -321,3 +321,3 @@

}
}
},
)

@@ -343,15 +343,15 @@ .command(

'$0 launch chrome@115.0.5790.170',
'Launch Chrome 115.0.5790.170'
'Launch Chrome 115.0.5790.170',
);
yargs.example(
'$0 launch firefox@112.0a1',
'Launch the Firefox browser identified by the milestone 112.0a1.'
'Launch the Firefox browser identified by the milestone 112.0a1.',
);
yargs.example(
'$0 launch chrome@115.0.5790.170 --detached',
'Launch the browser but detach the sub-processes.'
'Launch the browser but detach the sub-processes.',
);
yargs.example(
'$0 launch chrome@canary --system',
'Try to locate the Canary build of Chrome installed on the system and launch it.'
'Try to locate the Canary build of Chrome installed on the system and launch it.',
);

@@ -378,3 +378,3 @@ },

});
}
},
)

@@ -404,5 +404,5 @@ .command(

console.log(`${cacheDir} cleared.`);
}
},
);
}
},
)

@@ -445,3 +445,3 @@ .demandCommand(1)

args.platform,
args.browser.buildId
args.browser.buildId,
);

@@ -455,3 +455,3 @@ await install({

args.browser.name,
args.browser.buildId
args.browser.buildId,
),

@@ -469,3 +469,3 @@ baseUrl: args.baseUrl,

platform: args.platform,
})}`
})}`,
);

@@ -480,3 +480,3 @@ }

browser: Browser,
buildId: string
buildId: string,
): (downloadedBytes: number, totalBytes: number) => void {

@@ -489,3 +489,3 @@ let progressBar: ProgressBar;

`Downloading ${browser} ${buildId} - ${toMegabytes(
totalBytes
totalBytes,
)} [:bar] :percent :etas `,

@@ -497,3 +497,3 @@ {

total: totalBytes,
}
},
);

@@ -500,0 +500,0 @@ }

@@ -21,3 +21,3 @@ /**

archivePath: string,
folderPath: string
folderPath: string,
): Promise<void> {

@@ -40,3 +40,3 @@ if (archivePath.endsWith('.zip')) {

throw new Error(
`Failed to extract ${archivePath} to ${folderPath}: ${result.output}`
`Failed to extract ${archivePath} to ${folderPath}: ${result.output}`,
);

@@ -43,0 +43,0 @@ }

@@ -24,3 +24,3 @@ /**

},
false
false,
);

@@ -37,3 +37,3 @@ request.on('error', () => {

response: (x: http.IncomingMessage) => void,
keepAlive = true
keepAlive = true,
): http.ClientRequest {

@@ -80,3 +80,3 @@ const options: http.RequestOptions = {

destinationPath: string,
progressCallback?: (downloadedBytes: number, totalBytes: number) => void
progressCallback?: (downloadedBytes: number, totalBytes: number) => void,
): Promise<void> {

@@ -95,3 +95,3 @@ return new Promise<void>((resolve, reject) => {

const error = new Error(
`Download failed: server returned code ${response.statusCode}. URL: ${url}`
`Download failed: server returned code ${response.statusCode}. URL: ${url}`,
);

@@ -152,3 +152,3 @@ // consume response data to free up memory

},
false
false,
);

@@ -155,0 +155,0 @@ request.on('error', err => {

@@ -78,3 +78,3 @@ /**

downloadedBytes: number,
totalBytes: number
totalBytes: number,
) => void;

@@ -124,3 +124,3 @@ /**

export function install(
options: InstallOptions & {unpack?: true}
options: InstallOptions & {unpack?: true},
): Promise<InstalledBrowser>;

@@ -136,6 +136,6 @@ /**

export function install(
options: InstallOptions & {unpack: false}
options: InstallOptions & {unpack: false},
): Promise<string>;
export async function install(
options: InstallOptions
options: InstallOptions,
): Promise<InstalledBrowser | string> {

@@ -146,3 +146,3 @@ options.platform ??= detectBrowserPlatform();

throw new Error(
`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`
`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`,
);

@@ -154,3 +154,3 @@ }

options.buildId,
options.baseUrl
options.baseUrl,
);

@@ -170,3 +170,3 @@ try {

debugInstall(
`Trying to find download URL via https://googlechromelabs.github.io/chrome-for-testing.`
`Trying to find download URL via https://googlechromelabs.github.io/chrome-for-testing.`,
);

@@ -178,4 +178,4 @@ interface Version {

new URL(
`https://googlechromelabs.github.io/chrome-for-testing/${options.buildId}.json`
)
`https://googlechromelabs.github.io/chrome-for-testing/${options.buildId}.json`,
),
)) as Version;

@@ -225,3 +225,3 @@ let platform = '';

path.dirname(installedBrowser.executablePath),
'deb.deps'
'deb.deps',
);

@@ -239,3 +239,3 @@ if (!existsSync(depsPath)) {

throw new Error(
'Failed to install system dependencies: apt-get does not seem to be available'
'Failed to install system dependencies: apt-get does not seem to be available',
);

@@ -252,3 +252,3 @@ }

throw new Error(
`Failed to install system dependencies: status=${result.status},error=${result.error},stdout=${result.stdout.toString('utf8')},stderr=${result.stderr.toString('utf8')}`
`Failed to install system dependencies: status=${result.status},error=${result.error},stdout=${result.stdout.toString('utf8')},stderr=${result.stderr.toString('utf8')}`,
);

@@ -261,3 +261,3 @@ }

url: URL,
options: InstallOptions
options: InstallOptions,
): Promise<InstalledBrowser | string> {

@@ -267,3 +267,3 @@ options.platform ??= detectBrowserPlatform();

throw new Error(
`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`
`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`,
);

@@ -294,3 +294,3 @@ }

options.platform,
options.buildId
options.buildId,
);

@@ -304,7 +304,7 @@

options.buildId,
options.platform
options.platform,
);
if (!existsSync(installedBrowser.executablePath)) {
throw new Error(
`The browser folder (${outputPath}) exists but the executable (${installedBrowser.executablePath}) is missing`
`The browser folder (${outputPath}) exists but the executable (${installedBrowser.executablePath}) is missing`,
);

@@ -338,3 +338,3 @@ }

options.buildId,
options.platform
options.platform,
);

@@ -379,3 +379,3 @@ if (options.buildIdAlias) {

shell: true,
}
},
);

@@ -422,3 +422,3 @@ // TODO: Handle error here. Currently the setup.exe sometimes

throw new Error(
`Cannot detect the browser platform for: ${os.platform()} (${os.arch()})`
`Cannot detect the browser platform for: ${os.platform()} (${os.arch()})`,
);

@@ -430,3 +430,3 @@ }

options.platform,
options.buildId
options.buildId,
);

@@ -451,3 +451,3 @@ }

export async function getInstalledBrowsers(
options: GetInstalledBrowsersOptions
options: GetInstalledBrowsersOptions,
): Promise<InstalledBrowser[]> {

@@ -464,3 +464,3 @@ return new Cache(options.cacheDir).getInstalledBrowsers();

throw new Error(
`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`
`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`,
);

@@ -473,4 +473,4 @@ }

options.buildId,
options.baseUrl
)
options.baseUrl,
),
);

@@ -483,5 +483,5 @@ }

buildId: string,
baseUrl?: string
baseUrl?: string,
): URL {
return new URL(downloadUrls[browser](platform, buildId, baseUrl));
}

@@ -53,3 +53,3 @@ /**

export function computeExecutablePath(
options: ComputeExecutablePathOptions
options: ComputeExecutablePathOptions,
): string {

@@ -86,3 +86,3 @@ return new Cache(options.cacheDir).computeExecutablePath(options);

throw new Error(
`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`
`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`,
);

@@ -93,9 +93,9 @@ }

options.platform,
options.channel
options.channel,
);
try {
accessSync(path);
} catch (error) {
} catch {
throw new Error(
`Could not find Google Chrome executable for channel '${options.channel}' at '${path}'.`
`Could not find Google Chrome executable for channel '${options.channel}' at '${path}'.`,
);

@@ -218,3 +218,3 @@ }

event: 'exit' | 'SIGINT' | 'SIGHUP' | 'SIGTERM',
handler: EventHandler
handler: EventHandler,
): void {

@@ -231,3 +231,3 @@ const listeners = processListeners.get(event) || [];

event: 'exit' | 'SIGINT' | 'SIGHUP' | 'SIGTERM',
handler: EventHandler
handler: EventHandler,
): void {

@@ -292,3 +292,3 @@ const listeners = processListeners.get(event) || [];

},
{}
{},
),

@@ -305,3 +305,3 @@ stdio,

stdio,
}
},
);

@@ -424,3 +424,3 @@

childProcess.execSync(
`taskkill /pid ${this.#browserProcess.pid} /T /F`
`taskkill /pid ${this.#browserProcess.pid} /T /F`,
);

@@ -430,3 +430,3 @@ } catch (error) {

`Killing ${this.#browserProcess.pid} using taskkill failed`,
error
error,
);

@@ -448,3 +448,3 @@ // taskkill can fail to kill the process e.g. due to missing permissions.

`Killing ${this.#browserProcess.pid} using process.kill failed`,
error
error,
);

@@ -461,3 +461,3 @@ // Killing the process group can fail due e.g. to missing permissions.

isErrorLike(error) ? error.stack : error
}`
}`,
);

@@ -506,4 +506,4 @@ }

'',
].join('\n')
)
].join('\n'),
),
);

@@ -516,4 +516,4 @@ }

new TimeoutError(
`Timed out after ${timeout} ms while waiting for the WS endpoint URL to appear in stdout!`
)
`Timed out after ${timeout} ms while waiting for the WS endpoint URL to appear in stdout!`,
),
);

@@ -520,0 +520,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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