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

find-chrome-bin

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-chrome-bin - npm Package Compare versions

Comparing version 1.0.5 to 2.0.0

5

CHANGELOG.md

@@ -5,2 +5,7 @@ # Change Log

## 2.0.0
- Dropped support for CommonJS
- Switched to using @puppeteer/browsers to download the browser
## 1.0.5

@@ -7,0 +12,0 @@

12

index.js

@@ -1,7 +0,7 @@

const { isSuitableVersion, chromeVersion, downloadChromium } = require('./src/chrome')
const { findChromeBinaryOnDarwin } = require('./src/darwin')
const { findChromeBinaryOnLinux } = require('./src/linux')
const { findChromeBinaryOnWin32 } = require('./src/win32')
import { isSuitableVersion, chromeVersion, downloadChromium } from './src/chrome/index.js'
import { findChromeBinaryOnDarwin } from './src/darwin/index.js'
import { findChromeBinaryOnLinux } from './src/linux/index.js'
import { findChromeBinaryOnWin32 } from './src/win32/index.js'
async function findChrome({ min, max, download: { puppeteer, path, revision } = {} } = {}) {
export async function findChrome({ min, max, download: { puppeteer, path, revision } = {} } = {}) {
try {

@@ -56,3 +56,1 @@ let executablePath = findChromeBinaryPath()

}
module.exports = { findChrome }
{
"name": "find-chrome-bin",
"version": "1.0.5",
"version": "2.0.0",
"description": "Finds local Chromium binary to use it with puppeteer-core",

@@ -17,4 +17,5 @@ "keywords": [

"engines": {
"node": ">=14.0.0"
"node": ">=18.0.0"
},
"type": "module",
"types": "./index.d.ts",

@@ -26,18 +27,21 @@ "scripts": {

},
"dependencies": {
"@puppeteer/browsers": "^1.8.0"
},
"devDependencies": {
"@logux/eslint-config": "^49.0.0",
"@size-limit/preset-small-lib": "^8.2.4",
"check-dts": "^0.7.1",
"eslint": "^8.36.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.6.1",
"@logux/eslint-config": "^52.0.2",
"@size-limit/preset-small-lib": "^11.0.0",
"check-dts": "^0.7.2",
"eslint": "^8.54.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-n": "^16.3.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prefer-let": "^3.0.1",
"eslint-plugin-promise": "^6.1.1",
"nanospy": "^0.5.0",
"puppeteer-core": "^19.8.0",
"size-limit": "^8.2.4",
"nanospy": "^1.0.0",
"puppeteer-core": "^21.5.2",
"size-limit": "^11.0.0",
"tsm": "^2.3.0",
"typescript": "^5.0.2",
"typescript": "^5.3.2",
"uvu": "^0.5.6"

@@ -44,0 +48,0 @@ },

@@ -1,7 +0,12 @@

const { execSync } = require('child_process')
import { execSync } from 'child_process'
import { install } from '@puppeteer/browsers'
const { MIN_CHROME_VERSION, MAX_CHROME_VERSION } = require('../utils')
const { getWin32ChromeVersionInfo } = require('../win32')
import { MIN_CHROME_VERSION, MAX_CHROME_VERSION } from '../utils/index.js'
import { getWin32ChromeVersionInfo } from '../win32/index.js'
function isSuitableVersion(executablePath, min = MIN_CHROME_VERSION, max = MAX_CHROME_VERSION) {
export function isSuitableVersion(
executablePath,
min = MIN_CHROME_VERSION,
max = MAX_CHROME_VERSION
) {
if (min > max) {

@@ -37,3 +42,3 @@ throw new Error(

function chromeVersion(executablePath) {
export function chromeVersion(executablePath) {
return (

@@ -46,25 +51,13 @@ process.platform === 'win32'

async function downloadChromium(puppeteer, path, revision) {
export async function downloadChromium(puppeteer, path, revision) {
try {
let downloadHost =
process.env.PUPPETEER_DOWNLOAD_HOST ||
process.env.npm_config_puppeteer_download_host ||
process.env.npm_package_config_puppeteer_download_host
const config = {
buildId: revision,
browser: 'chrome',
unpack: true,
cacheDir: path
}
let browserFetcher = new puppeteer.BrowserFetcher({ path, host: downloadHost })
let newRevisionInfo = await install(config)
let revisionInfo = browserFetcher.revisionInfo(revision)
// If already downloaded
if (revisionInfo.local) return revisionInfo
let newRevisionInfo = await browserFetcher.download(revisionInfo.revision)
let localRevisions = await browserFetcher.localRevisions()
localRevisions = localRevisions.filter(r => r !== revisionInfo.revision)
// Remove previous revisions
let cleanupOldVersions = localRevisions.map(r => browserFetcher.remove(r))
await Promise.all(cleanupOldVersions)
return newRevisionInfo

@@ -76,3 +69,1 @@ } catch (error) {

}
module.exports = { isSuitableVersion, chromeVersion, downloadChromium }

@@ -1,7 +0,7 @@

const { join } = require('path')
const { execSync } = require('child_process')
import { join } from 'path'
import { execSync } from 'child_process'
const { newLineRegex, canAccess } = require('../utils')
import { newLineRegex, canAccess } from '../utils/index.js'
function findChromeBinaryOnDarwin(canary) {
export function findChromeBinaryOnDarwin(canary) {
let LSREGISTER =

@@ -37,3 +37,1 @@ '/System/Library/Frameworks/CoreServices.framework' +

}
module.exports = { findChromeBinaryOnDarwin }

@@ -1,8 +0,8 @@

const { join } = require('path')
const { execSync, execFileSync } = require('child_process')
const { homedir } = require('os')
import { join } from 'path'
import { execSync, execFileSync } from 'child_process'
import { homedir } from 'os'
const { newLineRegex, canAccess } = require('../utils')
import { newLineRegex, canAccess } from '../utils/index.js'
function findChromeBinaryOnLinux() {
export function findChromeBinaryOnLinux() {
let installations = []

@@ -96,3 +96,1 @@

}
module.exports = { findChromeBinaryOnLinux }

@@ -1,10 +0,10 @@

const { accessSync } = require('fs')
import { accessSync } from 'fs'
const MIN_CHROME_VERSION = 85
export const MIN_CHROME_VERSION = 85
const MAX_CHROME_VERSION = Number.MAX_VALUE
export const MAX_CHROME_VERSION = Number.MAX_VALUE
const newLineRegex = /\r?\n/
export const newLineRegex = /\r?\n/
function canAccess(file) {
export function canAccess(file) {
if (!file) {

@@ -21,8 +21,1 @@ return false

}
module.exports = {
MIN_CHROME_VERSION,
MAX_CHROME_VERSION,
newLineRegex,
canAccess
}

@@ -1,7 +0,7 @@

const { sep, join } = require('path')
const { execSync } = require('child_process')
import { sep, join } from 'path'
import { execSync } from 'child_process'
const { canAccess } = require('../utils')
import { canAccess } from '../utils/index.js'
function findChromeBinaryOnWin32(canary) {
export function findChromeBinaryOnWin32(canary) {
let suffix = canary

@@ -27,3 +27,3 @@ ? `${sep}Google${sep}Chrome SxS${sep}Application${sep}chrome.exe`

function getWin32ChromeVersionInfo(executablePath) {
export function getWin32ChromeVersionInfo(executablePath) {
let executablePathForNode = executablePath.replace(/\\/g, '\\\\')

@@ -67,3 +67,1 @@ let wmiResult = execSync(

}
module.exports = { findChromeBinaryOnWin32, getWin32ChromeVersionInfo }

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