First Push
This commit is contained in:
commit
8a635f669d
4
BackendServer/command.php
Normal file
4
BackendServer/command.php
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?php
|
||||||
|
$dbadminusername = "ENTERUSERNAME";
|
||||||
|
$dbadminpassword = "ENTERPASSWORD";
|
||||||
|
?>
|
31
BackendServer/index.php
Normal file
31
BackendServer/index.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
print '<!-- GETTING TRACKERPHP -->';
|
||||||
|
require_once('/var/www/bin/inventorytrackconnector.php');
|
||||||
|
print '<!-- MAKING NEW DB -->';
|
||||||
|
$database_instance = new Database();
|
||||||
|
print '<!-- DONE SETUP -->';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>Inventory Track</title>
|
||||||
|
<meta http-equiv="Content-Type" content="charset=utf-8" >
|
||||||
|
<meta name="description" content="Inventory Tracking Software" >
|
||||||
|
<meta name="author" content="Noah Backus" >
|
||||||
|
<!-- <link href='resume.css' rel='stylesheet' type='text/css' media='screen'/>
|
||||||
|
<link href='print.css' rel='stylesheet' type='text/css' media='print'/>
|
||||||
|
<link rel="icon" type="image/svg+xml" href="favicon.svg"> -->
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body id="resume">
|
||||||
|
<p>
|
||||||
|
<?php print '<!-- RUNNING DB -->'; print $database_instance->test_con()[0]['name']; print '<!-- RUN IS DONE -->';?>
|
||||||
|
</p>
|
||||||
|
<p> should be something above </p>
|
||||||
|
</body>
|
||||||
|
</html>
|
62
BackendServer/inventorytrackconnector.php
Normal file
62
BackendServer/inventorytrackconnector.php
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
// This script functions as the hidden connection to the postgresql db
|
||||||
|
// Clients never directly contact this script, it is only contacted by the inventorytrack index page
|
||||||
|
// The index page will call functions from here to get data, and then return it to clients that requested it
|
||||||
|
// All requests from the index page will need to be authenticated by a session number (except logins, which will then add session keys to then authenticate further requests)
|
||||||
|
|
||||||
|
|
||||||
|
class Database {
|
||||||
|
|
||||||
|
public $db;
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
print '<!-- CONSTRUCTING DATABASE -->';
|
||||||
|
$this->$db = null;
|
||||||
|
$this->connect();
|
||||||
|
print '<!-- DONE CONSTRUCTING DATABASE -->';
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function __destructor() {
|
||||||
|
// if ($this->$db) {
|
||||||
|
// pg_close($this->$db);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Establish connection to the db
|
||||||
|
private function connect() {
|
||||||
|
print '<!-- CONNECTING DATABASE -->';
|
||||||
|
// Get credentials
|
||||||
|
print '<!-- getting creds -->';
|
||||||
|
require('command.php');
|
||||||
|
print '<!-- got creds -->';
|
||||||
|
// Credentials String
|
||||||
|
$creds = "host=localhost port=5432 user=" . $dbadminusername . " password=" . $dbadminpassword . " dbname=inventorytrackdb";
|
||||||
|
|
||||||
|
print '<!-- running connect -->';
|
||||||
|
if (!$this->$db) {
|
||||||
|
//$this->$db = new PDO('pgsql:host=localhost;port=5432;dbname=inventorytrackdb', $dbadminusername, $dbadminpassword);
|
||||||
|
$this->$db = pg_connect($creds);
|
||||||
|
}
|
||||||
|
if (!$this->$db) {
|
||||||
|
echo '<p> NOT ACTUALLY CONNECTED TO DB WTHHH </p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<!-- DONE CONNECTING DATABASE -->';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_con() {
|
||||||
|
print '<!-- TESTING CONNECTION -->';
|
||||||
|
$result = pg_query($this->$db, "SELECT * FROM users_table;");
|
||||||
|
// $result = $this->$db->prepare("SELECT * FROM users_table;");
|
||||||
|
// $result->execute();
|
||||||
|
// $recordset = $result->fetchAll();
|
||||||
|
// $result->closeCursor();
|
||||||
|
print '<!-- DONE TESTING CONNECTION -->';
|
||||||
|
return pg_fetch_all($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
27
index.html
Normal file
27
index.html
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<!--index.html-->
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||||
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
|
||||||
|
<title>Inventory Track</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Inventory Tracker</h1>
|
||||||
|
<h2>Login:</h2>
|
||||||
|
<form id="loginForm">
|
||||||
|
<p>Email:</p>
|
||||||
|
<input type="email" name="email" id="email" value="">
|
||||||
|
<p>Password:</p>
|
||||||
|
<input type="password" name="password" id="password" value="">
|
||||||
|
<input id="submit" type="submit" value="submit">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<p id="response"></p>
|
||||||
|
|
||||||
|
<!-- You can also require other files to run in this process -->
|
||||||
|
<script src="./renderer.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
59
main.js
Normal file
59
main.js
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// main.js
|
||||||
|
|
||||||
|
// Modules to control application life and create native browser window
|
||||||
|
const { app, BrowserWindow, ipcMain } = require('electron')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
const createWindow = () => {
|
||||||
|
// Create the browser window.
|
||||||
|
const mainWindow = new BrowserWindow({
|
||||||
|
width: 800,
|
||||||
|
height: 600,
|
||||||
|
webPreferences: {
|
||||||
|
preload: path.join(__dirname, 'preload.js'),
|
||||||
|
contextIsolation: false,
|
||||||
|
nodeIntegration: true,
|
||||||
|
enableRemoteModule: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// and load the index.html of the app.
|
||||||
|
mainWindow.loadFile('index.html')
|
||||||
|
|
||||||
|
// Open the DevTools.
|
||||||
|
mainWindow.webContents.openDevTools()
|
||||||
|
|
||||||
|
let contents = window.webContents;
|
||||||
|
}
|
||||||
|
|
||||||
|
ipcMain.on('login-request', (event, arg) => {
|
||||||
|
console.log( arg[0] );
|
||||||
|
console.log( arg[1] );
|
||||||
|
event.sender.send('login-reply', "Login was received")
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// This method will be called when Electron has finished
|
||||||
|
// initialization and is ready to create browser windows.
|
||||||
|
// Some APIs can only be used after this event occurs.
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
createWindow()
|
||||||
|
|
||||||
|
app.on('activate', () => {
|
||||||
|
// On macOS it's common to re-create a window in the app when the
|
||||||
|
// dock icon is clicked and there are no other windows open.
|
||||||
|
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// Quit when all windows are closed, except on macOS. There, it's common
|
||||||
|
// for applications and their menu bar to stay active until the user quits
|
||||||
|
// explicitly with Cmd + Q.
|
||||||
|
app.on('window-all-closed', () => {
|
||||||
|
if (process.platform !== 'darwin') app.quit()
|
||||||
|
})
|
||||||
|
|
||||||
|
// In this file you can include the rest of your app's specific main process
|
||||||
|
// code. You can also put them in separate files and require them here.
|
12
node_modules/.bin/electron
generated
vendored
Normal file
12
node_modules/.bin/electron
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../electron/cli.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../electron/cli.js" "$@"
|
||||||
|
fi
|
17
node_modules/.bin/electron.cmd
generated
vendored
Normal file
17
node_modules/.bin/electron.cmd
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
@ECHO off
|
||||||
|
GOTO start
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
||||||
|
:start
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\electron\cli.js" %*
|
28
node_modules/.bin/electron.ps1
generated
vendored
Normal file
28
node_modules/.bin/electron.ps1
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
}
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "$basedir/node$exe" "$basedir/../electron/cli.js" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../electron/cli.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../electron/cli.js" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../electron/cli.js" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
exit $ret
|
12
node_modules/.bin/extract-zip
generated
vendored
Normal file
12
node_modules/.bin/extract-zip
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../extract-zip/cli.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../extract-zip/cli.js" "$@"
|
||||||
|
fi
|
17
node_modules/.bin/extract-zip.cmd
generated
vendored
Normal file
17
node_modules/.bin/extract-zip.cmd
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
@ECHO off
|
||||||
|
GOTO start
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
||||||
|
:start
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\extract-zip\cli.js" %*
|
28
node_modules/.bin/extract-zip.ps1
generated
vendored
Normal file
28
node_modules/.bin/extract-zip.ps1
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
}
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "$basedir/node$exe" "$basedir/../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
|
12
node_modules/.bin/semver
generated
vendored
Normal file
12
node_modules/.bin/semver
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../semver/bin/semver.js" "$@"
|
||||||
|
fi
|
17
node_modules/.bin/semver.cmd
generated
vendored
Normal file
17
node_modules/.bin/semver.cmd
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
@ECHO off
|
||||||
|
GOTO start
|
||||||
|
:find_dp0
|
||||||
|
SET dp0=%~dp0
|
||||||
|
EXIT /b
|
||||||
|
:start
|
||||||
|
SETLOCAL
|
||||||
|
CALL :find_dp0
|
||||||
|
|
||||||
|
IF EXIST "%dp0%\node.exe" (
|
||||||
|
SET "_prog=%dp0%\node.exe"
|
||||||
|
) ELSE (
|
||||||
|
SET "_prog=node"
|
||||||
|
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
)
|
||||||
|
|
||||||
|
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver.js" %*
|
28
node_modules/.bin/semver.ps1
generated
vendored
Normal file
28
node_modules/.bin/semver.ps1
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
}
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "$basedir/node$exe" "$basedir/../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
|
851
node_modules/.package-lock.json
generated
vendored
Normal file
851
node_modules/.package-lock.json
generated
vendored
Normal file
@ -0,0 +1,851 @@
|
|||||||
|
{
|
||||||
|
"name": "invetorytrack",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"node_modules/@electron/get": {
|
||||||
|
"version": "1.14.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@electron/get/-/get-1.14.1.tgz",
|
||||||
|
"integrity": "sha512-BrZYyL/6m0ZXz/lDxy/nlVhQz+WF+iPS6qXolEU8atw7h6v1aYkjwJZ63m+bJMBTxDE66X+r2tPS4a/8C82sZw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.1.1",
|
||||||
|
"env-paths": "^2.2.0",
|
||||||
|
"fs-extra": "^8.1.0",
|
||||||
|
"got": "^9.6.0",
|
||||||
|
"progress": "^2.0.3",
|
||||||
|
"semver": "^6.2.0",
|
||||||
|
"sumchecker": "^3.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.6"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"global-agent": "^3.0.0",
|
||||||
|
"global-tunnel-ng": "^2.7.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@sindresorhus/is": {
|
||||||
|
"version": "0.14.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
|
||||||
|
"integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@szmarczak/http-timer": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"defer-to-connect": "^1.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "16.11.56",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.56.tgz",
|
||||||
|
"integrity": "sha512-aFcUkv7EddxxOa/9f74DINReQ/celqH8DiB3fRYgVDM2Xm5QJL8sl80QKuAnGvwAsMn+H3IFA6WCrQh1CY7m1A==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/@types/yauzl": {
|
||||||
|
"version": "2.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz",
|
||||||
|
"integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/boolean": {
|
||||||
|
"version": "3.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz",
|
||||||
|
"integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"node_modules/buffer-crc32": {
|
||||||
|
"version": "0.2.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
|
||||||
|
"integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/cacheable-request": {
|
||||||
|
"version": "6.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz",
|
||||||
|
"integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"clone-response": "^1.0.2",
|
||||||
|
"get-stream": "^5.1.0",
|
||||||
|
"http-cache-semantics": "^4.0.0",
|
||||||
|
"keyv": "^3.0.0",
|
||||||
|
"lowercase-keys": "^2.0.0",
|
||||||
|
"normalize-url": "^4.1.0",
|
||||||
|
"responselike": "^1.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/cacheable-request/node_modules/lowercase-keys": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/clone-response": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"mimic-response": "^1.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/config-chain": {
|
||||||
|
"version": "1.1.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz",
|
||||||
|
"integrity": "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"ini": "^1.3.4",
|
||||||
|
"proto-list": "~1.2.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/debug": {
|
||||||
|
"version": "4.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||||
|
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"ms": "2.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"supports-color": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/decompress-response": {
|
||||||
|
"version": "3.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz",
|
||||||
|
"integrity": "sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"mimic-response": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/defer-to-connect": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz",
|
||||||
|
"integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/define-properties": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz",
|
||||||
|
"integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"has-property-descriptors": "^1.0.0",
|
||||||
|
"object-keys": "^1.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/detect-node": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"node_modules/duplexer3": {
|
||||||
|
"version": "0.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.5.tgz",
|
||||||
|
"integrity": "sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/electron": {
|
||||||
|
"version": "20.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/electron/-/electron-20.1.0.tgz",
|
||||||
|
"integrity": "sha512-gzl6fdZe5g0qmzCC6Ejxa1Oa8eqUSxs4+QLtrM7SyEVp+mEPJAOoDe0xD8ayRQqeXTBxLK1LFrKtc4c98iufsg==",
|
||||||
|
"dev": true,
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@electron/get": "^1.14.1",
|
||||||
|
"@types/node": "^16.11.26",
|
||||||
|
"extract-zip": "^2.0.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"electron": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.17.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/encodeurl": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/end-of-stream": {
|
||||||
|
"version": "1.4.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||||
|
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"once": "^1.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/env-paths": {
|
||||||
|
"version": "2.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz",
|
||||||
|
"integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/es6-error": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"node_modules/escape-string-regexp": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/extract-zip": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.1.1",
|
||||||
|
"get-stream": "^5.1.0",
|
||||||
|
"yauzl": "^2.10.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"extract-zip": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.17.0"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@types/yauzl": "^2.9.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fd-slicer": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"pend": "~1.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fs-extra": {
|
||||||
|
"version": "8.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
||||||
|
"integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"graceful-fs": "^4.2.0",
|
||||||
|
"jsonfile": "^4.0.0",
|
||||||
|
"universalify": "^0.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6 <7 || >=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/function-bind": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"node_modules/get-intrinsic": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"function-bind": "^1.1.1",
|
||||||
|
"has": "^1.0.3",
|
||||||
|
"has-symbols": "^1.0.3"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/get-stream": {
|
||||||
|
"version": "5.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
|
||||||
|
"integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"pump": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/global-agent": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/global-agent/-/global-agent-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"boolean": "^3.0.1",
|
||||||
|
"es6-error": "^4.1.1",
|
||||||
|
"matcher": "^3.0.0",
|
||||||
|
"roarr": "^2.15.3",
|
||||||
|
"semver": "^7.3.2",
|
||||||
|
"serialize-error": "^7.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/global-agent/node_modules/semver": {
|
||||||
|
"version": "7.3.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
|
||||||
|
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"lru-cache": "^6.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"semver": "bin/semver.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/global-tunnel-ng": {
|
||||||
|
"version": "2.7.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/global-tunnel-ng/-/global-tunnel-ng-2.7.1.tgz",
|
||||||
|
"integrity": "sha512-4s+DyciWBV0eK148wqXxcmVAbFVPqtc3sEtUE/GTQfuU80rySLcMhUmHKSHI7/LDj8q0gDYI1lIhRRB7ieRAqg==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"encodeurl": "^1.0.2",
|
||||||
|
"lodash": "^4.17.10",
|
||||||
|
"npm-conf": "^1.1.3",
|
||||||
|
"tunnel": "^0.0.6"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/globalthis": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"define-properties": "^1.1.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/got": {
|
||||||
|
"version": "9.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz",
|
||||||
|
"integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@sindresorhus/is": "^0.14.0",
|
||||||
|
"@szmarczak/http-timer": "^1.1.2",
|
||||||
|
"cacheable-request": "^6.0.0",
|
||||||
|
"decompress-response": "^3.3.0",
|
||||||
|
"duplexer3": "^0.1.4",
|
||||||
|
"get-stream": "^4.1.0",
|
||||||
|
"lowercase-keys": "^1.0.1",
|
||||||
|
"mimic-response": "^1.0.1",
|
||||||
|
"p-cancelable": "^1.0.0",
|
||||||
|
"to-readable-stream": "^1.0.0",
|
||||||
|
"url-parse-lax": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/got/node_modules/get-stream": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"pump": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/graceful-fs": {
|
||||||
|
"version": "4.2.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
|
||||||
|
"integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/has": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"function-bind": "^1.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/has-property-descriptors": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"get-intrinsic": "^1.1.1"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/has-symbols": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/http-cache-semantics": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/ini": {
|
||||||
|
"version": "1.3.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
||||||
|
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"node_modules/jquery": {
|
||||||
|
"version": "3.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz",
|
||||||
|
"integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw=="
|
||||||
|
},
|
||||||
|
"node_modules/json-buffer": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-CuUqjv0FUZIdXkHPI8MezCnFCdaTAacej1TZYulLoAg1h/PhwkdXFN4V/gzY4g+fMBCOV2xF+rp7t2XD2ns/NQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/json-stringify-safe": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"node_modules/jsonfile": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==",
|
||||||
|
"dev": true,
|
||||||
|
"optionalDependencies": {
|
||||||
|
"graceful-fs": "^4.1.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/keyv": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"json-buffer": "3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lodash": {
|
||||||
|
"version": "4.17.21",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||||
|
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"node_modules/lowercase-keys": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lru-cache": {
|
||||||
|
"version": "6.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||||
|
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"yallist": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/matcher": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"escape-string-regexp": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mimic-response": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ms": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/normalize-url": {
|
||||||
|
"version": "4.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz",
|
||||||
|
"integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/npm-conf": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/npm-conf/-/npm-conf-1.1.3.tgz",
|
||||||
|
"integrity": "sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"config-chain": "^1.1.11",
|
||||||
|
"pify": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/object-keys": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/once": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||||
|
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"wrappy": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/p-cancelable": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pend": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/pify": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/prepend-http": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/progress": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
|
||||||
|
"integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/proto-list": {
|
||||||
|
"version": "1.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz",
|
||||||
|
"integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"node_modules/pump": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"end-of-stream": "^1.1.0",
|
||||||
|
"once": "^1.3.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/responselike": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-/Fpe5guzJk1gPqdJLJR5u7eG/gNY4nImjbRDaVWVMRhne55TCmj2i9Q+54PBRfatRC8v/rIiv9BN0pMd9OV5EQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"lowercase-keys": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/roarr": {
|
||||||
|
"version": "2.15.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz",
|
||||||
|
"integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"boolean": "^3.0.1",
|
||||||
|
"detect-node": "^2.0.4",
|
||||||
|
"globalthis": "^1.0.1",
|
||||||
|
"json-stringify-safe": "^5.0.1",
|
||||||
|
"semver-compare": "^1.0.0",
|
||||||
|
"sprintf-js": "^1.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/semver": {
|
||||||
|
"version": "6.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||||
|
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"semver": "bin/semver.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/semver-compare": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"node_modules/serialize-error": {
|
||||||
|
"version": "7.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz",
|
||||||
|
"integrity": "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"type-fest": "^0.13.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/sprintf-js": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"node_modules/sumchecker": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/to-readable-stream": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/tunnel": {
|
||||||
|
"version": "0.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
||||||
|
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/type-fest": {
|
||||||
|
"version": "0.13.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",
|
||||||
|
"integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/universalify": {
|
||||||
|
"version": "0.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
|
||||||
|
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/url-parse-lax": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-NjFKA0DidqPa5ciFcSrXnAltTtzz84ogy+NebPvfEgAck0+TNg4UJ4IN+fB7zRZfbgUf0syOo9MDxFkDSMuFaQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"prepend-http": "^2.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/wrappy": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/yallist": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"node_modules/yauzl": {
|
||||||
|
"version": "2.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
||||||
|
"integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"buffer-crc32": "~0.2.3",
|
||||||
|
"fd-slicer": "~1.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
node_modules/@electron/get/LICENSE
generated
vendored
Normal file
21
node_modules/@electron/get/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Contributors to the Electron project
|
||||||
|
|
||||||
|
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.
|
142
node_modules/@electron/get/README.md
generated
vendored
Normal file
142
node_modules/@electron/get/README.md
generated
vendored
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
# @electron/get
|
||||||
|
|
||||||
|
> Download Electron release artifacts
|
||||||
|
|
||||||
|
[![CircleCI](https://circleci.com/gh/electron/get.svg?style=svg)](https://circleci.com/gh/electron/get)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Simple: Downloading an Electron Binary ZIP
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { download } from '@electron/get';
|
||||||
|
|
||||||
|
// NB: Use this syntax within an async function, Node does not have support for
|
||||||
|
// top-level await as of Node 12.
|
||||||
|
const zipFilePath = await download('4.0.4');
|
||||||
|
```
|
||||||
|
|
||||||
|
### Advanced: Downloading a macOS Electron Symbol File
|
||||||
|
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { downloadArtifact } from '@electron/get';
|
||||||
|
|
||||||
|
// NB: Use this syntax within an async function, Node does not have support for
|
||||||
|
// top-level await as of Node 12.
|
||||||
|
const zipFilePath = await downloadArtifact({
|
||||||
|
version: '4.0.4',
|
||||||
|
platform: 'darwin',
|
||||||
|
artifactName: 'electron',
|
||||||
|
artifactSuffix: 'symbols',
|
||||||
|
arch: 'x64',
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Specifying a mirror
|
||||||
|
|
||||||
|
To specify another location to download Electron assets from, the following options are
|
||||||
|
available:
|
||||||
|
|
||||||
|
* `mirrorOptions` Object
|
||||||
|
* `mirror` String (optional) - The base URL of the mirror to download from.
|
||||||
|
* `nightlyMirror` String (optional) - The Electron nightly-specific mirror URL.
|
||||||
|
* `customDir` String (optional) - The name of the directory to download from, often scoped by version number.
|
||||||
|
* `customFilename` String (optional) - The name of the asset to download.
|
||||||
|
* `resolveAssetURL` Function (optional) - A function allowing customization of the url used to download the asset.
|
||||||
|
|
||||||
|
Anatomy of a download URL, in terms of `mirrorOptions`:
|
||||||
|
|
||||||
|
```
|
||||||
|
https://github.com/electron/electron/releases/download/v4.0.4/electron-v4.0.4-linux-x64.zip
|
||||||
|
| | | |
|
||||||
|
------------------------------------------------------- -----------------------------
|
||||||
|
| |
|
||||||
|
mirror / nightlyMirror | | customFilename
|
||||||
|
------
|
||||||
|
||
|
||||||
|
customDir
|
||||||
|
```
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { download } from '@electron/get';
|
||||||
|
|
||||||
|
const zipFilePath = await download('4.0.4', {
|
||||||
|
mirrorOptions: {
|
||||||
|
mirror: 'https://mirror.example.com/electron/',
|
||||||
|
customDir: 'custom',
|
||||||
|
customFilename: 'unofficial-electron-linux.zip'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Will download from https://mirror.example.com/electron/custom/unofficial-electron-linux.zip
|
||||||
|
|
||||||
|
const nightlyZipFilePath = await download('8.0.0-nightly.20190901', {
|
||||||
|
mirrorOptions: {
|
||||||
|
nightlyMirror: 'https://nightly.example.com/',
|
||||||
|
customDir: 'nightlies',
|
||||||
|
customFilename: 'nightly-linux.zip'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Will download from https://nightly.example.com/nightlies/nightly-linux.zip
|
||||||
|
```
|
||||||
|
|
||||||
|
`customDir` can have the placeholder `{{ version }}`, which will be replaced by the version
|
||||||
|
specified (without the leading `v`). For example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const zipFilePath = await download('4.0.4', {
|
||||||
|
mirrorOptions: {
|
||||||
|
mirror: 'https://mirror.example.com/electron/',
|
||||||
|
customDir: 'version-{{ version }}',
|
||||||
|
platform: 'linux',
|
||||||
|
arch: 'x64'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Will download from https://mirror.example.com/electron/version-4.0.4/electron-v4.0.4-linux-x64.zip
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Using environment variables for mirror options
|
||||||
|
Mirror options can also be specified via the following environment variables:
|
||||||
|
* `ELECTRON_CUSTOM_DIR` - Specifies the custom directory to download from.
|
||||||
|
* `ELECTRON_CUSTOM_FILENAME` - Specifies the custom file name to download.
|
||||||
|
* `ELECTRON_MIRROR` - Specifies the URL of the server to download from if the version is not a nightly version.
|
||||||
|
* `ELECTRON_NIGHTLY_MIRROR` - Specifies the URL of the server to download from if the version is a nightly version.
|
||||||
|
|
||||||
|
### Overriding the version downloaded
|
||||||
|
|
||||||
|
The version downloaded can be overriden by setting the `ELECTRON_CUSTOM_VERSION` environment variable.
|
||||||
|
Setting this environment variable will override the version passed in to `download` or `downloadArtifact`.
|
||||||
|
|
||||||
|
## How It Works
|
||||||
|
|
||||||
|
This module downloads Electron to a known place on your system and caches it
|
||||||
|
so that future requests for that asset can be returned instantly. The cache
|
||||||
|
locations are:
|
||||||
|
|
||||||
|
* Linux: `$XDG_CACHE_HOME` or `~/.cache/electron/`
|
||||||
|
* MacOS: `~/Library/Caches/electron/`
|
||||||
|
* Windows: `%LOCALAPPDATA%/electron/Cache` or `~/AppData/Local/electron/Cache/`
|
||||||
|
|
||||||
|
By default, the module uses [`got`](https://github.com/sindresorhus/got) as the
|
||||||
|
downloader. As a result, you can use the same [options](https://github.com/sindresorhus/got#options)
|
||||||
|
via `downloadOptions`.
|
||||||
|
|
||||||
|
### Progress Bar
|
||||||
|
|
||||||
|
By default, a progress bar is shown when downloading an artifact for more than 30 seconds. To
|
||||||
|
disable, set the `ELECTRON_GET_NO_PROGRESS` environment variable to any non-empty value, or set
|
||||||
|
`quiet` to `true` in `downloadOptions`. If you need to monitor progress yourself via the API, set
|
||||||
|
`getProgressCallback` in `downloadOptions`, which has the same function signature as `got`'s
|
||||||
|
[`downloadProgress` event callback](https://github.com/sindresorhus/got#ondownloadprogress-progress).
|
||||||
|
|
||||||
|
### Proxies
|
||||||
|
|
||||||
|
Downstream packages should utilize the `initializeProxy` function to add HTTP(S) proxy support. If
|
||||||
|
the environment variable `ELECTRON_GET_USE_PROXY` is set, it is called automatically. A different
|
||||||
|
proxy module is used, depending on the version of Node in use, and as such, there are slightly
|
||||||
|
different ways to set the proxy environment variables. For Node 10 and above,
|
||||||
|
[`global-agent`](https://github.com/gajus/global-agent#environment-variables) is used. Otherwise,
|
||||||
|
[`global-tunnel-ng`](https://github.com/np-maintain/global-tunnel#auto-config) is used. Refer to the
|
||||||
|
appropriate linked module to determine how to configure proxy support.
|
8
node_modules/@electron/get/dist/cjs/Cache.d.ts
generated
vendored
Normal file
8
node_modules/@electron/get/dist/cjs/Cache.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export declare class Cache {
|
||||||
|
private cacheRoot;
|
||||||
|
constructor(cacheRoot?: string);
|
||||||
|
static getCacheDirectory(downloadUrl: string): string;
|
||||||
|
getCachePath(downloadUrl: string, fileName: string): string;
|
||||||
|
getPathForFileInCache(url: string, fileName: string): Promise<string | null>;
|
||||||
|
putFileInCache(url: string, currentPath: string, fileName: string): Promise<string>;
|
||||||
|
}
|
60
node_modules/@electron/get/dist/cjs/Cache.js
generated
vendored
Normal file
60
node_modules/@electron/get/dist/cjs/Cache.js
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
"use strict";
|
||||||
|
var __rest = (this && this.__rest) || function (s, e) {
|
||||||
|
var t = {};
|
||||||
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||||
|
t[p] = s[p];
|
||||||
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||||
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||||
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||||
|
t[p[i]] = s[p[i]];
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const debug_1 = require("debug");
|
||||||
|
const env_paths_1 = require("env-paths");
|
||||||
|
const fs = require("fs-extra");
|
||||||
|
const path = require("path");
|
||||||
|
const url = require("url");
|
||||||
|
const crypto = require("crypto");
|
||||||
|
const d = debug_1.default('@electron/get:cache');
|
||||||
|
const defaultCacheRoot = env_paths_1.default('electron', {
|
||||||
|
suffix: '',
|
||||||
|
}).cache;
|
||||||
|
class Cache {
|
||||||
|
constructor(cacheRoot = defaultCacheRoot) {
|
||||||
|
this.cacheRoot = cacheRoot;
|
||||||
|
}
|
||||||
|
static getCacheDirectory(downloadUrl) {
|
||||||
|
const parsedDownloadUrl = url.parse(downloadUrl);
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
const { search, hash, pathname } = parsedDownloadUrl, rest = __rest(parsedDownloadUrl, ["search", "hash", "pathname"]);
|
||||||
|
const strippedUrl = url.format(Object.assign(Object.assign({}, rest), { pathname: path.dirname(pathname || 'electron') }));
|
||||||
|
return crypto
|
||||||
|
.createHash('sha256')
|
||||||
|
.update(strippedUrl)
|
||||||
|
.digest('hex');
|
||||||
|
}
|
||||||
|
getCachePath(downloadUrl, fileName) {
|
||||||
|
return path.resolve(this.cacheRoot, Cache.getCacheDirectory(downloadUrl), fileName);
|
||||||
|
}
|
||||||
|
async getPathForFileInCache(url, fileName) {
|
||||||
|
const cachePath = this.getCachePath(url, fileName);
|
||||||
|
if (await fs.pathExists(cachePath)) {
|
||||||
|
return cachePath;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
async putFileInCache(url, currentPath, fileName) {
|
||||||
|
const cachePath = this.getCachePath(url, fileName);
|
||||||
|
d(`Moving ${currentPath} to ${cachePath}`);
|
||||||
|
if (await fs.pathExists(cachePath)) {
|
||||||
|
d('* Replacing existing file');
|
||||||
|
await fs.remove(cachePath);
|
||||||
|
}
|
||||||
|
await fs.move(currentPath, cachePath);
|
||||||
|
return cachePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.Cache = Cache;
|
||||||
|
//# sourceMappingURL=Cache.js.map
|
1
node_modules/@electron/get/dist/cjs/Cache.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/cjs/Cache.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../src/Cache.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,iCAA0B;AAC1B,yCAAiC;AACjC,+BAA+B;AAC/B,6BAA6B;AAC7B,2BAA2B;AAC3B,iCAAiC;AAEjC,MAAM,CAAC,GAAG,eAAK,CAAC,qBAAqB,CAAC,CAAC;AAEvC,MAAM,gBAAgB,GAAG,mBAAQ,CAAC,UAAU,EAAE;IAC5C,MAAM,EAAE,EAAE;CACX,CAAC,CAAC,KAAK,CAAC;AAET,MAAa,KAAK;IAChB,YAAoB,YAAY,gBAAgB;QAA5B,cAAS,GAAT,SAAS,CAAmB;IAAG,CAAC;IAE7C,MAAM,CAAC,iBAAiB,CAAC,WAAmB;QACjD,MAAM,iBAAiB,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACjD,6DAA6D;QAC7D,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,KAAc,iBAAiB,EAA7B,gEAA6B,CAAC;QAC9D,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,iCAAM,IAAI,KAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,UAAU,CAAC,IAAG,CAAC;QAE5F,OAAO,MAAM;aACV,UAAU,CAAC,QAAQ,CAAC;aACpB,MAAM,CAAC,WAAW,CAAC;aACnB,MAAM,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAEM,YAAY,CAAC,WAAmB,EAAE,QAAgB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,CAAC;IACtF,CAAC;IAEM,KAAK,CAAC,qBAAqB,CAAC,GAAW,EAAE,QAAgB;QAC9D,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACnD,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YAClC,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,GAAW,EAAE,WAAmB,EAAE,QAAgB;QAC5E,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACnD,CAAC,CAAC,UAAU,WAAW,OAAO,SAAS,EAAE,CAAC,CAAC;QAC3C,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YAClC,CAAC,CAAC,2BAA2B,CAAC,CAAC;YAC/B,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SAC5B;QAED,MAAM,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QAEtC,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAxCD,sBAwCC"}
|
3
node_modules/@electron/get/dist/cjs/Downloader.d.ts
generated
vendored
Normal file
3
node_modules/@electron/get/dist/cjs/Downloader.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export interface Downloader<T> {
|
||||||
|
download(url: string, targetFilePath: string, options: T): Promise<void>;
|
||||||
|
}
|
3
node_modules/@electron/get/dist/cjs/Downloader.js
generated
vendored
Normal file
3
node_modules/@electron/get/dist/cjs/Downloader.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
//# sourceMappingURL=Downloader.js.map
|
1
node_modules/@electron/get/dist/cjs/Downloader.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/cjs/Downloader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Downloader.js","sourceRoot":"","sources":["../../src/Downloader.ts"],"names":[],"mappings":""}
|
19
node_modules/@electron/get/dist/cjs/GotDownloader.d.ts
generated
vendored
Normal file
19
node_modules/@electron/get/dist/cjs/GotDownloader.d.ts
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import * as got from 'got';
|
||||||
|
import { Downloader } from './Downloader';
|
||||||
|
/**
|
||||||
|
* See [`got#options`](https://github.com/sindresorhus/got#options) for possible keys/values.
|
||||||
|
*/
|
||||||
|
export declare type GotDownloaderOptions = got.GotOptions<string | null> & {
|
||||||
|
/**
|
||||||
|
* if defined, triggers every time `got`'s `downloadProgress` event callback is triggered.
|
||||||
|
*/
|
||||||
|
getProgressCallback?: (progress: got.Progress) => Promise<void>;
|
||||||
|
/**
|
||||||
|
* if `true`, disables the console progress bar (setting the `ELECTRON_GET_NO_PROGRESS`
|
||||||
|
* environment variable to a non-empty value also does this).
|
||||||
|
*/
|
||||||
|
quiet?: boolean;
|
||||||
|
};
|
||||||
|
export declare class GotDownloader implements Downloader<GotDownloaderOptions> {
|
||||||
|
download(url: string, targetFilePath: string, options?: GotDownloaderOptions): Promise<void>;
|
||||||
|
}
|
76
node_modules/@electron/get/dist/cjs/GotDownloader.js
generated
vendored
Normal file
76
node_modules/@electron/get/dist/cjs/GotDownloader.js
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
"use strict";
|
||||||
|
var __rest = (this && this.__rest) || function (s, e) {
|
||||||
|
var t = {};
|
||||||
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||||
|
t[p] = s[p];
|
||||||
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||||
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||||
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||||
|
t[p[i]] = s[p[i]];
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const fs = require("fs-extra");
|
||||||
|
const got = require("got");
|
||||||
|
const path = require("path");
|
||||||
|
const ProgressBar = require("progress");
|
||||||
|
const PROGRESS_BAR_DELAY_IN_SECONDS = 30;
|
||||||
|
class GotDownloader {
|
||||||
|
async download(url, targetFilePath, options) {
|
||||||
|
if (!options) {
|
||||||
|
options = {};
|
||||||
|
}
|
||||||
|
const { quiet, getProgressCallback } = options, gotOptions = __rest(options, ["quiet", "getProgressCallback"]);
|
||||||
|
let downloadCompleted = false;
|
||||||
|
let bar;
|
||||||
|
let progressPercent;
|
||||||
|
let timeout = undefined;
|
||||||
|
await fs.mkdirp(path.dirname(targetFilePath));
|
||||||
|
const writeStream = fs.createWriteStream(targetFilePath);
|
||||||
|
if (!quiet || !process.env.ELECTRON_GET_NO_PROGRESS) {
|
||||||
|
const start = new Date();
|
||||||
|
timeout = setTimeout(() => {
|
||||||
|
if (!downloadCompleted) {
|
||||||
|
bar = new ProgressBar(`Downloading ${path.basename(url)}: [:bar] :percent ETA: :eta seconds `, {
|
||||||
|
curr: progressPercent,
|
||||||
|
total: 100,
|
||||||
|
});
|
||||||
|
// https://github.com/visionmedia/node-progress/issues/159
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
bar.start = start;
|
||||||
|
}
|
||||||
|
}, PROGRESS_BAR_DELAY_IN_SECONDS * 1000);
|
||||||
|
}
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
const downloadStream = got.stream(url, gotOptions);
|
||||||
|
downloadStream.on('downloadProgress', async (progress) => {
|
||||||
|
progressPercent = progress.percent;
|
||||||
|
if (bar) {
|
||||||
|
bar.update(progress.percent);
|
||||||
|
}
|
||||||
|
if (getProgressCallback) {
|
||||||
|
await getProgressCallback(progress);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
downloadStream.on('error', error => {
|
||||||
|
if (error.name === 'HTTPError' && error.statusCode === 404) {
|
||||||
|
error.message += ` for ${error.url}`;
|
||||||
|
}
|
||||||
|
if (writeStream.destroy) {
|
||||||
|
writeStream.destroy(error);
|
||||||
|
}
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
writeStream.on('error', error => reject(error));
|
||||||
|
writeStream.on('close', () => resolve());
|
||||||
|
downloadStream.pipe(writeStream);
|
||||||
|
});
|
||||||
|
downloadCompleted = true;
|
||||||
|
if (timeout) {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.GotDownloader = GotDownloader;
|
||||||
|
//# sourceMappingURL=GotDownloader.js.map
|
1
node_modules/@electron/get/dist/cjs/GotDownloader.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/cjs/GotDownloader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"GotDownloader.js","sourceRoot":"","sources":["../../src/GotDownloader.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+BAA+B;AAC/B,2BAA2B;AAC3B,6BAA6B;AAC7B,wCAAwC;AAIxC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAiBzC,MAAa,aAAa;IACxB,KAAK,CAAC,QAAQ,CACZ,GAAW,EACX,cAAsB,EACtB,OAA8B;QAE9B,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,EAAE,CAAC;SACd;QACD,MAAM,EAAE,KAAK,EAAE,mBAAmB,KAAoB,OAAO,EAAzB,8DAAyB,CAAC;QAC9D,IAAI,iBAAiB,GAAG,KAAK,CAAC;QAC9B,IAAI,GAA4B,CAAC;QACjC,IAAI,eAAuB,CAAC;QAC5B,IAAI,OAAO,GAA+B,SAAS,CAAC;QACpD,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;QAC9C,MAAM,WAAW,GAAG,EAAE,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;QAEzD,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE;YACnD,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;YACzB,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;gBACxB,IAAI,CAAC,iBAAiB,EAAE;oBACtB,GAAG,GAAG,IAAI,WAAW,CACnB,eAAe,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,sCAAsC,EACvE;wBACE,IAAI,EAAE,eAAe;wBACrB,KAAK,EAAE,GAAG;qBACX,CACF,CAAC;oBACF,0DAA0D;oBAC1D,8DAA8D;oBAC7D,GAAW,CAAC,KAAK,GAAG,KAAK,CAAC;iBAC5B;YACH,CAAC,EAAE,6BAA6B,GAAG,IAAI,CAAC,CAAC;SAC1C;QACD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACpC,MAAM,cAAc,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;YACnD,cAAc,CAAC,EAAE,CAAC,kBAAkB,EAAE,KAAK,EAAC,QAAQ,EAAC,EAAE;gBACrD,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC;gBACnC,IAAI,GAAG,EAAE;oBACP,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;iBAC9B;gBACD,IAAI,mBAAmB,EAAE;oBACvB,MAAM,mBAAmB,CAAC,QAAQ,CAAC,CAAC;iBACrC;YACH,CAAC,CAAC,CAAC;YACH,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;gBACjC,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE;oBAC1D,KAAK,CAAC,OAAO,IAAI,QAAQ,KAAK,CAAC,GAAG,EAAE,CAAC;iBACtC;gBACD,IAAI,WAAW,CAAC,OAAO,EAAE;oBACvB,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;iBAC5B;gBAED,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;YACH,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAChD,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YAEzC,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,iBAAiB,GAAG,IAAI,CAAC;QACzB,IAAI,OAAO,EAAE;YACX,YAAY,CAAC,OAAO,CAAC,CAAC;SACvB;IACH,CAAC;CACF;AAlED,sCAkEC"}
|
3
node_modules/@electron/get/dist/cjs/artifact-utils.d.ts
generated
vendored
Normal file
3
node_modules/@electron/get/dist/cjs/artifact-utils.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import { ElectronArtifactDetails } from './types';
|
||||||
|
export declare function getArtifactFileName(details: ElectronArtifactDetails): string;
|
||||||
|
export declare function getArtifactRemoteURL(details: ElectronArtifactDetails): Promise<string>;
|
56
node_modules/@electron/get/dist/cjs/artifact-utils.js
generated
vendored
Normal file
56
node_modules/@electron/get/dist/cjs/artifact-utils.js
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const utils_1 = require("./utils");
|
||||||
|
const BASE_URL = 'https://github.com/electron/electron/releases/download/';
|
||||||
|
const NIGHTLY_BASE_URL = 'https://github.com/electron/nightlies/releases/download/';
|
||||||
|
function getArtifactFileName(details) {
|
||||||
|
utils_1.ensureIsTruthyString(details, 'artifactName');
|
||||||
|
if (details.isGeneric) {
|
||||||
|
return details.artifactName;
|
||||||
|
}
|
||||||
|
utils_1.ensureIsTruthyString(details, 'arch');
|
||||||
|
utils_1.ensureIsTruthyString(details, 'platform');
|
||||||
|
utils_1.ensureIsTruthyString(details, 'version');
|
||||||
|
return `${[
|
||||||
|
details.artifactName,
|
||||||
|
details.version,
|
||||||
|
details.platform,
|
||||||
|
details.arch,
|
||||||
|
...(details.artifactSuffix ? [details.artifactSuffix] : []),
|
||||||
|
].join('-')}.zip`;
|
||||||
|
}
|
||||||
|
exports.getArtifactFileName = getArtifactFileName;
|
||||||
|
function mirrorVar(name, options, defaultValue) {
|
||||||
|
// Convert camelCase to camel_case for env var reading
|
||||||
|
const lowerName = name.replace(/([a-z])([A-Z])/g, (_, a, b) => `${a}_${b}`).toLowerCase();
|
||||||
|
return (process.env[`NPM_CONFIG_ELECTRON_${lowerName.toUpperCase()}`] ||
|
||||||
|
process.env[`npm_config_electron_${lowerName}`] ||
|
||||||
|
process.env[`npm_package_config_electron_${lowerName}`] ||
|
||||||
|
process.env[`ELECTRON_${lowerName.toUpperCase()}`] ||
|
||||||
|
options[name] ||
|
||||||
|
defaultValue);
|
||||||
|
}
|
||||||
|
async function getArtifactRemoteURL(details) {
|
||||||
|
const opts = details.mirrorOptions || {};
|
||||||
|
let base = mirrorVar('mirror', opts, BASE_URL);
|
||||||
|
if (details.version.includes('nightly')) {
|
||||||
|
const nightlyDeprecated = mirrorVar('nightly_mirror', opts, '');
|
||||||
|
if (nightlyDeprecated) {
|
||||||
|
base = nightlyDeprecated;
|
||||||
|
console.warn(`nightly_mirror is deprecated, please use nightlyMirror`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
base = mirrorVar('nightlyMirror', opts, NIGHTLY_BASE_URL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const path = mirrorVar('customDir', opts, details.version).replace('{{ version }}', details.version.replace(/^v/, ''));
|
||||||
|
const file = mirrorVar('customFilename', opts, getArtifactFileName(details));
|
||||||
|
// Allow customized download URL resolution.
|
||||||
|
if (opts.resolveAssetURL) {
|
||||||
|
const url = await opts.resolveAssetURL(details);
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
return `${base}${path}/${file}`;
|
||||||
|
}
|
||||||
|
exports.getArtifactRemoteURL = getArtifactRemoteURL;
|
||||||
|
//# sourceMappingURL=artifact-utils.js.map
|
1
node_modules/@electron/get/dist/cjs/artifact-utils.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/cjs/artifact-utils.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"artifact-utils.js","sourceRoot":"","sources":["../../src/artifact-utils.ts"],"names":[],"mappings":"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"}
|
3
node_modules/@electron/get/dist/cjs/downloader-resolver.d.ts
generated
vendored
Normal file
3
node_modules/@electron/get/dist/cjs/downloader-resolver.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import { DownloadOptions } from './types';
|
||||||
|
import { Downloader } from './Downloader';
|
||||||
|
export declare function getDownloaderForSystem(): Promise<Downloader<DownloadOptions>>;
|
12
node_modules/@electron/get/dist/cjs/downloader-resolver.js
generated
vendored
Normal file
12
node_modules/@electron/get/dist/cjs/downloader-resolver.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
async function getDownloaderForSystem() {
|
||||||
|
// TODO: Resolve the downloader or default to GotDownloader
|
||||||
|
// Current thoughts are a dot-file traversal for something like
|
||||||
|
// ".electron.downloader" which would be a text file with the name of the
|
||||||
|
// npm module to import() and use as the downloader
|
||||||
|
const { GotDownloader } = await Promise.resolve().then(() => require('./GotDownloader'));
|
||||||
|
return new GotDownloader();
|
||||||
|
}
|
||||||
|
exports.getDownloaderForSystem = getDownloaderForSystem;
|
||||||
|
//# sourceMappingURL=downloader-resolver.js.map
|
1
node_modules/@electron/get/dist/cjs/downloader-resolver.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/cjs/downloader-resolver.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"downloader-resolver.js","sourceRoot":"","sources":["../../src/downloader-resolver.ts"],"names":[],"mappings":";;AAGO,KAAK,UAAU,sBAAsB;IAC1C,2DAA2D;IAC3D,+DAA+D;IAC/D,yEAAyE;IACzE,mDAAmD;IACnD,MAAM,EAAE,aAAa,EAAE,GAAG,2CAAa,iBAAiB,EAAC,CAAC;IAC1D,OAAO,IAAI,aAAa,EAAE,CAAC;AAC7B,CAAC;AAPD,wDAOC"}
|
18
node_modules/@electron/get/dist/cjs/index.d.ts
generated
vendored
Normal file
18
node_modules/@electron/get/dist/cjs/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { ElectronDownloadRequestOptions, ElectronPlatformArtifactDetailsWithDefaults } from './types';
|
||||||
|
export { getHostArch } from './utils';
|
||||||
|
export { initializeProxy } from './proxy';
|
||||||
|
export * from './types';
|
||||||
|
/**
|
||||||
|
* Downloads an artifact from an Electron release and returns an absolute path
|
||||||
|
* to the downloaded file.
|
||||||
|
*
|
||||||
|
* @param artifactDetails - The information required to download the artifact
|
||||||
|
*/
|
||||||
|
export declare function downloadArtifact(_artifactDetails: ElectronPlatformArtifactDetailsWithDefaults): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Downloads a specific version of Electron and returns an absolute path to a
|
||||||
|
* ZIP file.
|
||||||
|
*
|
||||||
|
* @param version - The version of Electron you want to download
|
||||||
|
*/
|
||||||
|
export declare function download(version: string, options?: ElectronDownloadRequestOptions): Promise<string>;
|
130
node_modules/@electron/get/dist/cjs/index.js
generated
vendored
Normal file
130
node_modules/@electron/get/dist/cjs/index.js
generated
vendored
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const debug_1 = require("debug");
|
||||||
|
const fs = require("fs-extra");
|
||||||
|
const path = require("path");
|
||||||
|
const semver = require("semver");
|
||||||
|
const sumchecker = require("sumchecker");
|
||||||
|
const artifact_utils_1 = require("./artifact-utils");
|
||||||
|
const Cache_1 = require("./Cache");
|
||||||
|
const downloader_resolver_1 = require("./downloader-resolver");
|
||||||
|
const proxy_1 = require("./proxy");
|
||||||
|
const utils_1 = require("./utils");
|
||||||
|
var utils_2 = require("./utils");
|
||||||
|
exports.getHostArch = utils_2.getHostArch;
|
||||||
|
var proxy_2 = require("./proxy");
|
||||||
|
exports.initializeProxy = proxy_2.initializeProxy;
|
||||||
|
const d = debug_1.default('@electron/get:index');
|
||||||
|
if (process.env.ELECTRON_GET_USE_PROXY) {
|
||||||
|
proxy_1.initializeProxy();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Downloads an artifact from an Electron release and returns an absolute path
|
||||||
|
* to the downloaded file.
|
||||||
|
*
|
||||||
|
* @param artifactDetails - The information required to download the artifact
|
||||||
|
*/
|
||||||
|
async function downloadArtifact(_artifactDetails) {
|
||||||
|
const artifactDetails = Object.assign({}, _artifactDetails);
|
||||||
|
if (!_artifactDetails.isGeneric) {
|
||||||
|
const platformArtifactDetails = artifactDetails;
|
||||||
|
if (!platformArtifactDetails.platform) {
|
||||||
|
d('No platform found, defaulting to the host platform');
|
||||||
|
platformArtifactDetails.platform = process.platform;
|
||||||
|
}
|
||||||
|
if (platformArtifactDetails.arch) {
|
||||||
|
platformArtifactDetails.arch = utils_1.getNodeArch(platformArtifactDetails.arch);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
d('No arch found, defaulting to the host arch');
|
||||||
|
platformArtifactDetails.arch = utils_1.getHostArch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
utils_1.ensureIsTruthyString(artifactDetails, 'version');
|
||||||
|
artifactDetails.version = utils_1.normalizeVersion(process.env.ELECTRON_CUSTOM_VERSION || artifactDetails.version);
|
||||||
|
const fileName = artifact_utils_1.getArtifactFileName(artifactDetails);
|
||||||
|
const url = await artifact_utils_1.getArtifactRemoteURL(artifactDetails);
|
||||||
|
const cache = new Cache_1.Cache(artifactDetails.cacheRoot);
|
||||||
|
// Do not check if the file exists in the cache when force === true
|
||||||
|
if (!artifactDetails.force) {
|
||||||
|
d(`Checking the cache (${artifactDetails.cacheRoot}) for ${fileName} (${url})`);
|
||||||
|
const cachedPath = await cache.getPathForFileInCache(url, fileName);
|
||||||
|
if (cachedPath === null) {
|
||||||
|
d('Cache miss');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
d('Cache hit');
|
||||||
|
return cachedPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!artifactDetails.isGeneric &&
|
||||||
|
utils_1.isOfficialLinuxIA32Download(artifactDetails.platform, artifactDetails.arch, artifactDetails.version, artifactDetails.mirrorOptions)) {
|
||||||
|
console.warn('Official Linux/ia32 support is deprecated.');
|
||||||
|
console.warn('For more info: https://electronjs.org/blog/linux-32bit-support');
|
||||||
|
}
|
||||||
|
return await utils_1.withTempDirectoryIn(artifactDetails.tempDirectory, async (tempFolder) => {
|
||||||
|
const tempDownloadPath = path.resolve(tempFolder, artifact_utils_1.getArtifactFileName(artifactDetails));
|
||||||
|
const downloader = artifactDetails.downloader || (await downloader_resolver_1.getDownloaderForSystem());
|
||||||
|
d(`Downloading ${url} to ${tempDownloadPath} with options: ${JSON.stringify(artifactDetails.downloadOptions)}`);
|
||||||
|
await downloader.download(url, tempDownloadPath, artifactDetails.downloadOptions);
|
||||||
|
// Don't try to verify the hash of the hash file itself
|
||||||
|
// and for older versions that don't have a SHASUMS256.txt
|
||||||
|
if (!artifactDetails.artifactName.startsWith('SHASUMS256') &&
|
||||||
|
!artifactDetails.unsafelyDisableChecksums &&
|
||||||
|
semver.gte(artifactDetails.version, '1.3.2')) {
|
||||||
|
await utils_1.withTempDirectory(async (tmpDir) => {
|
||||||
|
let shasumPath;
|
||||||
|
const checksums = artifactDetails.checksums;
|
||||||
|
if (checksums) {
|
||||||
|
shasumPath = path.resolve(tmpDir, 'SHASUMS256.txt');
|
||||||
|
const fileNames = Object.keys(checksums);
|
||||||
|
if (fileNames.length === 0) {
|
||||||
|
throw new Error('Provided "checksums" object is empty, cannot generate a valid SHASUMS256.txt');
|
||||||
|
}
|
||||||
|
const generatedChecksums = fileNames
|
||||||
|
.map(fileName => `${checksums[fileName]} *${fileName}`)
|
||||||
|
.join('\n');
|
||||||
|
await fs.writeFile(shasumPath, generatedChecksums);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
shasumPath = await downloadArtifact({
|
||||||
|
isGeneric: true,
|
||||||
|
version: artifactDetails.version,
|
||||||
|
artifactName: 'SHASUMS256.txt',
|
||||||
|
force: artifactDetails.force,
|
||||||
|
downloadOptions: artifactDetails.downloadOptions,
|
||||||
|
cacheRoot: artifactDetails.cacheRoot,
|
||||||
|
downloader: artifactDetails.downloader,
|
||||||
|
mirrorOptions: artifactDetails.mirrorOptions,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// For versions 1.3.2 - 1.3.4, need to overwrite the `defaultTextEncoding` option:
|
||||||
|
// https://github.com/electron/electron/pull/6676#discussion_r75332120
|
||||||
|
if (semver.satisfies(artifactDetails.version, '1.3.2 - 1.3.4')) {
|
||||||
|
const validatorOptions = {};
|
||||||
|
validatorOptions.defaultTextEncoding = 'binary';
|
||||||
|
const checker = new sumchecker.ChecksumValidator('sha256', shasumPath, validatorOptions);
|
||||||
|
await checker.validate(path.dirname(tempDownloadPath), path.basename(tempDownloadPath));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
await sumchecker('sha256', shasumPath, path.dirname(tempDownloadPath), [
|
||||||
|
path.basename(tempDownloadPath),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return await cache.putFileInCache(url, tempDownloadPath, fileName);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.downloadArtifact = downloadArtifact;
|
||||||
|
/**
|
||||||
|
* Downloads a specific version of Electron and returns an absolute path to a
|
||||||
|
* ZIP file.
|
||||||
|
*
|
||||||
|
* @param version - The version of Electron you want to download
|
||||||
|
*/
|
||||||
|
function download(version, options) {
|
||||||
|
return downloadArtifact(Object.assign(Object.assign({}, options), { version, platform: process.platform, arch: process.arch, artifactName: 'electron' }));
|
||||||
|
}
|
||||||
|
exports.download = download;
|
||||||
|
//# sourceMappingURL=index.js.map
|
1
node_modules/@electron/get/dist/cjs/index.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/cjs/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"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"}
|
4
node_modules/@electron/get/dist/cjs/proxy.d.ts
generated
vendored
Normal file
4
node_modules/@electron/get/dist/cjs/proxy.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* Initializes a third-party proxy module for HTTP(S) requests.
|
||||||
|
*/
|
||||||
|
export declare function initializeProxy(): void;
|
32
node_modules/@electron/get/dist/cjs/proxy.js
generated
vendored
Normal file
32
node_modules/@electron/get/dist/cjs/proxy.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const debug = require("debug");
|
||||||
|
const utils_1 = require("./utils");
|
||||||
|
const d = debug('@electron/get:proxy');
|
||||||
|
/**
|
||||||
|
* Initializes a third-party proxy module for HTTP(S) requests.
|
||||||
|
*/
|
||||||
|
function initializeProxy() {
|
||||||
|
try {
|
||||||
|
// Code originally from https://github.com/yeoman/yo/blob/b2eea87e/lib/cli.js#L19-L28
|
||||||
|
const MAJOR_NODEJS_VERSION = parseInt(process.version.slice(1).split('.')[0], 10);
|
||||||
|
if (MAJOR_NODEJS_VERSION >= 10) {
|
||||||
|
// See: https://github.com/electron/get/pull/214#discussion_r798845713
|
||||||
|
const env = utils_1.getEnv('GLOBAL_AGENT_');
|
||||||
|
utils_1.setEnv('GLOBAL_AGENT_HTTP_PROXY', env('HTTP_PROXY'));
|
||||||
|
utils_1.setEnv('GLOBAL_AGENT_HTTPS_PROXY', env('HTTPS_PROXY'));
|
||||||
|
utils_1.setEnv('GLOBAL_AGENT_NO_PROXY', env('NO_PROXY'));
|
||||||
|
// `global-agent` works with Node.js v10 and above.
|
||||||
|
require('global-agent').bootstrap();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// `global-tunnel-ng` works with Node.js v10 and below.
|
||||||
|
require('global-tunnel-ng').initialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
d('Could not load either proxy modules, built-in proxy support not available:', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.initializeProxy = initializeProxy;
|
||||||
|
//# sourceMappingURL=proxy.js.map
|
1
node_modules/@electron/get/dist/cjs/proxy.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/cjs/proxy.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/proxy.ts"],"names":[],"mappings":";;AAAA,+BAA+B;AAC/B,mCAAyC;AAEzC,MAAM,CAAC,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAEvC;;GAEG;AACH,SAAgB,eAAe;IAC7B,IAAI;QACF,qFAAqF;QACrF,MAAM,oBAAoB,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAElF,IAAI,oBAAoB,IAAI,EAAE,EAAE;YAC9B,sEAAsE;YACtE,MAAM,GAAG,GAAG,cAAM,CAAC,eAAe,CAAC,CAAC;YAEpC,cAAM,CAAC,yBAAyB,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;YACrD,cAAM,CAAC,0BAA0B,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;YACvD,cAAM,CAAC,uBAAuB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;YAEjD,mDAAmD;YACnD,OAAO,CAAC,cAAc,CAAC,CAAC,SAAS,EAAE,CAAC;SACrC;aAAM;YACL,uDAAuD;YACvD,OAAO,CAAC,kBAAkB,CAAC,CAAC,UAAU,EAAE,CAAC;SAC1C;KACF;IAAC,OAAO,CAAC,EAAE;QACV,CAAC,CAAC,4EAA4E,EAAE,CAAC,CAAC,CAAC;KACpF;AACH,CAAC;AAtBD,0CAsBC"}
|
124
node_modules/@electron/get/dist/cjs/types.d.ts
generated
vendored
Normal file
124
node_modules/@electron/get/dist/cjs/types.d.ts
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
import { Downloader } from './Downloader';
|
||||||
|
export declare type DownloadOptions = any;
|
||||||
|
export interface MirrorOptions {
|
||||||
|
/**
|
||||||
|
* DEPRECATED - see nightlyMirror.
|
||||||
|
*/
|
||||||
|
nightly_mirror?: string;
|
||||||
|
/**
|
||||||
|
* The Electron nightly-specific mirror URL.
|
||||||
|
*/
|
||||||
|
nightlyMirror?: string;
|
||||||
|
/**
|
||||||
|
* The base URL of the mirror to download from,
|
||||||
|
* e.g https://github.com/electron/electron/releases/download
|
||||||
|
*/
|
||||||
|
mirror?: string;
|
||||||
|
/**
|
||||||
|
* The name of the directory to download from,
|
||||||
|
* often scoped by version number e.g 'v4.0.4'
|
||||||
|
*/
|
||||||
|
customDir?: string;
|
||||||
|
/**
|
||||||
|
* The name of the asset to download,
|
||||||
|
* e.g 'electron-v4.0.4-linux-x64.zip'
|
||||||
|
*/
|
||||||
|
customFilename?: string;
|
||||||
|
/**
|
||||||
|
* A function allowing customization of the url returned
|
||||||
|
* from getArtifactRemoteURL().
|
||||||
|
*/
|
||||||
|
resolveAssetURL?: (opts: DownloadOptions) => Promise<string>;
|
||||||
|
}
|
||||||
|
export interface ElectronDownloadRequest {
|
||||||
|
/**
|
||||||
|
* The version of Electron associated with the artifact.
|
||||||
|
*/
|
||||||
|
version: string;
|
||||||
|
/**
|
||||||
|
* The type of artifact. For example:
|
||||||
|
* * `electron`
|
||||||
|
* * `ffmpeg`
|
||||||
|
*/
|
||||||
|
artifactName: string;
|
||||||
|
}
|
||||||
|
export interface ElectronDownloadRequestOptions {
|
||||||
|
/**
|
||||||
|
* Whether to download an artifact regardless of whether it's in the cache directory.
|
||||||
|
*
|
||||||
|
* Defaults to `false`.
|
||||||
|
*/
|
||||||
|
force?: boolean;
|
||||||
|
/**
|
||||||
|
* When set to `true`, disables checking that the artifact download completed successfully
|
||||||
|
* with the correct payload.
|
||||||
|
*
|
||||||
|
* Defaults to `false`.
|
||||||
|
*/
|
||||||
|
unsafelyDisableChecksums?: boolean;
|
||||||
|
/**
|
||||||
|
* Provides checksums for the artifact as strings.
|
||||||
|
* Can be used if you already know the checksums of the Electron artifact
|
||||||
|
* you are downloading and want to skip the checksum file download
|
||||||
|
* without skipping the checksum validation.
|
||||||
|
*
|
||||||
|
* This should be an object whose keys are the file names of the artifacts and
|
||||||
|
* the values are their respective SHA256 checksums.
|
||||||
|
*/
|
||||||
|
checksums?: Record<string, string>;
|
||||||
|
/**
|
||||||
|
* The directory that caches Electron artifact downloads.
|
||||||
|
*
|
||||||
|
* The default value is dependent upon the host platform:
|
||||||
|
*
|
||||||
|
* * Linux: `$XDG_CACHE_HOME` or `~/.cache/electron/`
|
||||||
|
* * MacOS: `~/Library/Caches/electron/`
|
||||||
|
* * Windows: `%LOCALAPPDATA%/electron/Cache` or `~/AppData/Local/electron/Cache/`
|
||||||
|
*/
|
||||||
|
cacheRoot?: string;
|
||||||
|
/**
|
||||||
|
* Options passed to the downloader module.
|
||||||
|
*/
|
||||||
|
downloadOptions?: DownloadOptions;
|
||||||
|
/**
|
||||||
|
* Options related to specifying an artifact mirror.
|
||||||
|
*/
|
||||||
|
mirrorOptions?: MirrorOptions;
|
||||||
|
/**
|
||||||
|
* The custom [[Downloader]] class used to download artifacts. Defaults to the
|
||||||
|
* built-in [[GotDownloader]].
|
||||||
|
*/
|
||||||
|
downloader?: Downloader<DownloadOptions>;
|
||||||
|
/**
|
||||||
|
* A temporary directory for downloads.
|
||||||
|
* It is used before artifacts are put into cache.
|
||||||
|
*/
|
||||||
|
tempDirectory?: string;
|
||||||
|
}
|
||||||
|
export declare type ElectronPlatformArtifactDetails = {
|
||||||
|
/**
|
||||||
|
* The target artifact platform. These are Node-style platform names, for example:
|
||||||
|
* * `win32`
|
||||||
|
* * `darwin`
|
||||||
|
* * `linux`
|
||||||
|
*/
|
||||||
|
platform: string;
|
||||||
|
/**
|
||||||
|
* The target artifact architecture. These are Node-style architecture names, for example:
|
||||||
|
* * `ia32`
|
||||||
|
* * `x64`
|
||||||
|
* * `armv7l`
|
||||||
|
*/
|
||||||
|
arch: string;
|
||||||
|
artifactSuffix?: string;
|
||||||
|
isGeneric?: false;
|
||||||
|
} & ElectronDownloadRequest & ElectronDownloadRequestOptions;
|
||||||
|
export declare type ElectronGenericArtifactDetails = {
|
||||||
|
isGeneric: true;
|
||||||
|
} & ElectronDownloadRequest & ElectronDownloadRequestOptions;
|
||||||
|
export declare type ElectronArtifactDetails = ElectronPlatformArtifactDetails | ElectronGenericArtifactDetails;
|
||||||
|
export declare type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
|
||||||
|
export declare type ElectronPlatformArtifactDetailsWithDefaults = (Omit<ElectronPlatformArtifactDetails, 'platform' | 'arch'> & {
|
||||||
|
platform?: string;
|
||||||
|
arch?: string;
|
||||||
|
}) | ElectronGenericArtifactDetails;
|
3
node_modules/@electron/get/dist/cjs/types.js
generated
vendored
Normal file
3
node_modules/@electron/get/dist/cjs/types.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
//# sourceMappingURL=types.js.map
|
1
node_modules/@electron/get/dist/cjs/types.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/cjs/types.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
25
node_modules/@electron/get/dist/cjs/utils.d.ts
generated
vendored
Normal file
25
node_modules/@electron/get/dist/cjs/utils.d.ts
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
export declare function withTempDirectoryIn<T>(parentDirectory: string | undefined, fn: (directory: string) => Promise<T>): Promise<T>;
|
||||||
|
export declare function withTempDirectory<T>(fn: (directory: string) => Promise<T>): Promise<T>;
|
||||||
|
export declare function normalizeVersion(version: string): string;
|
||||||
|
/**
|
||||||
|
* Runs the `uname` command and returns the trimmed output.
|
||||||
|
*/
|
||||||
|
export declare function uname(): string;
|
||||||
|
/**
|
||||||
|
* Generates an architecture name that would be used in an Electron or Node.js
|
||||||
|
* download file name.
|
||||||
|
*/
|
||||||
|
export declare function getNodeArch(arch: string): string;
|
||||||
|
/**
|
||||||
|
* Generates an architecture name that would be used in an Electron or Node.js
|
||||||
|
* download file name, from the `process` module information.
|
||||||
|
*/
|
||||||
|
export declare function getHostArch(): string;
|
||||||
|
export declare function ensureIsTruthyString<T, K extends keyof T>(obj: T, key: K): void;
|
||||||
|
export declare function isOfficialLinuxIA32Download(platform: string, arch: string, version: string, mirrorOptions?: object): boolean;
|
||||||
|
/**
|
||||||
|
* Find the value of a environment variable which may or may not have the
|
||||||
|
* prefix, in a case-insensitive manner.
|
||||||
|
*/
|
||||||
|
export declare function getEnv(prefix?: string): (name: string) => string | undefined;
|
||||||
|
export declare function setEnv(key: string, value: string | undefined): void;
|
107
node_modules/@electron/get/dist/cjs/utils.js
generated
vendored
Normal file
107
node_modules/@electron/get/dist/cjs/utils.js
generated
vendored
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const childProcess = require("child_process");
|
||||||
|
const fs = require("fs-extra");
|
||||||
|
const os = require("os");
|
||||||
|
const path = require("path");
|
||||||
|
async function useAndRemoveDirectory(directory, fn) {
|
||||||
|
let result;
|
||||||
|
try {
|
||||||
|
result = await fn(directory);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
await fs.remove(directory);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
async function withTempDirectoryIn(parentDirectory = os.tmpdir(), fn) {
|
||||||
|
const tempDirectoryPrefix = 'electron-download-';
|
||||||
|
const tempDirectory = await fs.mkdtemp(path.resolve(parentDirectory, tempDirectoryPrefix));
|
||||||
|
return useAndRemoveDirectory(tempDirectory, fn);
|
||||||
|
}
|
||||||
|
exports.withTempDirectoryIn = withTempDirectoryIn;
|
||||||
|
async function withTempDirectory(fn) {
|
||||||
|
return withTempDirectoryIn(undefined, fn);
|
||||||
|
}
|
||||||
|
exports.withTempDirectory = withTempDirectory;
|
||||||
|
function normalizeVersion(version) {
|
||||||
|
if (!version.startsWith('v')) {
|
||||||
|
return `v${version}`;
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
exports.normalizeVersion = normalizeVersion;
|
||||||
|
/**
|
||||||
|
* Runs the `uname` command and returns the trimmed output.
|
||||||
|
*/
|
||||||
|
function uname() {
|
||||||
|
return childProcess
|
||||||
|
.execSync('uname -m')
|
||||||
|
.toString()
|
||||||
|
.trim();
|
||||||
|
}
|
||||||
|
exports.uname = uname;
|
||||||
|
/**
|
||||||
|
* Generates an architecture name that would be used in an Electron or Node.js
|
||||||
|
* download file name.
|
||||||
|
*/
|
||||||
|
function getNodeArch(arch) {
|
||||||
|
if (arch === 'arm') {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
switch (process.config.variables.arm_version) {
|
||||||
|
case '6':
|
||||||
|
return uname();
|
||||||
|
case '7':
|
||||||
|
default:
|
||||||
|
return 'armv7l';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return arch;
|
||||||
|
}
|
||||||
|
exports.getNodeArch = getNodeArch;
|
||||||
|
/**
|
||||||
|
* Generates an architecture name that would be used in an Electron or Node.js
|
||||||
|
* download file name, from the `process` module information.
|
||||||
|
*/
|
||||||
|
function getHostArch() {
|
||||||
|
return getNodeArch(process.arch);
|
||||||
|
}
|
||||||
|
exports.getHostArch = getHostArch;
|
||||||
|
function ensureIsTruthyString(obj, key) {
|
||||||
|
if (!obj[key] || typeof obj[key] !== 'string') {
|
||||||
|
throw new Error(`Expected property "${key}" to be provided as a string but it was not`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ensureIsTruthyString = ensureIsTruthyString;
|
||||||
|
function isOfficialLinuxIA32Download(platform, arch, version, mirrorOptions) {
|
||||||
|
return (platform === 'linux' &&
|
||||||
|
arch === 'ia32' &&
|
||||||
|
Number(version.slice(1).split('.')[0]) >= 4 &&
|
||||||
|
typeof mirrorOptions === 'undefined');
|
||||||
|
}
|
||||||
|
exports.isOfficialLinuxIA32Download = isOfficialLinuxIA32Download;
|
||||||
|
/**
|
||||||
|
* Find the value of a environment variable which may or may not have the
|
||||||
|
* prefix, in a case-insensitive manner.
|
||||||
|
*/
|
||||||
|
function getEnv(prefix = '') {
|
||||||
|
const envsLowerCase = {};
|
||||||
|
for (const envKey in process.env) {
|
||||||
|
envsLowerCase[envKey.toLowerCase()] = process.env[envKey];
|
||||||
|
}
|
||||||
|
return (name) => {
|
||||||
|
return (envsLowerCase[`${prefix}${name}`.toLowerCase()] ||
|
||||||
|
envsLowerCase[name.toLowerCase()] ||
|
||||||
|
undefined);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
exports.getEnv = getEnv;
|
||||||
|
function setEnv(key, value) {
|
||||||
|
// The `void` operator always returns `undefined`.
|
||||||
|
// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void
|
||||||
|
if (value !== void 0) {
|
||||||
|
process.env[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.setEnv = setEnv;
|
||||||
|
//# sourceMappingURL=utils.js.map
|
1
node_modules/@electron/get/dist/cjs/utils.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/cjs/utils.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"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"}
|
8
node_modules/@electron/get/dist/esm/Cache.d.ts
generated
vendored
Normal file
8
node_modules/@electron/get/dist/esm/Cache.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export declare class Cache {
|
||||||
|
private cacheRoot;
|
||||||
|
constructor(cacheRoot?: string);
|
||||||
|
static getCacheDirectory(downloadUrl: string): string;
|
||||||
|
getCachePath(downloadUrl: string, fileName: string): string;
|
||||||
|
getPathForFileInCache(url: string, fileName: string): Promise<string | null>;
|
||||||
|
putFileInCache(url: string, currentPath: string, fileName: string): Promise<string>;
|
||||||
|
}
|
57
node_modules/@electron/get/dist/esm/Cache.js
generated
vendored
Normal file
57
node_modules/@electron/get/dist/esm/Cache.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
var __rest = (this && this.__rest) || function (s, e) {
|
||||||
|
var t = {};
|
||||||
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||||
|
t[p] = s[p];
|
||||||
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||||
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||||
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||||
|
t[p[i]] = s[p[i]];
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
};
|
||||||
|
import debug from 'debug';
|
||||||
|
import envPaths from 'env-paths';
|
||||||
|
import * as fs from 'fs-extra';
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as url from 'url';
|
||||||
|
import * as crypto from 'crypto';
|
||||||
|
const d = debug('@electron/get:cache');
|
||||||
|
const defaultCacheRoot = envPaths('electron', {
|
||||||
|
suffix: '',
|
||||||
|
}).cache;
|
||||||
|
export class Cache {
|
||||||
|
constructor(cacheRoot = defaultCacheRoot) {
|
||||||
|
this.cacheRoot = cacheRoot;
|
||||||
|
}
|
||||||
|
static getCacheDirectory(downloadUrl) {
|
||||||
|
const parsedDownloadUrl = url.parse(downloadUrl);
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
const { search, hash, pathname } = parsedDownloadUrl, rest = __rest(parsedDownloadUrl, ["search", "hash", "pathname"]);
|
||||||
|
const strippedUrl = url.format(Object.assign(Object.assign({}, rest), { pathname: path.dirname(pathname || 'electron') }));
|
||||||
|
return crypto
|
||||||
|
.createHash('sha256')
|
||||||
|
.update(strippedUrl)
|
||||||
|
.digest('hex');
|
||||||
|
}
|
||||||
|
getCachePath(downloadUrl, fileName) {
|
||||||
|
return path.resolve(this.cacheRoot, Cache.getCacheDirectory(downloadUrl), fileName);
|
||||||
|
}
|
||||||
|
async getPathForFileInCache(url, fileName) {
|
||||||
|
const cachePath = this.getCachePath(url, fileName);
|
||||||
|
if (await fs.pathExists(cachePath)) {
|
||||||
|
return cachePath;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
async putFileInCache(url, currentPath, fileName) {
|
||||||
|
const cachePath = this.getCachePath(url, fileName);
|
||||||
|
d(`Moving ${currentPath} to ${cachePath}`);
|
||||||
|
if (await fs.pathExists(cachePath)) {
|
||||||
|
d('* Replacing existing file');
|
||||||
|
await fs.remove(cachePath);
|
||||||
|
}
|
||||||
|
await fs.move(currentPath, cachePath);
|
||||||
|
return cachePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=Cache.js.map
|
1
node_modules/@electron/get/dist/esm/Cache.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/esm/Cache.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../src/Cache.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,MAAM,CAAC,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAEvC,MAAM,gBAAgB,GAAG,QAAQ,CAAC,UAAU,EAAE;IAC5C,MAAM,EAAE,EAAE;CACX,CAAC,CAAC,KAAK,CAAC;AAET,MAAM,OAAO,KAAK;IAChB,YAAoB,YAAY,gBAAgB;QAA5B,cAAS,GAAT,SAAS,CAAmB;IAAG,CAAC;IAE7C,MAAM,CAAC,iBAAiB,CAAC,WAAmB;QACjD,MAAM,iBAAiB,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACjD,6DAA6D;QAC7D,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,KAAc,iBAAiB,EAA7B,gEAA6B,CAAC;QAC9D,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,iCAAM,IAAI,KAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,UAAU,CAAC,IAAG,CAAC;QAE5F,OAAO,MAAM;aACV,UAAU,CAAC,QAAQ,CAAC;aACpB,MAAM,CAAC,WAAW,CAAC;aACnB,MAAM,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAEM,YAAY,CAAC,WAAmB,EAAE,QAAgB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,CAAC;IACtF,CAAC;IAEM,KAAK,CAAC,qBAAqB,CAAC,GAAW,EAAE,QAAgB;QAC9D,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACnD,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YAClC,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,GAAW,EAAE,WAAmB,EAAE,QAAgB;QAC5E,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACnD,CAAC,CAAC,UAAU,WAAW,OAAO,SAAS,EAAE,CAAC,CAAC;QAC3C,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YAClC,CAAC,CAAC,2BAA2B,CAAC,CAAC;YAC/B,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SAC5B;QAED,MAAM,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QAEtC,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
3
node_modules/@electron/get/dist/esm/Downloader.d.ts
generated
vendored
Normal file
3
node_modules/@electron/get/dist/esm/Downloader.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export interface Downloader<T> {
|
||||||
|
download(url: string, targetFilePath: string, options: T): Promise<void>;
|
||||||
|
}
|
1
node_modules/@electron/get/dist/esm/Downloader.js
generated
vendored
Normal file
1
node_modules/@electron/get/dist/esm/Downloader.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
//# sourceMappingURL=Downloader.js.map
|
1
node_modules/@electron/get/dist/esm/Downloader.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/esm/Downloader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Downloader.js","sourceRoot":"","sources":["../../src/Downloader.ts"],"names":[],"mappings":""}
|
19
node_modules/@electron/get/dist/esm/GotDownloader.d.ts
generated
vendored
Normal file
19
node_modules/@electron/get/dist/esm/GotDownloader.d.ts
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import * as got from 'got';
|
||||||
|
import { Downloader } from './Downloader';
|
||||||
|
/**
|
||||||
|
* See [`got#options`](https://github.com/sindresorhus/got#options) for possible keys/values.
|
||||||
|
*/
|
||||||
|
export declare type GotDownloaderOptions = got.GotOptions<string | null> & {
|
||||||
|
/**
|
||||||
|
* if defined, triggers every time `got`'s `downloadProgress` event callback is triggered.
|
||||||
|
*/
|
||||||
|
getProgressCallback?: (progress: got.Progress) => Promise<void>;
|
||||||
|
/**
|
||||||
|
* if `true`, disables the console progress bar (setting the `ELECTRON_GET_NO_PROGRESS`
|
||||||
|
* environment variable to a non-empty value also does this).
|
||||||
|
*/
|
||||||
|
quiet?: boolean;
|
||||||
|
};
|
||||||
|
export declare class GotDownloader implements Downloader<GotDownloaderOptions> {
|
||||||
|
download(url: string, targetFilePath: string, options?: GotDownloaderOptions): Promise<void>;
|
||||||
|
}
|
73
node_modules/@electron/get/dist/esm/GotDownloader.js
generated
vendored
Normal file
73
node_modules/@electron/get/dist/esm/GotDownloader.js
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
var __rest = (this && this.__rest) || function (s, e) {
|
||||||
|
var t = {};
|
||||||
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||||
|
t[p] = s[p];
|
||||||
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||||
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||||
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||||
|
t[p[i]] = s[p[i]];
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
};
|
||||||
|
import * as fs from 'fs-extra';
|
||||||
|
import * as got from 'got';
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as ProgressBar from 'progress';
|
||||||
|
const PROGRESS_BAR_DELAY_IN_SECONDS = 30;
|
||||||
|
export class GotDownloader {
|
||||||
|
async download(url, targetFilePath, options) {
|
||||||
|
if (!options) {
|
||||||
|
options = {};
|
||||||
|
}
|
||||||
|
const { quiet, getProgressCallback } = options, gotOptions = __rest(options, ["quiet", "getProgressCallback"]);
|
||||||
|
let downloadCompleted = false;
|
||||||
|
let bar;
|
||||||
|
let progressPercent;
|
||||||
|
let timeout = undefined;
|
||||||
|
await fs.mkdirp(path.dirname(targetFilePath));
|
||||||
|
const writeStream = fs.createWriteStream(targetFilePath);
|
||||||
|
if (!quiet || !process.env.ELECTRON_GET_NO_PROGRESS) {
|
||||||
|
const start = new Date();
|
||||||
|
timeout = setTimeout(() => {
|
||||||
|
if (!downloadCompleted) {
|
||||||
|
bar = new ProgressBar(`Downloading ${path.basename(url)}: [:bar] :percent ETA: :eta seconds `, {
|
||||||
|
curr: progressPercent,
|
||||||
|
total: 100,
|
||||||
|
});
|
||||||
|
// https://github.com/visionmedia/node-progress/issues/159
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
bar.start = start;
|
||||||
|
}
|
||||||
|
}, PROGRESS_BAR_DELAY_IN_SECONDS * 1000);
|
||||||
|
}
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
const downloadStream = got.stream(url, gotOptions);
|
||||||
|
downloadStream.on('downloadProgress', async (progress) => {
|
||||||
|
progressPercent = progress.percent;
|
||||||
|
if (bar) {
|
||||||
|
bar.update(progress.percent);
|
||||||
|
}
|
||||||
|
if (getProgressCallback) {
|
||||||
|
await getProgressCallback(progress);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
downloadStream.on('error', error => {
|
||||||
|
if (error.name === 'HTTPError' && error.statusCode === 404) {
|
||||||
|
error.message += ` for ${error.url}`;
|
||||||
|
}
|
||||||
|
if (writeStream.destroy) {
|
||||||
|
writeStream.destroy(error);
|
||||||
|
}
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
writeStream.on('error', error => reject(error));
|
||||||
|
writeStream.on('close', () => resolve());
|
||||||
|
downloadStream.pipe(writeStream);
|
||||||
|
});
|
||||||
|
downloadCompleted = true;
|
||||||
|
if (timeout) {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=GotDownloader.js.map
|
1
node_modules/@electron/get/dist/esm/GotDownloader.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/esm/GotDownloader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"GotDownloader.js","sourceRoot":"","sources":["../../src/GotDownloader.ts"],"names":[],"mappings":"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"}
|
3
node_modules/@electron/get/dist/esm/artifact-utils.d.ts
generated
vendored
Normal file
3
node_modules/@electron/get/dist/esm/artifact-utils.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import { ElectronArtifactDetails } from './types';
|
||||||
|
export declare function getArtifactFileName(details: ElectronArtifactDetails): string;
|
||||||
|
export declare function getArtifactRemoteURL(details: ElectronArtifactDetails): Promise<string>;
|
52
node_modules/@electron/get/dist/esm/artifact-utils.js
generated
vendored
Normal file
52
node_modules/@electron/get/dist/esm/artifact-utils.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import { ensureIsTruthyString } from './utils';
|
||||||
|
const BASE_URL = 'https://github.com/electron/electron/releases/download/';
|
||||||
|
const NIGHTLY_BASE_URL = 'https://github.com/electron/nightlies/releases/download/';
|
||||||
|
export function getArtifactFileName(details) {
|
||||||
|
ensureIsTruthyString(details, 'artifactName');
|
||||||
|
if (details.isGeneric) {
|
||||||
|
return details.artifactName;
|
||||||
|
}
|
||||||
|
ensureIsTruthyString(details, 'arch');
|
||||||
|
ensureIsTruthyString(details, 'platform');
|
||||||
|
ensureIsTruthyString(details, 'version');
|
||||||
|
return `${[
|
||||||
|
details.artifactName,
|
||||||
|
details.version,
|
||||||
|
details.platform,
|
||||||
|
details.arch,
|
||||||
|
...(details.artifactSuffix ? [details.artifactSuffix] : []),
|
||||||
|
].join('-')}.zip`;
|
||||||
|
}
|
||||||
|
function mirrorVar(name, options, defaultValue) {
|
||||||
|
// Convert camelCase to camel_case for env var reading
|
||||||
|
const lowerName = name.replace(/([a-z])([A-Z])/g, (_, a, b) => `${a}_${b}`).toLowerCase();
|
||||||
|
return (process.env[`NPM_CONFIG_ELECTRON_${lowerName.toUpperCase()}`] ||
|
||||||
|
process.env[`npm_config_electron_${lowerName}`] ||
|
||||||
|
process.env[`npm_package_config_electron_${lowerName}`] ||
|
||||||
|
process.env[`ELECTRON_${lowerName.toUpperCase()}`] ||
|
||||||
|
options[name] ||
|
||||||
|
defaultValue);
|
||||||
|
}
|
||||||
|
export async function getArtifactRemoteURL(details) {
|
||||||
|
const opts = details.mirrorOptions || {};
|
||||||
|
let base = mirrorVar('mirror', opts, BASE_URL);
|
||||||
|
if (details.version.includes('nightly')) {
|
||||||
|
const nightlyDeprecated = mirrorVar('nightly_mirror', opts, '');
|
||||||
|
if (nightlyDeprecated) {
|
||||||
|
base = nightlyDeprecated;
|
||||||
|
console.warn(`nightly_mirror is deprecated, please use nightlyMirror`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
base = mirrorVar('nightlyMirror', opts, NIGHTLY_BASE_URL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const path = mirrorVar('customDir', opts, details.version).replace('{{ version }}', details.version.replace(/^v/, ''));
|
||||||
|
const file = mirrorVar('customFilename', opts, getArtifactFileName(details));
|
||||||
|
// Allow customized download URL resolution.
|
||||||
|
if (opts.resolveAssetURL) {
|
||||||
|
const url = await opts.resolveAssetURL(details);
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
return `${base}${path}/${file}`;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=artifact-utils.js.map
|
1
node_modules/@electron/get/dist/esm/artifact-utils.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/esm/artifact-utils.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"artifact-utils.js","sourceRoot":"","sources":["../../src/artifact-utils.ts"],"names":[],"mappings":"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"}
|
3
node_modules/@electron/get/dist/esm/downloader-resolver.d.ts
generated
vendored
Normal file
3
node_modules/@electron/get/dist/esm/downloader-resolver.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import { DownloadOptions } from './types';
|
||||||
|
import { Downloader } from './Downloader';
|
||||||
|
export declare function getDownloaderForSystem(): Promise<Downloader<DownloadOptions>>;
|
9
node_modules/@electron/get/dist/esm/downloader-resolver.js
generated
vendored
Normal file
9
node_modules/@electron/get/dist/esm/downloader-resolver.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export async function getDownloaderForSystem() {
|
||||||
|
// TODO: Resolve the downloader or default to GotDownloader
|
||||||
|
// Current thoughts are a dot-file traversal for something like
|
||||||
|
// ".electron.downloader" which would be a text file with the name of the
|
||||||
|
// npm module to import() and use as the downloader
|
||||||
|
const { GotDownloader } = await import('./GotDownloader');
|
||||||
|
return new GotDownloader();
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=downloader-resolver.js.map
|
1
node_modules/@electron/get/dist/esm/downloader-resolver.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/esm/downloader-resolver.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"downloader-resolver.js","sourceRoot":"","sources":["../../src/downloader-resolver.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,2DAA2D;IAC3D,+DAA+D;IAC/D,yEAAyE;IACzE,mDAAmD;IACnD,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC1D,OAAO,IAAI,aAAa,EAAE,CAAC;AAC7B,CAAC"}
|
18
node_modules/@electron/get/dist/esm/index.d.ts
generated
vendored
Normal file
18
node_modules/@electron/get/dist/esm/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { ElectronDownloadRequestOptions, ElectronPlatformArtifactDetailsWithDefaults } from './types';
|
||||||
|
export { getHostArch } from './utils';
|
||||||
|
export { initializeProxy } from './proxy';
|
||||||
|
export * from './types';
|
||||||
|
/**
|
||||||
|
* Downloads an artifact from an Electron release and returns an absolute path
|
||||||
|
* to the downloaded file.
|
||||||
|
*
|
||||||
|
* @param artifactDetails - The information required to download the artifact
|
||||||
|
*/
|
||||||
|
export declare function downloadArtifact(_artifactDetails: ElectronPlatformArtifactDetailsWithDefaults): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Downloads a specific version of Electron and returns an absolute path to a
|
||||||
|
* ZIP file.
|
||||||
|
*
|
||||||
|
* @param version - The version of Electron you want to download
|
||||||
|
*/
|
||||||
|
export declare function download(version: string, options?: ElectronDownloadRequestOptions): Promise<string>;
|
124
node_modules/@electron/get/dist/esm/index.js
generated
vendored
Normal file
124
node_modules/@electron/get/dist/esm/index.js
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
import debug from 'debug';
|
||||||
|
import * as fs from 'fs-extra';
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as semver from 'semver';
|
||||||
|
import * as sumchecker from 'sumchecker';
|
||||||
|
import { getArtifactFileName, getArtifactRemoteURL } from './artifact-utils';
|
||||||
|
import { Cache } from './Cache';
|
||||||
|
import { getDownloaderForSystem } from './downloader-resolver';
|
||||||
|
import { initializeProxy } from './proxy';
|
||||||
|
import { withTempDirectoryIn, normalizeVersion, getHostArch, getNodeArch, ensureIsTruthyString, isOfficialLinuxIA32Download, withTempDirectory, } from './utils';
|
||||||
|
export { getHostArch } from './utils';
|
||||||
|
export { initializeProxy } from './proxy';
|
||||||
|
const d = debug('@electron/get:index');
|
||||||
|
if (process.env.ELECTRON_GET_USE_PROXY) {
|
||||||
|
initializeProxy();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Downloads an artifact from an Electron release and returns an absolute path
|
||||||
|
* to the downloaded file.
|
||||||
|
*
|
||||||
|
* @param artifactDetails - The information required to download the artifact
|
||||||
|
*/
|
||||||
|
export async function downloadArtifact(_artifactDetails) {
|
||||||
|
const artifactDetails = Object.assign({}, _artifactDetails);
|
||||||
|
if (!_artifactDetails.isGeneric) {
|
||||||
|
const platformArtifactDetails = artifactDetails;
|
||||||
|
if (!platformArtifactDetails.platform) {
|
||||||
|
d('No platform found, defaulting to the host platform');
|
||||||
|
platformArtifactDetails.platform = process.platform;
|
||||||
|
}
|
||||||
|
if (platformArtifactDetails.arch) {
|
||||||
|
platformArtifactDetails.arch = getNodeArch(platformArtifactDetails.arch);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
d('No arch found, defaulting to the host arch');
|
||||||
|
platformArtifactDetails.arch = getHostArch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ensureIsTruthyString(artifactDetails, 'version');
|
||||||
|
artifactDetails.version = normalizeVersion(process.env.ELECTRON_CUSTOM_VERSION || artifactDetails.version);
|
||||||
|
const fileName = getArtifactFileName(artifactDetails);
|
||||||
|
const url = await getArtifactRemoteURL(artifactDetails);
|
||||||
|
const cache = new Cache(artifactDetails.cacheRoot);
|
||||||
|
// Do not check if the file exists in the cache when force === true
|
||||||
|
if (!artifactDetails.force) {
|
||||||
|
d(`Checking the cache (${artifactDetails.cacheRoot}) for ${fileName} (${url})`);
|
||||||
|
const cachedPath = await cache.getPathForFileInCache(url, fileName);
|
||||||
|
if (cachedPath === null) {
|
||||||
|
d('Cache miss');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
d('Cache hit');
|
||||||
|
return cachedPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!artifactDetails.isGeneric &&
|
||||||
|
isOfficialLinuxIA32Download(artifactDetails.platform, artifactDetails.arch, artifactDetails.version, artifactDetails.mirrorOptions)) {
|
||||||
|
console.warn('Official Linux/ia32 support is deprecated.');
|
||||||
|
console.warn('For more info: https://electronjs.org/blog/linux-32bit-support');
|
||||||
|
}
|
||||||
|
return await withTempDirectoryIn(artifactDetails.tempDirectory, async (tempFolder) => {
|
||||||
|
const tempDownloadPath = path.resolve(tempFolder, getArtifactFileName(artifactDetails));
|
||||||
|
const downloader = artifactDetails.downloader || (await getDownloaderForSystem());
|
||||||
|
d(`Downloading ${url} to ${tempDownloadPath} with options: ${JSON.stringify(artifactDetails.downloadOptions)}`);
|
||||||
|
await downloader.download(url, tempDownloadPath, artifactDetails.downloadOptions);
|
||||||
|
// Don't try to verify the hash of the hash file itself
|
||||||
|
// and for older versions that don't have a SHASUMS256.txt
|
||||||
|
if (!artifactDetails.artifactName.startsWith('SHASUMS256') &&
|
||||||
|
!artifactDetails.unsafelyDisableChecksums &&
|
||||||
|
semver.gte(artifactDetails.version, '1.3.2')) {
|
||||||
|
await withTempDirectory(async (tmpDir) => {
|
||||||
|
let shasumPath;
|
||||||
|
const checksums = artifactDetails.checksums;
|
||||||
|
if (checksums) {
|
||||||
|
shasumPath = path.resolve(tmpDir, 'SHASUMS256.txt');
|
||||||
|
const fileNames = Object.keys(checksums);
|
||||||
|
if (fileNames.length === 0) {
|
||||||
|
throw new Error('Provided "checksums" object is empty, cannot generate a valid SHASUMS256.txt');
|
||||||
|
}
|
||||||
|
const generatedChecksums = fileNames
|
||||||
|
.map(fileName => `${checksums[fileName]} *${fileName}`)
|
||||||
|
.join('\n');
|
||||||
|
await fs.writeFile(shasumPath, generatedChecksums);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
shasumPath = await downloadArtifact({
|
||||||
|
isGeneric: true,
|
||||||
|
version: artifactDetails.version,
|
||||||
|
artifactName: 'SHASUMS256.txt',
|
||||||
|
force: artifactDetails.force,
|
||||||
|
downloadOptions: artifactDetails.downloadOptions,
|
||||||
|
cacheRoot: artifactDetails.cacheRoot,
|
||||||
|
downloader: artifactDetails.downloader,
|
||||||
|
mirrorOptions: artifactDetails.mirrorOptions,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// For versions 1.3.2 - 1.3.4, need to overwrite the `defaultTextEncoding` option:
|
||||||
|
// https://github.com/electron/electron/pull/6676#discussion_r75332120
|
||||||
|
if (semver.satisfies(artifactDetails.version, '1.3.2 - 1.3.4')) {
|
||||||
|
const validatorOptions = {};
|
||||||
|
validatorOptions.defaultTextEncoding = 'binary';
|
||||||
|
const checker = new sumchecker.ChecksumValidator('sha256', shasumPath, validatorOptions);
|
||||||
|
await checker.validate(path.dirname(tempDownloadPath), path.basename(tempDownloadPath));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
await sumchecker('sha256', shasumPath, path.dirname(tempDownloadPath), [
|
||||||
|
path.basename(tempDownloadPath),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return await cache.putFileInCache(url, tempDownloadPath, fileName);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Downloads a specific version of Electron and returns an absolute path to a
|
||||||
|
* ZIP file.
|
||||||
|
*
|
||||||
|
* @param version - The version of Electron you want to download
|
||||||
|
*/
|
||||||
|
export function download(version, options) {
|
||||||
|
return downloadArtifact(Object.assign(Object.assign({}, options), { version, platform: process.platform, arch: process.arch, artifactName: 'electron' }));
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=index.js.map
|
1
node_modules/@electron/get/dist/esm/index.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/esm/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"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"}
|
4
node_modules/@electron/get/dist/esm/proxy.d.ts
generated
vendored
Normal file
4
node_modules/@electron/get/dist/esm/proxy.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* Initializes a third-party proxy module for HTTP(S) requests.
|
||||||
|
*/
|
||||||
|
export declare function initializeProxy(): void;
|
29
node_modules/@electron/get/dist/esm/proxy.js
generated
vendored
Normal file
29
node_modules/@electron/get/dist/esm/proxy.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import * as debug from 'debug';
|
||||||
|
import { getEnv, setEnv } from './utils';
|
||||||
|
const d = debug('@electron/get:proxy');
|
||||||
|
/**
|
||||||
|
* Initializes a third-party proxy module for HTTP(S) requests.
|
||||||
|
*/
|
||||||
|
export function initializeProxy() {
|
||||||
|
try {
|
||||||
|
// Code originally from https://github.com/yeoman/yo/blob/b2eea87e/lib/cli.js#L19-L28
|
||||||
|
const MAJOR_NODEJS_VERSION = parseInt(process.version.slice(1).split('.')[0], 10);
|
||||||
|
if (MAJOR_NODEJS_VERSION >= 10) {
|
||||||
|
// See: https://github.com/electron/get/pull/214#discussion_r798845713
|
||||||
|
const env = getEnv('GLOBAL_AGENT_');
|
||||||
|
setEnv('GLOBAL_AGENT_HTTP_PROXY', env('HTTP_PROXY'));
|
||||||
|
setEnv('GLOBAL_AGENT_HTTPS_PROXY', env('HTTPS_PROXY'));
|
||||||
|
setEnv('GLOBAL_AGENT_NO_PROXY', env('NO_PROXY'));
|
||||||
|
// `global-agent` works with Node.js v10 and above.
|
||||||
|
require('global-agent').bootstrap();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// `global-tunnel-ng` works with Node.js v10 and below.
|
||||||
|
require('global-tunnel-ng').initialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
d('Could not load either proxy modules, built-in proxy support not available:', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=proxy.js.map
|
1
node_modules/@electron/get/dist/esm/proxy.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/esm/proxy.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,CAAC,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAEvC;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,IAAI;QACF,qFAAqF;QACrF,MAAM,oBAAoB,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAElF,IAAI,oBAAoB,IAAI,EAAE,EAAE;YAC9B,sEAAsE;YACtE,MAAM,GAAG,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;YAEpC,MAAM,CAAC,yBAAyB,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;YACrD,MAAM,CAAC,0BAA0B,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;YACvD,MAAM,CAAC,uBAAuB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;YAEjD,mDAAmD;YACnD,OAAO,CAAC,cAAc,CAAC,CAAC,SAAS,EAAE,CAAC;SACrC;aAAM;YACL,uDAAuD;YACvD,OAAO,CAAC,kBAAkB,CAAC,CAAC,UAAU,EAAE,CAAC;SAC1C;KACF;IAAC,OAAO,CAAC,EAAE;QACV,CAAC,CAAC,4EAA4E,EAAE,CAAC,CAAC,CAAC;KACpF;AACH,CAAC"}
|
124
node_modules/@electron/get/dist/esm/types.d.ts
generated
vendored
Normal file
124
node_modules/@electron/get/dist/esm/types.d.ts
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
import { Downloader } from './Downloader';
|
||||||
|
export declare type DownloadOptions = any;
|
||||||
|
export interface MirrorOptions {
|
||||||
|
/**
|
||||||
|
* DEPRECATED - see nightlyMirror.
|
||||||
|
*/
|
||||||
|
nightly_mirror?: string;
|
||||||
|
/**
|
||||||
|
* The Electron nightly-specific mirror URL.
|
||||||
|
*/
|
||||||
|
nightlyMirror?: string;
|
||||||
|
/**
|
||||||
|
* The base URL of the mirror to download from,
|
||||||
|
* e.g https://github.com/electron/electron/releases/download
|
||||||
|
*/
|
||||||
|
mirror?: string;
|
||||||
|
/**
|
||||||
|
* The name of the directory to download from,
|
||||||
|
* often scoped by version number e.g 'v4.0.4'
|
||||||
|
*/
|
||||||
|
customDir?: string;
|
||||||
|
/**
|
||||||
|
* The name of the asset to download,
|
||||||
|
* e.g 'electron-v4.0.4-linux-x64.zip'
|
||||||
|
*/
|
||||||
|
customFilename?: string;
|
||||||
|
/**
|
||||||
|
* A function allowing customization of the url returned
|
||||||
|
* from getArtifactRemoteURL().
|
||||||
|
*/
|
||||||
|
resolveAssetURL?: (opts: DownloadOptions) => Promise<string>;
|
||||||
|
}
|
||||||
|
export interface ElectronDownloadRequest {
|
||||||
|
/**
|
||||||
|
* The version of Electron associated with the artifact.
|
||||||
|
*/
|
||||||
|
version: string;
|
||||||
|
/**
|
||||||
|
* The type of artifact. For example:
|
||||||
|
* * `electron`
|
||||||
|
* * `ffmpeg`
|
||||||
|
*/
|
||||||
|
artifactName: string;
|
||||||
|
}
|
||||||
|
export interface ElectronDownloadRequestOptions {
|
||||||
|
/**
|
||||||
|
* Whether to download an artifact regardless of whether it's in the cache directory.
|
||||||
|
*
|
||||||
|
* Defaults to `false`.
|
||||||
|
*/
|
||||||
|
force?: boolean;
|
||||||
|
/**
|
||||||
|
* When set to `true`, disables checking that the artifact download completed successfully
|
||||||
|
* with the correct payload.
|
||||||
|
*
|
||||||
|
* Defaults to `false`.
|
||||||
|
*/
|
||||||
|
unsafelyDisableChecksums?: boolean;
|
||||||
|
/**
|
||||||
|
* Provides checksums for the artifact as strings.
|
||||||
|
* Can be used if you already know the checksums of the Electron artifact
|
||||||
|
* you are downloading and want to skip the checksum file download
|
||||||
|
* without skipping the checksum validation.
|
||||||
|
*
|
||||||
|
* This should be an object whose keys are the file names of the artifacts and
|
||||||
|
* the values are their respective SHA256 checksums.
|
||||||
|
*/
|
||||||
|
checksums?: Record<string, string>;
|
||||||
|
/**
|
||||||
|
* The directory that caches Electron artifact downloads.
|
||||||
|
*
|
||||||
|
* The default value is dependent upon the host platform:
|
||||||
|
*
|
||||||
|
* * Linux: `$XDG_CACHE_HOME` or `~/.cache/electron/`
|
||||||
|
* * MacOS: `~/Library/Caches/electron/`
|
||||||
|
* * Windows: `%LOCALAPPDATA%/electron/Cache` or `~/AppData/Local/electron/Cache/`
|
||||||
|
*/
|
||||||
|
cacheRoot?: string;
|
||||||
|
/**
|
||||||
|
* Options passed to the downloader module.
|
||||||
|
*/
|
||||||
|
downloadOptions?: DownloadOptions;
|
||||||
|
/**
|
||||||
|
* Options related to specifying an artifact mirror.
|
||||||
|
*/
|
||||||
|
mirrorOptions?: MirrorOptions;
|
||||||
|
/**
|
||||||
|
* The custom [[Downloader]] class used to download artifacts. Defaults to the
|
||||||
|
* built-in [[GotDownloader]].
|
||||||
|
*/
|
||||||
|
downloader?: Downloader<DownloadOptions>;
|
||||||
|
/**
|
||||||
|
* A temporary directory for downloads.
|
||||||
|
* It is used before artifacts are put into cache.
|
||||||
|
*/
|
||||||
|
tempDirectory?: string;
|
||||||
|
}
|
||||||
|
export declare type ElectronPlatformArtifactDetails = {
|
||||||
|
/**
|
||||||
|
* The target artifact platform. These are Node-style platform names, for example:
|
||||||
|
* * `win32`
|
||||||
|
* * `darwin`
|
||||||
|
* * `linux`
|
||||||
|
*/
|
||||||
|
platform: string;
|
||||||
|
/**
|
||||||
|
* The target artifact architecture. These are Node-style architecture names, for example:
|
||||||
|
* * `ia32`
|
||||||
|
* * `x64`
|
||||||
|
* * `armv7l`
|
||||||
|
*/
|
||||||
|
arch: string;
|
||||||
|
artifactSuffix?: string;
|
||||||
|
isGeneric?: false;
|
||||||
|
} & ElectronDownloadRequest & ElectronDownloadRequestOptions;
|
||||||
|
export declare type ElectronGenericArtifactDetails = {
|
||||||
|
isGeneric: true;
|
||||||
|
} & ElectronDownloadRequest & ElectronDownloadRequestOptions;
|
||||||
|
export declare type ElectronArtifactDetails = ElectronPlatformArtifactDetails | ElectronGenericArtifactDetails;
|
||||||
|
export declare type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
|
||||||
|
export declare type ElectronPlatformArtifactDetailsWithDefaults = (Omit<ElectronPlatformArtifactDetails, 'platform' | 'arch'> & {
|
||||||
|
platform?: string;
|
||||||
|
arch?: string;
|
||||||
|
}) | ElectronGenericArtifactDetails;
|
1
node_modules/@electron/get/dist/esm/types.js
generated
vendored
Normal file
1
node_modules/@electron/get/dist/esm/types.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
//# sourceMappingURL=types.js.map
|
1
node_modules/@electron/get/dist/esm/types.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/esm/types.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
25
node_modules/@electron/get/dist/esm/utils.d.ts
generated
vendored
Normal file
25
node_modules/@electron/get/dist/esm/utils.d.ts
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
export declare function withTempDirectoryIn<T>(parentDirectory: string | undefined, fn: (directory: string) => Promise<T>): Promise<T>;
|
||||||
|
export declare function withTempDirectory<T>(fn: (directory: string) => Promise<T>): Promise<T>;
|
||||||
|
export declare function normalizeVersion(version: string): string;
|
||||||
|
/**
|
||||||
|
* Runs the `uname` command and returns the trimmed output.
|
||||||
|
*/
|
||||||
|
export declare function uname(): string;
|
||||||
|
/**
|
||||||
|
* Generates an architecture name that would be used in an Electron or Node.js
|
||||||
|
* download file name.
|
||||||
|
*/
|
||||||
|
export declare function getNodeArch(arch: string): string;
|
||||||
|
/**
|
||||||
|
* Generates an architecture name that would be used in an Electron or Node.js
|
||||||
|
* download file name, from the `process` module information.
|
||||||
|
*/
|
||||||
|
export declare function getHostArch(): string;
|
||||||
|
export declare function ensureIsTruthyString<T, K extends keyof T>(obj: T, key: K): void;
|
||||||
|
export declare function isOfficialLinuxIA32Download(platform: string, arch: string, version: string, mirrorOptions?: object): boolean;
|
||||||
|
/**
|
||||||
|
* Find the value of a environment variable which may or may not have the
|
||||||
|
* prefix, in a case-insensitive manner.
|
||||||
|
*/
|
||||||
|
export declare function getEnv(prefix?: string): (name: string) => string | undefined;
|
||||||
|
export declare function setEnv(key: string, value: string | undefined): void;
|
95
node_modules/@electron/get/dist/esm/utils.js
generated
vendored
Normal file
95
node_modules/@electron/get/dist/esm/utils.js
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
import * as childProcess from 'child_process';
|
||||||
|
import * as fs from 'fs-extra';
|
||||||
|
import * as os from 'os';
|
||||||
|
import * as path from 'path';
|
||||||
|
async function useAndRemoveDirectory(directory, fn) {
|
||||||
|
let result;
|
||||||
|
try {
|
||||||
|
result = await fn(directory);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
await fs.remove(directory);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
export async function withTempDirectoryIn(parentDirectory = os.tmpdir(), fn) {
|
||||||
|
const tempDirectoryPrefix = 'electron-download-';
|
||||||
|
const tempDirectory = await fs.mkdtemp(path.resolve(parentDirectory, tempDirectoryPrefix));
|
||||||
|
return useAndRemoveDirectory(tempDirectory, fn);
|
||||||
|
}
|
||||||
|
export async function withTempDirectory(fn) {
|
||||||
|
return withTempDirectoryIn(undefined, fn);
|
||||||
|
}
|
||||||
|
export function normalizeVersion(version) {
|
||||||
|
if (!version.startsWith('v')) {
|
||||||
|
return `v${version}`;
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Runs the `uname` command and returns the trimmed output.
|
||||||
|
*/
|
||||||
|
export function uname() {
|
||||||
|
return childProcess
|
||||||
|
.execSync('uname -m')
|
||||||
|
.toString()
|
||||||
|
.trim();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Generates an architecture name that would be used in an Electron or Node.js
|
||||||
|
* download file name.
|
||||||
|
*/
|
||||||
|
export function getNodeArch(arch) {
|
||||||
|
if (arch === 'arm') {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
switch (process.config.variables.arm_version) {
|
||||||
|
case '6':
|
||||||
|
return uname();
|
||||||
|
case '7':
|
||||||
|
default:
|
||||||
|
return 'armv7l';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return arch;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Generates an architecture name that would be used in an Electron or Node.js
|
||||||
|
* download file name, from the `process` module information.
|
||||||
|
*/
|
||||||
|
export function getHostArch() {
|
||||||
|
return getNodeArch(process.arch);
|
||||||
|
}
|
||||||
|
export function ensureIsTruthyString(obj, key) {
|
||||||
|
if (!obj[key] || typeof obj[key] !== 'string') {
|
||||||
|
throw new Error(`Expected property "${key}" to be provided as a string but it was not`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function isOfficialLinuxIA32Download(platform, arch, version, mirrorOptions) {
|
||||||
|
return (platform === 'linux' &&
|
||||||
|
arch === 'ia32' &&
|
||||||
|
Number(version.slice(1).split('.')[0]) >= 4 &&
|
||||||
|
typeof mirrorOptions === 'undefined');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Find the value of a environment variable which may or may not have the
|
||||||
|
* prefix, in a case-insensitive manner.
|
||||||
|
*/
|
||||||
|
export function getEnv(prefix = '') {
|
||||||
|
const envsLowerCase = {};
|
||||||
|
for (const envKey in process.env) {
|
||||||
|
envsLowerCase[envKey.toLowerCase()] = process.env[envKey];
|
||||||
|
}
|
||||||
|
return (name) => {
|
||||||
|
return (envsLowerCase[`${prefix}${name}`.toLowerCase()] ||
|
||||||
|
envsLowerCase[name.toLowerCase()] ||
|
||||||
|
undefined);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export function setEnv(key, value) {
|
||||||
|
// The `void` operator always returns `undefined`.
|
||||||
|
// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void
|
||||||
|
if (value !== void 0) {
|
||||||
|
process.env[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=utils.js.map
|
1
node_modules/@electron/get/dist/esm/utils.js.map
generated
vendored
Normal file
1
node_modules/@electron/get/dist/esm/utils.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"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"}
|
102
node_modules/@electron/get/package.json
generated
vendored
Normal file
102
node_modules/@electron/get/package.json
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
{
|
||||||
|
"name": "@electron/get",
|
||||||
|
"version": "1.14.1",
|
||||||
|
"description": "Utility for downloading artifacts from different versions of Electron",
|
||||||
|
"main": "dist/cjs/index.js",
|
||||||
|
"module": "dist/esm/index.js",
|
||||||
|
"repository": "https://github.com/electron/get",
|
||||||
|
"author": "Samuel Attard",
|
||||||
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc && tsc -p tsconfig.esm.json",
|
||||||
|
"build:docs": "typedoc --out docs",
|
||||||
|
"eslint": "eslint --ext .ts src test",
|
||||||
|
"jest": "jest --coverage",
|
||||||
|
"lint": "npm run prettier && npm run eslint",
|
||||||
|
"prettier": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||||
|
"prepublishOnly": "npm run build",
|
||||||
|
"test": "npm run lint && npm run jest",
|
||||||
|
"test:nonetwork": "npm run lint && npm run jest -- --testPathIgnorePatterns network.spec"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist/*",
|
||||||
|
"README.md"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.6"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.1.1",
|
||||||
|
"env-paths": "^2.2.0",
|
||||||
|
"fs-extra": "^8.1.0",
|
||||||
|
"got": "^9.6.0",
|
||||||
|
"progress": "^2.0.3",
|
||||||
|
"semver": "^6.2.0",
|
||||||
|
"sumchecker": "^3.0.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@continuous-auth/semantic-release-npm": "^2.0.0",
|
||||||
|
"@types/debug": "^4.1.4",
|
||||||
|
"@types/fs-extra": "^8.0.0",
|
||||||
|
"@types/got": "^9.4.4",
|
||||||
|
"@types/jest": "^24.0.13",
|
||||||
|
"@types/node": "^12.0.2",
|
||||||
|
"@types/progress": "^2.0.3",
|
||||||
|
"@types/semver": "^6.2.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^2.34.0",
|
||||||
|
"@typescript-eslint/parser": "^2.34.0",
|
||||||
|
"eslint": "^6.8.0",
|
||||||
|
"eslint-config-prettier": "^6.15.0",
|
||||||
|
"eslint-plugin-import": "^2.22.1",
|
||||||
|
"eslint-plugin-jest": "< 24.0.0",
|
||||||
|
"husky": "^2.3.0",
|
||||||
|
"jest": "^24.8.0",
|
||||||
|
"lint-staged": "^8.1.7",
|
||||||
|
"prettier": "^1.17.1",
|
||||||
|
"ts-jest": "^24.0.0",
|
||||||
|
"typedoc": "^0.17.2",
|
||||||
|
"typescript": "^3.8.0"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended",
|
||||||
|
"plugin:jest/recommended",
|
||||||
|
"plugin:import/errors",
|
||||||
|
"plugin:import/warnings",
|
||||||
|
"plugin:import/typescript",
|
||||||
|
"prettier",
|
||||||
|
"prettier/@typescript-eslint"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"husky": {
|
||||||
|
"hooks": {
|
||||||
|
"pre-commit": "lint-staged"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"*.ts": [
|
||||||
|
"eslint --fix",
|
||||||
|
"prettier --write",
|
||||||
|
"git add"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"electron",
|
||||||
|
"download",
|
||||||
|
"prebuild",
|
||||||
|
"get",
|
||||||
|
"artifact",
|
||||||
|
"release"
|
||||||
|
],
|
||||||
|
"optionalDependencies": {
|
||||||
|
"global-agent": "^3.0.0",
|
||||||
|
"global-tunnel-ng": "^2.7.1"
|
||||||
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"eslint/inquirer": "< 7.3.0",
|
||||||
|
"**/@typescript-eslint/typescript-estree/semver": "^6.3.0"
|
||||||
|
}
|
||||||
|
}
|
132
node_modules/@sindresorhus/is/dist/index.d.ts
generated
vendored
Normal file
132
node_modules/@sindresorhus/is/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
/// <reference lib="es2016" />
|
||||||
|
/// <reference lib="es2017.sharedmemory" />
|
||||||
|
/// <reference lib="esnext.asynciterable" />
|
||||||
|
/// <reference lib="dom" />
|
||||||
|
declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
|
||||||
|
declare type Primitive = null | undefined | string | number | boolean | Symbol;
|
||||||
|
export interface ArrayLike {
|
||||||
|
length: number;
|
||||||
|
}
|
||||||
|
export interface Class<T = unknown> {
|
||||||
|
new (...args: any[]): T;
|
||||||
|
}
|
||||||
|
declare type DomElement = object & {
|
||||||
|
nodeType: 1;
|
||||||
|
nodeName: string;
|
||||||
|
};
|
||||||
|
declare type NodeStream = object & {
|
||||||
|
pipe: Function;
|
||||||
|
};
|
||||||
|
export declare const enum TypeName {
|
||||||
|
null = "null",
|
||||||
|
boolean = "boolean",
|
||||||
|
undefined = "undefined",
|
||||||
|
string = "string",
|
||||||
|
number = "number",
|
||||||
|
symbol = "symbol",
|
||||||
|
Function = "Function",
|
||||||
|
GeneratorFunction = "GeneratorFunction",
|
||||||
|
AsyncFunction = "AsyncFunction",
|
||||||
|
Observable = "Observable",
|
||||||
|
Array = "Array",
|
||||||
|
Buffer = "Buffer",
|
||||||
|
Object = "Object",
|
||||||
|
RegExp = "RegExp",
|
||||||
|
Date = "Date",
|
||||||
|
Error = "Error",
|
||||||
|
Map = "Map",
|
||||||
|
Set = "Set",
|
||||||
|
WeakMap = "WeakMap",
|
||||||
|
WeakSet = "WeakSet",
|
||||||
|
Int8Array = "Int8Array",
|
||||||
|
Uint8Array = "Uint8Array",
|
||||||
|
Uint8ClampedArray = "Uint8ClampedArray",
|
||||||
|
Int16Array = "Int16Array",
|
||||||
|
Uint16Array = "Uint16Array",
|
||||||
|
Int32Array = "Int32Array",
|
||||||
|
Uint32Array = "Uint32Array",
|
||||||
|
Float32Array = "Float32Array",
|
||||||
|
Float64Array = "Float64Array",
|
||||||
|
ArrayBuffer = "ArrayBuffer",
|
||||||
|
SharedArrayBuffer = "SharedArrayBuffer",
|
||||||
|
DataView = "DataView",
|
||||||
|
Promise = "Promise",
|
||||||
|
URL = "URL"
|
||||||
|
}
|
||||||
|
declare function is(value: unknown): TypeName;
|
||||||
|
declare namespace is {
|
||||||
|
const undefined: (value: unknown) => value is undefined;
|
||||||
|
const string: (value: unknown) => value is string;
|
||||||
|
const number: (value: unknown) => value is number;
|
||||||
|
const function_: (value: unknown) => value is Function;
|
||||||
|
const null_: (value: unknown) => value is null;
|
||||||
|
const class_: (value: unknown) => value is Class<unknown>;
|
||||||
|
const boolean: (value: unknown) => value is boolean;
|
||||||
|
const symbol: (value: unknown) => value is Symbol;
|
||||||
|
const numericString: (value: unknown) => boolean;
|
||||||
|
const array: (arg: any) => arg is any[];
|
||||||
|
const buffer: (input: unknown) => input is Buffer;
|
||||||
|
const nullOrUndefined: (value: unknown) => value is null | undefined;
|
||||||
|
const object: (value: unknown) => value is object;
|
||||||
|
const iterable: (value: unknown) => value is IterableIterator<unknown>;
|
||||||
|
const asyncIterable: (value: unknown) => value is AsyncIterableIterator<unknown>;
|
||||||
|
const generator: (value: unknown) => value is Generator;
|
||||||
|
const nativePromise: (value: unknown) => value is Promise<unknown>;
|
||||||
|
const promise: (value: unknown) => value is Promise<unknown>;
|
||||||
|
const generatorFunction: (value: unknown) => value is GeneratorFunction;
|
||||||
|
const asyncFunction: (value: unknown) => value is Function;
|
||||||
|
const boundFunction: (value: unknown) => value is Function;
|
||||||
|
const regExp: (value: unknown) => value is RegExp;
|
||||||
|
const date: (value: unknown) => value is Date;
|
||||||
|
const error: (value: unknown) => value is Error;
|
||||||
|
const map: (value: unknown) => value is Map<unknown, unknown>;
|
||||||
|
const set: (value: unknown) => value is Set<unknown>;
|
||||||
|
const weakMap: (value: unknown) => value is WeakMap<object, unknown>;
|
||||||
|
const weakSet: (value: unknown) => value is WeakSet<object>;
|
||||||
|
const int8Array: (value: unknown) => value is Int8Array;
|
||||||
|
const uint8Array: (value: unknown) => value is Uint8Array;
|
||||||
|
const uint8ClampedArray: (value: unknown) => value is Uint8ClampedArray;
|
||||||
|
const int16Array: (value: unknown) => value is Int16Array;
|
||||||
|
const uint16Array: (value: unknown) => value is Uint16Array;
|
||||||
|
const int32Array: (value: unknown) => value is Int32Array;
|
||||||
|
const uint32Array: (value: unknown) => value is Uint32Array;
|
||||||
|
const float32Array: (value: unknown) => value is Float32Array;
|
||||||
|
const float64Array: (value: unknown) => value is Float64Array;
|
||||||
|
const arrayBuffer: (value: unknown) => value is ArrayBuffer;
|
||||||
|
const sharedArrayBuffer: (value: unknown) => value is SharedArrayBuffer;
|
||||||
|
const dataView: (value: unknown) => value is DataView;
|
||||||
|
const directInstanceOf: <T>(instance: unknown, klass: Class<T>) => instance is T;
|
||||||
|
const urlInstance: (value: unknown) => value is URL;
|
||||||
|
const urlString: (value: unknown) => boolean;
|
||||||
|
const truthy: (value: unknown) => boolean;
|
||||||
|
const falsy: (value: unknown) => boolean;
|
||||||
|
const nan: (value: unknown) => boolean;
|
||||||
|
const primitive: (value: unknown) => value is Primitive;
|
||||||
|
const integer: (value: unknown) => value is number;
|
||||||
|
const safeInteger: (value: unknown) => value is number;
|
||||||
|
const plainObject: (value: unknown) => boolean;
|
||||||
|
const typedArray: (value: unknown) => value is TypedArray;
|
||||||
|
const arrayLike: (value: unknown) => value is ArrayLike;
|
||||||
|
const inRange: (value: number, range: number | number[]) => boolean;
|
||||||
|
const domElement: (value: unknown) => value is DomElement;
|
||||||
|
const observable: (value: unknown) => boolean;
|
||||||
|
const nodeStream: (value: unknown) => value is NodeStream;
|
||||||
|
const infinite: (value: unknown) => boolean;
|
||||||
|
const even: (value: number) => boolean;
|
||||||
|
const odd: (value: number) => boolean;
|
||||||
|
const emptyArray: (value: unknown) => boolean;
|
||||||
|
const nonEmptyArray: (value: unknown) => boolean;
|
||||||
|
const emptyString: (value: unknown) => boolean;
|
||||||
|
const nonEmptyString: (value: unknown) => boolean;
|
||||||
|
const emptyStringOrWhitespace: (value: unknown) => boolean;
|
||||||
|
const emptyObject: (value: unknown) => boolean;
|
||||||
|
const nonEmptyObject: (value: unknown) => boolean;
|
||||||
|
const emptySet: (value: unknown) => boolean;
|
||||||
|
const nonEmptySet: (value: unknown) => boolean;
|
||||||
|
const emptyMap: (value: unknown) => boolean;
|
||||||
|
const nonEmptyMap: (value: unknown) => boolean;
|
||||||
|
const any: (predicate: unknown, ...values: unknown[]) => boolean;
|
||||||
|
const all: (predicate: unknown, ...values: unknown[]) => boolean;
|
||||||
|
}
|
||||||
|
export default is;
|
245
node_modules/@sindresorhus/is/dist/index.js
generated
vendored
Normal file
245
node_modules/@sindresorhus/is/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
"use strict";
|
||||||
|
/// <reference lib="es2016"/>
|
||||||
|
/// <reference lib="es2017.sharedmemory"/>
|
||||||
|
/// <reference lib="esnext.asynciterable"/>
|
||||||
|
/// <reference lib="dom"/>
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
// TODO: Use the `URL` global when targeting Node.js 10
|
||||||
|
// tslint:disable-next-line
|
||||||
|
const URLGlobal = typeof URL === 'undefined' ? require('url').URL : URL;
|
||||||
|
const toString = Object.prototype.toString;
|
||||||
|
const isOfType = (type) => (value) => typeof value === type;
|
||||||
|
const isBuffer = (input) => !is.nullOrUndefined(input) && !is.nullOrUndefined(input.constructor) && is.function_(input.constructor.isBuffer) && input.constructor.isBuffer(input);
|
||||||
|
const getObjectType = (value) => {
|
||||||
|
const objectName = toString.call(value).slice(8, -1);
|
||||||
|
if (objectName) {
|
||||||
|
return objectName;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
const isObjectOfType = (type) => (value) => getObjectType(value) === type;
|
||||||
|
function is(value) {
|
||||||
|
switch (value) {
|
||||||
|
case null:
|
||||||
|
return "null" /* null */;
|
||||||
|
case true:
|
||||||
|
case false:
|
||||||
|
return "boolean" /* boolean */;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
switch (typeof value) {
|
||||||
|
case 'undefined':
|
||||||
|
return "undefined" /* undefined */;
|
||||||
|
case 'string':
|
||||||
|
return "string" /* string */;
|
||||||
|
case 'number':
|
||||||
|
return "number" /* number */;
|
||||||
|
case 'symbol':
|
||||||
|
return "symbol" /* symbol */;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
if (is.function_(value)) {
|
||||||
|
return "Function" /* Function */;
|
||||||
|
}
|
||||||
|
if (is.observable(value)) {
|
||||||
|
return "Observable" /* Observable */;
|
||||||
|
}
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
return "Array" /* Array */;
|
||||||
|
}
|
||||||
|
if (isBuffer(value)) {
|
||||||
|
return "Buffer" /* Buffer */;
|
||||||
|
}
|
||||||
|
const tagType = getObjectType(value);
|
||||||
|
if (tagType) {
|
||||||
|
return tagType;
|
||||||
|
}
|
||||||
|
if (value instanceof String || value instanceof Boolean || value instanceof Number) {
|
||||||
|
throw new TypeError('Please don\'t use object wrappers for primitive types');
|
||||||
|
}
|
||||||
|
return "Object" /* Object */;
|
||||||
|
}
|
||||||
|
(function (is) {
|
||||||
|
// tslint:disable-next-line:strict-type-predicates
|
||||||
|
const isObject = (value) => typeof value === 'object';
|
||||||
|
// tslint:disable:variable-name
|
||||||
|
is.undefined = isOfType('undefined');
|
||||||
|
is.string = isOfType('string');
|
||||||
|
is.number = isOfType('number');
|
||||||
|
is.function_ = isOfType('function');
|
||||||
|
// tslint:disable-next-line:strict-type-predicates
|
||||||
|
is.null_ = (value) => value === null;
|
||||||
|
is.class_ = (value) => is.function_(value) && value.toString().startsWith('class ');
|
||||||
|
is.boolean = (value) => value === true || value === false;
|
||||||
|
is.symbol = isOfType('symbol');
|
||||||
|
// tslint:enable:variable-name
|
||||||
|
is.numericString = (value) => is.string(value) && value.length > 0 && !Number.isNaN(Number(value));
|
||||||
|
is.array = Array.isArray;
|
||||||
|
is.buffer = isBuffer;
|
||||||
|
is.nullOrUndefined = (value) => is.null_(value) || is.undefined(value);
|
||||||
|
is.object = (value) => !is.nullOrUndefined(value) && (is.function_(value) || isObject(value));
|
||||||
|
is.iterable = (value) => !is.nullOrUndefined(value) && is.function_(value[Symbol.iterator]);
|
||||||
|
is.asyncIterable = (value) => !is.nullOrUndefined(value) && is.function_(value[Symbol.asyncIterator]);
|
||||||
|
is.generator = (value) => is.iterable(value) && is.function_(value.next) && is.function_(value.throw);
|
||||||
|
is.nativePromise = (value) => isObjectOfType("Promise" /* Promise */)(value);
|
||||||
|
const hasPromiseAPI = (value) => !is.null_(value) &&
|
||||||
|
isObject(value) &&
|
||||||
|
is.function_(value.then) &&
|
||||||
|
is.function_(value.catch);
|
||||||
|
is.promise = (value) => is.nativePromise(value) || hasPromiseAPI(value);
|
||||||
|
is.generatorFunction = isObjectOfType("GeneratorFunction" /* GeneratorFunction */);
|
||||||
|
is.asyncFunction = isObjectOfType("AsyncFunction" /* AsyncFunction */);
|
||||||
|
is.boundFunction = (value) => is.function_(value) && !value.hasOwnProperty('prototype');
|
||||||
|
is.regExp = isObjectOfType("RegExp" /* RegExp */);
|
||||||
|
is.date = isObjectOfType("Date" /* Date */);
|
||||||
|
is.error = isObjectOfType("Error" /* Error */);
|
||||||
|
is.map = (value) => isObjectOfType("Map" /* Map */)(value);
|
||||||
|
is.set = (value) => isObjectOfType("Set" /* Set */)(value);
|
||||||
|
is.weakMap = (value) => isObjectOfType("WeakMap" /* WeakMap */)(value);
|
||||||
|
is.weakSet = (value) => isObjectOfType("WeakSet" /* WeakSet */)(value);
|
||||||
|
is.int8Array = isObjectOfType("Int8Array" /* Int8Array */);
|
||||||
|
is.uint8Array = isObjectOfType("Uint8Array" /* Uint8Array */);
|
||||||
|
is.uint8ClampedArray = isObjectOfType("Uint8ClampedArray" /* Uint8ClampedArray */);
|
||||||
|
is.int16Array = isObjectOfType("Int16Array" /* Int16Array */);
|
||||||
|
is.uint16Array = isObjectOfType("Uint16Array" /* Uint16Array */);
|
||||||
|
is.int32Array = isObjectOfType("Int32Array" /* Int32Array */);
|
||||||
|
is.uint32Array = isObjectOfType("Uint32Array" /* Uint32Array */);
|
||||||
|
is.float32Array = isObjectOfType("Float32Array" /* Float32Array */);
|
||||||
|
is.float64Array = isObjectOfType("Float64Array" /* Float64Array */);
|
||||||
|
is.arrayBuffer = isObjectOfType("ArrayBuffer" /* ArrayBuffer */);
|
||||||
|
is.sharedArrayBuffer = isObjectOfType("SharedArrayBuffer" /* SharedArrayBuffer */);
|
||||||
|
is.dataView = isObjectOfType("DataView" /* DataView */);
|
||||||
|
is.directInstanceOf = (instance, klass) => Object.getPrototypeOf(instance) === klass.prototype;
|
||||||
|
is.urlInstance = (value) => isObjectOfType("URL" /* URL */)(value);
|
||||||
|
is.urlString = (value) => {
|
||||||
|
if (!is.string(value)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
new URLGlobal(value); // tslint:disable-line no-unused-expression
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (_a) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
is.truthy = (value) => Boolean(value);
|
||||||
|
is.falsy = (value) => !value;
|
||||||
|
is.nan = (value) => Number.isNaN(value);
|
||||||
|
const primitiveTypes = new Set([
|
||||||
|
'undefined',
|
||||||
|
'string',
|
||||||
|
'number',
|
||||||
|
'boolean',
|
||||||
|
'symbol'
|
||||||
|
]);
|
||||||
|
is.primitive = (value) => is.null_(value) || primitiveTypes.has(typeof value);
|
||||||
|
is.integer = (value) => Number.isInteger(value);
|
||||||
|
is.safeInteger = (value) => Number.isSafeInteger(value);
|
||||||
|
is.plainObject = (value) => {
|
||||||
|
// From: https://github.com/sindresorhus/is-plain-obj/blob/master/index.js
|
||||||
|
let prototype;
|
||||||
|
return getObjectType(value) === "Object" /* Object */ &&
|
||||||
|
(prototype = Object.getPrototypeOf(value), prototype === null || // tslint:disable-line:ban-comma-operator
|
||||||
|
prototype === Object.getPrototypeOf({}));
|
||||||
|
};
|
||||||
|
const typedArrayTypes = new Set([
|
||||||
|
"Int8Array" /* Int8Array */,
|
||||||
|
"Uint8Array" /* Uint8Array */,
|
||||||
|
"Uint8ClampedArray" /* Uint8ClampedArray */,
|
||||||
|
"Int16Array" /* Int16Array */,
|
||||||
|
"Uint16Array" /* Uint16Array */,
|
||||||
|
"Int32Array" /* Int32Array */,
|
||||||
|
"Uint32Array" /* Uint32Array */,
|
||||||
|
"Float32Array" /* Float32Array */,
|
||||||
|
"Float64Array" /* Float64Array */
|
||||||
|
]);
|
||||||
|
is.typedArray = (value) => {
|
||||||
|
const objectType = getObjectType(value);
|
||||||
|
if (objectType === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return typedArrayTypes.has(objectType);
|
||||||
|
};
|
||||||
|
const isValidLength = (value) => is.safeInteger(value) && value > -1;
|
||||||
|
is.arrayLike = (value) => !is.nullOrUndefined(value) && !is.function_(value) && isValidLength(value.length);
|
||||||
|
is.inRange = (value, range) => {
|
||||||
|
if (is.number(range)) {
|
||||||
|
return value >= Math.min(0, range) && value <= Math.max(range, 0);
|
||||||
|
}
|
||||||
|
if (is.array(range) && range.length === 2) {
|
||||||
|
return value >= Math.min(...range) && value <= Math.max(...range);
|
||||||
|
}
|
||||||
|
throw new TypeError(`Invalid range: ${JSON.stringify(range)}`);
|
||||||
|
};
|
||||||
|
const NODE_TYPE_ELEMENT = 1;
|
||||||
|
const DOM_PROPERTIES_TO_CHECK = [
|
||||||
|
'innerHTML',
|
||||||
|
'ownerDocument',
|
||||||
|
'style',
|
||||||
|
'attributes',
|
||||||
|
'nodeValue'
|
||||||
|
];
|
||||||
|
is.domElement = (value) => is.object(value) && value.nodeType === NODE_TYPE_ELEMENT && is.string(value.nodeName) &&
|
||||||
|
!is.plainObject(value) && DOM_PROPERTIES_TO_CHECK.every(property => property in value);
|
||||||
|
is.observable = (value) => {
|
||||||
|
if (!value) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (value[Symbol.observable] && value === value[Symbol.observable]()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (value['@@observable'] && value === value['@@observable']()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
is.nodeStream = (value) => !is.nullOrUndefined(value) && isObject(value) && is.function_(value.pipe) && !is.observable(value);
|
||||||
|
is.infinite = (value) => value === Infinity || value === -Infinity;
|
||||||
|
const isAbsoluteMod2 = (rem) => (value) => is.integer(value) && Math.abs(value % 2) === rem;
|
||||||
|
is.even = isAbsoluteMod2(0);
|
||||||
|
is.odd = isAbsoluteMod2(1);
|
||||||
|
const isWhiteSpaceString = (value) => is.string(value) && /\S/.test(value) === false;
|
||||||
|
is.emptyArray = (value) => is.array(value) && value.length === 0;
|
||||||
|
is.nonEmptyArray = (value) => is.array(value) && value.length > 0;
|
||||||
|
is.emptyString = (value) => is.string(value) && value.length === 0;
|
||||||
|
is.nonEmptyString = (value) => is.string(value) && value.length > 0;
|
||||||
|
is.emptyStringOrWhitespace = (value) => is.emptyString(value) || isWhiteSpaceString(value);
|
||||||
|
is.emptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length === 0;
|
||||||
|
is.nonEmptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length > 0;
|
||||||
|
is.emptySet = (value) => is.set(value) && value.size === 0;
|
||||||
|
is.nonEmptySet = (value) => is.set(value) && value.size > 0;
|
||||||
|
is.emptyMap = (value) => is.map(value) && value.size === 0;
|
||||||
|
is.nonEmptyMap = (value) => is.map(value) && value.size > 0;
|
||||||
|
const predicateOnArray = (method, predicate, values) => {
|
||||||
|
if (is.function_(predicate) === false) {
|
||||||
|
throw new TypeError(`Invalid predicate: ${JSON.stringify(predicate)}`);
|
||||||
|
}
|
||||||
|
if (values.length === 0) {
|
||||||
|
throw new TypeError('Invalid number of values');
|
||||||
|
}
|
||||||
|
return method.call(values, predicate);
|
||||||
|
};
|
||||||
|
// tslint:disable variable-name
|
||||||
|
is.any = (predicate, ...values) => predicateOnArray(Array.prototype.some, predicate, values);
|
||||||
|
is.all = (predicate, ...values) => predicateOnArray(Array.prototype.every, predicate, values);
|
||||||
|
// tslint:enable variable-name
|
||||||
|
})(is || (is = {}));
|
||||||
|
// Some few keywords are reserved, but we'll populate them for Node.js users
|
||||||
|
// See https://github.com/Microsoft/TypeScript/issues/2536
|
||||||
|
Object.defineProperties(is, {
|
||||||
|
class: {
|
||||||
|
value: is.class_
|
||||||
|
},
|
||||||
|
function: {
|
||||||
|
value: is.function_
|
||||||
|
},
|
||||||
|
null: {
|
||||||
|
value: is.null_
|
||||||
|
}
|
||||||
|
});
|
||||||
|
exports.default = is;
|
||||||
|
// For CommonJS default export support
|
||||||
|
module.exports = is;
|
||||||
|
module.exports.default = is;
|
||||||
|
//# sourceMappingURL=index.js.map
|
1
node_modules/@sindresorhus/is/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@sindresorhus/is/dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
9
node_modules/@sindresorhus/is/license
generated
vendored
Normal file
9
node_modules/@sindresorhus/is/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
63
node_modules/@sindresorhus/is/package.json
generated
vendored
Normal file
63
node_modules/@sindresorhus/is/package.json
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"name": "@sindresorhus/is",
|
||||||
|
"version": "0.14.0",
|
||||||
|
"description": "Type check values: `is.string('🦄') //=> true`",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "sindresorhus/is",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint": "tslint --format stylish --project .",
|
||||||
|
"build": "del dist && tsc",
|
||||||
|
"test": "npm run lint && npm run build && ava dist/tests",
|
||||||
|
"prepublish": "npm run build && del dist/tests"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"type",
|
||||||
|
"types",
|
||||||
|
"is",
|
||||||
|
"check",
|
||||||
|
"checking",
|
||||||
|
"validate",
|
||||||
|
"validation",
|
||||||
|
"utility",
|
||||||
|
"util",
|
||||||
|
"typeof",
|
||||||
|
"instanceof",
|
||||||
|
"object",
|
||||||
|
"assert",
|
||||||
|
"assertion",
|
||||||
|
"test",
|
||||||
|
"kind",
|
||||||
|
"primitive",
|
||||||
|
"verify",
|
||||||
|
"compare"
|
||||||
|
],
|
||||||
|
"devDependencies": {
|
||||||
|
"@sindresorhus/tsconfig": "^0.1.0",
|
||||||
|
"@types/jsdom": "^11.12.0",
|
||||||
|
"@types/node": "^10.12.10",
|
||||||
|
"@types/tempy": "^0.2.0",
|
||||||
|
"@types/zen-observable": "^0.8.0",
|
||||||
|
"ava": "^0.25.0",
|
||||||
|
"del-cli": "^1.1.0",
|
||||||
|
"jsdom": "^11.6.2",
|
||||||
|
"rxjs": "^6.3.3",
|
||||||
|
"tempy": "^0.2.1",
|
||||||
|
"tslint": "^5.9.1",
|
||||||
|
"tslint-xo": "^0.10.0",
|
||||||
|
"typescript": "^3.2.1",
|
||||||
|
"zen-observable": "^0.8.8"
|
||||||
|
},
|
||||||
|
"types": "dist/index.d.ts"
|
||||||
|
}
|
451
node_modules/@sindresorhus/is/readme.md
generated
vendored
Normal file
451
node_modules/@sindresorhus/is/readme.md
generated
vendored
Normal file
@ -0,0 +1,451 @@
|
|||||||
|
# is [![Build Status](https://travis-ci.org/sindresorhus/is.svg?branch=master)](https://travis-ci.org/sindresorhus/is)
|
||||||
|
|
||||||
|
> Type check values: `is.string('🦄') //=> true`
|
||||||
|
|
||||||
|
<img src="header.gif" width="182" align="right">
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install @sindresorhus/is
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const is = require('@sindresorhus/is');
|
||||||
|
|
||||||
|
is('🦄');
|
||||||
|
//=> 'string'
|
||||||
|
|
||||||
|
is(new Map());
|
||||||
|
//=> 'Map'
|
||||||
|
|
||||||
|
is.number(6);
|
||||||
|
//=> true
|
||||||
|
```
|
||||||
|
|
||||||
|
When using `is` together with TypeScript, [type guards](http://www.typescriptlang.org/docs/handbook/advanced-types.html#type-guards-and-differentiating-types) are being used to infer the correct type inside if-else statements.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import is from '@sindresorhus/is';
|
||||||
|
|
||||||
|
const padLeft = (value: string, padding: string | number) => {
|
||||||
|
if (is.number(padding)) {
|
||||||
|
// `padding` is typed as `number`
|
||||||
|
return Array(padding + 1).join(' ') + value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is.string(padding)) {
|
||||||
|
// `padding` is typed as `string`
|
||||||
|
return padding + value;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new TypeError(`Expected 'padding' to be of type 'string' or 'number', got '${is(padding)}'.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
padLeft('🦄', 3);
|
||||||
|
//=> ' 🦄'
|
||||||
|
|
||||||
|
padLeft('🦄', '🌈');
|
||||||
|
//=> '🌈🦄'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### is(value)
|
||||||
|
|
||||||
|
Returns the type of `value`.
|
||||||
|
|
||||||
|
Primitives are lowercase and object types are camelcase.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
- `'undefined'`
|
||||||
|
- `'null'`
|
||||||
|
- `'string'`
|
||||||
|
- `'symbol'`
|
||||||
|
- `'Array'`
|
||||||
|
- `'Function'`
|
||||||
|
- `'Object'`
|
||||||
|
|
||||||
|
Note: It will throw an error if you try to feed it object-wrapped primitives, as that's a bad practice. For example `new String('foo')`.
|
||||||
|
|
||||||
|
### is.{method}
|
||||||
|
|
||||||
|
All the below methods accept a value and returns a boolean for whether the value is of the desired type.
|
||||||
|
|
||||||
|
#### Primitives
|
||||||
|
|
||||||
|
##### .undefined(value)
|
||||||
|
##### .null(value)
|
||||||
|
##### .string(value)
|
||||||
|
##### .number(value)
|
||||||
|
##### .boolean(value)
|
||||||
|
##### .symbol(value)
|
||||||
|
|
||||||
|
#### Built-in types
|
||||||
|
|
||||||
|
##### .array(value)
|
||||||
|
##### .function(value)
|
||||||
|
##### .buffer(value)
|
||||||
|
##### .object(value)
|
||||||
|
|
||||||
|
Keep in mind that [functions are objects too](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions).
|
||||||
|
|
||||||
|
##### .numericString(value)
|
||||||
|
|
||||||
|
Returns `true` for a string that represents a number. For example, `'42'` and `'-8'`.
|
||||||
|
|
||||||
|
Note: `'NaN'` returns `false`, but `'Infinity'` and `'-Infinity'` return `true`.
|
||||||
|
|
||||||
|
##### .regExp(value)
|
||||||
|
##### .date(value)
|
||||||
|
##### .error(value)
|
||||||
|
##### .nativePromise(value)
|
||||||
|
##### .promise(value)
|
||||||
|
|
||||||
|
Returns `true` for any object with a `.then()` and `.catch()` method. Prefer this one over `.nativePromise()` as you usually want to allow userland promise implementations too.
|
||||||
|
|
||||||
|
##### .generator(value)
|
||||||
|
|
||||||
|
Returns `true` for any object that implements its own `.next()` and `.throw()` methods and has a function definition for `Symbol.iterator`.
|
||||||
|
|
||||||
|
##### .generatorFunction(value)
|
||||||
|
|
||||||
|
##### .asyncFunction(value)
|
||||||
|
|
||||||
|
Returns `true` for any `async` function that can be called with the `await` operator.
|
||||||
|
|
||||||
|
```js
|
||||||
|
is.asyncFunction(async () => {});
|
||||||
|
// => true
|
||||||
|
|
||||||
|
is.asyncFunction(() => {});
|
||||||
|
// => false
|
||||||
|
```
|
||||||
|
|
||||||
|
##### .boundFunction(value)
|
||||||
|
|
||||||
|
Returns `true` for any `bound` function.
|
||||||
|
|
||||||
|
```js
|
||||||
|
is.boundFunction(() => {});
|
||||||
|
// => true
|
||||||
|
|
||||||
|
is.boundFunction(function () {}.bind(null));
|
||||||
|
// => true
|
||||||
|
|
||||||
|
is.boundFunction(function () {});
|
||||||
|
// => false
|
||||||
|
```
|
||||||
|
|
||||||
|
##### .map(value)
|
||||||
|
##### .set(value)
|
||||||
|
##### .weakMap(value)
|
||||||
|
##### .weakSet(value)
|
||||||
|
|
||||||
|
#### Typed arrays
|
||||||
|
|
||||||
|
##### .int8Array(value)
|
||||||
|
##### .uint8Array(value)
|
||||||
|
##### .uint8ClampedArray(value)
|
||||||
|
##### .int16Array(value)
|
||||||
|
##### .uint16Array(value)
|
||||||
|
##### .int32Array(value)
|
||||||
|
##### .uint32Array(value)
|
||||||
|
##### .float32Array(value)
|
||||||
|
##### .float64Array(value)
|
||||||
|
|
||||||
|
#### Structured data
|
||||||
|
|
||||||
|
##### .arrayBuffer(value)
|
||||||
|
##### .sharedArrayBuffer(value)
|
||||||
|
##### .dataView(value)
|
||||||
|
|
||||||
|
#### Emptiness
|
||||||
|
|
||||||
|
##### .emptyString(value)
|
||||||
|
|
||||||
|
Returns `true` if the value is a `string` and the `.length` is 0.
|
||||||
|
|
||||||
|
##### .nonEmptyString(value)
|
||||||
|
|
||||||
|
Returns `true` if the value is a `string` and the `.length` is more than 0.
|
||||||
|
|
||||||
|
##### .emptyStringOrWhitespace(value)
|
||||||
|
|
||||||
|
Returns `true` if `is.emptyString(value)` or if it's a `string` that is all whitespace.
|
||||||
|
|
||||||
|
##### .emptyArray(value)
|
||||||
|
|
||||||
|
Returns `true` if the value is an `Array` and the `.length` is 0.
|
||||||
|
|
||||||
|
##### .nonEmptyArray(value)
|
||||||
|
|
||||||
|
Returns `true` if the value is an `Array` and the `.length` is more than 0.
|
||||||
|
|
||||||
|
##### .emptyObject(value)
|
||||||
|
|
||||||
|
Returns `true` if the value is an `Object` and `Object.keys(value).length` is 0.
|
||||||
|
|
||||||
|
Please note that `Object.keys` returns only own enumerable properties. Hence something like this can happen:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const object1 = {};
|
||||||
|
|
||||||
|
Object.defineProperty(object1, 'property1', {
|
||||||
|
value: 42,
|
||||||
|
writable: true,
|
||||||
|
enumerable: false,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
|
||||||
|
is.emptyObject(object1);
|
||||||
|
// => true
|
||||||
|
```
|
||||||
|
|
||||||
|
##### .nonEmptyObject(value)
|
||||||
|
|
||||||
|
Returns `true` if the value is an `Object` and `Object.keys(value).length` is more than 0.
|
||||||
|
|
||||||
|
##### .emptySet(value)
|
||||||
|
|
||||||
|
Returns `true` if the value is a `Set` and the `.size` is 0.
|
||||||
|
|
||||||
|
##### .nonEmptySet(Value)
|
||||||
|
|
||||||
|
Returns `true` if the value is a `Set` and the `.size` is more than 0.
|
||||||
|
|
||||||
|
##### .emptyMap(value)
|
||||||
|
|
||||||
|
Returns `true` if the value is a `Map` and the `.size` is 0.
|
||||||
|
|
||||||
|
##### .nonEmptyMap(value)
|
||||||
|
|
||||||
|
Returns `true` if the value is a `Map` and the `.size` is more than 0.
|
||||||
|
|
||||||
|
#### Miscellaneous
|
||||||
|
|
||||||
|
##### .directInstanceOf(value, class)
|
||||||
|
|
||||||
|
Returns `true` if `value` is a direct instance of `class`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
is.directInstanceOf(new Error(), Error);
|
||||||
|
//=> true
|
||||||
|
|
||||||
|
class UnicornError extends Error {}
|
||||||
|
|
||||||
|
is.directInstanceOf(new UnicornError(), Error);
|
||||||
|
//=> false
|
||||||
|
```
|
||||||
|
|
||||||
|
##### .urlInstance(value)
|
||||||
|
|
||||||
|
Returns `true` if `value` is an instance of the [`URL` class](https://developer.mozilla.org/en-US/docs/Web/API/URL).
|
||||||
|
|
||||||
|
```js
|
||||||
|
const url = new URL('https://example.com');
|
||||||
|
|
||||||
|
is.urlInstance(url);
|
||||||
|
//=> true
|
||||||
|
```
|
||||||
|
|
||||||
|
### .url(value)
|
||||||
|
|
||||||
|
Returns `true` if `value` is a URL string.
|
||||||
|
|
||||||
|
Note: this only does basic checking using the [`URL` class](https://developer.mozilla.org/en-US/docs/Web/API/URL) constructor.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const url = 'https://example.com';
|
||||||
|
|
||||||
|
is.url(url);
|
||||||
|
//=> true
|
||||||
|
|
||||||
|
is.url(new URL(url));
|
||||||
|
//=> false
|
||||||
|
```
|
||||||
|
|
||||||
|
##### .truthy(value)
|
||||||
|
|
||||||
|
Returns `true` for all values that evaluate to true in a boolean context:
|
||||||
|
|
||||||
|
```js
|
||||||
|
is.truthy('🦄');
|
||||||
|
//=> true
|
||||||
|
|
||||||
|
is.truthy(undefined);
|
||||||
|
//=> false
|
||||||
|
```
|
||||||
|
|
||||||
|
##### .falsy(value)
|
||||||
|
|
||||||
|
Returns `true` if `value` is one of: `false`, `0`, `''`, `null`, `undefined`, `NaN`.
|
||||||
|
|
||||||
|
##### .nan(value)
|
||||||
|
##### .nullOrUndefined(value)
|
||||||
|
##### .primitive(value)
|
||||||
|
|
||||||
|
JavaScript primitives are as follows: `null`, `undefined`, `string`, `number`, `boolean`, `symbol`.
|
||||||
|
|
||||||
|
##### .integer(value)
|
||||||
|
|
||||||
|
##### .safeInteger(value)
|
||||||
|
|
||||||
|
Returns `true` if `value` is a [safe integer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger).
|
||||||
|
|
||||||
|
##### .plainObject(value)
|
||||||
|
|
||||||
|
An object is plain if it's created by either `{}`, `new Object()`, or `Object.create(null)`.
|
||||||
|
|
||||||
|
##### .iterable(value)
|
||||||
|
##### .asyncIterable(value)
|
||||||
|
##### .class(value)
|
||||||
|
|
||||||
|
Returns `true` for instances created by a class.
|
||||||
|
|
||||||
|
##### .typedArray(value)
|
||||||
|
|
||||||
|
##### .arrayLike(value)
|
||||||
|
|
||||||
|
A `value` is array-like if it is not a function and has a `value.length` that is a safe integer greater than or equal to 0.
|
||||||
|
|
||||||
|
```js
|
||||||
|
is.arrayLike(document.forms);
|
||||||
|
//=> true
|
||||||
|
|
||||||
|
function foo() {
|
||||||
|
is.arrayLike(arguments);
|
||||||
|
//=> true
|
||||||
|
}
|
||||||
|
foo();
|
||||||
|
```
|
||||||
|
|
||||||
|
##### .inRange(value, range)
|
||||||
|
|
||||||
|
Check if `value` (number) is in the given `range`. The range is an array of two values, lower bound and upper bound, in no specific order.
|
||||||
|
|
||||||
|
```js
|
||||||
|
is.inRange(3, [0, 5]);
|
||||||
|
is.inRange(3, [5, 0]);
|
||||||
|
is.inRange(0, [-2, 2]);
|
||||||
|
```
|
||||||
|
|
||||||
|
##### .inRange(value, upperBound)
|
||||||
|
|
||||||
|
Check if `value` (number) is in the range of `0` to `upperBound`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
is.inRange(3, 10);
|
||||||
|
```
|
||||||
|
|
||||||
|
##### .domElement(value)
|
||||||
|
|
||||||
|
Returns `true` if `value` is a DOM Element.
|
||||||
|
|
||||||
|
##### .nodeStream(value)
|
||||||
|
|
||||||
|
Returns `true` if `value` is a Node.js [stream](https://nodejs.org/api/stream.html).
|
||||||
|
|
||||||
|
```js
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
is.nodeStream(fs.createReadStream('unicorn.png'));
|
||||||
|
//=> true
|
||||||
|
```
|
||||||
|
|
||||||
|
##### .observable(value)
|
||||||
|
|
||||||
|
Returns `true` if `value` is an `Observable`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const {Observable} = require('rxjs');
|
||||||
|
|
||||||
|
is.observable(new Observable());
|
||||||
|
//=> true
|
||||||
|
```
|
||||||
|
|
||||||
|
##### .infinite(value)
|
||||||
|
|
||||||
|
Check if `value` is `Infinity` or `-Infinity`.
|
||||||
|
|
||||||
|
##### .even(value)
|
||||||
|
|
||||||
|
Returns `true` if `value` is an even integer.
|
||||||
|
|
||||||
|
##### .odd(value)
|
||||||
|
|
||||||
|
Returns `true` if `value` is an odd integer.
|
||||||
|
|
||||||
|
##### .any(predicate, ...values)
|
||||||
|
|
||||||
|
Returns `true` if **any** of the input `values` returns true in the `predicate`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
is.any(is.string, {}, true, '🦄');
|
||||||
|
//=> true
|
||||||
|
|
||||||
|
is.any(is.boolean, 'unicorns', [], new Map());
|
||||||
|
//=> false
|
||||||
|
```
|
||||||
|
|
||||||
|
##### .all(predicate, ...values)
|
||||||
|
|
||||||
|
Returns `true` if **all** of the input `values` returns true in the `predicate`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
is.all(is.object, {}, new Map(), new Set());
|
||||||
|
//=> true
|
||||||
|
|
||||||
|
is.all(is.string, '🦄', [], 'unicorns');
|
||||||
|
//=> false
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### Why yet another type checking module?
|
||||||
|
|
||||||
|
There are hundreds of type checking modules on npm, unfortunately, I couldn't find any that fit my needs:
|
||||||
|
|
||||||
|
- Includes both type methods and ability to get the type
|
||||||
|
- Types of primitives returned as lowercase and object types as camelcase
|
||||||
|
- Covers all built-ins
|
||||||
|
- Unsurprising behavior
|
||||||
|
- Well-maintained
|
||||||
|
- Comprehensive test suite
|
||||||
|
|
||||||
|
For the ones I found, pick 3 of these.
|
||||||
|
|
||||||
|
The most common mistakes I noticed in these modules was using `instanceof` for type checking, forgetting that functions are objects, and omitting `symbol` as a primitive.
|
||||||
|
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
- [ow](https://github.com/sindresorhus/ow) - Function argument validation for humans
|
||||||
|
- [is-stream](https://github.com/sindresorhus/is-stream) - Check if something is a Node.js stream
|
||||||
|
- [is-observable](https://github.com/sindresorhus/is-observable) - Check if a value is an Observable
|
||||||
|
- [file-type](https://github.com/sindresorhus/file-type) - Detect the file type of a Buffer/Uint8Array
|
||||||
|
- [is-ip](https://github.com/sindresorhus/is-ip) - Check if a string is an IP address
|
||||||
|
- [is-array-sorted](https://github.com/sindresorhus/is-array-sorted) - Check if an Array is sorted
|
||||||
|
- [is-error-constructor](https://github.com/sindresorhus/is-error-constructor) - Check if a value is an error constructor
|
||||||
|
- [is-empty-iterable](https://github.com/sindresorhus/is-empty-iterable) - Check if an Iterable is empty
|
||||||
|
- [is-blob](https://github.com/sindresorhus/is-blob) - Check if a value is a Blob - File-like object of immutable, raw data
|
||||||
|
- [has-emoji](https://github.com/sindresorhus/has-emoji) - Check whether a string has any emoji
|
||||||
|
|
||||||
|
|
||||||
|
## Created by
|
||||||
|
|
||||||
|
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||||
|
- [Giora Guttsait](https://github.com/gioragutt)
|
||||||
|
- [Brandon Smith](https://github.com/brandon93s)
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
21
node_modules/@szmarczak/http-timer/LICENSE
generated
vendored
Normal file
21
node_modules/@szmarczak/http-timer/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018 Szymon Marczak
|
||||||
|
|
||||||
|
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.
|
70
node_modules/@szmarczak/http-timer/README.md
generated
vendored
Normal file
70
node_modules/@szmarczak/http-timer/README.md
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
# http-timer
|
||||||
|
> Timings for HTTP requests
|
||||||
|
|
||||||
|
[![Build Status](https://travis-ci.org/szmarczak/http-timer.svg?branch=master)](https://travis-ci.org/szmarczak/http-timer)
|
||||||
|
[![Coverage Status](https://coveralls.io/repos/github/szmarczak/http-timer/badge.svg?branch=master)](https://coveralls.io/github/szmarczak/http-timer?branch=master)
|
||||||
|
[![install size](https://packagephobia.now.sh/badge?p=@szmarczak/http-timer)](https://packagephobia.now.sh/result?p=@szmarczak/http-timer)
|
||||||
|
|
||||||
|
Inspired by the [`request` package](https://github.com/request/request).
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
```js
|
||||||
|
'use strict';
|
||||||
|
const https = require('https');
|
||||||
|
const timer = require('@szmarczak/http-timer');
|
||||||
|
|
||||||
|
const request = https.get('https://httpbin.org/anything');
|
||||||
|
const timings = timer(request);
|
||||||
|
|
||||||
|
request.on('response', response => {
|
||||||
|
response.on('data', () => {}); // Consume the data somehow
|
||||||
|
response.on('end', () => {
|
||||||
|
console.log(timings);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// { start: 1535708511443,
|
||||||
|
// socket: 1535708511444,
|
||||||
|
// lookup: 1535708511444,
|
||||||
|
// connect: 1535708511582,
|
||||||
|
// upload: 1535708511887,
|
||||||
|
// response: 1535708512037,
|
||||||
|
// end: 1535708512040,
|
||||||
|
// phases:
|
||||||
|
// { wait: 1,
|
||||||
|
// dns: 0,
|
||||||
|
// tcp: 138,
|
||||||
|
// request: 305,
|
||||||
|
// firstByte: 150,
|
||||||
|
// download: 3,
|
||||||
|
// total: 597 } }
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### timer(request)
|
||||||
|
|
||||||
|
Returns: `Object`
|
||||||
|
|
||||||
|
- `start` - Time when the request started.
|
||||||
|
- `socket` - Time when a socket was assigned to the request.
|
||||||
|
- `lookup` - Time when the DNS lookup finished.
|
||||||
|
- `connect` - Time when the socket successfully connected.
|
||||||
|
- `upload` - Time when the request finished uploading.
|
||||||
|
- `response` - Time when the request fired the `response` event.
|
||||||
|
- `end` - Time when the response fired the `end` event.
|
||||||
|
- `error` - Time when the request fired the `error` event.
|
||||||
|
- `phases`
|
||||||
|
- `wait` - `timings.socket - timings.start`
|
||||||
|
- `dns` - `timings.lookup - timings.socket`
|
||||||
|
- `tcp` - `timings.connect - timings.lookup`
|
||||||
|
- `request` - `timings.upload - timings.connect`
|
||||||
|
- `firstByte` - `timings.response - timings.upload`
|
||||||
|
- `download` - `timings.end - timings.response`
|
||||||
|
- `total` - `timings.end - timings.start` or `timings.error - timings.start`
|
||||||
|
|
||||||
|
**Note**: The time is a `number` representing the milliseconds elapsed since the UNIX epoch.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
47
node_modules/@szmarczak/http-timer/package.json
generated
vendored
Normal file
47
node_modules/@szmarczak/http-timer/package.json
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"name": "@szmarczak/http-timer",
|
||||||
|
"version": "1.1.2",
|
||||||
|
"description": "Timings for HTTP requests",
|
||||||
|
"main": "source",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && nyc ava",
|
||||||
|
"coveralls": "nyc report --reporter=text-lcov | coveralls"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"source"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"http",
|
||||||
|
"https",
|
||||||
|
"timer",
|
||||||
|
"timings"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/szmarczak/http-timer.git"
|
||||||
|
},
|
||||||
|
"author": "Szymon Marczak",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/szmarczak/http-timer/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/szmarczak/http-timer#readme",
|
||||||
|
"xo": {
|
||||||
|
"rules": {
|
||||||
|
"unicorn/filename-case": "camelCase"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "^0.25.0",
|
||||||
|
"coveralls": "^3.0.2",
|
||||||
|
"p-event": "^2.1.0",
|
||||||
|
"nyc": "^12.0.2",
|
||||||
|
"xo": "^0.22.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"defer-to-connect": "^1.0.1"
|
||||||
|
}
|
||||||
|
}
|
99
node_modules/@szmarczak/http-timer/source/index.js
generated
vendored
Normal file
99
node_modules/@szmarczak/http-timer/source/index.js
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
'use strict';
|
||||||
|
const deferToConnect = require('defer-to-connect');
|
||||||
|
|
||||||
|
module.exports = request => {
|
||||||
|
const timings = {
|
||||||
|
start: Date.now(),
|
||||||
|
socket: null,
|
||||||
|
lookup: null,
|
||||||
|
connect: null,
|
||||||
|
upload: null,
|
||||||
|
response: null,
|
||||||
|
end: null,
|
||||||
|
error: null,
|
||||||
|
phases: {
|
||||||
|
wait: null,
|
||||||
|
dns: null,
|
||||||
|
tcp: null,
|
||||||
|
request: null,
|
||||||
|
firstByte: null,
|
||||||
|
download: null,
|
||||||
|
total: null
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleError = origin => {
|
||||||
|
const emit = origin.emit.bind(origin);
|
||||||
|
origin.emit = (event, ...args) => {
|
||||||
|
// Catches the `error` event
|
||||||
|
if (event === 'error') {
|
||||||
|
timings.error = Date.now();
|
||||||
|
timings.phases.total = timings.error - timings.start;
|
||||||
|
|
||||||
|
origin.emit = emit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Saves the original behavior
|
||||||
|
return emit(event, ...args);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
let uploadFinished = false;
|
||||||
|
const onUpload = () => {
|
||||||
|
timings.upload = Date.now();
|
||||||
|
timings.phases.request = timings.upload - timings.connect;
|
||||||
|
};
|
||||||
|
|
||||||
|
handleError(request);
|
||||||
|
|
||||||
|
request.once('socket', socket => {
|
||||||
|
timings.socket = Date.now();
|
||||||
|
timings.phases.wait = timings.socket - timings.start;
|
||||||
|
|
||||||
|
const lookupListener = () => {
|
||||||
|
timings.lookup = Date.now();
|
||||||
|
timings.phases.dns = timings.lookup - timings.socket;
|
||||||
|
};
|
||||||
|
|
||||||
|
socket.once('lookup', lookupListener);
|
||||||
|
|
||||||
|
deferToConnect(socket, () => {
|
||||||
|
timings.connect = Date.now();
|
||||||
|
|
||||||
|
if (timings.lookup === null) {
|
||||||
|
socket.removeListener('lookup', lookupListener);
|
||||||
|
timings.lookup = timings.connect;
|
||||||
|
timings.phases.dns = timings.lookup - timings.socket;
|
||||||
|
}
|
||||||
|
|
||||||
|
timings.phases.tcp = timings.connect - timings.lookup;
|
||||||
|
|
||||||
|
if (uploadFinished && !timings.upload) {
|
||||||
|
onUpload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
request.once('finish', () => {
|
||||||
|
uploadFinished = true;
|
||||||
|
|
||||||
|
if (timings.connect) {
|
||||||
|
onUpload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
request.once('response', response => {
|
||||||
|
timings.response = Date.now();
|
||||||
|
timings.phases.firstByte = timings.response - timings.upload;
|
||||||
|
|
||||||
|
handleError(response);
|
||||||
|
|
||||||
|
response.once('end', () => {
|
||||||
|
timings.end = Date.now();
|
||||||
|
timings.phases.download = timings.end - timings.response;
|
||||||
|
timings.phases.total = timings.end - timings.start;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return timings;
|
||||||
|
};
|
21
node_modules/@types/node/LICENSE
generated
vendored
Normal file
21
node_modules/@types/node/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
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
|
16
node_modules/@types/node/README.md
generated
vendored
Normal file
16
node_modules/@types/node/README.md
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Installation
|
||||||
|
> `npm install --save @types/node`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for Node.js (https://nodejs.org/).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v16.
|
||||||
|
|
||||||
|
### Additional Details
|
||||||
|
* Last updated: Wed, 24 Aug 2022 03:02:34 GMT
|
||||||
|
* Dependencies: none
|
||||||
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Seth Westphal](https://github.com/westy92), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), and [wafuwafu13](https://github.com/wafuwafu13).
|
912
node_modules/@types/node/assert.d.ts
generated
vendored
Normal file
912
node_modules/@types/node/assert.d.ts
generated
vendored
Normal file
@ -0,0 +1,912 @@
|
|||||||
|
/**
|
||||||
|
* The `assert` module provides a set of assertion functions for verifying
|
||||||
|
* invariants.
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/assert.js)
|
||||||
|
*/
|
||||||
|
declare module 'assert' {
|
||||||
|
/**
|
||||||
|
* An alias of {@link ok}.
|
||||||
|
* @since v0.5.9
|
||||||
|
* @param value The input that is checked for being truthy.
|
||||||
|
*/
|
||||||
|
function assert(value: unknown, message?: string | Error): asserts value;
|
||||||
|
namespace assert {
|
||||||
|
/**
|
||||||
|
* Indicates the failure of an assertion. All errors thrown by the `assert` module
|
||||||
|
* will be instances of the `AssertionError` class.
|
||||||
|
*/
|
||||||
|
class AssertionError extends Error {
|
||||||
|
actual: unknown;
|
||||||
|
expected: unknown;
|
||||||
|
operator: string;
|
||||||
|
generatedMessage: boolean;
|
||||||
|
code: 'ERR_ASSERTION';
|
||||||
|
constructor(options?: {
|
||||||
|
/** If provided, the error message is set to this value. */
|
||||||
|
message?: string | undefined;
|
||||||
|
/** The `actual` property on the error instance. */
|
||||||
|
actual?: unknown | undefined;
|
||||||
|
/** The `expected` property on the error instance. */
|
||||||
|
expected?: unknown | undefined;
|
||||||
|
/** The `operator` property on the error instance. */
|
||||||
|
operator?: string | undefined;
|
||||||
|
/** If provided, the generated stack trace omits frames before this function. */
|
||||||
|
// tslint:disable-next-line:ban-types
|
||||||
|
stackStartFn?: Function | undefined;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This feature is currently experimental and behavior might still change.
|
||||||
|
* @since v14.2.0, v12.19.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
class CallTracker {
|
||||||
|
/**
|
||||||
|
* The wrapper function is expected to be called exactly `exact` times. If the
|
||||||
|
* function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an
|
||||||
|
* error.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert';
|
||||||
|
*
|
||||||
|
* // Creates call tracker.
|
||||||
|
* const tracker = new assert.CallTracker();
|
||||||
|
*
|
||||||
|
* function func() {}
|
||||||
|
*
|
||||||
|
* // Returns a function that wraps func() that must be called exact times
|
||||||
|
* // before tracker.verify().
|
||||||
|
* const callsfunc = tracker.calls(func);
|
||||||
|
* ```
|
||||||
|
* @since v14.2.0, v12.19.0
|
||||||
|
* @param [fn='A no-op function']
|
||||||
|
* @param [exact=1]
|
||||||
|
* @return that wraps `fn`.
|
||||||
|
*/
|
||||||
|
calls(exact?: number): () => void;
|
||||||
|
calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
|
||||||
|
/**
|
||||||
|
* The arrays contains information about the expected and actual number of calls of
|
||||||
|
* the functions that have not been called the expected number of times.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert';
|
||||||
|
*
|
||||||
|
* // Creates call tracker.
|
||||||
|
* const tracker = new assert.CallTracker();
|
||||||
|
*
|
||||||
|
* function func() {}
|
||||||
|
*
|
||||||
|
* function foo() {}
|
||||||
|
*
|
||||||
|
* // Returns a function that wraps func() that must be called exact times
|
||||||
|
* // before tracker.verify().
|
||||||
|
* const callsfunc = tracker.calls(func, 2);
|
||||||
|
*
|
||||||
|
* // Returns an array containing information on callsfunc()
|
||||||
|
* tracker.report();
|
||||||
|
* // [
|
||||||
|
* // {
|
||||||
|
* // message: 'Expected the func function to be executed 2 time(s) but was
|
||||||
|
* // executed 0 time(s).',
|
||||||
|
* // actual: 0,
|
||||||
|
* // expected: 2,
|
||||||
|
* // operator: 'func',
|
||||||
|
* // stack: stack trace
|
||||||
|
* // }
|
||||||
|
* // ]
|
||||||
|
* ```
|
||||||
|
* @since v14.2.0, v12.19.0
|
||||||
|
* @return of objects containing information about the wrapper functions returned by `calls`.
|
||||||
|
*/
|
||||||
|
report(): CallTrackerReportInformation[];
|
||||||
|
/**
|
||||||
|
* Iterates through the list of functions passed to `tracker.calls()` and will throw an error for functions that
|
||||||
|
* have not been called the expected number of times.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert';
|
||||||
|
*
|
||||||
|
* // Creates call tracker.
|
||||||
|
* const tracker = new assert.CallTracker();
|
||||||
|
*
|
||||||
|
* function func() {}
|
||||||
|
*
|
||||||
|
* // Returns a function that wraps func() that must be called exact times
|
||||||
|
* // before tracker.verify().
|
||||||
|
* const callsfunc = tracker.calls(func, 2);
|
||||||
|
*
|
||||||
|
* callsfunc();
|
||||||
|
*
|
||||||
|
* // Will throw an error since callsfunc() was only called once.
|
||||||
|
* tracker.verify();
|
||||||
|
* ```
|
||||||
|
* @since v14.2.0, v12.19.0
|
||||||
|
*/
|
||||||
|
verify(): void;
|
||||||
|
}
|
||||||
|
interface CallTrackerReportInformation {
|
||||||
|
message: string;
|
||||||
|
/** The actual number of times the function was called. */
|
||||||
|
actual: number;
|
||||||
|
/** The number of times the function was expected to be called. */
|
||||||
|
expected: number;
|
||||||
|
/** The name of the function that is wrapped. */
|
||||||
|
operator: string;
|
||||||
|
/** A stack trace of the function. */
|
||||||
|
stack: object;
|
||||||
|
}
|
||||||
|
type AssertPredicate = RegExp | (new () => object) | ((thrown: unknown) => boolean) | object | Error;
|
||||||
|
/**
|
||||||
|
* Throws an `AssertionError` with the provided error message or a default
|
||||||
|
* error message. If the `message` parameter is an instance of an `Error` then
|
||||||
|
* it will be thrown instead of the `AssertionError`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.fail();
|
||||||
|
* // AssertionError [ERR_ASSERTION]: Failed
|
||||||
|
*
|
||||||
|
* assert.fail('boom');
|
||||||
|
* // AssertionError [ERR_ASSERTION]: boom
|
||||||
|
*
|
||||||
|
* assert.fail(new TypeError('need array'));
|
||||||
|
* // TypeError: need array
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Using `assert.fail()` with more than two arguments is possible but deprecated.
|
||||||
|
* See below for further details.
|
||||||
|
* @since v0.1.21
|
||||||
|
* @param [message='Failed']
|
||||||
|
*/
|
||||||
|
function fail(message?: string | Error): never;
|
||||||
|
/** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
|
||||||
|
function fail(
|
||||||
|
actual: unknown,
|
||||||
|
expected: unknown,
|
||||||
|
message?: string | Error,
|
||||||
|
operator?: string,
|
||||||
|
// tslint:disable-next-line:ban-types
|
||||||
|
stackStartFn?: Function
|
||||||
|
): never;
|
||||||
|
/**
|
||||||
|
* Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`.
|
||||||
|
*
|
||||||
|
* If `value` is not truthy, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is `undefined`, a default
|
||||||
|
* error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
|
||||||
|
* If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``.
|
||||||
|
*
|
||||||
|
* Be aware that in the `repl` the error message will be different to the one
|
||||||
|
* thrown in a file! See below for further details.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.ok(true);
|
||||||
|
* // OK
|
||||||
|
* assert.ok(1);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.ok();
|
||||||
|
* // AssertionError: No value argument passed to `assert.ok()`
|
||||||
|
*
|
||||||
|
* assert.ok(false, 'it\'s false');
|
||||||
|
* // AssertionError: it's false
|
||||||
|
*
|
||||||
|
* // In the repl:
|
||||||
|
* assert.ok(typeof 123 === 'string');
|
||||||
|
* // AssertionError: false == true
|
||||||
|
*
|
||||||
|
* // In a file (e.g. test.js):
|
||||||
|
* assert.ok(typeof 123 === 'string');
|
||||||
|
* // AssertionError: The expression evaluated to a falsy value:
|
||||||
|
* //
|
||||||
|
* // assert.ok(typeof 123 === 'string')
|
||||||
|
*
|
||||||
|
* assert.ok(false);
|
||||||
|
* // AssertionError: The expression evaluated to a falsy value:
|
||||||
|
* //
|
||||||
|
* // assert.ok(false)
|
||||||
|
*
|
||||||
|
* assert.ok(0);
|
||||||
|
* // AssertionError: The expression evaluated to a falsy value:
|
||||||
|
* //
|
||||||
|
* // assert.ok(0)
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* // Using `assert()` works the same:
|
||||||
|
* assert(0);
|
||||||
|
* // AssertionError: The expression evaluated to a falsy value:
|
||||||
|
* //
|
||||||
|
* // assert(0)
|
||||||
|
* ```
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function ok(value: unknown, message?: string | Error): asserts value;
|
||||||
|
/**
|
||||||
|
* **Strict assertion mode**
|
||||||
|
*
|
||||||
|
* An alias of {@link strictEqual}.
|
||||||
|
*
|
||||||
|
* **Legacy assertion mode**
|
||||||
|
*
|
||||||
|
* > Stability: 3 - Legacy: Use {@link strictEqual} instead.
|
||||||
|
*
|
||||||
|
* Tests shallow, coercive equality between the `actual` and `expected` parameters
|
||||||
|
* using the [Abstract Equality Comparison](https://tc39.github.io/ecma262/#sec-abstract-equality-comparison) ( `==` ). `NaN` is special handled
|
||||||
|
* and treated as being identical in case both sides are `NaN`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert';
|
||||||
|
*
|
||||||
|
* assert.equal(1, 1);
|
||||||
|
* // OK, 1 == 1
|
||||||
|
* assert.equal(1, '1');
|
||||||
|
* // OK, 1 == '1'
|
||||||
|
* assert.equal(NaN, NaN);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.equal(1, 2);
|
||||||
|
* // AssertionError: 1 == 2
|
||||||
|
* assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
|
||||||
|
* // AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are not equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default
|
||||||
|
* error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function equal(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* **Strict assertion mode**
|
||||||
|
*
|
||||||
|
* An alias of {@link notStrictEqual}.
|
||||||
|
*
|
||||||
|
* **Legacy assertion mode**
|
||||||
|
*
|
||||||
|
* > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
|
||||||
|
*
|
||||||
|
* Tests shallow, coercive inequality with the [Abstract Equality Comparison](https://tc39.github.io/ecma262/#sec-abstract-equality-comparison)(`!=` ). `NaN` is special handled and treated as
|
||||||
|
* being identical in case both
|
||||||
|
* sides are `NaN`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert';
|
||||||
|
*
|
||||||
|
* assert.notEqual(1, 2);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.notEqual(1, 1);
|
||||||
|
* // AssertionError: 1 != 1
|
||||||
|
*
|
||||||
|
* assert.notEqual(1, '1');
|
||||||
|
* // AssertionError: 1 != '1'
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default error
|
||||||
|
* message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* **Strict assertion mode**
|
||||||
|
*
|
||||||
|
* An alias of {@link deepStrictEqual}.
|
||||||
|
*
|
||||||
|
* **Legacy assertion mode**
|
||||||
|
*
|
||||||
|
* > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead.
|
||||||
|
*
|
||||||
|
* Tests for deep equality between the `actual` and `expected` parameters. Consider
|
||||||
|
* using {@link deepStrictEqual} instead. {@link deepEqual} can have
|
||||||
|
* surprising results.
|
||||||
|
*
|
||||||
|
* _Deep equality_ means that the enumerable "own" properties of child objects
|
||||||
|
* are also recursively evaluated by the following rules.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* **Strict assertion mode**
|
||||||
|
*
|
||||||
|
* An alias of {@link notDeepStrictEqual}.
|
||||||
|
*
|
||||||
|
* **Legacy assertion mode**
|
||||||
|
*
|
||||||
|
* > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead.
|
||||||
|
*
|
||||||
|
* Tests for any deep inequality. Opposite of {@link deepEqual}.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert';
|
||||||
|
*
|
||||||
|
* const obj1 = {
|
||||||
|
* a: {
|
||||||
|
* b: 1
|
||||||
|
* }
|
||||||
|
* };
|
||||||
|
* const obj2 = {
|
||||||
|
* a: {
|
||||||
|
* b: 2
|
||||||
|
* }
|
||||||
|
* };
|
||||||
|
* const obj3 = {
|
||||||
|
* a: {
|
||||||
|
* b: 1
|
||||||
|
* }
|
||||||
|
* };
|
||||||
|
* const obj4 = Object.create(obj1);
|
||||||
|
*
|
||||||
|
* assert.notDeepEqual(obj1, obj1);
|
||||||
|
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
|
||||||
|
*
|
||||||
|
* assert.notDeepEqual(obj1, obj2);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.notDeepEqual(obj1, obj3);
|
||||||
|
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
|
||||||
|
*
|
||||||
|
* assert.notDeepEqual(obj1, obj4);
|
||||||
|
* // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are deeply equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a default
|
||||||
|
* error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
|
||||||
|
* instead of the `AssertionError`.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Tests strict equality between the `actual` and `expected` parameters as
|
||||||
|
* determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.strictEqual(1, 2);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
|
||||||
|
* //
|
||||||
|
* // 1 !== 2
|
||||||
|
*
|
||||||
|
* assert.strictEqual(1, 1);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.strictEqual('Hello foobar', 'Hello World!');
|
||||||
|
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
|
||||||
|
* // + actual - expected
|
||||||
|
* //
|
||||||
|
* // + 'Hello foobar'
|
||||||
|
* // - 'Hello World!'
|
||||||
|
* // ^
|
||||||
|
*
|
||||||
|
* const apples = 1;
|
||||||
|
* const oranges = 2;
|
||||||
|
* assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2
|
||||||
|
*
|
||||||
|
* assert.strictEqual(1, '1', new TypeError('Inputs are not identical'));
|
||||||
|
* // TypeError: Inputs are not identical
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are not strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
|
||||||
|
* default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
|
||||||
|
* instead of the `AssertionError`.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
||||||
|
/**
|
||||||
|
* Tests strict inequality between the `actual` and `expected` parameters as
|
||||||
|
* determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.notStrictEqual(1, 2);
|
||||||
|
* // OK
|
||||||
|
*
|
||||||
|
* assert.notStrictEqual(1, 1);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to:
|
||||||
|
* //
|
||||||
|
* // 1
|
||||||
|
*
|
||||||
|
* assert.notStrictEqual(1, '1');
|
||||||
|
* // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
|
||||||
|
* default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
|
||||||
|
* instead of the `AssertionError`.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Tests for deep equality between the `actual` and `expected` parameters.
|
||||||
|
* "Deep" equality means that the enumerable "own" properties of child objects
|
||||||
|
* are recursively evaluated also by the following rules.
|
||||||
|
* @since v1.2.0
|
||||||
|
*/
|
||||||
|
function deepStrictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
|
||||||
|
/**
|
||||||
|
* Tests for deep strict inequality. Opposite of {@link deepStrictEqual}.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
|
||||||
|
* // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values are deeply and strictly equal, an `AssertionError` is thrown
|
||||||
|
* with a `message` property set equal to the value of the `message` parameter. If
|
||||||
|
* the `message` parameter is undefined, a default error message is assigned. If
|
||||||
|
* the `message` parameter is an instance of an `Error` then it will be thrown
|
||||||
|
* instead of the `AssertionError`.
|
||||||
|
* @since v1.2.0
|
||||||
|
*/
|
||||||
|
function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Expects the function `fn` to throw an error.
|
||||||
|
*
|
||||||
|
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
||||||
|
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
|
||||||
|
* a validation object where each property will be tested for strict deep equality,
|
||||||
|
* or an instance of error where each property will be tested for strict deep
|
||||||
|
* equality including the non-enumerable `message` and `name` properties. When
|
||||||
|
* using an object, it is also possible to use a regular expression, when
|
||||||
|
* validating against a string property. See below for examples.
|
||||||
|
*
|
||||||
|
* If specified, `message` will be appended to the message provided by the`AssertionError` if the `fn` call fails to throw or in case the error validation
|
||||||
|
* fails.
|
||||||
|
*
|
||||||
|
* Custom validation object/error instance:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* const err = new TypeError('Wrong value');
|
||||||
|
* err.code = 404;
|
||||||
|
* err.foo = 'bar';
|
||||||
|
* err.info = {
|
||||||
|
* nested: true,
|
||||||
|
* baz: 'text'
|
||||||
|
* };
|
||||||
|
* err.reg = /abc/i;
|
||||||
|
*
|
||||||
|
* assert.throws(
|
||||||
|
* () => {
|
||||||
|
* throw err;
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* name: 'TypeError',
|
||||||
|
* message: 'Wrong value',
|
||||||
|
* info: {
|
||||||
|
* nested: true,
|
||||||
|
* baz: 'text'
|
||||||
|
* }
|
||||||
|
* // Only properties on the validation object will be tested for.
|
||||||
|
* // Using nested objects requires all properties to be present. Otherwise
|
||||||
|
* // the validation is going to fail.
|
||||||
|
* }
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* // Using regular expressions to validate error properties:
|
||||||
|
* throws(
|
||||||
|
* () => {
|
||||||
|
* throw err;
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* // The `name` and `message` properties are strings and using regular
|
||||||
|
* // expressions on those will match against the string. If they fail, an
|
||||||
|
* // error is thrown.
|
||||||
|
* name: /^TypeError$/,
|
||||||
|
* message: /Wrong/,
|
||||||
|
* foo: 'bar',
|
||||||
|
* info: {
|
||||||
|
* nested: true,
|
||||||
|
* // It is not possible to use regular expressions for nested properties!
|
||||||
|
* baz: 'text'
|
||||||
|
* },
|
||||||
|
* // The `reg` property contains a regular expression and only if the
|
||||||
|
* // validation object contains an identical regular expression, it is going
|
||||||
|
* // to pass.
|
||||||
|
* reg: /abc/i
|
||||||
|
* }
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* // Fails due to the different `message` and `name` properties:
|
||||||
|
* throws(
|
||||||
|
* () => {
|
||||||
|
* const otherErr = new Error('Not found');
|
||||||
|
* // Copy all enumerable properties from `err` to `otherErr`.
|
||||||
|
* for (const [key, value] of Object.entries(err)) {
|
||||||
|
* otherErr[key] = value;
|
||||||
|
* }
|
||||||
|
* throw otherErr;
|
||||||
|
* },
|
||||||
|
* // The error's `message` and `name` properties will also be checked when using
|
||||||
|
* // an error as validation object.
|
||||||
|
* err
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Validate instanceof using constructor:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.throws(
|
||||||
|
* () => {
|
||||||
|
* throw new Error('Wrong value');
|
||||||
|
* },
|
||||||
|
* Error
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions):
|
||||||
|
*
|
||||||
|
* Using a regular expression runs `.toString` on the error object, and will
|
||||||
|
* therefore also include the error name.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.throws(
|
||||||
|
* () => {
|
||||||
|
* throw new Error('Wrong value');
|
||||||
|
* },
|
||||||
|
* /^Error: Wrong value$/
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Custom error validation:
|
||||||
|
*
|
||||||
|
* The function must return `true` to indicate all internal validations passed.
|
||||||
|
* It will otherwise fail with an `AssertionError`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.throws(
|
||||||
|
* () => {
|
||||||
|
* throw new Error('Wrong value');
|
||||||
|
* },
|
||||||
|
* (err) => {
|
||||||
|
* assert(err instanceof Error);
|
||||||
|
* assert(/value/.test(err));
|
||||||
|
* // Avoid returning anything from validation functions besides `true`.
|
||||||
|
* // Otherwise, it's not clear what part of the validation failed. Instead,
|
||||||
|
* // throw an error about the specific validation that failed (as done in this
|
||||||
|
* // example) and add as much helpful debugging information to that error as
|
||||||
|
* // possible.
|
||||||
|
* return true;
|
||||||
|
* },
|
||||||
|
* 'unexpected error'
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* `error` cannot be a string. If a string is provided as the second
|
||||||
|
* argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Using the same
|
||||||
|
* message as the thrown error message is going to result in an`ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
|
||||||
|
* a string as the second argument gets considered:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* function throwingFirst() {
|
||||||
|
* throw new Error('First');
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* function throwingSecond() {
|
||||||
|
* throw new Error('Second');
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* function notThrowing() {}
|
||||||
|
*
|
||||||
|
* // The second argument is a string and the input function threw an Error.
|
||||||
|
* // The first case will not throw as it does not match for the error message
|
||||||
|
* // thrown by the input function!
|
||||||
|
* assert.throws(throwingFirst, 'Second');
|
||||||
|
* // In the next example the message has no benefit over the message from the
|
||||||
|
* // error and since it is not clear if the user intended to actually match
|
||||||
|
* // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error.
|
||||||
|
* assert.throws(throwingSecond, 'Second');
|
||||||
|
* // TypeError [ERR_AMBIGUOUS_ARGUMENT]
|
||||||
|
*
|
||||||
|
* // The string is only used (as message) in case the function does not throw:
|
||||||
|
* assert.throws(notThrowing, 'Second');
|
||||||
|
* // AssertionError [ERR_ASSERTION]: Missing expected exception: Second
|
||||||
|
*
|
||||||
|
* // If it was intended to match for the error message do this instead:
|
||||||
|
* // It does not throw because the error messages match.
|
||||||
|
* assert.throws(throwingSecond, /Second$/);
|
||||||
|
*
|
||||||
|
* // If the error message does not match, an AssertionError is thrown.
|
||||||
|
* assert.throws(throwingFirst, /Second$/);
|
||||||
|
* // AssertionError [ERR_ASSERTION]
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Due to the confusing error-prone notation, avoid a string as the second
|
||||||
|
* argument.
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function throws(block: () => unknown, message?: string | Error): void;
|
||||||
|
function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Asserts that the function `fn` does not throw an error.
|
||||||
|
*
|
||||||
|
* Using `assert.doesNotThrow()` is actually not useful because there
|
||||||
|
* is no benefit in catching an error and then rethrowing it. Instead, consider
|
||||||
|
* adding a comment next to the specific code path that should not throw and keep
|
||||||
|
* error messages as expressive as possible.
|
||||||
|
*
|
||||||
|
* When `assert.doesNotThrow()` is called, it will immediately call the `fn`function.
|
||||||
|
*
|
||||||
|
* If an error is thrown and it is the same type as that specified by the `error`parameter, then an `AssertionError` is thrown. If the error is of a
|
||||||
|
* different type, or if the `error` parameter is undefined, the error is
|
||||||
|
* propagated back to the caller.
|
||||||
|
*
|
||||||
|
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
||||||
|
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
|
||||||
|
* function. See {@link throws} for more details.
|
||||||
|
*
|
||||||
|
* The following, for instance, will throw the `TypeError` because there is no
|
||||||
|
* matching error type in the assertion:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.doesNotThrow(
|
||||||
|
* () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* SyntaxError
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* However, the following will result in an `AssertionError` with the message
|
||||||
|
* 'Got unwanted exception...':
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.doesNotThrow(
|
||||||
|
* () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* TypeError
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.doesNotThrow(
|
||||||
|
* () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* /Wrong value/,
|
||||||
|
* 'Whoops'
|
||||||
|
* );
|
||||||
|
* // Throws: AssertionError: Got unwanted exception: Whoops
|
||||||
|
* ```
|
||||||
|
* @since v0.1.21
|
||||||
|
*/
|
||||||
|
function doesNotThrow(block: () => unknown, message?: string | Error): void;
|
||||||
|
function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Throws `value` if `value` is not `undefined` or `null`. This is useful when
|
||||||
|
* testing the `error` argument in callbacks. The stack trace contains all frames
|
||||||
|
* from the error passed to `ifError()` including the potential new frames for`ifError()` itself.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.ifError(null);
|
||||||
|
* // OK
|
||||||
|
* assert.ifError(0);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0
|
||||||
|
* assert.ifError('error');
|
||||||
|
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error'
|
||||||
|
* assert.ifError(new Error());
|
||||||
|
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error
|
||||||
|
*
|
||||||
|
* // Create some random error frames.
|
||||||
|
* let err;
|
||||||
|
* (function errorFrame() {
|
||||||
|
* err = new Error('test error');
|
||||||
|
* })();
|
||||||
|
*
|
||||||
|
* (function ifErrorFrame() {
|
||||||
|
* assert.ifError(err);
|
||||||
|
* })();
|
||||||
|
* // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error
|
||||||
|
* // at ifErrorFrame
|
||||||
|
* // at errorFrame
|
||||||
|
* ```
|
||||||
|
* @since v0.1.97
|
||||||
|
*/
|
||||||
|
function ifError(value: unknown): asserts value is null | undefined;
|
||||||
|
/**
|
||||||
|
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
|
||||||
|
* calls the function and awaits the returned promise to complete. It will then
|
||||||
|
* check that the promise is rejected.
|
||||||
|
*
|
||||||
|
* If `asyncFn` is a function and it throws an error synchronously,`assert.rejects()` will return a rejected `Promise` with that error. If the
|
||||||
|
* function does not return a promise, `assert.rejects()` will return a rejected`Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases the error
|
||||||
|
* handler is skipped.
|
||||||
|
*
|
||||||
|
* Besides the async nature to await the completion behaves identically to {@link throws}.
|
||||||
|
*
|
||||||
|
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
||||||
|
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
|
||||||
|
* an object where each property will be tested for, or an instance of error where
|
||||||
|
* each property will be tested for including the non-enumerable `message` and`name` properties.
|
||||||
|
*
|
||||||
|
* If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* await assert.rejects(
|
||||||
|
* async () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* name: 'TypeError',
|
||||||
|
* message: 'Wrong value'
|
||||||
|
* }
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* await assert.rejects(
|
||||||
|
* async () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* (err) => {
|
||||||
|
* assert.strictEqual(err.name, 'TypeError');
|
||||||
|
* assert.strictEqual(err.message, 'Wrong value');
|
||||||
|
* return true;
|
||||||
|
* }
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.rejects(
|
||||||
|
* Promise.reject(new Error('Wrong value')),
|
||||||
|
* Error
|
||||||
|
* ).then(() => {
|
||||||
|
* // ...
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* `error` cannot be a string. If a string is provided as the second
|
||||||
|
* argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Please read the
|
||||||
|
* example in {@link throws} carefully if using a string as the second
|
||||||
|
* argument gets considered.
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function rejects(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
|
||||||
|
function rejects(block: (() => Promise<unknown>) | Promise<unknown>, error: AssertPredicate, message?: string | Error): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
|
||||||
|
* calls the function and awaits the returned promise to complete. It will then
|
||||||
|
* check that the promise is not rejected.
|
||||||
|
*
|
||||||
|
* If `asyncFn` is a function and it throws an error synchronously,`assert.doesNotReject()` will return a rejected `Promise` with that error. If
|
||||||
|
* the function does not return a promise, `assert.doesNotReject()` will return a
|
||||||
|
* rejected `Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases
|
||||||
|
* the error handler is skipped.
|
||||||
|
*
|
||||||
|
* Using `assert.doesNotReject()` is actually not useful because there is little
|
||||||
|
* benefit in catching a rejection and then rejecting it again. Instead, consider
|
||||||
|
* adding a comment next to the specific code path that should not reject and keep
|
||||||
|
* error messages as expressive as possible.
|
||||||
|
*
|
||||||
|
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
|
||||||
|
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
|
||||||
|
* function. See {@link throws} for more details.
|
||||||
|
*
|
||||||
|
* Besides the async nature to await the completion behaves identically to {@link doesNotThrow}.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* await assert.doesNotReject(
|
||||||
|
* async () => {
|
||||||
|
* throw new TypeError('Wrong value');
|
||||||
|
* },
|
||||||
|
* SyntaxError
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
|
||||||
|
* .then(() => {
|
||||||
|
* // ...
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
function doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
|
||||||
|
function doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>, error: AssertPredicate, message?: string | Error): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Expects the `string` input to match the regular expression.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.match('I will fail', /pass/);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: The input did not match the regular ...
|
||||||
|
*
|
||||||
|
* assert.match(123, /pass/);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
|
||||||
|
*
|
||||||
|
* assert.match('I will pass', /pass/);
|
||||||
|
* // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values do not match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
|
||||||
|
* to the value of the `message` parameter. If the `message` parameter is
|
||||||
|
* undefined, a default error message is assigned. If the `message` parameter is an
|
||||||
|
* instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
||||||
|
* @since v13.6.0, v12.16.0
|
||||||
|
*/
|
||||||
|
function match(value: string, regExp: RegExp, message?: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Expects the `string` input not to match the regular expression.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import assert from 'assert/strict';
|
||||||
|
*
|
||||||
|
* assert.doesNotMatch('I will fail', /fail/);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: The input was expected to not match the ...
|
||||||
|
*
|
||||||
|
* assert.doesNotMatch(123, /pass/);
|
||||||
|
* // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
|
||||||
|
*
|
||||||
|
* assert.doesNotMatch('I will pass', /different/);
|
||||||
|
* // OK
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If the values do match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
|
||||||
|
* to the value of the `message` parameter. If the `message` parameter is
|
||||||
|
* undefined, a default error message is assigned. If the `message` parameter is an
|
||||||
|
* instance of an `Error` then it will be thrown instead of the `AssertionError`.
|
||||||
|
* @since v13.6.0, v12.16.0
|
||||||
|
*/
|
||||||
|
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
|
||||||
|
const strict: Omit<typeof assert, 'equal' | 'notEqual' | 'deepEqual' | 'notDeepEqual' | 'ok' | 'strictEqual' | 'deepStrictEqual' | 'ifError' | 'strict'> & {
|
||||||
|
(value: unknown, message?: string | Error): asserts value;
|
||||||
|
equal: typeof strictEqual;
|
||||||
|
notEqual: typeof notStrictEqual;
|
||||||
|
deepEqual: typeof deepStrictEqual;
|
||||||
|
notDeepEqual: typeof notDeepStrictEqual;
|
||||||
|
// Mapped types and assertion functions are incompatible?
|
||||||
|
// TS2775: Assertions require every name in the call target
|
||||||
|
// to be declared with an explicit type annotation.
|
||||||
|
ok: typeof ok;
|
||||||
|
strictEqual: typeof strictEqual;
|
||||||
|
deepStrictEqual: typeof deepStrictEqual;
|
||||||
|
ifError: typeof ifError;
|
||||||
|
strict: typeof strict;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export = assert;
|
||||||
|
}
|
||||||
|
declare module 'node:assert' {
|
||||||
|
import assert = require('assert');
|
||||||
|
export = assert;
|
||||||
|
}
|
8
node_modules/@types/node/assert/strict.d.ts
generated
vendored
Normal file
8
node_modules/@types/node/assert/strict.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
declare module 'assert/strict' {
|
||||||
|
import { strict } from 'node:assert';
|
||||||
|
export = strict;
|
||||||
|
}
|
||||||
|
declare module 'node:assert/strict' {
|
||||||
|
import { strict } from 'node:assert';
|
||||||
|
export = strict;
|
||||||
|
}
|
497
node_modules/@types/node/async_hooks.d.ts
generated
vendored
Normal file
497
node_modules/@types/node/async_hooks.d.ts
generated
vendored
Normal file
@ -0,0 +1,497 @@
|
|||||||
|
/**
|
||||||
|
* The `async_hooks` module provides an API to track asynchronous resources. It
|
||||||
|
* can be accessed using:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import async_hooks from 'async_hooks';
|
||||||
|
* ```
|
||||||
|
* @experimental
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/async_hooks.js)
|
||||||
|
*/
|
||||||
|
declare module 'async_hooks' {
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* import { executionAsyncId } from 'async_hooks';
|
||||||
|
*
|
||||||
|
* console.log(executionAsyncId()); // 1 - bootstrap
|
||||||
|
* fs.open(path, 'r', (err, fd) => {
|
||||||
|
* console.log(executionAsyncId()); // 6 - open()
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The ID returned from `executionAsyncId()` is related to execution timing, not
|
||||||
|
* causality (which is covered by `triggerAsyncId()`):
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const server = net.createServer((conn) => {
|
||||||
|
* // Returns the ID of the server, not of the new connection, because the
|
||||||
|
* // callback runs in the execution scope of the server's MakeCallback().
|
||||||
|
* async_hooks.executionAsyncId();
|
||||||
|
*
|
||||||
|
* }).listen(port, () => {
|
||||||
|
* // Returns the ID of a TickObject (process.nextTick()) because all
|
||||||
|
* // callbacks passed to .listen() are wrapped in a nextTick().
|
||||||
|
* async_hooks.executionAsyncId();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Promise contexts may not get precise `executionAsyncIds` by default.
|
||||||
|
* See the section on `promise execution tracking`.
|
||||||
|
* @since v8.1.0
|
||||||
|
* @return The `asyncId` of the current execution context. Useful to track when something calls.
|
||||||
|
*/
|
||||||
|
function executionAsyncId(): number;
|
||||||
|
/**
|
||||||
|
* Resource objects returned by `executionAsyncResource()` are most often internal
|
||||||
|
* Node.js handle objects with undocumented APIs. Using any functions or properties
|
||||||
|
* on the object is likely to crash your application and should be avoided.
|
||||||
|
*
|
||||||
|
* Using `executionAsyncResource()` in the top-level execution context will
|
||||||
|
* return an empty object as there is no handle or request object to use,
|
||||||
|
* but having an object representing the top-level can be helpful.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { open } from 'fs';
|
||||||
|
* import { executionAsyncId, executionAsyncResource } from 'async_hooks';
|
||||||
|
*
|
||||||
|
* console.log(executionAsyncId(), executionAsyncResource()); // 1 {}
|
||||||
|
* open(new URL(import.meta.url), 'r', (err, fd) => {
|
||||||
|
* console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* This can be used to implement continuation local storage without the
|
||||||
|
* use of a tracking `Map` to store the metadata:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { createServer } from 'http';
|
||||||
|
* import {
|
||||||
|
* executionAsyncId,
|
||||||
|
* executionAsyncResource,
|
||||||
|
* createHook
|
||||||
|
* } from 'async_hooks';
|
||||||
|
* const sym = Symbol('state'); // Private symbol to avoid pollution
|
||||||
|
*
|
||||||
|
* createHook({
|
||||||
|
* init(asyncId, type, triggerAsyncId, resource) {
|
||||||
|
* const cr = executionAsyncResource();
|
||||||
|
* if (cr) {
|
||||||
|
* resource[sym] = cr[sym];
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }).enable();
|
||||||
|
*
|
||||||
|
* const server = createServer((req, res) => {
|
||||||
|
* executionAsyncResource()[sym] = { state: req.url };
|
||||||
|
* setTimeout(function() {
|
||||||
|
* res.end(JSON.stringify(executionAsyncResource()[sym]));
|
||||||
|
* }, 100);
|
||||||
|
* }).listen(3000);
|
||||||
|
* ```
|
||||||
|
* @since v13.9.0, v12.17.0
|
||||||
|
* @return The resource representing the current execution. Useful to store data within the resource.
|
||||||
|
*/
|
||||||
|
function executionAsyncResource(): object;
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* const server = net.createServer((conn) => {
|
||||||
|
* // The resource that caused (or triggered) this callback to be called
|
||||||
|
* // was that of the new connection. Thus the return value of triggerAsyncId()
|
||||||
|
* // is the asyncId of "conn".
|
||||||
|
* async_hooks.triggerAsyncId();
|
||||||
|
*
|
||||||
|
* }).listen(port, () => {
|
||||||
|
* // Even though all callbacks passed to .listen() are wrapped in a nextTick()
|
||||||
|
* // the callback itself exists because the call to the server's .listen()
|
||||||
|
* // was made. So the return value would be the ID of the server.
|
||||||
|
* async_hooks.triggerAsyncId();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Promise contexts may not get valid `triggerAsyncId`s by default. See
|
||||||
|
* the section on `promise execution tracking`.
|
||||||
|
* @return The ID of the resource responsible for calling the callback that is currently being executed.
|
||||||
|
*/
|
||||||
|
function triggerAsyncId(): number;
|
||||||
|
interface HookCallbacks {
|
||||||
|
/**
|
||||||
|
* Called when a class is constructed that has the possibility to emit an asynchronous event.
|
||||||
|
* @param asyncId a unique ID for the async resource
|
||||||
|
* @param type the type of the async resource
|
||||||
|
* @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
|
||||||
|
* @param resource reference to the resource representing the async operation, needs to be released during destroy
|
||||||
|
*/
|
||||||
|
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
|
||||||
|
/**
|
||||||
|
* When an asynchronous operation is initiated or completes a callback is called to notify the user.
|
||||||
|
* The before callback is called just before said callback is executed.
|
||||||
|
* @param asyncId the unique identifier assigned to the resource about to execute the callback.
|
||||||
|
*/
|
||||||
|
before?(asyncId: number): void;
|
||||||
|
/**
|
||||||
|
* Called immediately after the callback specified in before is completed.
|
||||||
|
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
|
||||||
|
*/
|
||||||
|
after?(asyncId: number): void;
|
||||||
|
/**
|
||||||
|
* Called when a promise has resolve() called. This may not be in the same execution id
|
||||||
|
* as the promise itself.
|
||||||
|
* @param asyncId the unique id for the promise that was resolve()d.
|
||||||
|
*/
|
||||||
|
promiseResolve?(asyncId: number): void;
|
||||||
|
/**
|
||||||
|
* Called after the resource corresponding to asyncId is destroyed
|
||||||
|
* @param asyncId a unique ID for the async resource
|
||||||
|
*/
|
||||||
|
destroy?(asyncId: number): void;
|
||||||
|
}
|
||||||
|
interface AsyncHook {
|
||||||
|
/**
|
||||||
|
* Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
|
||||||
|
*/
|
||||||
|
enable(): this;
|
||||||
|
/**
|
||||||
|
* Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
|
||||||
|
*/
|
||||||
|
disable(): this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Registers functions to be called for different lifetime events of each async
|
||||||
|
* operation.
|
||||||
|
*
|
||||||
|
* The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the
|
||||||
|
* respective asynchronous event during a resource's lifetime.
|
||||||
|
*
|
||||||
|
* All callbacks are optional. For example, if only resource cleanup needs to
|
||||||
|
* be tracked, then only the `destroy` callback needs to be passed. The
|
||||||
|
* specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { createHook } from 'async_hooks';
|
||||||
|
*
|
||||||
|
* const asyncHook = createHook({
|
||||||
|
* init(asyncId, type, triggerAsyncId, resource) { },
|
||||||
|
* destroy(asyncId) { }
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The callbacks will be inherited via the prototype chain:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* class MyAsyncCallbacks {
|
||||||
|
* init(asyncId, type, triggerAsyncId, resource) { }
|
||||||
|
* destroy(asyncId) {}
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* class MyAddedCallbacks extends MyAsyncCallbacks {
|
||||||
|
* before(asyncId) { }
|
||||||
|
* after(asyncId) { }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* const asyncHook = async_hooks.createHook(new MyAddedCallbacks());
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Because promises are asynchronous resources whose lifecycle is tracked
|
||||||
|
* via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises.
|
||||||
|
* @since v8.1.0
|
||||||
|
* @param callbacks The `Hook Callbacks` to register
|
||||||
|
* @return Instance used for disabling and enabling hooks
|
||||||
|
*/
|
||||||
|
function createHook(callbacks: HookCallbacks): AsyncHook;
|
||||||
|
interface AsyncResourceOptions {
|
||||||
|
/**
|
||||||
|
* The ID of the execution context that created this async event.
|
||||||
|
* @default executionAsyncId()
|
||||||
|
*/
|
||||||
|
triggerAsyncId?: number | undefined;
|
||||||
|
/**
|
||||||
|
* Disables automatic `emitDestroy` when the object is garbage collected.
|
||||||
|
* This usually does not need to be set (even if `emitDestroy` is called
|
||||||
|
* manually), unless the resource's `asyncId` is retrieved and the
|
||||||
|
* sensitive API's `emitDestroy` is called with it.
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
requireManualDestroy?: boolean | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The class `AsyncResource` is designed to be extended by the embedder's async
|
||||||
|
* resources. Using this, users can easily trigger the lifetime events of their
|
||||||
|
* own resources.
|
||||||
|
*
|
||||||
|
* The `init` hook will trigger when an `AsyncResource` is instantiated.
|
||||||
|
*
|
||||||
|
* The following is an overview of the `AsyncResource` API.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import { AsyncResource, executionAsyncId } from 'async_hooks';
|
||||||
|
*
|
||||||
|
* // AsyncResource() is meant to be extended. Instantiating a
|
||||||
|
* // new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
||||||
|
* // async_hook.executionAsyncId() is used.
|
||||||
|
* const asyncResource = new AsyncResource(
|
||||||
|
* type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* // Run a function in the execution context of the resource. This will
|
||||||
|
* // * establish the context of the resource
|
||||||
|
* // * trigger the AsyncHooks before callbacks
|
||||||
|
* // * call the provided function `fn` with the supplied arguments
|
||||||
|
* // * trigger the AsyncHooks after callbacks
|
||||||
|
* // * restore the original execution context
|
||||||
|
* asyncResource.runInAsyncScope(fn, thisArg, ...args);
|
||||||
|
*
|
||||||
|
* // Call AsyncHooks destroy callbacks.
|
||||||
|
* asyncResource.emitDestroy();
|
||||||
|
*
|
||||||
|
* // Return the unique ID assigned to the AsyncResource instance.
|
||||||
|
* asyncResource.asyncId();
|
||||||
|
*
|
||||||
|
* // Return the trigger ID for the AsyncResource instance.
|
||||||
|
* asyncResource.triggerAsyncId();
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
class AsyncResource {
|
||||||
|
/**
|
||||||
|
* AsyncResource() is meant to be extended. Instantiating a
|
||||||
|
* new AsyncResource() also triggers init. If triggerAsyncId is omitted then
|
||||||
|
* async_hook.executionAsyncId() is used.
|
||||||
|
* @param type The type of async event.
|
||||||
|
* @param triggerAsyncId The ID of the execution context that created
|
||||||
|
* this async event (default: `executionAsyncId()`), or an
|
||||||
|
* AsyncResourceOptions object (since v9.3.0)
|
||||||
|
*/
|
||||||
|
constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions);
|
||||||
|
/**
|
||||||
|
* Binds the given function to the current execution context.
|
||||||
|
*
|
||||||
|
* The returned function will have an `asyncResource` property referencing
|
||||||
|
* the `AsyncResource` to which the function is bound.
|
||||||
|
* @since v14.8.0, v12.19.0
|
||||||
|
* @param fn The function to bind to the current execution context.
|
||||||
|
* @param type An optional name to associate with the underlying `AsyncResource`.
|
||||||
|
*/
|
||||||
|
static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(
|
||||||
|
fn: Func,
|
||||||
|
type?: string,
|
||||||
|
thisArg?: ThisArg
|
||||||
|
): Func & {
|
||||||
|
asyncResource: AsyncResource;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Binds the given function to execute to this `AsyncResource`'s scope.
|
||||||
|
*
|
||||||
|
* The returned function will have an `asyncResource` property referencing
|
||||||
|
* the `AsyncResource` to which the function is bound.
|
||||||
|
* @since v14.8.0, v12.19.0
|
||||||
|
* @param fn The function to bind to the current `AsyncResource`.
|
||||||
|
*/
|
||||||
|
bind<Func extends (...args: any[]) => any>(
|
||||||
|
fn: Func
|
||||||
|
): Func & {
|
||||||
|
asyncResource: AsyncResource;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Call the provided function with the provided arguments in the execution context
|
||||||
|
* of the async resource. This will establish the context, trigger the AsyncHooks
|
||||||
|
* before callbacks, call the function, trigger the AsyncHooks after callbacks, and
|
||||||
|
* then restore the original execution context.
|
||||||
|
* @since v9.6.0
|
||||||
|
* @param fn The function to call in the execution context of this async resource.
|
||||||
|
* @param thisArg The receiver to be used for the function call.
|
||||||
|
* @param args Optional arguments to pass to the function.
|
||||||
|
*/
|
||||||
|
runInAsyncScope<This, Result>(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result;
|
||||||
|
/**
|
||||||
|
* Call all `destroy` hooks. This should only ever be called once. An error will
|
||||||
|
* be thrown if it is called more than once. This **must** be manually called. If
|
||||||
|
* the resource is left to be collected by the GC then the `destroy` hooks will
|
||||||
|
* never be called.
|
||||||
|
* @return A reference to `asyncResource`.
|
||||||
|
*/
|
||||||
|
emitDestroy(): this;
|
||||||
|
/**
|
||||||
|
* @return The unique `asyncId` assigned to the resource.
|
||||||
|
*/
|
||||||
|
asyncId(): number;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor.
|
||||||
|
*/
|
||||||
|
triggerAsyncId(): number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This class creates stores that stay coherent through asynchronous operations.
|
||||||
|
*
|
||||||
|
* While you can create your own implementation on top of the `async_hooks` module,`AsyncLocalStorage` should be preferred as it is a performant and memory safe
|
||||||
|
* implementation that involves significant optimizations that are non-obvious to
|
||||||
|
* implement.
|
||||||
|
*
|
||||||
|
* The following example uses `AsyncLocalStorage` to build a simple logger
|
||||||
|
* that assigns IDs to incoming HTTP requests and includes them in messages
|
||||||
|
* logged within each request.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import http from 'http';
|
||||||
|
* import { AsyncLocalStorage } from 'async_hooks';
|
||||||
|
*
|
||||||
|
* const asyncLocalStorage = new AsyncLocalStorage();
|
||||||
|
*
|
||||||
|
* function logWithId(msg) {
|
||||||
|
* const id = asyncLocalStorage.getStore();
|
||||||
|
* console.log(`${id !== undefined ? id : '-'}:`, msg);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* let idSeq = 0;
|
||||||
|
* http.createServer((req, res) => {
|
||||||
|
* asyncLocalStorage.run(idSeq++, () => {
|
||||||
|
* logWithId('start');
|
||||||
|
* // Imagine any chain of async operations here
|
||||||
|
* setImmediate(() => {
|
||||||
|
* logWithId('finish');
|
||||||
|
* res.end();
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* }).listen(8080);
|
||||||
|
*
|
||||||
|
* http.get('http://localhost:8080');
|
||||||
|
* http.get('http://localhost:8080');
|
||||||
|
* // Prints:
|
||||||
|
* // 0: start
|
||||||
|
* // 1: start
|
||||||
|
* // 0: finish
|
||||||
|
* // 1: finish
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Each instance of `AsyncLocalStorage` maintains an independent storage context.
|
||||||
|
* Multiple instances can safely exist simultaneously without risk of interfering
|
||||||
|
* with each other data.
|
||||||
|
* @since v13.10.0, v12.17.0
|
||||||
|
*/
|
||||||
|
class AsyncLocalStorage<T> {
|
||||||
|
/**
|
||||||
|
* Disables the instance of `AsyncLocalStorage`. All subsequent calls
|
||||||
|
* to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
|
||||||
|
*
|
||||||
|
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
|
||||||
|
* instance will be exited.
|
||||||
|
*
|
||||||
|
* Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores
|
||||||
|
* provided by the `asyncLocalStorage`, as those objects are garbage collected
|
||||||
|
* along with the corresponding async resources.
|
||||||
|
*
|
||||||
|
* Use this method when the `asyncLocalStorage` is not in use anymore
|
||||||
|
* in the current process.
|
||||||
|
* @since v13.10.0, v12.17.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
disable(): void;
|
||||||
|
/**
|
||||||
|
* Returns the current store.
|
||||||
|
* If called outside of an asynchronous context initialized by
|
||||||
|
* calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it
|
||||||
|
* returns `undefined`.
|
||||||
|
* @since v13.10.0, v12.17.0
|
||||||
|
*/
|
||||||
|
getStore(): T | undefined;
|
||||||
|
/**
|
||||||
|
* Runs a function synchronously within a context and returns its
|
||||||
|
* return value. The store is not accessible outside of the callback function or
|
||||||
|
* the asynchronous operations created within the callback.
|
||||||
|
*
|
||||||
|
* The optional `args` are passed to the callback function.
|
||||||
|
*
|
||||||
|
* If the callback function throws an error, the error is thrown by `run()` too.
|
||||||
|
* The stacktrace is not impacted by this call and the context is exited.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const store = { id: 2 };
|
||||||
|
* try {
|
||||||
|
* asyncLocalStorage.run(store, () => {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the store object
|
||||||
|
* throw new Error();
|
||||||
|
* });
|
||||||
|
* } catch (e) {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns undefined
|
||||||
|
* // The error will be caught here
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v13.10.0, v12.17.0
|
||||||
|
*/
|
||||||
|
run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
|
||||||
|
/**
|
||||||
|
* Runs a function synchronously outside of a context and returns its
|
||||||
|
* return value. The store is not accessible within the callback function or
|
||||||
|
* the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`.
|
||||||
|
*
|
||||||
|
* The optional `args` are passed to the callback function.
|
||||||
|
*
|
||||||
|
* If the callback function throws an error, the error is thrown by `exit()` too.
|
||||||
|
* The stacktrace is not impacted by this call and the context is re-entered.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* // Within a call to run
|
||||||
|
* try {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the store object or value
|
||||||
|
* asyncLocalStorage.exit(() => {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns undefined
|
||||||
|
* throw new Error();
|
||||||
|
* });
|
||||||
|
* } catch (e) {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the same object or value
|
||||||
|
* // The error will be caught here
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v13.10.0, v12.17.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
exit<R, TArgs extends any[]>(callback: (...args: TArgs) => R, ...args: TArgs): R;
|
||||||
|
/**
|
||||||
|
* Transitions into the context for the remainder of the current
|
||||||
|
* synchronous execution and then persists the store through any following
|
||||||
|
* asynchronous calls.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const store = { id: 1 };
|
||||||
|
* // Replaces previous store with the given store object
|
||||||
|
* asyncLocalStorage.enterWith(store);
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the store object
|
||||||
|
* someAsyncOperation(() => {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the same object
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* This transition will continue for the _entire_ synchronous execution.
|
||||||
|
* This means that if, for example, the context is entered within an event
|
||||||
|
* handler subsequent event handlers will also run within that context unless
|
||||||
|
* specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons
|
||||||
|
* to use the latter method.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const store = { id: 1 };
|
||||||
|
*
|
||||||
|
* emitter.on('my-event', () => {
|
||||||
|
* asyncLocalStorage.enterWith(store);
|
||||||
|
* });
|
||||||
|
* emitter.on('my-event', () => {
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the same object
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* asyncLocalStorage.getStore(); // Returns undefined
|
||||||
|
* emitter.emit('my-event');
|
||||||
|
* asyncLocalStorage.getStore(); // Returns the same object
|
||||||
|
* ```
|
||||||
|
* @since v13.11.0, v12.17.0
|
||||||
|
* @experimental
|
||||||
|
*/
|
||||||
|
enterWith(store: T): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module 'node:async_hooks' {
|
||||||
|
export * from 'async_hooks';
|
||||||
|
}
|
2232
node_modules/@types/node/buffer.d.ts
generated
vendored
Normal file
2232
node_modules/@types/node/buffer.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1366
node_modules/@types/node/child_process.d.ts
generated
vendored
Normal file
1366
node_modules/@types/node/child_process.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
414
node_modules/@types/node/cluster.d.ts
generated
vendored
Normal file
414
node_modules/@types/node/cluster.d.ts
generated
vendored
Normal file
@ -0,0 +1,414 @@
|
|||||||
|
/**
|
||||||
|
* A single instance of Node.js runs in a single thread. To take advantage of
|
||||||
|
* multi-core systems, the user will sometimes want to launch a cluster of Node.js
|
||||||
|
* processes to handle the load.
|
||||||
|
*
|
||||||
|
* The cluster module allows easy creation of child processes that all share
|
||||||
|
* server ports.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import cluster from 'cluster';
|
||||||
|
* import http from 'http';
|
||||||
|
* import { cpus } from 'os';
|
||||||
|
* import process from 'process';
|
||||||
|
*
|
||||||
|
* const numCPUs = cpus().length;
|
||||||
|
*
|
||||||
|
* if (cluster.isPrimary) {
|
||||||
|
* console.log(`Primary ${process.pid} is running`);
|
||||||
|
*
|
||||||
|
* // Fork workers.
|
||||||
|
* for (let i = 0; i < numCPUs; i++) {
|
||||||
|
* cluster.fork();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* cluster.on('exit', (worker, code, signal) => {
|
||||||
|
* console.log(`worker ${worker.process.pid} died`);
|
||||||
|
* });
|
||||||
|
* } else {
|
||||||
|
* // Workers can share any TCP connection
|
||||||
|
* // In this case it is an HTTP server
|
||||||
|
* http.createServer((req, res) => {
|
||||||
|
* res.writeHead(200);
|
||||||
|
* res.end('hello world\n');
|
||||||
|
* }).listen(8000);
|
||||||
|
*
|
||||||
|
* console.log(`Worker ${process.pid} started`);
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Running Node.js will now share port 8000 between the workers:
|
||||||
|
*
|
||||||
|
* ```console
|
||||||
|
* $ node server.js
|
||||||
|
* Primary 3596 is running
|
||||||
|
* Worker 4324 started
|
||||||
|
* Worker 4520 started
|
||||||
|
* Worker 6056 started
|
||||||
|
* Worker 5644 started
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* On Windows, it is not yet possible to set up a named pipe server in a worker.
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/cluster.js)
|
||||||
|
*/
|
||||||
|
declare module 'cluster' {
|
||||||
|
import * as child from 'node:child_process';
|
||||||
|
import EventEmitter = require('node:events');
|
||||||
|
import * as net from 'node:net';
|
||||||
|
export interface ClusterSettings {
|
||||||
|
execArgv?: string[] | undefined; // default: process.execArgv
|
||||||
|
exec?: string | undefined;
|
||||||
|
args?: string[] | undefined;
|
||||||
|
silent?: boolean | undefined;
|
||||||
|
stdio?: any[] | undefined;
|
||||||
|
uid?: number | undefined;
|
||||||
|
gid?: number | undefined;
|
||||||
|
inspectPort?: number | (() => number) | undefined;
|
||||||
|
}
|
||||||
|
export interface Address {
|
||||||
|
address: string;
|
||||||
|
port: number;
|
||||||
|
addressType: number | 'udp4' | 'udp6'; // 4, 6, -1, "udp4", "udp6"
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* A `Worker` object contains all public information and method about a worker.
|
||||||
|
* In the primary it can be obtained using `cluster.workers`. In a worker
|
||||||
|
* it can be obtained using `cluster.worker`.
|
||||||
|
* @since v0.7.0
|
||||||
|
*/
|
||||||
|
export class Worker extends EventEmitter {
|
||||||
|
/**
|
||||||
|
* Each new worker is given its own unique id, this id is stored in the`id`.
|
||||||
|
*
|
||||||
|
* While a worker is alive, this is the key that indexes it in`cluster.workers`.
|
||||||
|
* @since v0.8.0
|
||||||
|
*/
|
||||||
|
id: number;
|
||||||
|
/**
|
||||||
|
* All workers are created using `child_process.fork()`, the returned object
|
||||||
|
* from this function is stored as `.process`. In a worker, the global `process`is stored.
|
||||||
|
*
|
||||||
|
* See: `Child Process module`.
|
||||||
|
*
|
||||||
|
* Workers will call `process.exit(0)` if the `'disconnect'` event occurs
|
||||||
|
* on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
|
||||||
|
* accidental disconnection.
|
||||||
|
* @since v0.7.0
|
||||||
|
*/
|
||||||
|
process: child.ChildProcess;
|
||||||
|
/**
|
||||||
|
* Send a message to a worker or primary, optionally with a handle.
|
||||||
|
*
|
||||||
|
* In the primary this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
|
||||||
|
*
|
||||||
|
* In a worker this sends a message to the primary. It is identical to`process.send()`.
|
||||||
|
*
|
||||||
|
* This example will echo back all messages from the primary:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* if (cluster.isPrimary) {
|
||||||
|
* const worker = cluster.fork();
|
||||||
|
* worker.send('hi there');
|
||||||
|
*
|
||||||
|
* } else if (cluster.isWorker) {
|
||||||
|
* process.on('message', (msg) => {
|
||||||
|
* process.send(msg);
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.7.0
|
||||||
|
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
|
||||||
|
*/
|
||||||
|
send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
|
||||||
|
send(message: child.Serializable, sendHandle: child.SendHandle, callback?: (error: Error | null) => void): boolean;
|
||||||
|
send(message: child.Serializable, sendHandle: child.SendHandle, options?: child.MessageOptions, callback?: (error: Error | null) => void): boolean;
|
||||||
|
/**
|
||||||
|
* This function will kill the worker. In the primary, it does this
|
||||||
|
* by disconnecting the `worker.process`, and once disconnected, killing
|
||||||
|
* with `signal`. In the worker, it does it by disconnecting the channel,
|
||||||
|
* and then exiting with code `0`.
|
||||||
|
*
|
||||||
|
* Because `kill()` attempts to gracefully disconnect the worker process, it is
|
||||||
|
* susceptible to waiting indefinitely for the disconnect to complete. For example,
|
||||||
|
* if the worker enters an infinite loop, a graceful disconnect will never occur.
|
||||||
|
* If the graceful disconnect behavior is not needed, use `worker.process.kill()`.
|
||||||
|
*
|
||||||
|
* Causes `.exitedAfterDisconnect` to be set.
|
||||||
|
*
|
||||||
|
* This method is aliased as `worker.destroy()` for backward compatibility.
|
||||||
|
*
|
||||||
|
* In a worker, `process.kill()` exists, but it is not this function;
|
||||||
|
* it is `kill()`.
|
||||||
|
* @since v0.9.12
|
||||||
|
* @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
|
||||||
|
*/
|
||||||
|
kill(signal?: string): void;
|
||||||
|
destroy(signal?: string): void;
|
||||||
|
/**
|
||||||
|
* In a worker, this function will close all servers, wait for the `'close'` event
|
||||||
|
* on those servers, and then disconnect the IPC channel.
|
||||||
|
*
|
||||||
|
* In the primary, an internal message is sent to the worker causing it to call`.disconnect()` on itself.
|
||||||
|
*
|
||||||
|
* Causes `.exitedAfterDisconnect` to be set.
|
||||||
|
*
|
||||||
|
* After a server is closed, it will no longer accept new connections,
|
||||||
|
* but connections may be accepted by any other listening worker. Existing
|
||||||
|
* connections will be allowed to close as usual. When no more connections exist,
|
||||||
|
* see `server.close()`, the IPC channel to the worker will close allowing it
|
||||||
|
* to die gracefully.
|
||||||
|
*
|
||||||
|
* The above applies _only_ to server connections, client connections are not
|
||||||
|
* automatically closed by workers, and disconnect does not wait for them to close
|
||||||
|
* before exiting.
|
||||||
|
*
|
||||||
|
* In a worker, `process.disconnect` exists, but it is not this function;
|
||||||
|
* it is `disconnect()`.
|
||||||
|
*
|
||||||
|
* Because long living server connections may block workers from disconnecting, it
|
||||||
|
* may be useful to send a message, so application specific actions may be taken to
|
||||||
|
* close them. It also may be useful to implement a timeout, killing a worker if
|
||||||
|
* the `'disconnect'` event has not been emitted after some time.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* if (cluster.isPrimary) {
|
||||||
|
* const worker = cluster.fork();
|
||||||
|
* let timeout;
|
||||||
|
*
|
||||||
|
* worker.on('listening', (address) => {
|
||||||
|
* worker.send('shutdown');
|
||||||
|
* worker.disconnect();
|
||||||
|
* timeout = setTimeout(() => {
|
||||||
|
* worker.kill();
|
||||||
|
* }, 2000);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* worker.on('disconnect', () => {
|
||||||
|
* clearTimeout(timeout);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* } else if (cluster.isWorker) {
|
||||||
|
* const net = require('net');
|
||||||
|
* const server = net.createServer((socket) => {
|
||||||
|
* // Connections never end
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* server.listen(8000);
|
||||||
|
*
|
||||||
|
* process.on('message', (msg) => {
|
||||||
|
* if (msg === 'shutdown') {
|
||||||
|
* // Initiate graceful close of any connections to server
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.7.7
|
||||||
|
* @return A reference to `worker`.
|
||||||
|
*/
|
||||||
|
disconnect(): void;
|
||||||
|
/**
|
||||||
|
* This function returns `true` if the worker is connected to its primary via its
|
||||||
|
* IPC channel, `false` otherwise. A worker is connected to its primary after it
|
||||||
|
* has been created. It is disconnected after the `'disconnect'` event is emitted.
|
||||||
|
* @since v0.11.14
|
||||||
|
*/
|
||||||
|
isConnected(): boolean;
|
||||||
|
/**
|
||||||
|
* This function returns `true` if the worker's process has terminated (either
|
||||||
|
* because of exiting or being signaled). Otherwise, it returns `false`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import cluster from 'cluster';
|
||||||
|
* import http from 'http';
|
||||||
|
* import { cpus } from 'os';
|
||||||
|
* import process from 'process';
|
||||||
|
*
|
||||||
|
* const numCPUs = cpus().length;
|
||||||
|
*
|
||||||
|
* if (cluster.isPrimary) {
|
||||||
|
* console.log(`Primary ${process.pid} is running`);
|
||||||
|
*
|
||||||
|
* // Fork workers.
|
||||||
|
* for (let i = 0; i < numCPUs; i++) {
|
||||||
|
* cluster.fork();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* cluster.on('fork', (worker) => {
|
||||||
|
* console.log('worker is dead:', worker.isDead());
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* cluster.on('exit', (worker, code, signal) => {
|
||||||
|
* console.log('worker is dead:', worker.isDead());
|
||||||
|
* });
|
||||||
|
* } else {
|
||||||
|
* // Workers can share any TCP connection. In this case, it is an HTTP server.
|
||||||
|
* http.createServer((req, res) => {
|
||||||
|
* res.writeHead(200);
|
||||||
|
* res.end(`Current process\n ${process.pid}`);
|
||||||
|
* process.kill(process.pid);
|
||||||
|
* }).listen(8000);
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.11.14
|
||||||
|
*/
|
||||||
|
isDead(): boolean;
|
||||||
|
/**
|
||||||
|
* This property is `true` if the worker exited due to `.kill()` or`.disconnect()`. If the worker exited any other way, it is `false`. If the
|
||||||
|
* worker has not exited, it is `undefined`.
|
||||||
|
*
|
||||||
|
* The boolean `worker.exitedAfterDisconnect` allows distinguishing between
|
||||||
|
* voluntary and accidental exit, the primary may choose not to respawn a worker
|
||||||
|
* based on this value.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* cluster.on('exit', (worker, code, signal) => {
|
||||||
|
* if (worker.exitedAfterDisconnect === true) {
|
||||||
|
* console.log('Oh, it was just voluntary – no need to worry');
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // kill worker
|
||||||
|
* worker.kill();
|
||||||
|
* ```
|
||||||
|
* @since v6.0.0
|
||||||
|
*/
|
||||||
|
exitedAfterDisconnect: boolean;
|
||||||
|
/**
|
||||||
|
* events.EventEmitter
|
||||||
|
* 1. disconnect
|
||||||
|
* 2. error
|
||||||
|
* 3. exit
|
||||||
|
* 4. listening
|
||||||
|
* 5. message
|
||||||
|
* 6. online
|
||||||
|
*/
|
||||||
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
addListener(event: 'disconnect', listener: () => void): this;
|
||||||
|
addListener(event: 'error', listener: (error: Error) => void): this;
|
||||||
|
addListener(event: 'exit', listener: (code: number, signal: string) => void): this;
|
||||||
|
addListener(event: 'listening', listener: (address: Address) => void): this;
|
||||||
|
addListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
addListener(event: 'online', listener: () => void): this;
|
||||||
|
emit(event: string | symbol, ...args: any[]): boolean;
|
||||||
|
emit(event: 'disconnect'): boolean;
|
||||||
|
emit(event: 'error', error: Error): boolean;
|
||||||
|
emit(event: 'exit', code: number, signal: string): boolean;
|
||||||
|
emit(event: 'listening', address: Address): boolean;
|
||||||
|
emit(event: 'message', message: any, handle: net.Socket | net.Server): boolean;
|
||||||
|
emit(event: 'online'): boolean;
|
||||||
|
on(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
on(event: 'disconnect', listener: () => void): this;
|
||||||
|
on(event: 'error', listener: (error: Error) => void): this;
|
||||||
|
on(event: 'exit', listener: (code: number, signal: string) => void): this;
|
||||||
|
on(event: 'listening', listener: (address: Address) => void): this;
|
||||||
|
on(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
on(event: 'online', listener: () => void): this;
|
||||||
|
once(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
once(event: 'disconnect', listener: () => void): this;
|
||||||
|
once(event: 'error', listener: (error: Error) => void): this;
|
||||||
|
once(event: 'exit', listener: (code: number, signal: string) => void): this;
|
||||||
|
once(event: 'listening', listener: (address: Address) => void): this;
|
||||||
|
once(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
once(event: 'online', listener: () => void): this;
|
||||||
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
prependListener(event: 'disconnect', listener: () => void): this;
|
||||||
|
prependListener(event: 'error', listener: (error: Error) => void): this;
|
||||||
|
prependListener(event: 'exit', listener: (code: number, signal: string) => void): this;
|
||||||
|
prependListener(event: 'listening', listener: (address: Address) => void): this;
|
||||||
|
prependListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
prependListener(event: 'online', listener: () => void): this;
|
||||||
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
prependOnceListener(event: 'disconnect', listener: () => void): this;
|
||||||
|
prependOnceListener(event: 'error', listener: (error: Error) => void): this;
|
||||||
|
prependOnceListener(event: 'exit', listener: (code: number, signal: string) => void): this;
|
||||||
|
prependOnceListener(event: 'listening', listener: (address: Address) => void): this;
|
||||||
|
prependOnceListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
prependOnceListener(event: 'online', listener: () => void): this;
|
||||||
|
}
|
||||||
|
export interface Cluster extends EventEmitter {
|
||||||
|
disconnect(callback?: () => void): void;
|
||||||
|
fork(env?: any): Worker;
|
||||||
|
/** @deprecated since v16.0.0 - use isPrimary. */
|
||||||
|
readonly isMaster: boolean;
|
||||||
|
readonly isPrimary: boolean;
|
||||||
|
readonly isWorker: boolean;
|
||||||
|
schedulingPolicy: number;
|
||||||
|
readonly settings: ClusterSettings;
|
||||||
|
/** @deprecated since v16.0.0 - use setupPrimary. */
|
||||||
|
setupMaster(settings?: ClusterSettings): void;
|
||||||
|
/**
|
||||||
|
* `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings.
|
||||||
|
*/
|
||||||
|
setupPrimary(settings?: ClusterSettings): void;
|
||||||
|
readonly worker?: Worker | undefined;
|
||||||
|
readonly workers?: NodeJS.Dict<Worker> | undefined;
|
||||||
|
readonly SCHED_NONE: number;
|
||||||
|
readonly SCHED_RR: number;
|
||||||
|
/**
|
||||||
|
* events.EventEmitter
|
||||||
|
* 1. disconnect
|
||||||
|
* 2. exit
|
||||||
|
* 3. fork
|
||||||
|
* 4. listening
|
||||||
|
* 5. message
|
||||||
|
* 6. online
|
||||||
|
* 7. setup
|
||||||
|
*/
|
||||||
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
addListener(event: 'disconnect', listener: (worker: Worker) => void): this;
|
||||||
|
addListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||||
|
addListener(event: 'fork', listener: (worker: Worker) => void): this;
|
||||||
|
addListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
|
||||||
|
addListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
addListener(event: 'online', listener: (worker: Worker) => void): this;
|
||||||
|
addListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
|
||||||
|
emit(event: string | symbol, ...args: any[]): boolean;
|
||||||
|
emit(event: 'disconnect', worker: Worker): boolean;
|
||||||
|
emit(event: 'exit', worker: Worker, code: number, signal: string): boolean;
|
||||||
|
emit(event: 'fork', worker: Worker): boolean;
|
||||||
|
emit(event: 'listening', worker: Worker, address: Address): boolean;
|
||||||
|
emit(event: 'message', worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
|
||||||
|
emit(event: 'online', worker: Worker): boolean;
|
||||||
|
emit(event: 'setup', settings: ClusterSettings): boolean;
|
||||||
|
on(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
on(event: 'disconnect', listener: (worker: Worker) => void): this;
|
||||||
|
on(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||||
|
on(event: 'fork', listener: (worker: Worker) => void): this;
|
||||||
|
on(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
|
||||||
|
on(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
on(event: 'online', listener: (worker: Worker) => void): this;
|
||||||
|
on(event: 'setup', listener: (settings: ClusterSettings) => void): this;
|
||||||
|
once(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
once(event: 'disconnect', listener: (worker: Worker) => void): this;
|
||||||
|
once(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||||
|
once(event: 'fork', listener: (worker: Worker) => void): this;
|
||||||
|
once(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
|
||||||
|
once(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
once(event: 'online', listener: (worker: Worker) => void): this;
|
||||||
|
once(event: 'setup', listener: (settings: ClusterSettings) => void): this;
|
||||||
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
prependListener(event: 'disconnect', listener: (worker: Worker) => void): this;
|
||||||
|
prependListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||||
|
prependListener(event: 'fork', listener: (worker: Worker) => void): this;
|
||||||
|
prependListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
|
||||||
|
// the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
prependListener(event: 'message', listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void): this;
|
||||||
|
prependListener(event: 'online', listener: (worker: Worker) => void): this;
|
||||||
|
prependListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
|
||||||
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
prependOnceListener(event: 'disconnect', listener: (worker: Worker) => void): this;
|
||||||
|
prependOnceListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
|
||||||
|
prependOnceListener(event: 'fork', listener: (worker: Worker) => void): this;
|
||||||
|
prependOnceListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
|
||||||
|
// the handle is a net.Socket or net.Server object, or undefined.
|
||||||
|
prependOnceListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this;
|
||||||
|
prependOnceListener(event: 'online', listener: (worker: Worker) => void): this;
|
||||||
|
prependOnceListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
|
||||||
|
}
|
||||||
|
const cluster: Cluster;
|
||||||
|
export default cluster;
|
||||||
|
}
|
||||||
|
declare module 'node:cluster' {
|
||||||
|
export * from 'cluster';
|
||||||
|
export { default as default } from 'cluster';
|
||||||
|
}
|
412
node_modules/@types/node/console.d.ts
generated
vendored
Normal file
412
node_modules/@types/node/console.d.ts
generated
vendored
Normal file
@ -0,0 +1,412 @@
|
|||||||
|
/**
|
||||||
|
* The `console` module provides a simple debugging console that is similar to the
|
||||||
|
* JavaScript console mechanism provided by web browsers.
|
||||||
|
*
|
||||||
|
* The module exports two specific components:
|
||||||
|
*
|
||||||
|
* * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream.
|
||||||
|
* * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`.
|
||||||
|
*
|
||||||
|
* _**Warning**_: The global console object's methods are neither consistently
|
||||||
|
* synchronous like the browser APIs they resemble, nor are they consistently
|
||||||
|
* asynchronous like all other Node.js streams. See the `note on process I/O` for
|
||||||
|
* more information.
|
||||||
|
*
|
||||||
|
* Example using the global `console`:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* console.log('hello world');
|
||||||
|
* // Prints: hello world, to stdout
|
||||||
|
* console.log('hello %s', 'world');
|
||||||
|
* // Prints: hello world, to stdout
|
||||||
|
* console.error(new Error('Whoops, something bad happened'));
|
||||||
|
* // Prints error message and stack trace to stderr:
|
||||||
|
* // Error: Whoops, something bad happened
|
||||||
|
* // at [eval]:5:15
|
||||||
|
* // at Script.runInThisContext (node:vm:132:18)
|
||||||
|
* // at Object.runInThisContext (node:vm:309:38)
|
||||||
|
* // at node:internal/process/execution:77:19
|
||||||
|
* // at [eval]-wrapper:6:22
|
||||||
|
* // at evalScript (node:internal/process/execution:76:60)
|
||||||
|
* // at node:internal/main/eval_string:23:3
|
||||||
|
*
|
||||||
|
* const name = 'Will Robinson';
|
||||||
|
* console.warn(`Danger ${name}! Danger!`);
|
||||||
|
* // Prints: Danger Will Robinson! Danger!, to stderr
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Example using the `Console` class:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const out = getStreamSomehow();
|
||||||
|
* const err = getStreamSomehow();
|
||||||
|
* const myConsole = new console.Console(out, err);
|
||||||
|
*
|
||||||
|
* myConsole.log('hello world');
|
||||||
|
* // Prints: hello world, to out
|
||||||
|
* myConsole.log('hello %s', 'world');
|
||||||
|
* // Prints: hello world, to out
|
||||||
|
* myConsole.error(new Error('Whoops, something bad happened'));
|
||||||
|
* // Prints: [Error: Whoops, something bad happened], to err
|
||||||
|
*
|
||||||
|
* const name = 'Will Robinson';
|
||||||
|
* myConsole.warn(`Danger ${name}! Danger!`);
|
||||||
|
* // Prints: Danger Will Robinson! Danger!, to err
|
||||||
|
* ```
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/console.js)
|
||||||
|
*/
|
||||||
|
declare module 'console' {
|
||||||
|
import console = require('node:console');
|
||||||
|
export = console;
|
||||||
|
}
|
||||||
|
declare module 'node:console' {
|
||||||
|
import { InspectOptions } from 'node:util';
|
||||||
|
global {
|
||||||
|
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
|
||||||
|
interface Console {
|
||||||
|
Console: console.ConsoleConstructor;
|
||||||
|
/**
|
||||||
|
* `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only
|
||||||
|
* writes a message and does not otherwise affect execution. The output always
|
||||||
|
* starts with `"Assertion failed"`. If provided, `message` is formatted using `util.format()`.
|
||||||
|
*
|
||||||
|
* If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* console.assert(true, 'does nothing');
|
||||||
|
*
|
||||||
|
* console.assert(false, 'Whoops %s work', 'didn\'t');
|
||||||
|
* // Assertion failed: Whoops didn't work
|
||||||
|
*
|
||||||
|
* console.assert();
|
||||||
|
* // Assertion failed
|
||||||
|
* ```
|
||||||
|
* @since v0.1.101
|
||||||
|
* @param value The value tested for being truthy.
|
||||||
|
* @param message All arguments besides `value` are used as error message.
|
||||||
|
*/
|
||||||
|
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
||||||
|
/**
|
||||||
|
* When `stdout` is a TTY, calling `console.clear()` will attempt to clear the
|
||||||
|
* TTY. When `stdout` is not a TTY, this method does nothing.
|
||||||
|
*
|
||||||
|
* The specific operation of `console.clear()` can vary across operating systems
|
||||||
|
* and terminal types. For most Linux operating systems, `console.clear()`operates similarly to the `clear` shell command. On Windows, `console.clear()`will clear only the output in the
|
||||||
|
* current terminal viewport for the Node.js
|
||||||
|
* binary.
|
||||||
|
* @since v8.3.0
|
||||||
|
*/
|
||||||
|
clear(): void;
|
||||||
|
/**
|
||||||
|
* Maintains an internal counter specific to `label` and outputs to `stdout` the
|
||||||
|
* number of times `console.count()` has been called with the given `label`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* > console.count()
|
||||||
|
* default: 1
|
||||||
|
* undefined
|
||||||
|
* > console.count('default')
|
||||||
|
* default: 2
|
||||||
|
* undefined
|
||||||
|
* > console.count('abc')
|
||||||
|
* abc: 1
|
||||||
|
* undefined
|
||||||
|
* > console.count('xyz')
|
||||||
|
* xyz: 1
|
||||||
|
* undefined
|
||||||
|
* > console.count('abc')
|
||||||
|
* abc: 2
|
||||||
|
* undefined
|
||||||
|
* > console.count()
|
||||||
|
* default: 3
|
||||||
|
* undefined
|
||||||
|
* >
|
||||||
|
* ```
|
||||||
|
* @since v8.3.0
|
||||||
|
* @param label The display label for the counter.
|
||||||
|
*/
|
||||||
|
count(label?: string): void;
|
||||||
|
/**
|
||||||
|
* Resets the internal counter specific to `label`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* > console.count('abc');
|
||||||
|
* abc: 1
|
||||||
|
* undefined
|
||||||
|
* > console.countReset('abc');
|
||||||
|
* undefined
|
||||||
|
* > console.count('abc');
|
||||||
|
* abc: 1
|
||||||
|
* undefined
|
||||||
|
* >
|
||||||
|
* ```
|
||||||
|
* @since v8.3.0
|
||||||
|
* @param label The display label for the counter.
|
||||||
|
*/
|
||||||
|
countReset(label?: string): void;
|
||||||
|
/**
|
||||||
|
* The `console.debug()` function is an alias for {@link log}.
|
||||||
|
* @since v8.0.0
|
||||||
|
*/
|
||||||
|
debug(message?: any, ...optionalParams: any[]): void;
|
||||||
|
/**
|
||||||
|
* Uses `util.inspect()` on `obj` and prints the resulting string to `stdout`.
|
||||||
|
* This function bypasses any custom `inspect()` function defined on `obj`.
|
||||||
|
* @since v0.1.101
|
||||||
|
*/
|
||||||
|
dir(obj: any, options?: InspectOptions): void;
|
||||||
|
/**
|
||||||
|
* This method calls `console.log()` passing it the arguments received.
|
||||||
|
* This method does not produce any XML formatting.
|
||||||
|
* @since v8.0.0
|
||||||
|
*/
|
||||||
|
dirxml(...data: any[]): void;
|
||||||
|
/**
|
||||||
|
* Prints to `stderr` with newline. Multiple arguments can be passed, with the
|
||||||
|
* first used as the primary message and all additional used as substitution
|
||||||
|
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`).
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const code = 5;
|
||||||
|
* console.error('error #%d', code);
|
||||||
|
* // Prints: error #5, to stderr
|
||||||
|
* console.error('error', code);
|
||||||
|
* // Prints: error 5, to stderr
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If formatting elements (e.g. `%d`) are not found in the first string then `util.inspect()` is called on each argument and the resulting string
|
||||||
|
* values are concatenated. See `util.format()` for more information.
|
||||||
|
* @since v0.1.100
|
||||||
|
*/
|
||||||
|
error(message?: any, ...optionalParams: any[]): void;
|
||||||
|
/**
|
||||||
|
* Increases indentation of subsequent lines by spaces for `groupIndentation`length.
|
||||||
|
*
|
||||||
|
* If one or more `label`s are provided, those are printed first without the
|
||||||
|
* additional indentation.
|
||||||
|
* @since v8.5.0
|
||||||
|
*/
|
||||||
|
group(...label: any[]): void;
|
||||||
|
/**
|
||||||
|
* An alias for {@link group}.
|
||||||
|
* @since v8.5.0
|
||||||
|
*/
|
||||||
|
groupCollapsed(...label: any[]): void;
|
||||||
|
/**
|
||||||
|
* Decreases indentation of subsequent lines by spaces for `groupIndentation`length.
|
||||||
|
* @since v8.5.0
|
||||||
|
*/
|
||||||
|
groupEnd(): void;
|
||||||
|
/**
|
||||||
|
* The `console.info()` function is an alias for {@link log}.
|
||||||
|
* @since v0.1.100
|
||||||
|
*/
|
||||||
|
info(message?: any, ...optionalParams: any[]): void;
|
||||||
|
/**
|
||||||
|
* Prints to `stdout` with newline. Multiple arguments can be passed, with the
|
||||||
|
* first used as the primary message and all additional used as substitution
|
||||||
|
* values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`).
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const count = 5;
|
||||||
|
* console.log('count: %d', count);
|
||||||
|
* // Prints: count: 5, to stdout
|
||||||
|
* console.log('count:', count);
|
||||||
|
* // Prints: count: 5, to stdout
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* See `util.format()` for more information.
|
||||||
|
* @since v0.1.100
|
||||||
|
*/
|
||||||
|
log(message?: any, ...optionalParams: any[]): void;
|
||||||
|
/**
|
||||||
|
* Try to construct a table with the columns of the properties of `tabularData`(or use `properties`) and rows of `tabularData` and log it. Falls back to just
|
||||||
|
* logging the argument if it can’t be parsed as tabular.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* // These can't be parsed as tabular data
|
||||||
|
* console.table(Symbol());
|
||||||
|
* // Symbol()
|
||||||
|
*
|
||||||
|
* console.table(undefined);
|
||||||
|
* // undefined
|
||||||
|
*
|
||||||
|
* console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]);
|
||||||
|
* // ┌─────────┬─────┬─────┐
|
||||||
|
* // │ (index) │ a │ b │
|
||||||
|
* // ├─────────┼─────┼─────┤
|
||||||
|
* // │ 0 │ 1 │ 'Y' │
|
||||||
|
* // │ 1 │ 'Z' │ 2 │
|
||||||
|
* // └─────────┴─────┴─────┘
|
||||||
|
*
|
||||||
|
* console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']);
|
||||||
|
* // ┌─────────┬─────┐
|
||||||
|
* // │ (index) │ a │
|
||||||
|
* // ├─────────┼─────┤
|
||||||
|
* // │ 0 │ 1 │
|
||||||
|
* // │ 1 │ 'Z' │
|
||||||
|
* // └─────────┴─────┘
|
||||||
|
* ```
|
||||||
|
* @since v10.0.0
|
||||||
|
* @param properties Alternate properties for constructing the table.
|
||||||
|
*/
|
||||||
|
table(tabularData: any, properties?: ReadonlyArray<string>): void;
|
||||||
|
/**
|
||||||
|
* Starts a timer that can be used to compute the duration of an operation. Timers
|
||||||
|
* are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in
|
||||||
|
* suitable time units to `stdout`. For example, if the elapsed
|
||||||
|
* time is 3869ms, `console.timeEnd()` displays "3.869s".
|
||||||
|
* @since v0.1.104
|
||||||
|
*/
|
||||||
|
time(label?: string): void;
|
||||||
|
/**
|
||||||
|
* Stops a timer that was previously started by calling {@link time} and
|
||||||
|
* prints the result to `stdout`:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* console.time('100-elements');
|
||||||
|
* for (let i = 0; i < 100; i++) {}
|
||||||
|
* console.timeEnd('100-elements');
|
||||||
|
* // prints 100-elements: 225.438ms
|
||||||
|
* ```
|
||||||
|
* @since v0.1.104
|
||||||
|
*/
|
||||||
|
timeEnd(label?: string): void;
|
||||||
|
/**
|
||||||
|
* For a timer that was previously started by calling {@link time}, prints
|
||||||
|
* the elapsed time and other `data` arguments to `stdout`:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* console.time('process');
|
||||||
|
* const value = expensiveProcess1(); // Returns 42
|
||||||
|
* console.timeLog('process', value);
|
||||||
|
* // Prints "process: 365.227ms 42".
|
||||||
|
* doExpensiveProcess2(value);
|
||||||
|
* console.timeEnd('process');
|
||||||
|
* ```
|
||||||
|
* @since v10.7.0
|
||||||
|
*/
|
||||||
|
timeLog(label?: string, ...data: any[]): void;
|
||||||
|
/**
|
||||||
|
* Prints to `stderr` the string `'Trace: '`, followed by the `util.format()` formatted message and stack trace to the current position in the code.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* console.trace('Show me');
|
||||||
|
* // Prints: (stack trace will vary based on where trace is called)
|
||||||
|
* // Trace: Show me
|
||||||
|
* // at repl:2:9
|
||||||
|
* // at REPLServer.defaultEval (repl.js:248:27)
|
||||||
|
* // at bound (domain.js:287:14)
|
||||||
|
* // at REPLServer.runBound [as eval] (domain.js:300:12)
|
||||||
|
* // at REPLServer.<anonymous> (repl.js:412:12)
|
||||||
|
* // at emitOne (events.js:82:20)
|
||||||
|
* // at REPLServer.emit (events.js:169:7)
|
||||||
|
* // at REPLServer.Interface._onLine (readline.js:210:10)
|
||||||
|
* // at REPLServer.Interface._line (readline.js:549:8)
|
||||||
|
* // at REPLServer.Interface._ttyWrite (readline.js:826:14)
|
||||||
|
* ```
|
||||||
|
* @since v0.1.104
|
||||||
|
*/
|
||||||
|
trace(message?: any, ...optionalParams: any[]): void;
|
||||||
|
/**
|
||||||
|
* The `console.warn()` function is an alias for {@link error}.
|
||||||
|
* @since v0.1.100
|
||||||
|
*/
|
||||||
|
warn(message?: any, ...optionalParams: any[]): void;
|
||||||
|
// --- Inspector mode only ---
|
||||||
|
/**
|
||||||
|
* This method does not display anything unless used in the inspector.
|
||||||
|
* Starts a JavaScript CPU profile with an optional label.
|
||||||
|
*/
|
||||||
|
profile(label?: string): void;
|
||||||
|
/**
|
||||||
|
* This method does not display anything unless used in the inspector.
|
||||||
|
* Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector.
|
||||||
|
*/
|
||||||
|
profileEnd(label?: string): void;
|
||||||
|
/**
|
||||||
|
* This method does not display anything unless used in the inspector.
|
||||||
|
* Adds an event with the label `label` to the Timeline panel of the inspector.
|
||||||
|
*/
|
||||||
|
timeStamp(label?: string): void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The `console` module provides a simple debugging console that is similar to the
|
||||||
|
* JavaScript console mechanism provided by web browsers.
|
||||||
|
*
|
||||||
|
* The module exports two specific components:
|
||||||
|
*
|
||||||
|
* * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream.
|
||||||
|
* * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`.
|
||||||
|
*
|
||||||
|
* _**Warning**_: The global console object's methods are neither consistently
|
||||||
|
* synchronous like the browser APIs they resemble, nor are they consistently
|
||||||
|
* asynchronous like all other Node.js streams. See the `note on process I/O` for
|
||||||
|
* more information.
|
||||||
|
*
|
||||||
|
* Example using the global `console`:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* console.log('hello world');
|
||||||
|
* // Prints: hello world, to stdout
|
||||||
|
* console.log('hello %s', 'world');
|
||||||
|
* // Prints: hello world, to stdout
|
||||||
|
* console.error(new Error('Whoops, something bad happened'));
|
||||||
|
* // Prints error message and stack trace to stderr:
|
||||||
|
* // Error: Whoops, something bad happened
|
||||||
|
* // at [eval]:5:15
|
||||||
|
* // at Script.runInThisContext (node:vm:132:18)
|
||||||
|
* // at Object.runInThisContext (node:vm:309:38)
|
||||||
|
* // at node:internal/process/execution:77:19
|
||||||
|
* // at [eval]-wrapper:6:22
|
||||||
|
* // at evalScript (node:internal/process/execution:76:60)
|
||||||
|
* // at node:internal/main/eval_string:23:3
|
||||||
|
*
|
||||||
|
* const name = 'Will Robinson';
|
||||||
|
* console.warn(`Danger ${name}! Danger!`);
|
||||||
|
* // Prints: Danger Will Robinson! Danger!, to stderr
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Example using the `Console` class:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const out = getStreamSomehow();
|
||||||
|
* const err = getStreamSomehow();
|
||||||
|
* const myConsole = new console.Console(out, err);
|
||||||
|
*
|
||||||
|
* myConsole.log('hello world');
|
||||||
|
* // Prints: hello world, to out
|
||||||
|
* myConsole.log('hello %s', 'world');
|
||||||
|
* // Prints: hello world, to out
|
||||||
|
* myConsole.error(new Error('Whoops, something bad happened'));
|
||||||
|
* // Prints: [Error: Whoops, something bad happened], to err
|
||||||
|
*
|
||||||
|
* const name = 'Will Robinson';
|
||||||
|
* myConsole.warn(`Danger ${name}! Danger!`);
|
||||||
|
* // Prints: Danger Will Robinson! Danger!, to err
|
||||||
|
* ```
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/console.js)
|
||||||
|
*/
|
||||||
|
namespace console {
|
||||||
|
interface ConsoleConstructorOptions {
|
||||||
|
stdout: NodeJS.WritableStream;
|
||||||
|
stderr?: NodeJS.WritableStream | undefined;
|
||||||
|
ignoreErrors?: boolean | undefined;
|
||||||
|
colorMode?: boolean | 'auto' | undefined;
|
||||||
|
inspectOptions?: InspectOptions | undefined;
|
||||||
|
/**
|
||||||
|
* Set group indentation
|
||||||
|
* @default 2
|
||||||
|
*/
|
||||||
|
groupIndentation?: number | undefined;
|
||||||
|
}
|
||||||
|
interface ConsoleConstructor {
|
||||||
|
prototype: Console;
|
||||||
|
new (stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
|
||||||
|
new (options: ConsoleConstructorOptions): Console;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var console: Console;
|
||||||
|
}
|
||||||
|
export = globalThis.console;
|
||||||
|
}
|
18
node_modules/@types/node/constants.d.ts
generated
vendored
Normal file
18
node_modules/@types/node/constants.d.ts
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
|
||||||
|
declare module 'constants' {
|
||||||
|
import { constants as osConstants, SignalConstants } from 'node:os';
|
||||||
|
import { constants as cryptoConstants } from 'node:crypto';
|
||||||
|
import { constants as fsConstants } from 'node:fs';
|
||||||
|
|
||||||
|
const exp: typeof osConstants.errno &
|
||||||
|
typeof osConstants.priority &
|
||||||
|
SignalConstants &
|
||||||
|
typeof cryptoConstants &
|
||||||
|
typeof fsConstants;
|
||||||
|
export = exp;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'node:constants' {
|
||||||
|
import constants = require('constants');
|
||||||
|
export = constants;
|
||||||
|
}
|
3860
node_modules/@types/node/crypto.d.ts
generated
vendored
Normal file
3860
node_modules/@types/node/crypto.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
545
node_modules/@types/node/dgram.d.ts
generated
vendored
Normal file
545
node_modules/@types/node/dgram.d.ts
generated
vendored
Normal file
@ -0,0 +1,545 @@
|
|||||||
|
/**
|
||||||
|
* The `dgram` module provides an implementation of UDP datagram sockets.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import dgram from 'dgram';
|
||||||
|
*
|
||||||
|
* const server = dgram.createSocket('udp4');
|
||||||
|
*
|
||||||
|
* server.on('error', (err) => {
|
||||||
|
* console.log(`server error:\n${err.stack}`);
|
||||||
|
* server.close();
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* server.on('message', (msg, rinfo) => {
|
||||||
|
* console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* server.on('listening', () => {
|
||||||
|
* const address = server.address();
|
||||||
|
* console.log(`server listening ${address.address}:${address.port}`);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* server.bind(41234);
|
||||||
|
* // Prints: server listening 0.0.0.0:41234
|
||||||
|
* ```
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/dgram.js)
|
||||||
|
*/
|
||||||
|
declare module 'dgram' {
|
||||||
|
import { AddressInfo } from 'node:net';
|
||||||
|
import * as dns from 'node:dns';
|
||||||
|
import { EventEmitter, Abortable } from 'node:events';
|
||||||
|
interface RemoteInfo {
|
||||||
|
address: string;
|
||||||
|
family: 'IPv4' | 'IPv6';
|
||||||
|
port: number;
|
||||||
|
size: number;
|
||||||
|
}
|
||||||
|
interface BindOptions {
|
||||||
|
port?: number | undefined;
|
||||||
|
address?: string | undefined;
|
||||||
|
exclusive?: boolean | undefined;
|
||||||
|
fd?: number | undefined;
|
||||||
|
}
|
||||||
|
type SocketType = 'udp4' | 'udp6';
|
||||||
|
interface SocketOptions extends Abortable {
|
||||||
|
type: SocketType;
|
||||||
|
reuseAddr?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
ipv6Only?: boolean | undefined;
|
||||||
|
recvBufferSize?: number | undefined;
|
||||||
|
sendBufferSize?: number | undefined;
|
||||||
|
lookup?: ((hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void) | undefined;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram
|
||||||
|
* messages. When `address` and `port` are not passed to `socket.bind()` the
|
||||||
|
* method will bind the socket to the "all interfaces" address on a random port
|
||||||
|
* (it does the right thing for both `udp4` and `udp6` sockets). The bound address
|
||||||
|
* and port can be retrieved using `socket.address().address` and `socket.address().port`.
|
||||||
|
*
|
||||||
|
* If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.close()` on the socket:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const controller = new AbortController();
|
||||||
|
* const { signal } = controller;
|
||||||
|
* const server = dgram.createSocket({ type: 'udp4', signal });
|
||||||
|
* server.on('message', (msg, rinfo) => {
|
||||||
|
* console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
|
||||||
|
* });
|
||||||
|
* // Later, when you want to close the server.
|
||||||
|
* controller.abort();
|
||||||
|
* ```
|
||||||
|
* @since v0.11.13
|
||||||
|
* @param options Available options are:
|
||||||
|
* @param callback Attached as a listener for `'message'` events. Optional.
|
||||||
|
*/
|
||||||
|
function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
|
||||||
|
function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
|
||||||
|
/**
|
||||||
|
* Encapsulates the datagram functionality.
|
||||||
|
*
|
||||||
|
* New instances of `dgram.Socket` are created using {@link createSocket}.
|
||||||
|
* The `new` keyword is not to be used to create `dgram.Socket` instances.
|
||||||
|
* @since v0.1.99
|
||||||
|
*/
|
||||||
|
class Socket extends EventEmitter {
|
||||||
|
/**
|
||||||
|
* Tells the kernel to join a multicast group at the given `multicastAddress` and`multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the`multicastInterface` argument is not
|
||||||
|
* specified, the operating system will choose
|
||||||
|
* one interface and will add membership to it. To add membership to every
|
||||||
|
* available interface, call `addMembership` multiple times, once per interface.
|
||||||
|
*
|
||||||
|
* When called on an unbound socket, this method will implicitly bind to a random
|
||||||
|
* port, listening on all interfaces.
|
||||||
|
*
|
||||||
|
* When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import cluster from 'cluster';
|
||||||
|
* import dgram from 'dgram';
|
||||||
|
*
|
||||||
|
* if (cluster.isPrimary) {
|
||||||
|
* cluster.fork(); // Works ok.
|
||||||
|
* cluster.fork(); // Fails with EADDRINUSE.
|
||||||
|
* } else {
|
||||||
|
* const s = dgram.createSocket('udp4');
|
||||||
|
* s.bind(1234, () => {
|
||||||
|
* s.addMembership('224.0.0.114');
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.6.9
|
||||||
|
*/
|
||||||
|
addMembership(multicastAddress: string, multicastInterface?: string): void;
|
||||||
|
/**
|
||||||
|
* Returns an object containing the address information for a socket.
|
||||||
|
* For UDP sockets, this object will contain `address`, `family` and `port`properties.
|
||||||
|
*
|
||||||
|
* This method throws `EBADF` if called on an unbound socket.
|
||||||
|
* @since v0.1.99
|
||||||
|
*/
|
||||||
|
address(): AddressInfo;
|
||||||
|
/**
|
||||||
|
* For UDP sockets, causes the `dgram.Socket` to listen for datagram
|
||||||
|
* messages on a named `port` and optional `address`. If `port` is not
|
||||||
|
* specified or is `0`, the operating system will attempt to bind to a
|
||||||
|
* random port. If `address` is not specified, the operating system will
|
||||||
|
* attempt to listen on all addresses. Once binding is complete, a`'listening'` event is emitted and the optional `callback` function is
|
||||||
|
* called.
|
||||||
|
*
|
||||||
|
* Specifying both a `'listening'` event listener and passing a`callback` to the `socket.bind()` method is not harmful but not very
|
||||||
|
* useful.
|
||||||
|
*
|
||||||
|
* A bound datagram socket keeps the Node.js process running to receive
|
||||||
|
* datagram messages.
|
||||||
|
*
|
||||||
|
* If binding fails, an `'error'` event is generated. In rare case (e.g.
|
||||||
|
* attempting to bind with a closed socket), an `Error` may be thrown.
|
||||||
|
*
|
||||||
|
* Example of a UDP server listening on port 41234:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import dgram from 'dgram';
|
||||||
|
*
|
||||||
|
* const server = dgram.createSocket('udp4');
|
||||||
|
*
|
||||||
|
* server.on('error', (err) => {
|
||||||
|
* console.log(`server error:\n${err.stack}`);
|
||||||
|
* server.close();
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* server.on('message', (msg, rinfo) => {
|
||||||
|
* console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* server.on('listening', () => {
|
||||||
|
* const address = server.address();
|
||||||
|
* console.log(`server listening ${address.address}:${address.port}`);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* server.bind(41234);
|
||||||
|
* // Prints: server listening 0.0.0.0:41234
|
||||||
|
* ```
|
||||||
|
* @since v0.1.99
|
||||||
|
* @param callback with no parameters. Called when binding is complete.
|
||||||
|
*/
|
||||||
|
bind(port?: number, address?: string, callback?: () => void): this;
|
||||||
|
bind(port?: number, callback?: () => void): this;
|
||||||
|
bind(callback?: () => void): this;
|
||||||
|
bind(options: BindOptions, callback?: () => void): this;
|
||||||
|
/**
|
||||||
|
* Close the underlying socket and stop listening for data on it. If a callback is
|
||||||
|
* provided, it is added as a listener for the `'close'` event.
|
||||||
|
* @since v0.1.99
|
||||||
|
* @param callback Called when the socket has been closed.
|
||||||
|
*/
|
||||||
|
close(callback?: () => void): this;
|
||||||
|
/**
|
||||||
|
* Associates the `dgram.Socket` to a remote address and port. Every
|
||||||
|
* message sent by this handle is automatically sent to that destination. Also,
|
||||||
|
* the socket will only receive messages from that remote peer.
|
||||||
|
* Trying to call `connect()` on an already connected socket will result
|
||||||
|
* in an `ERR_SOCKET_DGRAM_IS_CONNECTED` exception. If `address` is not
|
||||||
|
* provided, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets)
|
||||||
|
* will be used by default. Once the connection is complete, a `'connect'` event
|
||||||
|
* is emitted and the optional `callback` function is called. In case of failure,
|
||||||
|
* the `callback` is called or, failing this, an `'error'` event is emitted.
|
||||||
|
* @since v12.0.0
|
||||||
|
* @param callback Called when the connection is completed or on error.
|
||||||
|
*/
|
||||||
|
connect(port: number, address?: string, callback?: () => void): void;
|
||||||
|
connect(port: number, callback: () => void): void;
|
||||||
|
/**
|
||||||
|
* A synchronous function that disassociates a connected `dgram.Socket` from
|
||||||
|
* its remote address. Trying to call `disconnect()` on an unbound or already
|
||||||
|
* disconnected socket will result in an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception.
|
||||||
|
* @since v12.0.0
|
||||||
|
*/
|
||||||
|
disconnect(): void;
|
||||||
|
/**
|
||||||
|
* Instructs the kernel to leave a multicast group at `multicastAddress` using the`IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the
|
||||||
|
* kernel when the socket is closed or the process terminates, so most apps will
|
||||||
|
* never have reason to call this.
|
||||||
|
*
|
||||||
|
* If `multicastInterface` is not specified, the operating system will attempt to
|
||||||
|
* drop membership on all valid interfaces.
|
||||||
|
* @since v0.6.9
|
||||||
|
*/
|
||||||
|
dropMembership(multicastAddress: string, multicastInterface?: string): void;
|
||||||
|
/**
|
||||||
|
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
|
||||||
|
* @since v8.7.0
|
||||||
|
* @return the `SO_RCVBUF` socket receive buffer size in bytes.
|
||||||
|
*/
|
||||||
|
getRecvBufferSize(): number;
|
||||||
|
/**
|
||||||
|
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
|
||||||
|
* @since v8.7.0
|
||||||
|
* @return the `SO_SNDBUF` socket send buffer size in bytes.
|
||||||
|
*/
|
||||||
|
getSendBufferSize(): number;
|
||||||
|
/**
|
||||||
|
* By default, binding a socket will cause it to block the Node.js process from
|
||||||
|
* exiting as long as the socket is open. The `socket.unref()` method can be used
|
||||||
|
* to exclude the socket from the reference counting that keeps the Node.js
|
||||||
|
* process active. The `socket.ref()` method adds the socket back to the reference
|
||||||
|
* counting and restores the default behavior.
|
||||||
|
*
|
||||||
|
* Calling `socket.ref()` multiples times will have no additional effect.
|
||||||
|
*
|
||||||
|
* The `socket.ref()` method returns a reference to the socket so calls can be
|
||||||
|
* chained.
|
||||||
|
* @since v0.9.1
|
||||||
|
*/
|
||||||
|
ref(): this;
|
||||||
|
/**
|
||||||
|
* Returns an object containing the `address`, `family`, and `port` of the remote
|
||||||
|
* endpoint. This method throws an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception
|
||||||
|
* if the socket is not connected.
|
||||||
|
* @since v12.0.0
|
||||||
|
*/
|
||||||
|
remoteAddress(): AddressInfo;
|
||||||
|
/**
|
||||||
|
* Broadcasts a datagram on the socket.
|
||||||
|
* For connectionless sockets, the destination `port` and `address` must be
|
||||||
|
* specified. Connected sockets, on the other hand, will use their associated
|
||||||
|
* remote endpoint, so the `port` and `address` arguments must not be set.
|
||||||
|
*
|
||||||
|
* The `msg` argument contains the message to be sent.
|
||||||
|
* Depending on its type, different behavior can apply. If `msg` is a `Buffer`,
|
||||||
|
* any `TypedArray` or a `DataView`,
|
||||||
|
* the `offset` and `length` specify the offset within the `Buffer` where the
|
||||||
|
* message begins and the number of bytes in the message, respectively.
|
||||||
|
* If `msg` is a `String`, then it is automatically converted to a `Buffer`with `'utf8'` encoding. With messages that
|
||||||
|
* contain multi-byte characters, `offset` and `length` will be calculated with
|
||||||
|
* respect to `byte length` and not the character position.
|
||||||
|
* If `msg` is an array, `offset` and `length` must not be specified.
|
||||||
|
*
|
||||||
|
* The `address` argument is a string. If the value of `address` is a host name,
|
||||||
|
* DNS will be used to resolve the address of the host. If `address` is not
|
||||||
|
* provided or otherwise falsy, `'127.0.0.1'` (for `udp4` sockets) or `'::1'`(for `udp6` sockets) will be used by default.
|
||||||
|
*
|
||||||
|
* If the socket has not been previously bound with a call to `bind`, the socket
|
||||||
|
* is assigned a random port number and is bound to the "all interfaces" address
|
||||||
|
* (`'0.0.0.0'` for `udp4` sockets, `'::0'` for `udp6` sockets.)
|
||||||
|
*
|
||||||
|
* An optional `callback` function may be specified to as a way of reporting
|
||||||
|
* DNS errors or for determining when it is safe to reuse the `buf` object.
|
||||||
|
* DNS lookups delay the time to send for at least one tick of the
|
||||||
|
* Node.js event loop.
|
||||||
|
*
|
||||||
|
* The only way to know for sure that the datagram has been sent is by using a`callback`. If an error occurs and a `callback` is given, the error will be
|
||||||
|
* passed as the first argument to the `callback`. If a `callback` is not given,
|
||||||
|
* the error is emitted as an `'error'` event on the `socket` object.
|
||||||
|
*
|
||||||
|
* Offset and length are optional but both _must_ be set if either are used.
|
||||||
|
* They are supported only when the first argument is a `Buffer`, a `TypedArray`,
|
||||||
|
* or a `DataView`.
|
||||||
|
*
|
||||||
|
* This method throws `ERR_SOCKET_BAD_PORT` if called on an unbound socket.
|
||||||
|
*
|
||||||
|
* Example of sending a UDP packet to a port on `localhost`;
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import dgram from 'dgram';
|
||||||
|
* import { Buffer } from 'buffer';
|
||||||
|
*
|
||||||
|
* const message = Buffer.from('Some bytes');
|
||||||
|
* const client = dgram.createSocket('udp4');
|
||||||
|
* client.send(message, 41234, 'localhost', (err) => {
|
||||||
|
* client.close();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`;
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import dgram from 'dgram';
|
||||||
|
* import { Buffer } from 'buffer';
|
||||||
|
*
|
||||||
|
* const buf1 = Buffer.from('Some ');
|
||||||
|
* const buf2 = Buffer.from('bytes');
|
||||||
|
* const client = dgram.createSocket('udp4');
|
||||||
|
* client.send([buf1, buf2], 41234, (err) => {
|
||||||
|
* client.close();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Sending multiple buffers might be faster or slower depending on the
|
||||||
|
* application and operating system. Run benchmarks to
|
||||||
|
* determine the optimal strategy on a case-by-case basis. Generally speaking,
|
||||||
|
* however, sending multiple buffers is faster.
|
||||||
|
*
|
||||||
|
* Example of sending a UDP packet using a socket connected to a port on`localhost`:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import dgram from 'dgram';
|
||||||
|
* import { Buffer } from 'buffer';
|
||||||
|
*
|
||||||
|
* const message = Buffer.from('Some bytes');
|
||||||
|
* const client = dgram.createSocket('udp4');
|
||||||
|
* client.connect(41234, 'localhost', (err) => {
|
||||||
|
* client.send(message, (err) => {
|
||||||
|
* client.close();
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v0.1.99
|
||||||
|
* @param msg Message to be sent.
|
||||||
|
* @param offset Offset in the buffer where the message starts.
|
||||||
|
* @param length Number of bytes in the message.
|
||||||
|
* @param port Destination port.
|
||||||
|
* @param address Destination host name or IP address.
|
||||||
|
* @param callback Called when the message has been sent.
|
||||||
|
*/
|
||||||
|
send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
|
||||||
|
send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
|
||||||
|
send(msg: string | Uint8Array | ReadonlyArray<any>, callback?: (error: Error | null, bytes: number) => void): void;
|
||||||
|
send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
|
||||||
|
send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
|
||||||
|
send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void;
|
||||||
|
/**
|
||||||
|
* Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP
|
||||||
|
* packets may be sent to a local interface's broadcast address.
|
||||||
|
*
|
||||||
|
* This method throws `EBADF` if called on an unbound socket.
|
||||||
|
* @since v0.6.9
|
||||||
|
*/
|
||||||
|
setBroadcast(flag: boolean): void;
|
||||||
|
/**
|
||||||
|
* _All references to scope in this section are referring to [IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC
|
||||||
|
* 4007](https://tools.ietf.org/html/rfc4007). In string form, an IP_
|
||||||
|
* _with a scope index is written as `'IP%scope'` where scope is an interface name_
|
||||||
|
* _or interface number._
|
||||||
|
*
|
||||||
|
* Sets the default outgoing multicast interface of the socket to a chosen
|
||||||
|
* interface or back to system interface selection. The `multicastInterface` must
|
||||||
|
* be a valid string representation of an IP from the socket's family.
|
||||||
|
*
|
||||||
|
* For IPv4 sockets, this should be the IP configured for the desired physical
|
||||||
|
* interface. All packets sent to multicast on the socket will be sent on the
|
||||||
|
* interface determined by the most recent successful use of this call.
|
||||||
|
*
|
||||||
|
* For IPv6 sockets, `multicastInterface` should include a scope to indicate the
|
||||||
|
* interface as in the examples that follow. In IPv6, individual `send` calls can
|
||||||
|
* also use explicit scope in addresses, so only packets sent to a multicast
|
||||||
|
* address without specifying an explicit scope are affected by the most recent
|
||||||
|
* successful use of this call.
|
||||||
|
*
|
||||||
|
* This method throws `EBADF` if called on an unbound socket.
|
||||||
|
*
|
||||||
|
* #### Example: IPv6 outgoing multicast interface
|
||||||
|
*
|
||||||
|
* On most systems, where scope format uses the interface name:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const socket = dgram.createSocket('udp6');
|
||||||
|
*
|
||||||
|
* socket.bind(1234, () => {
|
||||||
|
* socket.setMulticastInterface('::%eth1');
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* On Windows, where scope format uses an interface number:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const socket = dgram.createSocket('udp6');
|
||||||
|
*
|
||||||
|
* socket.bind(1234, () => {
|
||||||
|
* socket.setMulticastInterface('::%2');
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* #### Example: IPv4 outgoing multicast interface
|
||||||
|
*
|
||||||
|
* All systems use an IP of the host on the desired physical interface:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const socket = dgram.createSocket('udp4');
|
||||||
|
*
|
||||||
|
* socket.bind(1234, () => {
|
||||||
|
* socket.setMulticastInterface('10.0.0.2');
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v8.6.0
|
||||||
|
*/
|
||||||
|
setMulticastInterface(multicastInterface: string): void;
|
||||||
|
/**
|
||||||
|
* Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`,
|
||||||
|
* multicast packets will also be received on the local interface.
|
||||||
|
*
|
||||||
|
* This method throws `EBADF` if called on an unbound socket.
|
||||||
|
* @since v0.3.8
|
||||||
|
*/
|
||||||
|
setMulticastLoopback(flag: boolean): boolean;
|
||||||
|
/**
|
||||||
|
* Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for
|
||||||
|
* "Time to Live", in this context it specifies the number of IP hops that a
|
||||||
|
* packet is allowed to travel through, specifically for multicast traffic. Each
|
||||||
|
* router or gateway that forwards a packet decrements the TTL. If the TTL is
|
||||||
|
* decremented to 0 by a router, it will not be forwarded.
|
||||||
|
*
|
||||||
|
* The `ttl` argument may be between 0 and 255\. The default on most systems is `1`.
|
||||||
|
*
|
||||||
|
* This method throws `EBADF` if called on an unbound socket.
|
||||||
|
* @since v0.3.8
|
||||||
|
*/
|
||||||
|
setMulticastTTL(ttl: number): number;
|
||||||
|
/**
|
||||||
|
* Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer
|
||||||
|
* in bytes.
|
||||||
|
*
|
||||||
|
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
|
||||||
|
* @since v8.7.0
|
||||||
|
*/
|
||||||
|
setRecvBufferSize(size: number): void;
|
||||||
|
/**
|
||||||
|
* Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer
|
||||||
|
* in bytes.
|
||||||
|
*
|
||||||
|
* This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
|
||||||
|
* @since v8.7.0
|
||||||
|
*/
|
||||||
|
setSendBufferSize(size: number): void;
|
||||||
|
/**
|
||||||
|
* Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live",
|
||||||
|
* in this context it specifies the number of IP hops that a packet is allowed to
|
||||||
|
* travel through. Each router or gateway that forwards a packet decrements the
|
||||||
|
* TTL. If the TTL is decremented to 0 by a router, it will not be forwarded.
|
||||||
|
* Changing TTL values is typically done for network probes or when multicasting.
|
||||||
|
*
|
||||||
|
* The `ttl` argument may be between between 1 and 255\. The default on most systems
|
||||||
|
* is 64.
|
||||||
|
*
|
||||||
|
* This method throws `EBADF` if called on an unbound socket.
|
||||||
|
* @since v0.1.101
|
||||||
|
*/
|
||||||
|
setTTL(ttl: number): number;
|
||||||
|
/**
|
||||||
|
* By default, binding a socket will cause it to block the Node.js process from
|
||||||
|
* exiting as long as the socket is open. The `socket.unref()` method can be used
|
||||||
|
* to exclude the socket from the reference counting that keeps the Node.js
|
||||||
|
* process active, allowing the process to exit even if the socket is still
|
||||||
|
* listening.
|
||||||
|
*
|
||||||
|
* Calling `socket.unref()` multiple times will have no addition effect.
|
||||||
|
*
|
||||||
|
* The `socket.unref()` method returns a reference to the socket so calls can be
|
||||||
|
* chained.
|
||||||
|
* @since v0.9.1
|
||||||
|
*/
|
||||||
|
unref(): this;
|
||||||
|
/**
|
||||||
|
* Tells the kernel to join a source-specific multicast channel at the given`sourceAddress` and `groupAddress`, using the `multicastInterface` with the`IP_ADD_SOURCE_MEMBERSHIP` socket
|
||||||
|
* option. If the `multicastInterface` argument
|
||||||
|
* is not specified, the operating system will choose one interface and will add
|
||||||
|
* membership to it. To add membership to every available interface, call`socket.addSourceSpecificMembership()` multiple times, once per interface.
|
||||||
|
*
|
||||||
|
* When called on an unbound socket, this method will implicitly bind to a random
|
||||||
|
* port, listening on all interfaces.
|
||||||
|
* @since v13.1.0, v12.16.0
|
||||||
|
*/
|
||||||
|
addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
|
||||||
|
/**
|
||||||
|
* Instructs the kernel to leave a source-specific multicast channel at the given`sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP`socket option. This method is
|
||||||
|
* automatically called by the kernel when the
|
||||||
|
* socket is closed or the process terminates, so most apps will never have
|
||||||
|
* reason to call this.
|
||||||
|
*
|
||||||
|
* If `multicastInterface` is not specified, the operating system will attempt to
|
||||||
|
* drop membership on all valid interfaces.
|
||||||
|
* @since v13.1.0, v12.16.0
|
||||||
|
*/
|
||||||
|
dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
|
||||||
|
/**
|
||||||
|
* events.EventEmitter
|
||||||
|
* 1. close
|
||||||
|
* 2. connect
|
||||||
|
* 3. error
|
||||||
|
* 4. listening
|
||||||
|
* 5. message
|
||||||
|
*/
|
||||||
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
addListener(event: 'close', listener: () => void): this;
|
||||||
|
addListener(event: 'connect', listener: () => void): this;
|
||||||
|
addListener(event: 'error', listener: (err: Error) => void): this;
|
||||||
|
addListener(event: 'listening', listener: () => void): this;
|
||||||
|
addListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
|
||||||
|
emit(event: string | symbol, ...args: any[]): boolean;
|
||||||
|
emit(event: 'close'): boolean;
|
||||||
|
emit(event: 'connect'): boolean;
|
||||||
|
emit(event: 'error', err: Error): boolean;
|
||||||
|
emit(event: 'listening'): boolean;
|
||||||
|
emit(event: 'message', msg: Buffer, rinfo: RemoteInfo): boolean;
|
||||||
|
on(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
on(event: 'close', listener: () => void): this;
|
||||||
|
on(event: 'connect', listener: () => void): this;
|
||||||
|
on(event: 'error', listener: (err: Error) => void): this;
|
||||||
|
on(event: 'listening', listener: () => void): this;
|
||||||
|
on(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
|
||||||
|
once(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
once(event: 'close', listener: () => void): this;
|
||||||
|
once(event: 'connect', listener: () => void): this;
|
||||||
|
once(event: 'error', listener: (err: Error) => void): this;
|
||||||
|
once(event: 'listening', listener: () => void): this;
|
||||||
|
once(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
|
||||||
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
prependListener(event: 'close', listener: () => void): this;
|
||||||
|
prependListener(event: 'connect', listener: () => void): this;
|
||||||
|
prependListener(event: 'error', listener: (err: Error) => void): this;
|
||||||
|
prependListener(event: 'listening', listener: () => void): this;
|
||||||
|
prependListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
|
||||||
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
||||||
|
prependOnceListener(event: 'close', listener: () => void): this;
|
||||||
|
prependOnceListener(event: 'connect', listener: () => void): this;
|
||||||
|
prependOnceListener(event: 'error', listener: (err: Error) => void): this;
|
||||||
|
prependOnceListener(event: 'listening', listener: () => void): this;
|
||||||
|
prependOnceListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module 'node:dgram' {
|
||||||
|
export * from 'dgram';
|
||||||
|
}
|
152
node_modules/@types/node/diagnostics_channel.d.ts
generated
vendored
Normal file
152
node_modules/@types/node/diagnostics_channel.d.ts
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
/**
|
||||||
|
* The `diagnostics_channel` module provides an API to create named channels
|
||||||
|
* to report arbitrary message data for diagnostics purposes.
|
||||||
|
*
|
||||||
|
* It can be accessed using:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import diagnostics_channel from 'diagnostics_channel';
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* It is intended that a module writer wanting to report diagnostics messages
|
||||||
|
* will create one or many top-level channels to report messages through.
|
||||||
|
* Channels may also be acquired at runtime but it is not encouraged
|
||||||
|
* due to the additional overhead of doing so. Channels may be exported for
|
||||||
|
* convenience, but as long as the name is known it can be acquired anywhere.
|
||||||
|
*
|
||||||
|
* If you intend for your module to produce diagnostics data for others to
|
||||||
|
* consume it is recommended that you include documentation of what named
|
||||||
|
* channels are used along with the shape of the message data. Channel names
|
||||||
|
* should generally include the module name to avoid collisions with data from
|
||||||
|
* other modules.
|
||||||
|
* @experimental
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/diagnostics_channel.js)
|
||||||
|
*/
|
||||||
|
declare module 'diagnostics_channel' {
|
||||||
|
/**
|
||||||
|
* Check if there are active subscribers to the named channel. This is helpful if
|
||||||
|
* the message you want to send might be expensive to prepare.
|
||||||
|
*
|
||||||
|
* This API is optional but helpful when trying to publish messages from very
|
||||||
|
* performance-sensitive code.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import diagnostics_channel from 'diagnostics_channel';
|
||||||
|
*
|
||||||
|
* if (diagnostics_channel.hasSubscribers('my-channel')) {
|
||||||
|
* // There are subscribers, prepare and publish message
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v15.1.0, v14.17.0
|
||||||
|
* @param name The channel name
|
||||||
|
* @return If there are active subscribers
|
||||||
|
*/
|
||||||
|
function hasSubscribers(name: string): boolean;
|
||||||
|
/**
|
||||||
|
* This is the primary entry-point for anyone wanting to interact with a named
|
||||||
|
* channel. It produces a channel object which is optimized to reduce overhead at
|
||||||
|
* publish time as much as possible.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import diagnostics_channel from 'diagnostics_channel';
|
||||||
|
*
|
||||||
|
* const channel = diagnostics_channel.channel('my-channel');
|
||||||
|
* ```
|
||||||
|
* @since v15.1.0, v14.17.0
|
||||||
|
* @param name The channel name
|
||||||
|
* @return The named channel object
|
||||||
|
*/
|
||||||
|
function channel(name: string): Channel;
|
||||||
|
type ChannelListener = (message: unknown, name: string) => void;
|
||||||
|
/**
|
||||||
|
* The class `Channel` represents an individual named channel within the data
|
||||||
|
* pipeline. It is use to track subscribers and to publish messages when there
|
||||||
|
* are subscribers present. It exists as a separate object to avoid channel
|
||||||
|
* lookups at publish time, enabling very fast publish speeds and allowing
|
||||||
|
* for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly
|
||||||
|
* with `new Channel(name)` is not supported.
|
||||||
|
* @since v15.1.0, v14.17.0
|
||||||
|
*/
|
||||||
|
class Channel {
|
||||||
|
readonly name: string;
|
||||||
|
/**
|
||||||
|
* Check if there are active subscribers to this channel. This is helpful if
|
||||||
|
* the message you want to send might be expensive to prepare.
|
||||||
|
*
|
||||||
|
* This API is optional but helpful when trying to publish messages from very
|
||||||
|
* performance-sensitive code.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import diagnostics_channel from 'diagnostics_channel';
|
||||||
|
*
|
||||||
|
* const channel = diagnostics_channel.channel('my-channel');
|
||||||
|
*
|
||||||
|
* if (channel.hasSubscribers) {
|
||||||
|
* // There are subscribers, prepare and publish message
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v15.1.0, v14.17.0
|
||||||
|
*/
|
||||||
|
readonly hasSubscribers: boolean;
|
||||||
|
private constructor(name: string);
|
||||||
|
/**
|
||||||
|
* Publish a message to any subscribers to the channel. This will
|
||||||
|
* trigger message handlers synchronously so they will execute within
|
||||||
|
* the same context.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import diagnostics_channel from 'diagnostics_channel';
|
||||||
|
*
|
||||||
|
* const channel = diagnostics_channel.channel('my-channel');
|
||||||
|
*
|
||||||
|
* channel.publish({
|
||||||
|
* some: 'message'
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v15.1.0, v14.17.0
|
||||||
|
* @param message The message to send to the channel subscribers
|
||||||
|
*/
|
||||||
|
publish(message: unknown): void;
|
||||||
|
/**
|
||||||
|
* Register a message handler to subscribe to this channel. This message handler
|
||||||
|
* will be run synchronously whenever a message is published to the channel. Any
|
||||||
|
* errors thrown in the message handler will trigger an `'uncaughtException'`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import diagnostics_channel from 'diagnostics_channel';
|
||||||
|
*
|
||||||
|
* const channel = diagnostics_channel.channel('my-channel');
|
||||||
|
*
|
||||||
|
* channel.subscribe((message, name) => {
|
||||||
|
* // Received data
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v15.1.0, v14.17.0
|
||||||
|
* @param onMessage The handler to receive channel messages
|
||||||
|
*/
|
||||||
|
subscribe(onMessage: ChannelListener): void;
|
||||||
|
/**
|
||||||
|
* Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* import diagnostics_channel from 'diagnostics_channel';
|
||||||
|
*
|
||||||
|
* const channel = diagnostics_channel.channel('my-channel');
|
||||||
|
*
|
||||||
|
* function onMessage(message, name) {
|
||||||
|
* // Received data
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* channel.subscribe(onMessage);
|
||||||
|
*
|
||||||
|
* channel.unsubscribe(onMessage);
|
||||||
|
* ```
|
||||||
|
* @since v15.1.0, v14.17.0
|
||||||
|
* @param onMessage The previous subscribed handler to remove
|
||||||
|
*/
|
||||||
|
unsubscribe(onMessage: ChannelListener): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module 'node:diagnostics_channel' {
|
||||||
|
export * from 'diagnostics_channel';
|
||||||
|
}
|
654
node_modules/@types/node/dns.d.ts
generated
vendored
Normal file
654
node_modules/@types/node/dns.d.ts
generated
vendored
Normal file
@ -0,0 +1,654 @@
|
|||||||
|
/**
|
||||||
|
* The `dns` module enables name resolution. For example, use it to look up IP
|
||||||
|
* addresses of host names.
|
||||||
|
*
|
||||||
|
* Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the
|
||||||
|
* DNS protocol for lookups. {@link lookup} uses the operating system
|
||||||
|
* facilities to perform name resolution. It may not need to perform any network
|
||||||
|
* communication. To perform name resolution the way other applications on the same
|
||||||
|
* system do, use {@link lookup}.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const dns = require('dns');
|
||||||
|
*
|
||||||
|
* dns.lookup('example.org', (err, address, family) => {
|
||||||
|
* console.log('address: %j family: IPv%s', address, family);
|
||||||
|
* });
|
||||||
|
* // address: "93.184.216.34" family: IPv4
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* All other functions in the `dns` module connect to an actual DNS server to
|
||||||
|
* perform name resolution. They will always use the network to perform DNS
|
||||||
|
* queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform
|
||||||
|
* DNS queries, bypassing other name-resolution facilities.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const dns = require('dns');
|
||||||
|
*
|
||||||
|
* dns.resolve4('archive.org', (err, addresses) => {
|
||||||
|
* if (err) throw err;
|
||||||
|
*
|
||||||
|
* console.log(`addresses: ${JSON.stringify(addresses)}`);
|
||||||
|
*
|
||||||
|
* addresses.forEach((a) => {
|
||||||
|
* dns.reverse(a, (err, hostnames) => {
|
||||||
|
* if (err) {
|
||||||
|
* throw err;
|
||||||
|
* }
|
||||||
|
* console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* See the `Implementation considerations section` for more information.
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/dns.js)
|
||||||
|
*/
|
||||||
|
declare module 'dns' {
|
||||||
|
import * as dnsPromises from 'node:dns/promises';
|
||||||
|
// Supported getaddrinfo flags.
|
||||||
|
export const ADDRCONFIG: number;
|
||||||
|
export const V4MAPPED: number;
|
||||||
|
/**
|
||||||
|
* If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
|
||||||
|
* well as IPv4 mapped IPv6 addresses.
|
||||||
|
*/
|
||||||
|
export const ALL: number;
|
||||||
|
export interface LookupOptions {
|
||||||
|
family?: number | undefined;
|
||||||
|
hints?: number | undefined;
|
||||||
|
all?: boolean | undefined;
|
||||||
|
verbatim?: boolean | undefined;
|
||||||
|
}
|
||||||
|
export interface LookupOneOptions extends LookupOptions {
|
||||||
|
all?: false | undefined;
|
||||||
|
}
|
||||||
|
export interface LookupAllOptions extends LookupOptions {
|
||||||
|
all: true;
|
||||||
|
}
|
||||||
|
export interface LookupAddress {
|
||||||
|
address: string;
|
||||||
|
family: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
|
||||||
|
* AAAA (IPv6) record. All `option` properties are optional. If `options` is an
|
||||||
|
* integer, then it must be `4` or `6` – if `options` is not provided, then IPv4
|
||||||
|
* and IPv6 addresses are both returned if found.
|
||||||
|
*
|
||||||
|
* With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the
|
||||||
|
* properties `address` and `family`.
|
||||||
|
*
|
||||||
|
* On error, `err` is an `Error` object, where `err.code` is the error code.
|
||||||
|
* Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
|
||||||
|
* the host name does not exist but also when the lookup fails in other ways
|
||||||
|
* such as no available file descriptors.
|
||||||
|
*
|
||||||
|
* `dns.lookup()` does not necessarily have anything to do with the DNS protocol.
|
||||||
|
* The implementation uses an operating system facility that can associate names
|
||||||
|
* with addresses, and vice versa. This implementation can have subtle but
|
||||||
|
* important consequences on the behavior of any Node.js program. Please take some
|
||||||
|
* time to consult the `Implementation considerations section` before using`dns.lookup()`.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const dns = require('dns');
|
||||||
|
* const options = {
|
||||||
|
* family: 6,
|
||||||
|
* hints: dns.ADDRCONFIG | dns.V4MAPPED,
|
||||||
|
* };
|
||||||
|
* dns.lookup('example.com', options, (err, address, family) =>
|
||||||
|
* console.log('address: %j family: IPv%s', address, family));
|
||||||
|
* // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
|
||||||
|
*
|
||||||
|
* // When options.all is true, the result will be an Array.
|
||||||
|
* options.all = true;
|
||||||
|
* dns.lookup('example.com', options, (err, addresses) =>
|
||||||
|
* console.log('addresses: %j', addresses));
|
||||||
|
* // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If this method is invoked as its `util.promisify()` ed version, and `all`is not set to `true`, it returns a `Promise` for an `Object` with `address` and`family` properties.
|
||||||
|
* @since v0.1.90
|
||||||
|
*/
|
||||||
|
export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
||||||
|
export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
||||||
|
export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void;
|
||||||
|
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void;
|
||||||
|
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
||||||
|
export namespace lookup {
|
||||||
|
function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
|
||||||
|
function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
|
||||||
|
function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Resolves the given `address` and `port` into a host name and service using
|
||||||
|
* the operating system's underlying `getnameinfo` implementation.
|
||||||
|
*
|
||||||
|
* If `address` is not a valid IP address, a `TypeError` will be thrown.
|
||||||
|
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown.
|
||||||
|
*
|
||||||
|
* On an error, `err` is an `Error` object, where `err.code` is the error code.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const dns = require('dns');
|
||||||
|
* dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
|
||||||
|
* console.log(hostname, service);
|
||||||
|
* // Prints: localhost ssh
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* If this method is invoked as its `util.promisify()` ed version, it returns a`Promise` for an `Object` with `hostname` and `service` properties.
|
||||||
|
* @since v0.11.14
|
||||||
|
*/
|
||||||
|
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void;
|
||||||
|
export namespace lookupService {
|
||||||
|
function __promisify__(
|
||||||
|
address: string,
|
||||||
|
port: number
|
||||||
|
): Promise<{
|
||||||
|
hostname: string;
|
||||||
|
service: string;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
export interface ResolveOptions {
|
||||||
|
ttl: boolean;
|
||||||
|
}
|
||||||
|
export interface ResolveWithTtlOptions extends ResolveOptions {
|
||||||
|
ttl: true;
|
||||||
|
}
|
||||||
|
export interface RecordWithTtl {
|
||||||
|
address: string;
|
||||||
|
ttl: number;
|
||||||
|
}
|
||||||
|
/** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */
|
||||||
|
export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
|
||||||
|
export interface AnyARecord extends RecordWithTtl {
|
||||||
|
type: 'A';
|
||||||
|
}
|
||||||
|
export interface AnyAaaaRecord extends RecordWithTtl {
|
||||||
|
type: 'AAAA';
|
||||||
|
}
|
||||||
|
export interface CaaRecord {
|
||||||
|
critial: number;
|
||||||
|
issue?: string | undefined;
|
||||||
|
issuewild?: string | undefined;
|
||||||
|
iodef?: string | undefined;
|
||||||
|
contactemail?: string | undefined;
|
||||||
|
contactphone?: string | undefined;
|
||||||
|
}
|
||||||
|
export interface MxRecord {
|
||||||
|
priority: number;
|
||||||
|
exchange: string;
|
||||||
|
}
|
||||||
|
export interface AnyMxRecord extends MxRecord {
|
||||||
|
type: 'MX';
|
||||||
|
}
|
||||||
|
export interface NaptrRecord {
|
||||||
|
flags: string;
|
||||||
|
service: string;
|
||||||
|
regexp: string;
|
||||||
|
replacement: string;
|
||||||
|
order: number;
|
||||||
|
preference: number;
|
||||||
|
}
|
||||||
|
export interface AnyNaptrRecord extends NaptrRecord {
|
||||||
|
type: 'NAPTR';
|
||||||
|
}
|
||||||
|
export interface SoaRecord {
|
||||||
|
nsname: string;
|
||||||
|
hostmaster: string;
|
||||||
|
serial: number;
|
||||||
|
refresh: number;
|
||||||
|
retry: number;
|
||||||
|
expire: number;
|
||||||
|
minttl: number;
|
||||||
|
}
|
||||||
|
export interface AnySoaRecord extends SoaRecord {
|
||||||
|
type: 'SOA';
|
||||||
|
}
|
||||||
|
export interface SrvRecord {
|
||||||
|
priority: number;
|
||||||
|
weight: number;
|
||||||
|
port: number;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
export interface AnySrvRecord extends SrvRecord {
|
||||||
|
type: 'SRV';
|
||||||
|
}
|
||||||
|
export interface AnyTxtRecord {
|
||||||
|
type: 'TXT';
|
||||||
|
entries: string[];
|
||||||
|
}
|
||||||
|
export interface AnyNsRecord {
|
||||||
|
type: 'NS';
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
export interface AnyPtrRecord {
|
||||||
|
type: 'PTR';
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
export interface AnyCnameRecord {
|
||||||
|
type: 'CNAME';
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
export type AnyRecord = AnyARecord | AnyAaaaRecord | AnyCnameRecord | AnyMxRecord | AnyNaptrRecord | AnyNsRecord | AnyPtrRecord | AnySoaRecord | AnySrvRecord | AnyTxtRecord;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
|
||||||
|
* of the resource records. The `callback` function has arguments`(err, records)`. When successful, `records` will be an array of resource
|
||||||
|
* records. The type and structure of individual results varies based on `rrtype`:
|
||||||
|
*
|
||||||
|
* <omitted>
|
||||||
|
*
|
||||||
|
* On error, `err` is an `Error` object, where `err.code` is one of the `DNS error codes`.
|
||||||
|
* @since v0.1.27
|
||||||
|
* @param hostname Host name to resolve.
|
||||||
|
* @param [rrtype='A'] Resource record type.
|
||||||
|
*/
|
||||||
|
export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
||||||
|
export function resolve(hostname: string, rrtype: 'A', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
||||||
|
export function resolve(hostname: string, rrtype: 'AAAA', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
||||||
|
export function resolve(hostname: string, rrtype: 'ANY', callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
|
||||||
|
export function resolve(hostname: string, rrtype: 'CNAME', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
||||||
|
export function resolve(hostname: string, rrtype: 'MX', callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
|
||||||
|
export function resolve(hostname: string, rrtype: 'NAPTR', callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
|
||||||
|
export function resolve(hostname: string, rrtype: 'NS', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
||||||
|
export function resolve(hostname: string, rrtype: 'PTR', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
||||||
|
export function resolve(hostname: string, rrtype: 'SOA', callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void;
|
||||||
|
export function resolve(hostname: string, rrtype: 'SRV', callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
|
||||||
|
export function resolve(hostname: string, rrtype: 'TXT', callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
|
||||||
|
export function resolve(
|
||||||
|
hostname: string,
|
||||||
|
rrtype: string,
|
||||||
|
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void
|
||||||
|
): void;
|
||||||
|
export namespace resolve {
|
||||||
|
function __promisify__(hostname: string, rrtype?: 'A' | 'AAAA' | 'CNAME' | 'NS' | 'PTR'): Promise<string[]>;
|
||||||
|
function __promisify__(hostname: string, rrtype: 'ANY'): Promise<AnyRecord[]>;
|
||||||
|
function __promisify__(hostname: string, rrtype: 'MX'): Promise<MxRecord[]>;
|
||||||
|
function __promisify__(hostname: string, rrtype: 'NAPTR'): Promise<NaptrRecord[]>;
|
||||||
|
function __promisify__(hostname: string, rrtype: 'SOA'): Promise<SoaRecord>;
|
||||||
|
function __promisify__(hostname: string, rrtype: 'SRV'): Promise<SrvRecord[]>;
|
||||||
|
function __promisify__(hostname: string, rrtype: 'TXT'): Promise<string[][]>;
|
||||||
|
function __promisify__(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the`hostname`. The `addresses` argument passed to the `callback` function
|
||||||
|
* will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
|
||||||
|
* @since v0.1.16
|
||||||
|
* @param hostname Host name to resolve.
|
||||||
|
*/
|
||||||
|
export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
||||||
|
export function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
|
||||||
|
export function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
|
||||||
|
export namespace resolve4 {
|
||||||
|
function __promisify__(hostname: string): Promise<string[]>;
|
||||||
|
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
||||||
|
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve a IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
|
||||||
|
* will contain an array of IPv6 addresses.
|
||||||
|
* @since v0.1.16
|
||||||
|
* @param hostname Host name to resolve.
|
||||||
|
*/
|
||||||
|
export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
||||||
|
export function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
|
||||||
|
export function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
|
||||||
|
export namespace resolve6 {
|
||||||
|
function __promisify__(hostname: string): Promise<string[]>;
|
||||||
|
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
||||||
|
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The`addresses` argument passed to the `callback` function
|
||||||
|
* will contain an array of canonical name records available for the `hostname`(e.g. `['bar.example.com']`).
|
||||||
|
* @since v0.3.2
|
||||||
|
*/
|
||||||
|
export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
||||||
|
export namespace resolveCname {
|
||||||
|
function __promisify__(hostname: string): Promise<string[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve `CAA` records for the `hostname`. The`addresses` argument passed to the `callback` function
|
||||||
|
* will contain an array of certification authority authorization records
|
||||||
|
* available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`).
|
||||||
|
* @since v15.0.0
|
||||||
|
*/
|
||||||
|
export function resolveCaa(hostname: string, callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void): void;
|
||||||
|
export namespace resolveCaa {
|
||||||
|
function __promisify__(hostname: string): Promise<CaaRecord[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
|
||||||
|
* contain an array of objects containing both a `priority` and `exchange`property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
|
||||||
|
* @since v0.1.27
|
||||||
|
*/
|
||||||
|
export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
|
||||||
|
export namespace resolveMx {
|
||||||
|
function __promisify__(hostname: string): Promise<MxRecord[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. The `addresses` argument passed to the `callback`function will contain an array of
|
||||||
|
* objects with the following properties:
|
||||||
|
*
|
||||||
|
* * `flags`
|
||||||
|
* * `service`
|
||||||
|
* * `regexp`
|
||||||
|
* * `replacement`
|
||||||
|
* * `order`
|
||||||
|
* * `preference`
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* flags: 's',
|
||||||
|
* service: 'SIP+D2U',
|
||||||
|
* regexp: '',
|
||||||
|
* replacement: '_sip._udp.example.com',
|
||||||
|
* order: 30,
|
||||||
|
* preference: 100
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.9.12
|
||||||
|
*/
|
||||||
|
export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
|
||||||
|
export namespace resolveNaptr {
|
||||||
|
function __promisify__(hostname: string): Promise<NaptrRecord[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
|
||||||
|
* contain an array of name server records available for `hostname`(e.g. `['ns1.example.com', 'ns2.example.com']`).
|
||||||
|
* @since v0.1.90
|
||||||
|
*/
|
||||||
|
export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
||||||
|
export namespace resolveNs {
|
||||||
|
function __promisify__(hostname: string): Promise<string[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
|
||||||
|
* be an array of strings containing the reply records.
|
||||||
|
* @since v6.0.0
|
||||||
|
*/
|
||||||
|
export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
||||||
|
export namespace resolvePtr {
|
||||||
|
function __promisify__(hostname: string): Promise<string[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve a start of authority record (`SOA` record) for
|
||||||
|
* the `hostname`. The `address` argument passed to the `callback` function will
|
||||||
|
* be an object with the following properties:
|
||||||
|
*
|
||||||
|
* * `nsname`
|
||||||
|
* * `hostmaster`
|
||||||
|
* * `serial`
|
||||||
|
* * `refresh`
|
||||||
|
* * `retry`
|
||||||
|
* * `expire`
|
||||||
|
* * `minttl`
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* nsname: 'ns.example.com',
|
||||||
|
* hostmaster: 'root.example.com',
|
||||||
|
* serial: 2013101809,
|
||||||
|
* refresh: 10000,
|
||||||
|
* retry: 2400,
|
||||||
|
* expire: 604800,
|
||||||
|
* minttl: 3600
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.11.10
|
||||||
|
*/
|
||||||
|
export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void;
|
||||||
|
export namespace resolveSoa {
|
||||||
|
function __promisify__(hostname: string): Promise<SoaRecord>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
|
||||||
|
* be an array of objects with the following properties:
|
||||||
|
*
|
||||||
|
* * `priority`
|
||||||
|
* * `weight`
|
||||||
|
* * `port`
|
||||||
|
* * `name`
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* priority: 10,
|
||||||
|
* weight: 5,
|
||||||
|
* port: 21223,
|
||||||
|
* name: 'service.example.com'
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v0.1.27
|
||||||
|
*/
|
||||||
|
export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
|
||||||
|
export namespace resolveSrv {
|
||||||
|
function __promisify__(hostname: string): Promise<SrvRecord[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. The `records` argument passed to the `callback` function is a
|
||||||
|
* two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
|
||||||
|
* one record. Depending on the use case, these could be either joined together or
|
||||||
|
* treated separately.
|
||||||
|
* @since v0.1.27
|
||||||
|
*/
|
||||||
|
export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
|
||||||
|
export namespace resolveTxt {
|
||||||
|
function __promisify__(hostname: string): Promise<string[][]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).
|
||||||
|
* The `ret` argument passed to the `callback` function will be an array containing
|
||||||
|
* various types of records. Each object has a property `type` that indicates the
|
||||||
|
* type of the current record. And depending on the `type`, additional properties
|
||||||
|
* will be present on the object:
|
||||||
|
*
|
||||||
|
* <omitted>
|
||||||
|
*
|
||||||
|
* Here is an example of the `ret` object passed to the callback:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* [ { type: 'A', address: '127.0.0.1', ttl: 299 },
|
||||||
|
* { type: 'CNAME', value: 'example.com' },
|
||||||
|
* { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
|
||||||
|
* { type: 'NS', value: 'ns1.example.com' },
|
||||||
|
* { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
|
||||||
|
* { type: 'SOA',
|
||||||
|
* nsname: 'ns1.example.com',
|
||||||
|
* hostmaster: 'admin.example.com',
|
||||||
|
* serial: 156696742,
|
||||||
|
* refresh: 900,
|
||||||
|
* retry: 900,
|
||||||
|
* expire: 1800,
|
||||||
|
* minttl: 60 } ]
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* DNS server operators may choose not to respond to `ANY`queries. It may be better to call individual methods like {@link resolve4},{@link resolveMx}, and so on. For more details, see [RFC
|
||||||
|
* 8482](https://tools.ietf.org/html/rfc8482).
|
||||||
|
*/
|
||||||
|
export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
|
||||||
|
export namespace resolveAny {
|
||||||
|
function __promisify__(hostname: string): Promise<AnyRecord[]>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
|
||||||
|
* array of host names.
|
||||||
|
*
|
||||||
|
* On error, `err` is an `Error` object, where `err.code` is
|
||||||
|
* one of the `DNS error codes`.
|
||||||
|
* @since v0.1.16
|
||||||
|
*/
|
||||||
|
export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
|
||||||
|
/**
|
||||||
|
* Sets the IP address and port of servers to be used when performing DNS
|
||||||
|
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
|
||||||
|
* addresses. If the port is the IANA default DNS port (53) it can be omitted.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* dns.setServers([
|
||||||
|
* '4.4.4.4',
|
||||||
|
* '[2001:4860:4860::8888]',
|
||||||
|
* '4.4.4.4:1053',
|
||||||
|
* '[2001:4860:4860::8888]:1053',
|
||||||
|
* ]);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* An error will be thrown if an invalid address is provided.
|
||||||
|
*
|
||||||
|
* The `dns.setServers()` method must not be called while a DNS query is in
|
||||||
|
* progress.
|
||||||
|
*
|
||||||
|
* The {@link setServers} method affects only {@link resolve},`dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}).
|
||||||
|
*
|
||||||
|
* This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
|
||||||
|
* That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
|
||||||
|
* subsequent servers provided. Fallback DNS servers will only be used if the
|
||||||
|
* earlier ones time out or result in some other error.
|
||||||
|
* @since v0.11.3
|
||||||
|
* @param servers array of `RFC 5952` formatted addresses
|
||||||
|
*/
|
||||||
|
export function setServers(servers: ReadonlyArray<string>): void;
|
||||||
|
/**
|
||||||
|
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
|
||||||
|
* that are currently configured for DNS resolution. A string will include a port
|
||||||
|
* section if a custom port is used.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* [
|
||||||
|
* '4.4.4.4',
|
||||||
|
* '2001:4860:4860::8888',
|
||||||
|
* '4.4.4.4:1053',
|
||||||
|
* '[2001:4860:4860::8888]:1053',
|
||||||
|
* ]
|
||||||
|
* ```
|
||||||
|
* @since v0.11.3
|
||||||
|
*/
|
||||||
|
export function getServers(): string[];
|
||||||
|
/**
|
||||||
|
* Set the default value of `verbatim` in {@link lookup}. The value could be:
|
||||||
|
* - `ipv4first`: sets default `verbatim` `false`.
|
||||||
|
* - `verbatim`: sets default `verbatim` `true`.
|
||||||
|
*
|
||||||
|
* The default is `ipv4first` and {@link setDefaultResultOrder} have higher priority than `--dns-result-order`.
|
||||||
|
* When using worker threads, {@link setDefaultResultOrder} from the main thread won't affect the default dns orders in workers.
|
||||||
|
* @since v14.18.0
|
||||||
|
* @param order must be 'ipv4first' or 'verbatim'.
|
||||||
|
*/
|
||||||
|
export function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
|
||||||
|
// Error codes
|
||||||
|
export const NODATA: string;
|
||||||
|
export const FORMERR: string;
|
||||||
|
export const SERVFAIL: string;
|
||||||
|
export const NOTFOUND: string;
|
||||||
|
export const NOTIMP: string;
|
||||||
|
export const REFUSED: string;
|
||||||
|
export const BADQUERY: string;
|
||||||
|
export const BADNAME: string;
|
||||||
|
export const BADFAMILY: string;
|
||||||
|
export const BADRESP: string;
|
||||||
|
export const CONNREFUSED: string;
|
||||||
|
export const TIMEOUT: string;
|
||||||
|
export const EOF: string;
|
||||||
|
export const FILE: string;
|
||||||
|
export const NOMEM: string;
|
||||||
|
export const DESTRUCTION: string;
|
||||||
|
export const BADSTR: string;
|
||||||
|
export const BADFLAGS: string;
|
||||||
|
export const NONAME: string;
|
||||||
|
export const BADHINTS: string;
|
||||||
|
export const NOTINITIALIZED: string;
|
||||||
|
export const LOADIPHLPAPI: string;
|
||||||
|
export const ADDRGETNETWORKPARAMS: string;
|
||||||
|
export const CANCELLED: string;
|
||||||
|
export interface ResolverOptions {
|
||||||
|
timeout?: number | undefined;
|
||||||
|
/**
|
||||||
|
* @default 4
|
||||||
|
*/
|
||||||
|
tries?: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* An independent resolver for DNS requests.
|
||||||
|
*
|
||||||
|
* Creating a new resolver uses the default server settings. Setting
|
||||||
|
* the servers used for a resolver using `resolver.setServers()` does not affect
|
||||||
|
* other resolvers:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { Resolver } = require('dns');
|
||||||
|
* const resolver = new Resolver();
|
||||||
|
* resolver.setServers(['4.4.4.4']);
|
||||||
|
*
|
||||||
|
* // This request will use the server at 4.4.4.4, independent of global settings.
|
||||||
|
* resolver.resolve4('example.org', (err, addresses) => {
|
||||||
|
* // ...
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The following methods from the `dns` module are available:
|
||||||
|
*
|
||||||
|
* * `resolver.getServers()`
|
||||||
|
* * `resolver.resolve()`
|
||||||
|
* * `resolver.resolve4()`
|
||||||
|
* * `resolver.resolve6()`
|
||||||
|
* * `resolver.resolveAny()`
|
||||||
|
* * `resolver.resolveCaa()`
|
||||||
|
* * `resolver.resolveCname()`
|
||||||
|
* * `resolver.resolveMx()`
|
||||||
|
* * `resolver.resolveNaptr()`
|
||||||
|
* * `resolver.resolveNs()`
|
||||||
|
* * `resolver.resolvePtr()`
|
||||||
|
* * `resolver.resolveSoa()`
|
||||||
|
* * `resolver.resolveSrv()`
|
||||||
|
* * `resolver.resolveTxt()`
|
||||||
|
* * `resolver.reverse()`
|
||||||
|
* * `resolver.setServers()`
|
||||||
|
* @since v8.3.0
|
||||||
|
*/
|
||||||
|
export class Resolver {
|
||||||
|
constructor(options?: ResolverOptions);
|
||||||
|
/**
|
||||||
|
* Cancel all outstanding DNS queries made by this resolver. The corresponding
|
||||||
|
* callbacks will be called with an error with code `ECANCELLED`.
|
||||||
|
* @since v8.3.0
|
||||||
|
*/
|
||||||
|
cancel(): void;
|
||||||
|
getServers: typeof getServers;
|
||||||
|
resolve: typeof resolve;
|
||||||
|
resolve4: typeof resolve4;
|
||||||
|
resolve6: typeof resolve6;
|
||||||
|
resolveAny: typeof resolveAny;
|
||||||
|
resolveCname: typeof resolveCname;
|
||||||
|
resolveMx: typeof resolveMx;
|
||||||
|
resolveNaptr: typeof resolveNaptr;
|
||||||
|
resolveNs: typeof resolveNs;
|
||||||
|
resolvePtr: typeof resolvePtr;
|
||||||
|
resolveSoa: typeof resolveSoa;
|
||||||
|
resolveSrv: typeof resolveSrv;
|
||||||
|
resolveTxt: typeof resolveTxt;
|
||||||
|
reverse: typeof reverse;
|
||||||
|
/**
|
||||||
|
* The resolver instance will send its requests from the specified IP address.
|
||||||
|
* This allows programs to specify outbound interfaces when used on multi-homed
|
||||||
|
* systems.
|
||||||
|
*
|
||||||
|
* If a v4 or v6 address is not specified, it is set to the default, and the
|
||||||
|
* operating system will choose a local address automatically.
|
||||||
|
*
|
||||||
|
* The resolver will use the v4 local address when making requests to IPv4 DNS
|
||||||
|
* servers, and the v6 local address when making requests to IPv6 DNS servers.
|
||||||
|
* The `rrtype` of resolution requests has no impact on the local address used.
|
||||||
|
* @since v15.1.0
|
||||||
|
* @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.
|
||||||
|
* @param [ipv6='::0'] A string representation of an IPv6 address.
|
||||||
|
*/
|
||||||
|
setLocalAddress(ipv4?: string, ipv6?: string): void;
|
||||||
|
setServers: typeof setServers;
|
||||||
|
}
|
||||||
|
export { dnsPromises as promises };
|
||||||
|
}
|
||||||
|
declare module 'node:dns' {
|
||||||
|
export * from 'dns';
|
||||||
|
}
|
368
node_modules/@types/node/dns/promises.d.ts
generated
vendored
Normal file
368
node_modules/@types/node/dns/promises.d.ts
generated
vendored
Normal file
@ -0,0 +1,368 @@
|
|||||||
|
/**
|
||||||
|
* The `dns.promises` API provides an alternative set of asynchronous DNS methods
|
||||||
|
* that return `Promise` objects rather than using callbacks. The API is accessible
|
||||||
|
* via `require('dns').promises` or `require('dns/promises')`.
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
declare module 'dns/promises' {
|
||||||
|
import {
|
||||||
|
LookupAddress,
|
||||||
|
LookupOneOptions,
|
||||||
|
LookupAllOptions,
|
||||||
|
LookupOptions,
|
||||||
|
AnyRecord,
|
||||||
|
CaaRecord,
|
||||||
|
MxRecord,
|
||||||
|
NaptrRecord,
|
||||||
|
SoaRecord,
|
||||||
|
SrvRecord,
|
||||||
|
ResolveWithTtlOptions,
|
||||||
|
RecordWithTtl,
|
||||||
|
ResolveOptions,
|
||||||
|
ResolverOptions,
|
||||||
|
} from 'node:dns';
|
||||||
|
/**
|
||||||
|
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
|
||||||
|
* that are currently configured for DNS resolution. A string will include a port
|
||||||
|
* section if a custom port is used.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* [
|
||||||
|
* '4.4.4.4',
|
||||||
|
* '2001:4860:4860::8888',
|
||||||
|
* '4.4.4.4:1053',
|
||||||
|
* '[2001:4860:4860::8888]:1053',
|
||||||
|
* ]
|
||||||
|
* ```
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function getServers(): string[];
|
||||||
|
/**
|
||||||
|
* Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
|
||||||
|
* AAAA (IPv6) record. All `option` properties are optional. If `options` is an
|
||||||
|
* integer, then it must be `4` or `6` – if `options` is not provided, then IPv4
|
||||||
|
* and IPv6 addresses are both returned if found.
|
||||||
|
*
|
||||||
|
* With the `all` option set to `true`, the `Promise` is resolved with `addresses`being an array of objects with the properties `address` and `family`.
|
||||||
|
*
|
||||||
|
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code.
|
||||||
|
* Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
|
||||||
|
* the host name does not exist but also when the lookup fails in other ways
|
||||||
|
* such as no available file descriptors.
|
||||||
|
*
|
||||||
|
* `dnsPromises.lookup()` does not necessarily have anything to do with the DNS
|
||||||
|
* protocol. The implementation uses an operating system facility that can
|
||||||
|
* associate names with addresses, and vice versa. This implementation can have
|
||||||
|
* subtle but important consequences on the behavior of any Node.js program. Please
|
||||||
|
* take some time to consult the `Implementation considerations section` before
|
||||||
|
* using `dnsPromises.lookup()`.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const dns = require('dns');
|
||||||
|
* const dnsPromises = dns.promises;
|
||||||
|
* const options = {
|
||||||
|
* family: 6,
|
||||||
|
* hints: dns.ADDRCONFIG | dns.V4MAPPED,
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* dnsPromises.lookup('example.com', options).then((result) => {
|
||||||
|
* console.log('address: %j family: IPv%s', result.address, result.family);
|
||||||
|
* // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // When options.all is true, the result will be an Array.
|
||||||
|
* options.all = true;
|
||||||
|
* dnsPromises.lookup('example.com', options).then((result) => {
|
||||||
|
* console.log('addresses: %j', result);
|
||||||
|
* // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function lookup(hostname: string, family: number): Promise<LookupAddress>;
|
||||||
|
function lookup(hostname: string, options: LookupOneOptions): Promise<LookupAddress>;
|
||||||
|
function lookup(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
|
||||||
|
function lookup(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
|
||||||
|
function lookup(hostname: string): Promise<LookupAddress>;
|
||||||
|
/**
|
||||||
|
* Resolves the given `address` and `port` into a host name and service using
|
||||||
|
* the operating system's underlying `getnameinfo` implementation.
|
||||||
|
*
|
||||||
|
* If `address` is not a valid IP address, a `TypeError` will be thrown.
|
||||||
|
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown.
|
||||||
|
*
|
||||||
|
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const dnsPromises = require('dns').promises;
|
||||||
|
* dnsPromises.lookupService('127.0.0.1', 22).then((result) => {
|
||||||
|
* console.log(result.hostname, result.service);
|
||||||
|
* // Prints: localhost ssh
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function lookupService(
|
||||||
|
address: string,
|
||||||
|
port: number
|
||||||
|
): Promise<{
|
||||||
|
hostname: string;
|
||||||
|
service: string;
|
||||||
|
}>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
|
||||||
|
* of the resource records. When successful, the `Promise` is resolved with an
|
||||||
|
* array of resource records. The type and structure of individual results vary
|
||||||
|
* based on `rrtype`:
|
||||||
|
*
|
||||||
|
* <omitted>
|
||||||
|
*
|
||||||
|
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`.
|
||||||
|
* @since v10.6.0
|
||||||
|
* @param hostname Host name to resolve.
|
||||||
|
* @param [rrtype='A'] Resource record type.
|
||||||
|
*/
|
||||||
|
function resolve(hostname: string): Promise<string[]>;
|
||||||
|
function resolve(hostname: string, rrtype: 'A'): Promise<string[]>;
|
||||||
|
function resolve(hostname: string, rrtype: 'AAAA'): Promise<string[]>;
|
||||||
|
function resolve(hostname: string, rrtype: 'ANY'): Promise<AnyRecord[]>;
|
||||||
|
function resolve(hostname: string, rrtype: 'CAA'): Promise<CaaRecord[]>;
|
||||||
|
function resolve(hostname: string, rrtype: 'CNAME'): Promise<string[]>;
|
||||||
|
function resolve(hostname: string, rrtype: 'MX'): Promise<MxRecord[]>;
|
||||||
|
function resolve(hostname: string, rrtype: 'NAPTR'): Promise<NaptrRecord[]>;
|
||||||
|
function resolve(hostname: string, rrtype: 'NS'): Promise<string[]>;
|
||||||
|
function resolve(hostname: string, rrtype: 'PTR'): Promise<string[]>;
|
||||||
|
function resolve(hostname: string, rrtype: 'SOA'): Promise<SoaRecord>;
|
||||||
|
function resolve(hostname: string, rrtype: 'SRV'): Promise<SrvRecord[]>;
|
||||||
|
function resolve(hostname: string, rrtype: 'TXT'): Promise<string[][]>;
|
||||||
|
function resolve(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv4
|
||||||
|
* addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
|
||||||
|
* @since v10.6.0
|
||||||
|
* @param hostname Host name to resolve.
|
||||||
|
*/
|
||||||
|
function resolve4(hostname: string): Promise<string[]>;
|
||||||
|
function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
||||||
|
function resolve4(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv6
|
||||||
|
* addresses.
|
||||||
|
* @since v10.6.0
|
||||||
|
* @param hostname Host name to resolve.
|
||||||
|
*/
|
||||||
|
function resolve6(hostname: string): Promise<string[]>;
|
||||||
|
function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
||||||
|
function resolve6(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).
|
||||||
|
* On success, the `Promise` is resolved with an array containing various types of
|
||||||
|
* records. Each object has a property `type` that indicates the type of the
|
||||||
|
* current record. And depending on the `type`, additional properties will be
|
||||||
|
* present on the object:
|
||||||
|
*
|
||||||
|
* <omitted>
|
||||||
|
*
|
||||||
|
* Here is an example of the result object:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* [ { type: 'A', address: '127.0.0.1', ttl: 299 },
|
||||||
|
* { type: 'CNAME', value: 'example.com' },
|
||||||
|
* { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
|
||||||
|
* { type: 'NS', value: 'ns1.example.com' },
|
||||||
|
* { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
|
||||||
|
* { type: 'SOA',
|
||||||
|
* nsname: 'ns1.example.com',
|
||||||
|
* hostmaster: 'admin.example.com',
|
||||||
|
* serial: 156696742,
|
||||||
|
* refresh: 900,
|
||||||
|
* retry: 900,
|
||||||
|
* expire: 1800,
|
||||||
|
* minttl: 60 } ]
|
||||||
|
* ```
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolveAny(hostname: string): Promise<AnyRecord[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success,
|
||||||
|
* the `Promise` is resolved with an array of objects containing available
|
||||||
|
* certification authority authorization records available for the `hostname`(e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`).
|
||||||
|
* @since v15.0.0
|
||||||
|
*/
|
||||||
|
function resolveCaa(hostname: string): Promise<CaaRecord[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve `CNAME` records for the `hostname`. On success,
|
||||||
|
* the `Promise` is resolved with an array of canonical name records available for
|
||||||
|
* the `hostname` (e.g. `['bar.example.com']`).
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolveCname(hostname: string): Promise<string[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects
|
||||||
|
* containing both a `priority` and `exchange` property (e.g.`[{priority: 10, exchange: 'mx.example.com'}, ...]`).
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolveMx(hostname: string): Promise<MxRecord[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. On success, the `Promise` is resolved with an array
|
||||||
|
* of objects with the following properties:
|
||||||
|
*
|
||||||
|
* * `flags`
|
||||||
|
* * `service`
|
||||||
|
* * `regexp`
|
||||||
|
* * `replacement`
|
||||||
|
* * `order`
|
||||||
|
* * `preference`
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* flags: 's',
|
||||||
|
* service: 'SIP+D2U',
|
||||||
|
* regexp: '',
|
||||||
|
* replacement: '_sip._udp.example.com',
|
||||||
|
* order: 30,
|
||||||
|
* preference: 100
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolveNaptr(hostname: string): Promise<NaptrRecord[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. On success, the `Promise` is resolved with an array of name server
|
||||||
|
* records available for `hostname` (e.g.`['ns1.example.com', 'ns2.example.com']`).
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolveNs(hostname: string): Promise<string[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. On success, the `Promise` is resolved with an array of strings
|
||||||
|
* containing the reply records.
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolvePtr(hostname: string): Promise<string[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve a start of authority record (`SOA` record) for
|
||||||
|
* the `hostname`. On success, the `Promise` is resolved with an object with the
|
||||||
|
* following properties:
|
||||||
|
*
|
||||||
|
* * `nsname`
|
||||||
|
* * `hostmaster`
|
||||||
|
* * `serial`
|
||||||
|
* * `refresh`
|
||||||
|
* * `retry`
|
||||||
|
* * `expire`
|
||||||
|
* * `minttl`
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* nsname: 'ns.example.com',
|
||||||
|
* hostmaster: 'root.example.com',
|
||||||
|
* serial: 2013101809,
|
||||||
|
* refresh: 10000,
|
||||||
|
* retry: 2400,
|
||||||
|
* expire: 604800,
|
||||||
|
* minttl: 3600
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolveSoa(hostname: string): Promise<SoaRecord>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects with
|
||||||
|
* the following properties:
|
||||||
|
*
|
||||||
|
* * `priority`
|
||||||
|
* * `weight`
|
||||||
|
* * `port`
|
||||||
|
* * `name`
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* {
|
||||||
|
* priority: 10,
|
||||||
|
* weight: 5,
|
||||||
|
* port: 21223,
|
||||||
|
* name: 'service.example.com'
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolveSrv(hostname: string): Promise<SrvRecord[]>;
|
||||||
|
/**
|
||||||
|
* Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. On success, the `Promise` is resolved with a two-dimensional array
|
||||||
|
* of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
|
||||||
|
* one record. Depending on the use case, these could be either joined together or
|
||||||
|
* treated separately.
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function resolveTxt(hostname: string): Promise<string[][]>;
|
||||||
|
/**
|
||||||
|
* Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
|
||||||
|
* array of host names.
|
||||||
|
*
|
||||||
|
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`.
|
||||||
|
* @since v10.6.0
|
||||||
|
*/
|
||||||
|
function reverse(ip: string): Promise<string[]>;
|
||||||
|
/**
|
||||||
|
* Sets the IP address and port of servers to be used when performing DNS
|
||||||
|
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
|
||||||
|
* addresses. If the port is the IANA default DNS port (53) it can be omitted.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* dnsPromises.setServers([
|
||||||
|
* '4.4.4.4',
|
||||||
|
* '[2001:4860:4860::8888]',
|
||||||
|
* '4.4.4.4:1053',
|
||||||
|
* '[2001:4860:4860::8888]:1053',
|
||||||
|
* ]);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* An error will be thrown if an invalid address is provided.
|
||||||
|
*
|
||||||
|
* The `dnsPromises.setServers()` method must not be called while a DNS query is in
|
||||||
|
* progress.
|
||||||
|
*
|
||||||
|
* This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
|
||||||
|
* That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
|
||||||
|
* subsequent servers provided. Fallback DNS servers will only be used if the
|
||||||
|
* earlier ones time out or result in some other error.
|
||||||
|
* @since v10.6.0
|
||||||
|
* @param servers array of `RFC 5952` formatted addresses
|
||||||
|
*/
|
||||||
|
function setServers(servers: ReadonlyArray<string>): void;
|
||||||
|
/**
|
||||||
|
* Set the default value of `verbatim` in {@link lookup}. The value could be:
|
||||||
|
* - `ipv4first`: sets default `verbatim` `false`.
|
||||||
|
* - `verbatim`: sets default `verbatim` `true`.
|
||||||
|
*
|
||||||
|
* The default is `ipv4first` and {@link setDefaultResultOrder} have higher priority than `--dns-result-order`.
|
||||||
|
* When using worker threads, {@link setDefaultResultOrder} from the main thread won't affect the default dns orders in workers.
|
||||||
|
* @since v14.18.0
|
||||||
|
* @param order must be 'ipv4first' or 'verbatim'.
|
||||||
|
*/
|
||||||
|
function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
|
||||||
|
class Resolver {
|
||||||
|
constructor(options?: ResolverOptions);
|
||||||
|
cancel(): void;
|
||||||
|
getServers: typeof getServers;
|
||||||
|
resolve: typeof resolve;
|
||||||
|
resolve4: typeof resolve4;
|
||||||
|
resolve6: typeof resolve6;
|
||||||
|
resolveAny: typeof resolveAny;
|
||||||
|
resolveCname: typeof resolveCname;
|
||||||
|
resolveMx: typeof resolveMx;
|
||||||
|
resolveNaptr: typeof resolveNaptr;
|
||||||
|
resolveNs: typeof resolveNs;
|
||||||
|
resolvePtr: typeof resolvePtr;
|
||||||
|
resolveSoa: typeof resolveSoa;
|
||||||
|
resolveSrv: typeof resolveSrv;
|
||||||
|
resolveTxt: typeof resolveTxt;
|
||||||
|
reverse: typeof reverse;
|
||||||
|
setLocalAddress(ipv4?: string, ipv6?: string): void;
|
||||||
|
setServers: typeof setServers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
declare module 'node:dns/promises' {
|
||||||
|
export * from 'dns/promises';
|
||||||
|
}
|
170
node_modules/@types/node/domain.d.ts
generated
vendored
Normal file
170
node_modules/@types/node/domain.d.ts
generated
vendored
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
/**
|
||||||
|
* **This module is pending deprecation.** Once a replacement API has been
|
||||||
|
* finalized, this module will be fully deprecated. Most developers should
|
||||||
|
* **not** have cause to use this module. Users who absolutely must have
|
||||||
|
* the functionality that domains provide may rely on it for the time being
|
||||||
|
* but should expect to have to migrate to a different solution
|
||||||
|
* in the future.
|
||||||
|
*
|
||||||
|
* Domains provide a way to handle multiple different IO operations as a
|
||||||
|
* single group. If any of the event emitters or callbacks registered to a
|
||||||
|
* domain emit an `'error'` event, or throw an error, then the domain object
|
||||||
|
* will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
|
||||||
|
* exit immediately with an error code.
|
||||||
|
* @deprecated Since v1.4.2 - Deprecated
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/domain.js)
|
||||||
|
*/
|
||||||
|
declare module 'domain' {
|
||||||
|
import EventEmitter = require('node:events');
|
||||||
|
/**
|
||||||
|
* The `Domain` class encapsulates the functionality of routing errors and
|
||||||
|
* uncaught exceptions to the active `Domain` object.
|
||||||
|
*
|
||||||
|
* To handle the errors that it catches, listen to its `'error'` event.
|
||||||
|
*/
|
||||||
|
class Domain extends EventEmitter {
|
||||||
|
/**
|
||||||
|
* An array of timers and event emitters that have been explicitly added
|
||||||
|
* to the domain.
|
||||||
|
*/
|
||||||
|
members: Array<EventEmitter | NodeJS.Timer>;
|
||||||
|
/**
|
||||||
|
* The `enter()` method is plumbing used by the `run()`, `bind()`, and`intercept()` methods to set the active domain. It sets `domain.active` and`process.domain` to the domain, and implicitly
|
||||||
|
* pushes the domain onto the domain
|
||||||
|
* stack managed by the domain module (see {@link exit} for details on the
|
||||||
|
* domain stack). The call to `enter()` delimits the beginning of a chain of
|
||||||
|
* asynchronous calls and I/O operations bound to a domain.
|
||||||
|
*
|
||||||
|
* Calling `enter()` changes only the active domain, and does not alter the domain
|
||||||
|
* itself. `enter()` and `exit()` can be called an arbitrary number of times on a
|
||||||
|
* single domain.
|
||||||
|
*/
|
||||||
|
enter(): void;
|
||||||
|
/**
|
||||||
|
* The `exit()` method exits the current domain, popping it off the domain stack.
|
||||||
|
* Any time execution is going to switch to the context of a different chain of
|
||||||
|
* asynchronous calls, it's important to ensure that the current domain is exited.
|
||||||
|
* The call to `exit()` delimits either the end of or an interruption to the chain
|
||||||
|
* of asynchronous calls and I/O operations bound to a domain.
|
||||||
|
*
|
||||||
|
* If there are multiple, nested domains bound to the current execution context,`exit()` will exit any domains nested within this domain.
|
||||||
|
*
|
||||||
|
* Calling `exit()` changes only the active domain, and does not alter the domain
|
||||||
|
* itself. `enter()` and `exit()` can be called an arbitrary number of times on a
|
||||||
|
* single domain.
|
||||||
|
*/
|
||||||
|
exit(): void;
|
||||||
|
/**
|
||||||
|
* Run the supplied function in the context of the domain, implicitly
|
||||||
|
* binding all event emitters, timers, and lowlevel requests that are
|
||||||
|
* created in that context. Optionally, arguments can be passed to
|
||||||
|
* the function.
|
||||||
|
*
|
||||||
|
* This is the most basic way to use a domain.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const domain = require('domain');
|
||||||
|
* const fs = require('fs');
|
||||||
|
* const d = domain.create();
|
||||||
|
* d.on('error', (er) => {
|
||||||
|
* console.error('Caught error!', er);
|
||||||
|
* });
|
||||||
|
* d.run(() => {
|
||||||
|
* process.nextTick(() => {
|
||||||
|
* setTimeout(() => { // Simulating some various async stuff
|
||||||
|
* fs.open('non-existent file', 'r', (er, fd) => {
|
||||||
|
* if (er) throw er;
|
||||||
|
* // proceed...
|
||||||
|
* });
|
||||||
|
* }, 100);
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* In this example, the `d.on('error')` handler will be triggered, rather
|
||||||
|
* than crashing the program.
|
||||||
|
*/
|
||||||
|
run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
|
||||||
|
/**
|
||||||
|
* Explicitly adds an emitter to the domain. If any event handlers called by
|
||||||
|
* the emitter throw an error, or if the emitter emits an `'error'` event, it
|
||||||
|
* will be routed to the domain's `'error'` event, just like with implicit
|
||||||
|
* binding.
|
||||||
|
*
|
||||||
|
* This also works with timers that are returned from `setInterval()` and `setTimeout()`. If their callback function throws, it will be caught by
|
||||||
|
* the domain `'error'` handler.
|
||||||
|
*
|
||||||
|
* If the Timer or `EventEmitter` was already bound to a domain, it is removed
|
||||||
|
* from that one, and bound to this one instead.
|
||||||
|
* @param emitter emitter or timer to be added to the domain
|
||||||
|
*/
|
||||||
|
add(emitter: EventEmitter | NodeJS.Timer): void;
|
||||||
|
/**
|
||||||
|
* The opposite of {@link add}. Removes domain handling from the
|
||||||
|
* specified emitter.
|
||||||
|
* @param emitter emitter or timer to be removed from the domain
|
||||||
|
*/
|
||||||
|
remove(emitter: EventEmitter | NodeJS.Timer): void;
|
||||||
|
/**
|
||||||
|
* The returned function will be a wrapper around the supplied callback
|
||||||
|
* function. When the returned function is called, any errors that are
|
||||||
|
* thrown will be routed to the domain's `'error'` event.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const d = domain.create();
|
||||||
|
*
|
||||||
|
* function readSomeFile(filename, cb) {
|
||||||
|
* fs.readFile(filename, 'utf8', d.bind((er, data) => {
|
||||||
|
* // If this throws, it will also be passed to the domain.
|
||||||
|
* return cb(er, data ? JSON.parse(data) : null);
|
||||||
|
* }));
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* d.on('error', (er) => {
|
||||||
|
* // An error occurred somewhere. If we throw it now, it will crash the program
|
||||||
|
* // with the normal line number and stack message.
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @param callback The callback function
|
||||||
|
* @return The bound function
|
||||||
|
*/
|
||||||
|
bind<T extends Function>(callback: T): T;
|
||||||
|
/**
|
||||||
|
* This method is almost identical to {@link bind}. However, in
|
||||||
|
* addition to catching thrown errors, it will also intercept `Error` objects sent as the first argument to the function.
|
||||||
|
*
|
||||||
|
* In this way, the common `if (err) return callback(err);` pattern can be replaced
|
||||||
|
* with a single error handler in a single place.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const d = domain.create();
|
||||||
|
*
|
||||||
|
* function readSomeFile(filename, cb) {
|
||||||
|
* fs.readFile(filename, 'utf8', d.intercept((data) => {
|
||||||
|
* // Note, the first argument is never passed to the
|
||||||
|
* // callback since it is assumed to be the 'Error' argument
|
||||||
|
* // and thus intercepted by the domain.
|
||||||
|
*
|
||||||
|
* // If this throws, it will also be passed to the domain
|
||||||
|
* // so the error-handling logic can be moved to the 'error'
|
||||||
|
* // event on the domain instead of being repeated throughout
|
||||||
|
* // the program.
|
||||||
|
* return cb(null, JSON.parse(data));
|
||||||
|
* }));
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* d.on('error', (er) => {
|
||||||
|
* // An error occurred somewhere. If we throw it now, it will crash the program
|
||||||
|
* // with the normal line number and stack message.
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @param callback The callback function
|
||||||
|
* @return The intercepted function
|
||||||
|
*/
|
||||||
|
intercept<T extends Function>(callback: T): T;
|
||||||
|
}
|
||||||
|
function create(): Domain;
|
||||||
|
}
|
||||||
|
declare module 'node:domain' {
|
||||||
|
export * from 'domain';
|
||||||
|
}
|
641
node_modules/@types/node/events.d.ts
generated
vendored
Normal file
641
node_modules/@types/node/events.d.ts
generated
vendored
Normal file
@ -0,0 +1,641 @@
|
|||||||
|
/**
|
||||||
|
* Much of the Node.js core API is built around an idiomatic asynchronous
|
||||||
|
* event-driven architecture in which certain kinds of objects (called "emitters")
|
||||||
|
* emit named events that cause `Function` objects ("listeners") to be called.
|
||||||
|
*
|
||||||
|
* For instance: a `net.Server` object emits an event each time a peer
|
||||||
|
* connects to it; a `fs.ReadStream` emits an event when the file is opened;
|
||||||
|
* a `stream` emits an event whenever data is available to be read.
|
||||||
|
*
|
||||||
|
* All objects that emit events are instances of the `EventEmitter` class. These
|
||||||
|
* objects expose an `eventEmitter.on()` function that allows one or more
|
||||||
|
* functions to be attached to named events emitted by the object. Typically,
|
||||||
|
* event names are camel-cased strings but any valid JavaScript property key
|
||||||
|
* can be used.
|
||||||
|
*
|
||||||
|
* When the `EventEmitter` object emits an event, all of the functions attached
|
||||||
|
* to that specific event are called _synchronously_. Any values returned by the
|
||||||
|
* called listeners are _ignored_ and discarded.
|
||||||
|
*
|
||||||
|
* The following example shows a simple `EventEmitter` instance with a single
|
||||||
|
* listener. The `eventEmitter.on()` method is used to register listeners, while
|
||||||
|
* the `eventEmitter.emit()` method is used to trigger the event.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const EventEmitter = require('events');
|
||||||
|
*
|
||||||
|
* class MyEmitter extends EventEmitter {}
|
||||||
|
*
|
||||||
|
* const myEmitter = new MyEmitter();
|
||||||
|
* myEmitter.on('event', () => {
|
||||||
|
* console.log('an event occurred!');
|
||||||
|
* });
|
||||||
|
* myEmitter.emit('event');
|
||||||
|
* ```
|
||||||
|
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/events.js)
|
||||||
|
*/
|
||||||
|
declare module 'events' {
|
||||||
|
interface EventEmitterOptions {
|
||||||
|
/**
|
||||||
|
* Enables automatic capturing of promise rejection.
|
||||||
|
*/
|
||||||
|
captureRejections?: boolean | undefined;
|
||||||
|
}
|
||||||
|
interface NodeEventTarget {
|
||||||
|
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
}
|
||||||
|
interface DOMEventTarget {
|
||||||
|
addEventListener(
|
||||||
|
eventName: string,
|
||||||
|
listener: (...args: any[]) => void,
|
||||||
|
opts?: {
|
||||||
|
once: boolean;
|
||||||
|
}
|
||||||
|
): any;
|
||||||
|
}
|
||||||
|
interface StaticEventEmitterOptions {
|
||||||
|
signal?: AbortSignal | undefined;
|
||||||
|
}
|
||||||
|
interface EventEmitter extends NodeJS.EventEmitter {}
|
||||||
|
/**
|
||||||
|
* The `EventEmitter` class is defined and exposed by the `events` module:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const EventEmitter = require('events');
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* All `EventEmitter`s emit the event `'newListener'` when new listeners are
|
||||||
|
* added and `'removeListener'` when existing listeners are removed.
|
||||||
|
*
|
||||||
|
* It supports the following option:
|
||||||
|
* @since v0.1.26
|
||||||
|
*/
|
||||||
|
class EventEmitter {
|
||||||
|
constructor(options?: EventEmitterOptions);
|
||||||
|
/**
|
||||||
|
* Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
|
||||||
|
* event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
|
||||||
|
* The `Promise` will resolve with an array of all the arguments emitted to the
|
||||||
|
* given event.
|
||||||
|
*
|
||||||
|
* This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event
|
||||||
|
* semantics and does not listen to the `'error'` event.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { once, EventEmitter } = require('events');
|
||||||
|
*
|
||||||
|
* async function run() {
|
||||||
|
* const ee = new EventEmitter();
|
||||||
|
*
|
||||||
|
* process.nextTick(() => {
|
||||||
|
* ee.emit('myevent', 42);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* const [value] = await once(ee, 'myevent');
|
||||||
|
* console.log(value);
|
||||||
|
*
|
||||||
|
* const err = new Error('kaboom');
|
||||||
|
* process.nextTick(() => {
|
||||||
|
* ee.emit('error', err);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* try {
|
||||||
|
* await once(ee, 'myevent');
|
||||||
|
* } catch (err) {
|
||||||
|
* console.log('error happened', err);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* run();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the
|
||||||
|
* '`error'` event itself, then it is treated as any other kind of event without
|
||||||
|
* special handling:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { EventEmitter, once } = require('events');
|
||||||
|
*
|
||||||
|
* const ee = new EventEmitter();
|
||||||
|
*
|
||||||
|
* once(ee, 'error')
|
||||||
|
* .then(([err]) => console.log('ok', err.message))
|
||||||
|
* .catch((err) => console.log('error', err.message));
|
||||||
|
*
|
||||||
|
* ee.emit('error', new Error('boom'));
|
||||||
|
*
|
||||||
|
* // Prints: ok boom
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* An `AbortSignal` can be used to cancel waiting for the event:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { EventEmitter, once } = require('events');
|
||||||
|
*
|
||||||
|
* const ee = new EventEmitter();
|
||||||
|
* const ac = new AbortController();
|
||||||
|
*
|
||||||
|
* async function foo(emitter, event, signal) {
|
||||||
|
* try {
|
||||||
|
* await once(emitter, event, { signal });
|
||||||
|
* console.log('event emitted!');
|
||||||
|
* } catch (error) {
|
||||||
|
* if (error.name === 'AbortError') {
|
||||||
|
* console.error('Waiting for the event was canceled!');
|
||||||
|
* } else {
|
||||||
|
* console.error('There was an error', error.message);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* foo(ee, 'foo', ac.signal);
|
||||||
|
* ac.abort(); // Abort waiting for the event
|
||||||
|
* ee.emit('foo'); // Prints: Waiting for the event was canceled!
|
||||||
|
* ```
|
||||||
|
* @since v11.13.0, v10.16.0
|
||||||
|
*/
|
||||||
|
static once(emitter: NodeEventTarget, eventName: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>;
|
||||||
|
static once(emitter: DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* const { on, EventEmitter } = require('events');
|
||||||
|
*
|
||||||
|
* (async () => {
|
||||||
|
* const ee = new EventEmitter();
|
||||||
|
*
|
||||||
|
* // Emit later on
|
||||||
|
* process.nextTick(() => {
|
||||||
|
* ee.emit('foo', 'bar');
|
||||||
|
* ee.emit('foo', 42);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* for await (const event of on(ee, 'foo')) {
|
||||||
|
* // The execution of this inner block is synchronous and it
|
||||||
|
* // processes one event at a time (even with await). Do not use
|
||||||
|
* // if concurrent execution is required.
|
||||||
|
* console.log(event); // prints ['bar'] [42]
|
||||||
|
* }
|
||||||
|
* // Unreachable here
|
||||||
|
* })();
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Returns an `AsyncIterator` that iterates `eventName` events. It will throw
|
||||||
|
* if the `EventEmitter` emits `'error'`. It removes all listeners when
|
||||||
|
* exiting the loop. The `value` returned by each iteration is an array
|
||||||
|
* composed of the emitted event arguments.
|
||||||
|
*
|
||||||
|
* An `AbortSignal` can be used to cancel waiting on events:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { on, EventEmitter } = require('events');
|
||||||
|
* const ac = new AbortController();
|
||||||
|
*
|
||||||
|
* (async () => {
|
||||||
|
* const ee = new EventEmitter();
|
||||||
|
*
|
||||||
|
* // Emit later on
|
||||||
|
* process.nextTick(() => {
|
||||||
|
* ee.emit('foo', 'bar');
|
||||||
|
* ee.emit('foo', 42);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* for await (const event of on(ee, 'foo', { signal: ac.signal })) {
|
||||||
|
* // The execution of this inner block is synchronous and it
|
||||||
|
* // processes one event at a time (even with await). Do not use
|
||||||
|
* // if concurrent execution is required.
|
||||||
|
* console.log(event); // prints ['bar'] [42]
|
||||||
|
* }
|
||||||
|
* // Unreachable here
|
||||||
|
* })();
|
||||||
|
*
|
||||||
|
* process.nextTick(() => ac.abort());
|
||||||
|
* ```
|
||||||
|
* @since v13.6.0, v12.16.0
|
||||||
|
* @param eventName The name of the event being listened for
|
||||||
|
* @return that iterates `eventName` events emitted by the `emitter`
|
||||||
|
*/
|
||||||
|
static on(emitter: NodeJS.EventEmitter, eventName: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>;
|
||||||
|
/**
|
||||||
|
* A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { EventEmitter, listenerCount } = require('events');
|
||||||
|
* const myEmitter = new EventEmitter();
|
||||||
|
* myEmitter.on('event', () => {});
|
||||||
|
* myEmitter.on('event', () => {});
|
||||||
|
* console.log(listenerCount(myEmitter, 'event'));
|
||||||
|
* // Prints: 2
|
||||||
|
* ```
|
||||||
|
* @since v0.9.12
|
||||||
|
* @deprecated Since v3.2.0 - Use `listenerCount` instead.
|
||||||
|
* @param emitter The emitter to query
|
||||||
|
* @param eventName The event name
|
||||||
|
*/
|
||||||
|
static listenerCount(emitter: NodeJS.EventEmitter, eventName: string | symbol): number;
|
||||||
|
/**
|
||||||
|
* Returns a copy of the array of listeners for the event named `eventName`.
|
||||||
|
*
|
||||||
|
* For `EventEmitter`s this behaves exactly the same as calling `.listeners` on
|
||||||
|
* the emitter.
|
||||||
|
*
|
||||||
|
* For `EventTarget`s this is the only way to get the event listeners for the
|
||||||
|
* event target. This is useful for debugging and diagnostic purposes.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const { getEventListeners, EventEmitter } = require('events');
|
||||||
|
*
|
||||||
|
* {
|
||||||
|
* const ee = new EventEmitter();
|
||||||
|
* const listener = () => console.log('Events are fun');
|
||||||
|
* ee.on('foo', listener);
|
||||||
|
* getEventListeners(ee, 'foo'); // [listener]
|
||||||
|
* }
|
||||||
|
* {
|
||||||
|
* const et = new EventTarget();
|
||||||
|
* const listener = () => console.log('Events are fun');
|
||||||
|
* et.addEventListener('foo', listener);
|
||||||
|
* getEventListeners(et, 'foo'); // [listener]
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
* @since v15.2.0
|
||||||
|
*/
|
||||||
|
static getEventListeners(emitter: DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
|
||||||
|
/**
|
||||||
|
* ```js
|
||||||
|
* const {
|
||||||
|
* setMaxListeners,
|
||||||
|
* EventEmitter
|
||||||
|
* } = require('events');
|
||||||
|
*
|
||||||
|
* const target = new EventTarget();
|
||||||
|
* const emitter = new EventEmitter();
|
||||||
|
*
|
||||||
|
* setMaxListeners(5, target, emitter);
|
||||||
|
* ```
|
||||||
|
* @since v15.4.0
|
||||||
|
* @param n A non-negative number. The maximum number of listeners per `EventTarget` event.
|
||||||
|
* @param eventsTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter}
|
||||||
|
* objects.
|
||||||
|
*/
|
||||||
|
static setMaxListeners(n?: number, ...eventTargets: Array<DOMEventTarget | NodeJS.EventEmitter>): void;
|
||||||
|
/**
|
||||||
|
* This symbol shall be used to install a listener for only monitoring `'error'`
|
||||||
|
* events. Listeners installed using this symbol are called before the regular
|
||||||
|
* `'error'` listeners are called.
|
||||||
|
*
|
||||||
|
* Installing a listener using this symbol does not change the behavior once an
|
||||||
|
* `'error'` event is emitted, therefore the process will still crash if no
|
||||||
|
* regular `'error'` listener is installed.
|
||||||
|
*/
|
||||||
|
static readonly errorMonitor: unique symbol;
|
||||||
|
static readonly captureRejectionSymbol: unique symbol;
|
||||||
|
/**
|
||||||
|
* Sets or gets the default captureRejection value for all emitters.
|
||||||
|
*/
|
||||||
|
// TODO: These should be described using static getter/setter pairs:
|
||||||
|
static captureRejections: boolean;
|
||||||
|
static defaultMaxListeners: number;
|
||||||
|
}
|
||||||
|
import internal = require('node:events');
|
||||||
|
namespace EventEmitter {
|
||||||
|
// Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4
|
||||||
|
export { internal as EventEmitter };
|
||||||
|
export interface Abortable {
|
||||||
|
/**
|
||||||
|
* When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
|
||||||
|
*/
|
||||||
|
signal?: AbortSignal | undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
global {
|
||||||
|
namespace NodeJS {
|
||||||
|
interface EventEmitter {
|
||||||
|
/**
|
||||||
|
* Alias for `emitter.on(eventName, listener)`.
|
||||||
|
* @since v0.1.26
|
||||||
|
*/
|
||||||
|
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
/**
|
||||||
|
* Adds the `listener` function to the end of the listeners array for the
|
||||||
|
* event named `eventName`. No checks are made to see if the `listener` has
|
||||||
|
* already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
|
||||||
|
* times.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* server.on('connection', (stream) => {
|
||||||
|
* console.log('someone connected!');
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
||||||
|
*
|
||||||
|
* By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the
|
||||||
|
* event listener to the beginning of the listeners array.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const myEE = new EventEmitter();
|
||||||
|
* myEE.on('foo', () => console.log('a'));
|
||||||
|
* myEE.prependListener('foo', () => console.log('b'));
|
||||||
|
* myEE.emit('foo');
|
||||||
|
* // Prints:
|
||||||
|
* // b
|
||||||
|
* // a
|
||||||
|
* ```
|
||||||
|
* @since v0.1.101
|
||||||
|
* @param eventName The name of the event.
|
||||||
|
* @param listener The callback function
|
||||||
|
*/
|
||||||
|
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
/**
|
||||||
|
* Adds a **one-time**`listener` function for the event named `eventName`. The
|
||||||
|
* next time `eventName` is triggered, this listener is removed and then invoked.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* server.once('connection', (stream) => {
|
||||||
|
* console.log('Ah, we have our first user!');
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
||||||
|
*
|
||||||
|
* By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the
|
||||||
|
* event listener to the beginning of the listeners array.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const myEE = new EventEmitter();
|
||||||
|
* myEE.once('foo', () => console.log('a'));
|
||||||
|
* myEE.prependOnceListener('foo', () => console.log('b'));
|
||||||
|
* myEE.emit('foo');
|
||||||
|
* // Prints:
|
||||||
|
* // b
|
||||||
|
* // a
|
||||||
|
* ```
|
||||||
|
* @since v0.3.0
|
||||||
|
* @param eventName The name of the event.
|
||||||
|
* @param listener The callback function
|
||||||
|
*/
|
||||||
|
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
/**
|
||||||
|
* Removes the specified `listener` from the listener array for the event named`eventName`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const callback = (stream) => {
|
||||||
|
* console.log('someone connected!');
|
||||||
|
* };
|
||||||
|
* server.on('connection', callback);
|
||||||
|
* // ...
|
||||||
|
* server.removeListener('connection', callback);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* `removeListener()` will remove, at most, one instance of a listener from the
|
||||||
|
* listener array. If any single listener has been added multiple times to the
|
||||||
|
* listener array for the specified `eventName`, then `removeListener()` must be
|
||||||
|
* called multiple times to remove each instance.
|
||||||
|
*
|
||||||
|
* Once an event is emitted, all listeners attached to it at the
|
||||||
|
* time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and_before_ the last listener finishes execution will
|
||||||
|
* not remove them from`emit()` in progress. Subsequent events behave as expected.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const myEmitter = new MyEmitter();
|
||||||
|
*
|
||||||
|
* const callbackA = () => {
|
||||||
|
* console.log('A');
|
||||||
|
* myEmitter.removeListener('event', callbackB);
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* const callbackB = () => {
|
||||||
|
* console.log('B');
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* myEmitter.on('event', callbackA);
|
||||||
|
*
|
||||||
|
* myEmitter.on('event', callbackB);
|
||||||
|
*
|
||||||
|
* // callbackA removes listener callbackB but it will still be called.
|
||||||
|
* // Internal listener array at time of emit [callbackA, callbackB]
|
||||||
|
* myEmitter.emit('event');
|
||||||
|
* // Prints:
|
||||||
|
* // A
|
||||||
|
* // B
|
||||||
|
*
|
||||||
|
* // callbackB is now removed.
|
||||||
|
* // Internal listener array [callbackA]
|
||||||
|
* myEmitter.emit('event');
|
||||||
|
* // Prints:
|
||||||
|
* // A
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Because listeners are managed using an internal array, calling this will
|
||||||
|
* change the position indices of any listener registered _after_ the listener
|
||||||
|
* being removed. This will not impact the order in which listeners are called,
|
||||||
|
* but it means that any copies of the listener array as returned by
|
||||||
|
* the `emitter.listeners()` method will need to be recreated.
|
||||||
|
*
|
||||||
|
* When a single function has been added as a handler multiple times for a single
|
||||||
|
* event (as in the example below), `removeListener()` will remove the most
|
||||||
|
* recently added instance. In the example the `once('ping')`listener is removed:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const ee = new EventEmitter();
|
||||||
|
*
|
||||||
|
* function pong() {
|
||||||
|
* console.log('pong');
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* ee.on('ping', pong);
|
||||||
|
* ee.once('ping', pong);
|
||||||
|
* ee.removeListener('ping', pong);
|
||||||
|
*
|
||||||
|
* ee.emit('ping');
|
||||||
|
* ee.emit('ping');
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
||||||
|
* @since v0.1.26
|
||||||
|
*/
|
||||||
|
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
/**
|
||||||
|
* Alias for `emitter.removeListener()`.
|
||||||
|
* @since v10.0.0
|
||||||
|
*/
|
||||||
|
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
/**
|
||||||
|
* Removes all listeners, or those of the specified `eventName`.
|
||||||
|
*
|
||||||
|
* It is bad practice to remove listeners added elsewhere in the code,
|
||||||
|
* particularly when the `EventEmitter` instance was created by some other
|
||||||
|
* component or module (e.g. sockets or file streams).
|
||||||
|
*
|
||||||
|
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
||||||
|
* @since v0.1.26
|
||||||
|
*/
|
||||||
|
removeAllListeners(event?: string | symbol): this;
|
||||||
|
/**
|
||||||
|
* By default `EventEmitter`s will print a warning if more than `10` listeners are
|
||||||
|
* added for a particular event. This is a useful default that helps finding
|
||||||
|
* memory leaks. The `emitter.setMaxListeners()` method allows the limit to be
|
||||||
|
* modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners.
|
||||||
|
*
|
||||||
|
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
||||||
|
* @since v0.3.5
|
||||||
|
*/
|
||||||
|
setMaxListeners(n: number): this;
|
||||||
|
/**
|
||||||
|
* Returns the current max listener value for the `EventEmitter` which is either
|
||||||
|
* set by `emitter.setMaxListeners(n)` or defaults to {@link defaultMaxListeners}.
|
||||||
|
* @since v1.0.0
|
||||||
|
*/
|
||||||
|
getMaxListeners(): number;
|
||||||
|
/**
|
||||||
|
* Returns a copy of the array of listeners for the event named `eventName`.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* server.on('connection', (stream) => {
|
||||||
|
* console.log('someone connected!');
|
||||||
|
* });
|
||||||
|
* console.log(util.inspect(server.listeners('connection')));
|
||||||
|
* // Prints: [ [Function] ]
|
||||||
|
* ```
|
||||||
|
* @since v0.1.26
|
||||||
|
*/
|
||||||
|
listeners(eventName: string | symbol): Function[];
|
||||||
|
/**
|
||||||
|
* Returns a copy of the array of listeners for the event named `eventName`,
|
||||||
|
* including any wrappers (such as those created by `.once()`).
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const emitter = new EventEmitter();
|
||||||
|
* emitter.once('log', () => console.log('log once'));
|
||||||
|
*
|
||||||
|
* // Returns a new Array with a function `onceWrapper` which has a property
|
||||||
|
* // `listener` which contains the original listener bound above
|
||||||
|
* const listeners = emitter.rawListeners('log');
|
||||||
|
* const logFnWrapper = listeners[0];
|
||||||
|
*
|
||||||
|
* // Logs "log once" to the console and does not unbind the `once` event
|
||||||
|
* logFnWrapper.listener();
|
||||||
|
*
|
||||||
|
* // Logs "log once" to the console and removes the listener
|
||||||
|
* logFnWrapper();
|
||||||
|
*
|
||||||
|
* emitter.on('log', () => console.log('log persistently'));
|
||||||
|
* // Will return a new Array with a single function bound by `.on()` above
|
||||||
|
* const newListeners = emitter.rawListeners('log');
|
||||||
|
*
|
||||||
|
* // Logs "log persistently" twice
|
||||||
|
* newListeners[0]();
|
||||||
|
* emitter.emit('log');
|
||||||
|
* ```
|
||||||
|
* @since v9.4.0
|
||||||
|
*/
|
||||||
|
rawListeners(eventName: string | symbol): Function[];
|
||||||
|
/**
|
||||||
|
* Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments
|
||||||
|
* to each.
|
||||||
|
*
|
||||||
|
* Returns `true` if the event had listeners, `false` otherwise.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const EventEmitter = require('events');
|
||||||
|
* const myEmitter = new EventEmitter();
|
||||||
|
*
|
||||||
|
* // First listener
|
||||||
|
* myEmitter.on('event', function firstListener() {
|
||||||
|
* console.log('Helloooo! first listener');
|
||||||
|
* });
|
||||||
|
* // Second listener
|
||||||
|
* myEmitter.on('event', function secondListener(arg1, arg2) {
|
||||||
|
* console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
|
||||||
|
* });
|
||||||
|
* // Third listener
|
||||||
|
* myEmitter.on('event', function thirdListener(...args) {
|
||||||
|
* const parameters = args.join(', ');
|
||||||
|
* console.log(`event with parameters ${parameters} in third listener`);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* console.log(myEmitter.listeners('event'));
|
||||||
|
*
|
||||||
|
* myEmitter.emit('event', 1, 2, 3, 4, 5);
|
||||||
|
*
|
||||||
|
* // Prints:
|
||||||
|
* // [
|
||||||
|
* // [Function: firstListener],
|
||||||
|
* // [Function: secondListener],
|
||||||
|
* // [Function: thirdListener]
|
||||||
|
* // ]
|
||||||
|
* // Helloooo! first listener
|
||||||
|
* // event with parameters 1, 2 in second listener
|
||||||
|
* // event with parameters 1, 2, 3, 4, 5 in third listener
|
||||||
|
* ```
|
||||||
|
* @since v0.1.26
|
||||||
|
*/
|
||||||
|
emit(eventName: string | symbol, ...args: any[]): boolean;
|
||||||
|
/**
|
||||||
|
* Returns the number of listeners listening to the event named `eventName`.
|
||||||
|
* @since v3.2.0
|
||||||
|
* @param eventName The name of the event being listened for
|
||||||
|
*/
|
||||||
|
listenerCount(eventName: string | symbol): number;
|
||||||
|
/**
|
||||||
|
* Adds the `listener` function to the _beginning_ of the listeners array for the
|
||||||
|
* event named `eventName`. No checks are made to see if the `listener` has
|
||||||
|
* already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
|
||||||
|
* times.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* server.prependListener('connection', (stream) => {
|
||||||
|
* console.log('someone connected!');
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
||||||
|
* @since v6.0.0
|
||||||
|
* @param eventName The name of the event.
|
||||||
|
* @param listener The callback function
|
||||||
|
*/
|
||||||
|
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
/**
|
||||||
|
* Adds a **one-time**`listener` function for the event named `eventName` to the_beginning_ of the listeners array. The next time `eventName` is triggered, this
|
||||||
|
* listener is removed, and then invoked.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* server.prependOnceListener('connection', (stream) => {
|
||||||
|
* console.log('Ah, we have our first user!');
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
||||||
|
* @since v6.0.0
|
||||||
|
* @param eventName The name of the event.
|
||||||
|
* @param listener The callback function
|
||||||
|
*/
|
||||||
|
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
|
/**
|
||||||
|
* Returns an array listing the events for which the emitter has registered
|
||||||
|
* listeners. The values in the array are strings or `Symbol`s.
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* const EventEmitter = require('events');
|
||||||
|
* const myEE = new EventEmitter();
|
||||||
|
* myEE.on('foo', () => {});
|
||||||
|
* myEE.on('bar', () => {});
|
||||||
|
*
|
||||||
|
* const sym = Symbol('symbol');
|
||||||
|
* myEE.on(sym, () => {});
|
||||||
|
*
|
||||||
|
* console.log(myEE.eventNames());
|
||||||
|
* // Prints: [ 'foo', 'bar', Symbol(symbol) ]
|
||||||
|
* ```
|
||||||
|
* @since v6.0.0
|
||||||
|
*/
|
||||||
|
eventNames(): Array<string | symbol>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export = EventEmitter;
|
||||||
|
}
|
||||||
|
declare module 'node:events' {
|
||||||
|
import events = require('events');
|
||||||
|
export = events;
|
||||||
|
}
|
3799
node_modules/@types/node/fs.d.ts
generated
vendored
Normal file
3799
node_modules/@types/node/fs.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user