@puppeteer/browsers
Advanced tools
Comparing version
@@ -21,8 +21,6 @@ /** | ||
allowCachePathOverride?: boolean; | ||
pinnedBrowsers?: Partial<{ | ||
[key in Browser]: { | ||
buildId: string; | ||
skipDownload: boolean; | ||
}; | ||
}>; | ||
pinnedBrowsers?: Partial<Record<Browser, { | ||
buildId: string; | ||
skipDownload: boolean; | ||
}>>; | ||
}, rl?: readline.Interface); | ||
@@ -29,0 +27,0 @@ run(argv: string[]): Promise<void>; |
@@ -108,3 +108,3 @@ "use strict"; | ||
type: 'string', | ||
desc: 'Path to the root folder for the browser downloads and installation. The installation folder structure is compatible with the cache structure used by Puppeteer.', | ||
desc: 'Path to the root folder for the browser downloads and installation. If a relative path is provided, it will be resolved relative to the current working directory. The installation folder structure is compatible with the cache structure used by Puppeteer.', | ||
defaultDescription: 'Current working directory', | ||
@@ -111,0 +111,0 @@ ...(required ? {} : { default: process.cwd() }), |
@@ -57,2 +57,5 @@ "use strict"; | ||
async function unpackArchive(archivePath, folderPath) { | ||
if (!path.isAbsolute(folderPath)) { | ||
folderPath = path.resolve(process.cwd(), folderPath); | ||
} | ||
if (archivePath.endsWith('.zip')) { | ||
@@ -59,0 +62,0 @@ await (0, extract_zip_1.default)(archivePath, { dir: folderPath }); |
@@ -81,8 +81,12 @@ "use strict"; | ||
} | ||
const url = version.downloads[options.browser]?.find(link => { | ||
const backupUrl = version.downloads[options.browser]?.find(link => { | ||
return link['platform'] === platform; | ||
})?.url; | ||
if (url) { | ||
debugInstall(`Falling back to downloading from ${url}.`); | ||
return await installUrl(new URL(url), options); | ||
if (backupUrl) { | ||
// If the URL is the same, skip the retry. | ||
if (backupUrl === url.toString()) { | ||
throw err; | ||
} | ||
debugInstall(`Falling back to downloading from ${backupUrl}.`); | ||
return await installUrl(new URL(backupUrl), options); | ||
} | ||
@@ -89,0 +93,0 @@ throw err; |
@@ -21,8 +21,6 @@ /** | ||
allowCachePathOverride?: boolean; | ||
pinnedBrowsers?: Partial<{ | ||
[key in Browser]: { | ||
buildId: string; | ||
skipDownload: boolean; | ||
}; | ||
}>; | ||
pinnedBrowsers?: Partial<Record<Browser, { | ||
buildId: string; | ||
skipDownload: boolean; | ||
}>>; | ||
}, rl?: readline.Interface); | ||
@@ -29,0 +27,0 @@ run(argv: string[]): Promise<void>; |
@@ -68,3 +68,3 @@ /** | ||
type: 'string', | ||
desc: 'Path to the root folder for the browser downloads and installation. The installation folder structure is compatible with the cache structure used by Puppeteer.', | ||
desc: 'Path to the root folder for the browser downloads and installation. If a relative path is provided, it will be resolved relative to the current working directory. The installation folder structure is compatible with the cache structure used by Puppeteer.', | ||
defaultDescription: 'Current working directory', | ||
@@ -71,0 +71,0 @@ ...(required ? {} : { default: process.cwd() }), |
@@ -18,2 +18,5 @@ /** | ||
export async function unpackArchive(archivePath, folderPath) { | ||
if (!path.isAbsolute(folderPath)) { | ||
folderPath = path.resolve(process.cwd(), folderPath); | ||
} | ||
if (archivePath.endsWith('.zip')) { | ||
@@ -20,0 +23,0 @@ await extractZip(archivePath, { dir: folderPath }); |
@@ -72,8 +72,12 @@ /** | ||
} | ||
const url = version.downloads[options.browser]?.find(link => { | ||
const backupUrl = version.downloads[options.browser]?.find(link => { | ||
return link['platform'] === platform; | ||
})?.url; | ||
if (url) { | ||
debugInstall(`Falling back to downloading from ${url}.`); | ||
return await installUrl(new URL(url), options); | ||
if (backupUrl) { | ||
// If the URL is the same, skip the retry. | ||
if (backupUrl === url.toString()) { | ||
throw err; | ||
} | ||
debugInstall(`Falling back to downloading from ${backupUrl}.`); | ||
return await installUrl(new URL(backupUrl), options); | ||
} | ||
@@ -80,0 +84,0 @@ throw err; |
{ | ||
"name": "@puppeteer/browsers", | ||
"version": "2.6.1", | ||
"version": "2.7.0", | ||
"description": "Download and launch browsers", | ||
@@ -21,3 +21,3 @@ "scripts": { | ||
"build": { | ||
"command": "tsc -b && tsx ../../tools/chmod.ts 755 lib/cjs/main-cli.js lib/esm/main-cli.js", | ||
"command": "tsc -b && node --experimental-strip-types ../../tools/chmod.ts 755 lib/cjs/main-cli.js lib/esm/main-cli.js", | ||
"files": [ | ||
@@ -37,3 +37,3 @@ "src/**/*.ts", | ||
"generate:package-json": { | ||
"command": "tsx ../../tools/generate_module_package_json.ts lib/esm/package.json", | ||
"command": "node --experimental-strip-types ../../tools/generate_module_package_json.ts lib/esm/package.json", | ||
"files": [ | ||
@@ -40,0 +40,0 @@ "../../tools/generate_module_package_json.ts" |
@@ -67,2 +67,8 @@ # @puppeteer/browsers | ||
npx @puppeteer/browsers install chromedriver@116.0.5793.0 | ||
# On Ubuntu/Debian and only for Chrome, install the browser and required system dependencies. | ||
# If the browser version has already been installed, the command | ||
# will still attempt to install system dependencies. | ||
# Requires root privileges. | ||
npx puppeteer browsers install chrome --install-deps | ||
``` | ||
@@ -69,0 +75,0 @@ |
@@ -85,5 +85,6 @@ /** | ||
data as { | ||
channels: { | ||
[channel in ChromeReleaseChannel]: {version: string; revision: string}; | ||
}; | ||
channels: Record< | ||
ChromeReleaseChannel, | ||
{version: string; revision: string} | ||
>; | ||
} | ||
@@ -90,0 +91,0 @@ ).channels[channel]; |
@@ -69,8 +69,11 @@ /** | ||
#allowCachePathOverride = true; | ||
#pinnedBrowsers?: Partial<{ | ||
[key in Browser]: { | ||
buildId: string; | ||
skipDownload: boolean; | ||
}; | ||
}>; | ||
#pinnedBrowsers?: Partial< | ||
Record< | ||
Browser, | ||
{ | ||
buildId: string; | ||
skipDownload: boolean; | ||
} | ||
> | ||
>; | ||
#prefixCommand?: {cmd: string; description: string}; | ||
@@ -86,8 +89,11 @@ | ||
allowCachePathOverride?: boolean; | ||
pinnedBrowsers?: Partial<{ | ||
[key in Browser]: { | ||
buildId: string; | ||
skipDownload: boolean; | ||
}; | ||
}>; | ||
pinnedBrowsers?: Partial< | ||
Record< | ||
Browser, | ||
{ | ||
buildId: string; | ||
skipDownload: boolean; | ||
} | ||
> | ||
>; | ||
}, | ||
@@ -141,3 +147,3 @@ rl?: readline.Interface, | ||
type: 'string', | ||
desc: 'Path to the root folder for the browser downloads and installation. The installation folder structure is compatible with the cache structure used by Puppeteer.', | ||
desc: 'Path to the root folder for the browser downloads and installation. If a relative path is provided, it will be resolved relative to the current working directory. The installation folder structure is compatible with the cache structure used by Puppeteer.', | ||
defaultDescription: 'Current working directory', | ||
@@ -144,0 +150,0 @@ ...(required ? {} : {default: process.cwd()}), |
@@ -24,2 +24,6 @@ /** | ||
): Promise<void> { | ||
if (!path.isAbsolute(folderPath)) { | ||
folderPath = path.resolve(process.cwd(), folderPath); | ||
} | ||
if (archivePath.endsWith('.zip')) { | ||
@@ -26,0 +30,0 @@ await extractZip(archivePath, {dir: folderPath}); |
@@ -193,8 +193,12 @@ /** | ||
} | ||
const url = version.downloads[options.browser]?.find(link => { | ||
const backupUrl = version.downloads[options.browser]?.find(link => { | ||
return link['platform'] === platform; | ||
})?.url; | ||
if (url) { | ||
debugInstall(`Falling back to downloading from ${url}.`); | ||
return await installUrl(new URL(url), options); | ||
if (backupUrl) { | ||
// If the URL is the same, skip the retry. | ||
if (backupUrl === url.toString()) { | ||
throw err; | ||
} | ||
debugInstall(`Falling back to downloading from ${backupUrl}.`); | ||
return await installUrl(new URL(backupUrl), options); | ||
} | ||
@@ -201,0 +205,0 @@ throw err; |
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
518479
0.38%9527
0.25%82
7.89%