Socket
Socket
Sign inDemoInstall

@puppeteer/browsers

Package Overview
Dependencies
Maintainers
2
Versions
46
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 0.3.2 to 0.3.3

lib/cjs/install.d.ts

15

lib/cjs/browser-data/browser-data.d.ts

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

import { Browser, BrowserPlatform, ChromeReleaseChannel, ProfileOptions } from './types.js';
export { ProfileOptions };
export declare const downloadUrls: {

@@ -26,2 +27,7 @@ chrome: typeof chrome.resolveDownloadUrl;

};
export declare const downloadPaths: {
chrome: typeof chrome.resolveDownloadPath;
chromium: typeof chromium.resolveDownloadPath;
firefox: typeof firefox.resolveDownloadPath;
};
export declare const executablePathByBrowser: {

@@ -33,5 +39,14 @@ chrome: typeof chrome.relativeExecutablePath;

export { Browser, BrowserPlatform, ChromeReleaseChannel };
/**
* @public
*/
export declare function resolveBuildId(browser: Browser, platform: BrowserPlatform, tag: string): Promise<string>;
/**
* @public
*/
export declare function createProfile(browser: Browser, opts: ProfileOptions): Promise<void>;
/**
* @public
*/
export declare function resolveSystemExecutablePath(browser: Browser, platform: BrowserPlatform, channel: ChromeReleaseChannel): string;
//# sourceMappingURL=browser-data.d.ts.map

16

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

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

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

@@ -55,2 +55,7 @@ const chromium = __importStar(require("./chromium.js"));

};
exports.downloadPaths = {
[types_js_1.Browser.CHROME]: chrome.resolveDownloadPath,
[types_js_1.Browser.CHROMIUM]: chromium.resolveDownloadPath,
[types_js_1.Browser.FIREFOX]: firefox.resolveDownloadPath,
};
exports.executablePathByBrowser = {

@@ -61,2 +66,5 @@ [types_js_1.Browser.CHROME]: chrome.relativeExecutablePath,

};
/**
* @public
*/
async function resolveBuildId(browser, platform, tag) {

@@ -85,2 +93,5 @@ switch (browser) {

exports.resolveBuildId = resolveBuildId;
/**
* @public
*/
async function createProfile(browser, opts) {

@@ -96,2 +107,5 @@ switch (browser) {

exports.createProfile = createProfile;
/**
* @public
*/
function resolveSystemExecutablePath(browser, platform, channel) {

@@ -98,0 +112,0 @@ switch (browser) {

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

export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
export declare function relativeExecutablePath(platform: BrowserPlatform, _buildId: string): string;

@@ -20,0 +21,0 @@ export declare function resolveBuildId(platform: BrowserPlatform, channel?: 'beta' | 'stable'): Promise<string>;

8

lib/cjs/browser-data/chrome.js

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

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

@@ -55,5 +55,9 @@ const httpUtil_js_1 = require("../httpUtil.js");

function resolveDownloadUrl(platform, buildId, baseUrl = 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing') {
return `${baseUrl}/${buildId}/${folder(platform)}/chrome-${folder(platform)}.zip`;
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
}
exports.resolveDownloadUrl = resolveDownloadUrl;
function resolveDownloadPath(platform, buildId) {
return [buildId, folder(platform), `chrome-${folder(platform)}.zip`];
}
exports.resolveDownloadPath = resolveDownloadPath;
function relativeExecutablePath(platform, _buildId) {

@@ -60,0 +64,0 @@ switch (platform) {

@@ -19,4 +19,5 @@ /**

export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
export declare function relativeExecutablePath(platform: BrowserPlatform, _buildId: string): string;
export declare function resolveBuildId(platform: BrowserPlatform, _channel?: 'latest'): Promise<string>;
//# sourceMappingURL=chromium.d.ts.map

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

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

@@ -56,5 +56,9 @@ const httpUtil_js_1 = require("../httpUtil.js");

function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chromium-browser-snapshots') {
return `${baseUrl}/${folder(platform)}/${buildId}/${archive(platform, buildId)}.zip`;
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
}
exports.resolveDownloadUrl = resolveDownloadUrl;
function resolveDownloadPath(platform, buildId) {
return [folder(platform), buildId, `${archive(platform, buildId)}.zip`];
}
exports.resolveDownloadPath = resolveDownloadPath;
function relativeExecutablePath(platform, _buildId) {

@@ -61,0 +65,0 @@ switch (platform) {

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

export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
export declare function relativeExecutablePath(platform: BrowserPlatform, _buildId: string): string;

@@ -20,0 +21,0 @@ export declare function resolveBuildId(channel?: 'FIREFOX_NIGHTLY'): Promise<string>;

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

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

@@ -40,5 +40,9 @@ const path_1 = __importDefault(require("path"));

function resolveDownloadUrl(platform, buildId, baseUrl = 'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central') {
return `${baseUrl}/${archive(platform, buildId)}`;
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
}
exports.resolveDownloadUrl = resolveDownloadUrl;
function resolveDownloadPath(platform, buildId) {
return [archive(platform, buildId)];
}
exports.resolveDownloadPath = resolveDownloadPath;
function relativeExecutablePath(platform, _buildId) {

@@ -45,0 +49,0 @@ switch (platform) {

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

* Supported browsers.
*
* @public
*/

@@ -30,2 +32,4 @@ export declare enum Browser {

* that is relevant for the browser download.
*
* @public
*/

@@ -44,5 +48,11 @@ export declare enum BrowserPlatform {

};
/**
* @public
*/
export declare enum BrowserTag {
LATEST = "latest"
}
/**
* @public
*/
export interface ProfileOptions {

@@ -52,2 +62,5 @@ preferences: Record<string, unknown>;

}
/**
* @public
*/
export declare enum ChromeReleaseChannel {

@@ -54,0 +67,0 @@ STABLE = "stable",

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

* Supported browsers.
*
* @public
*/

@@ -57,2 +59,4 @@ var Browser;

* that is relevant for the browser download.
*
* @public
*/

@@ -72,2 +76,5 @@ var BrowserPlatform;

};
/**
* @public
*/
var BrowserTag;

@@ -77,2 +84,5 @@ (function (BrowserTag) {

})(BrowserTag = exports.BrowserTag || (exports.BrowserTag = {}));
/**
* @public
*/
var ChromeReleaseChannel;

@@ -79,0 +89,0 @@ (function (ChromeReleaseChannel) {

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

maxRetries: 10,
retryDelay: 200,
retryDelay: 500,
});

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

@@ -19,2 +19,5 @@ /**

import { Browser } from './browser-data/browser-data.js';
/**
* @public
*/
export declare class CLI {

@@ -25,3 +28,6 @@ #private;

}
/**
* @public
*/
export declare function makeProgressCallback(browser: Browser, buildId: string): (downloadedBytes: number, totalBytes: number) => void;
//# sourceMappingURL=CLI.d.ts.map

@@ -60,9 +60,12 @@ "use strict";

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");
const Cache_js_1 = require("./Cache.js");
const detectPlatform_js_1 = require("./detectPlatform.js");
const fetch_js_1 = require("./fetch.js");
const launcher_js_1 = require("./launcher.js");
const install_js_1 = require("./install.js");
const launch_js_1 = require("./launch.js");
/**
* @public
*/
class CLI {

@@ -77,3 +80,4 @@ constructor(cachePath = process.cwd(), rl) {

async run(argv) {
await (0, yargs_1.default)((0, helpers_1.hideBin)(argv))
const yargsInstance = (0, yargs_1.default)((0, helpers_1.hideBin)(argv));
await yargsInstance
.scriptName('@puppeteer/browsers')

@@ -84,2 +88,6 @@ .command('install <browser>', 'Download and install the specified browser. If successful, the command outputs the actual browser buildId that was installed and the absolute path to the browser executable (format: <browser>@<buildID> <path>).', yargs => {

__classPrivateFieldGet(this, _CLI_instances, "m", _CLI_definePathParameter).call(this, yargs);
yargs.option('base-url', {
type: 'string',
desc: 'Base URL to download from',
});
yargs.example('$0 install chrome', 'Install the latest available build of the Chrome browser.');

@@ -99,3 +107,3 @@ yargs.example('$0 install chrome@latest', 'Install the latest available build for the Chrome browser.');

args.browser.buildId = await (0, browser_data_js_1.resolveBuildId)(args.browser.name, args.platform, args.browser.buildId);
await (0, fetch_js_1.fetch)({
await (0, install_js_1.install)({
browser: args.browser.name,

@@ -106,4 +114,5 @@ buildId: args.browser.buildId,

downloadProgressCallback: makeProgressCallback(args.browser.name, args.browser.buildId),
baseUrl: args.baseUrl,
});
console.log(`${args.browser.name}@${args.browser.buildId} ${(0, launcher_js_1.computeExecutablePath)({
console.log(`${args.browser.name}@${args.browser.buildId} ${(0, launch_js_1.computeExecutablePath)({
browser: args.browser.name,

@@ -137,3 +146,3 @@ buildId: args.browser.buildId,

const executablePath = args.system
? (0, launcher_js_1.computeSystemExecutablePath)({
? (0, launch_js_1.computeSystemExecutablePath)({
browser: args.browser.name,

@@ -144,3 +153,3 @@ // TODO: throw an error if not a ChromeReleaseChannel is provided.

})
: (0, launcher_js_1.computeExecutablePath)({
: (0, launch_js_1.computeExecutablePath)({
browser: args.browser.name,

@@ -151,3 +160,3 @@ buildId: args.browser.buildId,

});
(0, launcher_js_1.launch)({
(0, launch_js_1.launch)({
executablePath,

@@ -177,3 +186,3 @@ detached: args.detached,

.help()
.wrap(Math.min(120, yargs_1.default.terminalWidth()))
.wrap(Math.min(120, yargsInstance.terminalWidth()))
.parse();

@@ -217,2 +226,5 @@ }

};
/**
* @public
*/
function makeProgressCallback(browser, buildId) {

@@ -219,0 +231,0 @@ let progressBar;

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

import { BrowserPlatform } from './browser-data/browser-data.js';
/**
* @public
*/
export declare function detectBrowserPlatform(): BrowserPlatform | undefined;
//# sourceMappingURL=detectPlatform.d.ts.map

@@ -24,2 +24,5 @@ "use strict";

const browser_data_js_1 = require("./browser-data/browser-data.js");
/**
* @public
*/
function detectBrowserPlatform() {

@@ -26,0 +29,0 @@ const platform = os_1.default.platform();

@@ -16,8 +16,8 @@ /**

*/
export { launch, computeExecutablePath, computeSystemExecutablePath, CDP_WEBSOCKET_ENDPOINT_REGEX, WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX, } from './launcher.js';
export { fetch, canFetch } from './fetch.js';
export { launch, computeExecutablePath, computeSystemExecutablePath, TimeoutError, LaunchOptions, ComputeExecutablePathOptions as Options, SystemOptions, CDP_WEBSOCKET_ENDPOINT_REGEX, WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX, Process, } from './launch.js';
export { install, canDownload, InstallOptions, InstalledBrowser, } from './install.js';
export { detectBrowserPlatform } from './detectPlatform.js';
export { resolveBuildId, Browser, BrowserPlatform, ChromeReleaseChannel, } from './browser-data/browser-data.js';
export { resolveBuildId, Browser, BrowserPlatform, ChromeReleaseChannel, createProfile, ProfileOptions, } from './browser-data/browser-data.js';
export { CLI, makeProgressCallback } from './CLI.js';
export { Cache } from './Cache.js';
//# sourceMappingURL=main.d.ts.map

@@ -18,12 +18,14 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Cache = exports.makeProgressCallback = exports.CLI = exports.ChromeReleaseChannel = exports.BrowserPlatform = exports.Browser = exports.resolveBuildId = exports.detectBrowserPlatform = exports.canFetch = exports.fetch = exports.WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = exports.CDP_WEBSOCKET_ENDPOINT_REGEX = exports.computeSystemExecutablePath = exports.computeExecutablePath = exports.launch = void 0;
var launcher_js_1 = require("./launcher.js");
Object.defineProperty(exports, "launch", { enumerable: true, get: function () { return launcher_js_1.launch; } });
Object.defineProperty(exports, "computeExecutablePath", { enumerable: true, get: function () { return launcher_js_1.computeExecutablePath; } });
Object.defineProperty(exports, "computeSystemExecutablePath", { enumerable: true, get: function () { return launcher_js_1.computeSystemExecutablePath; } });
Object.defineProperty(exports, "CDP_WEBSOCKET_ENDPOINT_REGEX", { enumerable: true, get: function () { return launcher_js_1.CDP_WEBSOCKET_ENDPOINT_REGEX; } });
Object.defineProperty(exports, "WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX", { enumerable: true, get: function () { return launcher_js_1.WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX; } });
var fetch_js_1 = require("./fetch.js");
Object.defineProperty(exports, "fetch", { enumerable: true, get: function () { return fetch_js_1.fetch; } });
Object.defineProperty(exports, "canFetch", { enumerable: true, get: function () { return fetch_js_1.canFetch; } });
exports.Cache = exports.makeProgressCallback = exports.CLI = exports.createProfile = exports.ChromeReleaseChannel = exports.BrowserPlatform = exports.Browser = exports.resolveBuildId = exports.detectBrowserPlatform = exports.canDownload = exports.install = exports.Process = exports.WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = exports.CDP_WEBSOCKET_ENDPOINT_REGEX = exports.TimeoutError = exports.computeSystemExecutablePath = exports.computeExecutablePath = exports.launch = void 0;
var launch_js_1 = require("./launch.js");
Object.defineProperty(exports, "launch", { enumerable: true, get: function () { return launch_js_1.launch; } });
Object.defineProperty(exports, "computeExecutablePath", { enumerable: true, get: function () { return launch_js_1.computeExecutablePath; } });
Object.defineProperty(exports, "computeSystemExecutablePath", { enumerable: true, get: function () { return launch_js_1.computeSystemExecutablePath; } });
Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return launch_js_1.TimeoutError; } });
Object.defineProperty(exports, "CDP_WEBSOCKET_ENDPOINT_REGEX", { enumerable: true, get: function () { return launch_js_1.CDP_WEBSOCKET_ENDPOINT_REGEX; } });
Object.defineProperty(exports, "WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX", { enumerable: true, get: function () { return launch_js_1.WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX; } });
Object.defineProperty(exports, "Process", { enumerable: true, get: function () { return launch_js_1.Process; } });
var install_js_1 = require("./install.js");
Object.defineProperty(exports, "install", { enumerable: true, get: function () { return install_js_1.install; } });
Object.defineProperty(exports, "canDownload", { enumerable: true, get: function () { return install_js_1.canDownload; } });
var detectPlatform_js_1 = require("./detectPlatform.js");

@@ -36,2 +38,3 @@ Object.defineProperty(exports, "detectBrowserPlatform", { enumerable: true, get: function () { return detectPlatform_js_1.detectBrowserPlatform; } });

Object.defineProperty(exports, "ChromeReleaseChannel", { enumerable: true, get: function () { return browser_data_js_1.ChromeReleaseChannel; } });
Object.defineProperty(exports, "createProfile", { enumerable: true, get: function () { return browser_data_js_1.createProfile; } });
var CLI_js_1 = require("./CLI.js");

@@ -38,0 +41,0 @@ Object.defineProperty(exports, "CLI", { enumerable: true, get: function () { return CLI_js_1.CLI; } });

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

import { Browser, BrowserPlatform, ChromeReleaseChannel, ProfileOptions } from './types.js';
export { ProfileOptions };
export declare const downloadUrls: {

@@ -26,2 +27,7 @@ chrome: typeof chrome.resolveDownloadUrl;

};
export declare const downloadPaths: {
chrome: typeof chrome.resolveDownloadPath;
chromium: typeof chromium.resolveDownloadPath;
firefox: typeof firefox.resolveDownloadPath;
};
export declare const executablePathByBrowser: {

@@ -33,5 +39,14 @@ chrome: typeof chrome.relativeExecutablePath;

export { Browser, BrowserPlatform, ChromeReleaseChannel };
/**
* @public
*/
export declare function resolveBuildId(browser: Browser, platform: BrowserPlatform, tag: string): Promise<string>;
/**
* @public
*/
export declare function createProfile(browser: Browser, opts: ProfileOptions): Promise<void>;
/**
* @public
*/
export declare function resolveSystemExecutablePath(browser: Browser, platform: BrowserPlatform, channel: ChromeReleaseChannel): string;
//# sourceMappingURL=browser-data.d.ts.map

@@ -25,2 +25,7 @@ /**

};
export const downloadPaths = {
[Browser.CHROME]: chrome.resolveDownloadPath,
[Browser.CHROMIUM]: chromium.resolveDownloadPath,
[Browser.FIREFOX]: firefox.resolveDownloadPath,
};
export const executablePathByBrowser = {

@@ -32,2 +37,5 @@ [Browser.CHROME]: chrome.relativeExecutablePath,

export { Browser, BrowserPlatform, ChromeReleaseChannel };
/**
* @public
*/
export async function resolveBuildId(browser, platform, tag) {

@@ -55,2 +63,5 @@ switch (browser) {

}
/**
* @public
*/
export async function createProfile(browser, opts) {

@@ -65,2 +76,5 @@ switch (browser) {

}
/**
* @public
*/
export function resolveSystemExecutablePath(browser, platform, channel) {

@@ -67,0 +81,0 @@ switch (browser) {

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

export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
export declare function relativeExecutablePath(platform: BrowserPlatform, _buildId: string): string;

@@ -20,0 +21,0 @@ export declare function resolveBuildId(platform: BrowserPlatform, channel?: 'beta' | 'stable'): Promise<string>;

@@ -48,4 +48,7 @@ /**

export function resolveDownloadUrl(platform, buildId, baseUrl = 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing') {
return `${baseUrl}/${buildId}/${folder(platform)}/chrome-${folder(platform)}.zip`;
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
}
export function resolveDownloadPath(platform, buildId) {
return [buildId, folder(platform), `chrome-${folder(platform)}.zip`];
}
export function relativeExecutablePath(platform, _buildId) {

@@ -52,0 +55,0 @@ switch (platform) {

@@ -19,4 +19,5 @@ /**

export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
export declare function relativeExecutablePath(platform: BrowserPlatform, _buildId: string): string;
export declare function resolveBuildId(platform: BrowserPlatform, _channel?: 'latest'): Promise<string>;
//# sourceMappingURL=chromium.d.ts.map

@@ -48,4 +48,7 @@ /**

export function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chromium-browser-snapshots') {
return `${baseUrl}/${folder(platform)}/${buildId}/${archive(platform, buildId)}.zip`;
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
}
export function resolveDownloadPath(platform, buildId) {
return [folder(platform), buildId, `${archive(platform, buildId)}.zip`];
}
export function relativeExecutablePath(platform, _buildId) {

@@ -52,0 +55,0 @@ switch (platform) {

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

export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
export declare function relativeExecutablePath(platform: BrowserPlatform, _buildId: string): string;

@@ -20,0 +21,0 @@ export declare function resolveBuildId(channel?: 'FIREFOX_NIGHTLY'): Promise<string>;

@@ -33,4 +33,7 @@ /**

export function resolveDownloadUrl(platform, buildId, baseUrl = 'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central') {
return `${baseUrl}/${archive(platform, buildId)}`;
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
}
export function resolveDownloadPath(platform, buildId) {
return [archive(platform, buildId)];
}
export function relativeExecutablePath(platform, _buildId) {

@@ -37,0 +40,0 @@ switch (platform) {

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

* Supported browsers.
*
* @public
*/

@@ -30,2 +32,4 @@ export declare enum Browser {

* that is relevant for the browser download.
*
* @public
*/

@@ -44,5 +48,11 @@ export declare enum BrowserPlatform {

};
/**
* @public
*/
export declare enum BrowserTag {
LATEST = "latest"
}
/**
* @public
*/
export interface ProfileOptions {

@@ -52,2 +62,5 @@ preferences: Record<string, unknown>;

}
/**
* @public
*/
export declare enum ChromeReleaseChannel {

@@ -54,0 +67,0 @@ STABLE = "stable",

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

* Supported browsers.
*
* @public
*/

@@ -31,2 +33,4 @@ export var Browser;

* that is relevant for the browser download.
*
* @public
*/

@@ -46,2 +50,5 @@ export var BrowserPlatform;

};
/**
* @public
*/
export var BrowserTag;

@@ -51,2 +58,5 @@ (function (BrowserTag) {

})(BrowserTag || (BrowserTag = {}));
/**
* @public
*/
export var ChromeReleaseChannel;

@@ -53,0 +63,0 @@ (function (ChromeReleaseChannel) {

@@ -63,3 +63,3 @@ /**

maxRetries: 10,
retryDelay: 200,
retryDelay: 500,
});

@@ -66,0 +66,0 @@ }

@@ -19,2 +19,5 @@ /**

import { Browser } from './browser-data/browser-data.js';
/**
* @public
*/
export declare class CLI {

@@ -25,3 +28,6 @@ #private;

}
/**
* @public
*/
export declare function makeProgressCallback(browser: Browser, buildId: string): (downloadedBytes: number, totalBytes: number) => void;
//# sourceMappingURL=CLI.d.ts.map

@@ -31,9 +31,12 @@ /**

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';
import { Cache } from './Cache.js';
import { detectBrowserPlatform } from './detectPlatform.js';
import { fetch } from './fetch.js';
import { computeExecutablePath, computeSystemExecutablePath, launch, } from './launcher.js';
import { install } from './install.js';
import { computeExecutablePath, computeSystemExecutablePath, launch, } from './launch.js';
/**
* @public
*/
export class CLI {

@@ -48,3 +51,4 @@ constructor(cachePath = process.cwd(), rl) {

async run(argv) {
await yargs(hideBin(argv))
const yargsInstance = yargs(hideBin(argv));
await yargsInstance
.scriptName('@puppeteer/browsers')

@@ -55,2 +59,6 @@ .command('install <browser>', 'Download and install the specified browser. If successful, the command outputs the actual browser buildId that was installed and the absolute path to the browser executable (format: <browser>@<buildID> <path>).', yargs => {

__classPrivateFieldGet(this, _CLI_instances, "m", _CLI_definePathParameter).call(this, yargs);
yargs.option('base-url', {
type: 'string',
desc: 'Base URL to download from',
});
yargs.example('$0 install chrome', 'Install the latest available build of the Chrome browser.');

@@ -70,3 +78,3 @@ yargs.example('$0 install chrome@latest', 'Install the latest available build for the Chrome browser.');

args.browser.buildId = await resolveBuildId(args.browser.name, args.platform, args.browser.buildId);
await fetch({
await install({
browser: args.browser.name,

@@ -77,2 +85,3 @@ buildId: args.browser.buildId,

downloadProgressCallback: makeProgressCallback(args.browser.name, args.browser.buildId),
baseUrl: args.baseUrl,
});

@@ -145,3 +154,3 @@ console.log(`${args.browser.name}@${args.browser.buildId} ${computeExecutablePath({

.help()
.wrap(Math.min(120, yargs.terminalWidth()))
.wrap(Math.min(120, yargsInstance.terminalWidth()))
.parse();

@@ -184,2 +193,5 @@ }

};
/**
* @public
*/
export function makeProgressCallback(browser, buildId) {

@@ -186,0 +198,0 @@ let progressBar;

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

import { BrowserPlatform } from './browser-data/browser-data.js';
/**
* @public
*/
export declare function detectBrowserPlatform(): BrowserPlatform | undefined;
//# sourceMappingURL=detectPlatform.d.ts.map

@@ -18,2 +18,5 @@ /**

import { BrowserPlatform } from './browser-data/browser-data.js';
/**
* @public
*/
export function detectBrowserPlatform() {

@@ -20,0 +23,0 @@ const platform = os.platform();

@@ -16,8 +16,8 @@ /**

*/
export { launch, computeExecutablePath, computeSystemExecutablePath, CDP_WEBSOCKET_ENDPOINT_REGEX, WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX, } from './launcher.js';
export { fetch, canFetch } from './fetch.js';
export { launch, computeExecutablePath, computeSystemExecutablePath, TimeoutError, LaunchOptions, ComputeExecutablePathOptions as Options, SystemOptions, CDP_WEBSOCKET_ENDPOINT_REGEX, WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX, Process, } from './launch.js';
export { install, canDownload, InstallOptions, InstalledBrowser, } from './install.js';
export { detectBrowserPlatform } from './detectPlatform.js';
export { resolveBuildId, Browser, BrowserPlatform, ChromeReleaseChannel, } from './browser-data/browser-data.js';
export { resolveBuildId, Browser, BrowserPlatform, ChromeReleaseChannel, createProfile, ProfileOptions, } from './browser-data/browser-data.js';
export { CLI, makeProgressCallback } from './CLI.js';
export { Cache } from './Cache.js';
//# sourceMappingURL=main.d.ts.map

@@ -16,8 +16,8 @@ /**

*/
export { launch, computeExecutablePath, computeSystemExecutablePath, CDP_WEBSOCKET_ENDPOINT_REGEX, WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX, } from './launcher.js';
export { fetch, canFetch } from './fetch.js';
export { launch, computeExecutablePath, computeSystemExecutablePath, TimeoutError, CDP_WEBSOCKET_ENDPOINT_REGEX, WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX, Process, } from './launch.js';
export { install, canDownload, } from './install.js';
export { detectBrowserPlatform } from './detectPlatform.js';
export { resolveBuildId, Browser, BrowserPlatform, ChromeReleaseChannel, } from './browser-data/browser-data.js';
export { resolveBuildId, Browser, BrowserPlatform, ChromeReleaseChannel, createProfile, } from './browser-data/browser-data.js';
export { CLI, makeProgressCallback } from './CLI.js';
export { Cache } from './Cache.js';
//# sourceMappingURL=main.js.map
{
"name": "@puppeteer/browsers",
"version": "0.3.2",
"version": "0.3.3",
"description": "Download and launch browsers",
"scripts": {
"build:docs": "wireit",
"build": "wireit",

@@ -15,2 +16,4 @@ "build:test": "wireit",

"main": "./lib/cjs/main.js",
"module": "./lib/esm/main.js",
"type": "commonjs",
"exports": {

@@ -29,6 +32,31 @@ ".": {

],
"clean": "if-file-deleted",
"output": [
"lib/**"
"lib/**",
"!lib/esm/package.json"
],
"dependencies": [
"generate:package-json"
]
},
"generate:package-json": {
"command": "tsx ../../tools/generate_module_package_json.ts lib/esm/package.json",
"files": [
"../../tools/generate_module_package_json.ts"
],
"output": [
"lib/esm/package.json"
]
},
"build:docs": {
"command": "api-extractor run --local --config \"./api-extractor.docs.json\"",
"files": [
"api-extractor.docs.json",
"lib/esm/main.d.ts",
"tsconfig.json"
],
"dependencies": [
"build"
]
},
"build:test": {

@@ -44,7 +72,8 @@ "command": "tsc -b test/src/tsconfig.json",

"dependencies": [
"build"
"build",
"../testserver:build"
]
},
"test": {
"command": "mocha",
"command": "node tools/downloadTestBrowsers.mjs && cross-env DEBUG=puppeteer:* mocha",
"files": [

@@ -51,0 +80,0 @@ ".mocharc.cjs"

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

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