You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@puppeteer/browsers

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.2.0

8

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

@@ -99,8 +99,10 @@ "use strict";

case types_js_1.BrowserTag.LATEST:
return await chromedriver.resolveBuildId('latest');
case types_js_1.BrowserTag.CANARY:
return await chromedriver.resolveBuildId(types_js_1.ChromeReleaseChannel.CANARY);
case types_js_1.BrowserTag.BETA:
case types_js_1.BrowserTag.CANARY:
return await chromedriver.resolveBuildId(types_js_1.ChromeReleaseChannel.BETA);
case types_js_1.BrowserTag.DEV:
return await chromedriver.resolveBuildId(types_js_1.ChromeReleaseChannel.DEV);
case types_js_1.BrowserTag.STABLE:
throw new Error(`${tag} is not support for ${browser}`);
return await chromedriver.resolveBuildId(types_js_1.ChromeReleaseChannel.STABLE);
}

@@ -107,0 +109,0 @@ case types_js_1.Browser.CHROMIUM:

@@ -1,21 +0,6 @@

/**
* Copyright 2023 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BrowserPlatform } from './types.js';
import { BrowserPlatform, ChromeReleaseChannel } from './types.js';
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(_channel?: 'latest'): Promise<string>;
export declare function resolveBuildId(channel: ChromeReleaseChannel): Promise<string>;
//# sourceMappingURL=chromedriver.d.ts.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveBuildId = exports.relativeExecutablePath = exports.resolveDownloadPath = exports.resolveDownloadUrl = void 0;
/**

@@ -17,20 +22,20 @@ * Copyright 2023 Google Inc. All rights reserved.

*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveBuildId = exports.relativeExecutablePath = exports.resolveDownloadPath = exports.resolveDownloadUrl = void 0;
const httpUtil_js_1 = require("../httpUtil.js");
const path_1 = __importDefault(require("path"));
const chrome_js_1 = require("./chrome.js");
const types_js_1 = require("./types.js");
function archive(platform) {
function folder(platform) {
switch (platform) {
case types_js_1.BrowserPlatform.LINUX:
return 'chromedriver_linux64';
return 'linux64';
case types_js_1.BrowserPlatform.MAC_ARM:
return 'chromedriver_mac_arm64';
return 'mac-arm64';
case types_js_1.BrowserPlatform.MAC:
return 'chromedriver_mac64';
return 'mac-x64';
case types_js_1.BrowserPlatform.WIN32:
return 'win32';
case types_js_1.BrowserPlatform.WIN64:
return 'chromedriver_win32';
return 'win64';
}
}
function resolveDownloadUrl(platform, buildId, baseUrl = 'https://chromedriver.storage.googleapis.com') {
function resolveDownloadUrl(platform, buildId, baseUrl = 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing') {
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;

@@ -40,3 +45,3 @@ }

function resolveDownloadPath(platform, buildId) {
return [buildId, `${archive(platform)}.zip`];
return [buildId, folder(platform), `chromedriver-${folder(platform)}.zip`];
}

@@ -48,35 +53,15 @@ exports.resolveDownloadPath = resolveDownloadPath;

case types_js_1.BrowserPlatform.MAC_ARM:
return path_1.default.join('chromedriver-' + folder(platform), 'chromedriver');
case types_js_1.BrowserPlatform.LINUX:
return 'chromedriver';
return path_1.default.join('chromedriver-linux64', 'chromedriver');
case types_js_1.BrowserPlatform.WIN32:
case types_js_1.BrowserPlatform.WIN64:
return 'chromedriver.exe';
return path_1.default.join('chromedriver-' + folder(platform), 'chromedriver.exe');
}
}
exports.relativeExecutablePath = relativeExecutablePath;
async function resolveBuildId(_channel = 'latest') {
return new Promise((resolve, reject) => {
const request = (0, httpUtil_js_1.httpRequest)(new URL(`https://chromedriver.storage.googleapis.com/LATEST_RELEASE`), 'GET', response => {
let data = '';
if (response.statusCode && response.statusCode >= 400) {
return reject(new Error(`Got status code ${response.statusCode}`));
}
response.on('data', chunk => {
data += chunk;
});
response.on('end', () => {
try {
return resolve(String(data));
}
catch {
return reject(new Error('Chrome version not found'));
}
});
}, false);
request.on('error', err => {
reject(err);
});
});
async function resolveBuildId(channel) {
return (await (0, chrome_js_1.getLastKnownGoodReleaseForChannel)(channel)).version;
}
exports.resolveBuildId = resolveBuildId;
//# sourceMappingURL=chromedriver.js.map

@@ -60,25 +60,8 @@ "use strict";

async function resolveBuildId(channel = 'FIREFOX_NIGHTLY') {
return new Promise((resolve, reject) => {
const request = (0, httpUtil_js_1.httpRequest)(new URL('https://product-details.mozilla.org/1.0/firefox_versions.json'), 'GET', response => {
let data = '';
if (response.statusCode && response.statusCode >= 400) {
return reject(new Error(`Got status code ${response.statusCode}`));
}
response.on('data', chunk => {
data += chunk;
});
response.on('end', () => {
try {
const versions = JSON.parse(data);
return resolve(versions[channel]);
}
catch {
return reject(new Error('Firefox version not found'));
}
});
}, false);
request.on('error', err => {
reject(err);
});
});
const versions = (await (0, httpUtil_js_1.getJSON)(new URL('https://product-details.mozilla.org/1.0/firefox_versions.json')));
const version = versions[channel];
if (!version) {
throw new Error(`Channel ${channel} is not found.`);
}
return version;
}

@@ -85,0 +68,0 @@ exports.resolveBuildId = resolveBuildId;

@@ -71,8 +71,10 @@ /**

case BrowserTag.LATEST:
return await chromedriver.resolveBuildId('latest');
case BrowserTag.CANARY:
return await chromedriver.resolveBuildId(ChromeReleaseChannel.CANARY);
case BrowserTag.BETA:
case BrowserTag.CANARY:
return await chromedriver.resolveBuildId(ChromeReleaseChannel.BETA);
case BrowserTag.DEV:
return await chromedriver.resolveBuildId(ChromeReleaseChannel.DEV);
case BrowserTag.STABLE:
throw new Error(`${tag} is not support for ${browser}`);
return await chromedriver.resolveBuildId(ChromeReleaseChannel.STABLE);
}

@@ -79,0 +81,0 @@ case Browser.CHROMIUM:

@@ -1,21 +0,6 @@

/**
* Copyright 2023 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BrowserPlatform } from './types.js';
import { BrowserPlatform, ChromeReleaseChannel } from './types.js';
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(_channel?: 'latest'): Promise<string>;
export declare function resolveBuildId(channel: ChromeReleaseChannel): Promise<string>;
//# sourceMappingURL=chromedriver.d.ts.map

@@ -16,22 +16,24 @@ /**

*/
import { httpRequest } from '../httpUtil.js';
import path from 'path';
import { getLastKnownGoodReleaseForChannel } from './chrome.js';
import { BrowserPlatform } from './types.js';
function archive(platform) {
function folder(platform) {
switch (platform) {
case BrowserPlatform.LINUX:
return 'chromedriver_linux64';
return 'linux64';
case BrowserPlatform.MAC_ARM:
return 'chromedriver_mac_arm64';
return 'mac-arm64';
case BrowserPlatform.MAC:
return 'chromedriver_mac64';
return 'mac-x64';
case BrowserPlatform.WIN32:
return 'win32';
case BrowserPlatform.WIN64:
return 'chromedriver_win32';
return 'win64';
}
}
export function resolveDownloadUrl(platform, buildId, baseUrl = 'https://chromedriver.storage.googleapis.com') {
export function resolveDownloadUrl(platform, buildId, baseUrl = 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing') {
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
}
export function resolveDownloadPath(platform, buildId) {
return [buildId, `${archive(platform)}.zip`];
return [buildId, folder(platform), `chromedriver-${folder(platform)}.zip`];
}

@@ -42,33 +44,13 @@ export function relativeExecutablePath(platform, _buildId) {

case BrowserPlatform.MAC_ARM:
return path.join('chromedriver-' + folder(platform), 'chromedriver');
case BrowserPlatform.LINUX:
return 'chromedriver';
return path.join('chromedriver-linux64', 'chromedriver');
case BrowserPlatform.WIN32:
case BrowserPlatform.WIN64:
return 'chromedriver.exe';
return path.join('chromedriver-' + folder(platform), 'chromedriver.exe');
}
}
export async function resolveBuildId(_channel = 'latest') {
return new Promise((resolve, reject) => {
const request = httpRequest(new URL(`https://chromedriver.storage.googleapis.com/LATEST_RELEASE`), 'GET', response => {
let data = '';
if (response.statusCode && response.statusCode >= 400) {
return reject(new Error(`Got status code ${response.statusCode}`));
}
response.on('data', chunk => {
data += chunk;
});
response.on('end', () => {
try {
return resolve(String(data));
}
catch {
return reject(new Error('Chrome version not found'));
}
});
}, false);
request.on('error', err => {
reject(err);
});
});
export async function resolveBuildId(channel) {
return (await getLastKnownGoodReleaseForChannel(channel)).version;
}
//# sourceMappingURL=chromedriver.js.map

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

import path from 'path';
import { httpRequest } from '../httpUtil.js';
import { getJSON } from '../httpUtil.js';
import { BrowserPlatform } from './types.js';

@@ -52,25 +52,8 @@ function archive(platform, buildId) {

export async function resolveBuildId(channel = 'FIREFOX_NIGHTLY') {
return new Promise((resolve, reject) => {
const request = httpRequest(new URL('https://product-details.mozilla.org/1.0/firefox_versions.json'), 'GET', response => {
let data = '';
if (response.statusCode && response.statusCode >= 400) {
return reject(new Error(`Got status code ${response.statusCode}`));
}
response.on('data', chunk => {
data += chunk;
});
response.on('end', () => {
try {
const versions = JSON.parse(data);
return resolve(versions[channel]);
}
catch {
return reject(new Error('Firefox version not found'));
}
});
}, false);
request.on('error', err => {
reject(err);
});
});
const versions = (await getJSON(new URL('https://product-details.mozilla.org/1.0/firefox_versions.json')));
const version = versions[channel];
if (!version) {
throw new Error(`Channel ${channel} is not found.`);
}
return version;
}

@@ -77,0 +60,0 @@ export async function createProfile(options) {

{
"name": "@puppeteer/browsers",
"version": "1.1.0",
"version": "1.2.0",
"description": "Download and launch browsers",

@@ -5,0 +5,0 @@ "scripts": {

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc