@puppeteer/browsers
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -97,5 +97,4 @@ "use strict"; | ||
}, async (argv) => { | ||
var _a, _b, _c; | ||
const args = argv; | ||
(_a = args.platform) !== null && _a !== void 0 ? _a : (args.platform = (0, detectPlatform_js_1.detectBrowserPlatform)()); | ||
args.platform ??= (0, detectPlatform_js_1.detectBrowserPlatform)(); | ||
if (!args.platform) { | ||
@@ -109,3 +108,3 @@ throw new Error(`Could not resolve the current platform`); | ||
platform: args.platform, | ||
cacheDir: (_b = args.path) !== null && _b !== void 0 ? _b : __classPrivateFieldGet(this, _CLI_cachePath, "f"), | ||
cacheDir: args.path ?? __classPrivateFieldGet(this, _CLI_cachePath, "f"), | ||
downloadProgressCallback: makeProgressCallback(args.browser.name, args.browser.buildId), | ||
@@ -117,3 +116,3 @@ baseUrl: args.baseUrl, | ||
buildId: args.browser.buildId, | ||
cacheDir: (_c = args.path) !== null && _c !== void 0 ? _c : __classPrivateFieldGet(this, _CLI_cachePath, "f"), | ||
cacheDir: args.path ?? __classPrivateFieldGet(this, _CLI_cachePath, "f"), | ||
platform: args.platform, | ||
@@ -141,3 +140,2 @@ })}`); | ||
}, async (argv) => { | ||
var _a; | ||
const args = argv; | ||
@@ -154,3 +152,3 @@ const executablePath = args.system | ||
buildId: args.browser.buildId, | ||
cacheDir: (_a = args.path) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _CLI_cachePath, "f"), | ||
cacheDir: args.path ?? __classPrivateFieldGet(this, _CLI_cachePath, "f"), | ||
platform: args.platform, | ||
@@ -166,6 +164,5 @@ }); | ||
}, async (argv) => { | ||
var _a, _b; | ||
const args = argv; | ||
const cacheDir = (_a = args.path) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _CLI_cachePath, "f"); | ||
const rl = (_b = __classPrivateFieldGet(this, _CLI_rl, "f")) !== null && _b !== void 0 ? _b : readline.createInterface({ input: process_1.stdin, output: process_1.stdout }); | ||
const cacheDir = args.path ?? __classPrivateFieldGet(this, _CLI_cachePath, "f"); | ||
const rl = __classPrivateFieldGet(this, _CLI_rl, "f") ?? readline.createInterface({ input: process_1.stdin, output: process_1.stdout }); | ||
rl.question(`Do you want to permanently and recursively delete the content of ${cacheDir} (yes/No)? `, answer => { | ||
@@ -220,4 +217,3 @@ rl.close(); | ||
}, _CLI_parseBuildId = function _CLI_parseBuildId(version) { | ||
var _a; | ||
return (_a = version.split('@').pop()) !== null && _a !== void 0 ? _a : 'latest'; | ||
return version.split('@').pop() ?? 'latest'; | ||
}; | ||
@@ -224,0 +220,0 @@ /** |
@@ -66,2 +66,3 @@ "use strict"; | ||
headers: keepAlive ? { Connection: 'keep-alive' } : undefined, | ||
auth: (0, url_1.urlToHttpOptions)(url).auth, | ||
agent: new proxy_agent_1.ProxyAgent(), | ||
@@ -68,0 +69,0 @@ }; |
@@ -66,2 +66,5 @@ /** | ||
export declare function install(options: InstallOptions): Promise<InstalledBrowser>; | ||
/** | ||
* @public | ||
*/ | ||
export interface UninstallOptions { | ||
@@ -92,2 +95,5 @@ /** | ||
export declare function uninstall(options: UninstallOptions): Promise<void>; | ||
/** | ||
* @public | ||
*/ | ||
export interface GetInstalledBrowsersOptions { | ||
@@ -94,0 +100,0 @@ /** |
@@ -51,5 +51,4 @@ "use strict"; | ||
async function install(options) { | ||
var _a, _b; | ||
(_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = (0, detectPlatform_js_1.detectBrowserPlatform)()); | ||
(_b = options.unpack) !== null && _b !== void 0 ? _b : (options.unpack = true); | ||
options.platform ??= (0, detectPlatform_js_1.detectBrowserPlatform)(); | ||
options.unpack ??= true; | ||
if (!options.platform) { | ||
@@ -132,4 +131,3 @@ throw new Error(`Cannot download a binary for the provided platform: ${os_1.default.platform()} (${os_1.default.arch()})`); | ||
async function uninstall(options) { | ||
var _a; | ||
(_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = (0, detectPlatform_js_1.detectBrowserPlatform)()); | ||
options.platform ??= (0, detectPlatform_js_1.detectBrowserPlatform)(); | ||
if (!options.platform) { | ||
@@ -154,4 +152,3 @@ throw new Error(`Cannot detect the browser platform for: ${os_1.default.platform()} (${os_1.default.arch()})`); | ||
async function canDownload(options) { | ||
var _a; | ||
(_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = (0, detectPlatform_js_1.detectBrowserPlatform)()); | ||
options.platform ??= (0, detectPlatform_js_1.detectBrowserPlatform)(); | ||
if (!options.platform) { | ||
@@ -158,0 +155,0 @@ throw new Error(`Cannot download a binary for the provided platform: ${os_1.default.platform()} (${os_1.default.arch()})`); |
@@ -48,4 +48,3 @@ "use strict"; | ||
function computeExecutablePath(options) { | ||
var _a; | ||
(_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = (0, detectPlatform_js_1.detectBrowserPlatform)()); | ||
options.platform ??= (0, detectPlatform_js_1.detectBrowserPlatform)(); | ||
if (!options.platform) { | ||
@@ -62,4 +61,3 @@ throw new Error(`Cannot download a binary for the provided platform: ${os_1.default.platform()} (${os_1.default.arch()})`); | ||
function computeSystemExecutablePath(options) { | ||
var _a; | ||
(_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = (0, detectPlatform_js_1.detectBrowserPlatform)()); | ||
options.platform ??= (0, detectPlatform_js_1.detectBrowserPlatform)(); | ||
if (!options.platform) { | ||
@@ -98,3 +96,2 @@ throw new Error(`Cannot download a binary for the provided platform: ${os_1.default.platform()} (${os_1.default.arch()})`); | ||
constructor(opts) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j; | ||
_Process_instances.add(this); | ||
@@ -126,8 +123,8 @@ _Process_executablePath.set(this, void 0); | ||
__classPrivateFieldSet(this, _Process_executablePath, opts.executablePath, "f"); | ||
__classPrivateFieldSet(this, _Process_args, (_a = opts.args) !== null && _a !== void 0 ? _a : [], "f"); | ||
(_b = opts.pipe) !== null && _b !== void 0 ? _b : (opts.pipe = false); | ||
(_c = opts.dumpio) !== null && _c !== void 0 ? _c : (opts.dumpio = false); | ||
(_d = opts.handleSIGINT) !== null && _d !== void 0 ? _d : (opts.handleSIGINT = true); | ||
(_e = opts.handleSIGTERM) !== null && _e !== void 0 ? _e : (opts.handleSIGTERM = true); | ||
(_f = opts.handleSIGHUP) !== null && _f !== void 0 ? _f : (opts.handleSIGHUP = true); | ||
__classPrivateFieldSet(this, _Process_args, opts.args ?? [], "f"); | ||
opts.pipe ??= false; | ||
opts.dumpio ??= false; | ||
opts.handleSIGINT ??= true; | ||
opts.handleSIGTERM ??= true; | ||
opts.handleSIGHUP ??= true; | ||
// On non-windows platforms, `detached: true` makes child process a | ||
@@ -137,3 +134,3 @@ // leader of a new process group, making it possible to kill child | ||
// https://nodejs.org/api/child_process.html#child_process_options_detached | ||
(_g = opts.detached) !== null && _g !== void 0 ? _g : (opts.detached = process.platform !== 'win32'); | ||
opts.detached ??= process.platform !== 'win32'; | ||
const stdio = __classPrivateFieldGet(this, _Process_instances, "m", _Process_configureStdio).call(this, { | ||
@@ -155,4 +152,4 @@ pipe: opts.pipe, | ||
if (opts.dumpio) { | ||
(_h = __classPrivateFieldGet(this, _Process_browserProcess, "f").stderr) === null || _h === void 0 ? void 0 : _h.pipe(process.stderr); | ||
(_j = __classPrivateFieldGet(this, _Process_browserProcess, "f").stdout) === null || _j === void 0 ? void 0 : _j.pipe(process.stdout); | ||
__classPrivateFieldGet(this, _Process_browserProcess, "f").stderr?.pipe(process.stderr); | ||
__classPrivateFieldGet(this, _Process_browserProcess, "f").stdout?.pipe(process.stdout); | ||
} | ||
@@ -159,0 +156,0 @@ process.on('exit', __classPrivateFieldGet(this, _Process_onDriverProcessExit, "f")); |
@@ -68,5 +68,4 @@ /** | ||
}, async (argv) => { | ||
var _a, _b, _c; | ||
const args = argv; | ||
(_a = args.platform) !== null && _a !== void 0 ? _a : (args.platform = detectBrowserPlatform()); | ||
args.platform ??= detectBrowserPlatform(); | ||
if (!args.platform) { | ||
@@ -80,3 +79,3 @@ throw new Error(`Could not resolve the current platform`); | ||
platform: args.platform, | ||
cacheDir: (_b = args.path) !== null && _b !== void 0 ? _b : __classPrivateFieldGet(this, _CLI_cachePath, "f"), | ||
cacheDir: args.path ?? __classPrivateFieldGet(this, _CLI_cachePath, "f"), | ||
downloadProgressCallback: makeProgressCallback(args.browser.name, args.browser.buildId), | ||
@@ -88,3 +87,3 @@ baseUrl: args.baseUrl, | ||
buildId: args.browser.buildId, | ||
cacheDir: (_c = args.path) !== null && _c !== void 0 ? _c : __classPrivateFieldGet(this, _CLI_cachePath, "f"), | ||
cacheDir: args.path ?? __classPrivateFieldGet(this, _CLI_cachePath, "f"), | ||
platform: args.platform, | ||
@@ -112,3 +111,2 @@ })}`); | ||
}, async (argv) => { | ||
var _a; | ||
const args = argv; | ||
@@ -125,3 +123,3 @@ const executablePath = args.system | ||
buildId: args.browser.buildId, | ||
cacheDir: (_a = args.path) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _CLI_cachePath, "f"), | ||
cacheDir: args.path ?? __classPrivateFieldGet(this, _CLI_cachePath, "f"), | ||
platform: args.platform, | ||
@@ -137,6 +135,5 @@ }); | ||
}, async (argv) => { | ||
var _a, _b; | ||
const args = argv; | ||
const cacheDir = (_a = args.path) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _CLI_cachePath, "f"); | ||
const rl = (_b = __classPrivateFieldGet(this, _CLI_rl, "f")) !== null && _b !== void 0 ? _b : readline.createInterface({ input, output }); | ||
const cacheDir = args.path ?? __classPrivateFieldGet(this, _CLI_cachePath, "f"); | ||
const rl = __classPrivateFieldGet(this, _CLI_rl, "f") ?? readline.createInterface({ input, output }); | ||
rl.question(`Do you want to permanently and recursively delete the content of ${cacheDir} (yes/No)? `, answer => { | ||
@@ -190,4 +187,3 @@ rl.close(); | ||
}, _CLI_parseBuildId = function _CLI_parseBuildId(version) { | ||
var _a; | ||
return (_a = version.split('@').pop()) !== null && _a !== void 0 ? _a : 'latest'; | ||
return version.split('@').pop() ?? 'latest'; | ||
}; | ||
@@ -194,0 +190,0 @@ /** |
@@ -19,3 +19,3 @@ /** | ||
import * as https from 'https'; | ||
import { URL } from 'url'; | ||
import { URL, urlToHttpOptions } from 'url'; | ||
import { ProxyAgent } from 'proxy-agent'; | ||
@@ -40,2 +40,3 @@ export function headHttpRequest(url) { | ||
headers: keepAlive ? { Connection: 'keep-alive' } : undefined, | ||
auth: urlToHttpOptions(url).auth, | ||
agent: new ProxyAgent(), | ||
@@ -42,0 +43,0 @@ }; |
@@ -66,2 +66,5 @@ /** | ||
export declare function install(options: InstallOptions): Promise<InstalledBrowser>; | ||
/** | ||
* @public | ||
*/ | ||
export interface UninstallOptions { | ||
@@ -92,2 +95,5 @@ /** | ||
export declare function uninstall(options: UninstallOptions): Promise<void>; | ||
/** | ||
* @public | ||
*/ | ||
export interface GetInstalledBrowsersOptions { | ||
@@ -94,0 +100,0 @@ /** |
@@ -45,5 +45,4 @@ /** | ||
export async function install(options) { | ||
var _a, _b; | ||
(_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = detectBrowserPlatform()); | ||
(_b = options.unpack) !== null && _b !== void 0 ? _b : (options.unpack = true); | ||
options.platform ??= detectBrowserPlatform(); | ||
options.unpack ??= true; | ||
if (!options.platform) { | ||
@@ -125,4 +124,3 @@ throw new Error(`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`); | ||
export async function uninstall(options) { | ||
var _a; | ||
(_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = detectBrowserPlatform()); | ||
options.platform ??= detectBrowserPlatform(); | ||
if (!options.platform) { | ||
@@ -145,4 +143,3 @@ throw new Error(`Cannot detect the browser platform for: ${os.platform()} (${os.arch()})`); | ||
export async function canDownload(options) { | ||
var _a; | ||
(_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = detectBrowserPlatform()); | ||
options.platform ??= detectBrowserPlatform(); | ||
if (!options.platform) { | ||
@@ -149,0 +146,0 @@ throw new Error(`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`); |
@@ -42,4 +42,3 @@ /** | ||
export function computeExecutablePath(options) { | ||
var _a; | ||
(_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = detectBrowserPlatform()); | ||
options.platform ??= detectBrowserPlatform(); | ||
if (!options.platform) { | ||
@@ -55,4 +54,3 @@ throw new Error(`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`); | ||
export function computeSystemExecutablePath(options) { | ||
var _a; | ||
(_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = detectBrowserPlatform()); | ||
options.platform ??= detectBrowserPlatform(); | ||
if (!options.platform) { | ||
@@ -89,3 +87,2 @@ throw new Error(`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`); | ||
constructor(opts) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j; | ||
_Process_instances.add(this); | ||
@@ -117,8 +114,8 @@ _Process_executablePath.set(this, void 0); | ||
__classPrivateFieldSet(this, _Process_executablePath, opts.executablePath, "f"); | ||
__classPrivateFieldSet(this, _Process_args, (_a = opts.args) !== null && _a !== void 0 ? _a : [], "f"); | ||
(_b = opts.pipe) !== null && _b !== void 0 ? _b : (opts.pipe = false); | ||
(_c = opts.dumpio) !== null && _c !== void 0 ? _c : (opts.dumpio = false); | ||
(_d = opts.handleSIGINT) !== null && _d !== void 0 ? _d : (opts.handleSIGINT = true); | ||
(_e = opts.handleSIGTERM) !== null && _e !== void 0 ? _e : (opts.handleSIGTERM = true); | ||
(_f = opts.handleSIGHUP) !== null && _f !== void 0 ? _f : (opts.handleSIGHUP = true); | ||
__classPrivateFieldSet(this, _Process_args, opts.args ?? [], "f"); | ||
opts.pipe ??= false; | ||
opts.dumpio ??= false; | ||
opts.handleSIGINT ??= true; | ||
opts.handleSIGTERM ??= true; | ||
opts.handleSIGHUP ??= true; | ||
// On non-windows platforms, `detached: true` makes child process a | ||
@@ -128,3 +125,3 @@ // leader of a new process group, making it possible to kill child | ||
// https://nodejs.org/api/child_process.html#child_process_options_detached | ||
(_g = opts.detached) !== null && _g !== void 0 ? _g : (opts.detached = process.platform !== 'win32'); | ||
opts.detached ??= process.platform !== 'win32'; | ||
const stdio = __classPrivateFieldGet(this, _Process_instances, "m", _Process_configureStdio).call(this, { | ||
@@ -146,4 +143,4 @@ pipe: opts.pipe, | ||
if (opts.dumpio) { | ||
(_h = __classPrivateFieldGet(this, _Process_browserProcess, "f").stderr) === null || _h === void 0 ? void 0 : _h.pipe(process.stderr); | ||
(_j = __classPrivateFieldGet(this, _Process_browserProcess, "f").stdout) === null || _j === void 0 ? void 0 : _j.pipe(process.stdout); | ||
__classPrivateFieldGet(this, _Process_browserProcess, "f").stderr?.pipe(process.stderr); | ||
__classPrivateFieldGet(this, _Process_browserProcess, "f").stdout?.pipe(process.stdout); | ||
} | ||
@@ -150,0 +147,0 @@ process.on('exit', __classPrivateFieldGet(this, _Process_onDriverProcessExit, "f")); |
{ | ||
"name": "@puppeteer/browsers", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "Download and launch browsers", | ||
@@ -93,3 +93,3 @@ "scripts": { | ||
"engines": { | ||
"node": ">=16.0.0" | ||
"node": ">=16.3.0" | ||
}, | ||
@@ -104,3 +104,3 @@ "files": [ | ||
"progress": "2.0.3", | ||
"proxy-agent": "6.2.0", | ||
"proxy-agent": "6.2.1", | ||
"tar-fs": "2.1.1", | ||
@@ -111,3 +111,3 @@ "unbzip2-stream": "1.4.3", | ||
"devDependencies": { | ||
"@types/node": "^14.15.0", | ||
"@types/node": "^16.11.7", | ||
"@types/yargs": "17.0.22" | ||
@@ -114,0 +114,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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
341948
5156
+ Addedproxy-agent@6.2.1(transitive)
- Removedhttp-proxy-agent@6.1.1(transitive)
- Removedhttps-proxy-agent@6.2.1(transitive)
- Removedproxy-agent@6.2.0(transitive)
Updatedproxy-agent@6.2.1