chore: 更新学生档案数据
This commit is contained in:
16
node_modules/.bin/browsers
generated
vendored
Normal file
16
node_modules/.bin/browsers
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../@puppeteer/browsers/lib/main-cli.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../@puppeteer/browsers/lib/main-cli.js" "$@"
|
||||
fi
|
||||
17
node_modules/.bin/browsers.cmd
generated
vendored
Normal file
17
node_modules/.bin/browsers.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@puppeteer\browsers\lib\main-cli.js" %*
|
||||
28
node_modules/.bin/browsers.ps1
generated
vendored
Normal file
28
node_modules/.bin/browsers.ps1
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../@puppeteer/browsers/lib/main-cli.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../@puppeteer/browsers/lib/main-cli.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../@puppeteer/browsers/lib/main-cli.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../@puppeteer/browsers/lib/main-cli.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
16
node_modules/.bin/puppeteer
generated
vendored
Normal file
16
node_modules/.bin/puppeteer
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../puppeteer/lib/puppeteer/node/cli.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../puppeteer/lib/puppeteer/node/cli.js" "$@"
|
||||
fi
|
||||
17
node_modules/.bin/puppeteer.cmd
generated
vendored
Normal file
17
node_modules/.bin/puppeteer.cmd
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\puppeteer\lib\puppeteer\node\cli.js" %*
|
||||
28
node_modules/.bin/puppeteer.ps1
generated
vendored
Normal file
28
node_modules/.bin/puppeteer.ps1
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../puppeteer/lib/puppeteer/node/cli.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../puppeteer/lib/puppeteer/node/cli.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../puppeteer/lib/puppeteer/node/cli.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../puppeteer/lib/puppeteer/node/cli.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
564
node_modules/.package-lock.json
generated
vendored
564
node_modules/.package-lock.json
generated
vendored
@@ -1,350 +1,318 @@
|
||||
{
|
||||
"name": "ClassFeedback",
|
||||
"name": "02-ClassFeedback",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/agent-base": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/agent-base/-/agent-base-6.0.2.tgz",
|
||||
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
|
||||
"license": "MIT",
|
||||
"node_modules/@puppeteer/browsers": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmmirror.com/@puppeteer/browsers/-/browsers-3.0.5.tgz",
|
||||
"integrity": "sha512-xYXNuEQmHNIPWWcbL/skf2KF7seyp7c1xmKFRk3wmdFx7VwBsKVrtOLKs8ecaezsKPsWeF1YsgwIiElAscaryA==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"debug": "4"
|
||||
"modern-tar": "^0.7.6",
|
||||
"yargs": "^18.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"browsers": "lib/main-cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.16.1",
|
||||
"resolved": "https://registry.npmmirror.com/axios/-/axios-1.16.1.tgz",
|
||||
"integrity": "sha512-caYkukvroVPO8KrzuJEb50Hm07KwfBZPEC3VeFHTsqWHvKTsy54hjJz9BS/cdaypROE2rH6xvm9mHX4fgWkr3A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.16.0",
|
||||
"form-data": "^4.0.5",
|
||||
"https-proxy-agent": "^5.0.1",
|
||||
"proxy-from-env": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bind-apply-helpers": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2"
|
||||
"node": ">=22.12.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.4.3",
|
||||
"resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.3.tgz",
|
||||
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
"peerDependencies": {
|
||||
"proxy-agent": ">=8.0.1"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"proxy-agent": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||
"node_modules/ansi-regex": {
|
||||
"version": "6.2.2",
|
||||
"resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-6.2.2.tgz",
|
||||
"integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/dotenv": {
|
||||
"version": "17.4.2",
|
||||
"resolved": "https://registry.npmmirror.com/dotenv/-/dotenv-17.4.2.tgz",
|
||||
"integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==",
|
||||
"license": "BSD-2-Clause",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://dotenvx.com"
|
||||
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||
"node_modules/ansi-styles": {
|
||||
"version": "6.2.3",
|
||||
"resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-6.2.3.tgz",
|
||||
"integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/chromium-bidi": {
|
||||
"version": "16.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/chromium-bidi/-/chromium-bidi-16.0.1.tgz",
|
||||
"integrity": "sha512-J63PGu/9PpeCwLIcKYyzWP6yaVL5pxuBc0shlYCYM8BaAkmlwiQboXO1iNbOgSDbVklEyYFfNEcHD8oOAWacUA==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"gopd": "^1.2.0"
|
||||
"mitt": "^3.0.1",
|
||||
"zod": "^3.24.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
"node": ">=20.19.0 <22.0.0 || >=22.12.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"devtools-protocol": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/es-define-property": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-errors": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-object-atoms": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
||||
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
||||
"license": "MIT",
|
||||
"node_modules/cliui": {
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/cliui/-/cliui-9.0.1.tgz",
|
||||
"integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0"
|
||||
"string-width": "^7.2.0",
|
||||
"strip-ansi": "^7.1.0",
|
||||
"wrap-ansi": "^9.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
"node": ">=20"
|
||||
}
|
||||
},
|
||||
"node_modules/es-set-tostringtag": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
|
||||
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
|
||||
"node_modules/devtools-protocol": {
|
||||
"version": "0.0.1638949",
|
||||
"resolved": "https://registry.npmmirror.com/devtools-protocol/-/devtools-protocol-0.0.1638949.tgz",
|
||||
"integrity": "sha512-mXwg4Fqnv0WR4iuAT/gYUmctNkjILwXFHyZ+m7Ty1dfr0ezZt2U3gnrrJTfRobJTHoXf+IbuFvFITzLrLFjwJA==",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/emoji-regex": {
|
||||
"version": "10.6.0",
|
||||
"resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-10.6.0.tgz",
|
||||
"integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/escalade": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/escalade/-/escalade-3.2.0.tgz",
|
||||
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/get-caller-file": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmmirror.com/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "6.* || 8.* || >= 10.*"
|
||||
}
|
||||
},
|
||||
"node_modules/get-east-asian-width": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmmirror.com/get-east-asian-width/-/get-east-asian-width-1.6.0.tgz",
|
||||
"integrity": "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/lilconfig": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmmirror.com/lilconfig/-/lilconfig-3.1.3.tgz",
|
||||
"integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/antonk52"
|
||||
}
|
||||
},
|
||||
"node_modules/mitt": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/mitt/-/mitt-3.0.1.tgz",
|
||||
"integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/modern-tar": {
|
||||
"version": "0.7.6",
|
||||
"resolved": "https://registry.npmmirror.com/modern-tar/-/modern-tar-0.7.6.tgz",
|
||||
"integrity": "sha512-sweCIVXzx1aIGTCdzcMlSZt1h8k5Tmk08VNAuRk3IU28XamGiOH5ypi11g6De2CH7PhYqSSnGy2A/EFhbWnVKg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/puppeteer": {
|
||||
"version": "25.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/puppeteer/-/puppeteer-25.2.1.tgz",
|
||||
"integrity": "sha512-2D5RMkQH9FRhDU57a1/jV9xWoxqZvUjaZOYjAAPdRCEY8A01V5sxzyGOMs8XiKU9fPF91SOSwNYpHRu5SD958g==",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.6",
|
||||
"has-tostringtag": "^1.0.2",
|
||||
"hasown": "^2.0.2"
|
||||
"@puppeteer/browsers": "3.0.5",
|
||||
"chromium-bidi": "16.0.1",
|
||||
"devtools-protocol": "0.0.1638949",
|
||||
"lilconfig": "^3.1.3",
|
||||
"puppeteer-core": "25.2.1",
|
||||
"typed-query-selector": "^2.12.2"
|
||||
},
|
||||
"bin": {
|
||||
"puppeteer": "lib/puppeteer/node/cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
"node": ">=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.16.0",
|
||||
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.16.0.tgz",
|
||||
"integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||
}
|
||||
],
|
||||
"node_modules/puppeteer-core": {
|
||||
"version": "25.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/puppeteer-core/-/puppeteer-core-25.2.1.tgz",
|
||||
"integrity": "sha512-MwEZ4FFGJ1ZLOmu/04eISxoEMKtCnHyJBRFfgpwPPSYNG6gT6Xw1laNziFSV7uwDcx3jK+ATYIo9SfOd8Uhc3w==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@puppeteer/browsers": "3.0.5",
|
||||
"chromium-bidi": "16.0.1",
|
||||
"devtools-protocol": "0.0.1638949",
|
||||
"typed-query-selector": "^2.12.2",
|
||||
"webdriver-bidi-protocol": "0.4.2",
|
||||
"ws": "^8.21.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/string-width": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/string-width/-/string-width-7.2.0.tgz",
|
||||
"integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"emoji-regex": "^10.3.0",
|
||||
"get-east-asian-width": "^1.0.0",
|
||||
"strip-ansi": "^7.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-ansi": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-7.2.0.tgz",
|
||||
"integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^6.2.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/typed-query-selector": {
|
||||
"version": "2.12.2",
|
||||
"resolved": "https://registry.npmmirror.com/typed-query-selector/-/typed-query-selector-2.12.2.tgz",
|
||||
"integrity": "sha512-EOPFbyIub4ngnEdqi2yOcNeDLaX/0jcE1JoAXQDDMIthap7FoN795lc/SHfIq2d416VufXpM8z/lD+WRm2gfOQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/webdriver-bidi-protocol": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmmirror.com/webdriver-bidi-protocol/-/webdriver-bidi-protocol-0.4.2.tgz",
|
||||
"integrity": "sha512-VSV+fzfChirL3e7jay2yUC7B4HQCGtEWEg/MSSQbK+qWbqeGlRLlXTzPpYr3XGUvbpDHumWZBJxgesg4N7dbtA==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/wrap-ansi": {
|
||||
"version": "9.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-9.0.2.tgz",
|
||||
"integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^6.2.1",
|
||||
"string-width": "^7.0.0",
|
||||
"strip-ansi": "^7.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.21.0",
|
||||
"resolved": "https://registry.npmmirror.com/ws/-/ws-8.21.0.tgz",
|
||||
"integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": ">=5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"debug": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/form-data": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.5.tgz",
|
||||
"integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"es-set-tostringtag": "^2.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"es-define-property": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"es-object-atoms": "^1.1.1",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-proto": "^1.0.1",
|
||||
"gopd": "^1.2.0",
|
||||
"has-symbols": "^1.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"math-intrinsics": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dunder-proto": "^1.0.1",
|
||||
"es-object-atoms": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz",
|
||||
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-tostringtag": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
|
||||
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"has-symbols": "^1.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.3.tgz",
|
||||
"integrity": "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/https-proxy-agent": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
|
||||
"integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"agent-base": "6",
|
||||
"debug": "4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/proxy-from-env": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-2.1.0.tgz",
|
||||
"integrity": "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==",
|
||||
"license": "MIT",
|
||||
"node_modules/y18n": {
|
||||
"version": "5.0.8",
|
||||
"resolved": "https://registry.npmmirror.com/y18n/-/y18n-5.0.8.tgz",
|
||||
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/yargs": {
|
||||
"version": "18.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/yargs/-/yargs-18.0.0.tgz",
|
||||
"integrity": "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cliui": "^9.0.1",
|
||||
"escalade": "^3.1.1",
|
||||
"get-caller-file": "^2.0.5",
|
||||
"string-width": "^7.2.0",
|
||||
"y18n": "^5.0.5",
|
||||
"yargs-parser": "^22.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || ^22.12.0 || >=23"
|
||||
}
|
||||
},
|
||||
"node_modules/yargs-parser": {
|
||||
"version": "22.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/yargs-parser/-/yargs-parser-22.0.0.tgz",
|
||||
"integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "^20.19.0 || ^22.12.0 || >=23"
|
||||
}
|
||||
},
|
||||
"node_modules/zod": {
|
||||
"version": "3.25.76",
|
||||
"resolved": "https://registry.npmmirror.com/zod/-/zod-3.25.76.tgz",
|
||||
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
186
node_modules/@puppeteer/browsers/README.md
generated
vendored
Normal file
186
node_modules/@puppeteer/browsers/README.md
generated
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
# @puppeteer/browsers
|
||||
|
||||
Manage and launch browsers/drivers from a CLI or programmatically.
|
||||
|
||||
## System requirements
|
||||
|
||||
- A compatible Node version (see `engines` in `package.json`).
|
||||
- For Firefox downloads:
|
||||
- Linux builds: `xz` and `bzip2` utilities are required to unpack `.tar.gz` and `.tar.bz2` archives.
|
||||
- MacOS builds: `hdiutil` is required to unpack `.dmg` archives.
|
||||
- For Chrome downloads:
|
||||
- On Linux/MacOS: `unzip`.
|
||||
- On Windows: `tar.exe`.
|
||||
|
||||
## CLI
|
||||
|
||||
Use `npx` to run the CLI:
|
||||
|
||||
```bash
|
||||
# This will install and run the @puppeteer/browsers package.
|
||||
# If it is already installed in the current directory, the installed
|
||||
# version will be used.
|
||||
npx @puppeteer/browsers --help
|
||||
```
|
||||
|
||||
Built-in per-command `help` will provide all documentation you need to use the CLI.
|
||||
|
||||
```bash
|
||||
npx @puppeteer/browsers --help # help for all commands
|
||||
npx @puppeteer/browsers install --help # help for the install command
|
||||
npx @puppeteer/browsers launch --help # help for the launch command
|
||||
npx @puppeteer/browsers clear --help # help for the clear command
|
||||
npx @puppeteer/browsers list --help # help for the list command
|
||||
```
|
||||
|
||||
You can specify the version of the `@puppeteer/browsers` when using
|
||||
`npx`:
|
||||
|
||||
```bash
|
||||
# Always install and use the latest version from the registry.
|
||||
npx @puppeteer/browsers@latest --help
|
||||
# Always use a specifc version.
|
||||
npx @puppeteer/browsers@2.4.1 --help
|
||||
# Always install the latest version and automatically confirm the installation.
|
||||
npx --yes @puppeteer/browsers@latest --help
|
||||
```
|
||||
|
||||
To clear all installed browsers, use the `clear` command:
|
||||
|
||||
```bash
|
||||
npx @puppeteer/browsers clear
|
||||
```
|
||||
|
||||
To list all installed browsers, use the `list` command:
|
||||
|
||||
```bash
|
||||
npx @puppeteer/browsers list
|
||||
```
|
||||
|
||||
Some example to give an idea of what the CLI looks like (use the `--help` command for more examples):
|
||||
|
||||
```sh
|
||||
# Download the latest available Chrome for Testing binary corresponding to the Stable channel.
|
||||
npx @puppeteer/browsers install chrome@stable
|
||||
|
||||
# Download a specific Chrome for Testing version.
|
||||
npx @puppeteer/browsers install chrome@116.0.5793.0
|
||||
|
||||
# Download the latest Chrome for Testing version for the given milestone.
|
||||
npx @puppeteer/browsers install chrome@117
|
||||
|
||||
# Download the latest available ChromeDriver version corresponding to the Canary channel.
|
||||
npx @puppeteer/browsers install chromedriver@canary
|
||||
|
||||
# Download a specific ChromeDriver version.
|
||||
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
|
||||
```
|
||||
|
||||
## Known limitations
|
||||
|
||||
1. Launching the system browsers is only possible for Chrome/Chromium.
|
||||
|
||||
## Proxies
|
||||
|
||||
The library and CLI respect `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY` environment variables. For them to work, you must have the `proxy-agent` package installed:
|
||||
|
||||
```bash
|
||||
npm install proxy-agent
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
To enable verbose logging for `@puppeteer/browsers` operations (like download progress, installation steps, and launching parameters), use Node.js's built-in `NODE_DEBUG` environment variable.
|
||||
|
||||
```bash
|
||||
env NODE_DEBUG="puppeteer:browsers:*" npx @puppeteer/browsers install chrome@stable
|
||||
```
|
||||
|
||||
The following debug channels are available:
|
||||
|
||||
- `puppeteer:browsers:cache`: Caching operations.
|
||||
- `puppeteer:browsers:fileUtil`: Decompressing and other file utility operations.
|
||||
- `puppeteer:browsers:install`: Download and install progress.
|
||||
- `puppeteer:browsers:launcher`: Browser launching parameters and process state.
|
||||
|
||||
## Custom Providers
|
||||
|
||||
You can implement custom browser providers to download from alternative sources like corporate mirrors, private repositories, or specialized browser builds.
|
||||
|
||||
```typescript
|
||||
import {
|
||||
BrowserProvider,
|
||||
DownloadOptions,
|
||||
Browser,
|
||||
BrowserPlatform,
|
||||
} from '@puppeteer/browsers';
|
||||
|
||||
class SimpleMirrorProvider implements BrowserProvider {
|
||||
constructor(private mirrorUrl: string) {}
|
||||
|
||||
supports(options: DownloadOptions): boolean {
|
||||
return options.browser === Browser.CHROME;
|
||||
}
|
||||
|
||||
getDownloadUrl(options: DownloadOptions): URL | null {
|
||||
const {buildId, platform} = options;
|
||||
const filenameMap = {
|
||||
[BrowserPlatform.LINUX]: 'chrome-linux64.zip',
|
||||
[BrowserPlatform.MAC]: 'chrome-mac-x64.zip',
|
||||
[BrowserPlatform.MAC_ARM]: 'chrome-mac-arm64.zip',
|
||||
[BrowserPlatform.WIN32]: 'chrome-win32.zip',
|
||||
[BrowserPlatform.WIN64]: 'chrome-win64.zip',
|
||||
};
|
||||
const filename = filenameMap[platform];
|
||||
if (!filename) return null;
|
||||
return new URL(`${this.mirrorUrl}/chrome/${buildId}/${filename}`);
|
||||
}
|
||||
|
||||
getExecutablePath(options: DownloadOptions): string {
|
||||
const {platform} = options;
|
||||
if (
|
||||
platform === BrowserPlatform.MAC ||
|
||||
platform === BrowserPlatform.MAC_ARM
|
||||
) {
|
||||
return 'chrome-mac/Chromium.app/Contents/MacOS/Chromium';
|
||||
} else if (platform === BrowserPlatform.LINUX) {
|
||||
return 'chrome-linux64/chrome';
|
||||
} else if (platform.includes('win')) {
|
||||
return 'chrome-win64/chrome.exe';
|
||||
}
|
||||
throw new Error(`Unsupported platform: ${platform}`);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Use with the `install` API:
|
||||
|
||||
```typescript
|
||||
import {install} from '@puppeteer/browsers';
|
||||
|
||||
const customProvider = new SimpleMirrorProvider('https://internal.company.com');
|
||||
|
||||
await install({
|
||||
browser: Browser.CHROME,
|
||||
buildId: '120.0.6099.109',
|
||||
platform: BrowserPlatform.LINUX,
|
||||
cacheDir: '/tmp/puppeteer-cache',
|
||||
providers: [customProvider],
|
||||
});
|
||||
```
|
||||
|
||||
Multiple providers can be chained - they're tried in order until one succeeds, with a default provider such as Chrome for Testing, as an automatic fallback.
|
||||
|
||||
:::caution
|
||||
Custom providers are NOT officially supported by Puppeteer. You accept full responsibility for binary compatibility, testing, and maintenance.
|
||||
:::
|
||||
|
||||
## API
|
||||
|
||||
The programmatic API allows installing and launching browsers from your code. See the `test` folder for examples on how to use the `install`, `canInstall`, `launch`, `computeExecutablePath`, `computeSystemExecutablePath`, and other methods.
|
||||
29
node_modules/@puppeteer/browsers/lib/CLI.d.ts
generated
vendored
Normal file
29
node_modules/@puppeteer/browsers/lib/CLI.d.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import * as readline from 'node:readline';
|
||||
import { Browser } from './browser-data/browser-data.js';
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare class CLI {
|
||||
#private;
|
||||
constructor(opts?: string | {
|
||||
cachePath?: string;
|
||||
scriptName?: string;
|
||||
version?: string;
|
||||
prefixCommand?: {
|
||||
cmd: string;
|
||||
description: string;
|
||||
};
|
||||
allowCachePathOverride?: boolean;
|
||||
pinnedBrowsers?: Partial<Record<Browser, {
|
||||
buildId: string;
|
||||
skipDownload: boolean;
|
||||
}>>;
|
||||
}, rl?: readline.Interface);
|
||||
run(argv: string[]): Promise<void>;
|
||||
}
|
||||
//# sourceMappingURL=CLI.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/CLI.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/CLI.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"CLI.d.ts","sourceRoot":"","sources":["../src/CLI.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAI1C,OAAO,EACL,OAAO,EAIR,MAAM,gCAAgC,CAAC;AAoCxC;;GAEG;AACH,qBAAa,GAAG;;gBAkBZ,IAAI,CAAC,EACD,MAAM,GACN;QACE,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAA;SAAC,CAAC;QACnD,sBAAsB,CAAC,EAAE,OAAO,CAAC;QACjC,cAAc,CAAC,EAAE,OAAO,CACtB,MAAM,CACJ,OAAO,EACP;YACE,OAAO,EAAE,MAAM,CAAC;YAChB,YAAY,EAAE,OAAO,CAAC;SACvB,CACF,CACF,CAAC;KACH,EACL,EAAE,CAAC,EAAE,QAAQ,CAAC,SAAS;IA+EnB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAyezC"}
|
||||
415
node_modules/@puppeteer/browsers/lib/CLI.js
generated
vendored
Normal file
415
node_modules/@puppeteer/browsers/lib/CLI.js
generated
vendored
Normal file
@@ -0,0 +1,415 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { spawn } from 'node:child_process';
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { stdin as input, stdout as output } from 'node:process';
|
||||
import * as readline from 'node:readline';
|
||||
import { Browser, resolveBuildId, BrowserPlatform, verifyChromeReleaseChannel, } from './browser-data/browser-data.js';
|
||||
import { Cache } from './Cache.js';
|
||||
import { detectBrowserPlatform } from './detectPlatform.js';
|
||||
import { install } from './install.js';
|
||||
import { computeExecutablePath, computeSystemExecutablePath, launch, } from './launch.js';
|
||||
function isValidBrowser(browser) {
|
||||
return Object.values(Browser).includes(browser);
|
||||
}
|
||||
function isValidPlatform(platform) {
|
||||
return Object.values(BrowserPlatform).includes(platform);
|
||||
}
|
||||
// If moved update release-please config
|
||||
// x-release-please-start-version
|
||||
const packageVersion = '3.0.5';
|
||||
// x-release-please-end
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export class CLI {
|
||||
#cachePath;
|
||||
#rl;
|
||||
#scriptName;
|
||||
#version;
|
||||
#allowCachePathOverride;
|
||||
#pinnedBrowsers;
|
||||
#prefixCommand;
|
||||
constructor(opts, rl) {
|
||||
if (!opts) {
|
||||
opts = {};
|
||||
}
|
||||
if (typeof opts === 'string') {
|
||||
opts = {
|
||||
cachePath: opts,
|
||||
};
|
||||
}
|
||||
this.#cachePath = opts.cachePath ?? process.cwd();
|
||||
this.#rl = rl;
|
||||
this.#scriptName = opts.scriptName ?? '@puppeteer/browsers';
|
||||
this.#version = opts.version ?? packageVersion;
|
||||
this.#allowCachePathOverride = opts.allowCachePathOverride ?? true;
|
||||
this.#pinnedBrowsers = opts.pinnedBrowsers;
|
||||
this.#prefixCommand = opts.prefixCommand;
|
||||
}
|
||||
#defineBrowserParameter(yargs, required) {
|
||||
return yargs.positional('browser', {
|
||||
description: 'Which browser to install <browser>[@<buildId|latest>]. `latest` will try to find the latest available build. `buildId` is a browser-specific identifier such as a version or a revision.',
|
||||
type: 'string',
|
||||
coerce: (opt) => {
|
||||
const browser = {
|
||||
name: this.#parseBrowser(opt),
|
||||
buildId: this.#parseBuildId(opt),
|
||||
};
|
||||
if (!isValidBrowser(browser.name)) {
|
||||
throw new Error(`Unsupported browser '${browser.name}'`);
|
||||
}
|
||||
return browser;
|
||||
},
|
||||
demandOption: required,
|
||||
});
|
||||
}
|
||||
#definePlatformParameter(yargs) {
|
||||
return yargs.option('platform', {
|
||||
type: 'string',
|
||||
desc: 'Platform that the binary needs to be compatible with.',
|
||||
choices: Object.values(BrowserPlatform),
|
||||
default: detectBrowserPlatform(),
|
||||
coerce: platform => {
|
||||
if (!isValidPlatform(platform)) {
|
||||
throw new Error(`Unsupported platform '${platform}'`);
|
||||
}
|
||||
return platform;
|
||||
},
|
||||
defaultDescription: 'Auto-detected',
|
||||
});
|
||||
}
|
||||
#definePathParameter(yargs, required = false) {
|
||||
if (!this.#allowCachePathOverride) {
|
||||
return yargs;
|
||||
}
|
||||
return yargs.option('path', {
|
||||
type: 'string',
|
||||
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',
|
||||
...(required ? {} : { default: process.cwd() }),
|
||||
demandOption: required,
|
||||
});
|
||||
}
|
||||
async run(argv) {
|
||||
const { default: yargs } = await import('yargs');
|
||||
const { hideBin } = await import('yargs/helpers');
|
||||
const yargsInstance = yargs(hideBin(argv));
|
||||
let target = yargsInstance
|
||||
.scriptName(this.#scriptName)
|
||||
.version(this.#version);
|
||||
if (this.#prefixCommand) {
|
||||
target = target.command(this.#prefixCommand.cmd, this.#prefixCommand.description, yargs => {
|
||||
return this.#build(yargs);
|
||||
});
|
||||
}
|
||||
else {
|
||||
target = this.#build(target);
|
||||
}
|
||||
await target
|
||||
.demandCommand(1)
|
||||
.help()
|
||||
.wrap(Math.min(120, yargsInstance.terminalWidth()))
|
||||
.parseAsync();
|
||||
}
|
||||
#build(yargs) {
|
||||
const latestOrPinned = this.#pinnedBrowsers ? 'pinned' : 'latest';
|
||||
// If there are pinned browsers allow the positional arg to be optional
|
||||
const browserArgType = this.#pinnedBrowsers ? '[browser]' : '<browser>';
|
||||
return yargs
|
||||
.command(`install ${browserArgType}`, '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 (see --format).', yargs => {
|
||||
if (this.#pinnedBrowsers) {
|
||||
yargs.example('$0 install', 'Install all pinned browsers');
|
||||
}
|
||||
yargs
|
||||
.example('$0 install chrome', `Install the ${latestOrPinned} available build of the Chrome browser.`)
|
||||
.example('$0 install chrome@latest', 'Install the latest available build for the Chrome browser.')
|
||||
.example('$0 install chrome@stable', 'Install the latest available build for the Chrome browser from the stable channel.')
|
||||
.example('$0 install chrome@beta', 'Install the latest available build for the Chrome browser from the beta channel.')
|
||||
.example('$0 install chrome@dev', 'Install the latest available build for the Chrome browser from the dev channel.')
|
||||
.example('$0 install chrome@canary', 'Install the latest available build for the Chrome Canary browser.')
|
||||
.example('$0 install chrome@115', 'Install the latest available build for Chrome 115.')
|
||||
.example('$0 install chromedriver@canary', 'Install the latest available build for ChromeDriver Canary.')
|
||||
.example('$0 install chromedriver@115', 'Install the latest available build for ChromeDriver 115.')
|
||||
.example('$0 install chromedriver@115.0.5790', 'Install the latest available patch (115.0.5790.X) build for ChromeDriver.')
|
||||
.example('$0 install chrome-headless-shell', 'Install the latest available chrome-headless-shell build.')
|
||||
.example('$0 install chrome-headless-shell@beta', 'Install the latest available chrome-headless-shell build corresponding to the Beta channel.')
|
||||
.example('$0 install chrome-headless-shell@118', 'Install the latest available chrome-headless-shell 118 build.')
|
||||
.example('$0 install chromium@1083080', 'Install the revision 1083080 of the Chromium browser.')
|
||||
.example('$0 install firefox', 'Install the latest nightly available build of the Firefox browser.')
|
||||
.example('$0 install firefox@stable', 'Install the latest stable build of the Firefox browser.')
|
||||
.example('$0 install firefox@beta', 'Install the latest beta build of the Firefox browser.')
|
||||
.example('$0 install firefox@devedition', 'Install the latest devedition build of the Firefox browser.')
|
||||
.example('$0 install firefox@esr', 'Install the latest ESR build of the Firefox browser.')
|
||||
.example('$0 install firefox@nightly', 'Install the latest nightly build of the Firefox browser.')
|
||||
.example('$0 install firefox@stable_111.0.1', 'Install a specific version of the Firefox browser.')
|
||||
.example('$0 install firefox --platform mac', 'Install the latest Mac (Intel) build of the Firefox browser.');
|
||||
if (this.#allowCachePathOverride) {
|
||||
yargs.example('$0 install firefox --path /tmp/my-browser-cache', 'Install to the specified cache directory.');
|
||||
}
|
||||
const yargsWithBrowserParam = this.#defineBrowserParameter(yargs, !Boolean(this.#pinnedBrowsers));
|
||||
const yargsWithPlatformParam = this.#definePlatformParameter(yargsWithBrowserParam);
|
||||
return this.#definePathParameter(yargsWithPlatformParam, false)
|
||||
.option('base-url', {
|
||||
type: 'string',
|
||||
desc: 'Base URL to download from',
|
||||
})
|
||||
.option('install-deps', {
|
||||
type: 'boolean',
|
||||
desc: 'Whether to attempt installing system dependencies (only supported on Linux, requires root privileges).',
|
||||
default: false,
|
||||
})
|
||||
.option('format', {
|
||||
type: 'string',
|
||||
desc: 'Format to use for the output. Supported placeholders: {{browser}}, {{buildId}}, {{path}}, {{platform}}',
|
||||
default: '{{browser}}@{{buildId}} {{path}}',
|
||||
});
|
||||
}, async (args) => {
|
||||
if (this.#pinnedBrowsers && !args.browser) {
|
||||
// Use allSettled to avoid scenarios that
|
||||
// a browser may fail early and leave the other
|
||||
// installation in a faulty state
|
||||
const result = await Promise.allSettled(Object.entries(this.#pinnedBrowsers).map(async ([browser, options]) => {
|
||||
if (options.skipDownload) {
|
||||
return;
|
||||
}
|
||||
await this.#install({
|
||||
...args,
|
||||
browser: {
|
||||
name: browser,
|
||||
buildId: options.buildId,
|
||||
},
|
||||
});
|
||||
}));
|
||||
for (const install of result) {
|
||||
if (install.status === 'rejected') {
|
||||
throw install.reason;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
await this.#install(args);
|
||||
}
|
||||
})
|
||||
.command('launch <browser>', 'Launch the specified browser', yargs => {
|
||||
yargs
|
||||
.example('$0 launch chrome@115.0.5790.170', 'Launch Chrome 115.0.5790.170')
|
||||
.example('$0 launch firefox@112.0a1', 'Launch the Firefox browser identified by the milestone 112.0a1.')
|
||||
.example('$0 launch chrome@115.0.5790.170 --detached', 'Launch the browser but detach the sub-processes.')
|
||||
.example('$0 launch chrome@canary --system', 'Try to locate the Canary build of Chrome installed on the system and launch it.')
|
||||
.example('$0 launch chrome@115.0.5790.170 -- --version', 'Launch Chrome 115.0.5790.170 and pass custom argument to the binary.');
|
||||
const yargsWithExtraAgs = yargs.parserConfiguration({
|
||||
'populate--': true,
|
||||
// Yargs does not have the correct overload for this.
|
||||
});
|
||||
const yargsWithBrowserParam = this.#defineBrowserParameter(yargsWithExtraAgs, true);
|
||||
const yargsWithPlatformParam = this.#definePlatformParameter(yargsWithBrowserParam);
|
||||
return this.#definePathParameter(yargsWithPlatformParam)
|
||||
.option('detached', {
|
||||
type: 'boolean',
|
||||
desc: 'Detach the child process.',
|
||||
default: false,
|
||||
})
|
||||
.option('system', {
|
||||
type: 'boolean',
|
||||
desc: 'Search for a browser installed on the system instead of the cache folder.',
|
||||
default: false,
|
||||
})
|
||||
.option('dumpio', {
|
||||
type: 'boolean',
|
||||
desc: "Forwards the browser's process stdout and stderr",
|
||||
default: false,
|
||||
});
|
||||
}, async (args) => {
|
||||
const extraArgs = args['--']?.filter(arg => {
|
||||
return typeof arg === 'string';
|
||||
});
|
||||
args.browser.buildId = this.#resolvePinnedBrowserIfNeeded(args.browser.buildId, args.browser.name);
|
||||
const executablePath = args.system
|
||||
? computeSystemExecutablePath({
|
||||
browser: args.browser.name,
|
||||
channel: verifyChromeReleaseChannel(args.browser.buildId),
|
||||
platform: args.platform,
|
||||
})
|
||||
: computeExecutablePath({
|
||||
browser: args.browser.name,
|
||||
buildId: args.browser.buildId,
|
||||
cacheDir: args.path ?? this.#cachePath,
|
||||
platform: args.platform,
|
||||
});
|
||||
launch({
|
||||
args: extraArgs,
|
||||
executablePath,
|
||||
dumpio: args.dumpio,
|
||||
detached: args.detached,
|
||||
});
|
||||
})
|
||||
.command('clear', this.#allowCachePathOverride
|
||||
? 'Removes all installed browsers from the specified cache directory'
|
||||
: `Removes all installed browsers from ${this.#cachePath}`, yargs => {
|
||||
return this.#definePathParameter(yargs, true);
|
||||
}, async (args) => {
|
||||
const cacheDir = args.path ?? this.#cachePath;
|
||||
const rl = this.#rl ?? readline.createInterface({ input, output });
|
||||
rl.question(`Do you want to permanently and recursively delete the content of ${cacheDir} (yes/No)? `, answer => {
|
||||
rl.close();
|
||||
if (!['y', 'yes'].includes(answer.toLowerCase().trim())) {
|
||||
console.log('Cancelled.');
|
||||
return;
|
||||
}
|
||||
const cache = new Cache(cacheDir);
|
||||
cache.clear();
|
||||
console.log(`${cacheDir} cleared.`);
|
||||
});
|
||||
})
|
||||
.command('list', 'List all installed browsers in the cache directory', yargs => {
|
||||
yargs.example('$0 list', 'List all installed browsers in the cache directory');
|
||||
if (this.#allowCachePathOverride) {
|
||||
yargs.example('$0 list --path /tmp/my-browser-cache', 'List browsers installed in the specified cache directory');
|
||||
}
|
||||
return this.#definePathParameter(yargs);
|
||||
}, async (args) => {
|
||||
const cacheDir = args.path ?? this.#cachePath;
|
||||
const cache = new Cache(cacheDir);
|
||||
const browsers = cache.getInstalledBrowsers();
|
||||
for (const browser of browsers) {
|
||||
console.log(`${browser.browser}@${browser.buildId} (${browser.platform}) ${browser.executablePath}`);
|
||||
}
|
||||
})
|
||||
.command('bisect <path>', '(experimental) Bisect Chrome for Testing using the specified script. Downloads https://chromium.googlesource.com/chromium/src.git/+/main/tools/bisect-builds.py to ~/bisect-builds.py if needed.', yargs => {
|
||||
return yargs
|
||||
.positional('path', {
|
||||
type: 'string',
|
||||
description: 'Path to a script or test name to bisect.',
|
||||
demandOption: true,
|
||||
})
|
||||
.option('good', {
|
||||
type: 'string',
|
||||
alias: 'g',
|
||||
demandOption: true,
|
||||
desc: 'Last known good version',
|
||||
})
|
||||
.option('bad', {
|
||||
type: 'string',
|
||||
alias: 'b',
|
||||
demandOption: true,
|
||||
desc: 'First known bad version',
|
||||
})
|
||||
.option('cft', {
|
||||
type: 'boolean',
|
||||
desc: 'Use -cft',
|
||||
default: true,
|
||||
});
|
||||
}, async (args) => {
|
||||
const isScript = args.path.endsWith('.mjs') ||
|
||||
args.path.endsWith('.cjs') ||
|
||||
args.path.endsWith('.js');
|
||||
const testCommand = isScript
|
||||
? `PUPPETEER_EXECUTABLE_PATH=%p node ${args.path}`
|
||||
: `BINARY=%p npm run ${args.path}`;
|
||||
const bisectScriptPath = path.join(os.homedir(), 'bisect-builds.py');
|
||||
if (!fs.existsSync(bisectScriptPath)) {
|
||||
console.log('Downloading bisect-builds.py...');
|
||||
const response = await fetch('https://chromium.googlesource.com/chromium/src.git/+/main/tools/bisect-builds.py?format=TEXT');
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to download bisect-builds.py: ${response.statusText}`);
|
||||
}
|
||||
const base64Text = await response.text();
|
||||
const decodedText = Buffer.from(base64Text, 'base64').toString('utf-8');
|
||||
fs.writeFileSync(bisectScriptPath, decodedText, { mode: 0o755 });
|
||||
console.log(`Saved bisect-builds.py to ${bisectScriptPath}`);
|
||||
}
|
||||
const pythonExecutable = 'python3';
|
||||
const bisectArgs = [
|
||||
bisectScriptPath,
|
||||
'-g',
|
||||
args.good,
|
||||
'-b',
|
||||
args.bad,
|
||||
args.cft ? '-cft' : '-s',
|
||||
'-v',
|
||||
'--verify-range',
|
||||
'--not-interactive',
|
||||
'-c',
|
||||
testCommand,
|
||||
];
|
||||
await new Promise((resolve, reject) => {
|
||||
const createProcess = spawn(pythonExecutable, bisectArgs, {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
createProcess.on('error', message => {
|
||||
reject(message);
|
||||
});
|
||||
createProcess.on('exit', code => {
|
||||
if (code !== 0) {
|
||||
reject(new Error(`Process exited with code ${code}`));
|
||||
}
|
||||
else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
.demandCommand(1)
|
||||
.help();
|
||||
}
|
||||
#parseBrowser(version) {
|
||||
return version.split('@').shift();
|
||||
}
|
||||
#parseBuildId(version) {
|
||||
const parts = version.split('@');
|
||||
return parts.length === 2
|
||||
? parts[1]
|
||||
: this.#pinnedBrowsers
|
||||
? 'pinned'
|
||||
: 'latest';
|
||||
}
|
||||
#resolvePinnedBrowserIfNeeded(buildId, browserName) {
|
||||
if (buildId === 'pinned') {
|
||||
const options = this.#pinnedBrowsers?.[browserName];
|
||||
if (!options || !options.buildId) {
|
||||
throw new Error(`No pinned version found for ${browserName}`);
|
||||
}
|
||||
return options.buildId;
|
||||
}
|
||||
return buildId;
|
||||
}
|
||||
async #install(args) {
|
||||
if (!args.browser) {
|
||||
throw new Error(`No browser arg provided`);
|
||||
}
|
||||
if (!args.platform) {
|
||||
throw new Error(`Could not resolve the current platform`);
|
||||
}
|
||||
args.browser.buildId = this.#resolvePinnedBrowserIfNeeded(args.browser.buildId, args.browser.name);
|
||||
const originalBuildId = args.browser.buildId;
|
||||
args.browser.buildId = await resolveBuildId(args.browser.name, args.platform, args.browser.buildId);
|
||||
await install({
|
||||
browser: args.browser.name,
|
||||
buildId: args.browser.buildId,
|
||||
platform: args.platform,
|
||||
cacheDir: args.path ?? this.#cachePath,
|
||||
downloadProgressCallback: 'default',
|
||||
baseUrl: args.baseUrl,
|
||||
buildIdAlias: originalBuildId !== args.browser.buildId ? originalBuildId : undefined,
|
||||
installDeps: args.installDeps,
|
||||
});
|
||||
const executablePath = computeExecutablePath({
|
||||
browser: args.browser.name,
|
||||
buildId: args.browser.buildId,
|
||||
cacheDir: args.path ?? this.#cachePath,
|
||||
platform: args.platform,
|
||||
});
|
||||
console.log(args.format
|
||||
.replace(/{{browser}}/g, args.browser.name)
|
||||
.replace(/{{buildId}}/g, args.browser.buildId)
|
||||
.replace(/{{path}}/g, executablePath)
|
||||
.replace(/{{platform}}/g, args.platform));
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=CLI.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/CLI.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/CLI.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
89
node_modules/@puppeteer/browsers/lib/Cache.d.ts
generated
vendored
Normal file
89
node_modules/@puppeteer/browsers/lib/Cache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { Browser, type BrowserPlatform } from './browser-data/browser-data.js';
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare class InstalledBrowser {
|
||||
#private;
|
||||
browser: Browser;
|
||||
buildId: string;
|
||||
platform: BrowserPlatform;
|
||||
readonly executablePath: string;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(cache: Cache, browser: Browser, buildId: string, platform: BrowserPlatform);
|
||||
/**
|
||||
* Path to the root of the installation folder. Use
|
||||
* {@link computeExecutablePath} to get the path to the executable binary.
|
||||
*/
|
||||
get path(): string;
|
||||
readMetadata(): Metadata;
|
||||
writeMetadata(metadata: Metadata): void;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface ComputeExecutablePathOptions {
|
||||
/**
|
||||
* Determines which platform the browser will be suited for.
|
||||
*
|
||||
* @defaultValue **Auto-detected.**
|
||||
*/
|
||||
platform?: BrowserPlatform;
|
||||
/**
|
||||
* Determines which browser to launch.
|
||||
*/
|
||||
browser: Browser;
|
||||
/**
|
||||
* Determines which buildId to download. BuildId should uniquely identify
|
||||
* binaries and they are used for caching.
|
||||
*/
|
||||
buildId: string;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Metadata {
|
||||
aliases: Record<string, string>;
|
||||
executablePaths?: Record<string, string>;
|
||||
}
|
||||
/**
|
||||
* The cache used by Puppeteer relies on the following structure:
|
||||
*
|
||||
* - rootDir
|
||||
* -- <browser1> | browserRoot(browser1)
|
||||
* ---- <platform>-<buildId> | installationDir()
|
||||
* ------ the browser-platform-buildId
|
||||
* ------ specific structure.
|
||||
* -- <browser2> | browserRoot(browser2)
|
||||
* ---- <platform>-<buildId> | installationDir()
|
||||
* ------ the browser-platform-buildId
|
||||
* ------ specific structure.
|
||||
* @internal
|
||||
*/
|
||||
export declare class Cache {
|
||||
#private;
|
||||
constructor(rootDir: string);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
get rootDir(): string;
|
||||
browserRoot(browser: Browser): string;
|
||||
metadataFile(browser: Browser): string;
|
||||
readMetadata(browser: Browser): Metadata;
|
||||
writeMetadata(browser: Browser, metadata: Metadata): void;
|
||||
readExecutablePath(browser: Browser, platform: BrowserPlatform, buildId: string): string | null;
|
||||
writeExecutablePath(browser: Browser, platform: BrowserPlatform, buildId: string, executablePath: string): void;
|
||||
resolveAlias(browser: Browser, alias: string): string | undefined;
|
||||
installationDir(browser: Browser, platform: BrowserPlatform, buildId: string): string;
|
||||
clear(): void;
|
||||
uninstall(browser: Browser, platform: BrowserPlatform, buildId: string): void;
|
||||
getInstalledBrowsers(): InstalledBrowser[];
|
||||
computeExecutablePath(options: ComputeExecutablePathOptions): string;
|
||||
}
|
||||
//# sourceMappingURL=Cache.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/Cache.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/Cache.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../src/Cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EACL,OAAO,EACP,KAAK,eAAe,EAGrB,MAAM,gCAAgC,CAAC;AAMxC;;GAEG;AACH,qBAAa,gBAAgB;;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAIhC;;OAEG;gBAED,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,eAAe;IAa3B;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,CAMjB;IAED,YAAY,IAAI,QAAQ;IAIxB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAGxC;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IAEvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,KAAK;;gBAGJ,OAAO,EAAE,MAAM;IAI3B;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAIrC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAItC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ;IAaxC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAMzD,kBAAkB,CAChB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI;IAMhB,mBAAmB,CACjB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GACrB,IAAI;IAUP,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAUjE,eAAe,CACb,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM;IAIT,KAAK,IAAI,IAAI;IASb,SAAS,CACP,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,IAAI;IAqBP,oBAAoB,IAAI,gBAAgB,EAAE;IA+B1C,qBAAqB,CAAC,OAAO,EAAE,4BAA4B,GAAG,MAAM;CAqCrE"}
|
||||
208
node_modules/@puppeteer/browsers/lib/Cache.js
generated
vendored
Normal file
208
node_modules/@puppeteer/browsers/lib/Cache.js
generated
vendored
Normal file
@@ -0,0 +1,208 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { Browser, executablePathByBrowser, getVersionComparator, } from './browser-data/browser-data.js';
|
||||
import { debug } from './debug.js';
|
||||
import { detectBrowserPlatform } from './detectPlatform.js';
|
||||
const debugCache = debug('puppeteer:browsers:cache');
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export class InstalledBrowser {
|
||||
browser;
|
||||
buildId;
|
||||
platform;
|
||||
executablePath;
|
||||
#cache;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(cache, browser, buildId, platform) {
|
||||
this.#cache = cache;
|
||||
this.browser = browser;
|
||||
this.buildId = buildId;
|
||||
this.platform = platform;
|
||||
this.executablePath = cache.computeExecutablePath({
|
||||
browser,
|
||||
buildId,
|
||||
platform,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Path to the root of the installation folder. Use
|
||||
* {@link computeExecutablePath} to get the path to the executable binary.
|
||||
*/
|
||||
get path() {
|
||||
return this.#cache.installationDir(this.browser, this.platform, this.buildId);
|
||||
}
|
||||
readMetadata() {
|
||||
return this.#cache.readMetadata(this.browser);
|
||||
}
|
||||
writeMetadata(metadata) {
|
||||
this.#cache.writeMetadata(this.browser, metadata);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The cache used by Puppeteer relies on the following structure:
|
||||
*
|
||||
* - rootDir
|
||||
* -- <browser1> | browserRoot(browser1)
|
||||
* ---- <platform>-<buildId> | installationDir()
|
||||
* ------ the browser-platform-buildId
|
||||
* ------ specific structure.
|
||||
* -- <browser2> | browserRoot(browser2)
|
||||
* ---- <platform>-<buildId> | installationDir()
|
||||
* ------ the browser-platform-buildId
|
||||
* ------ specific structure.
|
||||
* @internal
|
||||
*/
|
||||
export class Cache {
|
||||
#rootDir;
|
||||
constructor(rootDir) {
|
||||
this.#rootDir = rootDir;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
get rootDir() {
|
||||
return this.#rootDir;
|
||||
}
|
||||
browserRoot(browser) {
|
||||
return path.join(this.#rootDir, browser);
|
||||
}
|
||||
metadataFile(browser) {
|
||||
return path.join(this.browserRoot(browser), '.metadata');
|
||||
}
|
||||
readMetadata(browser) {
|
||||
const metatadaPath = this.metadataFile(browser);
|
||||
if (!fs.existsSync(metatadaPath)) {
|
||||
return { aliases: {} };
|
||||
}
|
||||
// TODO: add type-safe parsing.
|
||||
const data = JSON.parse(fs.readFileSync(metatadaPath, 'utf8'));
|
||||
if (typeof data !== 'object') {
|
||||
throw new Error('.metadata is not an object');
|
||||
}
|
||||
return data;
|
||||
}
|
||||
writeMetadata(browser, metadata) {
|
||||
const metatadaPath = this.metadataFile(browser);
|
||||
fs.mkdirSync(path.dirname(metatadaPath), { recursive: true });
|
||||
fs.writeFileSync(metatadaPath, JSON.stringify(metadata, null, 2));
|
||||
}
|
||||
readExecutablePath(browser, platform, buildId) {
|
||||
const metadata = this.readMetadata(browser);
|
||||
const key = `${platform}-${buildId}`;
|
||||
return metadata.executablePaths?.[key] ?? null;
|
||||
}
|
||||
writeExecutablePath(browser, platform, buildId, executablePath) {
|
||||
const metadata = this.readMetadata(browser);
|
||||
if (!metadata.executablePaths) {
|
||||
metadata.executablePaths = {};
|
||||
}
|
||||
const key = `${platform}-${buildId}`;
|
||||
metadata.executablePaths[key] = executablePath;
|
||||
this.writeMetadata(browser, metadata);
|
||||
}
|
||||
resolveAlias(browser, alias) {
|
||||
const metadata = this.readMetadata(browser);
|
||||
if (alias === 'latest') {
|
||||
return Object.values(metadata.aliases || {})
|
||||
.sort(getVersionComparator(browser))
|
||||
.at(-1);
|
||||
}
|
||||
return metadata.aliases[alias];
|
||||
}
|
||||
installationDir(browser, platform, buildId) {
|
||||
return path.join(this.browserRoot(browser), `${platform}-${buildId}`);
|
||||
}
|
||||
clear() {
|
||||
fs.rmSync(this.#rootDir, {
|
||||
force: true,
|
||||
recursive: true,
|
||||
maxRetries: 10,
|
||||
retryDelay: 500,
|
||||
});
|
||||
}
|
||||
uninstall(browser, platform, buildId) {
|
||||
const metadata = this.readMetadata(browser);
|
||||
for (const alias of Object.keys(metadata.aliases)) {
|
||||
if (metadata.aliases[alias] === buildId) {
|
||||
delete metadata.aliases[alias];
|
||||
}
|
||||
}
|
||||
// Clean up executable path entry
|
||||
const key = `${platform}-${buildId}`;
|
||||
if (metadata.executablePaths?.[key]) {
|
||||
delete metadata.executablePaths[key];
|
||||
this.writeMetadata(browser, metadata);
|
||||
}
|
||||
fs.rmSync(this.installationDir(browser, platform, buildId), {
|
||||
force: true,
|
||||
recursive: true,
|
||||
maxRetries: 10,
|
||||
retryDelay: 500,
|
||||
});
|
||||
}
|
||||
getInstalledBrowsers() {
|
||||
if (!fs.existsSync(this.#rootDir)) {
|
||||
return [];
|
||||
}
|
||||
const types = fs.readdirSync(this.#rootDir);
|
||||
const browsers = types.filter((t) => {
|
||||
return Object.values(Browser).includes(t);
|
||||
});
|
||||
return browsers.flatMap(browser => {
|
||||
const files = fs.readdirSync(this.browserRoot(browser));
|
||||
return files
|
||||
.map(file => {
|
||||
const result = parseFolderPath(path.join(this.browserRoot(browser), file));
|
||||
if (!result) {
|
||||
return null;
|
||||
}
|
||||
return new InstalledBrowser(this, browser, result.buildId, result.platform);
|
||||
})
|
||||
.filter((item) => {
|
||||
return item !== null;
|
||||
});
|
||||
});
|
||||
}
|
||||
computeExecutablePath(options) {
|
||||
options.platform ??= detectBrowserPlatform();
|
||||
if (!options.platform) {
|
||||
throw new Error(`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`);
|
||||
}
|
||||
try {
|
||||
options.buildId =
|
||||
this.resolveAlias(options.browser, options.buildId) ?? options.buildId;
|
||||
}
|
||||
catch {
|
||||
debugCache?.('could not read .metadata file for the browser');
|
||||
}
|
||||
const installationDir = this.installationDir(options.browser, options.platform, options.buildId);
|
||||
const storedExecutablePath = this.readExecutablePath(options.browser, options.platform, options.buildId);
|
||||
if (storedExecutablePath) {
|
||||
// The metadata contains a resolved relative path from the installation dir
|
||||
return path.join(installationDir, storedExecutablePath);
|
||||
}
|
||||
return path.join(installationDir, executablePathByBrowser[options.browser](options.platform, options.buildId));
|
||||
}
|
||||
}
|
||||
function parseFolderPath(folderPath) {
|
||||
const name = path.basename(folderPath);
|
||||
const splits = name.split('-');
|
||||
if (splits.length !== 2) {
|
||||
return;
|
||||
}
|
||||
const [platform, buildId] = splits;
|
||||
if (!buildId || !platform) {
|
||||
return;
|
||||
}
|
||||
return { platform, buildId };
|
||||
}
|
||||
//# sourceMappingURL=Cache.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/Cache.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/Cache.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
26
node_modules/@puppeteer/browsers/lib/DefaultProvider.d.ts
generated
vendored
Normal file
26
node_modules/@puppeteer/browsers/lib/DefaultProvider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import type { Browser, BrowserPlatform } from './browser-data/browser-data.js';
|
||||
import type { BrowserProvider, DownloadOptions } from './provider.js';
|
||||
/**
|
||||
* Default provider implementation that uses default sources.
|
||||
* This is the standard provider used by Puppeteer.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class DefaultProvider implements BrowserProvider {
|
||||
#private;
|
||||
constructor(baseUrl?: string);
|
||||
supports(_options: DownloadOptions): boolean;
|
||||
getDownloadUrl(options: DownloadOptions): URL;
|
||||
getExecutablePath(options: {
|
||||
browser: Browser;
|
||||
buildId: string;
|
||||
platform: BrowserPlatform;
|
||||
}): string;
|
||||
getName(): string;
|
||||
}
|
||||
//# sourceMappingURL=DefaultProvider.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/DefaultProvider.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/DefaultProvider.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DefaultProvider.d.ts","sourceRoot":"","sources":["../src/DefaultProvider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAE,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAK7E,OAAO,KAAK,EAAC,eAAe,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAEpE;;;;;GAKG;AACH,qBAAa,eAAgB,YAAW,eAAe;;gBAGzC,OAAO,CAAC,EAAE,MAAM;IAI5B,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO;IAK5C,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;IAgB7C,iBAAiB,CAAC,OAAO,EAAE;QACzB,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,eAAe,CAAC;KAC3B,GAAG,MAAM;IAOV,OAAO,IAAI,MAAM;CAGlB"}
|
||||
35
node_modules/@puppeteer/browsers/lib/DefaultProvider.js
generated
vendored
Normal file
35
node_modules/@puppeteer/browsers/lib/DefaultProvider.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { downloadUrls, executablePathByBrowser, } from './browser-data/browser-data.js';
|
||||
/**
|
||||
* Default provider implementation that uses default sources.
|
||||
* This is the standard provider used by Puppeteer.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export class DefaultProvider {
|
||||
#baseUrl;
|
||||
constructor(baseUrl) {
|
||||
this.#baseUrl = baseUrl;
|
||||
}
|
||||
supports(_options) {
|
||||
// Default provider supports all browsers
|
||||
return true;
|
||||
}
|
||||
getDownloadUrl(options) {
|
||||
return this.#getDownloadUrl(options.browser, options.platform, options.buildId);
|
||||
}
|
||||
#getDownloadUrl(browser, platform, buildId) {
|
||||
return new URL(downloadUrls[browser](platform, buildId, this.#baseUrl));
|
||||
}
|
||||
getExecutablePath(options) {
|
||||
return executablePathByBrowser[options.browser](options.platform, options.buildId);
|
||||
}
|
||||
getName() {
|
||||
return 'DefaultProvider';
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=DefaultProvider.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/DefaultProvider.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/DefaultProvider.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DefaultProvider.js","sourceRoot":"","sources":["../src/DefaultProvider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,YAAY,EACZ,uBAAuB,GACxB,MAAM,gCAAgC,CAAC;AAGxC;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAC1B,QAAQ,CAAU;IAElB,YAAY,OAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,QAAQ,CAAC,QAAyB;QAChC,yCAAyC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,cAAc,CAAC,OAAwB;QACrC,OAAO,IAAI,CAAC,eAAe,CACzB,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,QAAQ,EAChB,OAAO,CAAC,OAAO,CAChB,CAAC;IACJ,CAAC;IAED,eAAe,CACb,OAAgB,EAChB,QAAyB,EACzB,OAAe;QAEf,OAAO,IAAI,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1E,CAAC;IAED,iBAAiB,CAAC,OAIjB;QACC,OAAO,uBAAuB,CAAC,OAAO,CAAC,OAAO,CAAC,CAC7C,OAAO,CAAC,QAAQ,EAChB,OAAO,CAAC,OAAO,CAChB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF"}
|
||||
24
node_modules/@puppeteer/browsers/lib/ProgressBar.d.ts
generated
vendored
Normal file
24
node_modules/@puppeteer/browsers/lib/ProgressBar.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/**
|
||||
* Manages one or more concurrent progress bars on separate terminal lines.
|
||||
* Use {@link ProgressBar.createBarTicker} to add a bar; concurrent calls
|
||||
* automatically share a session so bars don't overwrite each other.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export declare class ProgressBar {
|
||||
#private;
|
||||
private constructor();
|
||||
/**
|
||||
* Returns a `tick(delta)` function for a new progress bar. If another bar
|
||||
* is already active on the same stream, the new bar appears on the next line
|
||||
* and both update in place. The trailing newline is emitted automatically
|
||||
* once every bar in the session has reached 100%.
|
||||
*/
|
||||
static createBarTicker(title: string, total: number, stream?: NodeJS.WriteStream): (delta: number) => void;
|
||||
}
|
||||
//# sourceMappingURL=ProgressBar.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/ProgressBar.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/ProgressBar.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../src/ProgressBar.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;;;;GAMG;AACH,qBAAa,WAAW;;IAetB,OAAO;IAIP;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CACpB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,MAAM,GAAE,MAAM,CAAC,WAAkD,GAChE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;CA4H3B"}
|
||||
143
node_modules/@puppeteer/browsers/lib/ProgressBar.js
generated
vendored
Normal file
143
node_modules/@puppeteer/browsers/lib/ProgressBar.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
// Module-level active session. Concurrent bars share a session; a new session
|
||||
// starts whenever no bar is currently active (or the stream changes).
|
||||
let activeBar = null;
|
||||
/**
|
||||
* Manages one or more concurrent progress bars on separate terminal lines.
|
||||
* Use {@link ProgressBar.createBarTicker} to add a bar; concurrent calls
|
||||
* automatically share a session so bars don't overwrite each other.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export class ProgressBar {
|
||||
#stream;
|
||||
#totalRows = 0;
|
||||
#doneCount = 0;
|
||||
#bars = [];
|
||||
#renderScheduled = false;
|
||||
#lastRenderTime = 0;
|
||||
#allDone = false;
|
||||
constructor(stream) {
|
||||
this.#stream = stream;
|
||||
}
|
||||
/**
|
||||
* Returns a `tick(delta)` function for a new progress bar. If another bar
|
||||
* is already active on the same stream, the new bar appears on the next line
|
||||
* and both update in place. The trailing newline is emitted automatically
|
||||
* once every bar in the session has reached 100%.
|
||||
*/
|
||||
static createBarTicker(title, total, stream = process.stderr) {
|
||||
// Start a fresh session when none is active or the stream changed.
|
||||
if (!activeBar || activeBar.#stream !== stream) {
|
||||
activeBar = new ProgressBar(stream);
|
||||
}
|
||||
return activeBar.#addBar(title, total);
|
||||
}
|
||||
#claimRow() {
|
||||
const row = this.#totalRows++;
|
||||
if (row > 0 && this.#stream.isTTY) {
|
||||
// Cursor is parked at col 0 of the previous bottom row; \n opens the
|
||||
// new line and moves the cursor there, establishing the new bottom row.
|
||||
this.#stream.write('\n');
|
||||
}
|
||||
return row;
|
||||
}
|
||||
#addBar(title, total) {
|
||||
const row = this.#claimRow();
|
||||
this.#bars.push({
|
||||
title,
|
||||
total,
|
||||
downloaded: 0,
|
||||
startTime: 0,
|
||||
lastRendered: '',
|
||||
});
|
||||
let doneNotified = false;
|
||||
return (delta) => {
|
||||
const bar = this.#bars[row];
|
||||
if (bar.startTime === 0) {
|
||||
bar.startTime = Date.now();
|
||||
}
|
||||
bar.downloaded += delta;
|
||||
const isDone = bar.downloaded >= bar.total;
|
||||
if (isDone || Date.now() - this.#lastRenderTime >= 100) {
|
||||
this.#scheduleRender();
|
||||
}
|
||||
if (isDone && !doneNotified) {
|
||||
doneNotified = true;
|
||||
this.#onBarDone();
|
||||
}
|
||||
};
|
||||
}
|
||||
// Defers to a microtask so multiple ticks in the same turn share one render
|
||||
// pass and the cursor only moves once.
|
||||
#scheduleRender() {
|
||||
if (!this.#renderScheduled) {
|
||||
this.#renderScheduled = true;
|
||||
queueMicrotask(() => {
|
||||
this.#renderScheduled = false;
|
||||
this.#lastRenderTime = Date.now();
|
||||
this.#renderAll();
|
||||
});
|
||||
}
|
||||
}
|
||||
#computeRendered(row) {
|
||||
const bar = this.#bars[row];
|
||||
const ratio = Math.min(1, Math.max(0, bar.downloaded / bar.total));
|
||||
const percent = Math.round(ratio * 100);
|
||||
const elapsedMs = bar.startTime > 0 ? Date.now() - bar.startTime : 0;
|
||||
const rate = elapsedMs > 0 ? bar.downloaded / elapsedMs : 0; // bytes/ms
|
||||
const etaSec = rate > 0 ? (bar.total - bar.downloaded) / rate / 1000 : 0;
|
||||
const width = 20;
|
||||
const completeCount = Math.round(width * ratio);
|
||||
const barStr = '='.repeat(completeCount) + ' '.repeat(width - completeCount);
|
||||
const status = ratio >= 1 ? 'unpacking' : `${percent}% ${etaSec.toFixed(1)}s`;
|
||||
return `${bar.title} [${barStr}] ${status} `;
|
||||
}
|
||||
// Invariant: cursor is at col 0 of the bottom row before and after this call.
|
||||
// Single top-down pass: go up to bar 0, render each bar, come back to bottom.
|
||||
#renderAll() {
|
||||
if (!this.#stream.isTTY) {
|
||||
return;
|
||||
}
|
||||
const N = this.#totalRows;
|
||||
if (N === 0) {
|
||||
return;
|
||||
}
|
||||
// Move cursor to top of bar area.
|
||||
if (N > 1) {
|
||||
this.#stream.moveCursor(0, -(N - 1));
|
||||
}
|
||||
for (let row = 0; row < N; row++) {
|
||||
const rendered = this.#computeRendered(row);
|
||||
if (rendered !== this.#bars[row].lastRendered) {
|
||||
this.#stream.cursorTo(0);
|
||||
this.#stream.write(rendered);
|
||||
this.#stream.clearLine(1);
|
||||
this.#bars[row].lastRendered = rendered;
|
||||
}
|
||||
if (row < N - 1) {
|
||||
this.#stream.moveCursor(0, 1);
|
||||
}
|
||||
}
|
||||
// Park cursor at col 0 of the bottom row.
|
||||
this.#stream.cursorTo(0);
|
||||
if (this.#allDone) {
|
||||
activeBar = null;
|
||||
this.#stream.write('\n');
|
||||
}
|
||||
}
|
||||
#onBarDone() {
|
||||
this.#doneCount++;
|
||||
if (this.#doneCount >= this.#totalRows && this.#totalRows > 0) {
|
||||
this.#allDone = true;
|
||||
// Don't emit \n here — the pending render microtask hasn't run yet.
|
||||
// #renderAll() will emit it after the final pass so the cursor is
|
||||
// already past the last bar line before the newline moves it.
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=ProgressBar.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/ProgressBar.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/ProgressBar.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../src/ProgressBar.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,8EAA8E;AAC9E,sEAAsE;AACtE,IAAI,SAAS,GAAuB,IAAI,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,OAAO,WAAW;IACtB,OAAO,CAAqB;IAC5B,UAAU,GAAG,CAAC,CAAC;IACf,UAAU,GAAG,CAAC,CAAC;IACf,KAAK,GAMA,EAAE,CAAC;IACR,gBAAgB,GAAG,KAAK,CAAC;IACzB,eAAe,GAAG,CAAC,CAAC;IACpB,QAAQ,GAAG,KAAK,CAAC;IAEjB,YAAoB,MAA0B;QAC5C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CACpB,KAAa,EACb,KAAa,EACb,SAA6B,OAAO,CAAC,MAA4B;QAEjE,mEAAmE;QACnE,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;YAC/C,SAAS,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;IAED,SAAS;QACP,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC9B,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAClC,qEAAqE;YACrE,wEAAwE;YACxE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,OAAO,CAAC,KAAa,EAAE,KAAa;QAClC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAC7B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YACd,KAAK;YACL,KAAK;YACL,UAAU,EAAE,CAAC;YACb,SAAS,EAAE,CAAC;YACZ,YAAY,EAAE,EAAE;SACjB,CAAC,CAAC;QACH,IAAI,YAAY,GAAG,KAAK,CAAC;QAEzB,OAAO,CAAC,KAAa,EAAE,EAAE;YACvB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAE,CAAC;YAC7B,IAAI,GAAG,CAAC,SAAS,KAAK,CAAC,EAAE,CAAC;gBACxB,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAC7B,CAAC;YACD,GAAG,CAAC,UAAU,IAAI,KAAK,CAAC;YAExB,MAAM,MAAM,GAAG,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,KAAK,CAAC;YAC3C,IAAI,MAAM,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,eAAe,IAAI,GAAG,EAAE,CAAC;gBACvD,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,CAAC;YAED,IAAI,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;gBAC5B,YAAY,GAAG,IAAI,CAAC;gBACpB,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;IAED,4EAA4E;IAC5E,uCAAuC;IACvC,eAAe;QACb,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC3B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,cAAc,CAAC,GAAG,EAAE;gBAClB,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;gBAC9B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;gBAClC,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,gBAAgB,CAAC,GAAW;QAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QACnE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;QACxC,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW;QACxE,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACzE,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;QAChD,MAAM,MAAM,GACV,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,aAAa,CAAC,CAAC;QAChE,MAAM,MAAM,GACV,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;QACjE,OAAO,GAAG,GAAG,CAAC,KAAK,KAAK,MAAM,KAAK,MAAM,GAAG,CAAC;IAC/C,CAAC;IAED,8EAA8E;IAC9E,8EAA8E;IAC9E,UAAU;QACR,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACxB,OAAO;QACT,CAAC;QACD,MAAM,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAC1B,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACZ,OAAO;QACT,CAAC;QAED,kCAAkC;QAClC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACV,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC;QAED,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC;YACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;YAC5C,IAAI,QAAQ,KAAK,IAAI,CAAC,KAAK,CAAC,GAAG,CAAE,CAAC,YAAY,EAAE,CAAC;gBAC/C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBACzB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;gBAC7B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;gBAC1B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAE,CAAC,YAAY,GAAG,QAAQ,CAAC;YAC3C,CAAC;YACD,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAEzB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,SAAS,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,UAAU;QACR,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;YAC9D,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,oEAAoE;YACpE,kEAAkE;YAClE,8DAA8D;QAChE,CAAC;IACH,CAAC;CACF"}
|
||||
77
node_modules/@puppeteer/browsers/lib/browser-data/browser-data.d.ts
generated
vendored
Normal file
77
node_modules/@puppeteer/browsers/lib/browser-data/browser-data.d.ts
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import * as chromeHeadlessShell from './chrome-headless-shell.js';
|
||||
import * as chrome from './chrome.js';
|
||||
import * as chromedriver from './chromedriver.js';
|
||||
import * as chromium from './chromium.js';
|
||||
import * as firefox from './firefox.js';
|
||||
import { Browser, BrowserPlatform, BrowserTag, ChromeReleaseChannel, verifyChromeReleaseChannel, type ProfileOptions } from './types.js';
|
||||
export type { ProfileOptions };
|
||||
export declare const downloadUrls: {
|
||||
chromedriver: typeof chromedriver.resolveDownloadUrl;
|
||||
"chrome-headless-shell": typeof chromeHeadlessShell.resolveDownloadUrl;
|
||||
chrome: typeof chrome.resolveDownloadUrl;
|
||||
chromium: typeof chromium.resolveDownloadUrl;
|
||||
firefox: typeof firefox.resolveDownloadUrl;
|
||||
};
|
||||
export declare const downloadPaths: {
|
||||
chromedriver: typeof chromedriver.resolveDownloadPath;
|
||||
"chrome-headless-shell": typeof chromeHeadlessShell.resolveDownloadPath;
|
||||
chrome: typeof chrome.resolveDownloadPath;
|
||||
chromium: typeof chromium.resolveDownloadPath;
|
||||
firefox: typeof firefox.resolveDownloadPath;
|
||||
};
|
||||
export declare const executablePathByBrowser: {
|
||||
chromedriver: typeof chromedriver.relativeExecutablePath;
|
||||
"chrome-headless-shell": typeof chromeHeadlessShell.relativeExecutablePath;
|
||||
chrome: typeof chrome.relativeExecutablePath;
|
||||
chromium: typeof chromium.relativeExecutablePath;
|
||||
firefox: typeof firefox.relativeExecutablePath;
|
||||
};
|
||||
export declare const versionComparators: {
|
||||
chromedriver: typeof chromeHeadlessShell.compareVersions;
|
||||
"chrome-headless-shell": typeof chromeHeadlessShell.compareVersions;
|
||||
chrome: typeof chromeHeadlessShell.compareVersions;
|
||||
chromium: typeof chromium.compareVersions;
|
||||
firefox: typeof firefox.compareVersions;
|
||||
};
|
||||
export { Browser, BrowserPlatform, ChromeReleaseChannel, verifyChromeReleaseChannel, };
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare function resolveBuildId(browser: Browser, platform: BrowserPlatform, tag: string | BrowserTag): Promise<string>;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare function createProfile(browser: Browser, opts: ProfileOptions): Promise<void>;
|
||||
/**
|
||||
* @public
|
||||
*
|
||||
* Get's the first resolved system path
|
||||
*/
|
||||
export declare function resolveSystemExecutablePath(browser: Browser, platform: BrowserPlatform, channel: ChromeReleaseChannel): string;
|
||||
/**
|
||||
* Returns the expected default user data dir for the given channel. It does not
|
||||
* check if the dir actually exists.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function resolveDefaultUserDataDir(browser: Browser, platform: BrowserPlatform, channel: ChromeReleaseChannel): string;
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* Returns multiple paths where the executable may be located at on the current system
|
||||
* ordered by likelihood (based on heuristics).
|
||||
*/
|
||||
export declare function resolveSystemExecutablePaths(browser: Browser, platform: BrowserPlatform, channel: ChromeReleaseChannel): [string, ...string[]];
|
||||
/**
|
||||
* Returns a version comparator for the given browser that can be used to sort
|
||||
* browser versions.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function getVersionComparator(browser: Browser): (a: string, b: string) => number;
|
||||
//# sourceMappingURL=browser-data.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/browser-data/browser-data.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/browser-data/browser-data.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"browser-data.d.ts","sourceRoot":"","sources":["../../src/browser-data/browser-data.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,mBAAmB,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EACL,OAAO,EACP,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,0BAA0B,EAC1B,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAC,cAAc,EAAC,CAAC;AAE7B,eAAO,MAAM,YAAY;;;;;;CAMxB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;CAMzB,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;CAMnC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;CAM9B,CAAC;AAEF,OAAO,EACL,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,0BAA0B,GAC3B,CAAC;AA+GF;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,GAAG,EAAE,MAAM,GAAG,UAAU,GACvB,OAAO,CAAC,MAAM,CAAC,CA+BjB;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,oBAAoB,GAC5B,MAAM,CAYR;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,oBAAoB,GAC5B,MAAM,CAYR;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,oBAAoB,GAC5B,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAYvB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,GACf,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAElC"}
|
||||
235
node_modules/@puppeteer/browsers/lib/browser-data/browser-data.js
generated
vendored
Normal file
235
node_modules/@puppeteer/browsers/lib/browser-data/browser-data.js
generated
vendored
Normal file
@@ -0,0 +1,235 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import * as chromeHeadlessShell from './chrome-headless-shell.js';
|
||||
import * as chrome from './chrome.js';
|
||||
import * as chromedriver from './chromedriver.js';
|
||||
import * as chromium from './chromium.js';
|
||||
import * as firefox from './firefox.js';
|
||||
import { Browser, BrowserPlatform, BrowserTag, ChromeReleaseChannel, verifyChromeReleaseChannel, } from './types.js';
|
||||
export const downloadUrls = {
|
||||
[Browser.CHROMEDRIVER]: chromedriver.resolveDownloadUrl,
|
||||
[Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.resolveDownloadUrl,
|
||||
[Browser.CHROME]: chrome.resolveDownloadUrl,
|
||||
[Browser.CHROMIUM]: chromium.resolveDownloadUrl,
|
||||
[Browser.FIREFOX]: firefox.resolveDownloadUrl,
|
||||
};
|
||||
export const downloadPaths = {
|
||||
[Browser.CHROMEDRIVER]: chromedriver.resolveDownloadPath,
|
||||
[Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.resolveDownloadPath,
|
||||
[Browser.CHROME]: chrome.resolveDownloadPath,
|
||||
[Browser.CHROMIUM]: chromium.resolveDownloadPath,
|
||||
[Browser.FIREFOX]: firefox.resolveDownloadPath,
|
||||
};
|
||||
export const executablePathByBrowser = {
|
||||
[Browser.CHROMEDRIVER]: chromedriver.relativeExecutablePath,
|
||||
[Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.relativeExecutablePath,
|
||||
[Browser.CHROME]: chrome.relativeExecutablePath,
|
||||
[Browser.CHROMIUM]: chromium.relativeExecutablePath,
|
||||
[Browser.FIREFOX]: firefox.relativeExecutablePath,
|
||||
};
|
||||
export const versionComparators = {
|
||||
[Browser.CHROMEDRIVER]: chromedriver.compareVersions,
|
||||
[Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.compareVersions,
|
||||
[Browser.CHROME]: chrome.compareVersions,
|
||||
[Browser.CHROMIUM]: chromium.compareVersions,
|
||||
[Browser.FIREFOX]: firefox.compareVersions,
|
||||
};
|
||||
export { Browser, BrowserPlatform, ChromeReleaseChannel, verifyChromeReleaseChannel, };
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
async function resolveBuildIdForBrowserTag(browser, platform, tag) {
|
||||
switch (browser) {
|
||||
case Browser.FIREFOX:
|
||||
switch (tag) {
|
||||
case BrowserTag.LATEST:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.NIGHTLY);
|
||||
case BrowserTag.BETA:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.BETA);
|
||||
case BrowserTag.NIGHTLY:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.NIGHTLY);
|
||||
case BrowserTag.DEVEDITION:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.DEVEDITION);
|
||||
case BrowserTag.STABLE:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.STABLE);
|
||||
case BrowserTag.ESR:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.ESR);
|
||||
case BrowserTag.CANARY:
|
||||
case BrowserTag.DEV:
|
||||
throw new Error(`${tag.toUpperCase()} is not available for Firefox`);
|
||||
}
|
||||
case Browser.CHROME: {
|
||||
switch (tag) {
|
||||
case BrowserTag.LATEST:
|
||||
return await chrome.resolveBuildId(ChromeReleaseChannel.CANARY);
|
||||
case BrowserTag.BETA:
|
||||
return await chrome.resolveBuildId(ChromeReleaseChannel.BETA);
|
||||
case BrowserTag.CANARY:
|
||||
return await chrome.resolveBuildId(ChromeReleaseChannel.CANARY);
|
||||
case BrowserTag.DEV:
|
||||
return await chrome.resolveBuildId(ChromeReleaseChannel.DEV);
|
||||
case BrowserTag.STABLE:
|
||||
return await chrome.resolveBuildId(ChromeReleaseChannel.STABLE);
|
||||
case BrowserTag.NIGHTLY:
|
||||
case BrowserTag.DEVEDITION:
|
||||
case BrowserTag.ESR:
|
||||
throw new Error(`${tag.toUpperCase()} is not available for Chrome`);
|
||||
}
|
||||
}
|
||||
case Browser.CHROMEDRIVER: {
|
||||
switch (tag) {
|
||||
case BrowserTag.LATEST:
|
||||
case BrowserTag.CANARY:
|
||||
return await chromedriver.resolveBuildId(ChromeReleaseChannel.CANARY);
|
||||
case BrowserTag.BETA:
|
||||
return await chromedriver.resolveBuildId(ChromeReleaseChannel.BETA);
|
||||
case BrowserTag.DEV:
|
||||
return await chromedriver.resolveBuildId(ChromeReleaseChannel.DEV);
|
||||
case BrowserTag.STABLE:
|
||||
return await chromedriver.resolveBuildId(ChromeReleaseChannel.STABLE);
|
||||
case BrowserTag.NIGHTLY:
|
||||
case BrowserTag.DEVEDITION:
|
||||
case BrowserTag.ESR:
|
||||
throw new Error(`${tag.toUpperCase()} is not available for ChromeDriver`);
|
||||
}
|
||||
}
|
||||
case Browser.CHROMEHEADLESSSHELL: {
|
||||
switch (tag) {
|
||||
case BrowserTag.LATEST:
|
||||
case BrowserTag.CANARY:
|
||||
return await chromeHeadlessShell.resolveBuildId(ChromeReleaseChannel.CANARY);
|
||||
case BrowserTag.BETA:
|
||||
return await chromeHeadlessShell.resolveBuildId(ChromeReleaseChannel.BETA);
|
||||
case BrowserTag.DEV:
|
||||
return await chromeHeadlessShell.resolveBuildId(ChromeReleaseChannel.DEV);
|
||||
case BrowserTag.STABLE:
|
||||
return await chromeHeadlessShell.resolveBuildId(ChromeReleaseChannel.STABLE);
|
||||
case BrowserTag.NIGHTLY:
|
||||
case BrowserTag.DEVEDITION:
|
||||
case BrowserTag.ESR:
|
||||
throw new Error(`${tag} is not available for chrome-headless-shell`);
|
||||
}
|
||||
}
|
||||
case Browser.CHROMIUM:
|
||||
switch (tag) {
|
||||
case BrowserTag.LATEST:
|
||||
return await chromium.resolveBuildId(platform);
|
||||
case BrowserTag.NIGHTLY:
|
||||
case BrowserTag.CANARY:
|
||||
case BrowserTag.DEV:
|
||||
case BrowserTag.DEVEDITION:
|
||||
case BrowserTag.BETA:
|
||||
case BrowserTag.STABLE:
|
||||
case BrowserTag.ESR:
|
||||
throw new Error(`${tag} is not supported for Chromium. Use 'latest' instead.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export async function resolveBuildId(browser, platform, tag) {
|
||||
const browserTag = tag;
|
||||
if (Object.values(BrowserTag).includes(browserTag)) {
|
||||
return await resolveBuildIdForBrowserTag(browser, platform, browserTag);
|
||||
}
|
||||
switch (browser) {
|
||||
case Browser.FIREFOX:
|
||||
return tag;
|
||||
case Browser.CHROME:
|
||||
const chromeResult = await chrome.resolveBuildId(tag);
|
||||
if (chromeResult) {
|
||||
return chromeResult;
|
||||
}
|
||||
return tag;
|
||||
case Browser.CHROMEDRIVER:
|
||||
const chromeDriverResult = await chromedriver.resolveBuildId(tag);
|
||||
if (chromeDriverResult) {
|
||||
return chromeDriverResult;
|
||||
}
|
||||
return tag;
|
||||
case Browser.CHROMEHEADLESSSHELL:
|
||||
const chromeHeadlessShellResult = await chromeHeadlessShell.resolveBuildId(tag);
|
||||
if (chromeHeadlessShellResult) {
|
||||
return chromeHeadlessShellResult;
|
||||
}
|
||||
return tag;
|
||||
case Browser.CHROMIUM:
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export async function createProfile(browser, opts) {
|
||||
switch (browser) {
|
||||
case Browser.FIREFOX:
|
||||
return await firefox.createProfile(opts);
|
||||
case Browser.CHROME:
|
||||
case Browser.CHROMIUM:
|
||||
throw new Error(`Profile creation is not support for ${browser} yet`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*
|
||||
* Get's the first resolved system path
|
||||
*/
|
||||
export function resolveSystemExecutablePath(browser, platform, channel) {
|
||||
switch (browser) {
|
||||
case Browser.CHROMEDRIVER:
|
||||
case Browser.CHROMEHEADLESSSHELL:
|
||||
case Browser.FIREFOX:
|
||||
case Browser.CHROMIUM:
|
||||
throw new Error(`System browser detection is not supported for ${browser} yet.`);
|
||||
case Browser.CHROME:
|
||||
return chrome.resolveSystemExecutablePaths(platform, channel)[0];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the expected default user data dir for the given channel. It does not
|
||||
* check if the dir actually exists.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function resolveDefaultUserDataDir(browser, platform, channel) {
|
||||
switch (browser) {
|
||||
case Browser.CHROMEDRIVER:
|
||||
case Browser.CHROMEHEADLESSSHELL:
|
||||
case Browser.FIREFOX:
|
||||
case Browser.CHROMIUM:
|
||||
throw new Error(`Default user dir detection is not supported for ${browser} yet.`);
|
||||
case Browser.CHROME:
|
||||
return chrome.resolveDefaultUserDataDir(platform, channel);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* Returns multiple paths where the executable may be located at on the current system
|
||||
* ordered by likelihood (based on heuristics).
|
||||
*/
|
||||
export function resolveSystemExecutablePaths(browser, platform, channel) {
|
||||
switch (browser) {
|
||||
case Browser.CHROMEDRIVER:
|
||||
case Browser.CHROMEHEADLESSSHELL:
|
||||
case Browser.FIREFOX:
|
||||
case Browser.CHROMIUM:
|
||||
throw new Error(`System browser detection is not supported for ${browser} yet.`);
|
||||
case Browser.CHROME:
|
||||
return chrome.resolveSystemExecutablePaths(platform, channel);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns a version comparator for the given browser that can be used to sort
|
||||
* browser versions.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function getVersionComparator(browser) {
|
||||
return versionComparators[browser];
|
||||
}
|
||||
//# sourceMappingURL=browser-data.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/browser-data/browser-data.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/browser-data/browser-data.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/@puppeteer/browsers/lib/browser-data/chrome-headless-shell.d.ts
generated
vendored
Normal file
6
node_modules/@puppeteer/browsers/lib/browser-data/chrome-headless-shell.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { BrowserPlatform } 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 { resolveBuildId, compareVersions } from './chrome.js';
|
||||
//# sourceMappingURL=chrome-headless-shell.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/browser-data/chrome-headless-shell.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/browser-data/chrome-headless-shell.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"chrome-headless-shell.d.ts","sourceRoot":"","sources":["../../src/browser-data/chrome-headless-shell.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAkB3C,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,SAA6D,GACnE,MAAM,CAER;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAMV;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,MAAM,GACf,MAAM,CAqBR;AAED,OAAO,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,aAAa,CAAC"}
|
||||
47
node_modules/@puppeteer/browsers/lib/browser-data/chrome-headless-shell.js
generated
vendored
Normal file
47
node_modules/@puppeteer/browsers/lib/browser-data/chrome-headless-shell.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import path from 'node:path';
|
||||
import { BrowserPlatform } from './types.js';
|
||||
function folder(platform) {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return 'linux64';
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return 'mac-arm64';
|
||||
case BrowserPlatform.MAC:
|
||||
return 'mac-x64';
|
||||
case BrowserPlatform.WIN32:
|
||||
return 'win32';
|
||||
case BrowserPlatform.WIN64:
|
||||
return 'win64';
|
||||
}
|
||||
}
|
||||
export function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public') {
|
||||
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
|
||||
}
|
||||
export function resolveDownloadPath(platform, buildId) {
|
||||
return [
|
||||
buildId,
|
||||
folder(platform),
|
||||
`chrome-headless-shell-${folder(platform)}.zip`,
|
||||
];
|
||||
}
|
||||
export function relativeExecutablePath(platform, _buildId) {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.MAC:
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return path.join('chrome-headless-shell-' + folder(platform), 'chrome-headless-shell');
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return path.join('chrome-headless-shell-linux64', 'chrome-headless-shell');
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return path.join('chrome-headless-shell-' + folder(platform), 'chrome-headless-shell.exe');
|
||||
}
|
||||
}
|
||||
export { resolveBuildId, compareVersions } from './chrome.js';
|
||||
//# sourceMappingURL=chrome-headless-shell.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/browser-data/chrome-headless-shell.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/browser-data/chrome-headless-shell.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"chrome-headless-shell.js","sourceRoot":"","sources":["../../src/browser-data/chrome-headless-shell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAE3C,SAAS,MAAM,CAAC,QAAyB;IACvC,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,eAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,SAAS,CAAC;QACnB,KAAK,eAAe,CAAC,OAAO;YAC1B,OAAO,WAAW,CAAC;QACrB,KAAK,eAAe,CAAC,GAAG;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,OAAO,CAAC;QACjB,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,OAAO,CAAC;IACnB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,QAAyB,EACzB,OAAe,EACf,OAAO,GAAG,0DAA0D;IAEpE,OAAO,GAAG,OAAO,IAAI,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,QAAyB,EACzB,OAAe;IAEf,OAAO;QACL,OAAO;QACP,MAAM,CAAC,QAAQ,CAAC;QAChB,yBAAyB,MAAM,CAAC,QAAQ,CAAC,MAAM;KAChD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAAyB,EACzB,QAAgB;IAEhB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,eAAe,CAAC,GAAG,CAAC;QACzB,KAAK,eAAe,CAAC,OAAO;YAC1B,OAAO,IAAI,CAAC,IAAI,CACd,wBAAwB,GAAG,MAAM,CAAC,QAAQ,CAAC,EAC3C,uBAAuB,CACxB,CAAC;QACJ,KAAK,eAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,IAAI,CAAC,IAAI,CACd,+BAA+B,EAC/B,uBAAuB,CACxB,CAAC;QACJ,KAAK,eAAe,CAAC,KAAK,CAAC;QAC3B,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,IAAI,CAAC,IAAI,CACd,wBAAwB,GAAG,MAAM,CAAC,QAAQ,CAAC,EAC3C,2BAA2B,CAC5B,CAAC;IACN,CAAC;AACH,CAAC;AAED,OAAO,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,aAAa,CAAC"}
|
||||
33
node_modules/@puppeteer/browsers/lib/browser-data/chrome.d.ts
generated
vendored
Normal file
33
node_modules/@puppeteer/browsers/lib/browser-data/chrome.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
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 changeBaseVersionUrlForTesting(url: string): void;
|
||||
export declare function resetBaseVersionUrlForTesting(): void;
|
||||
export declare function getLastKnownGoodReleaseForChannel(channel: ChromeReleaseChannel): Promise<{
|
||||
version: string;
|
||||
revision: string;
|
||||
}>;
|
||||
export declare function getLastKnownGoodReleaseForMilestone(milestone: string): Promise<{
|
||||
version: string;
|
||||
revision: string;
|
||||
} | undefined>;
|
||||
export declare function getLastKnownGoodReleaseForBuild(
|
||||
/**
|
||||
* @example `112.0.23`,
|
||||
*/
|
||||
buildPrefix: string): Promise<{
|
||||
version: string;
|
||||
revision: string;
|
||||
} | undefined>;
|
||||
export declare function resolveBuildId(channel: ChromeReleaseChannel): Promise<string>;
|
||||
export declare function resolveBuildId(channel: string): Promise<string | undefined>;
|
||||
export declare function resolveSystemExecutablePaths(platform: BrowserPlatform, channel: ChromeReleaseChannel): [string, ...string[]];
|
||||
export declare function resolveDefaultUserDataDir(platform: BrowserPlatform, channel: ChromeReleaseChannel): string;
|
||||
export declare function compareVersions(a: string, b: string): number;
|
||||
//# sourceMappingURL=chrome.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/browser-data/chrome.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/browser-data/chrome.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../../src/browser-data/chrome.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAC,MAAM,YAAY,CAAC;AAkBjE,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,SAA6D,GACnE,MAAM,CAER;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAEV;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,MAAM,GACf,MAAM,CAkBR;AAID,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEhE;AACD,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD;AAED,wBAAsB,iCAAiC,CACrD,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAAC,CAoB9C;AAED,wBAAsB,mCAAmC,CACvD,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,GAAG,SAAS,CAAC,CAS1D;AAED,wBAAsB,+BAA+B;AACnD;;GAEG;AACH,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,GAAG,SAAS,CAAC,CAS1D;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAAC;AACnB,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AA2I/B,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,oBAAoB,GAC5B,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAyCvB;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,oBAAoB,GAC5B,MAAM,CA8DR;AAoBD,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CA4B5D"}
|
||||
302
node_modules/@puppeteer/browsers/lib/browser-data/chrome.js
generated
vendored
Normal file
302
node_modules/@puppeteer/browsers/lib/browser-data/chrome.js
generated
vendored
Normal file
@@ -0,0 +1,302 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { execSync } from 'node:child_process';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { getJSON } from '../httpUtil.js';
|
||||
import { BrowserPlatform, ChromeReleaseChannel } from './types.js';
|
||||
function folder(platform) {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return 'linux64';
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return 'mac-arm64';
|
||||
case BrowserPlatform.MAC:
|
||||
return 'mac-x64';
|
||||
case BrowserPlatform.WIN32:
|
||||
return 'win32';
|
||||
case BrowserPlatform.WIN64:
|
||||
return 'win64';
|
||||
}
|
||||
}
|
||||
export function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public') {
|
||||
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
|
||||
}
|
||||
export function resolveDownloadPath(platform, buildId) {
|
||||
return [buildId, folder(platform), `chrome-${folder(platform)}.zip`];
|
||||
}
|
||||
export function relativeExecutablePath(platform, _buildId) {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.MAC:
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return path.join('chrome-' + folder(platform), 'Google Chrome for Testing.app', 'Contents', 'MacOS', 'Google Chrome for Testing');
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return path.join('chrome-linux64', 'chrome');
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return path.join('chrome-' + folder(platform), 'chrome.exe');
|
||||
}
|
||||
}
|
||||
let baseVersionUrl = 'https://googlechromelabs.github.io/chrome-for-testing';
|
||||
export function changeBaseVersionUrlForTesting(url) {
|
||||
baseVersionUrl = url;
|
||||
}
|
||||
export function resetBaseVersionUrlForTesting() {
|
||||
baseVersionUrl = 'https://googlechromelabs.github.io/chrome-for-testing';
|
||||
}
|
||||
export async function getLastKnownGoodReleaseForChannel(channel) {
|
||||
const data = (await getJSON(new URL(`${baseVersionUrl}/last-known-good-versions.json`)));
|
||||
for (const channel of Object.keys(data.channels)) {
|
||||
data.channels[channel.toLowerCase()] = data.channels[channel];
|
||||
delete data.channels[channel];
|
||||
}
|
||||
return data.channels[channel];
|
||||
}
|
||||
export async function getLastKnownGoodReleaseForMilestone(milestone) {
|
||||
const data = (await getJSON(new URL(`${baseVersionUrl}/latest-versions-per-milestone.json`)));
|
||||
return data.milestones[milestone];
|
||||
}
|
||||
export async function getLastKnownGoodReleaseForBuild(
|
||||
/**
|
||||
* @example `112.0.23`,
|
||||
*/
|
||||
buildPrefix) {
|
||||
const data = (await getJSON(new URL(`${baseVersionUrl}/latest-patch-versions-per-build.json`)));
|
||||
return data.builds[buildPrefix];
|
||||
}
|
||||
export async function resolveBuildId(channel) {
|
||||
if (Object.values(ChromeReleaseChannel).includes(channel)) {
|
||||
return (await getLastKnownGoodReleaseForChannel(channel)).version;
|
||||
}
|
||||
if (channel.match(/^\d+$/)) {
|
||||
// Potentially a milestone.
|
||||
return (await getLastKnownGoodReleaseForMilestone(channel))?.version;
|
||||
}
|
||||
if (channel.match(/^\d+\.\d+\.\d+$/)) {
|
||||
// Potentially a build prefix without the patch version.
|
||||
return (await getLastKnownGoodReleaseForBuild(channel))?.version;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const WINDOWS_ENV_PARAM_NAMES = [
|
||||
'PROGRAMFILES',
|
||||
'ProgramW6432',
|
||||
'ProgramFiles(x86)',
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/installer/mini_installer/README.md
|
||||
'LOCALAPPDATA',
|
||||
];
|
||||
function getChromeWindowsLocation(channel, locationsPrefixes) {
|
||||
if (locationsPrefixes.size === 0) {
|
||||
throw new Error('Non of the common Windows Env variables were set');
|
||||
}
|
||||
let suffix;
|
||||
switch (channel) {
|
||||
case ChromeReleaseChannel.STABLE:
|
||||
suffix = 'Google\\Chrome\\Application\\chrome.exe';
|
||||
break;
|
||||
case ChromeReleaseChannel.BETA:
|
||||
suffix = 'Google\\Chrome Beta\\Application\\chrome.exe';
|
||||
break;
|
||||
case ChromeReleaseChannel.CANARY:
|
||||
suffix = 'Google\\Chrome SxS\\Application\\chrome.exe';
|
||||
break;
|
||||
case ChromeReleaseChannel.DEV:
|
||||
suffix = 'Google\\Chrome Dev\\Application\\chrome.exe';
|
||||
break;
|
||||
}
|
||||
return [...locationsPrefixes.values()].map(l => {
|
||||
return path.win32.join(l, suffix);
|
||||
});
|
||||
}
|
||||
function getWslVariable(variable) {
|
||||
try {
|
||||
// The Windows env for the paths are not passed down
|
||||
// to WSL, so we evoke `cmd.exe` which is usually on the PATH
|
||||
// from which the env can be access with all uppercase names.
|
||||
// The return value is a Windows Path - `C:\Program Files`.
|
||||
const result = execSync(`cmd.exe /c echo %${variable.toLocaleUpperCase()}%`, {
|
||||
// We need to ignore the stderr as cmd.exe
|
||||
// prints a message about wrong UNC path not supported.
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
encoding: 'utf-8',
|
||||
}).trim();
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
return;
|
||||
}
|
||||
function getWslLocation(channel) {
|
||||
const wslVersion = execSync('wslinfo --version', {
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
encoding: 'utf-8',
|
||||
}).trim();
|
||||
if (!wslVersion) {
|
||||
throw new Error('Not in WSL or unsupported version of WSL.');
|
||||
}
|
||||
const wslPrefixes = new Set();
|
||||
for (const name of WINDOWS_ENV_PARAM_NAMES) {
|
||||
const wslPrefix = getWslVariable(name);
|
||||
if (wslPrefix) {
|
||||
wslPrefixes.add(wslPrefix);
|
||||
}
|
||||
}
|
||||
const windowsPath = getChromeWindowsLocation(channel, wslPrefixes);
|
||||
return windowsPath.map(path => {
|
||||
// The above command returned the Windows paths `C:\Program Files\...\chrome.exe`
|
||||
// Use the `wslpath` utility tool to transform into the mounted disk
|
||||
return execSync(`wslpath "${path}"`).toString().trim();
|
||||
});
|
||||
}
|
||||
function getChromeLinuxOrWslLocation(channel) {
|
||||
const locations = [];
|
||||
switch (channel) {
|
||||
case ChromeReleaseChannel.STABLE:
|
||||
locations.push('/opt/google/chrome/chrome');
|
||||
break;
|
||||
case ChromeReleaseChannel.BETA:
|
||||
locations.push('/opt/google/chrome-beta/chrome');
|
||||
break;
|
||||
case ChromeReleaseChannel.CANARY:
|
||||
locations.push('/opt/google/chrome-canary/chrome');
|
||||
break;
|
||||
case ChromeReleaseChannel.DEV:
|
||||
locations.push('/opt/google/chrome-unstable/chrome');
|
||||
break;
|
||||
}
|
||||
try {
|
||||
const wslPath = getWslLocation(channel);
|
||||
if (wslPath) {
|
||||
locations.push(...wslPath);
|
||||
}
|
||||
}
|
||||
catch {
|
||||
// Ignore WSL errors
|
||||
}
|
||||
return locations;
|
||||
}
|
||||
export function resolveSystemExecutablePaths(platform, channel) {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.WIN64:
|
||||
case BrowserPlatform.WIN32:
|
||||
const prefixLocation = new Set(WINDOWS_ENV_PARAM_NAMES.map(name => {
|
||||
return process.env[name];
|
||||
}).filter((l) => {
|
||||
return !!l;
|
||||
}));
|
||||
// Fallbacks in case env vars are misconfigured.
|
||||
prefixLocation.add('C:\\Program Files');
|
||||
prefixLocation.add('C:\\Program Files (x86)');
|
||||
prefixLocation.add('D:\\Program Files');
|
||||
prefixLocation.add('D:\\Program Files (x86)');
|
||||
return getChromeWindowsLocation(channel, prefixLocation);
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
switch (channel) {
|
||||
case ChromeReleaseChannel.STABLE:
|
||||
return [
|
||||
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
||||
];
|
||||
case ChromeReleaseChannel.BETA:
|
||||
return [
|
||||
'/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta',
|
||||
];
|
||||
case ChromeReleaseChannel.CANARY:
|
||||
return [
|
||||
'/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary',
|
||||
];
|
||||
case ChromeReleaseChannel.DEV:
|
||||
return [
|
||||
'/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev',
|
||||
];
|
||||
}
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return getChromeLinuxOrWslLocation(channel);
|
||||
}
|
||||
}
|
||||
export function resolveDefaultUserDataDir(platform, channel) {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.WIN64:
|
||||
case BrowserPlatform.WIN32:
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/chrome_paths_win.cc;l=42;drc=4c86c7940a47c36b8bf52c134483ef2da86caa62
|
||||
switch (channel) {
|
||||
case ChromeReleaseChannel.STABLE:
|
||||
return path.join(getLocalAppDataWin(), 'Google', 'Chrome', 'User Data');
|
||||
case ChromeReleaseChannel.BETA:
|
||||
return path.join(getLocalAppDataWin(), 'Google', 'Chrome Beta', 'User Data');
|
||||
case ChromeReleaseChannel.CANARY:
|
||||
return path.join(getLocalAppDataWin(), 'Google', 'Chrome SxS', 'User Data');
|
||||
case ChromeReleaseChannel.DEV:
|
||||
return path.join(getLocalAppDataWin(), 'Google', 'Chrome Dev', 'User Data');
|
||||
}
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/chrome_paths_mac.mm;l=86;drc=4c86c7940a47c36b8bf52c134483ef2da86caa62
|
||||
switch (channel) {
|
||||
case ChromeReleaseChannel.STABLE:
|
||||
return path.join(getBaseUserDataDirPathMac(), 'Chrome');
|
||||
case ChromeReleaseChannel.BETA:
|
||||
return path.join(getBaseUserDataDirPathMac(), 'Chrome Beta');
|
||||
case ChromeReleaseChannel.DEV:
|
||||
return path.join(getBaseUserDataDirPathMac(), 'Chrome Dev');
|
||||
case ChromeReleaseChannel.CANARY:
|
||||
return path.join(getBaseUserDataDirPathMac(), 'Chrome Canary');
|
||||
}
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/chrome_paths_linux.cc;l=80;drc=4c86c7940a47c36b8bf52c134483ef2da86caa62
|
||||
switch (channel) {
|
||||
case ChromeReleaseChannel.STABLE:
|
||||
return path.join(getConfigHomeLinux(), 'google-chrome');
|
||||
case ChromeReleaseChannel.BETA:
|
||||
return path.join(getConfigHomeLinux(), 'google-chrome-beta');
|
||||
case ChromeReleaseChannel.CANARY:
|
||||
return path.join(getConfigHomeLinux(), 'google-chrome-canary');
|
||||
case ChromeReleaseChannel.DEV:
|
||||
return path.join(getConfigHomeLinux(), 'google-chrome-unstable');
|
||||
}
|
||||
}
|
||||
}
|
||||
function getLocalAppDataWin() {
|
||||
return (process.env['LOCALAPPDATA'] || path.join(os.homedir(), 'AppData', 'Local'));
|
||||
}
|
||||
function getConfigHomeLinux() {
|
||||
return (process.env['CHROME_CONFIG_HOME'] ||
|
||||
process.env['XDG_CONFIG_HOME'] ||
|
||||
path.join(os.homedir(), '.config'));
|
||||
}
|
||||
function getBaseUserDataDirPathMac() {
|
||||
return path.join(os.homedir(), 'Library', 'Application Support', 'Google');
|
||||
}
|
||||
export function compareVersions(a, b) {
|
||||
const cleanA = a.trim();
|
||||
const cleanB = b.trim();
|
||||
const versionRegex = /^\d+(?:\.\d+){0,3}$/;
|
||||
if (!versionRegex.test(cleanA)) {
|
||||
throw new Error(`Version ${a} is not a valid Chrome version`);
|
||||
}
|
||||
if (!versionRegex.test(cleanB)) {
|
||||
throw new Error(`Version ${b} is not a valid Chrome version`);
|
||||
}
|
||||
const aParts = cleanA.split('.').map(Number);
|
||||
const bParts = cleanB.split('.').map(Number);
|
||||
for (let i = 0; i < 4; i++) {
|
||||
const aPart = aParts[i] ?? 0;
|
||||
const bPart = bParts[i] ?? 0;
|
||||
if (aPart > bPart) {
|
||||
return 1;
|
||||
}
|
||||
if (aPart < bPart) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//# sourceMappingURL=chrome.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/browser-data/chrome.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/browser-data/chrome.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/@puppeteer/browsers/lib/browser-data/chromedriver.d.ts
generated
vendored
Normal file
6
node_modules/@puppeteer/browsers/lib/browser-data/chromedriver.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { BrowserPlatform } 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 { resolveBuildId, compareVersions } from './chrome.js';
|
||||
//# sourceMappingURL=chromedriver.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/browser-data/chromedriver.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/browser-data/chromedriver.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"chromedriver.d.ts","sourceRoot":"","sources":["../../src/browser-data/chromedriver.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAkB3C,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,SAA6D,GACnE,MAAM,CAER;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAEV;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,MAAM,GACf,MAAM,CAYR;AAED,OAAO,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,aAAa,CAAC"}
|
||||
43
node_modules/@puppeteer/browsers/lib/browser-data/chromedriver.js
generated
vendored
Normal file
43
node_modules/@puppeteer/browsers/lib/browser-data/chromedriver.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import path from 'node:path';
|
||||
import { BrowserPlatform } from './types.js';
|
||||
function folder(platform) {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return 'linux64';
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return 'mac-arm64';
|
||||
case BrowserPlatform.MAC:
|
||||
return 'mac-x64';
|
||||
case BrowserPlatform.WIN32:
|
||||
return 'win32';
|
||||
case BrowserPlatform.WIN64:
|
||||
return 'win64';
|
||||
}
|
||||
}
|
||||
export function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public') {
|
||||
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
|
||||
}
|
||||
export function resolveDownloadPath(platform, buildId) {
|
||||
return [buildId, folder(platform), `chromedriver-${folder(platform)}.zip`];
|
||||
}
|
||||
export function relativeExecutablePath(platform, _buildId) {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.MAC:
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return path.join('chromedriver-' + folder(platform), 'chromedriver');
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return path.join('chromedriver-linux64', 'chromedriver');
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return path.join('chromedriver-' + folder(platform), 'chromedriver.exe');
|
||||
}
|
||||
}
|
||||
export { resolveBuildId, compareVersions } from './chrome.js';
|
||||
//# sourceMappingURL=chromedriver.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/browser-data/chromedriver.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/browser-data/chromedriver.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"chromedriver.js","sourceRoot":"","sources":["../../src/browser-data/chromedriver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAE3C,SAAS,MAAM,CAAC,QAAyB;IACvC,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,eAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,SAAS,CAAC;QACnB,KAAK,eAAe,CAAC,OAAO;YAC1B,OAAO,WAAW,CAAC;QACrB,KAAK,eAAe,CAAC,GAAG;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,OAAO,CAAC;QACjB,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,OAAO,CAAC;IACnB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,QAAyB,EACzB,OAAe,EACf,OAAO,GAAG,0DAA0D;IAEpE,OAAO,GAAG,OAAO,IAAI,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,QAAyB,EACzB,OAAe;IAEf,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,gBAAgB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAAyB,EACzB,QAAgB;IAEhB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,eAAe,CAAC,GAAG,CAAC;QACzB,KAAK,eAAe,CAAC,OAAO;YAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC,CAAC;QACvE,KAAK,eAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;QAC3D,KAAK,eAAe,CAAC,KAAK,CAAC;QAC3B,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC;AAED,OAAO,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,aAAa,CAAC"}
|
||||
12
node_modules/@puppeteer/browsers/lib/browser-data/chromium.d.ts
generated
vendored
Normal file
12
node_modules/@puppeteer/browsers/lib/browser-data/chromium.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { BrowserPlatform } 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(platform: BrowserPlatform): Promise<string>;
|
||||
export declare function compareVersions(a: string, b: string): number;
|
||||
//# sourceMappingURL=chromium.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/browser-data/chromium.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/browser-data/chromium.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"chromium.d.ts","sourceRoot":"","sources":["../../src/browser-data/chromium.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAiC3C,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,SAA8D,GACpE,MAAM,CAER;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAEV;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,MAAM,GACf,MAAM,CAkBR;AACD,wBAAsB,cAAc,CAClC,QAAQ,EAAE,eAAe,GACxB,OAAO,CAAC,MAAM,CAAC,CAQjB;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5D"}
|
||||
63
node_modules/@puppeteer/browsers/lib/browser-data/chromium.js
generated
vendored
Normal file
63
node_modules/@puppeteer/browsers/lib/browser-data/chromium.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import path from 'node:path';
|
||||
import { getText } from '../httpUtil.js';
|
||||
import { BrowserPlatform } from './types.js';
|
||||
function archive(platform, buildId) {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return 'chrome-linux';
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
return 'chrome-mac';
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
// Windows archive name changed at r591479.
|
||||
return parseInt(buildId, 10) > 591479 ? 'chrome-win' : 'chrome-win32';
|
||||
}
|
||||
}
|
||||
function folder(platform) {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return 'Linux_x64';
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return 'Mac_Arm';
|
||||
case BrowserPlatform.MAC:
|
||||
return 'Mac';
|
||||
case BrowserPlatform.WIN32:
|
||||
return 'Win';
|
||||
case BrowserPlatform.WIN64:
|
||||
return 'Win_x64';
|
||||
}
|
||||
}
|
||||
export function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chromium-browser-snapshots') {
|
||||
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
|
||||
}
|
||||
export function resolveDownloadPath(platform, buildId) {
|
||||
return [folder(platform), buildId, `${archive(platform, buildId)}.zip`];
|
||||
}
|
||||
export function relativeExecutablePath(platform, _buildId) {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.MAC:
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return path.join('chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium');
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return path.join('chrome-linux', 'chrome');
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return path.join('chrome-win', 'chrome.exe');
|
||||
}
|
||||
}
|
||||
export async function resolveBuildId(platform) {
|
||||
return await getText(new URL(`https://storage.googleapis.com/chromium-browser-snapshots/${folder(platform)}/LAST_CHANGE`));
|
||||
}
|
||||
export function compareVersions(a, b) {
|
||||
return Number(a) - Number(b);
|
||||
}
|
||||
//# sourceMappingURL=chromium.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/browser-data/chromium.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/browser-data/chromium.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"chromium.js","sourceRoot":"","sources":["../../src/browser-data/chromium.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAE3C,SAAS,OAAO,CAAC,QAAyB,EAAE,OAAe;IACzD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,eAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,cAAc,CAAC;QACxB,KAAK,eAAe,CAAC,OAAO,CAAC;QAC7B,KAAK,eAAe,CAAC,GAAG;YACtB,OAAO,YAAY,CAAC;QACtB,KAAK,eAAe,CAAC,KAAK,CAAC;QAC3B,KAAK,eAAe,CAAC,KAAK;YACxB,2CAA2C;YAC3C,OAAO,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC;IAC1E,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,QAAyB;IACvC,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,eAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,WAAW,CAAC;QACrB,KAAK,eAAe,CAAC,OAAO;YAC1B,OAAO,SAAS,CAAC;QACnB,KAAK,eAAe,CAAC,GAAG;YACtB,OAAO,KAAK,CAAC;QACf,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,KAAK,CAAC;QACf,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,QAAyB,EACzB,OAAe,EACf,OAAO,GAAG,2DAA2D;IAErE,OAAO,GAAG,OAAO,IAAI,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,QAAyB,EACzB,OAAe;IAEf,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAAyB,EACzB,QAAgB;IAEhB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,eAAe,CAAC,GAAG,CAAC;QACzB,KAAK,eAAe,CAAC,OAAO;YAC1B,OAAO,IAAI,CAAC,IAAI,CACd,YAAY,EACZ,cAAc,EACd,UAAU,EACV,OAAO,EACP,UAAU,CACX,CAAC;QACJ,KAAK,eAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;QAC7C,KAAK,eAAe,CAAC,KAAK,CAAC;QAC3B,KAAK,eAAe,CAAC,KAAK;YACxB,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;AACH,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAyB;IAEzB,OAAO,MAAM,OAAO,CAClB,IAAI,GAAG,CACL,6DAA6D,MAAM,CACjE,QAAQ,CACT,cAAc,CAChB,CACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,CAAS,EAAE,CAAS;IAClD,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC"}
|
||||
22
node_modules/@puppeteer/browsers/lib/browser-data/firefox.d.ts
generated
vendored
Normal file
22
node_modules/@puppeteer/browsers/lib/browser-data/firefox.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { BrowserPlatform, type ProfileOptions } 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 enum FirefoxChannel {
|
||||
STABLE = "stable",
|
||||
ESR = "esr",
|
||||
DEVEDITION = "devedition",
|
||||
BETA = "beta",
|
||||
NIGHTLY = "nightly"
|
||||
}
|
||||
export declare function changeBaseVersionUrlForTesting(url: string): void;
|
||||
export declare function resetBaseVersionUrlForTesting(): void;
|
||||
export declare function resolveBuildId(channel?: FirefoxChannel): Promise<string>;
|
||||
export declare function createProfile(options: ProfileOptions): Promise<void>;
|
||||
export declare function compareVersions(a: string, b: string): number;
|
||||
//# sourceMappingURL=firefox.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/browser-data/firefox.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/browser-data/firefox.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"firefox.d.ts","sourceRoot":"","sources":["../../src/browser-data/firefox.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,EAAC,eAAe,EAAE,KAAK,cAAc,EAAC,MAAM,YAAY,CAAC;AA8DhE,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAiBR;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAgBV;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,CAoCR;AAED,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAID,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEhE;AAED,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD;AAED,wBAAsB,cAAc,CAClC,OAAO,GAAE,cAAuC,GAC/C,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAa1E;AAgQD,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAG5D"}
|
||||
374
node_modules/@puppeteer/browsers/lib/browser-data/firefox.js
generated
vendored
Normal file
374
node_modules/@puppeteer/browsers/lib/browser-data/firefox.js
generated
vendored
Normal file
@@ -0,0 +1,374 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { getJSON } from '../httpUtil.js';
|
||||
import { BrowserPlatform } from './types.js';
|
||||
function getFormat(buildId) {
|
||||
const majorVersion = Number(buildId.split('.').shift());
|
||||
return majorVersion >= 135 ? 'xz' : 'bz2';
|
||||
}
|
||||
function archiveNightly(platform, buildId) {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX:
|
||||
return `firefox-${buildId}.en-US.linux-x86_64.tar.${getFormat(buildId)}`;
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
return `firefox-${buildId}.en-US.linux-aarch64.tar.${getFormat(buildId)}`;
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
return `firefox-${buildId}.en-US.mac.dmg`;
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return `firefox-${buildId}.en-US.${platform}.zip`;
|
||||
}
|
||||
}
|
||||
function archive(platform, buildId) {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return `firefox-${buildId}.tar.${getFormat(buildId)}`;
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
return `Firefox ${buildId}.dmg`;
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return `Firefox Setup ${buildId}.exe`;
|
||||
}
|
||||
}
|
||||
function platformName(platform) {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX:
|
||||
return `linux-x86_64`;
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
return `linux-aarch64`;
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
return `mac`;
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return platform;
|
||||
}
|
||||
}
|
||||
function parseBuildId(buildId) {
|
||||
for (const value of Object.values(FirefoxChannel)) {
|
||||
if (buildId.startsWith(value + '_')) {
|
||||
buildId = buildId.substring(value.length + 1);
|
||||
return [value, buildId];
|
||||
}
|
||||
}
|
||||
// Older versions do not have channel as the prefix.«
|
||||
return [FirefoxChannel.NIGHTLY, buildId];
|
||||
}
|
||||
export function resolveDownloadUrl(platform, buildId, baseUrl) {
|
||||
const [channel] = parseBuildId(buildId);
|
||||
switch (channel) {
|
||||
case FirefoxChannel.NIGHTLY:
|
||||
baseUrl ??=
|
||||
'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central';
|
||||
break;
|
||||
case FirefoxChannel.DEVEDITION:
|
||||
baseUrl ??= 'https://archive.mozilla.org/pub/devedition/releases';
|
||||
break;
|
||||
case FirefoxChannel.BETA:
|
||||
case FirefoxChannel.STABLE:
|
||||
case FirefoxChannel.ESR:
|
||||
baseUrl ??= 'https://archive.mozilla.org/pub/firefox/releases';
|
||||
break;
|
||||
}
|
||||
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
|
||||
}
|
||||
export function resolveDownloadPath(platform, buildId) {
|
||||
const [channel, resolvedBuildId] = parseBuildId(buildId);
|
||||
switch (channel) {
|
||||
case FirefoxChannel.NIGHTLY:
|
||||
return [archiveNightly(platform, resolvedBuildId)];
|
||||
case FirefoxChannel.DEVEDITION:
|
||||
case FirefoxChannel.BETA:
|
||||
case FirefoxChannel.STABLE:
|
||||
case FirefoxChannel.ESR:
|
||||
return [
|
||||
resolvedBuildId,
|
||||
platformName(platform),
|
||||
'en-US',
|
||||
archive(platform, resolvedBuildId),
|
||||
];
|
||||
}
|
||||
}
|
||||
export function relativeExecutablePath(platform, buildId) {
|
||||
const [channel] = parseBuildId(buildId);
|
||||
switch (channel) {
|
||||
case FirefoxChannel.NIGHTLY:
|
||||
switch (platform) {
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
return path.join('Firefox Nightly.app', 'Contents', 'MacOS', 'firefox');
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return path.join('firefox', 'firefox');
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return path.join('firefox', 'firefox.exe');
|
||||
}
|
||||
case FirefoxChannel.BETA:
|
||||
case FirefoxChannel.DEVEDITION:
|
||||
case FirefoxChannel.ESR:
|
||||
case FirefoxChannel.STABLE:
|
||||
switch (platform) {
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
return path.join('Firefox.app', 'Contents', 'MacOS', 'firefox');
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return path.join('firefox', 'firefox');
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return path.join('core', 'firefox.exe');
|
||||
}
|
||||
}
|
||||
}
|
||||
export var FirefoxChannel;
|
||||
(function (FirefoxChannel) {
|
||||
FirefoxChannel["STABLE"] = "stable";
|
||||
FirefoxChannel["ESR"] = "esr";
|
||||
FirefoxChannel["DEVEDITION"] = "devedition";
|
||||
FirefoxChannel["BETA"] = "beta";
|
||||
FirefoxChannel["NIGHTLY"] = "nightly";
|
||||
})(FirefoxChannel || (FirefoxChannel = {}));
|
||||
let baseVersionUrl = 'https://product-details.mozilla.org/1.0';
|
||||
export function changeBaseVersionUrlForTesting(url) {
|
||||
baseVersionUrl = url;
|
||||
}
|
||||
export function resetBaseVersionUrlForTesting() {
|
||||
baseVersionUrl = 'https://product-details.mozilla.org/1.0';
|
||||
}
|
||||
export async function resolveBuildId(channel = FirefoxChannel.NIGHTLY) {
|
||||
const channelToVersionKey = {
|
||||
[FirefoxChannel.ESR]: 'FIREFOX_ESR',
|
||||
[FirefoxChannel.STABLE]: 'LATEST_FIREFOX_VERSION',
|
||||
[FirefoxChannel.DEVEDITION]: 'FIREFOX_DEVEDITION',
|
||||
[FirefoxChannel.BETA]: 'FIREFOX_DEVEDITION',
|
||||
[FirefoxChannel.NIGHTLY]: 'FIREFOX_NIGHTLY',
|
||||
};
|
||||
const versions = (await getJSON(new URL(`${baseVersionUrl}/firefox_versions.json`)));
|
||||
const version = versions[channelToVersionKey[channel]];
|
||||
if (!version) {
|
||||
throw new Error(`Channel ${channel} is not found.`);
|
||||
}
|
||||
return channel + '_' + version;
|
||||
}
|
||||
export async function createProfile(options) {
|
||||
if (!fs.existsSync(options.path)) {
|
||||
await fs.promises.mkdir(options.path, {
|
||||
recursive: true,
|
||||
});
|
||||
}
|
||||
await syncPreferences({
|
||||
preferences: {
|
||||
...defaultProfilePreferences(options.preferences),
|
||||
...options.preferences,
|
||||
},
|
||||
path: options.path,
|
||||
});
|
||||
}
|
||||
function defaultProfilePreferences(extraPrefs) {
|
||||
const server = 'dummy.test';
|
||||
const defaultPrefs = {
|
||||
// Make sure Shield doesn't hit the network.
|
||||
'app.normandy.api_url': '',
|
||||
// Disable Firefox old build background check
|
||||
'app.update.checkInstallTime': false,
|
||||
// Disable automatically upgrading Firefox
|
||||
'app.update.disabledForTesting': true,
|
||||
// Increase the APZ content response timeout to 1 minute
|
||||
'apz.content_response_timeout': 60000,
|
||||
// Prevent various error message on the console
|
||||
// jest-puppeteer asserts that no error message is emitted by the console
|
||||
'browser.contentblocking.features.standard': '-tp,tpPrivate,cookieBehavior0,-cryptoTP,-fp',
|
||||
// Enable the dump function: which sends messages to the system
|
||||
// console
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1543115
|
||||
'browser.dom.window.dump.enabled': true,
|
||||
// Disable topstories
|
||||
'browser.newtabpage.activity-stream.feeds.system.topstories': false,
|
||||
// Always display a blank page
|
||||
'browser.newtabpage.enabled': false,
|
||||
// Background thumbnails in particular cause grief: and disabling
|
||||
// thumbnails in general cannot hurt
|
||||
'browser.pagethumbnails.capturing_disabled': true,
|
||||
// Disable safebrowsing components.
|
||||
'browser.safebrowsing.blockedURIs.enabled': false,
|
||||
'browser.safebrowsing.downloads.enabled': false,
|
||||
'browser.safebrowsing.malware.enabled': false,
|
||||
'browser.safebrowsing.phishing.enabled': false,
|
||||
// Disable updates to search engines.
|
||||
'browser.search.update': false,
|
||||
// Do not restore the last open set of tabs if the browser has crashed
|
||||
'browser.sessionstore.resume_from_crash': false,
|
||||
// Skip check for default browser on startup
|
||||
'browser.shell.checkDefaultBrowser': false,
|
||||
// Disable newtabpage
|
||||
'browser.startup.homepage': 'about:blank',
|
||||
// Do not redirect user when a milstone upgrade of Firefox is detected
|
||||
'browser.startup.homepage_override.mstone': 'ignore',
|
||||
// Start with a blank page about:blank
|
||||
'browser.startup.page': 0,
|
||||
// Do not allow background tabs to be zombified on Android: otherwise for
|
||||
// tests that open additional tabs: the test harness tab itself might get
|
||||
// unloaded
|
||||
'browser.tabs.disableBackgroundZombification': false,
|
||||
// Do not warn when closing all other open tabs
|
||||
'browser.tabs.warnOnCloseOtherTabs': false,
|
||||
// Do not warn when multiple tabs will be opened
|
||||
'browser.tabs.warnOnOpen': false,
|
||||
// Do not automatically offer translations, as tests do not expect this.
|
||||
'browser.translations.automaticallyPopup': false,
|
||||
// Disable the UI tour.
|
||||
'browser.uitour.enabled': false,
|
||||
// Turn off search suggestions in the location bar so as not to trigger
|
||||
// network connections.
|
||||
'browser.urlbar.suggest.searches': false,
|
||||
// Disable first run splash page on Windows 10
|
||||
'browser.usedOnWindows10.introURL': '',
|
||||
// Do not warn on quitting Firefox
|
||||
'browser.warnOnQuit': false,
|
||||
// Defensively disable data reporting systems
|
||||
'datareporting.healthreport.documentServerURI': `http://${server}/dummy/healthreport/`,
|
||||
'datareporting.healthreport.logging.consoleEnabled': false,
|
||||
'datareporting.healthreport.service.enabled': false,
|
||||
'datareporting.healthreport.service.firstRun': false,
|
||||
'datareporting.healthreport.uploadEnabled': false,
|
||||
// Do not show datareporting policy notifications which can interfere with tests
|
||||
'datareporting.policy.dataSubmissionEnabled': false,
|
||||
'datareporting.policy.dataSubmissionPolicyBypassNotification': true,
|
||||
// DevTools JSONViewer sometimes fails to load dependencies with its require.js.
|
||||
// This doesn't affect Puppeteer but spams console (Bug 1424372)
|
||||
'devtools.jsonview.enabled': false,
|
||||
// Disable popup-blocker
|
||||
'dom.disable_open_during_load': false,
|
||||
// Enable the support for File object creation in the content process
|
||||
// Required for |Page.setFileInputFiles| protocol method.
|
||||
'dom.file.createInChild': true,
|
||||
// Disable the ProcessHangMonitor
|
||||
'dom.ipc.reportProcessHangs': false,
|
||||
// Disable slow script dialogues
|
||||
'dom.max_chrome_script_run_time': 0,
|
||||
'dom.max_script_run_time': 0,
|
||||
// Only load extensions from the application and user profile
|
||||
// AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION
|
||||
'extensions.autoDisableScopes': 0,
|
||||
'extensions.enabledScopes': 5,
|
||||
// Disable metadata caching for installed add-ons by default
|
||||
'extensions.getAddons.cache.enabled': false,
|
||||
// Disable installing any distribution extensions or add-ons.
|
||||
'extensions.installDistroAddons': false,
|
||||
// Turn off extension updates so they do not bother tests
|
||||
'extensions.update.enabled': false,
|
||||
// Turn off extension updates so they do not bother tests
|
||||
'extensions.update.notifyUser': false,
|
||||
// Make sure opening about:addons will not hit the network
|
||||
'extensions.webservice.discoverURL': `http://${server}/dummy/discoveryURL`,
|
||||
// Allow the application to have focus even it runs in the background
|
||||
'focusmanager.testmode': true,
|
||||
// Disable useragent updates
|
||||
'general.useragent.updates.enabled': false,
|
||||
// Always use network provider for geolocation tests so we bypass the
|
||||
// macOS dialog raised by the corelocation provider
|
||||
'geo.provider.testing': true,
|
||||
// Do not scan Wifi
|
||||
'geo.wifi.scan': false,
|
||||
// No hang monitor
|
||||
'hangmonitor.timeout': 0,
|
||||
// Show chrome errors and warnings in the error console
|
||||
'javascript.options.showInConsole': true,
|
||||
// Disable download and usage of OpenH264: and Widevine plugins
|
||||
'media.gmp-manager.updateEnabled': false,
|
||||
// Disable the GFX sanity window
|
||||
'media.sanity-test.disabled': true,
|
||||
// Disable experimental feature that is only available in Nightly
|
||||
'network.cookie.sameSite.laxByDefault': false,
|
||||
// Do not prompt for temporary redirects
|
||||
'network.http.prompt-temp-redirect': false,
|
||||
// Disable speculative connections so they are not reported as leaking
|
||||
// when they are hanging around
|
||||
'network.http.speculative-parallel-limit': 0,
|
||||
// Do not automatically switch between offline and online
|
||||
'network.manage-offline-status': false,
|
||||
// Make sure SNTP requests do not hit the network
|
||||
'network.sntp.pools': server,
|
||||
// Disable Flash.
|
||||
'plugin.state.flash': 0,
|
||||
'privacy.trackingprotection.enabled': false,
|
||||
// Can be removed once Firefox 89 is no longer supported
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1710839
|
||||
'remote.enabled': true,
|
||||
// Until Bug 1999693 is resolved, this preference needs to be set to allow
|
||||
// Webdriver BiDi to automatically dismiss file pickers.
|
||||
'remote.bidi.dismiss_file_pickers.enabled': true,
|
||||
// Disabled screenshots component
|
||||
'screenshots.browser.component.enabled': false,
|
||||
// Don't do network connections for mitm priming
|
||||
'security.certerrors.mitm.priming.enabled': false,
|
||||
// Local documents have access to all other local documents,
|
||||
// including directory listings
|
||||
'security.fileuri.strict_origin_policy': false,
|
||||
// Do not wait for the notification button security delay
|
||||
'security.notification_enable_delay': 0,
|
||||
// Ensure blocklist updates do not hit the network
|
||||
'services.settings.server': `http://${server}/dummy/blocklist/`,
|
||||
// Do not automatically fill sign-in forms with known usernames and
|
||||
// passwords
|
||||
'signon.autofillForms': false,
|
||||
// Disable password capture, so that tests that include forms are not
|
||||
// influenced by the presence of the persistent doorhanger notification
|
||||
'signon.rememberSignons': false,
|
||||
// Disable first-run welcome page
|
||||
'startup.homepage_welcome_url': 'about:blank',
|
||||
// Disable first-run welcome page
|
||||
'startup.homepage_welcome_url.additional': '',
|
||||
// Disable browser animations (tabs, fullscreen, sliding alerts)
|
||||
'toolkit.cosmeticAnimations.enabled': false,
|
||||
// Prevent starting into safe mode after application crashes
|
||||
'toolkit.startup.max_resumed_crashes': -1,
|
||||
};
|
||||
return Object.assign(defaultPrefs, extraPrefs);
|
||||
}
|
||||
async function backupFile(input) {
|
||||
if (!fs.existsSync(input)) {
|
||||
return;
|
||||
}
|
||||
await fs.promises.copyFile(input, input + '.puppeteer');
|
||||
}
|
||||
/**
|
||||
* Populates the user.js file with custom preferences as needed to allow
|
||||
* Firefox's support to properly function. These preferences will be
|
||||
* automatically copied over to prefs.js during startup of Firefox. To be
|
||||
* able to restore the original values of preferences a backup of prefs.js
|
||||
* will be created.
|
||||
*/
|
||||
async function syncPreferences(options) {
|
||||
const prefsPath = path.join(options.path, 'prefs.js');
|
||||
const userPath = path.join(options.path, 'user.js');
|
||||
const lines = Object.entries(options.preferences).map(([key, value]) => {
|
||||
return `user_pref(${JSON.stringify(key)}, ${JSON.stringify(value)});`;
|
||||
});
|
||||
// Use allSettled to prevent corruption.
|
||||
const result = await Promise.allSettled([
|
||||
backupFile(userPath).then(async () => {
|
||||
await fs.promises.writeFile(userPath, lines.join('\n'));
|
||||
}),
|
||||
backupFile(prefsPath),
|
||||
]);
|
||||
for (const command of result) {
|
||||
if (command.status === 'rejected') {
|
||||
throw command.reason;
|
||||
}
|
||||
}
|
||||
}
|
||||
export function compareVersions(a, b) {
|
||||
// TODO: this is a not very reliable check.
|
||||
return parseInt(a.replace('.', ''), 16) - parseInt(b.replace('.', ''), 16);
|
||||
}
|
||||
//# sourceMappingURL=firefox.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/browser-data/firefox.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/browser-data/firefox.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
70
node_modules/@puppeteer/browsers/lib/browser-data/types.d.ts
generated
vendored
Normal file
70
node_modules/@puppeteer/browsers/lib/browser-data/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/**
|
||||
* Supported browsers.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare enum Browser {
|
||||
CHROME = "chrome",
|
||||
CHROMEHEADLESSSHELL = "chrome-headless-shell",
|
||||
CHROMIUM = "chromium",
|
||||
FIREFOX = "firefox",
|
||||
CHROMEDRIVER = "chromedriver"
|
||||
}
|
||||
/**
|
||||
* Platform names used to identify a OS platform x architecture combination in the way
|
||||
* that is relevant for the browser download.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare enum BrowserPlatform {
|
||||
LINUX = "linux",
|
||||
LINUX_ARM = "linux_arm",
|
||||
MAC = "mac",
|
||||
MAC_ARM = "mac_arm",
|
||||
WIN32 = "win32",
|
||||
WIN64 = "win64"
|
||||
}
|
||||
/**
|
||||
* Enum describing a release channel for a browser.
|
||||
*
|
||||
* You can use this in combination with {@link resolveBuildId} to resolve
|
||||
* a build ID based on a release channel.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare enum BrowserTag {
|
||||
CANARY = "canary",
|
||||
NIGHTLY = "nightly",
|
||||
BETA = "beta",
|
||||
DEV = "dev",
|
||||
DEVEDITION = "devedition",
|
||||
STABLE = "stable",
|
||||
ESR = "esr",
|
||||
LATEST = "latest"
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface ProfileOptions {
|
||||
preferences: Record<string, unknown>;
|
||||
path: string;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare enum ChromeReleaseChannel {
|
||||
STABLE = "stable",
|
||||
DEV = "dev",
|
||||
CANARY = "canary",
|
||||
BETA = "beta"
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function verifyChromeReleaseChannel(value: unknown): ChromeReleaseChannel;
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/browser-data/types.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/browser-data/types.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/browser-data/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,oBAAY,OAAO;IACjB,MAAM,WAAW;IACjB,mBAAmB,0BAA0B;IAC7C,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,YAAY,iBAAiB;CAC9B;AAED;;;;;GAKG;AACH,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED;;;;;;;GAOG;AACH,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,oBAAY,oBAAoB;IAC9B,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,GACb,oBAAoB,CAKtB"}
|
||||
72
node_modules/@puppeteer/browsers/lib/browser-data/types.js
generated
vendored
Normal file
72
node_modules/@puppeteer/browsers/lib/browser-data/types.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/**
|
||||
* Supported browsers.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export var Browser;
|
||||
(function (Browser) {
|
||||
Browser["CHROME"] = "chrome";
|
||||
Browser["CHROMEHEADLESSSHELL"] = "chrome-headless-shell";
|
||||
Browser["CHROMIUM"] = "chromium";
|
||||
Browser["FIREFOX"] = "firefox";
|
||||
Browser["CHROMEDRIVER"] = "chromedriver";
|
||||
})(Browser || (Browser = {}));
|
||||
/**
|
||||
* Platform names used to identify a OS platform x architecture combination in the way
|
||||
* that is relevant for the browser download.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export var BrowserPlatform;
|
||||
(function (BrowserPlatform) {
|
||||
BrowserPlatform["LINUX"] = "linux";
|
||||
BrowserPlatform["LINUX_ARM"] = "linux_arm";
|
||||
BrowserPlatform["MAC"] = "mac";
|
||||
BrowserPlatform["MAC_ARM"] = "mac_arm";
|
||||
BrowserPlatform["WIN32"] = "win32";
|
||||
BrowserPlatform["WIN64"] = "win64";
|
||||
})(BrowserPlatform || (BrowserPlatform = {}));
|
||||
/**
|
||||
* Enum describing a release channel for a browser.
|
||||
*
|
||||
* You can use this in combination with {@link resolveBuildId} to resolve
|
||||
* a build ID based on a release channel.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export var BrowserTag;
|
||||
(function (BrowserTag) {
|
||||
BrowserTag["CANARY"] = "canary";
|
||||
BrowserTag["NIGHTLY"] = "nightly";
|
||||
BrowserTag["BETA"] = "beta";
|
||||
BrowserTag["DEV"] = "dev";
|
||||
BrowserTag["DEVEDITION"] = "devedition";
|
||||
BrowserTag["STABLE"] = "stable";
|
||||
BrowserTag["ESR"] = "esr";
|
||||
BrowserTag["LATEST"] = "latest";
|
||||
})(BrowserTag || (BrowserTag = {}));
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export var ChromeReleaseChannel;
|
||||
(function (ChromeReleaseChannel) {
|
||||
ChromeReleaseChannel["STABLE"] = "stable";
|
||||
ChromeReleaseChannel["DEV"] = "dev";
|
||||
ChromeReleaseChannel["CANARY"] = "canary";
|
||||
ChromeReleaseChannel["BETA"] = "beta";
|
||||
})(ChromeReleaseChannel || (ChromeReleaseChannel = {}));
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function verifyChromeReleaseChannel(value) {
|
||||
if (Object.values(ChromeReleaseChannel).includes(value)) {
|
||||
return value;
|
||||
}
|
||||
throw new Error(`Invalid Chrome channel: ${value}`);
|
||||
}
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/browser-data/types.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/browser-data/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/browser-data/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAN,IAAY,OAMX;AAND,WAAY,OAAO;IACjB,4BAAiB,CAAA;IACjB,wDAA6C,CAAA;IAC7C,gCAAqB,CAAA;IACrB,8BAAmB,CAAA;IACnB,wCAA6B,CAAA;AAC/B,CAAC,EANW,OAAO,KAAP,OAAO,QAMlB;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,0CAAuB,CAAA;IACvB,8BAAW,CAAA;IACX,sCAAmB,CAAA;IACnB,kCAAe,CAAA;IACf,kCAAe,CAAA;AACjB,CAAC,EAPW,eAAe,KAAf,eAAe,QAO1B;AAED;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,UASX;AATD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;IACnB,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,uCAAyB,CAAA;IACzB,+BAAiB,CAAA;IACjB,yBAAW,CAAA;IACX,+BAAiB,CAAA;AACnB,CAAC,EATW,UAAU,KAAV,UAAU,QASrB;AAUD;;GAEG;AACH,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,yCAAiB,CAAA;IACjB,mCAAW,CAAA;IACX,yCAAiB,CAAA;IACjB,qCAAa,CAAA;AACf,CAAC,EALW,oBAAoB,KAApB,oBAAoB,QAK/B;AAED;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,IAAI,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC,KAAY,CAAC,EAAE,CAAC;QAC/D,OAAO,KAA6B,CAAC;IACvC,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,2BAA2B,KAAK,EAAE,CAAC,CAAC;AACtD,CAAC"}
|
||||
7
node_modules/@puppeteer/browsers/lib/debug.d.ts
generated
vendored
Normal file
7
node_modules/@puppeteer/browsers/lib/debug.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
export declare const debug: (prefix: string) => ((msg: string, ...param: unknown[]) => void) | undefined;
|
||||
//# sourceMappingURL=debug.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/debug.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/debug.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,eAAO,MAAM,KAAK,GAChB,QAAQ,MAAM,KACb,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC,GAAG,SAGjD,CAAC"}
|
||||
11
node_modules/@puppeteer/browsers/lib/debug.js
generated
vendored
Normal file
11
node_modules/@puppeteer/browsers/lib/debug.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { debuglog } from 'node:util';
|
||||
export const debug = (prefix) => {
|
||||
const log = debuglog(prefix);
|
||||
return log.enabled ? log : undefined;
|
||||
};
|
||||
//# sourceMappingURL=debug.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/debug.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/debug.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEnC,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,MAAc,EAC4C,EAAE;IAC5D,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7B,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AACvC,CAAC,CAAC"}
|
||||
11
node_modules/@puppeteer/browsers/lib/detectPlatform.d.ts
generated
vendored
Normal file
11
node_modules/@puppeteer/browsers/lib/detectPlatform.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { BrowserPlatform } from './browser-data/browser-data.js';
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare function detectBrowserPlatform(): BrowserPlatform | undefined;
|
||||
//# sourceMappingURL=detectPlatform.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/detectPlatform.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/detectPlatform.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectPlatform.d.ts","sourceRoot":"","sources":["../src/detectPlatform.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAE/D;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,GAAG,SAAS,CAmBnE"}
|
||||
47
node_modules/@puppeteer/browsers/lib/detectPlatform.js
generated
vendored
Normal file
47
node_modules/@puppeteer/browsers/lib/detectPlatform.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import os from 'node:os';
|
||||
import { BrowserPlatform } from './browser-data/browser-data.js';
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export function detectBrowserPlatform() {
|
||||
const platform = os.platform();
|
||||
const arch = os.arch();
|
||||
switch (platform) {
|
||||
case 'darwin':
|
||||
return arch === 'arm64' ? BrowserPlatform.MAC_ARM : BrowserPlatform.MAC;
|
||||
case 'linux':
|
||||
return arch === 'arm64'
|
||||
? BrowserPlatform.LINUX_ARM
|
||||
: BrowserPlatform.LINUX;
|
||||
case 'win32':
|
||||
return arch === 'x64' ||
|
||||
// Windows 11 for ARM supports x64 emulation
|
||||
(arch === 'arm64' && isWindows11(os.release()))
|
||||
? BrowserPlatform.WIN64
|
||||
: BrowserPlatform.WIN32;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Windows 11 is identified by the version 10.0.22000 or greater
|
||||
* @internal
|
||||
*/
|
||||
function isWindows11(version) {
|
||||
const parts = version.split('.');
|
||||
if (parts.length > 2) {
|
||||
const major = parseInt(parts[0], 10);
|
||||
const minor = parseInt(parts[1], 10);
|
||||
const patch = parseInt(parts[2], 10);
|
||||
return (major > 10 ||
|
||||
(major === 10 && minor > 0) ||
|
||||
(major === 10 && minor === 0 && patch >= 22000));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//# sourceMappingURL=detectPlatform.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/detectPlatform.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/detectPlatform.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectPlatform.js","sourceRoot":"","sources":["../src/detectPlatform.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAE/D;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IACvB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC;QAC1E,KAAK,OAAO;YACV,OAAO,IAAI,KAAK,OAAO;gBACrB,CAAC,CAAC,eAAe,CAAC,SAAS;gBAC3B,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC;QAC5B,KAAK,OAAO;YACV,OAAO,IAAI,KAAK,KAAK;gBACnB,4CAA4C;gBAC5C,CAAC,IAAI,KAAK,OAAO,IAAI,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC/C,CAAC,CAAC,eAAe,CAAC,KAAK;gBACvB,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC;QAC5B;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,WAAW,CAAC,OAAe;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC;QAC/C,OAAO,CACL,KAAK,GAAG,EAAE;YACV,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,GAAG,CAAC,CAAC;YAC3B,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,CAChD,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
||||
17
node_modules/@puppeteer/browsers/lib/fileUtil.d.ts
generated
vendored
Normal file
17
node_modules/@puppeteer/browsers/lib/fileUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function unpackArchive(archivePath: string, folderPath: string): Promise<void>;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare const internalConstantsForTesting: {
|
||||
xz: string;
|
||||
bzip2: string;
|
||||
};
|
||||
//# sourceMappingURL=fileUtil.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/fileUtil.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/fileUtil.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fileUtil.d.ts","sourceRoot":"","sources":["../src/fileUtil.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgBH;;GAEG;AACH,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CA6Bf;AAgDD;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;CAGvC,CAAC"}
|
||||
212
node_modules/@puppeteer/browsers/lib/fileUtil.js
generated
vendored
Normal file
212
node_modules/@puppeteer/browsers/lib/fileUtil.js
generated
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { spawnSync, spawn, execFile } from 'node:child_process';
|
||||
import { createReadStream } from 'node:fs';
|
||||
import { mkdir, readdir } from 'node:fs/promises';
|
||||
import * as path from 'node:path';
|
||||
import { Stream } from 'node:stream';
|
||||
import { promisify } from 'node:util';
|
||||
import { debug } from './debug.js';
|
||||
const execFileAsync = promisify(execFile);
|
||||
const debugFileUtil = debug('puppeteer:browsers:fileUtil');
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function unpackArchive(archivePath, folderPath) {
|
||||
if (!path.isAbsolute(folderPath)) {
|
||||
folderPath = path.resolve(process.cwd(), folderPath);
|
||||
}
|
||||
if (archivePath.endsWith('.zip')) {
|
||||
await mkdir(folderPath, { recursive: true });
|
||||
await extractZip(archivePath, folderPath);
|
||||
}
|
||||
else if (archivePath.endsWith('.tar.bz2')) {
|
||||
await extractTar(archivePath, folderPath, 'bzip2');
|
||||
}
|
||||
else if (archivePath.endsWith('.dmg')) {
|
||||
await mkdir(folderPath);
|
||||
await installDMG(archivePath, folderPath);
|
||||
}
|
||||
else if (archivePath.endsWith('.exe')) {
|
||||
// Firefox on Windows.
|
||||
const result = spawnSync(archivePath, [`/ExtractDir=${folderPath}`], {
|
||||
env: {
|
||||
__compat_layer: 'RunAsInvoker',
|
||||
},
|
||||
});
|
||||
if (result.status !== 0) {
|
||||
throw new Error(`Failed to extract ${archivePath} to ${folderPath}: ${result.output}`);
|
||||
}
|
||||
}
|
||||
else if (archivePath.endsWith('.tar.xz')) {
|
||||
await extractTar(archivePath, folderPath, 'xz');
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unsupported archive format: ${archivePath}`);
|
||||
}
|
||||
}
|
||||
function createTransformStream(child) {
|
||||
const stream = new Stream.Transform({
|
||||
transform(chunk, encoding, callback) {
|
||||
if (!child.stdin.write(chunk, encoding)) {
|
||||
child.stdin.once('drain', callback);
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
flush(callback) {
|
||||
if (child.stdout.destroyed) {
|
||||
callback();
|
||||
}
|
||||
else {
|
||||
child.stdin.end();
|
||||
child.stdout.on('close', callback);
|
||||
}
|
||||
},
|
||||
});
|
||||
child.stdin.on('error', e => {
|
||||
if ('code' in e && e.code === 'EPIPE') {
|
||||
// finished before reading the file finished (i.e. head)
|
||||
stream.emit('end');
|
||||
}
|
||||
else {
|
||||
stream.destroy(e);
|
||||
}
|
||||
});
|
||||
child.stdout
|
||||
.on('data', data => {
|
||||
return stream.push(data);
|
||||
})
|
||||
.on('error', e => {
|
||||
return stream.destroy(e);
|
||||
});
|
||||
child.once('close', () => {
|
||||
return stream.end();
|
||||
});
|
||||
return stream;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const internalConstantsForTesting = {
|
||||
xz: 'xz',
|
||||
bzip2: 'bzip2',
|
||||
};
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
async function extractTar(tarPath, folderPath, decompressUtilityName) {
|
||||
const { unpackTar } = await import('modern-tar/fs');
|
||||
return await new Promise((fulfill, reject) => {
|
||||
function handleError(utilityName) {
|
||||
return (error) => {
|
||||
if ('code' in error && error.code === 'ENOENT') {
|
||||
error = new Error(`\`${utilityName}\` utility is required to unpack this archive`, {
|
||||
cause: error,
|
||||
});
|
||||
}
|
||||
reject(error);
|
||||
};
|
||||
}
|
||||
const unpack = spawn(internalConstantsForTesting[decompressUtilityName], ['-d'], {
|
||||
stdio: ['pipe', 'pipe', 'inherit'],
|
||||
})
|
||||
.once('error', handleError(decompressUtilityName))
|
||||
.once('exit', code => {
|
||||
debugFileUtil?.(`${decompressUtilityName} exited, code=${code}`);
|
||||
});
|
||||
const tar = unpackTar(folderPath);
|
||||
tar.once('error', handleError('tar'));
|
||||
tar.once('finish', fulfill);
|
||||
createReadStream(tarPath).pipe(createTransformStream(unpack)).pipe(tar);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
async function installDMG(dmgPath, folderPath) {
|
||||
const { stdout } = await execFileAsync('hdiutil', [
|
||||
'attach',
|
||||
'-nobrowse',
|
||||
'-noautoopen',
|
||||
dmgPath,
|
||||
]);
|
||||
const volumes = stdout.match(/\/Volumes\/(.*)/m);
|
||||
if (!volumes) {
|
||||
throw new Error(`Could not find volume path in ${stdout}`);
|
||||
}
|
||||
const mountPath = volumes[0];
|
||||
try {
|
||||
const fileNames = await readdir(mountPath);
|
||||
const appName = fileNames.find(item => {
|
||||
return typeof item === 'string' && item.endsWith('.app');
|
||||
});
|
||||
if (!appName) {
|
||||
throw new Error(`Cannot find app in ${mountPath}`);
|
||||
}
|
||||
const mountedPath = path.join(mountPath, appName);
|
||||
await execFileAsync('cp', ['-R', mountedPath, folderPath]);
|
||||
}
|
||||
finally {
|
||||
await execFileAsync('hdiutil', ['detach', mountPath, '-quiet']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
async function extractZip(archivePath, folderPath) {
|
||||
try {
|
||||
if (process.platform === 'win32') {
|
||||
const systemRoot = process.env['SystemRoot'] ?? process.env['SYSTEMROOT'] ?? 'C:\\Windows';
|
||||
try {
|
||||
const systemTar = `${systemRoot}\\System32\\tar.exe`;
|
||||
// -x: extract files
|
||||
// -f: specify the archive file
|
||||
// -C: extract to the specified directory
|
||||
await execFileAsync(systemTar, ['-xf', archivePath, '-C', folderPath]);
|
||||
return;
|
||||
}
|
||||
catch (tarError) {
|
||||
debugFileUtil?.(`tar.exe extraction failed: ${tarError}`);
|
||||
}
|
||||
try {
|
||||
await execFileAsync('powershell.exe', [
|
||||
'-NoProfile',
|
||||
'-NonInteractive',
|
||||
'-Command',
|
||||
'& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }',
|
||||
archivePath,
|
||||
folderPath,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
catch (powershellError) {
|
||||
debugFileUtil?.(`powershell.exe extraction failed: ${powershellError}`);
|
||||
}
|
||||
await execFileAsync('pwsh.exe', [
|
||||
'-NoProfile',
|
||||
'-NonInteractive',
|
||||
'-Command',
|
||||
'& { Expand-Archive -LiteralPath $args[0] -DestinationPath $args[1] -Force }',
|
||||
archivePath,
|
||||
folderPath,
|
||||
]);
|
||||
}
|
||||
else {
|
||||
// -o: overwrite existing files without prompting
|
||||
// -d: extract files into the specified directory
|
||||
await execFileAsync('unzip', ['-o', archivePath, '-d', folderPath]);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
if (error?.code === 'ENOENT') {
|
||||
throw new Error(`Extraction failed: Required native binary ('tar.exe', 'powershell.exe', 'pwsh.exe' or 'unzip') was not found in the system PATH.`);
|
||||
}
|
||||
throw new Error(`Extraction failed: ${error?.stderr?.toString() || error?.message}`);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=fileUtil.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/fileUtil.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/fileUtil.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
16
node_modules/@puppeteer/browsers/lib/httpUtil.d.ts
generated
vendored
Normal file
16
node_modules/@puppeteer/browsers/lib/httpUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import * as http from 'node:http';
|
||||
import { URL } from 'node:url';
|
||||
export declare function headHttpRequest(url: URL): Promise<boolean>;
|
||||
export declare function httpRequest(url: URL, method: string, response: (x: http.IncomingMessage) => void, keepAlive?: boolean): Promise<http.ClientRequest>;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function downloadFile(url: URL, destinationPath: string, progressCallback?: (downloadedBytes: number, totalBytes: number) => void, expectedHash?: string): Promise<void>;
|
||||
export declare function getJSON(url: URL): Promise<unknown>;
|
||||
export declare function getText(url: URL): Promise<string>;
|
||||
//# sourceMappingURL=httpUtil.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/httpUtil.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/httpUtil.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"httpUtil.d.ts","sourceRoot":"","sources":["../src/httpUtil.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAC,GAAG,EAAmB,MAAM,UAAU,CAAC;AAE/C,wBAAsB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAqBhE;AAED,wBAAsB,WAAW,CAC/B,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,eAAe,KAAK,IAAI,EAC3C,SAAS,UAAO,GACf,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAyC7B;AAyBD;;GAEG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,eAAe,EAAE,MAAM,EACvB,gBAAgB,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,EACxE,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CAiDf;AAED,wBAAsB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAOxD;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAiCjD"}
|
||||
176
node_modules/@puppeteer/browsers/lib/httpUtil.js
generated
vendored
Normal file
176
node_modules/@puppeteer/browsers/lib/httpUtil.js
generated
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { createHash } from 'node:crypto';
|
||||
import { createWriteStream, unlinkSync } from 'node:fs';
|
||||
import * as http from 'node:http';
|
||||
import * as https from 'node:https';
|
||||
import { URL, urlToHttpOptions } from 'node:url';
|
||||
export async function headHttpRequest(url) {
|
||||
return await new Promise(resolve => {
|
||||
httpRequest(url, 'HEAD', response => {
|
||||
// consume response data free node process
|
||||
response.resume();
|
||||
resolve(response.statusCode === 200);
|
||||
}, false)
|
||||
.then(request => {
|
||||
request.on('error', () => {
|
||||
resolve(false);
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
resolve(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
export async function httpRequest(url, method, response, keepAlive = true) {
|
||||
let agent;
|
||||
try {
|
||||
const { ProxyAgent } = await import('proxy-agent');
|
||||
agent = new ProxyAgent();
|
||||
}
|
||||
catch {
|
||||
// Standard Node.js agents will be used.
|
||||
}
|
||||
const options = {
|
||||
protocol: url.protocol,
|
||||
hostname: url.hostname,
|
||||
port: url.port,
|
||||
path: url.pathname + url.search,
|
||||
method,
|
||||
headers: keepAlive ? { Connection: 'keep-alive' } : undefined,
|
||||
auth: urlToHttpOptions(url).auth,
|
||||
agent,
|
||||
};
|
||||
const requestCallback = (res) => {
|
||||
if (res.statusCode &&
|
||||
res.statusCode >= 300 &&
|
||||
res.statusCode < 400 &&
|
||||
res.headers.location) {
|
||||
void httpRequest(new URL(res.headers.location), method, response);
|
||||
// consume response data to free up memory
|
||||
// And prevents the connection from being kept alive
|
||||
res.resume();
|
||||
}
|
||||
else {
|
||||
response(res);
|
||||
}
|
||||
};
|
||||
const request = options.protocol === 'https:'
|
||||
? https.request(options, requestCallback)
|
||||
: http.request(options, requestCallback);
|
||||
request.end();
|
||||
return request;
|
||||
}
|
||||
class HashVerifier {
|
||||
#hash = createHash('sha256');
|
||||
update(chunk) {
|
||||
this.#hash.update(chunk);
|
||||
}
|
||||
verify(url, destinationPath, expectedHash) {
|
||||
const actualHash = this.#hash.digest('hex');
|
||||
if (actualHash !== expectedHash.toLowerCase()) {
|
||||
try {
|
||||
unlinkSync(destinationPath);
|
||||
}
|
||||
catch { }
|
||||
throw new Error(`Integrity check failed for downloaded browser archive.\n` +
|
||||
` URL: ${url}\n` +
|
||||
` Expected: ${expectedHash.toLowerCase()}\n` +
|
||||
` Actual: ${actualHash}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function downloadFile(url, destinationPath, progressCallback, expectedHash) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let downloadedBytes = 0;
|
||||
let totalBytes = 0;
|
||||
const verifier = expectedHash ? new HashVerifier() : null;
|
||||
try {
|
||||
const request = await httpRequest(url, 'GET', response => {
|
||||
if (response.statusCode !== 200) {
|
||||
const error = new Error(`Download failed: server returned code ${response.statusCode}. URL: ${url}`);
|
||||
// consume response data to free up memory
|
||||
response.resume();
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
const file = createWriteStream(destinationPath);
|
||||
file.on('close', () => {
|
||||
if (verifier && expectedHash) {
|
||||
try {
|
||||
verifier.verify(url, destinationPath, expectedHash);
|
||||
}
|
||||
catch (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return resolve();
|
||||
});
|
||||
file.on('error', error => {
|
||||
return reject(error);
|
||||
});
|
||||
totalBytes = parseInt(response.headers['content-length'], 10);
|
||||
response.on('data', (chunk) => {
|
||||
downloadedBytes += chunk.length;
|
||||
verifier?.update(chunk);
|
||||
if (progressCallback) {
|
||||
progressCallback(downloadedBytes, totalBytes);
|
||||
}
|
||||
});
|
||||
response.pipe(file);
|
||||
});
|
||||
request.on('error', error => {
|
||||
return reject(error);
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
export async function getJSON(url) {
|
||||
const text = await getText(url);
|
||||
try {
|
||||
return JSON.parse(text);
|
||||
}
|
||||
catch {
|
||||
throw new Error('Could not parse JSON from ' + url.toString());
|
||||
}
|
||||
}
|
||||
export function getText(url) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const request = await httpRequest(url, '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(`Failed to read text response from ${url}`));
|
||||
}
|
||||
});
|
||||
}, false);
|
||||
request.on('error', err => {
|
||||
reject(err);
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=httpUtil.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/httpUtil.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/httpUtil.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
201
node_modules/@puppeteer/browsers/lib/install.d.ts
generated
vendored
Normal file
201
node_modules/@puppeteer/browsers/lib/install.d.ts
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { Browser, BrowserPlatform } from './browser-data/browser-data.js';
|
||||
import { InstalledBrowser } from './Cache.js';
|
||||
import type { BrowserProvider } from './provider.js';
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface InstallOptions {
|
||||
/**
|
||||
* Determines the path to download browsers to.
|
||||
*/
|
||||
cacheDir: string;
|
||||
/**
|
||||
* Determines which platform the browser will be suited for.
|
||||
*
|
||||
* @defaultValue **Auto-detected.**
|
||||
*/
|
||||
platform?: BrowserPlatform;
|
||||
/**
|
||||
* Determines which browser to install.
|
||||
*/
|
||||
browser: Browser;
|
||||
/**
|
||||
* Determines which buildId to download. BuildId should uniquely identify
|
||||
* binaries and they are used for caching.
|
||||
*/
|
||||
buildId: string;
|
||||
/**
|
||||
* An alias for the provided `buildId`. It will be used to maintain local
|
||||
* metadata to support aliases in the `launch` command.
|
||||
*
|
||||
* @example 'canary'
|
||||
*/
|
||||
buildIdAlias?: string;
|
||||
/**
|
||||
* Provides information about the progress of the download. If set to
|
||||
* 'default', the default callback implementing a progress bar will be
|
||||
* used.
|
||||
*/
|
||||
downloadProgressCallback?: 'default' | ((downloadedBytes: number, totalBytes: number) => void);
|
||||
/**
|
||||
* Determines the host that will be used for downloading.
|
||||
*
|
||||
* @defaultValue Either
|
||||
*
|
||||
* - https://storage.googleapis.com/chrome-for-testing-public or
|
||||
* - https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central
|
||||
*
|
||||
*/
|
||||
baseUrl?: string;
|
||||
/**
|
||||
* Whether to unpack and install browser archives.
|
||||
*
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
unpack?: boolean;
|
||||
/**
|
||||
* @internal
|
||||
* @defaultValue `false`
|
||||
*/
|
||||
forceFallbackForTesting?: boolean;
|
||||
/**
|
||||
* Whether to attempt to install system-level dependencies required
|
||||
* for the browser.
|
||||
*
|
||||
* Only supported for Chrome on Debian or Ubuntu.
|
||||
* Requires system-level privileges to run `apt-get`.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
*/
|
||||
installDeps?: boolean;
|
||||
/**
|
||||
* Expected SHA-256 checksum (lowercase hex) of the downloaded browser archive.
|
||||
* If provided, installation will fail when the downloaded file does not match.
|
||||
* If omitted, the download proceeds without integrity verification.
|
||||
*/
|
||||
expectedHash?: string;
|
||||
/**
|
||||
* Custom provider implementation for alternative download sources.
|
||||
*
|
||||
* If not provided, uses the default provider.
|
||||
* Multiple providers can be chained - they will be tried in order.
|
||||
* The default provider is automatically added as the final fallback.
|
||||
*
|
||||
* ⚠️ **IMPORTANT**: Custom providers are NOT officially supported by
|
||||
* Puppeteer.
|
||||
*
|
||||
* By using custom providers, you accept full responsibility for:
|
||||
*
|
||||
* - **Version compatibility**: Different platforms may receive different
|
||||
* binary versions
|
||||
* - **Archive compatibility**: Binary structure must match Puppeteer's expectations
|
||||
* - **Feature integration**: Browser launch and other Puppeteer features may not work
|
||||
* - **Testing**: You must validate that downloaded binaries work with Puppeteer
|
||||
*
|
||||
* **Puppeteer only tests and guarantees compatibility with default binaries.**
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```typescript
|
||||
* import {ElectronProvider} from './puppeteer-browser-provider-electron.js';
|
||||
*
|
||||
* await install({
|
||||
* browser: Browser.CHROMEDRIVER,
|
||||
* buildId: '142.0.7444.175',
|
||||
* cacheDir: './cache',
|
||||
* providers: [
|
||||
* new ElectronProvider(), // Try Electron releases first
|
||||
* // Falls back to Chrome for Testing automatically
|
||||
* ],
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
providers?: BrowserProvider[];
|
||||
}
|
||||
/**
|
||||
* Downloads and unpacks the browser archive according to the
|
||||
* {@link InstallOptions}.
|
||||
*
|
||||
* @returns a {@link InstalledBrowser} instance.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function install(options: InstallOptions & {
|
||||
unpack?: true;
|
||||
}): Promise<InstalledBrowser>;
|
||||
/**
|
||||
* Downloads the browser archive according to the {@link InstallOptions} without
|
||||
* unpacking.
|
||||
*
|
||||
* @returns the absolute path to the archive.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function install(options: InstallOptions & {
|
||||
unpack: false;
|
||||
}): Promise<string>;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface UninstallOptions {
|
||||
/**
|
||||
* Determines the platform for the browser binary.
|
||||
*
|
||||
* @defaultValue **Auto-detected.**
|
||||
*/
|
||||
platform?: BrowserPlatform;
|
||||
/**
|
||||
* The path to the root of the cache directory.
|
||||
*/
|
||||
cacheDir: string;
|
||||
/**
|
||||
* Determines which browser to uninstall.
|
||||
*/
|
||||
browser: Browser;
|
||||
/**
|
||||
* The browser build to uninstall
|
||||
*/
|
||||
buildId: string;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function uninstall(options: UninstallOptions): Promise<void>;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface GetInstalledBrowsersOptions {
|
||||
/**
|
||||
* The path to the root of the cache directory.
|
||||
*/
|
||||
cacheDir: string;
|
||||
}
|
||||
/**
|
||||
* Returns metadata about browsers installed in the cache directory.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function getInstalledBrowsers(options: GetInstalledBrowsersOptions): Promise<InstalledBrowser[]>;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare function canDownload(options: InstallOptions): Promise<boolean>;
|
||||
/**
|
||||
* Retrieves a URL for downloading the binary archive of a given browser.
|
||||
*
|
||||
* The archive is bound to the specific platform and build ID specified.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function getDownloadUrl(browser: Browser, platform: BrowserPlatform, buildId: string, baseUrl?: string): URL;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function makeProgressCallback(browser: Browser, buildId: string): Promise<(downloadedBytes: number, totalBytes: number) => void>;
|
||||
//# sourceMappingURL=install.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/install.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/install.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EACL,OAAO,EACP,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAQ,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAOnD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAoBnD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,wBAAwB,CAAC,EACrB,SAAS,GACT,CAAC,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC;IAC5D;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,SAAS,CAAC,EAAE,eAAe,EAAE,CAAC;CAC/B;AAmHD;;;;;;;GAOG;AACH,wBAAgB,OAAO,CACrB,OAAO,EAAE,cAAc,GAAG;IAAC,MAAM,CAAC,EAAE,IAAI,CAAA;CAAC,GACxC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC7B;;;;;;;GAOG;AACH,wBAAgB,OAAO,CACrB,OAAO,EAAE,cAAc,GAAG;IAAC,MAAM,EAAE,KAAK,CAAA;CAAC,GACxC,OAAO,CAAC,MAAM,CAAC,CAAC;AAuOnB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAaxE;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAE7B;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAgC3E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,GACf,GAAG,CAEL;AACD;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC,CAehE"}
|
||||
349
node_modules/@puppeteer/browsers/lib/install.js
generated
vendored
Normal file
349
node_modules/@puppeteer/browsers/lib/install.js
generated
vendored
Normal file
@@ -0,0 +1,349 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import assert from 'node:assert';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import { existsSync, readFileSync } from 'node:fs';
|
||||
import { mkdir, unlink } from 'node:fs/promises';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { Browser, BrowserPlatform, downloadUrls, } from './browser-data/browser-data.js';
|
||||
import { Cache, InstalledBrowser } from './Cache.js';
|
||||
import { debug } from './debug.js';
|
||||
import { DefaultProvider } from './DefaultProvider.js';
|
||||
import { detectBrowserPlatform } from './detectPlatform.js';
|
||||
import { unpackArchive } from './fileUtil.js';
|
||||
import { downloadFile, headHttpRequest } from './httpUtil.js';
|
||||
import { ProgressBar } from './ProgressBar.js';
|
||||
const debugInstall = debug('puppeteer:browsers:install');
|
||||
const times = new Map();
|
||||
function debugTime(label) {
|
||||
times.set(label, process.hrtime());
|
||||
}
|
||||
function debugTimeEnd(label) {
|
||||
const end = process.hrtime();
|
||||
const start = times.get(label);
|
||||
if (!start) {
|
||||
return;
|
||||
}
|
||||
const duration = end[0] * 1000 + end[1] / 1e6 - (start[0] * 1000 + start[1] / 1e6); // calculate duration in milliseconds
|
||||
debugInstall?.(`Duration for ${label}: ${duration}ms`);
|
||||
}
|
||||
/**
|
||||
* Install using custom provider plugins.
|
||||
* Tries each provider in order until one succeeds.
|
||||
* Falls back to default provider if all custom providers fail.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
async function installWithProviders(options) {
|
||||
if (!options.platform) {
|
||||
throw new Error('Platform must be defined');
|
||||
}
|
||||
const cache = new Cache(options.cacheDir);
|
||||
const browserRoot = cache.browserRoot(options.browser);
|
||||
// Build provider list with proper fallback behavior
|
||||
const providers = [...(options.providers || [])];
|
||||
// If custom baseUrl is provided, add it as a provider
|
||||
if (options.baseUrl) {
|
||||
providers.push(new DefaultProvider(options.baseUrl));
|
||||
}
|
||||
// Always add default provider as final fallback
|
||||
// (unless custom baseUrl is provided and forceFallbackForTesting is false)
|
||||
if (!options.baseUrl || options.forceFallbackForTesting) {
|
||||
providers.push(new DefaultProvider());
|
||||
}
|
||||
const downloadOptions = {
|
||||
browser: options.browser,
|
||||
platform: options.platform,
|
||||
buildId: options.buildId,
|
||||
progressCallback: options.downloadProgressCallback === 'default'
|
||||
? await makeProgressCallback(options.browser, options.buildIdAlias ?? options.buildId)
|
||||
: options.downloadProgressCallback,
|
||||
};
|
||||
const errors = [];
|
||||
for (const provider of providers) {
|
||||
try {
|
||||
// Check: does this provider support this browser/platform?
|
||||
if (!(await provider.supports(downloadOptions))) {
|
||||
debugInstall?.(`Provider ${provider.getName()} does not support ${options.browser} on ${options.platform}`);
|
||||
continue;
|
||||
}
|
||||
// Warn if using non-default provider
|
||||
if (!(provider instanceof DefaultProvider)) {
|
||||
debugInstall?.(`⚠️ Using custom downloader: ${provider.getName()}`);
|
||||
debugInstall?.(`⚠️ Puppeteer does not guarantee compatibility with non-default providers`);
|
||||
}
|
||||
debugInstall?.(`Trying provider: ${provider.getName()} for ${options.browser} ${options.buildId}`);
|
||||
// Get download URL from provider
|
||||
const url = await provider.getDownloadUrl(downloadOptions);
|
||||
if (!url) {
|
||||
debugInstall?.(`Provider ${provider.getName()} returned no URL for ${options.browser} ${options.buildId}`);
|
||||
continue;
|
||||
}
|
||||
debugInstall?.(`Successfully got URL from ${provider.getName()}: ${url}`);
|
||||
if (!existsSync(browserRoot)) {
|
||||
await mkdir(browserRoot, { recursive: true });
|
||||
}
|
||||
// Download and install using the URL from the provider
|
||||
return await installUrl(url, options, provider);
|
||||
}
|
||||
catch (err) {
|
||||
debugInstall?.(`Provider ${provider.getName()} failed: ${err.message}`);
|
||||
errors.push({
|
||||
providerName: provider.getName(),
|
||||
error: err,
|
||||
});
|
||||
// Continue to next provider
|
||||
}
|
||||
}
|
||||
// All providers failed
|
||||
const errorDetails = errors
|
||||
.map(e => {
|
||||
return ` - ${e.providerName}: ${e.error.message}`;
|
||||
})
|
||||
.join('\n');
|
||||
throw new Error(`All providers failed for ${options.browser} ${options.buildId}:\n${errorDetails}`);
|
||||
}
|
||||
export async function install(options) {
|
||||
options.platform ??= detectBrowserPlatform();
|
||||
options.unpack ??= true;
|
||||
if (!options.platform) {
|
||||
throw new Error(`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`);
|
||||
}
|
||||
// Always use plugin architecture (uses default provider if none specified)
|
||||
options.providers ??= [];
|
||||
return await installWithProviders(options);
|
||||
}
|
||||
async function installDeps(installedBrowser) {
|
||||
if (process.platform !== 'linux' ||
|
||||
installedBrowser.platform !== BrowserPlatform.LINUX) {
|
||||
return;
|
||||
}
|
||||
// Currently, only Debian-like deps are supported.
|
||||
const depsPath = path.join(path.dirname(installedBrowser.executablePath), 'deb.deps');
|
||||
if (!existsSync(depsPath)) {
|
||||
debugInstall?.(`deb.deps file was not found at ${depsPath}`);
|
||||
return;
|
||||
}
|
||||
const data = readFileSync(depsPath, 'utf-8').split('\n').join(',');
|
||||
if (process.getuid?.() !== 0) {
|
||||
throw new Error('Installing system dependencies requires root privileges');
|
||||
}
|
||||
let result = spawnSync('apt-get', ['-v']);
|
||||
if (result.status !== 0) {
|
||||
throw new Error('Failed to install system dependencies: apt-get does not seem to be available');
|
||||
}
|
||||
debugInstall?.(`Trying to install dependencies: ${data}`);
|
||||
result = spawnSync('apt-get', [
|
||||
'satisfy',
|
||||
'-y',
|
||||
data,
|
||||
'--no-install-recommends',
|
||||
]);
|
||||
if (result.status !== 0) {
|
||||
throw new Error(`Failed to install system dependencies: status=${result.status},error=${result.error},stdout=${result.stdout.toString('utf8')},stderr=${result.stderr.toString('utf8')}`);
|
||||
}
|
||||
debugInstall?.(`Installed system dependencies ${data}`);
|
||||
}
|
||||
async function installUrl(url, options, provider) {
|
||||
if (!provider) {
|
||||
throw new Error('Provider is required for installation');
|
||||
}
|
||||
options.platform ??= detectBrowserPlatform();
|
||||
if (!options.platform) {
|
||||
throw new Error(`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`);
|
||||
}
|
||||
let downloadProgressCallback = options.downloadProgressCallback;
|
||||
if (downloadProgressCallback === 'default') {
|
||||
downloadProgressCallback = await makeProgressCallback(options.browser, options.buildIdAlias ?? options.buildId);
|
||||
}
|
||||
const fileName = decodeURIComponent(url.toString()).split('/').pop();
|
||||
assert(fileName, `A malformed download URL was found: ${url}.`);
|
||||
const cache = new Cache(options.cacheDir);
|
||||
const browserRoot = cache.browserRoot(options.browser);
|
||||
const archivePath = path.join(browserRoot, `${options.buildId}-${fileName}`);
|
||||
if (!existsSync(browserRoot)) {
|
||||
await mkdir(browserRoot, { recursive: true });
|
||||
}
|
||||
if (options.expectedHash) {
|
||||
debugInstall?.(`Using provided checksum for ${fileName}: ${options.expectedHash}`);
|
||||
}
|
||||
if (!options.unpack) {
|
||||
if (existsSync(archivePath)) {
|
||||
return archivePath;
|
||||
}
|
||||
debugInstall?.(`Downloading binary from ${url}`);
|
||||
debugTime('download');
|
||||
await downloadFile(url, archivePath, downloadProgressCallback, options.expectedHash);
|
||||
debugTimeEnd('download');
|
||||
return archivePath;
|
||||
}
|
||||
const outputPath = cache.installationDir(options.browser, options.platform, options.buildId);
|
||||
// Get executable path from provider once (used for both cached and new installations)
|
||||
const relativeExecutablePath = await provider.getExecutablePath({
|
||||
browser: options.browser,
|
||||
buildId: options.buildId,
|
||||
platform: options.platform,
|
||||
});
|
||||
debugInstall?.(`Using executable path from provider: ${relativeExecutablePath}`);
|
||||
const installedBrowser = new InstalledBrowser(cache, options.browser, options.buildId, options.platform);
|
||||
// Write metadata for the installation (only for non-default providers)
|
||||
if (!(provider instanceof DefaultProvider)) {
|
||||
cache.writeExecutablePath(options.browser, options.platform, options.buildId, relativeExecutablePath);
|
||||
}
|
||||
try {
|
||||
if (existsSync(outputPath)) {
|
||||
if (!existsSync(installedBrowser.executablePath)) {
|
||||
throw new Error(`The browser folder (${outputPath}) exists but the executable (${installedBrowser.executablePath}) is missing`);
|
||||
}
|
||||
await runSetup(installedBrowser);
|
||||
if (options.installDeps) {
|
||||
await installDeps(installedBrowser);
|
||||
}
|
||||
return installedBrowser;
|
||||
}
|
||||
// Check if archive already exists (e.g., from a custom provider)
|
||||
if (!existsSync(archivePath)) {
|
||||
debugInstall?.(`Downloading binary from ${url}`);
|
||||
try {
|
||||
debugTime('download');
|
||||
await downloadFile(url, archivePath, downloadProgressCallback, options.expectedHash);
|
||||
}
|
||||
finally {
|
||||
debugTimeEnd('download');
|
||||
}
|
||||
}
|
||||
else {
|
||||
debugInstall?.(`Using existing archive at ${archivePath}`);
|
||||
}
|
||||
debugInstall?.(`Installing ${archivePath} to ${outputPath}`);
|
||||
try {
|
||||
debugTime('extract');
|
||||
await unpackArchive(archivePath, outputPath);
|
||||
}
|
||||
finally {
|
||||
debugTimeEnd('extract');
|
||||
}
|
||||
if (options.buildIdAlias) {
|
||||
const metadata = installedBrowser.readMetadata();
|
||||
metadata.aliases[options.buildIdAlias] = options.buildId;
|
||||
installedBrowser.writeMetadata(metadata);
|
||||
}
|
||||
await runSetup(installedBrowser);
|
||||
if (options.installDeps) {
|
||||
await installDeps(installedBrowser);
|
||||
}
|
||||
return installedBrowser;
|
||||
}
|
||||
finally {
|
||||
if (existsSync(archivePath)) {
|
||||
await unlink(archivePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
async function runSetup(installedBrowser) {
|
||||
// On Windows for Chrome invoke setup.exe to configure sandboxes.
|
||||
if ((installedBrowser.platform === BrowserPlatform.WIN32 ||
|
||||
installedBrowser.platform === BrowserPlatform.WIN64) &&
|
||||
installedBrowser.browser === Browser.CHROME &&
|
||||
installedBrowser.platform === detectBrowserPlatform()) {
|
||||
try {
|
||||
debugTime('permissions');
|
||||
const browserDir = path.dirname(installedBrowser.executablePath);
|
||||
const setupExePath = path.join(browserDir, 'setup.exe');
|
||||
if (!existsSync(setupExePath)) {
|
||||
return;
|
||||
}
|
||||
spawnSync(path.join(browserDir, 'setup.exe'), [`--configure-browser-in-directory=` + browserDir], {
|
||||
shell: false,
|
||||
});
|
||||
// TODO: Handle error here. Currently the setup.exe sometimes
|
||||
// errors although it sets the permissions correctly.
|
||||
}
|
||||
finally {
|
||||
debugTimeEnd('permissions');
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export async function uninstall(options) {
|
||||
options.platform ??= detectBrowserPlatform();
|
||||
if (!options.platform) {
|
||||
throw new Error(`Cannot detect the browser platform for: ${os.platform()} (${os.arch()})`);
|
||||
}
|
||||
new Cache(options.cacheDir).uninstall(options.browser, options.platform, options.buildId);
|
||||
}
|
||||
/**
|
||||
* Returns metadata about browsers installed in the cache directory.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export async function getInstalledBrowsers(options) {
|
||||
return new Cache(options.cacheDir).getInstalledBrowsers();
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export async function canDownload(options) {
|
||||
options.platform ??= detectBrowserPlatform();
|
||||
if (!options.platform) {
|
||||
throw new Error(`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`);
|
||||
}
|
||||
// Always use plugin architecture (uses default provider if none specified)
|
||||
const providers = [
|
||||
...(options.providers || []),
|
||||
new DefaultProvider(options.baseUrl),
|
||||
];
|
||||
const downloadOptions = {
|
||||
browser: options.browser,
|
||||
platform: options.platform,
|
||||
buildId: options.buildId,
|
||||
};
|
||||
// Check if any provider can provide a valid, downloadable URL
|
||||
for (const provider of providers) {
|
||||
if (!(await provider.supports(downloadOptions))) {
|
||||
continue;
|
||||
}
|
||||
const url = await provider.getDownloadUrl(downloadOptions);
|
||||
if (url && (await headHttpRequest(url))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Retrieves a URL for downloading the binary archive of a given browser.
|
||||
*
|
||||
* The archive is bound to the specific platform and build ID specified.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function getDownloadUrl(browser, platform, buildId, baseUrl) {
|
||||
return new URL(downloadUrls[browser](platform, buildId, baseUrl));
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export async function makeProgressCallback(browser, buildId) {
|
||||
let ticker;
|
||||
let lastDownloadedBytes = 0;
|
||||
return (downloadedBytes, totalBytes) => {
|
||||
if (!ticker) {
|
||||
ticker = ProgressBar.createBarTicker(`Downloading ${browser} ${buildId} - ${toMegabytes(totalBytes)}`, totalBytes);
|
||||
}
|
||||
const delta = downloadedBytes - lastDownloadedBytes;
|
||||
lastDownloadedBytes = downloadedBytes;
|
||||
ticker(delta);
|
||||
};
|
||||
}
|
||||
function toMegabytes(bytes) {
|
||||
const mb = bytes / 1000 / 1000;
|
||||
return `${Math.round(mb * 10) / 10} MB`;
|
||||
}
|
||||
//# sourceMappingURL=install.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/install.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/install.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
190
node_modules/@puppeteer/browsers/lib/launch.d.ts
generated
vendored
Normal file
190
node_modules/@puppeteer/browsers/lib/launch.d.ts
generated
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import childProcess from 'node:child_process';
|
||||
import { type Browser, type BrowserPlatform, type ChromeReleaseChannel } from './browser-data/browser-data.js';
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface ComputeExecutablePathOptions {
|
||||
/**
|
||||
* Root path to the storage directory.
|
||||
*
|
||||
* Can be set to `null` if the executable path should be relative
|
||||
* to the extracted download location. E.g. `./chrome-linux64/chrome`.
|
||||
*/
|
||||
cacheDir: string | null;
|
||||
/**
|
||||
* Determines which platform the browser will be suited for.
|
||||
*
|
||||
* @defaultValue **Auto-detected.**
|
||||
*/
|
||||
platform?: BrowserPlatform;
|
||||
/**
|
||||
* Determines which browser to launch.
|
||||
*/
|
||||
browser: Browser;
|
||||
/**
|
||||
* Determines which buildId to download. BuildId should uniquely identify
|
||||
* binaries and they are used for caching.
|
||||
*/
|
||||
buildId: string;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare function computeExecutablePath(options: ComputeExecutablePathOptions): string;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface SystemOptions {
|
||||
/**
|
||||
* Determines which platform the browser will be suited for.
|
||||
*
|
||||
* @defaultValue **Auto-detected.**
|
||||
*/
|
||||
platform?: BrowserPlatform;
|
||||
/**
|
||||
* Determines which browser to launch.
|
||||
*/
|
||||
browser: Browser;
|
||||
/**
|
||||
* Release channel to look for on the system.
|
||||
*/
|
||||
channel: ChromeReleaseChannel;
|
||||
}
|
||||
/**
|
||||
* Returns a path to a system-wide Chrome installation given a release channel
|
||||
* name by checking known installation locations (using
|
||||
* {@link https://pptr.dev/browsers-api/browsers.computesystemexecutablepath}).
|
||||
* If Chrome instance is not found at the expected path, an error is thrown.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function computeSystemExecutablePath(options: SystemOptions): string;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface LaunchOptions {
|
||||
/**
|
||||
* Absolute path to the browser's executable.
|
||||
*/
|
||||
executablePath: string;
|
||||
/**
|
||||
* Configures stdio streams to open two additional streams for automation over
|
||||
* those streams instead of WebSocket.
|
||||
*
|
||||
* @defaultValue `false`.
|
||||
*/
|
||||
pipe?: boolean;
|
||||
/**
|
||||
* If true, forwards the browser's process stdout and stderr to the Node's
|
||||
* process stdout and stderr.
|
||||
*
|
||||
* @defaultValue `false`.
|
||||
*/
|
||||
dumpio?: boolean;
|
||||
/**
|
||||
* Additional arguments to pass to the executable when launching.
|
||||
*/
|
||||
args?: string[];
|
||||
/**
|
||||
* Environment variables to set for the browser process.
|
||||
*/
|
||||
env?: Record<string, string | undefined>;
|
||||
/**
|
||||
* Handles SIGINT in the Node process and tries to kill the browser process.
|
||||
*
|
||||
* @defaultValue `true`.
|
||||
*/
|
||||
handleSIGINT?: boolean;
|
||||
/**
|
||||
* Handles SIGTERM in the Node process and tries to gracefully close the browser
|
||||
* process.
|
||||
*
|
||||
* @defaultValue `true`.
|
||||
*/
|
||||
handleSIGTERM?: boolean;
|
||||
/**
|
||||
* Handles SIGHUP in the Node process and tries to gracefully close the browser process.
|
||||
*
|
||||
* @defaultValue `true`.
|
||||
*/
|
||||
handleSIGHUP?: boolean;
|
||||
/**
|
||||
* Whether to spawn process in the {@link https://nodejs.org/api/child_process.html#optionsdetached | detached}
|
||||
* mode.
|
||||
*
|
||||
* @defaultValue `true` except on Windows.
|
||||
*/
|
||||
detached?: boolean;
|
||||
/**
|
||||
* A callback to run after the browser process exits or before the process
|
||||
* will be closed via the {@link Process.close} call (including when handling
|
||||
* signals). The callback is only run once.
|
||||
*/
|
||||
onExit?: () => Promise<void>;
|
||||
/**
|
||||
* If provided, the process will be killed when the signal is aborted.
|
||||
*/
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
/**
|
||||
* Launches a browser process according to {@link LaunchOptions}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function launch(opts: LaunchOptions): Process;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare const CDP_WEBSOCKET_ENDPOINT_REGEX: RegExp;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare const WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX: RegExp;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare class Process {
|
||||
#private;
|
||||
constructor(opts: LaunchOptions);
|
||||
get nodeProcess(): childProcess.ChildProcess;
|
||||
close(): Promise<void>;
|
||||
hasClosed(): Promise<void>;
|
||||
kill(): void;
|
||||
/**
|
||||
* Get recent logs (stderr + stdout) emitted by the browser.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
getRecentLogs(): string[];
|
||||
waitForLineOutput(regex: RegExp, timeout?: number): Promise<string>;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface ErrorLike extends Error {
|
||||
name: string;
|
||||
message: string;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function isErrorLike(obj: unknown): obj is ErrorLike;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function isErrnoException(obj: unknown): obj is NodeJS.ErrnoException;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare class TimeoutError extends Error {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(message?: string);
|
||||
}
|
||||
//# sourceMappingURL=launch.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/launch.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/launch.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../src/launch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAO9C,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAG1B,MAAM,gCAAgC,CAAC;AAOxC;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,MAAM,CAeR;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,oBAAoB,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAyB1E;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAEnD;AAED;;GAEG;AACH,eAAO,MAAM,4BAA4B,QACF,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,uCAAuC,QACP,CAAC;AAuD9C;;GAEG;AACH,qBAAa,OAAO;;gBAmBN,IAAI,EAAE,aAAa;IAgG/B,IAAI,WAAW,IAAI,YAAY,CAAC,YAAY,CAE3C;IAkCK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1B,IAAI,IAAI,IAAI;IAmFZ;;;;OAIG;IACH,aAAa,IAAI,MAAM,EAAE;IAIzB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,OAAO,CAAC,MAAM,CAAC;CA4D/D;AAuBD;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,KAAK;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,SAAS,CAI1D;AACD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CAAC,cAAc,CAK3E;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACrC;;OAEG;gBACS,OAAO,CAAC,EAAE,MAAM;CAK7B"}
|
||||
426
node_modules/@puppeteer/browsers/lib/launch.js
generated
vendored
Normal file
426
node_modules/@puppeteer/browsers/lib/launch.js
generated
vendored
Normal file
@@ -0,0 +1,426 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import childProcess from 'node:child_process';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import { accessSync } from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import readline from 'node:readline';
|
||||
import { executablePathByBrowser, resolveSystemExecutablePaths, } from './browser-data/browser-data.js';
|
||||
import { Cache } from './Cache.js';
|
||||
import { debug } from './debug.js';
|
||||
import { detectBrowserPlatform } from './detectPlatform.js';
|
||||
const debugLaunch = debug('puppeteer:browsers:launcher');
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export function computeExecutablePath(options) {
|
||||
if (options.cacheDir === null) {
|
||||
options.platform ??= detectBrowserPlatform();
|
||||
if (options.platform === undefined) {
|
||||
throw new Error(`No platform specified. Couldn't auto-detect browser platform.`);
|
||||
}
|
||||
return executablePathByBrowser[options.browser](options.platform, options.buildId);
|
||||
}
|
||||
return new Cache(options.cacheDir).computeExecutablePath(options);
|
||||
}
|
||||
/**
|
||||
* Returns a path to a system-wide Chrome installation given a release channel
|
||||
* name by checking known installation locations (using
|
||||
* {@link https://pptr.dev/browsers-api/browsers.computesystemexecutablepath}).
|
||||
* If Chrome instance is not found at the expected path, an error is thrown.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function computeSystemExecutablePath(options) {
|
||||
options.platform ??= detectBrowserPlatform();
|
||||
if (!options.platform) {
|
||||
throw new Error(`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`);
|
||||
}
|
||||
const paths = resolveSystemExecutablePaths(options.browser, options.platform, options.channel);
|
||||
for (const path of paths) {
|
||||
try {
|
||||
accessSync(path);
|
||||
return path;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
throw new Error(`Could not find Google Chrome executable for channel '${options.channel}' at:${paths.map(path => {
|
||||
return `\n - ${path}`;
|
||||
})}.`);
|
||||
}
|
||||
/**
|
||||
* Launches a browser process according to {@link LaunchOptions}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function launch(opts) {
|
||||
return new Process(opts);
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const CDP_WEBSOCKET_ENDPOINT_REGEX = /^DevTools listening on (ws:\/\/.*)$/;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = /^WebDriver BiDi listening on (ws:\/\/.*)$/;
|
||||
const processListeners = new Map();
|
||||
const dispatchers = {
|
||||
exit: (...args) => {
|
||||
processListeners.get('exit')?.forEach(handler => {
|
||||
return handler(...args);
|
||||
});
|
||||
},
|
||||
SIGINT: (...args) => {
|
||||
processListeners.get('SIGINT')?.forEach(handler => {
|
||||
return handler(...args);
|
||||
});
|
||||
},
|
||||
SIGHUP: (...args) => {
|
||||
processListeners.get('SIGHUP')?.forEach(handler => {
|
||||
return handler(...args);
|
||||
});
|
||||
},
|
||||
SIGTERM: (...args) => {
|
||||
processListeners.get('SIGTERM')?.forEach(handler => {
|
||||
return handler(...args);
|
||||
});
|
||||
},
|
||||
};
|
||||
function subscribeToProcessEvent(event, handler) {
|
||||
const listeners = processListeners.get(event) || [];
|
||||
if (listeners.length === 0) {
|
||||
process.on(event, dispatchers[event]);
|
||||
}
|
||||
listeners.push(handler);
|
||||
processListeners.set(event, listeners);
|
||||
}
|
||||
function unsubscribeFromProcessEvent(event, handler) {
|
||||
const listeners = processListeners.get(event) || [];
|
||||
const existingListenerIdx = listeners.indexOf(handler);
|
||||
if (existingListenerIdx === -1) {
|
||||
return;
|
||||
}
|
||||
listeners.splice(existingListenerIdx, 1);
|
||||
processListeners.set(event, listeners);
|
||||
if (listeners.length === 0) {
|
||||
process.off(event, dispatchers[event]);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export class Process {
|
||||
#executablePath;
|
||||
#args;
|
||||
#browserProcess;
|
||||
#exited = false;
|
||||
// The browser process can be closed externally or from the driver process. We
|
||||
// need to invoke the hooks only once though but we don't know how many times
|
||||
// we will be invoked.
|
||||
#hooksRan = false;
|
||||
#onExitHook = async () => { };
|
||||
#browserProcessExiting;
|
||||
#logs = [];
|
||||
#maxLogLinesSize = 1000;
|
||||
#lineEmitter = new EventEmitter();
|
||||
#onAbort = () => {
|
||||
this.kill();
|
||||
};
|
||||
#signal;
|
||||
constructor(opts) {
|
||||
this.#executablePath = opts.executablePath;
|
||||
this.#args = opts.args ?? [];
|
||||
this.#signal = opts.signal;
|
||||
if (this.#signal?.aborted) {
|
||||
throw new Error(this.#signal.reason ? this.#signal.reason : 'Launch aborted');
|
||||
}
|
||||
this.#signal?.addEventListener('abort', this.#onAbort, { once: true });
|
||||
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
|
||||
// leader of a new process group, making it possible to kill child
|
||||
// process tree with `.kill(-pid)` command. @see
|
||||
// https://nodejs.org/api/child_process.html#child_process_options_detached
|
||||
opts.detached ??= process.platform !== 'win32';
|
||||
const stdio = this.#configureStdio({
|
||||
pipe: opts.pipe,
|
||||
});
|
||||
const env = opts.env || {};
|
||||
debugLaunch?.(`Launching ${this.#executablePath} ${this.#args.join(' ')}`, {
|
||||
detached: opts.detached,
|
||||
env: Object.keys(env).reduce((res, key) => {
|
||||
if (key.toLowerCase().startsWith('puppeteer_')) {
|
||||
res[key] = env[key];
|
||||
}
|
||||
return res;
|
||||
}, {}),
|
||||
stdio,
|
||||
});
|
||||
this.#browserProcess = childProcess.spawn(this.#executablePath, this.#args, {
|
||||
detached: opts.detached,
|
||||
env,
|
||||
stdio,
|
||||
});
|
||||
this.#recordStream(this.#browserProcess.stderr);
|
||||
this.#recordStream(this.#browserProcess.stdout);
|
||||
debugLaunch?.(`Launched ${this.#browserProcess.pid}`);
|
||||
if (opts.dumpio) {
|
||||
this.#browserProcess.stderr?.pipe(process.stderr);
|
||||
this.#browserProcess.stdout?.pipe(process.stdout);
|
||||
}
|
||||
subscribeToProcessEvent('exit', this.#onDriverProcessExit);
|
||||
if (opts.handleSIGINT) {
|
||||
subscribeToProcessEvent('SIGINT', this.#onDriverProcessSignal);
|
||||
}
|
||||
if (opts.handleSIGTERM) {
|
||||
subscribeToProcessEvent('SIGTERM', this.#onDriverProcessSignal);
|
||||
}
|
||||
if (opts.handleSIGHUP) {
|
||||
subscribeToProcessEvent('SIGHUP', this.#onDriverProcessSignal);
|
||||
}
|
||||
if (opts.onExit) {
|
||||
this.#onExitHook = opts.onExit;
|
||||
}
|
||||
this.#browserProcessExiting = new Promise((resolve, reject) => {
|
||||
this.#browserProcess.once('exit', async () => {
|
||||
debugLaunch?.(`Browser process ${this.#browserProcess.pid} onExit`);
|
||||
this.#clearListeners();
|
||||
this.#exited = true;
|
||||
try {
|
||||
await this.#runHooks();
|
||||
}
|
||||
catch (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
async #runHooks() {
|
||||
if (this.#hooksRan) {
|
||||
return;
|
||||
}
|
||||
this.#hooksRan = true;
|
||||
await this.#onExitHook();
|
||||
}
|
||||
get nodeProcess() {
|
||||
return this.#browserProcess;
|
||||
}
|
||||
#configureStdio(opts) {
|
||||
if (opts.pipe) {
|
||||
return ['pipe', 'pipe', 'pipe', 'pipe', 'pipe'];
|
||||
}
|
||||
else {
|
||||
return ['pipe', 'pipe', 'pipe'];
|
||||
}
|
||||
}
|
||||
#clearListeners() {
|
||||
unsubscribeFromProcessEvent('exit', this.#onDriverProcessExit);
|
||||
unsubscribeFromProcessEvent('SIGINT', this.#onDriverProcessSignal);
|
||||
unsubscribeFromProcessEvent('SIGTERM', this.#onDriverProcessSignal);
|
||||
unsubscribeFromProcessEvent('SIGHUP', this.#onDriverProcessSignal);
|
||||
this.#signal?.removeEventListener('abort', this.#onAbort);
|
||||
}
|
||||
#onDriverProcessExit = (_code) => {
|
||||
this.kill();
|
||||
};
|
||||
#onDriverProcessSignal = (signal) => {
|
||||
switch (signal) {
|
||||
case 'SIGINT':
|
||||
this.kill();
|
||||
process.exit(130);
|
||||
case 'SIGTERM':
|
||||
case 'SIGHUP':
|
||||
void this.close();
|
||||
break;
|
||||
}
|
||||
};
|
||||
async close() {
|
||||
await this.#runHooks();
|
||||
if (!this.#exited) {
|
||||
this.kill();
|
||||
}
|
||||
return await this.#browserProcessExiting;
|
||||
}
|
||||
hasClosed() {
|
||||
return this.#browserProcessExiting;
|
||||
}
|
||||
kill() {
|
||||
debugLaunch?.(`Trying to kill ${this.#browserProcess.pid}`);
|
||||
// If the process failed to launch (for example if the browser executable path
|
||||
// is invalid), then the process does not get a pid assigned. A call to
|
||||
// `proc.kill` would error, as the `pid` to-be-killed can not be found.
|
||||
if (this.#browserProcess &&
|
||||
this.#browserProcess.pid &&
|
||||
pidExists(this.#browserProcess.pid)) {
|
||||
try {
|
||||
debugLaunch?.(`Browser process ${this.#browserProcess.pid} exists`);
|
||||
if (process.platform === 'win32') {
|
||||
try {
|
||||
childProcess.execSync(`taskkill /pid ${this.#browserProcess.pid} /T /F`);
|
||||
}
|
||||
catch (error) {
|
||||
debugLaunch?.(`Killing ${this.#browserProcess.pid} using taskkill failed`, error);
|
||||
// taskkill can fail to kill the process e.g. due to missing permissions.
|
||||
// Let's kill the process via Node API. This delays killing of all child
|
||||
// processes of `this.proc` until the main Node.js process dies.
|
||||
this.#browserProcess.kill();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// on linux the process group can be killed with the group id prefixed with
|
||||
// a minus sign. The process group id is the group leader's pid.
|
||||
const processGroupId = -this.#browserProcess.pid;
|
||||
try {
|
||||
process.kill(processGroupId, 'SIGKILL');
|
||||
}
|
||||
catch (error) {
|
||||
debugLaunch?.(`Killing ${this.#browserProcess.pid} using process.kill failed`, error);
|
||||
// Killing the process group can fail due e.g. to missing permissions.
|
||||
// Let's kill the process via Node API. This delays killing of all child
|
||||
// processes of `this.proc` until the main Node.js process dies.
|
||||
this.#browserProcess.kill('SIGKILL');
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`${PROCESS_ERROR_EXPLANATION}\nError cause: ${isErrorLike(error) ? error.stack : error}`);
|
||||
}
|
||||
}
|
||||
this.#clearListeners();
|
||||
}
|
||||
#recordStream(stream) {
|
||||
const rl = readline.createInterface(stream);
|
||||
const cleanup = () => {
|
||||
rl.off('line', onLine);
|
||||
rl.off('close', onClose);
|
||||
try {
|
||||
rl.close();
|
||||
}
|
||||
catch { }
|
||||
};
|
||||
const onLine = (line) => {
|
||||
if (line.trim() === '') {
|
||||
return;
|
||||
}
|
||||
this.#logs.push(line);
|
||||
const delta = this.#logs.length - this.#maxLogLinesSize;
|
||||
if (delta) {
|
||||
this.#logs.splice(0, delta);
|
||||
}
|
||||
this.#lineEmitter.emit('line', line);
|
||||
};
|
||||
const onClose = () => {
|
||||
cleanup();
|
||||
};
|
||||
rl.on('line', onLine);
|
||||
rl.on('close', onClose);
|
||||
}
|
||||
/**
|
||||
* Get recent logs (stderr + stdout) emitted by the browser.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
getRecentLogs() {
|
||||
return [...this.#logs];
|
||||
}
|
||||
waitForLineOutput(regex, timeout = 0) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const onClose = (errorOrCode) => {
|
||||
cleanup();
|
||||
reject(new Error([
|
||||
`Failed to launch the browser process: ${errorOrCode instanceof Error
|
||||
? ` ${errorOrCode.message}`
|
||||
: ` Code: ${errorOrCode}`}`,
|
||||
'',
|
||||
`stderr:`,
|
||||
this.getRecentLogs().join('\n'),
|
||||
'',
|
||||
'TROUBLESHOOTING: https://pptr.dev/troubleshooting',
|
||||
'',
|
||||
].join('\n')));
|
||||
};
|
||||
this.#browserProcess.on('exit', onClose);
|
||||
this.#browserProcess.on('error', onClose);
|
||||
const timeoutId = timeout > 0 ? setTimeout(onTimeout, timeout) : undefined;
|
||||
this.#lineEmitter.on('line', onLine);
|
||||
const cleanup = () => {
|
||||
clearTimeout(timeoutId);
|
||||
this.#lineEmitter.off('line', onLine);
|
||||
this.#browserProcess.off('exit', onClose);
|
||||
this.#browserProcess.off('error', onClose);
|
||||
};
|
||||
function onTimeout() {
|
||||
cleanup();
|
||||
reject(new TimeoutError(`Timed out after ${timeout} ms while waiting for the WS endpoint URL to appear in stdout!`));
|
||||
}
|
||||
for (const line of this.#logs) {
|
||||
onLine(line);
|
||||
}
|
||||
function onLine(line) {
|
||||
const match = line.match(regex);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
cleanup();
|
||||
// The RegExp matches, so this will obviously exist.
|
||||
resolve(match[1]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
const PROCESS_ERROR_EXPLANATION = `Puppeteer was unable to kill the process which ran the browser binary.
|
||||
This means that, on future Puppeteer launches, Puppeteer might not be able to launch the browser.
|
||||
Please check your open processes and ensure that the browser processes that Puppeteer launched have been killed.
|
||||
If you think this is a bug, please report it on the Puppeteer issue tracker.`;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function pidExists(pid) {
|
||||
try {
|
||||
return process.kill(pid, 0);
|
||||
}
|
||||
catch (error) {
|
||||
if (isErrnoException(error)) {
|
||||
if (error.code && error.code === 'ESRCH') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function isErrorLike(obj) {
|
||||
return (typeof obj === 'object' && obj !== null && 'name' in obj && 'message' in obj);
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function isErrnoException(obj) {
|
||||
return (isErrorLike(obj) &&
|
||||
('errno' in obj || 'code' in obj || 'path' in obj || 'syscall' in obj));
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export class TimeoutError extends Error {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = this.constructor.name;
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=launch.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/launch.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/launch.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/@puppeteer/browsers/lib/main-cli.d.ts
generated
vendored
Normal file
8
node_modules/@puppeteer/browsers/lib/main-cli.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
export {};
|
||||
//# sourceMappingURL=main-cli.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/main-cli.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/main-cli.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"main-cli.d.ts","sourceRoot":"","sources":["../src/main-cli.ts"],"names":[],"mappings":";AAEA;;;;GAIG"}
|
||||
9
node_modules/@puppeteer/browsers/lib/main-cli.js
generated
vendored
Normal file
9
node_modules/@puppeteer/browsers/lib/main-cli.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { CLI } from './CLI.js';
|
||||
void new CLI().run(process.argv);
|
||||
//# sourceMappingURL=main-cli.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/main-cli.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/main-cli.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"main-cli.js","sourceRoot":"","sources":["../src/main-cli.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AAEH,OAAO,EAAC,GAAG,EAAC,MAAM,UAAU,CAAC;AAE7B,KAAK,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
||||
18
node_modules/@puppeteer/browsers/lib/main.d.ts
generated
vendored
Normal file
18
node_modules/@puppeteer/browsers/lib/main.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
export type { LaunchOptions, ComputeExecutablePathOptions as Options, SystemOptions, } from './launch.js';
|
||||
export { launch, computeExecutablePath, computeSystemExecutablePath, TimeoutError, CDP_WEBSOCKET_ENDPOINT_REGEX, WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX, Process, } from './launch.js';
|
||||
export type { InstallOptions, GetInstalledBrowsersOptions, UninstallOptions, } from './install.js';
|
||||
export { install, getInstalledBrowsers, canDownload, uninstall, getDownloadUrl, } from './install.js';
|
||||
export { detectBrowserPlatform } from './detectPlatform.js';
|
||||
export type { ProfileOptions } from './browser-data/browser-data.js';
|
||||
export { resolveBuildId, Browser, BrowserPlatform, ChromeReleaseChannel, createProfile, getVersionComparator, resolveDefaultUserDataDir, } from './browser-data/browser-data.js';
|
||||
export { CLI } from './CLI.js';
|
||||
export { Cache, InstalledBrowser, type Metadata, type ComputeExecutablePathOptions, } from './Cache.js';
|
||||
export { BrowserTag } from './browser-data/types.js';
|
||||
export { DefaultProvider } from './DefaultProvider.js';
|
||||
export { type BrowserProvider, buildArchiveFilename, type DownloadOptions, } from './provider.js';
|
||||
//# sourceMappingURL=main.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/main.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/main.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,aAAa,EACb,4BAA4B,IAAI,OAAO,EACvC,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,MAAM,EACN,qBAAqB,EACrB,2BAA2B,EAC3B,YAAY,EACZ,4BAA4B,EAC5B,uCAAuC,EACvC,OAAO,GACR,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,cAAc,EACd,2BAA2B,EAC3B,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,OAAO,EACP,oBAAoB,EACpB,WAAW,EACX,SAAS,EACT,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,qBAAqB,EAAC,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAC,cAAc,EAAC,MAAM,gCAAgC,CAAC;AACnE,OAAO,EACL,cAAc,EACd,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAC,GAAG,EAAC,MAAM,UAAU,CAAC;AAC7B,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,4BAA4B,GAClC,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,KAAK,eAAe,EACpB,oBAAoB,EACpB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC"}
|
||||
15
node_modules/@puppeteer/browsers/lib/main.js
generated
vendored
Normal file
15
node_modules/@puppeteer/browsers/lib/main.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
export { launch, computeExecutablePath, computeSystemExecutablePath, TimeoutError, CDP_WEBSOCKET_ENDPOINT_REGEX, WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX, Process, } from './launch.js';
|
||||
export { install, getInstalledBrowsers, canDownload, uninstall, getDownloadUrl, } from './install.js';
|
||||
export { detectBrowserPlatform } from './detectPlatform.js';
|
||||
export { resolveBuildId, Browser, BrowserPlatform, ChromeReleaseChannel, createProfile, getVersionComparator, resolveDefaultUserDataDir, } from './browser-data/browser-data.js';
|
||||
export { CLI } from './CLI.js';
|
||||
export { Cache, InstalledBrowser, } from './Cache.js';
|
||||
export { BrowserTag } from './browser-data/types.js';
|
||||
export { DefaultProvider } from './DefaultProvider.js';
|
||||
export { buildArchiveFilename, } from './provider.js';
|
||||
//# sourceMappingURL=main.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/main.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,EACL,MAAM,EACN,qBAAqB,EACrB,2BAA2B,EAC3B,YAAY,EACZ,4BAA4B,EAC5B,uCAAuC,EACvC,OAAO,GACR,MAAM,aAAa,CAAC;AAMrB,OAAO,EACL,OAAO,EACP,oBAAoB,EACpB,WAAW,EACX,SAAS,EACT,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,qBAAqB,EAAC,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EACL,cAAc,EACd,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAC,GAAG,EAAC,MAAM,UAAU,CAAC;AAC7B,OAAO,EACL,KAAK,EACL,gBAAgB,GAGjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAEL,oBAAoB,GAErB,MAAM,eAAe,CAAC"}
|
||||
153
node_modules/@puppeteer/browsers/lib/provider.d.ts
generated
vendored
Normal file
153
node_modules/@puppeteer/browsers/lib/provider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import type { Browser, BrowserPlatform } from './browser-data/browser-data.js';
|
||||
/**
|
||||
* Options passed to a provider.
|
||||
* @public
|
||||
*/
|
||||
export interface DownloadOptions {
|
||||
browser: Browser;
|
||||
platform: BrowserPlatform;
|
||||
buildId: string;
|
||||
}
|
||||
/**
|
||||
* Interface for custom browser provider implementations.
|
||||
* Allows users to implement alternative download sources for browsers.
|
||||
*
|
||||
* ⚠️ **IMPORTANT**: Custom providers are NOT officially supported by
|
||||
* Puppeteer.
|
||||
*
|
||||
* By implementing this interface, you accept full responsibility for:
|
||||
*
|
||||
* - Ensuring downloaded binaries are compatible with Puppeteer's expectations
|
||||
* - Testing that browser launch and other features work with your binaries
|
||||
* - Maintaining compatibility when Puppeteer or your download source changes
|
||||
* - Version consistency across platforms if mixing sources
|
||||
*
|
||||
* Puppeteer only tests and guarantees Chrome for Testing binaries.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```typescript
|
||||
* class ElectronDownloader implements BrowserProvider {
|
||||
* supports(options: DownloadOptions): boolean {
|
||||
* return options.browser === Browser.CHROMEDRIVER;
|
||||
* }
|
||||
*
|
||||
* getDownloadUrl(options: DownloadOptions): URL {
|
||||
* const platform = mapToPlatform(options.platform);
|
||||
* return new URL(
|
||||
* `v${options.buildId}/chromedriver-v${options.buildId}-${platform}.zip`,
|
||||
* 'https://github.com/electron/electron/releases/download/',
|
||||
* );
|
||||
* }
|
||||
*
|
||||
* getExecutablePath(options): string {
|
||||
* const ext = options.platform.includes('win') ? '.exe' : '';
|
||||
* return `chromedriver/chromedriver${ext}`;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface BrowserProvider {
|
||||
/**
|
||||
* Check if this provider supports the given browser/platform.
|
||||
* Used for filtering before attempting downloads.
|
||||
*
|
||||
* Can be synchronous for quick checks or asynchronous if version
|
||||
* resolution/network requests are needed.
|
||||
*
|
||||
* @param options - Download options to check
|
||||
* @returns True if this provider supports the browser/platform combination
|
||||
*/
|
||||
supports(options: DownloadOptions): Promise<boolean> | boolean;
|
||||
/**
|
||||
* Get the download URL for the requested browser.
|
||||
*
|
||||
* The buildId can be either an exact version (e.g., "131.0.6778.109")
|
||||
* or an alias (e.g., "latest", "stable"). Custom providers should handle
|
||||
* version resolution internally if they support aliases.
|
||||
*
|
||||
* Returns null if the buildId cannot be resolved to a valid version.
|
||||
* The URL is not validated - download will fail later if URL doesn't exist.
|
||||
*
|
||||
* Can be synchronous for simple URL construction or asynchronous if version
|
||||
* resolution/network requests are needed.
|
||||
*
|
||||
* @param options - Download options (buildId may be alias or exact version)
|
||||
* @returns Download URL, or null if version cannot be resolved
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* // Synchronous example
|
||||
* getDownloadUrl(options) {
|
||||
* const platform = mapPlatform(options.platform);
|
||||
* return new URL(`https://releases.example.com/v${options.buildId}/${platform}.zip`);
|
||||
* }
|
||||
*
|
||||
* // Asynchronous example with version mapping
|
||||
* async getDownloadUrl(options) {
|
||||
* const electronVersion = await resolveElectronVersion(options.buildId);
|
||||
* if (!electronVersion) return null;
|
||||
*
|
||||
* const platform = mapPlatform(options.platform);
|
||||
* return new URL(`https://github.com/electron/electron/releases/download/v${electronVersion}/${platform}.zip`);
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
getDownloadUrl(options: DownloadOptions): Promise<URL | null> | URL | null;
|
||||
/**
|
||||
* Get the relative path to the executable within the extracted archive.
|
||||
*
|
||||
* @param options - Browser, buildId, and platform
|
||||
* @returns Relative path to the executable
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* // Electron uses simple structure
|
||||
* getExecutablePath() {
|
||||
* return 'chromedriver/chromedriver';
|
||||
* }
|
||||
*
|
||||
* // Custom provider with platform-specific paths
|
||||
* getExecutablePath(options) {
|
||||
* return `binaries/${options.browser}-${options.platform}`;
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
getExecutablePath(options: {
|
||||
browser: Browser;
|
||||
buildId: string;
|
||||
platform: BrowserPlatform;
|
||||
}): Promise<string> | string;
|
||||
/**
|
||||
* Get the name of this provider.
|
||||
* Used for error messages and logging purposes.
|
||||
*
|
||||
* @returns The provider name (e.g., "DefaultProvider", "CustomProvider")
|
||||
*
|
||||
* @remarks
|
||||
* This method is used instead of `constructor.name` to avoid issues with
|
||||
* minification in production builds.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* getName() {
|
||||
* return 'MyCustomProvider';
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
getName(): string;
|
||||
}
|
||||
/**
|
||||
* Utility function to build a standard archive filename.
|
||||
* @public
|
||||
*/
|
||||
export declare function buildArchiveFilename(browser: Browser, platform: BrowserPlatform, buildId: string, extension?: string): string;
|
||||
//# sourceMappingURL=provider.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/provider.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/provider.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAE,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAE7E;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;IAE3E;;;;;;;;;;;;;;;;;;OAkBG;IACH,iBAAiB,CAAC,OAAO,EAAE;QACzB,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,eAAe,CAAC;KAC3B,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAE7B;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,IAAI,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,SAAS,SAAQ,GAChB,MAAM,CAER"}
|
||||
13
node_modules/@puppeteer/browsers/lib/provider.js
generated
vendored
Normal file
13
node_modules/@puppeteer/browsers/lib/provider.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/**
|
||||
* Utility function to build a standard archive filename.
|
||||
* @public
|
||||
*/
|
||||
export function buildArchiveFilename(browser, platform, buildId, extension = 'zip') {
|
||||
return `${browser}-${platform}-${buildId}.${extension}`;
|
||||
}
|
||||
//# sourceMappingURL=provider.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/provider.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/provider.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAsJH;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAgB,EAChB,QAAyB,EACzB,OAAe,EACf,SAAS,GAAG,KAAK;IAEjB,OAAO,GAAG,OAAO,IAAI,QAAQ,IAAI,OAAO,IAAI,SAAS,EAAE,CAAC;AAC1D,CAAC"}
|
||||
101
node_modules/@puppeteer/browsers/package.json
generated
vendored
Normal file
101
node_modules/@puppeteer/browsers/package.json
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"name": "@puppeteer/browsers",
|
||||
"version": "3.0.5",
|
||||
"description": "Download and launch browsers",
|
||||
"scripts": {
|
||||
"build:docs": "wireit",
|
||||
"build": "wireit",
|
||||
"build:test": "wireit",
|
||||
"clean": "../../tools/clean.mjs",
|
||||
"test": "wireit"
|
||||
},
|
||||
"type": "module",
|
||||
"bin": "lib/main-cli.js",
|
||||
"main": "./lib/main.js",
|
||||
"module": "./lib/main.js",
|
||||
"wireit": {
|
||||
"build": {
|
||||
"command": "tsc -b && node --experimental-strip-types ../../tools/chmod.ts 755 lib/main-cli.js",
|
||||
"files": [
|
||||
"src/**/*.ts",
|
||||
"tsconfig.json"
|
||||
],
|
||||
"clean": "if-file-deleted",
|
||||
"output": [
|
||||
"lib/**"
|
||||
]
|
||||
},
|
||||
"build:docs": {
|
||||
"command": "api-extractor run --local --config \"./api-extractor.docs.json\"",
|
||||
"files": [
|
||||
"api-extractor.docs.json",
|
||||
"lib/main.d.ts",
|
||||
"tsconfig.json"
|
||||
],
|
||||
"dependencies": [
|
||||
"build"
|
||||
]
|
||||
},
|
||||
"build:test": {
|
||||
"command": "tsc -b test/src/tsconfig.json",
|
||||
"files": [
|
||||
"test/**/*.ts",
|
||||
"test/src/tsconfig.json"
|
||||
],
|
||||
"output": [
|
||||
"test/build/**",
|
||||
"!test/build/package.json"
|
||||
],
|
||||
"dependencies": [
|
||||
"build",
|
||||
"../testserver:build"
|
||||
]
|
||||
},
|
||||
"test": {
|
||||
"command": "node tools/downloadTestBrowsers.mjs && mocha",
|
||||
"files": [
|
||||
".mocharc.cjs"
|
||||
],
|
||||
"dependencies": [
|
||||
"build:test"
|
||||
],
|
||||
"env": {
|
||||
"NODE_DEBUG": "puppeteer:*"
|
||||
}
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"puppeteer",
|
||||
"browsers"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/puppeteer/puppeteer/tree/main/packages/browsers"
|
||||
},
|
||||
"author": "The Chromium Authors",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=22.12.0"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"src",
|
||||
"!*.tsbuildinfo"
|
||||
],
|
||||
"dependencies": {
|
||||
"modern-tar": "^0.7.6",
|
||||
"yargs": "^18.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"proxy-agent": ">=8.0.1"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"proxy-agent": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"proxy-agent": ">=8.0.1",
|
||||
"@types/yargs": "17.0.35"
|
||||
}
|
||||
}
|
||||
664
node_modules/@puppeteer/browsers/src/CLI.ts
generated
vendored
Normal file
664
node_modules/@puppeteer/browsers/src/CLI.ts
generated
vendored
Normal file
@@ -0,0 +1,664 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import {spawn} from 'node:child_process';
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import {stdin as input, stdout as output} from 'node:process';
|
||||
import * as readline from 'node:readline';
|
||||
|
||||
import type * as Yargs from 'yargs';
|
||||
|
||||
import {
|
||||
Browser,
|
||||
resolveBuildId,
|
||||
BrowserPlatform,
|
||||
verifyChromeReleaseChannel,
|
||||
} from './browser-data/browser-data.js';
|
||||
import {Cache} from './Cache.js';
|
||||
import {detectBrowserPlatform} from './detectPlatform.js';
|
||||
import {install} from './install.js';
|
||||
import {
|
||||
computeExecutablePath,
|
||||
computeSystemExecutablePath,
|
||||
launch,
|
||||
} from './launch.js';
|
||||
|
||||
interface InstallBrowser {
|
||||
name: Browser;
|
||||
buildId: string;
|
||||
}
|
||||
interface InstallArgs {
|
||||
browser?: InstallBrowser;
|
||||
path?: string;
|
||||
platform?: BrowserPlatform;
|
||||
baseUrl?: string;
|
||||
installDeps?: boolean;
|
||||
format: string;
|
||||
}
|
||||
|
||||
function isValidBrowser(browser: unknown): browser is Browser {
|
||||
return Object.values(Browser).includes(browser as Browser);
|
||||
}
|
||||
|
||||
function isValidPlatform(platform: unknown): platform is BrowserPlatform {
|
||||
return Object.values(BrowserPlatform).includes(platform as BrowserPlatform);
|
||||
}
|
||||
|
||||
// If moved update release-please config
|
||||
// x-release-please-start-version
|
||||
const packageVersion = '3.0.5';
|
||||
// x-release-please-end
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export class CLI {
|
||||
#cachePath: string;
|
||||
#rl?: readline.Interface;
|
||||
#scriptName: string;
|
||||
#version: string;
|
||||
#allowCachePathOverride: boolean;
|
||||
#pinnedBrowsers?: Partial<
|
||||
Record<
|
||||
Browser,
|
||||
{
|
||||
buildId: string;
|
||||
skipDownload: boolean;
|
||||
}
|
||||
>
|
||||
>;
|
||||
#prefixCommand?: {cmd: string; description: string};
|
||||
|
||||
constructor(
|
||||
opts?:
|
||||
| string
|
||||
| {
|
||||
cachePath?: string;
|
||||
scriptName?: string;
|
||||
version?: string;
|
||||
prefixCommand?: {cmd: string; description: string};
|
||||
allowCachePathOverride?: boolean;
|
||||
pinnedBrowsers?: Partial<
|
||||
Record<
|
||||
Browser,
|
||||
{
|
||||
buildId: string;
|
||||
skipDownload: boolean;
|
||||
}
|
||||
>
|
||||
>;
|
||||
},
|
||||
rl?: readline.Interface,
|
||||
) {
|
||||
if (!opts) {
|
||||
opts = {};
|
||||
}
|
||||
if (typeof opts === 'string') {
|
||||
opts = {
|
||||
cachePath: opts,
|
||||
};
|
||||
}
|
||||
this.#cachePath = opts.cachePath ?? process.cwd();
|
||||
this.#rl = rl;
|
||||
this.#scriptName = opts.scriptName ?? '@puppeteer/browsers';
|
||||
this.#version = opts.version ?? packageVersion;
|
||||
this.#allowCachePathOverride = opts.allowCachePathOverride ?? true;
|
||||
this.#pinnedBrowsers = opts.pinnedBrowsers;
|
||||
this.#prefixCommand = opts.prefixCommand;
|
||||
}
|
||||
|
||||
#defineBrowserParameter<T>(
|
||||
yargs: Yargs.Argv<T>,
|
||||
required: true,
|
||||
): Yargs.Argv<T & {browser: InstallBrowser}>;
|
||||
#defineBrowserParameter<T>(
|
||||
yargs: Yargs.Argv<T>,
|
||||
required: boolean,
|
||||
): Yargs.Argv<T & {browser: InstallBrowser | undefined}>;
|
||||
#defineBrowserParameter<T>(yargs: Yargs.Argv<T>, required: boolean) {
|
||||
return yargs.positional('browser', {
|
||||
description:
|
||||
'Which browser to install <browser>[@<buildId|latest>]. `latest` will try to find the latest available build. `buildId` is a browser-specific identifier such as a version or a revision.',
|
||||
type: 'string',
|
||||
coerce: (opt): InstallBrowser => {
|
||||
const browser: InstallBrowser = {
|
||||
name: this.#parseBrowser(opt),
|
||||
buildId: this.#parseBuildId(opt),
|
||||
};
|
||||
|
||||
if (!isValidBrowser(browser.name)) {
|
||||
throw new Error(`Unsupported browser '${browser.name}'`);
|
||||
}
|
||||
|
||||
return browser;
|
||||
},
|
||||
demandOption: required,
|
||||
});
|
||||
}
|
||||
|
||||
#definePlatformParameter<T>(yargs: Yargs.Argv<T>) {
|
||||
return yargs.option('platform', {
|
||||
type: 'string',
|
||||
desc: 'Platform that the binary needs to be compatible with.',
|
||||
choices: Object.values(BrowserPlatform),
|
||||
default: detectBrowserPlatform(),
|
||||
coerce: platform => {
|
||||
if (!isValidPlatform(platform)) {
|
||||
throw new Error(`Unsupported platform '${platform}'`);
|
||||
}
|
||||
|
||||
return platform;
|
||||
},
|
||||
defaultDescription: 'Auto-detected',
|
||||
});
|
||||
}
|
||||
|
||||
#definePathParameter<T>(yargs: Yargs.Argv<T>, required = false) {
|
||||
if (!this.#allowCachePathOverride) {
|
||||
return yargs as Yargs.Argv<T & {path: undefined}>;
|
||||
}
|
||||
|
||||
return yargs.option('path', {
|
||||
type: 'string',
|
||||
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',
|
||||
...(required ? {} : {default: process.cwd()}),
|
||||
demandOption: required,
|
||||
});
|
||||
}
|
||||
|
||||
async run(argv: string[]): Promise<void> {
|
||||
const {default: yargs} = await import('yargs');
|
||||
const {hideBin} = await import('yargs/helpers');
|
||||
const yargsInstance = yargs(hideBin(argv));
|
||||
let target = yargsInstance
|
||||
.scriptName(this.#scriptName)
|
||||
.version(this.#version);
|
||||
if (this.#prefixCommand) {
|
||||
target = target.command(
|
||||
this.#prefixCommand.cmd,
|
||||
this.#prefixCommand.description,
|
||||
yargs => {
|
||||
return this.#build(yargs);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
target = this.#build(target);
|
||||
}
|
||||
await target
|
||||
.demandCommand(1)
|
||||
.help()
|
||||
.wrap(Math.min(120, yargsInstance.terminalWidth()))
|
||||
.parseAsync();
|
||||
}
|
||||
|
||||
#build(yargs: Yargs.Argv<unknown>) {
|
||||
const latestOrPinned = this.#pinnedBrowsers ? 'pinned' : 'latest';
|
||||
// If there are pinned browsers allow the positional arg to be optional
|
||||
const browserArgType = this.#pinnedBrowsers ? '[browser]' : '<browser>';
|
||||
return yargs
|
||||
.command(
|
||||
`install ${browserArgType}`,
|
||||
'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 (see --format).',
|
||||
yargs => {
|
||||
if (this.#pinnedBrowsers) {
|
||||
yargs.example('$0 install', 'Install all pinned browsers');
|
||||
}
|
||||
yargs
|
||||
.example(
|
||||
'$0 install chrome',
|
||||
`Install the ${latestOrPinned} available build of the Chrome browser.`,
|
||||
)
|
||||
.example(
|
||||
'$0 install chrome@latest',
|
||||
'Install the latest available build for the Chrome browser.',
|
||||
)
|
||||
.example(
|
||||
'$0 install chrome@stable',
|
||||
'Install the latest available build for the Chrome browser from the stable channel.',
|
||||
)
|
||||
.example(
|
||||
'$0 install chrome@beta',
|
||||
'Install the latest available build for the Chrome browser from the beta channel.',
|
||||
)
|
||||
.example(
|
||||
'$0 install chrome@dev',
|
||||
'Install the latest available build for the Chrome browser from the dev channel.',
|
||||
)
|
||||
.example(
|
||||
'$0 install chrome@canary',
|
||||
'Install the latest available build for the Chrome Canary browser.',
|
||||
)
|
||||
.example(
|
||||
'$0 install chrome@115',
|
||||
'Install the latest available build for Chrome 115.',
|
||||
)
|
||||
.example(
|
||||
'$0 install chromedriver@canary',
|
||||
'Install the latest available build for ChromeDriver Canary.',
|
||||
)
|
||||
.example(
|
||||
'$0 install chromedriver@115',
|
||||
'Install the latest available build for ChromeDriver 115.',
|
||||
)
|
||||
.example(
|
||||
'$0 install chromedriver@115.0.5790',
|
||||
'Install the latest available patch (115.0.5790.X) build for ChromeDriver.',
|
||||
)
|
||||
.example(
|
||||
'$0 install chrome-headless-shell',
|
||||
'Install the latest available chrome-headless-shell build.',
|
||||
)
|
||||
.example(
|
||||
'$0 install chrome-headless-shell@beta',
|
||||
'Install the latest available chrome-headless-shell build corresponding to the Beta channel.',
|
||||
)
|
||||
.example(
|
||||
'$0 install chrome-headless-shell@118',
|
||||
'Install the latest available chrome-headless-shell 118 build.',
|
||||
)
|
||||
.example(
|
||||
'$0 install chromium@1083080',
|
||||
'Install the revision 1083080 of the Chromium browser.',
|
||||
)
|
||||
.example(
|
||||
'$0 install firefox',
|
||||
'Install the latest nightly available build of the Firefox browser.',
|
||||
)
|
||||
.example(
|
||||
'$0 install firefox@stable',
|
||||
'Install the latest stable build of the Firefox browser.',
|
||||
)
|
||||
.example(
|
||||
'$0 install firefox@beta',
|
||||
'Install the latest beta build of the Firefox browser.',
|
||||
)
|
||||
.example(
|
||||
'$0 install firefox@devedition',
|
||||
'Install the latest devedition build of the Firefox browser.',
|
||||
)
|
||||
.example(
|
||||
'$0 install firefox@esr',
|
||||
'Install the latest ESR build of the Firefox browser.',
|
||||
)
|
||||
.example(
|
||||
'$0 install firefox@nightly',
|
||||
'Install the latest nightly build of the Firefox browser.',
|
||||
)
|
||||
.example(
|
||||
'$0 install firefox@stable_111.0.1',
|
||||
'Install a specific version of the Firefox browser.',
|
||||
)
|
||||
.example(
|
||||
'$0 install firefox --platform mac',
|
||||
'Install the latest Mac (Intel) build of the Firefox browser.',
|
||||
);
|
||||
if (this.#allowCachePathOverride) {
|
||||
yargs.example(
|
||||
'$0 install firefox --path /tmp/my-browser-cache',
|
||||
'Install to the specified cache directory.',
|
||||
);
|
||||
}
|
||||
|
||||
const yargsWithBrowserParam = this.#defineBrowserParameter(
|
||||
yargs,
|
||||
!Boolean(this.#pinnedBrowsers),
|
||||
);
|
||||
const yargsWithPlatformParam = this.#definePlatformParameter(
|
||||
yargsWithBrowserParam,
|
||||
);
|
||||
return this.#definePathParameter(yargsWithPlatformParam, false)
|
||||
.option('base-url', {
|
||||
type: 'string',
|
||||
desc: 'Base URL to download from',
|
||||
})
|
||||
.option('install-deps', {
|
||||
type: 'boolean',
|
||||
desc: 'Whether to attempt installing system dependencies (only supported on Linux, requires root privileges).',
|
||||
default: false,
|
||||
})
|
||||
.option('format', {
|
||||
type: 'string',
|
||||
desc: 'Format to use for the output. Supported placeholders: {{browser}}, {{buildId}}, {{path}}, {{platform}}',
|
||||
default: '{{browser}}@{{buildId}} {{path}}',
|
||||
});
|
||||
},
|
||||
async args => {
|
||||
if (this.#pinnedBrowsers && !args.browser) {
|
||||
// Use allSettled to avoid scenarios that
|
||||
// a browser may fail early and leave the other
|
||||
// installation in a faulty state
|
||||
const result = await Promise.allSettled(
|
||||
Object.entries(this.#pinnedBrowsers).map(
|
||||
async ([browser, options]) => {
|
||||
if (options.skipDownload) {
|
||||
return;
|
||||
}
|
||||
await this.#install({
|
||||
...args,
|
||||
browser: {
|
||||
name: browser as Browser,
|
||||
buildId: options.buildId,
|
||||
},
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
for (const install of result) {
|
||||
if (install.status === 'rejected') {
|
||||
throw install.reason;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
await this.#install(args);
|
||||
}
|
||||
},
|
||||
)
|
||||
.command(
|
||||
'launch <browser>',
|
||||
'Launch the specified browser',
|
||||
yargs => {
|
||||
yargs
|
||||
.example(
|
||||
'$0 launch chrome@115.0.5790.170',
|
||||
'Launch Chrome 115.0.5790.170',
|
||||
)
|
||||
.example(
|
||||
'$0 launch firefox@112.0a1',
|
||||
'Launch the Firefox browser identified by the milestone 112.0a1.',
|
||||
)
|
||||
.example(
|
||||
'$0 launch chrome@115.0.5790.170 --detached',
|
||||
'Launch the browser but detach the sub-processes.',
|
||||
)
|
||||
.example(
|
||||
'$0 launch chrome@canary --system',
|
||||
'Try to locate the Canary build of Chrome installed on the system and launch it.',
|
||||
)
|
||||
.example(
|
||||
'$0 launch chrome@115.0.5790.170 -- --version',
|
||||
'Launch Chrome 115.0.5790.170 and pass custom argument to the binary.',
|
||||
);
|
||||
|
||||
const yargsWithExtraAgs = yargs.parserConfiguration({
|
||||
'populate--': true,
|
||||
// Yargs does not have the correct overload for this.
|
||||
}) as Yargs.Argv<{'--'?: Array<string | number>}>;
|
||||
const yargsWithBrowserParam = this.#defineBrowserParameter(
|
||||
yargsWithExtraAgs,
|
||||
true,
|
||||
);
|
||||
const yargsWithPlatformParam = this.#definePlatformParameter(
|
||||
yargsWithBrowserParam,
|
||||
);
|
||||
return this.#definePathParameter(yargsWithPlatformParam)
|
||||
.option('detached', {
|
||||
type: 'boolean',
|
||||
desc: 'Detach the child process.',
|
||||
default: false,
|
||||
})
|
||||
.option('system', {
|
||||
type: 'boolean',
|
||||
desc: 'Search for a browser installed on the system instead of the cache folder.',
|
||||
default: false,
|
||||
})
|
||||
.option('dumpio', {
|
||||
type: 'boolean',
|
||||
desc: "Forwards the browser's process stdout and stderr",
|
||||
default: false,
|
||||
});
|
||||
},
|
||||
async args => {
|
||||
const extraArgs = args['--']?.filter(arg => {
|
||||
return typeof arg === 'string';
|
||||
});
|
||||
|
||||
args.browser.buildId = this.#resolvePinnedBrowserIfNeeded(
|
||||
args.browser.buildId,
|
||||
args.browser.name,
|
||||
);
|
||||
|
||||
const executablePath = args.system
|
||||
? computeSystemExecutablePath({
|
||||
browser: args.browser.name,
|
||||
channel: verifyChromeReleaseChannel(args.browser.buildId),
|
||||
platform: args.platform,
|
||||
})
|
||||
: computeExecutablePath({
|
||||
browser: args.browser.name,
|
||||
buildId: args.browser.buildId,
|
||||
cacheDir: args.path ?? this.#cachePath,
|
||||
platform: args.platform,
|
||||
});
|
||||
launch({
|
||||
args: extraArgs,
|
||||
executablePath,
|
||||
dumpio: args.dumpio,
|
||||
detached: args.detached,
|
||||
});
|
||||
},
|
||||
)
|
||||
.command(
|
||||
'clear',
|
||||
this.#allowCachePathOverride
|
||||
? 'Removes all installed browsers from the specified cache directory'
|
||||
: `Removes all installed browsers from ${this.#cachePath}`,
|
||||
yargs => {
|
||||
return this.#definePathParameter(yargs, true);
|
||||
},
|
||||
async args => {
|
||||
const cacheDir = args.path ?? this.#cachePath;
|
||||
const rl = this.#rl ?? readline.createInterface({input, output});
|
||||
rl.question(
|
||||
`Do you want to permanently and recursively delete the content of ${cacheDir} (yes/No)? `,
|
||||
answer => {
|
||||
rl.close();
|
||||
if (!['y', 'yes'].includes(answer.toLowerCase().trim())) {
|
||||
console.log('Cancelled.');
|
||||
return;
|
||||
}
|
||||
const cache = new Cache(cacheDir);
|
||||
cache.clear();
|
||||
console.log(`${cacheDir} cleared.`);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
.command(
|
||||
'list',
|
||||
'List all installed browsers in the cache directory',
|
||||
yargs => {
|
||||
yargs.example(
|
||||
'$0 list',
|
||||
'List all installed browsers in the cache directory',
|
||||
);
|
||||
if (this.#allowCachePathOverride) {
|
||||
yargs.example(
|
||||
'$0 list --path /tmp/my-browser-cache',
|
||||
'List browsers installed in the specified cache directory',
|
||||
);
|
||||
}
|
||||
|
||||
return this.#definePathParameter(yargs);
|
||||
},
|
||||
async args => {
|
||||
const cacheDir = args.path ?? this.#cachePath;
|
||||
const cache = new Cache(cacheDir);
|
||||
const browsers = cache.getInstalledBrowsers();
|
||||
|
||||
for (const browser of browsers) {
|
||||
console.log(
|
||||
`${browser.browser}@${browser.buildId} (${browser.platform}) ${browser.executablePath}`,
|
||||
);
|
||||
}
|
||||
},
|
||||
)
|
||||
.command(
|
||||
'bisect <path>',
|
||||
'(experimental) Bisect Chrome for Testing using the specified script. Downloads https://chromium.googlesource.com/chromium/src.git/+/main/tools/bisect-builds.py to ~/bisect-builds.py if needed.',
|
||||
yargs => {
|
||||
return yargs
|
||||
.positional('path', {
|
||||
type: 'string',
|
||||
description: 'Path to a script or test name to bisect.',
|
||||
demandOption: true,
|
||||
})
|
||||
.option('good', {
|
||||
type: 'string',
|
||||
alias: 'g',
|
||||
demandOption: true,
|
||||
desc: 'Last known good version',
|
||||
})
|
||||
.option('bad', {
|
||||
type: 'string',
|
||||
alias: 'b',
|
||||
demandOption: true,
|
||||
desc: 'First known bad version',
|
||||
})
|
||||
.option('cft', {
|
||||
type: 'boolean',
|
||||
desc: 'Use -cft',
|
||||
default: true,
|
||||
});
|
||||
},
|
||||
async args => {
|
||||
const isScript =
|
||||
args.path.endsWith('.mjs') ||
|
||||
args.path.endsWith('.cjs') ||
|
||||
args.path.endsWith('.js');
|
||||
const testCommand = isScript
|
||||
? `PUPPETEER_EXECUTABLE_PATH=%p node ${args.path}`
|
||||
: `BINARY=%p npm run ${args.path}`;
|
||||
|
||||
const bisectScriptPath = path.join(os.homedir(), 'bisect-builds.py');
|
||||
|
||||
if (!fs.existsSync(bisectScriptPath)) {
|
||||
console.log('Downloading bisect-builds.py...');
|
||||
const response = await fetch(
|
||||
'https://chromium.googlesource.com/chromium/src.git/+/main/tools/bisect-builds.py?format=TEXT',
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new Error(
|
||||
`Failed to download bisect-builds.py: ${response.statusText}`,
|
||||
);
|
||||
}
|
||||
const base64Text = await response.text();
|
||||
const decodedText = Buffer.from(base64Text, 'base64').toString(
|
||||
'utf-8',
|
||||
);
|
||||
fs.writeFileSync(bisectScriptPath, decodedText, {mode: 0o755});
|
||||
console.log(`Saved bisect-builds.py to ${bisectScriptPath}`);
|
||||
}
|
||||
|
||||
const pythonExecutable = 'python3';
|
||||
const bisectArgs = [
|
||||
bisectScriptPath,
|
||||
'-g',
|
||||
args.good,
|
||||
'-b',
|
||||
args.bad,
|
||||
args.cft ? '-cft' : '-s',
|
||||
'-v',
|
||||
'--verify-range',
|
||||
'--not-interactive',
|
||||
'-c',
|
||||
testCommand,
|
||||
];
|
||||
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const createProcess = spawn(pythonExecutable, bisectArgs, {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
|
||||
createProcess.on('error', message => {
|
||||
reject(message);
|
||||
});
|
||||
|
||||
createProcess.on('exit', code => {
|
||||
if (code !== 0) {
|
||||
reject(new Error(`Process exited with code ${code}`));
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
)
|
||||
.demandCommand(1)
|
||||
.help();
|
||||
}
|
||||
|
||||
#parseBrowser(version: string): Browser {
|
||||
return version.split('@').shift() as Browser;
|
||||
}
|
||||
|
||||
#parseBuildId(version: string): string {
|
||||
const parts = version.split('@');
|
||||
return parts.length === 2
|
||||
? parts[1]!
|
||||
: this.#pinnedBrowsers
|
||||
? 'pinned'
|
||||
: 'latest';
|
||||
}
|
||||
|
||||
#resolvePinnedBrowserIfNeeded(buildId: string, browserName: Browser): string {
|
||||
if (buildId === 'pinned') {
|
||||
const options = this.#pinnedBrowsers?.[browserName];
|
||||
if (!options || !options.buildId) {
|
||||
throw new Error(`No pinned version found for ${browserName}`);
|
||||
}
|
||||
return options.buildId;
|
||||
}
|
||||
return buildId;
|
||||
}
|
||||
|
||||
async #install(args: InstallArgs) {
|
||||
if (!args.browser) {
|
||||
throw new Error(`No browser arg provided`);
|
||||
}
|
||||
if (!args.platform) {
|
||||
throw new Error(`Could not resolve the current platform`);
|
||||
}
|
||||
args.browser.buildId = this.#resolvePinnedBrowserIfNeeded(
|
||||
args.browser.buildId,
|
||||
args.browser.name,
|
||||
);
|
||||
const originalBuildId = args.browser.buildId;
|
||||
args.browser.buildId = await resolveBuildId(
|
||||
args.browser.name,
|
||||
args.platform,
|
||||
args.browser.buildId,
|
||||
);
|
||||
await install({
|
||||
browser: args.browser.name,
|
||||
buildId: args.browser.buildId,
|
||||
platform: args.platform,
|
||||
cacheDir: args.path ?? this.#cachePath,
|
||||
downloadProgressCallback: 'default',
|
||||
baseUrl: args.baseUrl,
|
||||
buildIdAlias:
|
||||
originalBuildId !== args.browser.buildId ? originalBuildId : undefined,
|
||||
installDeps: args.installDeps,
|
||||
});
|
||||
const executablePath = computeExecutablePath({
|
||||
browser: args.browser.name,
|
||||
buildId: args.browser.buildId,
|
||||
cacheDir: args.path ?? this.#cachePath,
|
||||
platform: args.platform,
|
||||
});
|
||||
|
||||
console.log(
|
||||
args.format
|
||||
.replace(/{{browser}}/g, args.browser.name)
|
||||
.replace(/{{buildId}}/g, args.browser.buildId)
|
||||
.replace(/{{path}}/g, executablePath)
|
||||
.replace(/{{platform}}/g, args.platform),
|
||||
);
|
||||
}
|
||||
}
|
||||
320
node_modules/@puppeteer/browsers/src/Cache.ts
generated
vendored
Normal file
320
node_modules/@puppeteer/browsers/src/Cache.ts
generated
vendored
Normal file
@@ -0,0 +1,320 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
|
||||
import {
|
||||
Browser,
|
||||
type BrowserPlatform,
|
||||
executablePathByBrowser,
|
||||
getVersionComparator,
|
||||
} from './browser-data/browser-data.js';
|
||||
import {debug} from './debug.js';
|
||||
import {detectBrowserPlatform} from './detectPlatform.js';
|
||||
|
||||
const debugCache = debug('puppeteer:browsers:cache');
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export class InstalledBrowser {
|
||||
browser: Browser;
|
||||
buildId: string;
|
||||
platform: BrowserPlatform;
|
||||
readonly executablePath: string;
|
||||
|
||||
#cache: Cache;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(
|
||||
cache: Cache,
|
||||
browser: Browser,
|
||||
buildId: string,
|
||||
platform: BrowserPlatform,
|
||||
) {
|
||||
this.#cache = cache;
|
||||
this.browser = browser;
|
||||
this.buildId = buildId;
|
||||
this.platform = platform;
|
||||
this.executablePath = cache.computeExecutablePath({
|
||||
browser,
|
||||
buildId,
|
||||
platform,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to the root of the installation folder. Use
|
||||
* {@link computeExecutablePath} to get the path to the executable binary.
|
||||
*/
|
||||
get path(): string {
|
||||
return this.#cache.installationDir(
|
||||
this.browser,
|
||||
this.platform,
|
||||
this.buildId,
|
||||
);
|
||||
}
|
||||
|
||||
readMetadata(): Metadata {
|
||||
return this.#cache.readMetadata(this.browser);
|
||||
}
|
||||
|
||||
writeMetadata(metadata: Metadata): void {
|
||||
this.#cache.writeMetadata(this.browser, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface ComputeExecutablePathOptions {
|
||||
/**
|
||||
* Determines which platform the browser will be suited for.
|
||||
*
|
||||
* @defaultValue **Auto-detected.**
|
||||
*/
|
||||
platform?: BrowserPlatform;
|
||||
/**
|
||||
* Determines which browser to launch.
|
||||
*/
|
||||
browser: Browser;
|
||||
/**
|
||||
* Determines which buildId to download. BuildId should uniquely identify
|
||||
* binaries and they are used for caching.
|
||||
*/
|
||||
buildId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Metadata {
|
||||
// Maps an alias (canary/latest/dev/etc.) to a buildId.
|
||||
aliases: Record<string, string>;
|
||||
// Maps installation key (platform-buildId) to executable path.
|
||||
executablePaths?: Record<string, string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* The cache used by Puppeteer relies on the following structure:
|
||||
*
|
||||
* - rootDir
|
||||
* -- <browser1> | browserRoot(browser1)
|
||||
* ---- <platform>-<buildId> | installationDir()
|
||||
* ------ the browser-platform-buildId
|
||||
* ------ specific structure.
|
||||
* -- <browser2> | browserRoot(browser2)
|
||||
* ---- <platform>-<buildId> | installationDir()
|
||||
* ------ the browser-platform-buildId
|
||||
* ------ specific structure.
|
||||
* @internal
|
||||
*/
|
||||
export class Cache {
|
||||
#rootDir: string;
|
||||
|
||||
constructor(rootDir: string) {
|
||||
this.#rootDir = rootDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
get rootDir(): string {
|
||||
return this.#rootDir;
|
||||
}
|
||||
|
||||
browserRoot(browser: Browser): string {
|
||||
return path.join(this.#rootDir, browser);
|
||||
}
|
||||
|
||||
metadataFile(browser: Browser): string {
|
||||
return path.join(this.browserRoot(browser), '.metadata');
|
||||
}
|
||||
|
||||
readMetadata(browser: Browser): Metadata {
|
||||
const metatadaPath = this.metadataFile(browser);
|
||||
if (!fs.existsSync(metatadaPath)) {
|
||||
return {aliases: {}};
|
||||
}
|
||||
// TODO: add type-safe parsing.
|
||||
const data = JSON.parse(fs.readFileSync(metatadaPath, 'utf8'));
|
||||
if (typeof data !== 'object') {
|
||||
throw new Error('.metadata is not an object');
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
writeMetadata(browser: Browser, metadata: Metadata): void {
|
||||
const metatadaPath = this.metadataFile(browser);
|
||||
fs.mkdirSync(path.dirname(metatadaPath), {recursive: true});
|
||||
fs.writeFileSync(metatadaPath, JSON.stringify(metadata, null, 2));
|
||||
}
|
||||
|
||||
readExecutablePath(
|
||||
browser: Browser,
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
): string | null {
|
||||
const metadata = this.readMetadata(browser);
|
||||
const key = `${platform}-${buildId}`;
|
||||
return metadata.executablePaths?.[key] ?? null;
|
||||
}
|
||||
|
||||
writeExecutablePath(
|
||||
browser: Browser,
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
executablePath: string,
|
||||
): void {
|
||||
const metadata = this.readMetadata(browser);
|
||||
if (!metadata.executablePaths) {
|
||||
metadata.executablePaths = {};
|
||||
}
|
||||
const key = `${platform}-${buildId}`;
|
||||
metadata.executablePaths[key] = executablePath;
|
||||
this.writeMetadata(browser, metadata);
|
||||
}
|
||||
|
||||
resolveAlias(browser: Browser, alias: string): string | undefined {
|
||||
const metadata = this.readMetadata(browser);
|
||||
if (alias === 'latest') {
|
||||
return Object.values(metadata.aliases || {})
|
||||
.sort(getVersionComparator(browser))
|
||||
.at(-1);
|
||||
}
|
||||
return metadata.aliases[alias];
|
||||
}
|
||||
|
||||
installationDir(
|
||||
browser: Browser,
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
): string {
|
||||
return path.join(this.browserRoot(browser), `${platform}-${buildId}`);
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
fs.rmSync(this.#rootDir, {
|
||||
force: true,
|
||||
recursive: true,
|
||||
maxRetries: 10,
|
||||
retryDelay: 500,
|
||||
});
|
||||
}
|
||||
|
||||
uninstall(
|
||||
browser: Browser,
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
): void {
|
||||
const metadata = this.readMetadata(browser);
|
||||
for (const alias of Object.keys(metadata.aliases)) {
|
||||
if (metadata.aliases[alias] === buildId) {
|
||||
delete metadata.aliases[alias];
|
||||
}
|
||||
}
|
||||
// Clean up executable path entry
|
||||
const key = `${platform}-${buildId}`;
|
||||
if (metadata.executablePaths?.[key]) {
|
||||
delete metadata.executablePaths[key];
|
||||
this.writeMetadata(browser, metadata);
|
||||
}
|
||||
fs.rmSync(this.installationDir(browser, platform, buildId), {
|
||||
force: true,
|
||||
recursive: true,
|
||||
maxRetries: 10,
|
||||
retryDelay: 500,
|
||||
});
|
||||
}
|
||||
|
||||
getInstalledBrowsers(): InstalledBrowser[] {
|
||||
if (!fs.existsSync(this.#rootDir)) {
|
||||
return [];
|
||||
}
|
||||
const types = fs.readdirSync(this.#rootDir);
|
||||
const browsers = types.filter((t): t is Browser => {
|
||||
return (Object.values(Browser) as string[]).includes(t);
|
||||
});
|
||||
return browsers.flatMap(browser => {
|
||||
const files = fs.readdirSync(this.browserRoot(browser));
|
||||
return files
|
||||
.map(file => {
|
||||
const result = parseFolderPath(
|
||||
path.join(this.browserRoot(browser), file),
|
||||
);
|
||||
if (!result) {
|
||||
return null;
|
||||
}
|
||||
return new InstalledBrowser(
|
||||
this,
|
||||
browser,
|
||||
result.buildId,
|
||||
result.platform as BrowserPlatform,
|
||||
);
|
||||
})
|
||||
.filter((item: InstalledBrowser | null): item is InstalledBrowser => {
|
||||
return item !== null;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
computeExecutablePath(options: ComputeExecutablePathOptions): string {
|
||||
options.platform ??= detectBrowserPlatform();
|
||||
if (!options.platform) {
|
||||
throw new Error(
|
||||
`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`,
|
||||
);
|
||||
}
|
||||
try {
|
||||
options.buildId =
|
||||
this.resolveAlias(options.browser, options.buildId) ?? options.buildId;
|
||||
} catch {
|
||||
debugCache?.('could not read .metadata file for the browser');
|
||||
}
|
||||
const installationDir = this.installationDir(
|
||||
options.browser,
|
||||
options.platform,
|
||||
options.buildId,
|
||||
);
|
||||
|
||||
const storedExecutablePath = this.readExecutablePath(
|
||||
options.browser,
|
||||
options.platform,
|
||||
options.buildId,
|
||||
);
|
||||
if (storedExecutablePath) {
|
||||
// The metadata contains a resolved relative path from the installation dir
|
||||
return path.join(installationDir, storedExecutablePath);
|
||||
}
|
||||
|
||||
return path.join(
|
||||
installationDir,
|
||||
executablePathByBrowser[options.browser](
|
||||
options.platform,
|
||||
options.buildId,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function parseFolderPath(
|
||||
folderPath: string,
|
||||
): {platform: string; buildId: string} | undefined {
|
||||
const name = path.basename(folderPath);
|
||||
const splits = name.split('-');
|
||||
if (splits.length !== 2) {
|
||||
return;
|
||||
}
|
||||
const [platform, buildId] = splits;
|
||||
if (!buildId || !platform) {
|
||||
return;
|
||||
}
|
||||
return {platform, buildId};
|
||||
}
|
||||
62
node_modules/@puppeteer/browsers/src/DefaultProvider.ts
generated
vendored
Normal file
62
node_modules/@puppeteer/browsers/src/DefaultProvider.ts
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import type {Browser, BrowserPlatform} from './browser-data/browser-data.js';
|
||||
import {
|
||||
downloadUrls,
|
||||
executablePathByBrowser,
|
||||
} from './browser-data/browser-data.js';
|
||||
import type {BrowserProvider, DownloadOptions} from './provider.js';
|
||||
|
||||
/**
|
||||
* Default provider implementation that uses default sources.
|
||||
* This is the standard provider used by Puppeteer.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export class DefaultProvider implements BrowserProvider {
|
||||
#baseUrl?: string;
|
||||
|
||||
constructor(baseUrl?: string) {
|
||||
this.#baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
supports(_options: DownloadOptions): boolean {
|
||||
// Default provider supports all browsers
|
||||
return true;
|
||||
}
|
||||
|
||||
getDownloadUrl(options: DownloadOptions): URL {
|
||||
return this.#getDownloadUrl(
|
||||
options.browser,
|
||||
options.platform,
|
||||
options.buildId,
|
||||
);
|
||||
}
|
||||
|
||||
#getDownloadUrl(
|
||||
browser: Browser,
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
): URL {
|
||||
return new URL(downloadUrls[browser](platform, buildId, this.#baseUrl));
|
||||
}
|
||||
|
||||
getExecutablePath(options: {
|
||||
browser: Browser;
|
||||
buildId: string;
|
||||
platform: BrowserPlatform;
|
||||
}): string {
|
||||
return executablePathByBrowser[options.browser](
|
||||
options.platform,
|
||||
options.buildId,
|
||||
);
|
||||
}
|
||||
|
||||
getName(): string {
|
||||
return 'DefaultProvider';
|
||||
}
|
||||
}
|
||||
171
node_modules/@puppeteer/browsers/src/ProgressBar.ts
generated
vendored
Normal file
171
node_modules/@puppeteer/browsers/src/ProgressBar.ts
generated
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
// Module-level active session. Concurrent bars share a session; a new session
|
||||
// starts whenever no bar is currently active (or the stream changes).
|
||||
let activeBar: ProgressBar | null = null;
|
||||
|
||||
/**
|
||||
* Manages one or more concurrent progress bars on separate terminal lines.
|
||||
* Use {@link ProgressBar.createBarTicker} to add a bar; concurrent calls
|
||||
* automatically share a session so bars don't overwrite each other.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export class ProgressBar {
|
||||
#stream: NodeJS.WriteStream;
|
||||
#totalRows = 0;
|
||||
#doneCount = 0;
|
||||
#bars: Array<{
|
||||
title: string;
|
||||
total: number;
|
||||
downloaded: number;
|
||||
startTime: number;
|
||||
lastRendered: string;
|
||||
}> = [];
|
||||
#renderScheduled = false;
|
||||
#lastRenderTime = 0;
|
||||
#allDone = false;
|
||||
|
||||
private constructor(stream: NodeJS.WriteStream) {
|
||||
this.#stream = stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a `tick(delta)` function for a new progress bar. If another bar
|
||||
* is already active on the same stream, the new bar appears on the next line
|
||||
* and both update in place. The trailing newline is emitted automatically
|
||||
* once every bar in the session has reached 100%.
|
||||
*/
|
||||
static createBarTicker(
|
||||
title: string,
|
||||
total: number,
|
||||
stream: NodeJS.WriteStream = process.stderr as NodeJS.WriteStream,
|
||||
): (delta: number) => void {
|
||||
// Start a fresh session when none is active or the stream changed.
|
||||
if (!activeBar || activeBar.#stream !== stream) {
|
||||
activeBar = new ProgressBar(stream);
|
||||
}
|
||||
return activeBar.#addBar(title, total);
|
||||
}
|
||||
|
||||
#claimRow(): number {
|
||||
const row = this.#totalRows++;
|
||||
if (row > 0 && this.#stream.isTTY) {
|
||||
// Cursor is parked at col 0 of the previous bottom row; \n opens the
|
||||
// new line and moves the cursor there, establishing the new bottom row.
|
||||
this.#stream.write('\n');
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
#addBar(title: string, total: number): (delta: number) => void {
|
||||
const row = this.#claimRow();
|
||||
this.#bars.push({
|
||||
title,
|
||||
total,
|
||||
downloaded: 0,
|
||||
startTime: 0,
|
||||
lastRendered: '',
|
||||
});
|
||||
let doneNotified = false;
|
||||
|
||||
return (delta: number) => {
|
||||
const bar = this.#bars[row]!;
|
||||
if (bar.startTime === 0) {
|
||||
bar.startTime = Date.now();
|
||||
}
|
||||
bar.downloaded += delta;
|
||||
|
||||
const isDone = bar.downloaded >= bar.total;
|
||||
if (isDone || Date.now() - this.#lastRenderTime >= 100) {
|
||||
this.#scheduleRender();
|
||||
}
|
||||
|
||||
if (isDone && !doneNotified) {
|
||||
doneNotified = true;
|
||||
this.#onBarDone();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Defers to a microtask so multiple ticks in the same turn share one render
|
||||
// pass and the cursor only moves once.
|
||||
#scheduleRender(): void {
|
||||
if (!this.#renderScheduled) {
|
||||
this.#renderScheduled = true;
|
||||
queueMicrotask(() => {
|
||||
this.#renderScheduled = false;
|
||||
this.#lastRenderTime = Date.now();
|
||||
this.#renderAll();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#computeRendered(row: number): string {
|
||||
const bar = this.#bars[row]!;
|
||||
const ratio = Math.min(1, Math.max(0, bar.downloaded / bar.total));
|
||||
const percent = Math.round(ratio * 100);
|
||||
const elapsedMs = bar.startTime > 0 ? Date.now() - bar.startTime : 0;
|
||||
const rate = elapsedMs > 0 ? bar.downloaded / elapsedMs : 0; // bytes/ms
|
||||
const etaSec = rate > 0 ? (bar.total - bar.downloaded) / rate / 1000 : 0;
|
||||
const width = 20;
|
||||
const completeCount = Math.round(width * ratio);
|
||||
const barStr =
|
||||
'='.repeat(completeCount) + ' '.repeat(width - completeCount);
|
||||
const status =
|
||||
ratio >= 1 ? 'unpacking' : `${percent}% ${etaSec.toFixed(1)}s`;
|
||||
return `${bar.title} [${barStr}] ${status} `;
|
||||
}
|
||||
|
||||
// Invariant: cursor is at col 0 of the bottom row before and after this call.
|
||||
// Single top-down pass: go up to bar 0, render each bar, come back to bottom.
|
||||
#renderAll(): void {
|
||||
if (!this.#stream.isTTY) {
|
||||
return;
|
||||
}
|
||||
const N = this.#totalRows;
|
||||
if (N === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Move cursor to top of bar area.
|
||||
if (N > 1) {
|
||||
this.#stream.moveCursor(0, -(N - 1));
|
||||
}
|
||||
|
||||
for (let row = 0; row < N; row++) {
|
||||
const rendered = this.#computeRendered(row);
|
||||
if (rendered !== this.#bars[row]!.lastRendered) {
|
||||
this.#stream.cursorTo(0);
|
||||
this.#stream.write(rendered);
|
||||
this.#stream.clearLine(1);
|
||||
this.#bars[row]!.lastRendered = rendered;
|
||||
}
|
||||
if (row < N - 1) {
|
||||
this.#stream.moveCursor(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Park cursor at col 0 of the bottom row.
|
||||
this.#stream.cursorTo(0);
|
||||
|
||||
if (this.#allDone) {
|
||||
activeBar = null;
|
||||
this.#stream.write('\n');
|
||||
}
|
||||
}
|
||||
|
||||
#onBarDone(): void {
|
||||
this.#doneCount++;
|
||||
if (this.#doneCount >= this.#totalRows && this.#totalRows > 0) {
|
||||
this.#allDone = true;
|
||||
// Don't emit \n here — the pending render microtask hasn't run yet.
|
||||
// #renderAll() will emit it after the final pass so the cursor is
|
||||
// already past the last bar line before the newline moves it.
|
||||
}
|
||||
}
|
||||
}
|
||||
308
node_modules/@puppeteer/browsers/src/browser-data/browser-data.ts
generated
vendored
Normal file
308
node_modules/@puppeteer/browsers/src/browser-data/browser-data.ts
generated
vendored
Normal file
@@ -0,0 +1,308 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import * as chromeHeadlessShell from './chrome-headless-shell.js';
|
||||
import * as chrome from './chrome.js';
|
||||
import * as chromedriver from './chromedriver.js';
|
||||
import * as chromium from './chromium.js';
|
||||
import * as firefox from './firefox.js';
|
||||
import {
|
||||
Browser,
|
||||
BrowserPlatform,
|
||||
BrowserTag,
|
||||
ChromeReleaseChannel,
|
||||
verifyChromeReleaseChannel,
|
||||
type ProfileOptions,
|
||||
} from './types.js';
|
||||
|
||||
export type {ProfileOptions};
|
||||
|
||||
export const downloadUrls = {
|
||||
[Browser.CHROMEDRIVER]: chromedriver.resolveDownloadUrl,
|
||||
[Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.resolveDownloadUrl,
|
||||
[Browser.CHROME]: chrome.resolveDownloadUrl,
|
||||
[Browser.CHROMIUM]: chromium.resolveDownloadUrl,
|
||||
[Browser.FIREFOX]: firefox.resolveDownloadUrl,
|
||||
};
|
||||
|
||||
export const downloadPaths = {
|
||||
[Browser.CHROMEDRIVER]: chromedriver.resolveDownloadPath,
|
||||
[Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.resolveDownloadPath,
|
||||
[Browser.CHROME]: chrome.resolveDownloadPath,
|
||||
[Browser.CHROMIUM]: chromium.resolveDownloadPath,
|
||||
[Browser.FIREFOX]: firefox.resolveDownloadPath,
|
||||
};
|
||||
|
||||
export const executablePathByBrowser = {
|
||||
[Browser.CHROMEDRIVER]: chromedriver.relativeExecutablePath,
|
||||
[Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.relativeExecutablePath,
|
||||
[Browser.CHROME]: chrome.relativeExecutablePath,
|
||||
[Browser.CHROMIUM]: chromium.relativeExecutablePath,
|
||||
[Browser.FIREFOX]: firefox.relativeExecutablePath,
|
||||
};
|
||||
|
||||
export const versionComparators = {
|
||||
[Browser.CHROMEDRIVER]: chromedriver.compareVersions,
|
||||
[Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.compareVersions,
|
||||
[Browser.CHROME]: chrome.compareVersions,
|
||||
[Browser.CHROMIUM]: chromium.compareVersions,
|
||||
[Browser.FIREFOX]: firefox.compareVersions,
|
||||
};
|
||||
|
||||
export {
|
||||
Browser,
|
||||
BrowserPlatform,
|
||||
ChromeReleaseChannel,
|
||||
verifyChromeReleaseChannel,
|
||||
};
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
async function resolveBuildIdForBrowserTag(
|
||||
browser: Browser,
|
||||
platform: BrowserPlatform,
|
||||
tag: BrowserTag,
|
||||
): Promise<string> {
|
||||
switch (browser) {
|
||||
case Browser.FIREFOX:
|
||||
switch (tag) {
|
||||
case BrowserTag.LATEST:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.NIGHTLY);
|
||||
case BrowserTag.BETA:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.BETA);
|
||||
case BrowserTag.NIGHTLY:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.NIGHTLY);
|
||||
case BrowserTag.DEVEDITION:
|
||||
return await firefox.resolveBuildId(
|
||||
firefox.FirefoxChannel.DEVEDITION,
|
||||
);
|
||||
case BrowserTag.STABLE:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.STABLE);
|
||||
case BrowserTag.ESR:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.ESR);
|
||||
case BrowserTag.CANARY:
|
||||
case BrowserTag.DEV:
|
||||
throw new Error(`${tag.toUpperCase()} is not available for Firefox`);
|
||||
}
|
||||
case Browser.CHROME: {
|
||||
switch (tag) {
|
||||
case BrowserTag.LATEST:
|
||||
return await chrome.resolveBuildId(ChromeReleaseChannel.CANARY);
|
||||
case BrowserTag.BETA:
|
||||
return await chrome.resolveBuildId(ChromeReleaseChannel.BETA);
|
||||
case BrowserTag.CANARY:
|
||||
return await chrome.resolveBuildId(ChromeReleaseChannel.CANARY);
|
||||
case BrowserTag.DEV:
|
||||
return await chrome.resolveBuildId(ChromeReleaseChannel.DEV);
|
||||
case BrowserTag.STABLE:
|
||||
return await chrome.resolveBuildId(ChromeReleaseChannel.STABLE);
|
||||
case BrowserTag.NIGHTLY:
|
||||
case BrowserTag.DEVEDITION:
|
||||
case BrowserTag.ESR:
|
||||
throw new Error(`${tag.toUpperCase()} is not available for Chrome`);
|
||||
}
|
||||
}
|
||||
case Browser.CHROMEDRIVER: {
|
||||
switch (tag) {
|
||||
case BrowserTag.LATEST:
|
||||
case BrowserTag.CANARY:
|
||||
return await chromedriver.resolveBuildId(ChromeReleaseChannel.CANARY);
|
||||
case BrowserTag.BETA:
|
||||
return await chromedriver.resolveBuildId(ChromeReleaseChannel.BETA);
|
||||
case BrowserTag.DEV:
|
||||
return await chromedriver.resolveBuildId(ChromeReleaseChannel.DEV);
|
||||
case BrowserTag.STABLE:
|
||||
return await chromedriver.resolveBuildId(ChromeReleaseChannel.STABLE);
|
||||
case BrowserTag.NIGHTLY:
|
||||
case BrowserTag.DEVEDITION:
|
||||
case BrowserTag.ESR:
|
||||
throw new Error(
|
||||
`${tag.toUpperCase()} is not available for ChromeDriver`,
|
||||
);
|
||||
}
|
||||
}
|
||||
case Browser.CHROMEHEADLESSSHELL: {
|
||||
switch (tag) {
|
||||
case BrowserTag.LATEST:
|
||||
case BrowserTag.CANARY:
|
||||
return await chromeHeadlessShell.resolveBuildId(
|
||||
ChromeReleaseChannel.CANARY,
|
||||
);
|
||||
case BrowserTag.BETA:
|
||||
return await chromeHeadlessShell.resolveBuildId(
|
||||
ChromeReleaseChannel.BETA,
|
||||
);
|
||||
case BrowserTag.DEV:
|
||||
return await chromeHeadlessShell.resolveBuildId(
|
||||
ChromeReleaseChannel.DEV,
|
||||
);
|
||||
case BrowserTag.STABLE:
|
||||
return await chromeHeadlessShell.resolveBuildId(
|
||||
ChromeReleaseChannel.STABLE,
|
||||
);
|
||||
case BrowserTag.NIGHTLY:
|
||||
case BrowserTag.DEVEDITION:
|
||||
case BrowserTag.ESR:
|
||||
throw new Error(`${tag} is not available for chrome-headless-shell`);
|
||||
}
|
||||
}
|
||||
case Browser.CHROMIUM:
|
||||
switch (tag) {
|
||||
case BrowserTag.LATEST:
|
||||
return await chromium.resolveBuildId(platform);
|
||||
case BrowserTag.NIGHTLY:
|
||||
case BrowserTag.CANARY:
|
||||
case BrowserTag.DEV:
|
||||
case BrowserTag.DEVEDITION:
|
||||
case BrowserTag.BETA:
|
||||
case BrowserTag.STABLE:
|
||||
case BrowserTag.ESR:
|
||||
throw new Error(
|
||||
`${tag} is not supported for Chromium. Use 'latest' instead.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export async function resolveBuildId(
|
||||
browser: Browser,
|
||||
platform: BrowserPlatform,
|
||||
tag: string | BrowserTag,
|
||||
): Promise<string> {
|
||||
const browserTag = tag as BrowserTag;
|
||||
if (Object.values(BrowserTag).includes(browserTag)) {
|
||||
return await resolveBuildIdForBrowserTag(browser, platform, browserTag);
|
||||
}
|
||||
|
||||
switch (browser) {
|
||||
case Browser.FIREFOX:
|
||||
return tag;
|
||||
case Browser.CHROME:
|
||||
const chromeResult = await chrome.resolveBuildId(tag);
|
||||
if (chromeResult) {
|
||||
return chromeResult;
|
||||
}
|
||||
return tag;
|
||||
case Browser.CHROMEDRIVER:
|
||||
const chromeDriverResult = await chromedriver.resolveBuildId(tag);
|
||||
if (chromeDriverResult) {
|
||||
return chromeDriverResult;
|
||||
}
|
||||
return tag;
|
||||
case Browser.CHROMEHEADLESSSHELL:
|
||||
const chromeHeadlessShellResult =
|
||||
await chromeHeadlessShell.resolveBuildId(tag);
|
||||
if (chromeHeadlessShellResult) {
|
||||
return chromeHeadlessShellResult;
|
||||
}
|
||||
return tag;
|
||||
case Browser.CHROMIUM:
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export async function createProfile(
|
||||
browser: Browser,
|
||||
opts: ProfileOptions,
|
||||
): Promise<void> {
|
||||
switch (browser) {
|
||||
case Browser.FIREFOX:
|
||||
return await firefox.createProfile(opts);
|
||||
case Browser.CHROME:
|
||||
case Browser.CHROMIUM:
|
||||
throw new Error(`Profile creation is not support for ${browser} yet`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*
|
||||
* Get's the first resolved system path
|
||||
*/
|
||||
export function resolveSystemExecutablePath(
|
||||
browser: Browser,
|
||||
platform: BrowserPlatform,
|
||||
channel: ChromeReleaseChannel,
|
||||
): string {
|
||||
switch (browser) {
|
||||
case Browser.CHROMEDRIVER:
|
||||
case Browser.CHROMEHEADLESSSHELL:
|
||||
case Browser.FIREFOX:
|
||||
case Browser.CHROMIUM:
|
||||
throw new Error(
|
||||
`System browser detection is not supported for ${browser} yet.`,
|
||||
);
|
||||
case Browser.CHROME:
|
||||
return chrome.resolveSystemExecutablePaths(platform, channel)[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the expected default user data dir for the given channel. It does not
|
||||
* check if the dir actually exists.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function resolveDefaultUserDataDir(
|
||||
browser: Browser,
|
||||
platform: BrowserPlatform,
|
||||
channel: ChromeReleaseChannel,
|
||||
): string {
|
||||
switch (browser) {
|
||||
case Browser.CHROMEDRIVER:
|
||||
case Browser.CHROMEHEADLESSSHELL:
|
||||
case Browser.FIREFOX:
|
||||
case Browser.CHROMIUM:
|
||||
throw new Error(
|
||||
`Default user dir detection is not supported for ${browser} yet.`,
|
||||
);
|
||||
case Browser.CHROME:
|
||||
return chrome.resolveDefaultUserDataDir(platform, channel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* Returns multiple paths where the executable may be located at on the current system
|
||||
* ordered by likelihood (based on heuristics).
|
||||
*/
|
||||
export function resolveSystemExecutablePaths(
|
||||
browser: Browser,
|
||||
platform: BrowserPlatform,
|
||||
channel: ChromeReleaseChannel,
|
||||
): [string, ...string[]] {
|
||||
switch (browser) {
|
||||
case Browser.CHROMEDRIVER:
|
||||
case Browser.CHROMEHEADLESSSHELL:
|
||||
case Browser.FIREFOX:
|
||||
case Browser.CHROMIUM:
|
||||
throw new Error(
|
||||
`System browser detection is not supported for ${browser} yet.`,
|
||||
);
|
||||
case Browser.CHROME:
|
||||
return chrome.resolveSystemExecutablePaths(platform, channel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a version comparator for the given browser that can be used to sort
|
||||
* browser versions.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function getVersionComparator(
|
||||
browser: Browser,
|
||||
): (a: string, b: string) => number {
|
||||
return versionComparators[browser];
|
||||
}
|
||||
71
node_modules/@puppeteer/browsers/src/browser-data/chrome-headless-shell.ts
generated
vendored
Normal file
71
node_modules/@puppeteer/browsers/src/browser-data/chrome-headless-shell.ts
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import path from 'node:path';
|
||||
|
||||
import {BrowserPlatform} from './types.js';
|
||||
|
||||
function folder(platform: BrowserPlatform): string {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return 'linux64';
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return 'mac-arm64';
|
||||
case BrowserPlatform.MAC:
|
||||
return 'mac-x64';
|
||||
case BrowserPlatform.WIN32:
|
||||
return 'win32';
|
||||
case BrowserPlatform.WIN64:
|
||||
return 'win64';
|
||||
}
|
||||
}
|
||||
|
||||
export function resolveDownloadUrl(
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public',
|
||||
): string {
|
||||
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
|
||||
}
|
||||
|
||||
export function resolveDownloadPath(
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
): string[] {
|
||||
return [
|
||||
buildId,
|
||||
folder(platform),
|
||||
`chrome-headless-shell-${folder(platform)}.zip`,
|
||||
];
|
||||
}
|
||||
|
||||
export function relativeExecutablePath(
|
||||
platform: BrowserPlatform,
|
||||
_buildId: string,
|
||||
): string {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.MAC:
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return path.join(
|
||||
'chrome-headless-shell-' + folder(platform),
|
||||
'chrome-headless-shell',
|
||||
);
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return path.join(
|
||||
'chrome-headless-shell-linux64',
|
||||
'chrome-headless-shell',
|
||||
);
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return path.join(
|
||||
'chrome-headless-shell-' + folder(platform),
|
||||
'chrome-headless-shell.exe',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export {resolveBuildId, compareVersions} from './chrome.js';
|
||||
434
node_modules/@puppeteer/browsers/src/browser-data/chrome.ts
generated
vendored
Normal file
434
node_modules/@puppeteer/browsers/src/browser-data/chrome.ts
generated
vendored
Normal file
@@ -0,0 +1,434 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import {execSync} from 'node:child_process';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
|
||||
import {getJSON} from '../httpUtil.js';
|
||||
|
||||
import {BrowserPlatform, ChromeReleaseChannel} from './types.js';
|
||||
|
||||
function folder(platform: BrowserPlatform): string {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return 'linux64';
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return 'mac-arm64';
|
||||
case BrowserPlatform.MAC:
|
||||
return 'mac-x64';
|
||||
case BrowserPlatform.WIN32:
|
||||
return 'win32';
|
||||
case BrowserPlatform.WIN64:
|
||||
return 'win64';
|
||||
}
|
||||
}
|
||||
|
||||
export function resolveDownloadUrl(
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public',
|
||||
): string {
|
||||
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
|
||||
}
|
||||
|
||||
export function resolveDownloadPath(
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
): string[] {
|
||||
return [buildId, folder(platform), `chrome-${folder(platform)}.zip`];
|
||||
}
|
||||
|
||||
export function relativeExecutablePath(
|
||||
platform: BrowserPlatform,
|
||||
_buildId: string,
|
||||
): string {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.MAC:
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return path.join(
|
||||
'chrome-' + folder(platform),
|
||||
'Google Chrome for Testing.app',
|
||||
'Contents',
|
||||
'MacOS',
|
||||
'Google Chrome for Testing',
|
||||
);
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return path.join('chrome-linux64', 'chrome');
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return path.join('chrome-' + folder(platform), 'chrome.exe');
|
||||
}
|
||||
}
|
||||
|
||||
let baseVersionUrl = 'https://googlechromelabs.github.io/chrome-for-testing';
|
||||
|
||||
export function changeBaseVersionUrlForTesting(url: string): void {
|
||||
baseVersionUrl = url;
|
||||
}
|
||||
export function resetBaseVersionUrlForTesting(): void {
|
||||
baseVersionUrl = 'https://googlechromelabs.github.io/chrome-for-testing';
|
||||
}
|
||||
|
||||
export async function getLastKnownGoodReleaseForChannel(
|
||||
channel: ChromeReleaseChannel,
|
||||
): Promise<{version: string; revision: string}> {
|
||||
const data = (await getJSON(
|
||||
new URL(`${baseVersionUrl}/last-known-good-versions.json`),
|
||||
)) as {
|
||||
channels: Record<string, {version: string}>;
|
||||
};
|
||||
|
||||
for (const channel of Object.keys(data.channels)) {
|
||||
data.channels[channel.toLowerCase()] = data.channels[channel]!;
|
||||
delete data.channels[channel];
|
||||
}
|
||||
|
||||
return (
|
||||
data as {
|
||||
channels: Record<
|
||||
ChromeReleaseChannel,
|
||||
{version: string; revision: string}
|
||||
>;
|
||||
}
|
||||
).channels[channel];
|
||||
}
|
||||
|
||||
export async function getLastKnownGoodReleaseForMilestone(
|
||||
milestone: string,
|
||||
): Promise<{version: string; revision: string} | undefined> {
|
||||
const data = (await getJSON(
|
||||
new URL(`${baseVersionUrl}/latest-versions-per-milestone.json`),
|
||||
)) as {
|
||||
milestones: Record<string, {version: string; revision: string}>;
|
||||
};
|
||||
return data.milestones[milestone] as
|
||||
| {version: string; revision: string}
|
||||
| undefined;
|
||||
}
|
||||
|
||||
export async function getLastKnownGoodReleaseForBuild(
|
||||
/**
|
||||
* @example `112.0.23`,
|
||||
*/
|
||||
buildPrefix: string,
|
||||
): Promise<{version: string; revision: string} | undefined> {
|
||||
const data = (await getJSON(
|
||||
new URL(`${baseVersionUrl}/latest-patch-versions-per-build.json`),
|
||||
)) as {
|
||||
builds: Record<string, {version: string; revision: string}>;
|
||||
};
|
||||
return data.builds[buildPrefix] as
|
||||
| {version: string; revision: string}
|
||||
| undefined;
|
||||
}
|
||||
|
||||
export async function resolveBuildId(
|
||||
channel: ChromeReleaseChannel,
|
||||
): Promise<string>;
|
||||
export async function resolveBuildId(
|
||||
channel: string,
|
||||
): Promise<string | undefined>;
|
||||
export async function resolveBuildId(
|
||||
channel: ChromeReleaseChannel | string,
|
||||
): Promise<string | undefined> {
|
||||
if (
|
||||
Object.values(ChromeReleaseChannel).includes(
|
||||
channel as ChromeReleaseChannel,
|
||||
)
|
||||
) {
|
||||
return (
|
||||
await getLastKnownGoodReleaseForChannel(channel as ChromeReleaseChannel)
|
||||
).version;
|
||||
}
|
||||
if (channel.match(/^\d+$/)) {
|
||||
// Potentially a milestone.
|
||||
return (await getLastKnownGoodReleaseForMilestone(channel))?.version;
|
||||
}
|
||||
if (channel.match(/^\d+\.\d+\.\d+$/)) {
|
||||
// Potentially a build prefix without the patch version.
|
||||
return (await getLastKnownGoodReleaseForBuild(channel))?.version;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const WINDOWS_ENV_PARAM_NAMES = [
|
||||
'PROGRAMFILES',
|
||||
'ProgramW6432',
|
||||
'ProgramFiles(x86)',
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/installer/mini_installer/README.md
|
||||
'LOCALAPPDATA',
|
||||
];
|
||||
|
||||
function getChromeWindowsLocation(
|
||||
channel: ChromeReleaseChannel,
|
||||
locationsPrefixes: Set<string>,
|
||||
): [string, ...string[]] {
|
||||
if (locationsPrefixes.size === 0) {
|
||||
throw new Error('Non of the common Windows Env variables were set');
|
||||
}
|
||||
|
||||
let suffix: string;
|
||||
switch (channel) {
|
||||
case ChromeReleaseChannel.STABLE:
|
||||
suffix = 'Google\\Chrome\\Application\\chrome.exe';
|
||||
break;
|
||||
case ChromeReleaseChannel.BETA:
|
||||
suffix = 'Google\\Chrome Beta\\Application\\chrome.exe';
|
||||
break;
|
||||
case ChromeReleaseChannel.CANARY:
|
||||
suffix = 'Google\\Chrome SxS\\Application\\chrome.exe';
|
||||
break;
|
||||
case ChromeReleaseChannel.DEV:
|
||||
suffix = 'Google\\Chrome Dev\\Application\\chrome.exe';
|
||||
break;
|
||||
}
|
||||
|
||||
return [...locationsPrefixes.values()].map(l => {
|
||||
return path.win32.join(l, suffix);
|
||||
}) as [string, ...string[]];
|
||||
}
|
||||
|
||||
function getWslVariable(variable: string): string | undefined {
|
||||
try {
|
||||
// The Windows env for the paths are not passed down
|
||||
// to WSL, so we evoke `cmd.exe` which is usually on the PATH
|
||||
// from which the env can be access with all uppercase names.
|
||||
// The return value is a Windows Path - `C:\Program Files`.
|
||||
|
||||
const result = execSync(
|
||||
`cmd.exe /c echo %${variable.toLocaleUpperCase()}%`,
|
||||
{
|
||||
// We need to ignore the stderr as cmd.exe
|
||||
// prints a message about wrong UNC path not supported.
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
encoding: 'utf-8',
|
||||
},
|
||||
).trim();
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
} catch {}
|
||||
return;
|
||||
}
|
||||
|
||||
function getWslLocation(channel: ChromeReleaseChannel): [string, ...string[]] {
|
||||
const wslVersion = execSync('wslinfo --version', {
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
encoding: 'utf-8',
|
||||
}).trim();
|
||||
if (!wslVersion) {
|
||||
throw new Error('Not in WSL or unsupported version of WSL.');
|
||||
}
|
||||
const wslPrefixes = new Set<string>();
|
||||
for (const name of WINDOWS_ENV_PARAM_NAMES) {
|
||||
const wslPrefix = getWslVariable(name);
|
||||
if (wslPrefix) {
|
||||
wslPrefixes.add(wslPrefix);
|
||||
}
|
||||
}
|
||||
const windowsPath = getChromeWindowsLocation(channel, wslPrefixes);
|
||||
|
||||
return windowsPath.map(path => {
|
||||
// The above command returned the Windows paths `C:\Program Files\...\chrome.exe`
|
||||
// Use the `wslpath` utility tool to transform into the mounted disk
|
||||
return execSync(`wslpath "${path}"`).toString().trim();
|
||||
}) as [string, ...string[]];
|
||||
}
|
||||
|
||||
function getChromeLinuxOrWslLocation(
|
||||
channel: ChromeReleaseChannel,
|
||||
): [string, ...string[]] {
|
||||
const locations: string[] = [];
|
||||
|
||||
switch (channel) {
|
||||
case ChromeReleaseChannel.STABLE:
|
||||
locations.push('/opt/google/chrome/chrome');
|
||||
break;
|
||||
case ChromeReleaseChannel.BETA:
|
||||
locations.push('/opt/google/chrome-beta/chrome');
|
||||
break;
|
||||
case ChromeReleaseChannel.CANARY:
|
||||
locations.push('/opt/google/chrome-canary/chrome');
|
||||
break;
|
||||
case ChromeReleaseChannel.DEV:
|
||||
locations.push('/opt/google/chrome-unstable/chrome');
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
const wslPath = getWslLocation(channel);
|
||||
if (wslPath) {
|
||||
locations.push(...wslPath);
|
||||
}
|
||||
} catch {
|
||||
// Ignore WSL errors
|
||||
}
|
||||
|
||||
return locations as [string, ...string[]];
|
||||
}
|
||||
|
||||
export function resolveSystemExecutablePaths(
|
||||
platform: BrowserPlatform,
|
||||
channel: ChromeReleaseChannel,
|
||||
): [string, ...string[]] {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.WIN64:
|
||||
case BrowserPlatform.WIN32:
|
||||
const prefixLocation = new Set<string>(
|
||||
WINDOWS_ENV_PARAM_NAMES.map(name => {
|
||||
return process.env[name];
|
||||
}).filter((l): l is string => {
|
||||
return !!l;
|
||||
}),
|
||||
);
|
||||
// Fallbacks in case env vars are misconfigured.
|
||||
prefixLocation.add('C:\\Program Files');
|
||||
prefixLocation.add('C:\\Program Files (x86)');
|
||||
prefixLocation.add('D:\\Program Files');
|
||||
prefixLocation.add('D:\\Program Files (x86)');
|
||||
return getChromeWindowsLocation(channel, prefixLocation);
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
switch (channel) {
|
||||
case ChromeReleaseChannel.STABLE:
|
||||
return [
|
||||
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
||||
];
|
||||
case ChromeReleaseChannel.BETA:
|
||||
return [
|
||||
'/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta',
|
||||
];
|
||||
case ChromeReleaseChannel.CANARY:
|
||||
return [
|
||||
'/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary',
|
||||
];
|
||||
case ChromeReleaseChannel.DEV:
|
||||
return [
|
||||
'/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev',
|
||||
];
|
||||
}
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return getChromeLinuxOrWslLocation(channel);
|
||||
}
|
||||
}
|
||||
|
||||
export function resolveDefaultUserDataDir(
|
||||
platform: BrowserPlatform,
|
||||
channel: ChromeReleaseChannel,
|
||||
): string {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.WIN64:
|
||||
case BrowserPlatform.WIN32:
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/chrome_paths_win.cc;l=42;drc=4c86c7940a47c36b8bf52c134483ef2da86caa62
|
||||
switch (channel) {
|
||||
case ChromeReleaseChannel.STABLE:
|
||||
return path.join(
|
||||
getLocalAppDataWin(),
|
||||
'Google',
|
||||
'Chrome',
|
||||
'User Data',
|
||||
);
|
||||
case ChromeReleaseChannel.BETA:
|
||||
return path.join(
|
||||
getLocalAppDataWin(),
|
||||
'Google',
|
||||
'Chrome Beta',
|
||||
'User Data',
|
||||
);
|
||||
case ChromeReleaseChannel.CANARY:
|
||||
return path.join(
|
||||
getLocalAppDataWin(),
|
||||
'Google',
|
||||
'Chrome SxS',
|
||||
'User Data',
|
||||
);
|
||||
case ChromeReleaseChannel.DEV:
|
||||
return path.join(
|
||||
getLocalAppDataWin(),
|
||||
'Google',
|
||||
'Chrome Dev',
|
||||
'User Data',
|
||||
);
|
||||
}
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/chrome_paths_mac.mm;l=86;drc=4c86c7940a47c36b8bf52c134483ef2da86caa62
|
||||
switch (channel) {
|
||||
case ChromeReleaseChannel.STABLE:
|
||||
return path.join(getBaseUserDataDirPathMac(), 'Chrome');
|
||||
case ChromeReleaseChannel.BETA:
|
||||
return path.join(getBaseUserDataDirPathMac(), 'Chrome Beta');
|
||||
case ChromeReleaseChannel.DEV:
|
||||
return path.join(getBaseUserDataDirPathMac(), 'Chrome Dev');
|
||||
case ChromeReleaseChannel.CANARY:
|
||||
return path.join(getBaseUserDataDirPathMac(), 'Chrome Canary');
|
||||
}
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/chrome_paths_linux.cc;l=80;drc=4c86c7940a47c36b8bf52c134483ef2da86caa62
|
||||
switch (channel) {
|
||||
case ChromeReleaseChannel.STABLE:
|
||||
return path.join(getConfigHomeLinux(), 'google-chrome');
|
||||
case ChromeReleaseChannel.BETA:
|
||||
return path.join(getConfigHomeLinux(), 'google-chrome-beta');
|
||||
case ChromeReleaseChannel.CANARY:
|
||||
return path.join(getConfigHomeLinux(), 'google-chrome-canary');
|
||||
case ChromeReleaseChannel.DEV:
|
||||
return path.join(getConfigHomeLinux(), 'google-chrome-unstable');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getLocalAppDataWin() {
|
||||
return (
|
||||
process.env['LOCALAPPDATA'] || path.join(os.homedir(), 'AppData', 'Local')
|
||||
);
|
||||
}
|
||||
|
||||
function getConfigHomeLinux() {
|
||||
return (
|
||||
process.env['CHROME_CONFIG_HOME'] ||
|
||||
process.env['XDG_CONFIG_HOME'] ||
|
||||
path.join(os.homedir(), '.config')
|
||||
);
|
||||
}
|
||||
|
||||
function getBaseUserDataDirPathMac() {
|
||||
return path.join(os.homedir(), 'Library', 'Application Support', 'Google');
|
||||
}
|
||||
|
||||
export function compareVersions(a: string, b: string): number {
|
||||
const cleanA = a.trim();
|
||||
const cleanB = b.trim();
|
||||
|
||||
const versionRegex = /^\d+(?:\.\d+){0,3}$/;
|
||||
if (!versionRegex.test(cleanA)) {
|
||||
throw new Error(`Version ${a} is not a valid Chrome version`);
|
||||
}
|
||||
if (!versionRegex.test(cleanB)) {
|
||||
throw new Error(`Version ${b} is not a valid Chrome version`);
|
||||
}
|
||||
|
||||
const aParts = cleanA.split('.').map(Number);
|
||||
const bParts = cleanB.split('.').map(Number);
|
||||
|
||||
for (let i = 0; i < 4; i++) {
|
||||
const aPart = aParts[i] ?? 0;
|
||||
const bPart = bParts[i] ?? 0;
|
||||
|
||||
if (aPart > bPart) {
|
||||
return 1;
|
||||
}
|
||||
if (aPart < bPart) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
58
node_modules/@puppeteer/browsers/src/browser-data/chromedriver.ts
generated
vendored
Normal file
58
node_modules/@puppeteer/browsers/src/browser-data/chromedriver.ts
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import path from 'node:path';
|
||||
|
||||
import {BrowserPlatform} from './types.js';
|
||||
|
||||
function folder(platform: BrowserPlatform): string {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return 'linux64';
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return 'mac-arm64';
|
||||
case BrowserPlatform.MAC:
|
||||
return 'mac-x64';
|
||||
case BrowserPlatform.WIN32:
|
||||
return 'win32';
|
||||
case BrowserPlatform.WIN64:
|
||||
return 'win64';
|
||||
}
|
||||
}
|
||||
|
||||
export function resolveDownloadUrl(
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public',
|
||||
): string {
|
||||
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
|
||||
}
|
||||
|
||||
export function resolveDownloadPath(
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
): string[] {
|
||||
return [buildId, folder(platform), `chromedriver-${folder(platform)}.zip`];
|
||||
}
|
||||
|
||||
export function relativeExecutablePath(
|
||||
platform: BrowserPlatform,
|
||||
_buildId: string,
|
||||
): string {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.MAC:
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return path.join('chromedriver-' + folder(platform), 'chromedriver');
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return path.join('chromedriver-linux64', 'chromedriver');
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return path.join('chromedriver-' + folder(platform), 'chromedriver.exe');
|
||||
}
|
||||
}
|
||||
|
||||
export {resolveBuildId, compareVersions} from './chrome.js';
|
||||
95
node_modules/@puppeteer/browsers/src/browser-data/chromium.ts
generated
vendored
Normal file
95
node_modules/@puppeteer/browsers/src/browser-data/chromium.ts
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import path from 'node:path';
|
||||
|
||||
import {getText} from '../httpUtil.js';
|
||||
|
||||
import {BrowserPlatform} from './types.js';
|
||||
|
||||
function archive(platform: BrowserPlatform, buildId: string): string {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return 'chrome-linux';
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
return 'chrome-mac';
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
// Windows archive name changed at r591479.
|
||||
return parseInt(buildId, 10) > 591479 ? 'chrome-win' : 'chrome-win32';
|
||||
}
|
||||
}
|
||||
|
||||
function folder(platform: BrowserPlatform): string {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return 'Linux_x64';
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return 'Mac_Arm';
|
||||
case BrowserPlatform.MAC:
|
||||
return 'Mac';
|
||||
case BrowserPlatform.WIN32:
|
||||
return 'Win';
|
||||
case BrowserPlatform.WIN64:
|
||||
return 'Win_x64';
|
||||
}
|
||||
}
|
||||
|
||||
export function resolveDownloadUrl(
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
baseUrl = 'https://storage.googleapis.com/chromium-browser-snapshots',
|
||||
): string {
|
||||
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
|
||||
}
|
||||
|
||||
export function resolveDownloadPath(
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
): string[] {
|
||||
return [folder(platform), buildId, `${archive(platform, buildId)}.zip`];
|
||||
}
|
||||
|
||||
export function relativeExecutablePath(
|
||||
platform: BrowserPlatform,
|
||||
_buildId: string,
|
||||
): string {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.MAC:
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
return path.join(
|
||||
'chrome-mac',
|
||||
'Chromium.app',
|
||||
'Contents',
|
||||
'MacOS',
|
||||
'Chromium',
|
||||
);
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return path.join('chrome-linux', 'chrome');
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return path.join('chrome-win', 'chrome.exe');
|
||||
}
|
||||
}
|
||||
export async function resolveBuildId(
|
||||
platform: BrowserPlatform,
|
||||
): Promise<string> {
|
||||
return await getText(
|
||||
new URL(
|
||||
`https://storage.googleapis.com/chromium-browser-snapshots/${folder(
|
||||
platform,
|
||||
)}/LAST_CHANGE`,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function compareVersions(a: string, b: string): number {
|
||||
return Number(a) - Number(b);
|
||||
}
|
||||
469
node_modules/@puppeteer/browsers/src/browser-data/firefox.ts
generated
vendored
Normal file
469
node_modules/@puppeteer/browsers/src/browser-data/firefox.ts
generated
vendored
Normal file
@@ -0,0 +1,469 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import {getJSON} from '../httpUtil.js';
|
||||
|
||||
import {BrowserPlatform, type ProfileOptions} from './types.js';
|
||||
|
||||
function getFormat(buildId: string): string {
|
||||
const majorVersion = Number(buildId.split('.').shift()!);
|
||||
return majorVersion >= 135 ? 'xz' : 'bz2';
|
||||
}
|
||||
|
||||
function archiveNightly(platform: BrowserPlatform, buildId: string): string {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX:
|
||||
return `firefox-${buildId}.en-US.linux-x86_64.tar.${getFormat(buildId)}`;
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
return `firefox-${buildId}.en-US.linux-aarch64.tar.${getFormat(buildId)}`;
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
return `firefox-${buildId}.en-US.mac.dmg`;
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return `firefox-${buildId}.en-US.${platform}.zip`;
|
||||
}
|
||||
}
|
||||
|
||||
function archive(platform: BrowserPlatform, buildId: string): string {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return `firefox-${buildId}.tar.${getFormat(buildId)}`;
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
return `Firefox ${buildId}.dmg`;
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return `Firefox Setup ${buildId}.exe`;
|
||||
}
|
||||
}
|
||||
|
||||
function platformName(platform: BrowserPlatform): string {
|
||||
switch (platform) {
|
||||
case BrowserPlatform.LINUX:
|
||||
return `linux-x86_64`;
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
return `linux-aarch64`;
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
return `mac`;
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return platform;
|
||||
}
|
||||
}
|
||||
|
||||
function parseBuildId(buildId: string): [FirefoxChannel, string] {
|
||||
for (const value of Object.values(FirefoxChannel)) {
|
||||
if (buildId.startsWith(value + '_')) {
|
||||
buildId = buildId.substring(value.length + 1);
|
||||
return [value, buildId];
|
||||
}
|
||||
}
|
||||
// Older versions do not have channel as the prefix.«
|
||||
return [FirefoxChannel.NIGHTLY, buildId];
|
||||
}
|
||||
|
||||
export function resolveDownloadUrl(
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
baseUrl?: string,
|
||||
): string {
|
||||
const [channel] = parseBuildId(buildId);
|
||||
switch (channel) {
|
||||
case FirefoxChannel.NIGHTLY:
|
||||
baseUrl ??=
|
||||
'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central';
|
||||
break;
|
||||
case FirefoxChannel.DEVEDITION:
|
||||
baseUrl ??= 'https://archive.mozilla.org/pub/devedition/releases';
|
||||
break;
|
||||
case FirefoxChannel.BETA:
|
||||
case FirefoxChannel.STABLE:
|
||||
case FirefoxChannel.ESR:
|
||||
baseUrl ??= 'https://archive.mozilla.org/pub/firefox/releases';
|
||||
break;
|
||||
}
|
||||
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
|
||||
}
|
||||
|
||||
export function resolveDownloadPath(
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
): string[] {
|
||||
const [channel, resolvedBuildId] = parseBuildId(buildId);
|
||||
switch (channel) {
|
||||
case FirefoxChannel.NIGHTLY:
|
||||
return [archiveNightly(platform, resolvedBuildId)];
|
||||
case FirefoxChannel.DEVEDITION:
|
||||
case FirefoxChannel.BETA:
|
||||
case FirefoxChannel.STABLE:
|
||||
case FirefoxChannel.ESR:
|
||||
return [
|
||||
resolvedBuildId,
|
||||
platformName(platform),
|
||||
'en-US',
|
||||
archive(platform, resolvedBuildId),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
export function relativeExecutablePath(
|
||||
platform: BrowserPlatform,
|
||||
buildId: string,
|
||||
): string {
|
||||
const [channel] = parseBuildId(buildId);
|
||||
switch (channel) {
|
||||
case FirefoxChannel.NIGHTLY:
|
||||
switch (platform) {
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
return path.join(
|
||||
'Firefox Nightly.app',
|
||||
'Contents',
|
||||
'MacOS',
|
||||
'firefox',
|
||||
);
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return path.join('firefox', 'firefox');
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return path.join('firefox', 'firefox.exe');
|
||||
}
|
||||
case FirefoxChannel.BETA:
|
||||
case FirefoxChannel.DEVEDITION:
|
||||
case FirefoxChannel.ESR:
|
||||
case FirefoxChannel.STABLE:
|
||||
switch (platform) {
|
||||
case BrowserPlatform.MAC_ARM:
|
||||
case BrowserPlatform.MAC:
|
||||
return path.join('Firefox.app', 'Contents', 'MacOS', 'firefox');
|
||||
case BrowserPlatform.LINUX_ARM:
|
||||
case BrowserPlatform.LINUX:
|
||||
return path.join('firefox', 'firefox');
|
||||
case BrowserPlatform.WIN32:
|
||||
case BrowserPlatform.WIN64:
|
||||
return path.join('core', 'firefox.exe');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export enum FirefoxChannel {
|
||||
STABLE = 'stable',
|
||||
ESR = 'esr',
|
||||
DEVEDITION = 'devedition',
|
||||
BETA = 'beta',
|
||||
NIGHTLY = 'nightly',
|
||||
}
|
||||
|
||||
let baseVersionUrl = 'https://product-details.mozilla.org/1.0';
|
||||
|
||||
export function changeBaseVersionUrlForTesting(url: string): void {
|
||||
baseVersionUrl = url;
|
||||
}
|
||||
|
||||
export function resetBaseVersionUrlForTesting(): void {
|
||||
baseVersionUrl = 'https://product-details.mozilla.org/1.0';
|
||||
}
|
||||
|
||||
export async function resolveBuildId(
|
||||
channel: FirefoxChannel = FirefoxChannel.NIGHTLY,
|
||||
): Promise<string> {
|
||||
const channelToVersionKey = {
|
||||
[FirefoxChannel.ESR]: 'FIREFOX_ESR',
|
||||
[FirefoxChannel.STABLE]: 'LATEST_FIREFOX_VERSION',
|
||||
[FirefoxChannel.DEVEDITION]: 'FIREFOX_DEVEDITION',
|
||||
[FirefoxChannel.BETA]: 'FIREFOX_DEVEDITION',
|
||||
[FirefoxChannel.NIGHTLY]: 'FIREFOX_NIGHTLY',
|
||||
};
|
||||
const versions = (await getJSON(
|
||||
new URL(`${baseVersionUrl}/firefox_versions.json`),
|
||||
)) as Record<string, string>;
|
||||
const version = versions[channelToVersionKey[channel]];
|
||||
if (!version) {
|
||||
throw new Error(`Channel ${channel} is not found.`);
|
||||
}
|
||||
return channel + '_' + version;
|
||||
}
|
||||
|
||||
export async function createProfile(options: ProfileOptions): Promise<void> {
|
||||
if (!fs.existsSync(options.path)) {
|
||||
await fs.promises.mkdir(options.path, {
|
||||
recursive: true,
|
||||
});
|
||||
}
|
||||
await syncPreferences({
|
||||
preferences: {
|
||||
...defaultProfilePreferences(options.preferences),
|
||||
...options.preferences,
|
||||
},
|
||||
path: options.path,
|
||||
});
|
||||
}
|
||||
|
||||
function defaultProfilePreferences(
|
||||
extraPrefs: Record<string, unknown>,
|
||||
): Record<string, unknown> {
|
||||
const server = 'dummy.test';
|
||||
|
||||
const defaultPrefs = {
|
||||
// Make sure Shield doesn't hit the network.
|
||||
'app.normandy.api_url': '',
|
||||
// Disable Firefox old build background check
|
||||
'app.update.checkInstallTime': false,
|
||||
// Disable automatically upgrading Firefox
|
||||
'app.update.disabledForTesting': true,
|
||||
|
||||
// Increase the APZ content response timeout to 1 minute
|
||||
'apz.content_response_timeout': 60000,
|
||||
|
||||
// Prevent various error message on the console
|
||||
// jest-puppeteer asserts that no error message is emitted by the console
|
||||
'browser.contentblocking.features.standard':
|
||||
'-tp,tpPrivate,cookieBehavior0,-cryptoTP,-fp',
|
||||
|
||||
// Enable the dump function: which sends messages to the system
|
||||
// console
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1543115
|
||||
'browser.dom.window.dump.enabled': true,
|
||||
// Disable topstories
|
||||
'browser.newtabpage.activity-stream.feeds.system.topstories': false,
|
||||
// Always display a blank page
|
||||
'browser.newtabpage.enabled': false,
|
||||
// Background thumbnails in particular cause grief: and disabling
|
||||
// thumbnails in general cannot hurt
|
||||
'browser.pagethumbnails.capturing_disabled': true,
|
||||
|
||||
// Disable safebrowsing components.
|
||||
'browser.safebrowsing.blockedURIs.enabled': false,
|
||||
'browser.safebrowsing.downloads.enabled': false,
|
||||
'browser.safebrowsing.malware.enabled': false,
|
||||
'browser.safebrowsing.phishing.enabled': false,
|
||||
|
||||
// Disable updates to search engines.
|
||||
'browser.search.update': false,
|
||||
// Do not restore the last open set of tabs if the browser has crashed
|
||||
'browser.sessionstore.resume_from_crash': false,
|
||||
// Skip check for default browser on startup
|
||||
'browser.shell.checkDefaultBrowser': false,
|
||||
|
||||
// Disable newtabpage
|
||||
'browser.startup.homepage': 'about:blank',
|
||||
// Do not redirect user when a milstone upgrade of Firefox is detected
|
||||
'browser.startup.homepage_override.mstone': 'ignore',
|
||||
// Start with a blank page about:blank
|
||||
'browser.startup.page': 0,
|
||||
|
||||
// Do not allow background tabs to be zombified on Android: otherwise for
|
||||
// tests that open additional tabs: the test harness tab itself might get
|
||||
// unloaded
|
||||
'browser.tabs.disableBackgroundZombification': false,
|
||||
// Do not warn when closing all other open tabs
|
||||
'browser.tabs.warnOnCloseOtherTabs': false,
|
||||
// Do not warn when multiple tabs will be opened
|
||||
'browser.tabs.warnOnOpen': false,
|
||||
|
||||
// Do not automatically offer translations, as tests do not expect this.
|
||||
'browser.translations.automaticallyPopup': false,
|
||||
|
||||
// Disable the UI tour.
|
||||
'browser.uitour.enabled': false,
|
||||
// Turn off search suggestions in the location bar so as not to trigger
|
||||
// network connections.
|
||||
'browser.urlbar.suggest.searches': false,
|
||||
// Disable first run splash page on Windows 10
|
||||
'browser.usedOnWindows10.introURL': '',
|
||||
// Do not warn on quitting Firefox
|
||||
'browser.warnOnQuit': false,
|
||||
|
||||
// Defensively disable data reporting systems
|
||||
'datareporting.healthreport.documentServerURI': `http://${server}/dummy/healthreport/`,
|
||||
'datareporting.healthreport.logging.consoleEnabled': false,
|
||||
'datareporting.healthreport.service.enabled': false,
|
||||
'datareporting.healthreport.service.firstRun': false,
|
||||
'datareporting.healthreport.uploadEnabled': false,
|
||||
|
||||
// Do not show datareporting policy notifications which can interfere with tests
|
||||
'datareporting.policy.dataSubmissionEnabled': false,
|
||||
'datareporting.policy.dataSubmissionPolicyBypassNotification': true,
|
||||
|
||||
// DevTools JSONViewer sometimes fails to load dependencies with its require.js.
|
||||
// This doesn't affect Puppeteer but spams console (Bug 1424372)
|
||||
'devtools.jsonview.enabled': false,
|
||||
|
||||
// Disable popup-blocker
|
||||
'dom.disable_open_during_load': false,
|
||||
|
||||
// Enable the support for File object creation in the content process
|
||||
// Required for |Page.setFileInputFiles| protocol method.
|
||||
'dom.file.createInChild': true,
|
||||
|
||||
// Disable the ProcessHangMonitor
|
||||
'dom.ipc.reportProcessHangs': false,
|
||||
|
||||
// Disable slow script dialogues
|
||||
'dom.max_chrome_script_run_time': 0,
|
||||
'dom.max_script_run_time': 0,
|
||||
|
||||
// Only load extensions from the application and user profile
|
||||
// AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION
|
||||
'extensions.autoDisableScopes': 0,
|
||||
'extensions.enabledScopes': 5,
|
||||
|
||||
// Disable metadata caching for installed add-ons by default
|
||||
'extensions.getAddons.cache.enabled': false,
|
||||
|
||||
// Disable installing any distribution extensions or add-ons.
|
||||
'extensions.installDistroAddons': false,
|
||||
|
||||
// Turn off extension updates so they do not bother tests
|
||||
'extensions.update.enabled': false,
|
||||
|
||||
// Turn off extension updates so they do not bother tests
|
||||
'extensions.update.notifyUser': false,
|
||||
|
||||
// Make sure opening about:addons will not hit the network
|
||||
'extensions.webservice.discoverURL': `http://${server}/dummy/discoveryURL`,
|
||||
|
||||
// Allow the application to have focus even it runs in the background
|
||||
'focusmanager.testmode': true,
|
||||
|
||||
// Disable useragent updates
|
||||
'general.useragent.updates.enabled': false,
|
||||
|
||||
// Always use network provider for geolocation tests so we bypass the
|
||||
// macOS dialog raised by the corelocation provider
|
||||
'geo.provider.testing': true,
|
||||
|
||||
// Do not scan Wifi
|
||||
'geo.wifi.scan': false,
|
||||
|
||||
// No hang monitor
|
||||
'hangmonitor.timeout': 0,
|
||||
|
||||
// Show chrome errors and warnings in the error console
|
||||
'javascript.options.showInConsole': true,
|
||||
|
||||
// Disable download and usage of OpenH264: and Widevine plugins
|
||||
'media.gmp-manager.updateEnabled': false,
|
||||
|
||||
// Disable the GFX sanity window
|
||||
'media.sanity-test.disabled': true,
|
||||
|
||||
// Disable experimental feature that is only available in Nightly
|
||||
'network.cookie.sameSite.laxByDefault': false,
|
||||
|
||||
// Do not prompt for temporary redirects
|
||||
'network.http.prompt-temp-redirect': false,
|
||||
|
||||
// Disable speculative connections so they are not reported as leaking
|
||||
// when they are hanging around
|
||||
'network.http.speculative-parallel-limit': 0,
|
||||
|
||||
// Do not automatically switch between offline and online
|
||||
'network.manage-offline-status': false,
|
||||
|
||||
// Make sure SNTP requests do not hit the network
|
||||
'network.sntp.pools': server,
|
||||
|
||||
// Disable Flash.
|
||||
'plugin.state.flash': 0,
|
||||
|
||||
'privacy.trackingprotection.enabled': false,
|
||||
|
||||
// Can be removed once Firefox 89 is no longer supported
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1710839
|
||||
'remote.enabled': true,
|
||||
|
||||
// Until Bug 1999693 is resolved, this preference needs to be set to allow
|
||||
// Webdriver BiDi to automatically dismiss file pickers.
|
||||
'remote.bidi.dismiss_file_pickers.enabled': true,
|
||||
|
||||
// Disabled screenshots component
|
||||
'screenshots.browser.component.enabled': false,
|
||||
|
||||
// Don't do network connections for mitm priming
|
||||
'security.certerrors.mitm.priming.enabled': false,
|
||||
|
||||
// Local documents have access to all other local documents,
|
||||
// including directory listings
|
||||
'security.fileuri.strict_origin_policy': false,
|
||||
|
||||
// Do not wait for the notification button security delay
|
||||
'security.notification_enable_delay': 0,
|
||||
|
||||
// Ensure blocklist updates do not hit the network
|
||||
'services.settings.server': `http://${server}/dummy/blocklist/`,
|
||||
|
||||
// Do not automatically fill sign-in forms with known usernames and
|
||||
// passwords
|
||||
'signon.autofillForms': false,
|
||||
|
||||
// Disable password capture, so that tests that include forms are not
|
||||
// influenced by the presence of the persistent doorhanger notification
|
||||
'signon.rememberSignons': false,
|
||||
|
||||
// Disable first-run welcome page
|
||||
'startup.homepage_welcome_url': 'about:blank',
|
||||
|
||||
// Disable first-run welcome page
|
||||
'startup.homepage_welcome_url.additional': '',
|
||||
|
||||
// Disable browser animations (tabs, fullscreen, sliding alerts)
|
||||
'toolkit.cosmeticAnimations.enabled': false,
|
||||
|
||||
// Prevent starting into safe mode after application crashes
|
||||
'toolkit.startup.max_resumed_crashes': -1,
|
||||
};
|
||||
|
||||
return Object.assign(defaultPrefs, extraPrefs);
|
||||
}
|
||||
|
||||
async function backupFile(input: string): Promise<void> {
|
||||
if (!fs.existsSync(input)) {
|
||||
return;
|
||||
}
|
||||
await fs.promises.copyFile(input, input + '.puppeteer');
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the user.js file with custom preferences as needed to allow
|
||||
* Firefox's support to properly function. These preferences will be
|
||||
* automatically copied over to prefs.js during startup of Firefox. To be
|
||||
* able to restore the original values of preferences a backup of prefs.js
|
||||
* will be created.
|
||||
*/
|
||||
async function syncPreferences(options: ProfileOptions): Promise<void> {
|
||||
const prefsPath = path.join(options.path, 'prefs.js');
|
||||
const userPath = path.join(options.path, 'user.js');
|
||||
|
||||
const lines = Object.entries(options.preferences).map(([key, value]) => {
|
||||
return `user_pref(${JSON.stringify(key)}, ${JSON.stringify(value)});`;
|
||||
});
|
||||
|
||||
// Use allSettled to prevent corruption.
|
||||
const result = await Promise.allSettled([
|
||||
backupFile(userPath).then(async () => {
|
||||
await fs.promises.writeFile(userPath, lines.join('\n'));
|
||||
}),
|
||||
backupFile(prefsPath),
|
||||
]);
|
||||
for (const command of result) {
|
||||
if (command.status === 'rejected') {
|
||||
throw command.reason;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function compareVersions(a: string, b: string): number {
|
||||
// TODO: this is a not very reliable check.
|
||||
return parseInt(a.replace('.', ''), 16) - parseInt(b.replace('.', ''), 16);
|
||||
}
|
||||
82
node_modules/@puppeteer/browsers/src/browser-data/types.ts
generated
vendored
Normal file
82
node_modules/@puppeteer/browsers/src/browser-data/types.ts
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Supported browsers.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export enum Browser {
|
||||
CHROME = 'chrome',
|
||||
CHROMEHEADLESSSHELL = 'chrome-headless-shell',
|
||||
CHROMIUM = 'chromium',
|
||||
FIREFOX = 'firefox',
|
||||
CHROMEDRIVER = 'chromedriver',
|
||||
}
|
||||
|
||||
/**
|
||||
* Platform names used to identify a OS platform x architecture combination in the way
|
||||
* that is relevant for the browser download.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export enum BrowserPlatform {
|
||||
LINUX = 'linux',
|
||||
LINUX_ARM = 'linux_arm',
|
||||
MAC = 'mac',
|
||||
MAC_ARM = 'mac_arm',
|
||||
WIN32 = 'win32',
|
||||
WIN64 = 'win64',
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum describing a release channel for a browser.
|
||||
*
|
||||
* You can use this in combination with {@link resolveBuildId} to resolve
|
||||
* a build ID based on a release channel.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export enum BrowserTag {
|
||||
CANARY = 'canary',
|
||||
NIGHTLY = 'nightly',
|
||||
BETA = 'beta',
|
||||
DEV = 'dev',
|
||||
DEVEDITION = 'devedition',
|
||||
STABLE = 'stable',
|
||||
ESR = 'esr',
|
||||
LATEST = 'latest',
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface ProfileOptions {
|
||||
preferences: Record<string, unknown>;
|
||||
path: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export enum ChromeReleaseChannel {
|
||||
STABLE = 'stable',
|
||||
DEV = 'dev',
|
||||
CANARY = 'canary',
|
||||
BETA = 'beta',
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function verifyChromeReleaseChannel(
|
||||
value: unknown,
|
||||
): ChromeReleaseChannel {
|
||||
if (Object.values(ChromeReleaseChannel).includes(value as any)) {
|
||||
return value as ChromeReleaseChannel;
|
||||
}
|
||||
throw new Error(`Invalid Chrome channel: ${value}`);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user