initial commit
This commit is contained in:
commit
c2686e7110
|
|
@ -0,0 +1,28 @@
|
||||||
|
-----BEGIN PRIVATE KEY-----
|
||||||
|
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDBOF/G2Ndw49WG
|
||||||
|
b6YjpDSrTNyG3kGnxiiFNhMQ0jQgSUlNa73Sl4izdd9tulGWpkgG5ADmoJsLsJxw
|
||||||
|
kufdtsvLOpOKizYO8I7bkdtNgILr+SzypMLMqUovODmF+DK35ju/8bTN6T+FOAMk
|
||||||
|
8maFbshIfckFlW4INpOAY9d97E/AEK3ZdGcIbUo6O1cYnWPOuaLLdkesw5gHnh4r
|
||||||
|
aP05jJxrcHeHCKiwjnz0tu5J7xbmKn1kTDFaPnx6K9M9Bkt1nep9TkZGFuB/kM38
|
||||||
|
zHlA7LPoHNbrzddw3kfxKCoxUxzfe8HDbOeaYZNKs7TiSPltWL7SqqwFOIe59piO
|
||||||
|
9BOZgbmZAgMBAAECggEAbpwkEAQgSOrUWHJfzHV7BTkp4TcopK/GkIOlJHMBDh6G
|
||||||
|
DQEJmJ3QztNChWEsxa4I+5DYhy4Xs/h1hehDPeQgBAZTYfNRjfnd/gogXdyclhN9
|
||||||
|
zKXPMjQTWLa6D1xHRIlTWQ04MMw+5bdr7WGqmOYTV5RSWJTzeVYs2EnPmbGG8e5b
|
||||||
|
t+/9FtsyOLjXRZhiikCJrbYRHoqegrpu2t/1L1F5Rw7vw3VKcTl9lwhl5Z5Xthy4
|
||||||
|
em2TERBXD8tfpRiV19XbN7CIJOwWdVmKd0LiLI/Bv3PGXF3mCeM8qEV9PHEwuNNC
|
||||||
|
yJY3mcZy/udoZsnm1z5T1c8wAeF6cC4f9P2v7PXAkQKBgQDaL3VDyv3LLyYvWqFa
|
||||||
|
fxCMVwrisK0+v8XZA0zhjlFQ3ocMzDsgr+SkWeS+NKpsx3eLRJgEsaVo0txwZR2w
|
||||||
|
HJV7MIoMa5ZlWl+RPGob3LKfWnOomR5WpzzZnadPKNkfyXugMNlYG0yRBrjVlPlu
|
||||||
|
wb7lpL/NvmAJEjG8uOO/saqY3QKBgQDitUAuBbSZGmMyTVKlpgajrjlGx4ivJydI
|
||||||
|
fAcCWf4Tp6iil3MV4bLTw2aimJ7QuX7ifXIZMYKbG337NeiZtQ7GBFYDRMcHAUzj
|
||||||
|
P3+KGLX7CeFlEwpScz/ErM8sUORmr/z7N+Jg23rPsZIUoHsuU26zzkOy5FnVWea+
|
||||||
|
YMabP5057QKBgGPYifpPH5tm5TuQZvyJ32HJx3J71Zw8mGa6KumhfjbazsSdhYVs
|
||||||
|
2N4ZQSOF6GPFWECEUGj9fqucq0JIE7DvM7zfNp1+cqHJHKjTE9/SPG/OLdV+1LJk
|
||||||
|
7+TKT7FbCRmR06A4Go5GV+CaSeV7ujXkNd7TaO7Xaw1bpSUvGxIzVNWFAoGAJBVT
|
||||||
|
LMANuZygkz4JXIIrZlvxk9loYPBraTcMaoxmSzyRM6fFUoNE0j20lUaTaIdNscDj
|
||||||
|
qyzdK9DZYWV4KxbNTikcg5Kr1uqXEUhnBVTfiiBNdqfsKalcSfJzWwtY/xsdueJw
|
||||||
|
LphgWLRbmtrcIEh5QzceQVflEHcpqb1/fvBGFxUCgYASMkfBmwIPB/Jao1M8UfNw
|
||||||
|
TfrC2gB22vHMBUdGJMzzcRwUq6Owo0bZLNtAsUqv383kujizmw410JRLFu4swkLI
|
||||||
|
2LHs4efMRLpmIwwFfxPNzhxhQb1TL1jcyczWieLlHkVPVkSgnR5FWHj+ciYGdG9c
|
||||||
|
1OE0XtxLxSaiqyr0l/sFMg==
|
||||||
|
-----END PRIVATE KEY-----
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIESDCCArCgAwIBAgIRAIlYTf3i3NMc7W9Oxk+/DXcwDQYJKoZIhvcNAQELBQAw
|
||||||
|
gYkxHjAcBgNVBAoTFW1rY2VydCBkZXZlbG9wbWVudCBDQTEvMC0GA1UECwwmREVT
|
||||||
|
S1RPUC1BNkMwOEYwXG1laHJhbkBERVNLVE9QLUE2QzA4RjAxNjA0BgNVBAMMLW1r
|
||||||
|
Y2VydCBERVNLVE9QLUE2QzA4RjBcbWVocmFuQERFU0tUT1AtQTZDMDhGMDAeFw0y
|
||||||
|
NTEwMTgwOTAwMzhaFw0yODAxMTgwOTAwMzhaMFoxJzAlBgNVBAoTHm1rY2VydCBk
|
||||||
|
ZXZlbG9wbWVudCBjZXJ0aWZpY2F0ZTEvMC0GA1UECwwmREVTS1RPUC1BNkMwOEYw
|
||||||
|
XG1laHJhbkBERVNLVE9QLUE2QzA4RjAwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
|
||||||
|
ggEKAoIBAQDBOF/G2Ndw49WGb6YjpDSrTNyG3kGnxiiFNhMQ0jQgSUlNa73Sl4iz
|
||||||
|
dd9tulGWpkgG5ADmoJsLsJxwkufdtsvLOpOKizYO8I7bkdtNgILr+SzypMLMqUov
|
||||||
|
ODmF+DK35ju/8bTN6T+FOAMk8maFbshIfckFlW4INpOAY9d97E/AEK3ZdGcIbUo6
|
||||||
|
O1cYnWPOuaLLdkesw5gHnh4raP05jJxrcHeHCKiwjnz0tu5J7xbmKn1kTDFaPnx6
|
||||||
|
K9M9Bkt1nep9TkZGFuB/kM38zHlA7LPoHNbrzddw3kfxKCoxUxzfe8HDbOeaYZNK
|
||||||
|
s7TiSPltWL7SqqwFOIe59piO9BOZgbmZAgMBAAGjWTBXMA4GA1UdDwEB/wQEAwIF
|
||||||
|
oDATBgNVHSUEDDAKBggrBgEFBQcDATAfBgNVHSMEGDAWgBQjmxqst8hPgCi+18zA
|
||||||
|
t8uU98ljHDAPBgNVHREECDAGhwTAqGQPMA0GCSqGSIb3DQEBCwUAA4IBgQCdgGlx
|
||||||
|
yGQ7stSST48yUUFsnxLDY+EjuyprHdMEnIxYeGTM+RUp0oKTnJJMIYG3CiXCRW/1
|
||||||
|
4mLUa93T+Ovf9nw9ZRVULGfdfBPstBtZJiP4YE8sp1L5JPPgrBCrgDUFZrG20ORE
|
||||||
|
irfK1zWNj6cw7CPAMibltnruBoge3+XfoAYLvNWi51odwY8oI8inMM4W5/RUgIV5
|
||||||
|
Z2WgHG5rNPUw8IZQlRmT+ZCpLCg7XfmY2Z2ey54fpyW6iY6UGoEL/4ggTsmLUjrp
|
||||||
|
PuZH3wQwQftOfZjoJILro4a+QweWLCcSRZoSDQAfc6fc1j5DG457gce3YjDoapEG
|
||||||
|
+IugT1ZZybGKzx9za+wX4FwfuZfIHIQeaVBlmjg0rDg28mu1/6J5MV7zNyfEKvFD
|
||||||
|
8KJFiwf5ueiyzcBJ3uB9mw9d8OOvscnJomB4/eQw4mukHPgvUCFbUg506s67RyxX
|
||||||
|
aER92w5C/VjLK+yesNTFCGienJzoVDsRFiCYW6AitfFL9a8jIroj9KIE1NA=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
Binary file not shown.
|
|
@ -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/cjs/main-cli.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../@puppeteer/browsers/lib/cjs/main-cli.js" "$@"
|
||||||
|
fi
|
||||||
|
|
@ -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\cjs\main-cli.js" %*
|
||||||
|
|
@ -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/cjs/main-cli.js" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../@puppeteer/browsers/lib/cjs/main-cli.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../@puppeteer/browsers/lib/cjs/main-cli.js" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../@puppeteer/browsers/lib/cjs/main-cli.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
|
|
@ -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/../escodegen/bin/escodegen.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../escodegen/bin/escodegen.js" "$@"
|
||||||
|
fi
|
||||||
|
|
@ -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%\..\escodegen\bin\escodegen.js" %*
|
||||||
|
|
@ -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/../escodegen/bin/escodegen.js" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../escodegen/bin/escodegen.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../escodegen/bin/escodegen.js" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../escodegen/bin/escodegen.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
|
|
@ -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/../escodegen/bin/esgenerate.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../escodegen/bin/esgenerate.js" "$@"
|
||||||
|
fi
|
||||||
|
|
@ -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%\..\escodegen\bin\esgenerate.js" %*
|
||||||
|
|
@ -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/../escodegen/bin/esgenerate.js" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../escodegen/bin/esgenerate.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../escodegen/bin/esgenerate.js" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../escodegen/bin/esgenerate.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
|
|
@ -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/../esprima/bin/esparse.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../esprima/bin/esparse.js" "$@"
|
||||||
|
fi
|
||||||
|
|
@ -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%\..\esprima\bin\esparse.js" %*
|
||||||
|
|
@ -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/../esprima/bin/esparse.js" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../esprima/bin/esparse.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../esprima/bin/esparse.js" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../esprima/bin/esparse.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
|
|
@ -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/../esprima/bin/esvalidate.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../esprima/bin/esvalidate.js" "$@"
|
||||||
|
fi
|
||||||
|
|
@ -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%\..\esprima\bin\esvalidate.js" %*
|
||||||
|
|
@ -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/../esprima/bin/esvalidate.js" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../esprima/bin/esvalidate.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../esprima/bin/esvalidate.js" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../esprima/bin/esvalidate.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
|
|
@ -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/../extract-zip/cli.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../extract-zip/cli.js" "$@"
|
||||||
|
fi
|
||||||
|
|
@ -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%\..\extract-zip\cli.js" %*
|
||||||
|
|
@ -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/../extract-zip/cli.js" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../extract-zip/cli.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../extract-zip/cli.js" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../extract-zip/cli.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
|
|
@ -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/../js-yaml/bin/js-yaml.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../js-yaml/bin/js-yaml.js" "$@"
|
||||||
|
fi
|
||||||
|
|
@ -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%\..\js-yaml\bin\js-yaml.js" %*
|
||||||
|
|
@ -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/../js-yaml/bin/js-yaml.js" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../js-yaml/bin/js-yaml.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
|
|
@ -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/../mime/cli.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../mime/cli.js" "$@"
|
||||||
|
fi
|
||||||
|
|
@ -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%\..\mime\cli.js" %*
|
||||||
|
|
@ -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/../mime/cli.js" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../mime/cli.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../mime/cli.js" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../mime/cli.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
|
|
@ -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/cjs/puppeteer/node/cli.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../puppeteer/lib/cjs/puppeteer/node/cli.js" "$@"
|
||||||
|
fi
|
||||||
|
|
@ -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\cjs\puppeteer\node\cli.js" %*
|
||||||
|
|
@ -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/cjs/puppeteer/node/cli.js" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../puppeteer/lib/cjs/puppeteer/node/cli.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../puppeteer/lib/cjs/puppeteer/node/cli.js" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../puppeteer/lib/cjs/puppeteer/node/cli.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
|
|
@ -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/../semver/bin/semver.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../semver/bin/semver.js" "$@"
|
||||||
|
fi
|
||||||
|
|
@ -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%\..\semver\bin\semver.js" %*
|
||||||
|
|
@ -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/../semver/bin/semver.js" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../semver/bin/semver.js" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../semver/bin/semver.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
|
|
@ -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/../sshpk/bin/sshpk-conv" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../sshpk/bin/sshpk-conv" "$@"
|
||||||
|
fi
|
||||||
|
|
@ -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%\..\sshpk\bin\sshpk-conv" %*
|
||||||
|
|
@ -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/../sshpk/bin/sshpk-conv" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../sshpk/bin/sshpk-conv" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../sshpk/bin/sshpk-conv" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../sshpk/bin/sshpk-conv" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
|
|
@ -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/../sshpk/bin/sshpk-sign" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../sshpk/bin/sshpk-sign" "$@"
|
||||||
|
fi
|
||||||
|
|
@ -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%\..\sshpk\bin\sshpk-sign" %*
|
||||||
|
|
@ -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/../sshpk/bin/sshpk-sign" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../sshpk/bin/sshpk-sign" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../sshpk/bin/sshpk-sign" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../sshpk/bin/sshpk-sign" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
|
|
@ -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/../sshpk/bin/sshpk-verify" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../sshpk/bin/sshpk-verify" "$@"
|
||||||
|
fi
|
||||||
|
|
@ -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%\..\sshpk\bin\sshpk-verify" %*
|
||||||
|
|
@ -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/../sshpk/bin/sshpk-verify" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../sshpk/bin/sshpk-verify" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../sshpk/bin/sshpk-verify" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../sshpk/bin/sshpk-verify" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
|
|
@ -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/../uuid/bin/uuid" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../uuid/bin/uuid" "$@"
|
||||||
|
fi
|
||||||
|
|
@ -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%\..\uuid\bin\uuid" %*
|
||||||
|
|
@ -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/../uuid/bin/uuid" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../uuid/bin/uuid" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../uuid/bin/uuid" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../uuid/bin/uuid" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,22 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
# @babel/code-frame
|
||||||
|
|
||||||
|
> Generate errors that contain a code frame that point to source locations.
|
||||||
|
|
||||||
|
See our website [@babel/code-frame](https://babeljs.io/docs/babel-code-frame) for more information.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Using npm:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save-dev @babel/code-frame
|
||||||
|
```
|
||||||
|
|
||||||
|
or using yarn:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn add @babel/code-frame --dev
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,216 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
|
var picocolors = require('picocolors');
|
||||||
|
var jsTokens = require('js-tokens');
|
||||||
|
var helperValidatorIdentifier = require('@babel/helper-validator-identifier');
|
||||||
|
|
||||||
|
function isColorSupported() {
|
||||||
|
return (typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? false : picocolors.isColorSupported
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const compose = (f, g) => v => f(g(v));
|
||||||
|
function buildDefs(colors) {
|
||||||
|
return {
|
||||||
|
keyword: colors.cyan,
|
||||||
|
capitalized: colors.yellow,
|
||||||
|
jsxIdentifier: colors.yellow,
|
||||||
|
punctuator: colors.yellow,
|
||||||
|
number: colors.magenta,
|
||||||
|
string: colors.green,
|
||||||
|
regex: colors.magenta,
|
||||||
|
comment: colors.gray,
|
||||||
|
invalid: compose(compose(colors.white, colors.bgRed), colors.bold),
|
||||||
|
gutter: colors.gray,
|
||||||
|
marker: compose(colors.red, colors.bold),
|
||||||
|
message: compose(colors.red, colors.bold),
|
||||||
|
reset: colors.reset
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const defsOn = buildDefs(picocolors.createColors(true));
|
||||||
|
const defsOff = buildDefs(picocolors.createColors(false));
|
||||||
|
function getDefs(enabled) {
|
||||||
|
return enabled ? defsOn : defsOff;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
|
||||||
|
const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
|
||||||
|
const BRACKET = /^[()[\]{}]$/;
|
||||||
|
let tokenize;
|
||||||
|
{
|
||||||
|
const JSX_TAG = /^[a-z][\w-]*$/i;
|
||||||
|
const getTokenType = function (token, offset, text) {
|
||||||
|
if (token.type === "name") {
|
||||||
|
if (helperValidatorIdentifier.isKeyword(token.value) || helperValidatorIdentifier.isStrictReservedWord(token.value, true) || sometimesKeywords.has(token.value)) {
|
||||||
|
return "keyword";
|
||||||
|
}
|
||||||
|
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) {
|
||||||
|
return "jsxIdentifier";
|
||||||
|
}
|
||||||
|
if (token.value[0] !== token.value[0].toLowerCase()) {
|
||||||
|
return "capitalized";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (token.type === "punctuator" && BRACKET.test(token.value)) {
|
||||||
|
return "bracket";
|
||||||
|
}
|
||||||
|
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
|
||||||
|
return "punctuator";
|
||||||
|
}
|
||||||
|
return token.type;
|
||||||
|
};
|
||||||
|
tokenize = function* (text) {
|
||||||
|
let match;
|
||||||
|
while (match = jsTokens.default.exec(text)) {
|
||||||
|
const token = jsTokens.matchToToken(match);
|
||||||
|
yield {
|
||||||
|
type: getTokenType(token, match.index, text),
|
||||||
|
value: token.value
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function highlight(text) {
|
||||||
|
if (text === "") return "";
|
||||||
|
const defs = getDefs(true);
|
||||||
|
let highlighted = "";
|
||||||
|
for (const {
|
||||||
|
type,
|
||||||
|
value
|
||||||
|
} of tokenize(text)) {
|
||||||
|
if (type in defs) {
|
||||||
|
highlighted += value.split(NEWLINE$1).map(str => defs[type](str)).join("\n");
|
||||||
|
} else {
|
||||||
|
highlighted += value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return highlighted;
|
||||||
|
}
|
||||||
|
|
||||||
|
let deprecationWarningShown = false;
|
||||||
|
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||||
|
function getMarkerLines(loc, source, opts) {
|
||||||
|
const startLoc = Object.assign({
|
||||||
|
column: 0,
|
||||||
|
line: -1
|
||||||
|
}, loc.start);
|
||||||
|
const endLoc = Object.assign({}, startLoc, loc.end);
|
||||||
|
const {
|
||||||
|
linesAbove = 2,
|
||||||
|
linesBelow = 3
|
||||||
|
} = opts || {};
|
||||||
|
const startLine = startLoc.line;
|
||||||
|
const startColumn = startLoc.column;
|
||||||
|
const endLine = endLoc.line;
|
||||||
|
const endColumn = endLoc.column;
|
||||||
|
let start = Math.max(startLine - (linesAbove + 1), 0);
|
||||||
|
let end = Math.min(source.length, endLine + linesBelow);
|
||||||
|
if (startLine === -1) {
|
||||||
|
start = 0;
|
||||||
|
}
|
||||||
|
if (endLine === -1) {
|
||||||
|
end = source.length;
|
||||||
|
}
|
||||||
|
const lineDiff = endLine - startLine;
|
||||||
|
const markerLines = {};
|
||||||
|
if (lineDiff) {
|
||||||
|
for (let i = 0; i <= lineDiff; i++) {
|
||||||
|
const lineNumber = i + startLine;
|
||||||
|
if (!startColumn) {
|
||||||
|
markerLines[lineNumber] = true;
|
||||||
|
} else if (i === 0) {
|
||||||
|
const sourceLength = source[lineNumber - 1].length;
|
||||||
|
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
||||||
|
} else if (i === lineDiff) {
|
||||||
|
markerLines[lineNumber] = [0, endColumn];
|
||||||
|
} else {
|
||||||
|
const sourceLength = source[lineNumber - i].length;
|
||||||
|
markerLines[lineNumber] = [0, sourceLength];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (startColumn === endColumn) {
|
||||||
|
if (startColumn) {
|
||||||
|
markerLines[startLine] = [startColumn, 0];
|
||||||
|
} else {
|
||||||
|
markerLines[startLine] = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
markerLines[startLine] = [startColumn, endColumn - startColumn];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
markerLines
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function codeFrameColumns(rawLines, loc, opts = {}) {
|
||||||
|
const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
|
||||||
|
const defs = getDefs(shouldHighlight);
|
||||||
|
const lines = rawLines.split(NEWLINE);
|
||||||
|
const {
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
markerLines
|
||||||
|
} = getMarkerLines(loc, lines, opts);
|
||||||
|
const hasColumns = loc.start && typeof loc.start.column === "number";
|
||||||
|
const numberMaxWidth = String(end).length;
|
||||||
|
const highlightedLines = shouldHighlight ? highlight(rawLines) : rawLines;
|
||||||
|
let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
|
||||||
|
const number = start + 1 + index;
|
||||||
|
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
||||||
|
const gutter = ` ${paddedNumber} |`;
|
||||||
|
const hasMarker = markerLines[number];
|
||||||
|
const lastMarkerLine = !markerLines[number + 1];
|
||||||
|
if (hasMarker) {
|
||||||
|
let markerLine = "";
|
||||||
|
if (Array.isArray(hasMarker)) {
|
||||||
|
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
||||||
|
const numberOfMarkers = hasMarker[1] || 1;
|
||||||
|
markerLine = ["\n ", defs.gutter(gutter.replace(/\d/g, " ")), " ", markerSpacing, defs.marker("^").repeat(numberOfMarkers)].join("");
|
||||||
|
if (lastMarkerLine && opts.message) {
|
||||||
|
markerLine += " " + defs.message(opts.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [defs.marker(">"), defs.gutter(gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
|
||||||
|
} else {
|
||||||
|
return ` ${defs.gutter(gutter)}${line.length > 0 ? ` ${line}` : ""}`;
|
||||||
|
}
|
||||||
|
}).join("\n");
|
||||||
|
if (opts.message && !hasColumns) {
|
||||||
|
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
|
||||||
|
}
|
||||||
|
if (shouldHighlight) {
|
||||||
|
return defs.reset(frame);
|
||||||
|
} else {
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function index (rawLines, lineNumber, colNumber, opts = {}) {
|
||||||
|
if (!deprecationWarningShown) {
|
||||||
|
deprecationWarningShown = true;
|
||||||
|
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
||||||
|
if (process.emitWarning) {
|
||||||
|
process.emitWarning(message, "DeprecationWarning");
|
||||||
|
} else {
|
||||||
|
const deprecationError = new Error(message);
|
||||||
|
deprecationError.name = "DeprecationWarning";
|
||||||
|
console.warn(new Error(message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
colNumber = Math.max(colNumber, 0);
|
||||||
|
const location = {
|
||||||
|
start: {
|
||||||
|
column: colNumber,
|
||||||
|
line: lineNumber
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return codeFrameColumns(rawLines, location, opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.codeFrameColumns = codeFrameColumns;
|
||||||
|
exports.default = index;
|
||||||
|
exports.highlight = highlight;
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"name": "@babel/code-frame",
|
||||||
|
"version": "7.27.1",
|
||||||
|
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||||
|
"author": "The Babel Team (https://babel.dev/team)",
|
||||||
|
"homepage": "https://babel.dev/docs/en/next/babel-code-frame",
|
||||||
|
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen",
|
||||||
|
"license": "MIT",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/babel/babel.git",
|
||||||
|
"directory": "packages/babel-code-frame"
|
||||||
|
},
|
||||||
|
"main": "./lib/index.js",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/helper-validator-identifier": "^7.27.1",
|
||||||
|
"js-tokens": "^4.0.0",
|
||||||
|
"picocolors": "^1.1.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"import-meta-resolve": "^4.1.0",
|
||||||
|
"strip-ansi": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.9.0"
|
||||||
|
},
|
||||||
|
"type": "commonjs"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
# @babel/helper-validator-identifier
|
||||||
|
|
||||||
|
> Validate identifier/keywords name
|
||||||
|
|
||||||
|
See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/babel-helper-validator-identifier) for more information.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Using npm:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save @babel/helper-validator-identifier
|
||||||
|
```
|
||||||
|
|
||||||
|
or using yarn:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn add @babel/helper-validator-identifier
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.isIdentifierChar = isIdentifierChar;
|
||||||
|
exports.isIdentifierName = isIdentifierName;
|
||||||
|
exports.isIdentifierStart = isIdentifierStart;
|
||||||
|
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7cd\ua7d0\ua7d1\ua7d3\ua7d5-\ua7dc\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
||||||
|
let nonASCIIidentifierChars = "\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
|
||||||
|
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
||||||
|
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
||||||
|
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
||||||
|
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 496, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191];
|
||||||
|
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
||||||
|
function isInAstralSet(code, set) {
|
||||||
|
let pos = 0x10000;
|
||||||
|
for (let i = 0, length = set.length; i < length; i += 2) {
|
||||||
|
pos += set[i];
|
||||||
|
if (pos > code) return false;
|
||||||
|
pos += set[i + 1];
|
||||||
|
if (pos >= code) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function isIdentifierStart(code) {
|
||||||
|
if (code < 65) return code === 36;
|
||||||
|
if (code <= 90) return true;
|
||||||
|
if (code < 97) return code === 95;
|
||||||
|
if (code <= 122) return true;
|
||||||
|
if (code <= 0xffff) {
|
||||||
|
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
|
||||||
|
}
|
||||||
|
return isInAstralSet(code, astralIdentifierStartCodes);
|
||||||
|
}
|
||||||
|
function isIdentifierChar(code) {
|
||||||
|
if (code < 48) return code === 36;
|
||||||
|
if (code < 58) return true;
|
||||||
|
if (code < 65) return false;
|
||||||
|
if (code <= 90) return true;
|
||||||
|
if (code < 97) return code === 95;
|
||||||
|
if (code <= 122) return true;
|
||||||
|
if (code <= 0xffff) {
|
||||||
|
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
|
||||||
|
}
|
||||||
|
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
||||||
|
}
|
||||||
|
function isIdentifierName(name) {
|
||||||
|
let isFirst = true;
|
||||||
|
for (let i = 0; i < name.length; i++) {
|
||||||
|
let cp = name.charCodeAt(i);
|
||||||
|
if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) {
|
||||||
|
const trail = name.charCodeAt(++i);
|
||||||
|
if ((trail & 0xfc00) === 0xdc00) {
|
||||||
|
cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isFirst) {
|
||||||
|
isFirst = false;
|
||||||
|
if (!isIdentifierStart(cp)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (!isIdentifierChar(cp)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return !isFirst;
|
||||||
|
}
|
||||||
|
|
||||||
|
//# sourceMappingURL=identifier.js.map
|
||||||
1
node_modules/@babel/helper-validator-identifier/lib/identifier.js.map
generated
vendored
Normal file
1
node_modules/@babel/helper-validator-identifier/lib/identifier.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,57 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "isIdentifierChar", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _identifier.isIdentifierChar;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "isIdentifierName", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _identifier.isIdentifierName;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "isIdentifierStart", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _identifier.isIdentifierStart;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "isKeyword", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _keyword.isKeyword;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "isReservedWord", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _keyword.isReservedWord;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _keyword.isStrictBindOnlyReservedWord;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "isStrictBindReservedWord", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _keyword.isStrictBindReservedWord;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "isStrictReservedWord", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _keyword.isStrictReservedWord;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var _identifier = require("./identifier.js");
|
||||||
|
var _keyword = require("./keyword.js");
|
||||||
|
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"names":["_identifier","require","_keyword"],"sources":["../src/index.ts"],"sourcesContent":["export {\n isIdentifierName,\n isIdentifierChar,\n isIdentifierStart,\n} from \"./identifier.ts\";\nexport {\n isReservedWord,\n isStrictBindOnlyReservedWord,\n isStrictBindReservedWord,\n isStrictReservedWord,\n isKeyword,\n} from \"./keyword.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA","ignoreList":[]}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.isKeyword = isKeyword;
|
||||||
|
exports.isReservedWord = isReservedWord;
|
||||||
|
exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
|
||||||
|
exports.isStrictBindReservedWord = isStrictBindReservedWord;
|
||||||
|
exports.isStrictReservedWord = isStrictReservedWord;
|
||||||
|
const reservedWords = {
|
||||||
|
keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
|
||||||
|
strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
|
||||||
|
strictBind: ["eval", "arguments"]
|
||||||
|
};
|
||||||
|
const keywords = new Set(reservedWords.keyword);
|
||||||
|
const reservedWordsStrictSet = new Set(reservedWords.strict);
|
||||||
|
const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
|
||||||
|
function isReservedWord(word, inModule) {
|
||||||
|
return inModule && word === "await" || word === "enum";
|
||||||
|
}
|
||||||
|
function isStrictReservedWord(word, inModule) {
|
||||||
|
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
||||||
|
}
|
||||||
|
function isStrictBindOnlyReservedWord(word) {
|
||||||
|
return reservedWordsStrictBindSet.has(word);
|
||||||
|
}
|
||||||
|
function isStrictBindReservedWord(word, inModule) {
|
||||||
|
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
||||||
|
}
|
||||||
|
function isKeyword(word) {
|
||||||
|
return keywords.has(word);
|
||||||
|
}
|
||||||
|
|
||||||
|
//# sourceMappingURL=keyword.js.map
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"names":["reservedWords","keyword","strict","strictBind","keywords","Set","reservedWordsStrictSet","reservedWordsStrictBindSet","isReservedWord","word","inModule","isStrictReservedWord","has","isStrictBindOnlyReservedWord","isStrictBindReservedWord","isKeyword"],"sources":["../src/keyword.ts"],"sourcesContent":["const reservedWords = {\n keyword: [\n \"break\",\n \"case\",\n \"catch\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"do\",\n \"else\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"return\",\n \"switch\",\n \"throw\",\n \"try\",\n \"var\",\n \"const\",\n \"while\",\n \"with\",\n \"new\",\n \"this\",\n \"super\",\n \"class\",\n \"extends\",\n \"export\",\n \"import\",\n \"null\",\n \"true\",\n \"false\",\n \"in\",\n \"instanceof\",\n \"typeof\",\n \"void\",\n \"delete\",\n ],\n strict: [\n \"implements\",\n \"interface\",\n \"let\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"static\",\n \"yield\",\n ],\n strictBind: [\"eval\", \"arguments\"],\n};\nconst keywords = new Set(reservedWords.keyword);\nconst reservedWordsStrictSet = new Set(reservedWords.strict);\nconst reservedWordsStrictBindSet = new Set(reservedWords.strictBind);\n\n/**\n * Checks if word is a reserved word in non-strict mode\n */\nexport function isReservedWord(word: string, inModule: boolean): boolean {\n return (inModule && word === \"await\") || word === \"enum\";\n}\n\n/**\n * Checks if word is a reserved word in non-binding strict mode\n *\n * Includes non-strict reserved words\n */\nexport function isStrictReservedWord(word: string, inModule: boolean): boolean {\n return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);\n}\n\n/**\n * Checks if word is a reserved word in binding strict mode, but it is allowed as\n * a normal identifier.\n */\nexport function isStrictBindOnlyReservedWord(word: string): boolean {\n return reservedWordsStrictBindSet.has(word);\n}\n\n/**\n * Checks if word is a reserved word in binding strict mode\n *\n * Includes non-strict reserved words and non-binding strict reserved words\n */\nexport function isStrictBindReservedWord(\n word: string,\n inModule: boolean,\n): boolean {\n return (\n isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word)\n );\n}\n\nexport function isKeyword(word: string): boolean {\n return keywords.has(word);\n}\n"],"mappings":";;;;;;;;;;AAAA,MAAMA,aAAa,GAAG;EACpBC,OAAO,EAAE,CACP,OAAO,EACP,MAAM,EACN,OAAO,EACP,UAAU,EACV,UAAU,EACV,SAAS,EACT,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,KAAK,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,MAAM,EACN,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,QAAQ,CACT;EACDC,MAAM,EAAE,CACN,YAAY,EACZ,WAAW,EACX,KAAK,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,OAAO,CACR;EACDC,UAAU,EAAE,CAAC,MAAM,EAAE,WAAW;AAClC,CAAC;AACD,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAACL,aAAa,CAACC,OAAO,CAAC;AAC/C,MAAMK,sBAAsB,GAAG,IAAID,GAAG,CAACL,aAAa,CAACE,MAAM,CAAC;AAC5D,MAAMK,0BAA0B,GAAG,IAAIF,GAAG,CAACL,aAAa,CAACG,UAAU,CAAC;AAK7D,SAASK,cAAcA,CAACC,IAAY,EAAEC,QAAiB,EAAW;EACvE,OAAQA,QAAQ,IAAID,IAAI,KAAK,OAAO,IAAKA,IAAI,KAAK,MAAM;AAC1D;AAOO,SAASE,oBAAoBA,CAACF,IAAY,EAAEC,QAAiB,EAAW;EAC7E,OAAOF,cAAc,CAACC,IAAI,EAAEC,QAAQ,CAAC,IAAIJ,sBAAsB,CAACM,GAAG,CAACH,IAAI,CAAC;AAC3E;AAMO,SAASI,4BAA4BA,CAACJ,IAAY,EAAW;EAClE,OAAOF,0BAA0B,CAACK,GAAG,CAACH,IAAI,CAAC;AAC7C;AAOO,SAASK,wBAAwBA,CACtCL,IAAY,EACZC,QAAiB,EACR;EACT,OACEC,oBAAoB,CAACF,IAAI,EAAEC,QAAQ,CAAC,IAAIG,4BAA4B,CAACJ,IAAI,CAAC;AAE9E;AAEO,SAASM,SAASA,CAACN,IAAY,EAAW;EAC/C,OAAOL,QAAQ,CAACQ,GAAG,CAACH,IAAI,CAAC;AAC3B","ignoreList":[]}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"name": "@babel/helper-validator-identifier",
|
||||||
|
"version": "7.27.1",
|
||||||
|
"description": "Validate identifier/keywords name",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/babel/babel.git",
|
||||||
|
"directory": "packages/babel-helper-validator-identifier"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"main": "./lib/index.js",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./lib/index.d.ts",
|
||||||
|
"default": "./lib/index.js"
|
||||||
|
},
|
||||||
|
"./package.json": "./package.json"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@unicode/unicode-16.0.0": "^1.0.0",
|
||||||
|
"charcodes": "^0.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.9.0"
|
||||||
|
},
|
||||||
|
"author": "The Babel Team (https://babel.dev/team)",
|
||||||
|
"type": "commonjs"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
# Licensing
|
||||||
|
|
||||||
|
## color
|
||||||
|
|
||||||
|
Copyright (c) 2012 Heather Arthur
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
## color-convert
|
||||||
|
|
||||||
|
Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.com>.
|
||||||
|
Copyright (c) 2016-2021 Josh Junon <josh@junon.me>.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
## color-string
|
||||||
|
|
||||||
|
Copyright (c) 2011 Heather Arthur <fayearthur@gmail.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
## color-name
|
||||||
|
|
||||||
|
The MIT License (MIT)
|
||||||
|
Copyright (c) 2015 Dmitry Ivanov
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
# `@img/colour`
|
||||||
|
|
||||||
|
The latest version of the
|
||||||
|
[color](https://www.npmjs.com/package/color)
|
||||||
|
package is now ESM-only,
|
||||||
|
however some JavaScript runtimes do not yet support this,
|
||||||
|
which includes versions of Node.js prior to 20.19.0.
|
||||||
|
|
||||||
|
This package converts the `color` package and its dependencies,
|
||||||
|
all of which are MIT-licensed, to CommonJS.
|
||||||
|
|
||||||
|
- [color](https://www.npmjs.com/package/color)
|
||||||
|
- [color-convert](https://www.npmjs.com/package/color-convert)
|
||||||
|
- [color-string](https://www.npmjs.com/package/color-string)
|
||||||
|
- [color-name](https://www.npmjs.com/package/color-name)
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require("./color.cjs").default;
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"name": "@img/colour",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "The ESM-only 'color' package made compatible for use with CommonJS runtimes",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.cjs",
|
||||||
|
"authors": [
|
||||||
|
"Heather Arthur <fayearthur@gmail.com>",
|
||||||
|
"Josh Junon <josh@junon.me>",
|
||||||
|
"Maxime Thirouin",
|
||||||
|
"Dyma Ywanov <dfcreative@gmail.com>",
|
||||||
|
"LitoMore (https://github.com/LitoMore)"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"color.cjs"
|
||||||
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/lovell/colour.git"
|
||||||
|
},
|
||||||
|
"type": "commonjs",
|
||||||
|
"keywords": [
|
||||||
|
"color",
|
||||||
|
"colour",
|
||||||
|
"cjs",
|
||||||
|
"commonjs"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"build": "esbuild node_modules/color/index.js --bundle --platform=node --outfile=color.cjs",
|
||||||
|
"test": "node --test"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"color": "5.0.0",
|
||||||
|
"color-convert": "3.1.0",
|
||||||
|
"color-name": "2.0.0",
|
||||||
|
"color-string": "2.1.0",
|
||||||
|
"esbuild": "^0.25.9"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,191 @@
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction, and
|
||||||
|
distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
||||||
|
owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all other entities
|
||||||
|
that control, are controlled by, or are under common control with that entity.
|
||||||
|
For the purposes of this definition, "control" means (i) the power, direct or
|
||||||
|
indirect, to cause the direction or management of such entity, whether by
|
||||||
|
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
||||||
|
permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications, including
|
||||||
|
but not limited to software source code, documentation source, and configuration
|
||||||
|
files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical transformation or
|
||||||
|
translation of a Source form, including but not limited to compiled object code,
|
||||||
|
generated documentation, and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
||||||
|
available under the License, as indicated by a copyright notice that is included
|
||||||
|
in or attached to the work (an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
||||||
|
is based on (or derived from) the Work and for which the editorial revisions,
|
||||||
|
annotations, elaborations, or other modifications represent, as a whole, an
|
||||||
|
original work of authorship. For the purposes of this License, Derivative Works
|
||||||
|
shall not include works that remain separable from, or merely link (or bind by
|
||||||
|
name) to the interfaces of, the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including the original version
|
||||||
|
of the Work and any modifications or additions to that Work or Derivative Works
|
||||||
|
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
||||||
|
by the copyright owner or by an individual or Legal Entity authorized to submit
|
||||||
|
on behalf of the copyright owner. For the purposes of this definition,
|
||||||
|
"submitted" means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems, and
|
||||||
|
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
||||||
|
the purpose of discussing and improving the Work, but excluding communication
|
||||||
|
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||||
|
owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
||||||
|
of whom a Contribution has been received by Licensor and subsequently
|
||||||
|
incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License.
|
||||||
|
|
||||||
|
Subject to the terms and conditions of this License, each Contributor hereby
|
||||||
|
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||||
|
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the Work and such
|
||||||
|
Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License.
|
||||||
|
|
||||||
|
Subject to the terms and conditions of this License, each Contributor hereby
|
||||||
|
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||||
|
irrevocable (except as stated in this section) patent license to make, have
|
||||||
|
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
||||||
|
such license applies only to those patent claims licensable by such Contributor
|
||||||
|
that are necessarily infringed by their Contribution(s) alone or by combination
|
||||||
|
of their Contribution(s) with the Work to which such Contribution(s) was
|
||||||
|
submitted. If You institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
||||||
|
Contribution incorporated within the Work constitutes direct or contributory
|
||||||
|
patent infringement, then any patent licenses granted to You under this License
|
||||||
|
for that Work shall terminate as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution.
|
||||||
|
|
||||||
|
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
||||||
|
in any medium, with or without modifications, and in Source or Object form,
|
||||||
|
provided that You meet the following conditions:
|
||||||
|
|
||||||
|
You must give any other recipients of the Work or Derivative Works a copy of
|
||||||
|
this License; and
|
||||||
|
You must cause any modified files to carry prominent notices stating that You
|
||||||
|
changed the files; and
|
||||||
|
You must retain, in the Source form of any Derivative Works that You distribute,
|
||||||
|
all copyright, patent, trademark, and attribution notices from the Source form
|
||||||
|
of the Work, excluding those notices that do not pertain to any part of the
|
||||||
|
Derivative Works; and
|
||||||
|
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
||||||
|
Derivative Works that You distribute must include a readable copy of the
|
||||||
|
attribution notices contained within such NOTICE file, excluding those notices
|
||||||
|
that do not pertain to any part of the Derivative Works, in at least one of the
|
||||||
|
following places: within a NOTICE text file distributed as part of the
|
||||||
|
Derivative Works; within the Source form or documentation, if provided along
|
||||||
|
with the Derivative Works; or, within a display generated by the Derivative
|
||||||
|
Works, if and wherever such third-party notices normally appear. The contents of
|
||||||
|
the NOTICE file are for informational purposes only and do not modify the
|
||||||
|
License. You may add Your own attribution notices within Derivative Works that
|
||||||
|
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||||
|
provided that such additional attribution notices cannot be construed as
|
||||||
|
modifying the License.
|
||||||
|
You may add Your own copyright statement to Your modifications and may provide
|
||||||
|
additional or different license terms and conditions for use, reproduction, or
|
||||||
|
distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||||
|
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||||
|
with the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions.
|
||||||
|
|
||||||
|
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
||||||
|
for inclusion in the Work by You to the Licensor shall be under the terms and
|
||||||
|
conditions of this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
||||||
|
any separate license agreement you may have executed with Licensor regarding
|
||||||
|
such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks.
|
||||||
|
|
||||||
|
This License does not grant permission to use the trade names, trademarks,
|
||||||
|
service marks, or product names of the Licensor, except as required for
|
||||||
|
reasonable and customary use in describing the origin of the Work and
|
||||||
|
reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, Licensor provides the
|
||||||
|
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||||
|
including, without limitation, any warranties or conditions of TITLE,
|
||||||
|
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
||||||
|
solely responsible for determining the appropriateness of using or
|
||||||
|
redistributing the Work and assume any risks associated with Your exercise of
|
||||||
|
permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability.
|
||||||
|
|
||||||
|
In no event and under no legal theory, whether in tort (including negligence),
|
||||||
|
contract, or otherwise, unless required by applicable law (such as deliberate
|
||||||
|
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special, incidental,
|
||||||
|
or consequential damages of any character arising as a result of this License or
|
||||||
|
out of the use or inability to use the Work (including but not limited to
|
||||||
|
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
||||||
|
any and all other commercial damages or losses), even if such Contributor has
|
||||||
|
been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability.
|
||||||
|
|
||||||
|
While redistributing the Work or Derivative Works thereof, You may choose to
|
||||||
|
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
||||||
|
other liability obligations and/or rights consistent with this License. However,
|
||||||
|
in accepting such obligations, You may act only on Your own behalf and on Your
|
||||||
|
sole responsibility, not on behalf of any other Contributor, and only if You
|
||||||
|
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason of your
|
||||||
|
accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following boilerplate
|
||||||
|
notice, with the fields enclosed by brackets "[]" replaced with your own
|
||||||
|
identifying information. (Don't include the brackets!) The text should be
|
||||||
|
enclosed in the appropriate comment syntax for the file format. We also
|
||||||
|
recommend that a file or class name and description of purpose be included on
|
||||||
|
the same "printed page" as the copyright notice for easier identification within
|
||||||
|
third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
# `@img/sharp-win32-x64`
|
||||||
|
|
||||||
|
Prebuilt sharp for use with Windows x64.
|
||||||
|
|
||||||
|
## Licensing
|
||||||
|
|
||||||
|
Copyright 2013 Lovell Fuller and others.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
[https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
This software contains third-party libraries
|
||||||
|
used under the terms of the following licences:
|
||||||
|
|
||||||
|
| Library | Used under the terms of |
|
||||||
|
|---------------|-----------------------------------------------------------------------------------------------------------|
|
||||||
|
| aom | BSD 2-Clause + [Alliance for Open Media Patent License 1.0](https://aomedia.org/license/patent-license/) |
|
||||||
|
| cairo | Mozilla Public License 2.0 |
|
||||||
|
| cgif | MIT Licence |
|
||||||
|
| expat | MIT Licence |
|
||||||
|
| fontconfig | [fontconfig Licence](https://gitlab.freedesktop.org/fontconfig/fontconfig/blob/main/COPYING) (BSD-like) |
|
||||||
|
| freetype | [freetype Licence](https://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/FTL.TXT) (BSD-like) |
|
||||||
|
| fribidi | LGPLv3 |
|
||||||
|
| glib | LGPLv3 |
|
||||||
|
| harfbuzz | MIT Licence |
|
||||||
|
| highway | Apache-2.0 License, BSD 3-Clause |
|
||||||
|
| lcms | MIT Licence |
|
||||||
|
| libarchive | BSD 2-Clause |
|
||||||
|
| libexif | LGPLv3 |
|
||||||
|
| libffi | MIT Licence |
|
||||||
|
| libheif | LGPLv3 |
|
||||||
|
| libimagequant | [BSD 2-Clause](https://github.com/lovell/libimagequant/blob/main/COPYRIGHT) |
|
||||||
|
| libnsgif | MIT Licence |
|
||||||
|
| libpng | [libpng License](https://github.com/pnggroup/libpng/blob/master/LICENSE) |
|
||||||
|
| librsvg | LGPLv3 |
|
||||||
|
| libspng | [BSD 2-Clause, libpng License](https://github.com/randy408/libspng/blob/master/LICENSE) |
|
||||||
|
| libtiff | [libtiff License](https://gitlab.com/libtiff/libtiff/blob/master/LICENSE.md) (BSD-like) |
|
||||||
|
| libvips | LGPLv3 |
|
||||||
|
| libwebp | New BSD License |
|
||||||
|
| libxml2 | MIT Licence |
|
||||||
|
| mozjpeg | [zlib License, IJG License, BSD-3-Clause](https://github.com/mozilla/mozjpeg/blob/master/LICENSE.md) |
|
||||||
|
| pango | LGPLv3 |
|
||||||
|
| pixman | MIT Licence |
|
||||||
|
| proxy-libintl | LGPLv3 |
|
||||||
|
| zlib-ng | [zlib Licence](https://github.com/zlib-ng/zlib-ng/blob/develop/LICENSE.md) |
|
||||||
|
|
||||||
|
Use of libraries under the terms of the LGPLv3 is via the
|
||||||
|
"any later version" clause of the LGPLv2 or LGPLv2.1.
|
||||||
|
|
||||||
|
Please report any errors or omissions via
|
||||||
|
https://github.com/lovell/sharp-libvips/issues/new
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
"name": "@img/sharp-win32-x64",
|
||||||
|
"version": "0.34.4",
|
||||||
|
"description": "Prebuilt sharp for use with Windows x64",
|
||||||
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
|
"homepage": "https://sharp.pixelplumbing.com",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/lovell/sharp.git",
|
||||||
|
"directory": "npm/win32-x64"
|
||||||
|
},
|
||||||
|
"license": "Apache-2.0 AND LGPL-3.0-or-later",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://opencollective.com/libvips"
|
||||||
|
},
|
||||||
|
"preferUnplugged": true,
|
||||||
|
"files": [
|
||||||
|
"lib",
|
||||||
|
"versions.json"
|
||||||
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"type": "commonjs",
|
||||||
|
"exports": {
|
||||||
|
"./sharp.node": "./lib/sharp-win32-x64.node",
|
||||||
|
"./package": "./package.json",
|
||||||
|
"./versions": "./versions.json"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"aom": "3.13.1",
|
||||||
|
"archive": "3.8.1",
|
||||||
|
"cairo": "1.18.4",
|
||||||
|
"cgif": "0.5.0",
|
||||||
|
"exif": "0.6.25",
|
||||||
|
"expat": "2.7.1",
|
||||||
|
"ffi": "3.5.2",
|
||||||
|
"fontconfig": "2.17.1",
|
||||||
|
"freetype": "2.14.1",
|
||||||
|
"fribidi": "1.0.16",
|
||||||
|
"glib": "2.86.0",
|
||||||
|
"harfbuzz": "11.5.0",
|
||||||
|
"heif": "1.20.2",
|
||||||
|
"highway": "1.3.0",
|
||||||
|
"imagequant": "2.4.1",
|
||||||
|
"lcms": "2.17",
|
||||||
|
"mozjpeg": "4.1.5",
|
||||||
|
"pango": "1.57.0",
|
||||||
|
"pixman": "0.46.4",
|
||||||
|
"png": "1.6.50",
|
||||||
|
"proxy-libintl": "0.5",
|
||||||
|
"rsvg": "2.61.1",
|
||||||
|
"spng": "0.7.4",
|
||||||
|
"tiff": "4.7.0",
|
||||||
|
"vips": "8.17.2",
|
||||||
|
"webp": "1.6.0",
|
||||||
|
"xml2": "2.14.6",
|
||||||
|
"zlib-ng": "2.2.5"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
Copyright (c) 2015 lsong
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
# @node-escpos/core
|
||||||
|
|
||||||
|
## Sponsors
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src='https://github.com/dohooo/sponsors/blob/master/sponsors.png?raw=true'/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](./LICENSE) License © 2022 [Dohooo](https://github.com/dohooo)
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
|
const EventEmitter = require('eventemitter3');
|
||||||
|
|
||||||
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
||||||
|
|
||||||
|
const EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter);
|
||||||
|
|
||||||
|
class NotImplementedException extends Error {
|
||||||
|
}
|
||||||
|
class Adapter extends EventEmitter__default {
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.Adapter = Adapter;
|
||||||
|
exports.NotImplementedException = NotImplementedException;
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
import EventEmitter from 'eventemitter3';
|
||||||
|
|
||||||
|
declare class NotImplementedException extends Error {
|
||||||
|
}
|
||||||
|
declare abstract class Adapter<CloseArgs extends unknown[]> extends EventEmitter {
|
||||||
|
abstract open(callback?: (error: Error | null) => void): this;
|
||||||
|
abstract write(data: Buffer | string, callback?: (error: Error | null) => void): this;
|
||||||
|
abstract close(callback?: (error: Error | null) => void, ...closeArgs: CloseArgs): this;
|
||||||
|
abstract read(callback?: (data: Buffer) => void): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Adapter, NotImplementedException };
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
import EventEmitter from 'eventemitter3';
|
||||||
|
|
||||||
|
class NotImplementedException extends Error {
|
||||||
|
}
|
||||||
|
class Adapter extends EventEmitter {
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Adapter, NotImplementedException };
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
"name": "@node-escpos/adapter",
|
||||||
|
"type": "module",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"packageManager": "pnpm@7.2.1",
|
||||||
|
"description": "",
|
||||||
|
"author": "Caspian <zhaodonghao586@outlook.com> (https://github.com/dohooo)",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": "https://github.com/sponsors/dohooo",
|
||||||
|
"homepage": "https://github.com/dohooo/[pkg-name]#readme",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/dohooo/[pkg-name].git"
|
||||||
|
},
|
||||||
|
"bugs": "https://github.com/dohooo/[pkg-name]/issues",
|
||||||
|
"keywords": [],
|
||||||
|
"sideEffects": false,
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"require": "./dist/index.cjs",
|
||||||
|
"import": "./dist/index.mjs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"main": "./dist/index.mjs",
|
||||||
|
"module": "./dist/index.mjs",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"typesVersions": {
|
||||||
|
"*": {
|
||||||
|
"*": [
|
||||||
|
"./dist/*",
|
||||||
|
"./dist/index.d.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"eventemitter3": "^4.0.7"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "unbuild",
|
||||||
|
"build:watch": "npx nodemon --exec 'pnpm run build' -w src -e 'ts'",
|
||||||
|
"dev": "unbuild --stub",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"release": "bumpp && npm publish",
|
||||||
|
"start": "esno src/index.ts",
|
||||||
|
"test": "vitest",
|
||||||
|
"typecheck": "tsc --noEmit"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
Copyright (c) 2015 lsong
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
# @node-escpos/core
|
||||||
|
|
||||||
|
## Sponsors
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src='https://github.com/dohooo/sponsors/blob/master/sponsors.png?raw=true'/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](./LICENSE) License © 2022 [Dohooo](https://github.com/dohooo)
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,904 @@
|
||||||
|
import { Adapter } from '@node-escpos/adapter';
|
||||||
|
import EventEmitter from 'eventemitter3';
|
||||||
|
import { MutableBuffer } from 'mutable-buffer';
|
||||||
|
import qr from 'qr-image';
|
||||||
|
import { NdArray } from 'ndarray';
|
||||||
|
|
||||||
|
declare const LF = "\n";
|
||||||
|
declare const FS = "\u001C";
|
||||||
|
declare const FF = "\f";
|
||||||
|
declare const GS = "\u001D";
|
||||||
|
declare const DLE = "\u0010";
|
||||||
|
declare const EOT = "\u0004";
|
||||||
|
declare const NUL = "\0";
|
||||||
|
declare const ESC = "\u001B";
|
||||||
|
declare const TAB = "t";
|
||||||
|
declare const EOL = "\n";
|
||||||
|
/**
|
||||||
|
* [FEED_CONTROL_SEQUENCES Feed control sequences]
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
declare const FEED_CONTROL_SEQUENCES: {
|
||||||
|
CTL_LF: string;
|
||||||
|
CTL_GLF: string;
|
||||||
|
CTL_FF: string;
|
||||||
|
CTL_CR: string;
|
||||||
|
CTL_HT: string;
|
||||||
|
CTL_VT: string;
|
||||||
|
};
|
||||||
|
declare const CHARACTER_SPACING: {
|
||||||
|
CS_DEFAULT: string;
|
||||||
|
CS_SET: string;
|
||||||
|
};
|
||||||
|
declare const LINE_SPACING: {
|
||||||
|
LS_DEFAULT: string;
|
||||||
|
LS_SET: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* [HARDWARE Printer hardware]
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
declare const HARDWARE: {
|
||||||
|
HW_INIT: string;
|
||||||
|
HW_SELECT: string;
|
||||||
|
HW_RESET: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* [CASH_DRAWER Cash Drawer]
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
declare const CASH_DRAWER: {
|
||||||
|
CD_KICK_2: string;
|
||||||
|
CD_KICK_5: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* [MARGINS Margins sizes]
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
declare const MARGINS: {
|
||||||
|
BOTTOM: string;
|
||||||
|
LEFT: string;
|
||||||
|
RIGHT: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* [PAPER Paper]
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
declare const PAPER: {
|
||||||
|
PAPER_FULL_CUT: string;
|
||||||
|
PAPER_PART_CUT: string;
|
||||||
|
PAPER_CUT_A: string;
|
||||||
|
PAPER_CUT_B: string;
|
||||||
|
STAR_FULL_CUT: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* [TEXT_FORMAT Text format]
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
declare const TEXT_FORMAT: {
|
||||||
|
TXT_NORMAL: string;
|
||||||
|
TXT_2HEIGHT: string;
|
||||||
|
TXT_2WIDTH: string;
|
||||||
|
TXT_4SQUARE: string;
|
||||||
|
STAR_TXT_EMPHASIZED: string;
|
||||||
|
STAR_CANCEL_TXT_EMPHASIZED: string;
|
||||||
|
TXT_CUSTOM_SIZE(width: number, height: number): string;
|
||||||
|
TXT_HEIGHT: {
|
||||||
|
1: string;
|
||||||
|
2: string;
|
||||||
|
3: string;
|
||||||
|
4: string;
|
||||||
|
5: string;
|
||||||
|
6: string;
|
||||||
|
7: string;
|
||||||
|
8: string;
|
||||||
|
};
|
||||||
|
TXT_WIDTH: {
|
||||||
|
1: string;
|
||||||
|
2: string;
|
||||||
|
3: string;
|
||||||
|
4: string;
|
||||||
|
5: string;
|
||||||
|
6: string;
|
||||||
|
7: string;
|
||||||
|
8: string;
|
||||||
|
};
|
||||||
|
TXT_UNDERL_OFF: string;
|
||||||
|
TXT_UNDERL_ON: string;
|
||||||
|
TXT_UNDERL2_ON: string;
|
||||||
|
TXT_BOLD_OFF: string;
|
||||||
|
TXT_BOLD_ON: string;
|
||||||
|
TXT_ITALIC_OFF: string;
|
||||||
|
TXT_ITALIC_ON: string;
|
||||||
|
TXT_FONT_A: string;
|
||||||
|
TXT_FONT_B: string;
|
||||||
|
TXT_FONT_C: string;
|
||||||
|
TXT_ALIGN_LT: string;
|
||||||
|
TXT_ALIGN_CT: string;
|
||||||
|
TXT_ALIGN_RT: string;
|
||||||
|
STAR_TXT_ALIGN_LA: string;
|
||||||
|
STAR_TXT_ALIGN_CA: string;
|
||||||
|
STAR_TXT_ALIGN_RA: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Qsprinter-compatible
|
||||||
|
* Added by Attawit Kittikrairit
|
||||||
|
* [MODEL Model-specific commands]
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
declare const MODEL: {
|
||||||
|
QSPRINTER: {
|
||||||
|
BARCODE_MODE: {
|
||||||
|
ON: string;
|
||||||
|
OFF: string;
|
||||||
|
};
|
||||||
|
BARCODE_HEIGHT_DEFAULT: string;
|
||||||
|
CODE2D_FORMAT: {
|
||||||
|
PIXEL_SIZE: {
|
||||||
|
CMD: string;
|
||||||
|
MIN: number;
|
||||||
|
MAX: number;
|
||||||
|
DEFAULT: number;
|
||||||
|
};
|
||||||
|
VERSION: {
|
||||||
|
CMD: string;
|
||||||
|
MIN: number;
|
||||||
|
MAX: number;
|
||||||
|
DEFAULT: number;
|
||||||
|
};
|
||||||
|
LEVEL: {
|
||||||
|
CMD: string;
|
||||||
|
OPTIONS: {
|
||||||
|
L: number;
|
||||||
|
M: number;
|
||||||
|
Q: number;
|
||||||
|
H: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
LEN_OFFSET: number;
|
||||||
|
SAVEBUF: {
|
||||||
|
CMD_P1: string;
|
||||||
|
CMD_P2: string;
|
||||||
|
};
|
||||||
|
PRINTBUF: {
|
||||||
|
CMD_P1: string;
|
||||||
|
CMD_P2: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* [BARCODE_FORMAT Barcode format]
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
declare const BARCODE_FORMAT: {
|
||||||
|
BARCODE_TXT_OFF: string;
|
||||||
|
BARCODE_TXT_ABV: string;
|
||||||
|
BARCODE_TXT_BLW: string;
|
||||||
|
BARCODE_TXT_BTH: string;
|
||||||
|
BARCODE_FONT_A: string;
|
||||||
|
BARCODE_FONT_B: string;
|
||||||
|
BARCODE_HEIGHT(height: number): Buffer;
|
||||||
|
BARCODE_WIDTH: {
|
||||||
|
1: string;
|
||||||
|
2: string;
|
||||||
|
3: string;
|
||||||
|
4: string;
|
||||||
|
5: string;
|
||||||
|
};
|
||||||
|
BARCODE_HEIGHT_DEFAULT: string;
|
||||||
|
BARCODE_WIDTH_DEFAULT: string;
|
||||||
|
BARCODE_UPC_A: string;
|
||||||
|
BARCODE_UPC_E: string;
|
||||||
|
BARCODE_EAN13: string;
|
||||||
|
BARCODE_EAN8: string;
|
||||||
|
BARCODE_CODE39: string;
|
||||||
|
BARCODE_ITF: string;
|
||||||
|
BARCODE_NW7: string;
|
||||||
|
BARCODE_CODE93: string;
|
||||||
|
BARCODE_CODE128: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* [CODE2D_FORMAT description]
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
declare const CODE2D_FORMAT: {
|
||||||
|
TYPE_PDF417: string;
|
||||||
|
TYPE_DATAMATRIX: string;
|
||||||
|
TYPE_QR: string;
|
||||||
|
CODE2D: string;
|
||||||
|
QR_LEVEL_L: string;
|
||||||
|
QR_LEVEL_M: string;
|
||||||
|
QR_LEVEL_Q: string;
|
||||||
|
QR_LEVEL_H: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* [IMAGE_FORMAT Image format]
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
declare const IMAGE_FORMAT: {
|
||||||
|
S_RASTER_N: string;
|
||||||
|
S_RASTER_2W: string;
|
||||||
|
S_RASTER_2H: string;
|
||||||
|
S_RASTER_Q: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* [BITMAP_FORMAT description]
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
declare const BITMAP_FORMAT: {
|
||||||
|
BITMAP_S8: string;
|
||||||
|
BITMAP_D8: string;
|
||||||
|
BITMAP_S24: string;
|
||||||
|
BITMAP_D24: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* [GSV0_FORMAT description]
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
declare const GSV0_FORMAT: {
|
||||||
|
GSV0_NORMAL: string;
|
||||||
|
GSV0_DW: string;
|
||||||
|
GSV0_DH: string;
|
||||||
|
GSV0_DWDH: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* [BEEP description]
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
declare const BEEP = "\u001BB";
|
||||||
|
/**
|
||||||
|
* [COLOR description]
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
declare const COLOR: {
|
||||||
|
0: string;
|
||||||
|
1: string;
|
||||||
|
REVERSE: string;
|
||||||
|
UNREVERSE: string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Receipt Enhancements as defining a static bottom or top logo
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
declare const RECEIPT_ENHANCEMENT = "\u001C(E";
|
||||||
|
/**
|
||||||
|
* List of available character sets
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
declare const CHARACTER_SET: {
|
||||||
|
TM_T20: {
|
||||||
|
US: number;
|
||||||
|
FR: number;
|
||||||
|
DE: number;
|
||||||
|
EN: number;
|
||||||
|
DK: number;
|
||||||
|
SE: number;
|
||||||
|
IT: number;
|
||||||
|
ES: number;
|
||||||
|
JP: number;
|
||||||
|
NO: number;
|
||||||
|
DK_2: number;
|
||||||
|
ES_2: number;
|
||||||
|
LATIN_A: number;
|
||||||
|
KR: number;
|
||||||
|
SI: number;
|
||||||
|
HR: number;
|
||||||
|
CN: number;
|
||||||
|
VN: number;
|
||||||
|
ARABIA: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Character Code Table
|
||||||
|
*/
|
||||||
|
declare const CHARACTER_CODE_TABLE: {
|
||||||
|
TM_T20: {
|
||||||
|
PC437: number;
|
||||||
|
KATAKANA: number;
|
||||||
|
PC850: number;
|
||||||
|
PC860: number;
|
||||||
|
PC863: number;
|
||||||
|
PC865: number;
|
||||||
|
PC851: number;
|
||||||
|
PC853: number;
|
||||||
|
PC857: number;
|
||||||
|
PC737: number;
|
||||||
|
ISO8859_7: number;
|
||||||
|
WPC1252: number;
|
||||||
|
PC866: number;
|
||||||
|
PC852: number;
|
||||||
|
PC858: number;
|
||||||
|
KU42: number;
|
||||||
|
TIS11: number;
|
||||||
|
TIS18: number;
|
||||||
|
TCVN_3: number;
|
||||||
|
TCVN_3_2: number;
|
||||||
|
PC720: number;
|
||||||
|
WPC775: number;
|
||||||
|
PC855: number;
|
||||||
|
PC861: number;
|
||||||
|
PC862: number;
|
||||||
|
PC864: number;
|
||||||
|
PC869: number;
|
||||||
|
ISO8859_2: number;
|
||||||
|
ISO8859_15: number;
|
||||||
|
PC1098: number;
|
||||||
|
PC1118: number;
|
||||||
|
PC1119: number;
|
||||||
|
PC1125: number;
|
||||||
|
WPC1250: number;
|
||||||
|
WPC1251: number;
|
||||||
|
WPC1253: number;
|
||||||
|
WPC1254: number;
|
||||||
|
WPC1255: number;
|
||||||
|
WPC1256: number;
|
||||||
|
WPC1257: number;
|
||||||
|
WPC1258: number;
|
||||||
|
KZ_1048: number;
|
||||||
|
USER_PAGE2: number;
|
||||||
|
USER_PAGE1: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
declare const __LF: typeof LF;
|
||||||
|
declare const __FS: typeof FS;
|
||||||
|
declare const __FF: typeof FF;
|
||||||
|
declare const __GS: typeof GS;
|
||||||
|
declare const __DLE: typeof DLE;
|
||||||
|
declare const __EOT: typeof EOT;
|
||||||
|
declare const __NUL: typeof NUL;
|
||||||
|
declare const __ESC: typeof ESC;
|
||||||
|
declare const __TAB: typeof TAB;
|
||||||
|
declare const __EOL: typeof EOL;
|
||||||
|
declare const __FEED_CONTROL_SEQUENCES: typeof FEED_CONTROL_SEQUENCES;
|
||||||
|
declare const __CHARACTER_SPACING: typeof CHARACTER_SPACING;
|
||||||
|
declare const __LINE_SPACING: typeof LINE_SPACING;
|
||||||
|
declare const __HARDWARE: typeof HARDWARE;
|
||||||
|
declare const __CASH_DRAWER: typeof CASH_DRAWER;
|
||||||
|
declare const __MARGINS: typeof MARGINS;
|
||||||
|
declare const __PAPER: typeof PAPER;
|
||||||
|
declare const __TEXT_FORMAT: typeof TEXT_FORMAT;
|
||||||
|
declare const __MODEL: typeof MODEL;
|
||||||
|
declare const __BARCODE_FORMAT: typeof BARCODE_FORMAT;
|
||||||
|
declare const __CODE2D_FORMAT: typeof CODE2D_FORMAT;
|
||||||
|
declare const __IMAGE_FORMAT: typeof IMAGE_FORMAT;
|
||||||
|
declare const __BITMAP_FORMAT: typeof BITMAP_FORMAT;
|
||||||
|
declare const __GSV0_FORMAT: typeof GSV0_FORMAT;
|
||||||
|
declare const __BEEP: typeof BEEP;
|
||||||
|
declare const __COLOR: typeof COLOR;
|
||||||
|
declare const __RECEIPT_ENHANCEMENT: typeof RECEIPT_ENHANCEMENT;
|
||||||
|
declare const __CHARACTER_SET: typeof CHARACTER_SET;
|
||||||
|
declare const __CHARACTER_CODE_TABLE: typeof CHARACTER_CODE_TABLE;
|
||||||
|
declare namespace _ {
|
||||||
|
export {
|
||||||
|
__LF as LF,
|
||||||
|
__FS as FS,
|
||||||
|
__FF as FF,
|
||||||
|
__GS as GS,
|
||||||
|
__DLE as DLE,
|
||||||
|
__EOT as EOT,
|
||||||
|
__NUL as NUL,
|
||||||
|
__ESC as ESC,
|
||||||
|
__TAB as TAB,
|
||||||
|
__EOL as EOL,
|
||||||
|
__FEED_CONTROL_SEQUENCES as FEED_CONTROL_SEQUENCES,
|
||||||
|
__CHARACTER_SPACING as CHARACTER_SPACING,
|
||||||
|
__LINE_SPACING as LINE_SPACING,
|
||||||
|
__HARDWARE as HARDWARE,
|
||||||
|
__CASH_DRAWER as CASH_DRAWER,
|
||||||
|
__MARGINS as MARGINS,
|
||||||
|
__PAPER as PAPER,
|
||||||
|
__TEXT_FORMAT as TEXT_FORMAT,
|
||||||
|
__MODEL as MODEL,
|
||||||
|
__BARCODE_FORMAT as BARCODE_FORMAT,
|
||||||
|
__CODE2D_FORMAT as CODE2D_FORMAT,
|
||||||
|
__IMAGE_FORMAT as IMAGE_FORMAT,
|
||||||
|
__BITMAP_FORMAT as BITMAP_FORMAT,
|
||||||
|
__GSV0_FORMAT as GSV0_FORMAT,
|
||||||
|
__BEEP as BEEP,
|
||||||
|
__COLOR as COLOR,
|
||||||
|
__RECEIPT_ENHANCEMENT as RECEIPT_ENHANCEMENT,
|
||||||
|
__CHARACTER_SET as CHARACTER_SET,
|
||||||
|
__CHARACTER_CODE_TABLE as CHARACTER_CODE_TABLE,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
declare type ImageMimeType = "image/png" | "image/jpg" | "image/jpeg" | "image/gif" | "image/bmp";
|
||||||
|
/**
|
||||||
|
* [Image description]
|
||||||
|
* @param {[type]} pixels [description]
|
||||||
|
*/
|
||||||
|
declare class Image {
|
||||||
|
private readonly pixels;
|
||||||
|
private readonly data;
|
||||||
|
constructor(pixels: NdArray<Uint8Array>);
|
||||||
|
get size(): {
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
colors: number;
|
||||||
|
};
|
||||||
|
private RGB2Gray;
|
||||||
|
toBitmap(density?: number): {
|
||||||
|
data: number[][];
|
||||||
|
density: number;
|
||||||
|
};
|
||||||
|
toRaster(): {
|
||||||
|
data: number[];
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Load image from URL
|
||||||
|
* @param {[string]} url [description]
|
||||||
|
* @param {[type]} type [description]
|
||||||
|
* @return {[Promise<Image>]} [description]
|
||||||
|
*/
|
||||||
|
static load(url: string | Uint8Array, type?: ImageMimeType | null): Promise<Image>;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare enum Status {
|
||||||
|
Ok = "ok",
|
||||||
|
Warning = "warning",
|
||||||
|
Error = "error"
|
||||||
|
}
|
||||||
|
interface StatusJSONElementSingle {
|
||||||
|
bit: number;
|
||||||
|
value: 0 | 1;
|
||||||
|
label: string;
|
||||||
|
status: Status;
|
||||||
|
}
|
||||||
|
interface StatusJSONElementMultiple {
|
||||||
|
bit: string;
|
||||||
|
value: string;
|
||||||
|
label: string;
|
||||||
|
status: Status;
|
||||||
|
}
|
||||||
|
declare type StatusJSONElement = StatusJSONElementSingle | StatusJSONElementMultiple;
|
||||||
|
interface StatusJSON<T extends string> {
|
||||||
|
className: T;
|
||||||
|
byte: number;
|
||||||
|
bits: string;
|
||||||
|
statuses: StatusJSONElement[];
|
||||||
|
}
|
||||||
|
declare abstract class DeviceStatus {
|
||||||
|
byte: number;
|
||||||
|
bits: (0 | 1)[];
|
||||||
|
bitsAsc: (0 | 1)[];
|
||||||
|
constructor(byte: number);
|
||||||
|
private getBits;
|
||||||
|
protected toBaseJSON<T extends StatusClassName>(name: T): StatusJSON<T>;
|
||||||
|
abstract toJSON(): StatusJSON<string>;
|
||||||
|
}
|
||||||
|
declare class PrinterStatus extends DeviceStatus {
|
||||||
|
static commands(): string[];
|
||||||
|
toJSON(): StatusJSON<"PrinterStatus">;
|
||||||
|
}
|
||||||
|
declare class OfflineCauseStatus extends DeviceStatus {
|
||||||
|
static commands(): string[];
|
||||||
|
toJSON(): StatusJSON<"OfflineCauseStatus">;
|
||||||
|
}
|
||||||
|
declare class ErrorCauseStatus extends DeviceStatus {
|
||||||
|
static commands(): string[];
|
||||||
|
toJSON(): StatusJSON<"ErrorCauseStatus">;
|
||||||
|
}
|
||||||
|
declare class RollPaperSensorStatus extends DeviceStatus {
|
||||||
|
static commands(): string[];
|
||||||
|
toJSON(): StatusJSON<"RollPaperSensorStatus">;
|
||||||
|
}
|
||||||
|
declare const statusClasses: {
|
||||||
|
PrinterStatus: typeof PrinterStatus;
|
||||||
|
OfflineCauseStatus: typeof OfflineCauseStatus;
|
||||||
|
ErrorCauseStatus: typeof ErrorCauseStatus;
|
||||||
|
RollPaperSensorStatus: typeof RollPaperSensorStatus;
|
||||||
|
};
|
||||||
|
declare type Statuses = typeof statusClasses;
|
||||||
|
declare type StatusClassName = keyof Statuses;
|
||||||
|
interface StatusClassConstructor<T extends DeviceStatus> {
|
||||||
|
new (byte: number): T;
|
||||||
|
commands(): string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
declare type AnyCase<T extends string> = Uppercase<T> | Lowercase<T>;
|
||||||
|
|
||||||
|
interface PrinterOptions {
|
||||||
|
encoding?: string | undefined;
|
||||||
|
width?: number | undefined;
|
||||||
|
}
|
||||||
|
declare type PrinterModel = null | "qsprinter" | "xprinter";
|
||||||
|
/**
|
||||||
|
* 'dhdw', 'dwh' and 'dhw' are treated as 'dwdh'
|
||||||
|
*/
|
||||||
|
declare type RasterMode = AnyCase<"normal" | "dw" | "dh" | "dwdh" | "dhdw" | "dwh" | "dhw">;
|
||||||
|
interface QrImageOptions extends qr.Options {
|
||||||
|
mode: RasterMode;
|
||||||
|
}
|
||||||
|
declare type BitmapDensity = AnyCase<"s8" | "d8" | "s24" | "d24">;
|
||||||
|
declare type StyleString = AnyCase<"normal" | `${"b" | ""}${"i" | ""}${"u" | "u2" | ""}`>;
|
||||||
|
declare type FeedControlSequence = AnyCase<"lf" | "glf" | "ff" | "cr" | "ht" | "vt">;
|
||||||
|
declare type Alignment = AnyCase<"lt" | "ct" | "rt">;
|
||||||
|
declare type FontFamily = AnyCase<"a" | "b" | "c">;
|
||||||
|
declare type HardwareCommand = AnyCase<"init" | "select" | "reset">;
|
||||||
|
declare type BarcodeType = AnyCase<"UPC_A" | "UPC-A" | "UPC-E" | "UPC_E" | "EAN13" | "EAN8" | "CODE39" | "ITF" | "NW7" | "CODE93" | "CODE128">;
|
||||||
|
declare type BarcodePosition = AnyCase<"off" | "abv" | "blw" | "bth">;
|
||||||
|
declare type BarcodeFont = AnyCase<"a" | "b">;
|
||||||
|
interface BarcodeOptions {
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
position?: BarcodePosition | undefined;
|
||||||
|
font?: BarcodeFont | undefined;
|
||||||
|
includeParity?: boolean | undefined;
|
||||||
|
}
|
||||||
|
declare type LegacyBarcodeArguments = [
|
||||||
|
width: number,
|
||||||
|
height: number,
|
||||||
|
position?: BarcodePosition | undefined,
|
||||||
|
font?: BarcodeFont | undefined
|
||||||
|
];
|
||||||
|
declare type QRLevel = AnyCase<"l" | "m" | "q" | "h">;
|
||||||
|
declare type TableAlignment = AnyCase<"left" | "center" | "right">;
|
||||||
|
declare type CustomTableItem = {
|
||||||
|
text: string;
|
||||||
|
align?: TableAlignment;
|
||||||
|
style?: StyleString | undefined;
|
||||||
|
} & ({
|
||||||
|
width: number;
|
||||||
|
} | {
|
||||||
|
cols: number;
|
||||||
|
});
|
||||||
|
interface CustomTableOptions {
|
||||||
|
size: [number, number];
|
||||||
|
encoding: string;
|
||||||
|
}
|
||||||
|
declare class Printer<AdapterCloseArgs extends []> extends EventEmitter {
|
||||||
|
adapter: Adapter<AdapterCloseArgs>;
|
||||||
|
buffer: MutableBuffer;
|
||||||
|
protected options: PrinterOptions | undefined;
|
||||||
|
protected encoding: string;
|
||||||
|
protected width: number;
|
||||||
|
protected _model: PrinterModel;
|
||||||
|
/**
|
||||||
|
* [function ESC/POS Printer]
|
||||||
|
* @param {[Adapter]} adapter [eg: usb, network, or serialport]
|
||||||
|
* @param {[PrinterOptions]} options
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
constructor(adapter: Adapter<AdapterCloseArgs>, options: PrinterOptions);
|
||||||
|
/**
|
||||||
|
* Set printer model to recognize model-specific commands.
|
||||||
|
* Supported models: [ null, 'qsprinter' ]
|
||||||
|
*
|
||||||
|
* For generic printers, set model to null
|
||||||
|
*
|
||||||
|
* [function set printer model]
|
||||||
|
* @param {[String]} model [mandatory]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
model(model: PrinterModel): this;
|
||||||
|
/**
|
||||||
|
* Set character code table
|
||||||
|
* @param {[Number]} codeTable
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
setCharacterCodeTable(codeTable: number): this;
|
||||||
|
/**
|
||||||
|
* Set charset
|
||||||
|
* @param {[Number]} charset
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
setCharset(charset?: number): this;
|
||||||
|
/**
|
||||||
|
* Fix bottom margin
|
||||||
|
* @param {[String]} size
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
marginBottom(size: number): this;
|
||||||
|
/**
|
||||||
|
* Fix left margin
|
||||||
|
* @param {[String]} size
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
marginLeft(size: number): this;
|
||||||
|
/**
|
||||||
|
* Set left margin using GS command
|
||||||
|
* @param {[String]} size
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
setMarginLeft(size: number): Printer<AdapterCloseArgs>;
|
||||||
|
/**
|
||||||
|
* Fix right margin
|
||||||
|
* @param {[String]} size
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
marginRight(size: number): this;
|
||||||
|
/**
|
||||||
|
* [function print]
|
||||||
|
* @param {[String]} content [mandatory]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
print(content: string | Buffer): this;
|
||||||
|
/**
|
||||||
|
* [function print pure content with End Of Line]
|
||||||
|
* @param {[String]} content [mandatory]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
println(content: string): this;
|
||||||
|
/**
|
||||||
|
* [function print End Of Line]
|
||||||
|
* @param {[Number]} Amount of new lines
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
newLine(count?: number): this;
|
||||||
|
/**
|
||||||
|
* [function Print encoded alpha-numeric text with End Of Line]
|
||||||
|
* @param {[String]} content [mandatory]
|
||||||
|
* @param {[String]} encoding [optional]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
text(content: string, encoding?: string): this;
|
||||||
|
/**
|
||||||
|
* [function Print draw line End Of Line]
|
||||||
|
* @param {[Buffer|string]} character [optional]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
drawLine(character?: Buffer | string): this;
|
||||||
|
/**
|
||||||
|
* [function Print table with End Of Line]
|
||||||
|
* @param {[data]} data [mandatory]
|
||||||
|
* @param {[String]} encoding [optional]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
table(data: (string | number)[], encoding?: string): this;
|
||||||
|
/**
|
||||||
|
* [function Print custom table with End Of Line]
|
||||||
|
* @param {[data]} data [mandatory]
|
||||||
|
* @param {[String]} options [optional]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
tableCustom(data: CustomTableItem[], options?: CustomTableOptions): this;
|
||||||
|
/**
|
||||||
|
* [function Print encoded alpha-numeric text without End Of Line]
|
||||||
|
* @param {[String]} content [mandatory]
|
||||||
|
* @param {[String]} encoding [optional]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
pureText(content: string, encoding?: string): this;
|
||||||
|
/**
|
||||||
|
* [function encode text]
|
||||||
|
* @param {[String]} encoding [mandatory]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
encode(encoding: string): this;
|
||||||
|
/**
|
||||||
|
* [line feed]
|
||||||
|
* @param {[type]} n Number of lines
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
feed(n?: number): this;
|
||||||
|
/**
|
||||||
|
* [feed control sequences]
|
||||||
|
* @param {[type]} ctrl [description]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
control(ctrl: FeedControlSequence): this;
|
||||||
|
/**
|
||||||
|
* [text align]
|
||||||
|
* @param {[type]} align [description]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
align(align: Alignment): this;
|
||||||
|
/**
|
||||||
|
* [font family]
|
||||||
|
* @param {[type]} family [description]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
font(family: FontFamily): this;
|
||||||
|
/**
|
||||||
|
* [font style]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
_getStyle(string: StyleString): string;
|
||||||
|
_getStyle(bold: boolean, italic: boolean, underline: boolean | 0 | 1 | 2): string;
|
||||||
|
/**
|
||||||
|
* [font style]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
style(string: StyleString): this;
|
||||||
|
style(bold: boolean, italic: boolean, underline: boolean | 0 | 1 | 2): this;
|
||||||
|
/**
|
||||||
|
* [font size]
|
||||||
|
* @param {[String]} width [description]
|
||||||
|
* @param {[String]} height [description]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
size(width: number, height: number): this;
|
||||||
|
/**
|
||||||
|
* [set character spacing]
|
||||||
|
* @param {[type]} n [description]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
spacing(n?: number | null): this;
|
||||||
|
/**
|
||||||
|
* [set line spacing]
|
||||||
|
* @param {[type]} n [description]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
lineSpace(n?: number | null): this;
|
||||||
|
/**
|
||||||
|
* [hardware]
|
||||||
|
* @param {[type]} hw [description]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
hardware(hw: HardwareCommand): this;
|
||||||
|
/**
|
||||||
|
* [barcode]
|
||||||
|
* @param {[type]} code [description]
|
||||||
|
* @param {[type]} type [description]
|
||||||
|
* @param {[type]} options [description]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
barcode(code: number | string, type: BarcodeType, options: BarcodeOptions): this;
|
||||||
|
/**
|
||||||
|
* [print qrcode]
|
||||||
|
* @param {[type]} content [description]
|
||||||
|
* @param {[type]} version [description]
|
||||||
|
* @param {[type]} level [description]
|
||||||
|
* @param {[type]} size [description]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
qrcode(content: string, version?: number | undefined, level?: QRLevel | undefined, size?: number | undefined): this;
|
||||||
|
/**
|
||||||
|
* [print qrcode image]
|
||||||
|
* @param {[type]} text [description]
|
||||||
|
* @param {[type]} options [description]
|
||||||
|
* @return {[Promise]}
|
||||||
|
*/
|
||||||
|
qrimage(text: string, options?: QrImageOptions): Promise<this>;
|
||||||
|
/**
|
||||||
|
* [image description]
|
||||||
|
* @param {[type]} image [description]
|
||||||
|
* @param {[type]} density [description]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
image(image: Image, density?: BitmapDensity): Promise<this>;
|
||||||
|
/**
|
||||||
|
* [raster description]
|
||||||
|
* @param {[type]} image [description]
|
||||||
|
* @param {[type]} mode Raster mode (
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
raster(image: Image, mode?: RasterMode): this;
|
||||||
|
/**
|
||||||
|
* [function Send pulse to kick the cash drawer]
|
||||||
|
* @param {[type]} pin [description]
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
cashdraw(pin?: 2 | 5): this;
|
||||||
|
/**
|
||||||
|
* Printer Buzzer (Beep sound)
|
||||||
|
* @param {[Number]} n Refers to the number of buzzer times
|
||||||
|
* @param {[Number]} t Refers to the buzzer sound length in (t * 100) milliseconds.
|
||||||
|
*/
|
||||||
|
beep(n: number, t: number): this;
|
||||||
|
/**
|
||||||
|
* Send data to hardware and flush buffer
|
||||||
|
* @return {[Promise]}
|
||||||
|
*/
|
||||||
|
flush(): Promise<this>;
|
||||||
|
/**
|
||||||
|
* Cut paper
|
||||||
|
* @param {[boolean]} partial set a full or partial cut. Default: full Partial cut is not implemented in all printers
|
||||||
|
* @param {[number]} feed Number of lines to feed before cutting
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
cut(partial?: boolean, feed?: number): this;
|
||||||
|
/**
|
||||||
|
* [close description]
|
||||||
|
* @param closeArgs Arguments passed to adapter's close function
|
||||||
|
*/
|
||||||
|
close(...closeArgs: AdapterCloseArgs): Promise<this>;
|
||||||
|
/**
|
||||||
|
* [color select between two print color modes, if your printer supports it]
|
||||||
|
* @param {Number} color - 0 for primary color (black) 1 for secondary color (red)
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
color(color: 0 | 1): this;
|
||||||
|
/**
|
||||||
|
* [reverse colors, if your printer supports it]
|
||||||
|
* @param {Boolean} reverse - True for reverse, false otherwise
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
setReverseColors(reverse: boolean): this;
|
||||||
|
/**
|
||||||
|
* [writes a low level command to the printer buffer]
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* 1) raw('1d:77:06:1d:6b:02:32:32:30:30:30:30:32:30:30:30:35:30:35:00:0a')
|
||||||
|
* 2) raw('1d 77 06 1d 6b 02 32 32 30 30 30 30 32 30 30 30 35 30 35 00 0a')
|
||||||
|
* 3) raw(Buffer.from('1d77061d6b0232323030303032303030353035000a','hex'))
|
||||||
|
*
|
||||||
|
* @param data {Buffer|string}
|
||||||
|
* @returns {Printer}
|
||||||
|
*/
|
||||||
|
raw(data: Buffer | string): this;
|
||||||
|
/**
|
||||||
|
* get one specific status from the printer using it's class
|
||||||
|
* @param {string} StatusClass
|
||||||
|
* @return {Promise} promise returning given status
|
||||||
|
*/
|
||||||
|
getStatus<T extends DeviceStatus>(StatusClass: StatusClassConstructor<T>): Promise<T>;
|
||||||
|
/**
|
||||||
|
* get statuses from the printer
|
||||||
|
* @return {Promise}
|
||||||
|
*/
|
||||||
|
getStatuses(): Promise<DeviceStatus[]>;
|
||||||
|
/****************************
|
||||||
|
/* Receipt Enhancements
|
||||||
|
/****************************/
|
||||||
|
/**
|
||||||
|
* Sets the alignment of the top and bottom logo
|
||||||
|
* @param {[Alignment]} align - Align left, center or right
|
||||||
|
*/
|
||||||
|
private setLogoAlignment;
|
||||||
|
/**
|
||||||
|
* [Function 62 & 63] Set top and bottom logo printing
|
||||||
|
* @param {[String]} pL_pH - Hex string to set the function range
|
||||||
|
* @param {[String]} fn - Hex string to set the receipt enhancement function
|
||||||
|
* @param {[Number]} kc1 - NV memory keycode 1 of the logo
|
||||||
|
* @param {[Number]} kc2 - NV memory keycode 2 of the logo
|
||||||
|
* @param {[Alignment]} align - Align left, center or right
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
private setLogoPrinting;
|
||||||
|
/**
|
||||||
|
* [Function 62] Set top logo printing
|
||||||
|
* @param {[Number]} kc1 - NV memory keycode 1 of the logo
|
||||||
|
* @param {[Number]} kc2 - NV memory keycode 2 of the logo
|
||||||
|
* @param {[Alignment]} align - Align left, center or right
|
||||||
|
* @param {[Number]} space - Set number of lines to be removed after top logo printing
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
setTopLogoPrinting(kc1: number, kc2: number, align?: Alignment, space?: number): Printer<AdapterCloseArgs>;
|
||||||
|
/**
|
||||||
|
* [Function 63] Set bottom logo printing
|
||||||
|
* @param {[Number]} kc1 - NV memory keycode 1 of the logo
|
||||||
|
* @param {[Number]} kc2 - NV memory keycode 2 of the logo
|
||||||
|
* @param {[Alignment]} align - Align left, center or right
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
setBottomLogoPrinting(kc1: number, kc2: number, align?: Alignment): Printer<AdapterCloseArgs>;
|
||||||
|
/**
|
||||||
|
* [Function 65] Enable or disable top logo printing
|
||||||
|
* @param {[Boolean]} enable - Enable or disable top logo printing
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
enableTopLogoPrinting(enable?: boolean): Printer<AdapterCloseArgs>;
|
||||||
|
/**
|
||||||
|
* [Function 65] Enable or disable bottom logo printing
|
||||||
|
* @param {[Boolean]} enable - Enable or disable bottom logo printing
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
enableBottomLogoPrinting(enable?: boolean): Printer<AdapterCloseArgs>;
|
||||||
|
/****************************
|
||||||
|
/* STAR printer
|
||||||
|
/****************************/
|
||||||
|
/**
|
||||||
|
* STAR printer - Paper cut instruction
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
starFullCut(): this;
|
||||||
|
/**
|
||||||
|
* STAR printer - Select emphasized printing
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
emphasize(): this;
|
||||||
|
/**
|
||||||
|
* STAR printer - Cancel emphasized printing
|
||||||
|
* @return {[Printer]} printer [the escpos printer instance]
|
||||||
|
*/
|
||||||
|
cancelEmphasize(): this;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const command: typeof _;
|
||||||
|
|
||||||
|
export { Alignment, BarcodeFont, BarcodeOptions, BarcodePosition, BarcodeType, BitmapDensity, CustomTableItem, CustomTableOptions, FeedControlSequence, FontFamily, HardwareCommand, Image, LegacyBarcodeArguments, Printer, PrinterModel, PrinterOptions, QRLevel, QrImageOptions, RasterMode, StyleString, TableAlignment, command, Printer as default };
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,64 @@
|
||||||
|
{
|
||||||
|
"name": "@node-escpos/core",
|
||||||
|
"type": "module",
|
||||||
|
"version": "0.6.0",
|
||||||
|
"packageManager": "pnpm@7.2.1",
|
||||||
|
"description": "",
|
||||||
|
"author": "Caspian <zhaodonghao586@outlook.com> (https://github.com/dohooo)",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": "https://github.com/sponsors/dohooo",
|
||||||
|
"homepage": "https://github.com/node-escpos/driver/tree/main/packages/core",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/node-escpos/driver.git"
|
||||||
|
},
|
||||||
|
"bugs": "https://github.com/node-escpos/driver/issues",
|
||||||
|
"keywords": [],
|
||||||
|
"sideEffects": false,
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"require": "./dist/index.cjs",
|
||||||
|
"import": "./dist/index.mjs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"main": "./dist/index.mjs",
|
||||||
|
"module": "./dist/index.mjs",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"typesVersions": {
|
||||||
|
"*": {
|
||||||
|
"*": [
|
||||||
|
"./dist/*",
|
||||||
|
"./dist/index.d.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"eventemitter3": "^4.0.7",
|
||||||
|
"get-pixels": "*",
|
||||||
|
"iconv-lite": "*",
|
||||||
|
"mutable-buffer": "^2.0.3",
|
||||||
|
"ndarray": "^1.0.19",
|
||||||
|
"qr-image": "*",
|
||||||
|
"@types/qr-image": "^3.2.4",
|
||||||
|
"@types/ndarray": "^1.0.11",
|
||||||
|
"@node-escpos/adapter": "0.0.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/get-pixels": "^3.3.2",
|
||||||
|
"@types/node": "^10.0.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "unbuild",
|
||||||
|
"build:watch": "npx nodemon --exec 'pnpm run build' -w src -e 'ts'",
|
||||||
|
"dev": "unbuild --stub",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"release": "bumpp && npm publish",
|
||||||
|
"start": "esno src/index.ts",
|
||||||
|
"test": "vitest",
|
||||||
|
"typecheck": "tsc --noEmit"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
Copyright (c) 2015 lsong
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
# @node-escpos/core
|
||||||
|
|
||||||
|
## Sponsors
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src='https://github.com/dohooo/sponsors/blob/master/sponsors.png?raw=true'/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](./LICENSE) License © 2022 [Dohooo](https://github.com/dohooo)
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const net = require('net');
|
||||||
|
const adapter = require('@node-escpos/adapter');
|
||||||
|
|
||||||
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
||||||
|
|
||||||
|
const net__default = /*#__PURE__*/_interopDefaultLegacy(net);
|
||||||
|
|
||||||
|
class Network extends adapter.Adapter {
|
||||||
|
constructor(address, port = 9100, timeout = 3e4) {
|
||||||
|
super();
|
||||||
|
this.address = address;
|
||||||
|
this.port = port;
|
||||||
|
this.timeout = timeout;
|
||||||
|
this.device = new net__default.Socket();
|
||||||
|
}
|
||||||
|
open(callback) {
|
||||||
|
const connection_timeout = setTimeout(() => {
|
||||||
|
this.device.destroy();
|
||||||
|
callback && callback(
|
||||||
|
new Error(`printer connection timeout after ${this.timeout}ms`),
|
||||||
|
this.device
|
||||||
|
);
|
||||||
|
}, this.timeout);
|
||||||
|
this.device.on("error", (err) => {
|
||||||
|
callback && callback(err, this.device);
|
||||||
|
}).on("data", (buf) => {
|
||||||
|
console.log("printer say:", buf);
|
||||||
|
}).connect(this.port, this.address, (err) => {
|
||||||
|
clearInterval(connection_timeout);
|
||||||
|
this.emit("connect", this.device);
|
||||||
|
callback && callback(err ?? null, this.device);
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
write(data, callback) {
|
||||||
|
const handler = (error) => {
|
||||||
|
if (callback)
|
||||||
|
callback(error ?? null);
|
||||||
|
};
|
||||||
|
if (typeof data === "string")
|
||||||
|
this.device.write(data, handler);
|
||||||
|
else
|
||||||
|
this.device.write(data, handler);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
read(callback) {
|
||||||
|
this.device.on("data", (buf) => {
|
||||||
|
if (callback)
|
||||||
|
callback(buf);
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
close(callback) {
|
||||||
|
this.device.destroy();
|
||||||
|
this.emit("disconnect", this.device);
|
||||||
|
callback && callback(null, this.device);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Network;
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
import net from 'net';
|
||||||
|
import { Adapter } from '@node-escpos/adapter';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Network Adapter
|
||||||
|
*/
|
||||||
|
declare class Network extends Adapter<[device: net.Socket]> {
|
||||||
|
private readonly address;
|
||||||
|
private readonly port;
|
||||||
|
private readonly timeout;
|
||||||
|
private readonly device;
|
||||||
|
/**
|
||||||
|
* @param {[type]} address
|
||||||
|
* @param {[type]} port
|
||||||
|
*/
|
||||||
|
constructor(address: string, port?: number, timeout?: number);
|
||||||
|
/**
|
||||||
|
* connect to remote device
|
||||||
|
* @praram {[type]} callback
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
open(callback?: (error: Error | null, device: net.Socket) => void): this;
|
||||||
|
/**
|
||||||
|
* write data to printer
|
||||||
|
* @param {[type]} data -- byte data
|
||||||
|
* @param {Function} callback
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
write(data: string | Buffer, callback?: (error: Error | null) => void): this;
|
||||||
|
read(callback?: (data: Buffer) => void): this;
|
||||||
|
/**
|
||||||
|
* [close description]
|
||||||
|
* @param {Function} callback [description]
|
||||||
|
* @return {[type]} [description]
|
||||||
|
*/
|
||||||
|
close(callback?: (error: Error | null, device: net.Socket) => void): this;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Network as default };
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
import net from 'net';
|
||||||
|
import { Adapter } from '@node-escpos/adapter';
|
||||||
|
|
||||||
|
class Network extends Adapter {
|
||||||
|
constructor(address, port = 9100, timeout = 3e4) {
|
||||||
|
super();
|
||||||
|
this.address = address;
|
||||||
|
this.port = port;
|
||||||
|
this.timeout = timeout;
|
||||||
|
this.device = new net.Socket();
|
||||||
|
}
|
||||||
|
open(callback) {
|
||||||
|
const connection_timeout = setTimeout(() => {
|
||||||
|
this.device.destroy();
|
||||||
|
callback && callback(
|
||||||
|
new Error(`printer connection timeout after ${this.timeout}ms`),
|
||||||
|
this.device
|
||||||
|
);
|
||||||
|
}, this.timeout);
|
||||||
|
this.device.on("error", (err) => {
|
||||||
|
callback && callback(err, this.device);
|
||||||
|
}).on("data", (buf) => {
|
||||||
|
console.log("printer say:", buf);
|
||||||
|
}).connect(this.port, this.address, (err) => {
|
||||||
|
clearInterval(connection_timeout);
|
||||||
|
this.emit("connect", this.device);
|
||||||
|
callback && callback(err ?? null, this.device);
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
write(data, callback) {
|
||||||
|
const handler = (error) => {
|
||||||
|
if (callback)
|
||||||
|
callback(error ?? null);
|
||||||
|
};
|
||||||
|
if (typeof data === "string")
|
||||||
|
this.device.write(data, handler);
|
||||||
|
else
|
||||||
|
this.device.write(data, handler);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
read(callback) {
|
||||||
|
this.device.on("data", (buf) => {
|
||||||
|
if (callback)
|
||||||
|
callback(buf);
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
close(callback) {
|
||||||
|
this.device.destroy();
|
||||||
|
this.emit("disconnect", this.device);
|
||||||
|
callback && callback(null, this.device);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Network as default };
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
{
|
||||||
|
"name": "@node-escpos/network-adapter",
|
||||||
|
"type": "module",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"packageManager": "pnpm@7.2.1",
|
||||||
|
"description": "",
|
||||||
|
"author": "Caspian <zhaodonghao586@outlook.com> (https://github.com/dohooo)",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": "https://github.com/sponsors/dohooo",
|
||||||
|
"homepage": "https://github.com/dohooo/[pkg-name]#readme",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/dohooo/[pkg-name].git"
|
||||||
|
},
|
||||||
|
"bugs": "https://github.com/dohooo/[pkg-name]/issues",
|
||||||
|
"keywords": [],
|
||||||
|
"sideEffects": false,
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"require": "./dist/index.cjs",
|
||||||
|
"import": "./dist/index.mjs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"main": "./dist/index.mjs",
|
||||||
|
"module": "./dist/index.mjs",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"typesVersions": {
|
||||||
|
"*": {
|
||||||
|
"*": [
|
||||||
|
"./dist/*",
|
||||||
|
"./dist/index.d.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"eventemitter3": "^4.0.7",
|
||||||
|
"@node-escpos/adapter": "0.0.1"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "unbuild",
|
||||||
|
"build:watch": "npx nodemon --exec 'pnpm run build' -w src -e 'ts'",
|
||||||
|
"dev": "unbuild --stub",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"release": "bumpp && npm publish",
|
||||||
|
"start": "esno src/index.ts",
|
||||||
|
"test": "vitest",
|
||||||
|
"typecheck": "tsc --noEmit"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
# @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.
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"CLI.d.ts","sourceRoot":"","sources":["../../src/CLI.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAI1C,OAAO,EACL,OAAO,EAIR,MAAM,gCAAgC,CAAC;AAmCxC;;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;CAoYzC"}
|
||||||
|
|
@ -0,0 +1,365 @@
|
||||||
|
"use strict";
|
||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2023 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || (function () {
|
||||||
|
var ownKeys = function(o) {
|
||||||
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||||
|
var ar = [];
|
||||||
|
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||||
|
return ar;
|
||||||
|
};
|
||||||
|
return ownKeys(o);
|
||||||
|
};
|
||||||
|
return function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.CLI = void 0;
|
||||||
|
const node_process_1 = require("node:process");
|
||||||
|
const readline = __importStar(require("node:readline"));
|
||||||
|
const browser_data_js_1 = require("./browser-data/browser-data.js");
|
||||||
|
const Cache_js_1 = require("./Cache.js");
|
||||||
|
const detectPlatform_js_1 = require("./detectPlatform.js");
|
||||||
|
const install_js_1 = require("./install.js");
|
||||||
|
const launch_js_1 = require("./launch.js");
|
||||||
|
function isValidBrowser(browser) {
|
||||||
|
return Object.values(browser_data_js_1.Browser).includes(browser);
|
||||||
|
}
|
||||||
|
function isValidPlatform(platform) {
|
||||||
|
return Object.values(browser_data_js_1.BrowserPlatform).includes(platform);
|
||||||
|
}
|
||||||
|
// If moved update release-please config
|
||||||
|
// x-release-please-start-version
|
||||||
|
const packageVersion = '2.10.12';
|
||||||
|
// x-release-please-end
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
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(browser_data_js_1.BrowserPlatform),
|
||||||
|
default: (0, detectPlatform_js_1.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 (format: <browser>@<buildID> <path>).', 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,
|
||||||
|
});
|
||||||
|
}, 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
|
||||||
|
? (0, launch_js_1.computeSystemExecutablePath)({
|
||||||
|
browser: args.browser.name,
|
||||||
|
// TODO: throw an error if not a ChromeReleaseChannel is provided.
|
||||||
|
channel: args.browser.buildId,
|
||||||
|
platform: args.platform,
|
||||||
|
})
|
||||||
|
: (0, launch_js_1.computeExecutablePath)({
|
||||||
|
browser: args.browser.name,
|
||||||
|
buildId: args.browser.buildId,
|
||||||
|
cacheDir: args.path ?? this.#cachePath,
|
||||||
|
platform: args.platform,
|
||||||
|
});
|
||||||
|
(0, launch_js_1.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: node_process_1.stdin, output: node_process_1.stdout });
|
||||||
|
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_js_1.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_js_1.Cache(cacheDir);
|
||||||
|
const browsers = cache.getInstalledBrowsers();
|
||||||
|
for (const browser of browsers) {
|
||||||
|
console.log(`${browser.browser}@${browser.buildId} (${browser.platform}) ${browser.executablePath}`);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.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 (0, browser_data_js_1.resolveBuildId)(args.browser.name, args.platform, args.browser.buildId);
|
||||||
|
await (0, install_js_1.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,
|
||||||
|
});
|
||||||
|
console.log(`${args.browser.name}@${args.browser.buildId} ${(0, launch_js_1.computeExecutablePath)({
|
||||||
|
browser: args.browser.name,
|
||||||
|
buildId: args.browser.buildId,
|
||||||
|
cacheDir: args.path ?? this.#cachePath,
|
||||||
|
platform: args.platform,
|
||||||
|
})}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.CLI = CLI;
|
||||||
|
//# sourceMappingURL=CLI.js.map
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,86 @@
|
||||||
|
/**
|
||||||
|
* @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>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
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
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../src/Cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EACL,OAAO,EACP,KAAK,eAAe,EAGrB,MAAM,gCAAgC,CAAC;AAKxC;;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;CACjC;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,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;IAeP,oBAAoB,IAAI,gBAAgB,EAAE;IA+B1C,qBAAqB,CAAC,OAAO,EAAE,4BAA4B,GAAG,MAAM;CA0BrE"}
|
||||||
|
|
@ -0,0 +1,191 @@
|
||||||
|
"use strict";
|
||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2023 Google Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.Cache = exports.InstalledBrowser = void 0;
|
||||||
|
const node_fs_1 = __importDefault(require("node:fs"));
|
||||||
|
const node_os_1 = __importDefault(require("node:os"));
|
||||||
|
const node_path_1 = __importDefault(require("node:path"));
|
||||||
|
const debug_1 = __importDefault(require("debug"));
|
||||||
|
const browser_data_js_1 = require("./browser-data/browser-data.js");
|
||||||
|
const detectPlatform_js_1 = require("./detectPlatform.js");
|
||||||
|
const debugCache = (0, debug_1.default)('puppeteer:browsers:cache');
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.InstalledBrowser = InstalledBrowser;
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
class Cache {
|
||||||
|
#rootDir;
|
||||||
|
constructor(rootDir) {
|
||||||
|
this.#rootDir = rootDir;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
get rootDir() {
|
||||||
|
return this.#rootDir;
|
||||||
|
}
|
||||||
|
browserRoot(browser) {
|
||||||
|
return node_path_1.default.join(this.#rootDir, browser);
|
||||||
|
}
|
||||||
|
metadataFile(browser) {
|
||||||
|
return node_path_1.default.join(this.browserRoot(browser), '.metadata');
|
||||||
|
}
|
||||||
|
readMetadata(browser) {
|
||||||
|
const metatadaPath = this.metadataFile(browser);
|
||||||
|
if (!node_fs_1.default.existsSync(metatadaPath)) {
|
||||||
|
return { aliases: {} };
|
||||||
|
}
|
||||||
|
// TODO: add type-safe parsing.
|
||||||
|
const data = JSON.parse(node_fs_1.default.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);
|
||||||
|
node_fs_1.default.mkdirSync(node_path_1.default.dirname(metatadaPath), { recursive: true });
|
||||||
|
node_fs_1.default.writeFileSync(metatadaPath, JSON.stringify(metadata, null, 2));
|
||||||
|
}
|
||||||
|
resolveAlias(browser, alias) {
|
||||||
|
const metadata = this.readMetadata(browser);
|
||||||
|
if (alias === 'latest') {
|
||||||
|
return Object.values(metadata.aliases || {})
|
||||||
|
.sort((0, browser_data_js_1.getVersionComparator)(browser))
|
||||||
|
.at(-1);
|
||||||
|
}
|
||||||
|
return metadata.aliases[alias];
|
||||||
|
}
|
||||||
|
installationDir(browser, platform, buildId) {
|
||||||
|
return node_path_1.default.join(this.browserRoot(browser), `${platform}-${buildId}`);
|
||||||
|
}
|
||||||
|
clear() {
|
||||||
|
node_fs_1.default.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];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
node_fs_1.default.rmSync(this.installationDir(browser, platform, buildId), {
|
||||||
|
force: true,
|
||||||
|
recursive: true,
|
||||||
|
maxRetries: 10,
|
||||||
|
retryDelay: 500,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
getInstalledBrowsers() {
|
||||||
|
if (!node_fs_1.default.existsSync(this.#rootDir)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
const types = node_fs_1.default.readdirSync(this.#rootDir);
|
||||||
|
const browsers = types.filter((t) => {
|
||||||
|
return Object.values(browser_data_js_1.Browser).includes(t);
|
||||||
|
});
|
||||||
|
return browsers.flatMap(browser => {
|
||||||
|
const files = node_fs_1.default.readdirSync(this.browserRoot(browser));
|
||||||
|
return files
|
||||||
|
.map(file => {
|
||||||
|
const result = parseFolderPath(node_path_1.default.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 ??= (0, detectPlatform_js_1.detectBrowserPlatform)();
|
||||||
|
if (!options.platform) {
|
||||||
|
throw new Error(`Cannot download a binary for the provided platform: ${node_os_1.default.platform()} (${node_os_1.default.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);
|
||||||
|
return node_path_1.default.join(installationDir, browser_data_js_1.executablePathByBrowser[options.browser](options.platform, options.buildId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.Cache = Cache;
|
||||||
|
function parseFolderPath(folderPath) {
|
||||||
|
const name = node_path_1.default.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
|
||||||
File diff suppressed because one or more lines are too long
70
node_modules/@puppeteer/browsers/lib/cjs/browser-data/browser-data.d.ts
generated
vendored
Normal file
70
node_modules/@puppeteer/browsers/lib/cjs/browser-data/browser-data.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
/**
|
||||||
|
* @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, 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 };
|
||||||
|
/**
|
||||||
|
* @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;
|
||||||
|
/**
|
||||||
|
* @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
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue